From a336e295f6666fe70fab68f55b6385b5e95a4d00 Mon Sep 17 00:00:00 2001 From: Tonio Date: Wed, 25 Nov 2026 11:16:24 -0800 Subject: [PATCH] feat(ui): turn Connectors into a Plugins marketplace (#22869) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Agents reach outside tools through connectors, which people add on the Connectors page > - That page is one long list. Each row mixes the catalog entry with its accounts, so it is hard to scan and hard to tell what is installed > - Some connectors also bring skills, but the page does not show them > - This pull request renames the page to Plugins and changes the browse view into a marketplace of small cards grouped by category. Each card opens a plugin page that holds the accounts, the skills and the tool permissions > - The benefit is a catalog that people can scan fast, with one place per connector for its accounts and its skills. Connector behavior does not change ## Linked Issues or Issue Description **Subsystem affected** UI: the Connectors (Apps catalog) pages under `ui/src/pages/apps/` and the navigation labels that point to them. **Problem or motivation** The Connectors browse page is a vertical list of large rows. A row shows the catalog entry and every account under it. People must expand rows to see what is connected. The page does not show which skills come with a connector. **Proposed solution** - Rename the page from Connectors to Plugins in the navigation, the breadcrumbs, and the page titles. A single app is still called a connector. - Remove the Browse / Review rail. The page header carries the title, a Review shortcut, and an Add menu for a custom MCP server, a pasted config, or an assistant connection. - Show the catalog as a marketplace under one "All" tab: "Most used" and "New and noteworthy" for first-party connectors, then one block per category. Composio and Arcade connectors sit in the same blocks. A block shows at most nine plugins, its total, and a "See all" link to a category page at `/apps/category/:categoryId`. - Use a compact card: logo, name, description, and one corner control. The control is a plus to connect, a check when connected, or a warning when an account needs attention. - Open a plugin page at `/apps/plugin/:pluginKey` from each card. The page has Connect in its header and groups Accounts, Connector, Skills, Tool permissions, and Information as blocks. Tool permissions shows a connected account's actions as Reads and Writes, each with a group policy and per-action policies. - Start sign-in straight from the card for a one-click connector: one OAuth method that Paperclip can start itself, with nothing to fill in and no warning to read. The success screen states who can use the connection and links to where that changes. - Search reads plugin titles only. - Keep the account list on the Installed filter. **Related pull requests** A search of open and closed pull requests for the Connectors browse page, a plugins or connectors marketplace, connector categories, and one-click sign-in found no duplicate. #22863 compresses connector logo files and does not overlap with these pages. **Alternatives considered** - An experimental setting that keeps the old page. The product owner chose to replace the page for everyone. - A new backend link between connectors and catalog skills. This pull request stays in the front end. The pairing for GitHub is a constant in `PluginSkills.tsx`. - Real categories for Composio apps. Its public catalog file has names only, so those apps are sorted by keywords in the name and the rest go to "Other". Arcade's catalog states a category, which is now carried through `AggregatorAppCatalogEntry.category`. ## What Changed - `Browse.tsx`: keeps all data loading, connect logic, and dialogs. The render now has five views: marketplace, category page, flat results grid, Installed list, and plugin page. The default source is `all`; the `paperclip` source is removed. - `PluginMarketplace.tsx` (new): `PluginTile`, `PluginShelf` (count and "See all"), `PluginCategories`, and the category labels. - `PluginsHeader.tsx` (new): page title, Review shortcut with the pending count, and the Add menu. - `PluginPageSections.tsx` (new): plugin page header, Connector row, and Information facts read from the app definition. - `PluginPermissions.tsx` (new): Reads and Writes blocks for a connected account. Saves go through `useConnectionPermissionSave` and restate agent access exactly as the per-connection page does. The four helpers it shares with that page moved from `AppDetail.tsx` to `app-detail/saved-permissions.ts` with no behavior change. - `PluginSkills.tsx` (new): lists built-in connector skills, skills that a connected server publishes, and paired catalog skills. "Add skill" calls the existing catalog install endpoint. - `plugin-categories.ts` (new): maps Arcade categories onto the Plugins categories and guesses a category from the name for apps that state none. - `features/connections/one-click-oauth.ts` (new): the one-click rule and the hand-over of the sign-in window from the card's click to the connect flow. A browser only opens that window during a click, so the card opens it and `ConnectionSetupFlow` takes it over. If the window is blocked, or the page is reloaded, the ordinary confirmation screen shows. - `ConnectionSetupFlow.tsx`: takes the handed-over window, starts sign-in when the app qualifies, and adds a "Change" link beside the stated default on the success screen. - `apps-rail.ts` (new), `AppsSidebar*.tsx`, `Layout*.tsx`: the marketplace pages have no second rail. Chat setup and detail keep theirs, and the developer pages keep one while a developer tab is on. - `ConnectorCard`: new `variant="page"` that renders the accounts as one block with "Add account" at the bottom. - `ConnectorsToolbar.tsx`: source filters first, a wider "Search plugins" field on the right. - `App.tsx`, `Layout.tsx`, `Layout.production.tsx`: new `apps/plugin/:pluginKey` and `apps/category/:categoryId` routes and reserved subpaths. - Navigation and breadcrumb labels: "Connectors" becomes "Plugins" in 19 files, and the instance plugin system becomes "System plugins". - `packages/shared/src/aggregator-app-catalog.ts`: optional `category` on a catalog entry, set from Arcade's catalog. - `ui/storybook/prototypes/ConnectorCatalogNavigation.tsx`: keeps its own five-source list so the older prototype still builds. - Tests: label renames in the specs and stories that named Connectors or "Search connectors". Seven specs now reach the custom-server setup through the Add menu. New specs: `one-click-connect`, `plugins-browse`. `apps-prosumer-mcp-flow` also covers the plugin page permissions and the success-screen link. Kept on purpose, so current flows and specs continue to work: the `Connector list` list label, `data-app-slug` and `data-connected` on each card, and the ` ` button names. ## Verification - `cd ui && pnpm typecheck`: pass. - `pnpm run check:token-gates`: pass. - `cd ui && npx vitest run`: 564 files, 7,059 tests pass, 1 skipped. - `cd packages/shared && npx vitest run src/aggregator-app-catalog.test.ts`: 9 tests pass. - `PAPERCLIP_RUNNER_BINARY=/usr/bin/true npx playwright test --config tests/e2e/playwright.config.ts` for the 15 spec files under `tests/e2e/*.spec.ts` that touch the Plugins pages, plus `one-click-connect` and `plugins-browse`: all pass (3 skipped by their own conditions). - Storybook: built this branch and master and ran the interaction tests of the 253 stories in the files that mount the browse page. Master passes 230; this branch passes the same 230. The 23 that fail do so on master too. - Manual: opened Plugins, a category page, a plugin page, the Installed filter, and Review on a local instance. - Not run locally: `execution-recovery/recovery.spec.ts`, `in-feed-native/connections.spec.ts`, the runner e2e tests, and the repo-wide typecheck (it needs the Rust toolchain). A real provider sign-in was not completed; the one-click test stops at the point the flow starts. `pnpm verify` exits 2 and names CI as the source of broad coverage. ## Risks - The page changes for every user. People who know the old list must learn the new layout. The Installed filter keeps the old account list. - The instance plugin system is renamed "System plugins" in the settings navigation, breadcrumbs, and its management page, so the two areas no longer share a name. URLs and lower-case mentions of "plugin" inside sentences are unchanged. - One-click connect skips the screen that states the access default ("Connects for everyone in your organization, available to all agents") and offers Change. The default is applied without being shown first; the success screen states it and links to the permissions page. - Most Composio apps (about 1,100 of 1,583) land in "Other", and the keyword guess is sometimes wrong. Correct categories need category data in the catalog file. - The plugin page can now save action permissions. It uses the same save path and access derivation as the per-connection page and waits for all four reads before it enables the controls. The account picker for several accounts and the read-only view have no test. - The Smoke Lab developer page has no link from the browse page; it is reachable by URL. - e2e specs that this pull request did not run locally can fail on selectors. CI must confirm them. - "New and noteworthy" is a fixed list in code. The catalog has no date to sort by. - Skill pairing is a front-end constant. Nothing records that a skill came from a connector, so removing a connector does not remove the skill. - The per-connection permissions page is not restyled in this pull request. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude Fable 5.2 (`claude-fable-5-2`) through Claude Code, with tool use, code execution, and subagents for read-only code search. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [ ] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [ ] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [ ] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 --- packages/shared/src/aggregator-app-catalog.ts | 9 +- .../connection-pools.spec.ts | 2 +- tests/e2e/agentmail.spec.ts | 4 +- tests/e2e/applications-crud.spec.ts | 8 +- tests/e2e/apps-prosumer-mcp-flow.spec.ts | 38 +- ...chat-adapters-ui-providers-catalog.spec.ts | 4 +- tests/e2e/chat-adapters-ui-providers.spec.ts | 6 +- tests/e2e/connection-intents.spec.ts | 10 +- tests/e2e/connection-reviews.spec.ts | 12 +- tests/e2e/daytona-connector.spec.ts | 4 +- tests/e2e/execution-recovery/recovery.spec.ts | 12 +- tests/e2e/in-feed-native/connections.spec.ts | 5 +- tests/e2e/mcp-user-stories.spec.ts | 2 +- tests/e2e/one-click-connect.spec.ts | 28 ++ tests/e2e/plugins-browse.spec.ts | 57 +++ tests/e2e/smoke-lab.shared.ts | 2 +- tests/e2e/unikraft-connector.spec.ts | 4 +- .../external-held-gateway.test.ts | 27 +- .../external-mcp-failure.ts | 16 +- tests/runner-e2e/connection-flow.ts | 2 +- tests/runner-e2e/connection-reviews.ts | 12 +- tests/runner-e2e/github-review-flow.ts | 2 +- .../runner-e2e/source-sdk-public-inputs.json | 2 +- tests/speko-native/live-browser.mjs | 2 +- .../feature-gap-render-states.ts | 2 +- ui/src/App.tsx | 2 + ui/src/components/AppsSidebar.production.tsx | 16 +- ui/src/components/AppsSidebar.tsx | 54 +-- .../CompanySettingsSidebar.production.tsx | 2 +- ui/src/components/CompanySettingsSidebar.tsx | 2 +- ui/src/components/CoordinatorSidebar.tsx | 2 +- ui/src/components/DesignSidebar.tsx | 2 +- ui/src/components/Layout.production.tsx | 5 +- ui/src/components/Layout.tsx | 9 +- ui/src/components/Sidebar.production.tsx | 2 +- ui/src/components/Sidebar.tsx | 4 +- .../components/access/CompanySettingsNav.tsx | 2 +- .../AiConnectionPoolConnector.tsx | 2 +- .../connections/ConnectionSetupFlow.tsx | 252 ++++++----- .../connections/one-click-oauth.test.ts | 55 +++ .../features/connections/one-click-oauth.ts | 85 ++++ ui/src/pages/PluginManager.tsx | 16 +- ui/src/pages/PluginPage.tsx | 2 +- ui/src/pages/PluginSettings.tsx | 2 +- ui/src/pages/apps/AppDetail.tsx | 63 +-- ui/src/pages/apps/AppNotConnected.tsx | 2 +- ui/src/pages/apps/AppsReview.tsx | 10 +- ui/src/pages/apps/AssistantConnection.tsx | 2 +- .../pages/apps/Browse.pluginTileState.test.ts | 33 ++ ui/src/pages/apps/Browse.tsx | 426 +++++++++++------- ui/src/pages/apps/CatalogSourceFilters.tsx | 4 +- ui/src/pages/apps/Connections.tsx | 2 +- ui/src/pages/apps/ConnectorsToolbar.tsx | 10 +- ui/src/pages/apps/PluginMarketplace.tsx | 188 ++++++++ ui/src/pages/apps/PluginPageSections.test.ts | 20 + ui/src/pages/apps/PluginPageSections.tsx | 169 +++++++ ui/src/pages/apps/PluginPermissions.test.ts | 20 + ui/src/pages/apps/PluginPermissions.tsx | 253 +++++++++++ ui/src/pages/apps/PluginSkills.test.tsx | 72 +++ ui/src/pages/apps/PluginSkills.tsx | 155 +++++++ ui/src/pages/apps/PluginsHeader.test.tsx | 29 ++ ui/src/pages/apps/PluginsHeader.tsx | 67 +++ ui/src/pages/apps/TailscaleConnector.tsx | 2 +- .../apps/app-detail/saved-permissions.ts | 63 +++ ui/src/pages/apps/apps-rail.test.ts | 27 ++ ui/src/pages/apps/apps-rail.ts | 15 + ui/src/pages/apps/chat/ChatEndpointDetail.tsx | 2 +- ui/src/pages/apps/chat/ChatEndpointSetup.tsx | 4 +- ui/src/pages/apps/chat/GitHubChatSetup.tsx | 2 +- ui/src/pages/apps/gateways/GatewayDetail.tsx | 2 +- ui/src/pages/apps/gateways/GatewaysList.tsx | 2 +- ui/src/pages/apps/plugin-categories.test.ts | 21 + ui/src/pages/apps/plugin-categories.ts | 39 ++ .../prototypes/ConnectorCatalogNavigation.tsx | 9 +- .../github-connections.stories.tsx | 2 +- .../public-mcp-journey.stories.tsx | 4 +- .../plugins/plugin-management.stories.tsx | 2 +- .../runs-adapters/ai-connections.stories.tsx | 14 +- 78 files changed, 1989 insertions(+), 534 deletions(-) create mode 100644 tests/e2e/one-click-connect.spec.ts create mode 100644 tests/e2e/plugins-browse.spec.ts create mode 100644 ui/src/features/connections/one-click-oauth.test.ts create mode 100644 ui/src/features/connections/one-click-oauth.ts create mode 100644 ui/src/pages/apps/Browse.pluginTileState.test.ts create mode 100644 ui/src/pages/apps/PluginMarketplace.tsx create mode 100644 ui/src/pages/apps/PluginPageSections.test.ts create mode 100644 ui/src/pages/apps/PluginPageSections.tsx create mode 100644 ui/src/pages/apps/PluginPermissions.test.ts create mode 100644 ui/src/pages/apps/PluginPermissions.tsx create mode 100644 ui/src/pages/apps/PluginSkills.test.tsx create mode 100644 ui/src/pages/apps/PluginSkills.tsx create mode 100644 ui/src/pages/apps/PluginsHeader.test.tsx create mode 100644 ui/src/pages/apps/PluginsHeader.tsx create mode 100644 ui/src/pages/apps/app-detail/saved-permissions.ts create mode 100644 ui/src/pages/apps/apps-rail.test.ts create mode 100644 ui/src/pages/apps/apps-rail.ts create mode 100644 ui/src/pages/apps/plugin-categories.test.ts create mode 100644 ui/src/pages/apps/plugin-categories.ts diff --git a/packages/shared/src/aggregator-app-catalog.ts b/packages/shared/src/aggregator-app-catalog.ts index d6778b07a41..83d0009b850 100644 --- a/packages/shared/src/aggregator-app-catalog.ts +++ b/packages/shared/src/aggregator-app-catalog.ts @@ -15,6 +15,8 @@ export interface AggregatorAppCatalogEntry { name: string; aliases: string[]; routes: AggregatorAppRoute[]; + /** The provider's own category for the app, when its public catalog states one. */ + category?: string; } // The public catalogs use different brand names for these same services. @@ -35,10 +37,11 @@ export function aggregatorAppIdentity(value: string): string { } const entries = new Map(); -function add(name: string, slug: string, aliases: string[], route: AggregatorAppRoute) { +function add(name: string, slug: string, aliases: string[], route: AggregatorAppRoute, category?: string) { const identity = aggregatorAppIdentity(name); const existing = entries.get(identity); if (existing) { + existing.category ??= category; existing.aliases = [...new Set([...existing.aliases, name, slug, ...aliases])]; // Prefer the ordinary toolkit over an API/MCP variant from the same provider. if (!existing.routes.some((candidate) => candidate.provider === route.provider)) { @@ -46,7 +49,7 @@ function add(name: string, slug: string, aliases: string[], route: AggregatorApp } return; } - entries.set(identity, { slug, name: name.replace(/\s+(MCP|API)$/i, ""), aliases, routes: [route] }); + entries.set(identity, { slug, name: name.replace(/\s+(MCP|API)$/i, ""), aliases, routes: [route], ...(category ? { category } : {}) }); } for (const [toolkit, name] of composio.toolkits) { @@ -59,7 +62,7 @@ for (const [toolkit, name] of composio.toolkits) { for (const app of arcade.apps) { add(app.name, app.slug, app.aliases, { provider: "arcade", toolkit: app.toolkit, logoUrl: app.logoUrl, docsUrl: app.docsUrl, - }); + }, app.category); } export const AGGREGATOR_APP_CATALOG = [...entries.values()].sort((a, b) => diff --git a/tests/ai-connections-app/connection-pools.spec.ts b/tests/ai-connections-app/connection-pools.spec.ts index e90135ce171..5019742e306 100644 --- a/tests/ai-connections-app/connection-pools.spec.ts +++ b/tests/ai-connections-app/connection-pools.spec.ts @@ -52,7 +52,7 @@ test("native catalog setup, account edits, conflicts and removal persist through let poolId: string | undefined; try { await page.goto(`/${prefix}/dashboard`); - await page.getByRole("link", { name: "Connectors", exact: true }).click(); + await page.getByRole("link", { name: "Plugins", exact: true }).click(); await page.getByRole("button", { name: `Add connection pool ${connector.name}`, exact: true }).click(); await expect(page.getByRole("heading", { name: "Add a connection pool", exact: true })).toBeVisible(); await expect(page.getByRole("button", { name: "Continue", exact: true })).toBeDisabled(); diff --git a/tests/e2e/agentmail.spec.ts b/tests/e2e/agentmail.spec.ts index 4d1bbd1b522..9b85a4b88df 100644 --- a/tests/e2e/agentmail.spec.ts +++ b/tests/e2e/agentmail.spec.ts @@ -261,7 +261,9 @@ test("AgentMail setup and email work through the normal task conversation", asyn await expect(page.getByRole("heading", { name: "Your agent’s email is ready" })).toHaveCount(0); await page.screenshot({ path: test.info().outputPath("agentmail-permission-denied.png"), fullPage: true }); await page.getByRole("button", { name: "More workspace pages", exact: true }).click(); - await page.getByRole("link", { name: "Connectors", exact: true }).click(); + await page.getByRole("link", { name: "Plugins", exact: true }).click(); + // Account rows, including one waiting on setup, are listed under Installed. + await page.getByRole("radio", { name: "Installed", exact: true }).click(); await page.getByRole("button", { name: "Finish setup", exact: true }).click(); await expect(page.getByText("mail-agent-free@verified.example.test", { exact: true })).toBeVisible(); await expect(addressField).toHaveCount(0); diff --git a/tests/e2e/applications-crud.spec.ts b/tests/e2e/applications-crud.spec.ts index a2449649864..114e6f283bd 100644 --- a/tests/e2e/applications-crud.spec.ts +++ b/tests/e2e/applications-crud.spec.ts @@ -56,7 +56,7 @@ async function createConnection( async function gotoApps(page: Page, prefix: string) { await page.goto(`/${prefix}/apps/connections`); - await expect(page.getByRole("heading", { name: "Connectors" })).toBeVisible({ timeout: 30_000 }); + await expect(page.getByRole("heading", { name: "Plugins" })).toBeVisible({ timeout: 30_000 }); } test.describe.serial("applications lifecycle", () => { @@ -97,8 +97,6 @@ test.describe.serial("applications lifecycle", () => { .filter({ has: page.getByRole("heading", { name: connectedName, exact: true }) }); await expect(connectedRow).toBeVisible(); await expect(connectedRow.getByText(/^(Connected|Needs attention)$/)).toBeVisible({ timeout: 30_000 }); - const openConnection = connectedRow.getByRole("button", { name: /^Open .* permissions$/ }); - await expect(openConnection).toBeVisible(); // The not-connected app has no connection, so the health sweep never touches // it and its Connect action stay deterministic. @@ -110,6 +108,10 @@ test.describe.serial("applications lifecycle", () => { await expect(notConnectedRow.getByRole("button", { name: `Connect ${notConnectedName}` })).toBeVisible(); await page.screenshot({ path: `${SCREENSHOT_DIR}/applications-crud-current-list.png`, fullPage: true }); + // Accounts live on the plugin's own page, one click in from the catalog. + await connectedRow.getByRole("button", { name: connectedName, exact: true }).click(); + const openConnection = page.getByRole("button", { name: /^Open .* permissions$/ }); + await expect(openConnection).toBeVisible(); await openConnection.click(); await expect(page).toHaveURL( new RegExp(`/${seed.prefix}/apps/${connected.id}/permissions$`), diff --git a/tests/e2e/apps-prosumer-mcp-flow.spec.ts b/tests/e2e/apps-prosumer-mcp-flow.spec.ts index 36f0698944a..87fb10942dc 100644 --- a/tests/e2e/apps-prosumer-mcp-flow.spec.ts +++ b/tests/e2e/apps-prosumer-mcp-flow.spec.ts @@ -115,13 +115,9 @@ async function gotoApps(page: Page, prefix: string) { async function gotoConnect(page: Page, prefix: string) { await page.goto(`/${prefix}/apps`); - await expect(page.getByRole("heading", { name: "Connectors" })).toBeVisible({ timeout: 30_000 }); - const customConnector = page - .getByRole("list", { name: "Connector list" }) - .getByRole("listitem") - .filter({ hasText: "Connect your own tool" }); - await customConnector.getByRole("button", { name: "Connect", exact: true }).click(); - await customConnector.getByRole("button", { name: "Connect your own MCP server" }).click(); + await expect(page.getByRole("heading", { name: "Plugins" })).toBeVisible({ timeout: 30_000 }); + await page.getByRole("button", { name: "Add", exact: true }).click(); + await page.getByRole("menuitem", { name: /MCP server URL/ }).click(); } async function gotoAdvanced(page: Page, prefix: string) { @@ -173,6 +169,8 @@ test.describe.serial("prosumer MCP flow prosumer MCP flow", () => { // A successful generic probe commits discovered actions and the stated // access defaults transactionally, so the key check lands on success. await expect(page.getByRole("heading", { name: /is ready\.$/i })).toBeVisible({ timeout: 30_000 }); + // The success screen restates who can use the connection and links to where that changes. + await expect(page.getByRole("button", { name: "Change", exact: true })).toBeVisible(); await page.screenshot({ path: `${SCREENSHOT_DIR}/prosumer-mcp-05-success.png`, fullPage: true }); // Verify the mock saw a tools/list call from the catalog refresh. @@ -212,6 +210,30 @@ test.describe.serial("prosumer MCP flow prosumer MCP flow", () => { await expect(page.getByText("List widgets", { exact: true })).toBeVisible(); await expect(page.getByText("Create widget", { exact: true })).toBeVisible(); await page.screenshot({ path: `${SCREENSHOT_DIR}/prosumer-mcp-06-permissions.png`, fullPage: true }); + + // The plugin page shows the same actions as two blocks and saves a group change in one step. + await gotoApps(page, seed.prefix); + await page + .getByRole("list", { name: "Connector list" }) + .getByRole("listitem") + .filter({ hasText: mockPort }) + .getByRole("heading") + .getByRole("button") + .click(); + const permissions = page.getByRole("region", { name: "Tool permissions" }); + const reads = permissions.getByRole("button", { name: /^Reads\s*1$/ }); + const writes = permissions.getByRole("button", { name: /^Writes\s*1$/ }); + await expect(reads).toBeVisible({ timeout: 30_000 }); + await expect(writes).toBeVisible(); + await writes.click(); + await expect(permissions.getByText("Create widget", { exact: true })).toBeVisible(); + await permissions.getByRole("button", { name: /^All writes: / }).click(); + await page.getByRole("menuitemradio", { name: "Off", exact: true }).click(); + await expect(permissions.getByRole("button", { name: "All writes: Off" })).toBeVisible({ timeout: 15_000 }); + await page.reload(); + await expect(page.getByRole("region", { name: "Tool permissions" }).getByRole("button", { name: "All writes: Off" })).toBeVisible({ timeout: 30_000 }); + await expect(page.getByRole("region", { name: "Tool permissions" }).getByRole("button", { name: /^All reads: Allowed$/ })).toBeVisible(); + await page.screenshot({ path: `${SCREENSHOT_DIR}/prosumer-mcp-07-plugin-permissions.png`, fullPage: true }); }); test("Expired key → health sweep → Needs attention → reconnect → green", async ({ page, request }) => { @@ -248,7 +270,7 @@ test.describe.serial("prosumer MCP flow prosumer MCP flow", () => { // Needs-attention page should surface this connection. await gotoNeedsAttention(page, seed.prefix); - await expect(page.getByRole("heading", { name: "Connectors" })).toBeVisible({ timeout: 30_000 }); + await expect(page.getByRole("heading", { name: "Plugins" })).toBeVisible({ timeout: 30_000 }); await expect(page.getByText("Needs attention", { exact: true }).first()).toBeVisible({ timeout: 30_000 }); await page.screenshot({ path: `${SCREENSHOT_DIR}/prosumer-mcp-07-needs-attention.png`, fullPage: true }); diff --git a/tests/e2e/chat-adapters-ui-providers-catalog.spec.ts b/tests/e2e/chat-adapters-ui-providers-catalog.spec.ts index 97e7a0c62c4..c18328ddf69 100644 --- a/tests/e2e/chat-adapters-ui-providers-catalog.spec.ts +++ b/tests/e2e/chat-adapters-ui-providers-catalog.spec.ts @@ -18,7 +18,7 @@ import { } from "./chat-adapters-ui.shared"; async function findConnectorBySearch(page: Page, query: string, slug: string) { - const search = page.getByRole("searchbox", { name: "Search connectors" }); + const search = page.getByRole("searchbox", { name: "Search plugins" }); await expect(search).toBeVisible(); await search.fill(query); const connector = page.locator(`[role="listitem"][data-app-slug="${slug}"]`); @@ -156,7 +156,7 @@ test.describe("native chat adapter UI catalog and management", () => { await page.goto(`/${seed.prefix}/apps`); await expect( - page.getByRole("heading", { name: "Connectors" }), + page.getByRole("heading", { name: "Plugins" }), ).toBeVisible({ timeout: 30_000 }); let connector = await findConnectorBySearch(page, provider.name, provider.slug); if (provider.provider === "github") { diff --git a/tests/e2e/chat-adapters-ui-providers.spec.ts b/tests/e2e/chat-adapters-ui-providers.spec.ts index e04df4d0774..33e79185a20 100644 --- a/tests/e2e/chat-adapters-ui-providers.spec.ts +++ b/tests/e2e/chat-adapters-ui-providers.spec.ts @@ -29,7 +29,7 @@ async function expectCompletedSlackSetupCloses(page: Page, seed: Seed) { } async function findConnectorBySearch(page: Page, query: string, slug: string) { - const search = page.getByRole("searchbox", { name: "Search connectors" }); + const search = page.getByRole("searchbox", { name: "Search plugins" }); await expect(search).toBeVisible(); await search.fill(query); const connector = page.locator(`[role="listitem"][data-app-slug="${slug}"]`); @@ -342,7 +342,7 @@ test.describe("native chat adapter UI", () => { }); await page.goto(`/${seed.prefix}/apps`); - await expect(page.getByRole("heading", { name: "Connectors" })).toBeVisible( + await expect(page.getByRole("heading", { name: "Plugins" })).toBeVisible( { timeout: 30_000 }, ); const connector = await findConnectorBySearch(page, "GitHub", "github"); @@ -367,7 +367,7 @@ test.describe("native chat adapter UI", () => { await page.goto(`/${seed.prefix}/apps/chat/connect?provider=github`); await expect(page).toHaveURL(new RegExp(`/${seed.prefix}/apps$`)); await expect( - page.getByRole("heading", { name: "Connectors" }), + page.getByRole("heading", { name: "Plugins" }), ).toBeVisible(); await page.goto(`/${seed.prefix}/apps/chat/endpoint-github/settings`); await expect(page).toHaveURL(new RegExp(`/${seed.prefix}/apps$`)); diff --git a/tests/e2e/connection-intents.spec.ts b/tests/e2e/connection-intents.spec.ts index a2b37a9c4d8..843da774d0a 100644 --- a/tests/e2e/connection-intents.spec.ts +++ b/tests/e2e/connection-intents.spec.ts @@ -288,15 +288,11 @@ test("store setup and task connection intent share one fake provider through con // Entry point one: connect and test the provider through the Connections store. await page.goto(`/${seed.prefix}/apps`); - await expect(page.getByRole("heading", { name: "Connectors" })).toBeVisible({ + await expect(page.getByRole("heading", { name: "Plugins" })).toBeVisible({ timeout: 30_000, }); - const customConnector = page - .getByRole("list", { name: "Connector list" }) - .getByRole("listitem") - .filter({ hasText: "Connect your own tool" }); - await customConnector.getByRole("button", { name: "Connect", exact: true }).click(); - await customConnector.getByRole("button", { name: "Connect your own MCP server" }).click(); + await page.getByRole("button", { name: "Add", exact: true }).click(); + await page.getByRole("menuitem", { name: /MCP server URL/ }).click(); await page .getByPlaceholder("https://example.com/actions") .fill(provider.url); diff --git a/tests/e2e/connection-reviews.spec.ts b/tests/e2e/connection-reviews.spec.ts index 753ac9e4814..54dcc1107d2 100644 --- a/tests/e2e/connection-reviews.spec.ts +++ b/tests/e2e/connection-reviews.spec.ts @@ -142,16 +142,8 @@ for (const journey of [ let connectionId: string; if (fullUiSetup) { await page.goto(`/${seed.prefix}/apps`); - const connector = page - .getByRole("list", { name: "Connector list" }) - .getByRole("listitem") - .filter({ hasText: "Connect your own tool" }); - await connector - .getByRole("button", { name: "Connect", exact: true }) - .click(); - await connector - .getByRole("button", { name: "Connect your own MCP server" }) - .click(); + await page.getByRole("button", { name: "Add", exact: true }).click(); + await page.getByRole("menuitem", { name: /MCP server URL/ }).click(); await page .getByPlaceholder("https://example.com/actions") .fill(provider.url); diff --git a/tests/e2e/daytona-connector.spec.ts b/tests/e2e/daytona-connector.spec.ts index b8062f91efa..f1eb9e1df0e 100644 --- a/tests/e2e/daytona-connector.spec.ts +++ b/tests/e2e/daytona-connector.spec.ts @@ -5,8 +5,8 @@ test("Daytona uses the ordinary access and credential wizard", async ({ page, re expect(response.ok()).toBe(true); const company = await response.json(); await page.goto(`/${company.issuePrefix}/apps`); - await expect(page.getByRole("heading", { name: "Connectors", exact: true })).toBeVisible(); - await page.getByRole("searchbox", { name: "Search connectors" }).fill("Daytona"); + await expect(page.getByRole("heading", { name: "Plugins", exact: true })).toBeVisible(); + await page.getByRole("searchbox", { name: "Search plugins" }).fill("Daytona"); const card = page.getByRole("list", { name: "Connector list" }).getByRole("listitem").filter({ hasText: "Daytona" }); await expect(card).toHaveCount(1); // App marks are decorative (empty alt), so they have no accessible img role. diff --git a/tests/e2e/execution-recovery/recovery.spec.ts b/tests/e2e/execution-recovery/recovery.spec.ts index 18ca0b85faf..2395bafb883 100644 --- a/tests/e2e/execution-recovery/recovery.spec.ts +++ b/tests/e2e/execution-recovery/recovery.spec.ts @@ -308,16 +308,8 @@ for (const journey of [ const connections: Record = {}; for (const service of ["notion", "gmail"]) { await page.goto(base + prefix + "/apps"); - const custom = page - .getByRole("list", { name: "Connector list" }) - .getByRole("listitem") - .filter({ hasText: "Connect your own tool" }); - await custom - .getByRole("button", { name: "Connect", exact: true }) - .click(); - await custom - .getByRole("button", { name: "Connect your own MCP server" }) - .click(); + await page.getByRole("button", { name: "Add", exact: true }).click(); + await page.getByRole("menuitem", { name: /MCP server URL/ }).click(); await page .getByPlaceholder("https://example.com/actions") .fill(`http://127.0.0.1:${port}/${service}`); diff --git a/tests/e2e/in-feed-native/connections.spec.ts b/tests/e2e/in-feed-native/connections.spec.ts index 5b3f124cfc8..224a1c0cfe2 100644 --- a/tests/e2e/in-feed-native/connections.spec.ts +++ b/tests/e2e/in-feed-native/connections.spec.ts @@ -66,9 +66,8 @@ for (const journey of ['connect', 'decline', 'restart'] as const) test(`fresh na expect(nativeAgent.adapterConfig.env).toEqual(agent.adapterConfig.env); const holder = await api(`/companies/${company.id}/agents`, 'POST', { name: 'Archive holder', role: 'qa', adapterType: 'process', adapterConfig: { command: process.execPath, args: ['-e', 'process.exit(0)'] } }); await page.goto(base + prefix + '/apps'); - const custom = page.getByRole('list', { name: 'Connector list' }).getByRole('listitem').filter({ hasText: 'Connect your own tool' }); - await custom.getByRole('button', { name: 'Connect', exact: true }).click(); - await custom.getByRole('button', { name: 'Connect your own MCP server' }).click(); + await page.getByRole('button', { name: 'Add', exact: true }).click(); + await page.getByRole('menuitem', { name: /MCP server URL/ }).click(); await page.getByPlaceholder('https://example.com/actions').fill(`http://127.0.0.1:${port}/`); await page.getByRole('button', { name: 'Continue', exact: true }).click(); await page.getByRole('button', { name: 'Change', exact: true }).click(); diff --git a/tests/e2e/mcp-user-stories.spec.ts b/tests/e2e/mcp-user-stories.spec.ts index 2585bc1a147..a1312f540a1 100644 --- a/tests/e2e/mcp-user-stories.spec.ts +++ b/tests/e2e/mcp-user-stories.spec.ts @@ -414,7 +414,7 @@ test.describe.serial("MCP prod Phase 5a user-story harness", () => { const health = await request.post(`/api/tool-connections/${connectionId}/health-check`); expect(health.status()).toBe(502); await page.goto(`/${seed.prefix}/apps/connections`); - await expect(page.getByRole("heading", { name: "Connectors" })).toBeVisible({ timeout: 30_000 }); + await expect(page.getByRole("heading", { name: "Plugins" })).toBeVisible({ timeout: 30_000 }); await screenshot(page, "US-8", "01-needs-attention"); const recovered = await startMockMcp(); diff --git a/tests/e2e/one-click-connect.spec.ts b/tests/e2e/one-click-connect.spec.ts new file mode 100644 index 00000000000..6aa8d98b2c4 --- /dev/null +++ b/tests/e2e/one-click-connect.spec.ts @@ -0,0 +1,28 @@ +import { expect, test } from "@playwright/test"; + +test("a one-click connector starts sign-in from its card, skipping the confirmation screen", async ({ page, request }) => { + const res = await request.post("/api/companies", { data: { name: `one-click connect ${Date.now()}` } }); + expect(res.ok(), `create company failed ${res.status()}: ${await res.text()}`).toBe(true); + const company = await res.json(); + const prefix = company.issuePrefix ?? company.prefix ?? company.urlKey ?? "E2E"; + try { + await page.goto(`/${prefix}/apps`); + await page.getByRole("searchbox", { name: "Search plugins" }).fill("Notion"); + const popupOpened = page.waitForEvent("popup"); + await page.getByRole("button", { name: "Connect Notion", exact: true }).click(); + const popup = await popupOpened; + + // The flow takes over the window the card opened and starts on its own, + // so the "Continue to Notion" confirmation never shows. + await expect(page).toHaveURL(new RegExp(`/${prefix}/apps/connect\\?source=notion`), { timeout: 20_000 }); + await expect(page.getByRole("heading", { name: /Preparing secure sign-in|Opening Notion|Notion couldn’t connect/ })).toBeVisible({ timeout: 20_000 }); + await expect(page.getByRole("button", { name: "Continue to Notion" })).toHaveCount(0); + await popup.close().catch(() => undefined); + + // Without a window from a click, a reload falls back to the confirmation screen. + await page.reload(); + await expect(page.getByRole("button", { name: "Continue to Notion" })).toBeVisible({ timeout: 20_000 }); + } finally { + await request.delete(`/api/companies/${company.id}`).catch(() => undefined); + } +}); diff --git a/tests/e2e/plugins-browse.spec.ts b/tests/e2e/plugins-browse.spec.ts new file mode 100644 index 00000000000..a429dbb1bd6 --- /dev/null +++ b/tests/e2e/plugins-browse.spec.ts @@ -0,0 +1,57 @@ +import { expect, test } from "@playwright/test"; + +test("browse shows capped category blocks that open a full category page", async ({ page, request }) => { + const res = await request.post("/api/companies", { data: { name: `plugins browse ${Date.now()}` } }); + expect(res.ok(), `create company failed ${res.status()}: ${await res.text()}`).toBe(true); + const company = await res.json(); + const prefix = company.issuePrefix ?? company.prefix ?? company.urlKey ?? "E2E"; + try { + await page.goto(`/${prefix}/apps`); + await expect(page.getByRole("radio", { name: "All", exact: true })).toBeChecked({ timeout: 30_000 }); + await expect(page.getByRole("radio", { name: "Paperclip", exact: true })).toHaveCount(0); + await expect(page.getByRole("region", { name: "Most used" })).toBeVisible(); + + // A category block holds at most nine plugins, states its full size and links to the rest. + const block = page.getByRole("region", { name: /^Developer tools \([\d,]+\)$/ }); + await expect(block).toBeVisible(); + await expect(block.getByRole("listitem")).toHaveCount(9); + const total = Number((await block.getByRole("heading", { level: 2 }).textContent())?.match(/\(([\d,]+)\)/)?.[1].replace(/,/g, "")); + expect(total).toBeGreaterThan(9); + + await block.getByRole("button", { name: "See all Developer tools" }).click(); + await expect(page).toHaveURL(new RegExp(`/${prefix}/apps/category/developer$`)); + await expect(page.getByText(`Developer tools (${total.toLocaleString("en-US")})`)).toBeVisible(); + await expect(page.getByRole("list", { name: "Connector list" }).getByRole("listitem").nth(9)).toBeVisible(); + await expect(page.getByRole("radio", { name: "All", exact: true })).toHaveCount(0); + + // The Categories list has no counts and opens the same pages. + await page.getByRole("button", { name: "Plugins", exact: true }).click(); + const categories = page.getByRole("navigation", { name: "Categories" }); + await expect(categories.getByRole("button", { name: "Commerce", exact: true })).toBeVisible(); + await categories.getByRole("button", { name: "Commerce", exact: true }).click(); + await expect(page).toHaveURL(new RegExp(`/${prefix}/apps/category/commerce$`)); + } finally { + await request.delete(`/api/companies/${company.id}`).catch(() => undefined); + } +}); + +test("search matches plugin titles, not their descriptions", async ({ page, request }) => { + const res = await request.post("/api/companies", { data: { name: `plugins search ${Date.now()}` } }); + expect(res.ok(), `create company failed ${res.status()}: ${await res.text()}`).toBe(true); + const company = await res.json(); + const prefix = company.issuePrefix ?? company.prefix ?? company.urlKey ?? "E2E"; + try { + await page.goto(`/${prefix}/apps`); + const search = page.getByRole("searchbox", { name: "Search plugins" }); + const tiles = page.getByRole("list", { name: "Connector list" }).getByRole("listitem"); + + await search.fill("GitHub"); + await expect(tiles.filter({ has: page.getByRole("heading", { name: "GitHub", exact: true }) })).toBeVisible({ timeout: 30_000 }); + + // "repositories" appears only in GitHub's description, so it no longer finds GitHub. + await search.fill("repositories"); + await expect(tiles.filter({ has: page.getByRole("heading", { name: "GitHub", exact: true }) })).toHaveCount(0); + } finally { + await request.delete(`/api/companies/${company.id}`).catch(() => undefined); + } +}); diff --git a/tests/e2e/smoke-lab.shared.ts b/tests/e2e/smoke-lab.shared.ts index 489e5ff1e88..6eca5eb7c67 100644 --- a/tests/e2e/smoke-lab.shared.ts +++ b/tests/e2e/smoke-lab.shared.ts @@ -166,7 +166,7 @@ async function navigateForEvidence(page: Page, seed: Seed, connectionId: string, } if (scenario.uiEntryPath === "attention") { await page.goto(`/${seed.prefix}/apps/connections`); - await expect(page.getByRole("heading", { name: "Connectors" })).toBeVisible({ timeout: 20_000 }); + await expect(page.getByRole("heading", { name: "Plugins" })).toBeVisible({ timeout: 20_000 }); return; } await page.goto(`/${seed.prefix}/apps/${connectionId}`); diff --git a/tests/e2e/unikraft-connector.spec.ts b/tests/e2e/unikraft-connector.spec.ts index eba676cf29e..c3f0cc7b7ee 100644 --- a/tests/e2e/unikraft-connector.spec.ts +++ b/tests/e2e/unikraft-connector.spec.ts @@ -5,8 +5,8 @@ test("Unikraft uses the ordinary access and credential wizard", async ({ page, r expect(response.ok()).toBe(true); const company = await response.json(); await page.goto(`/${company.issuePrefix}/apps`); - await expect(page.getByRole("heading", { name: "Connectors", exact: true })).toBeVisible(); - await page.getByRole("searchbox", { name: "Search connectors" }).fill("Unikraft"); + await expect(page.getByRole("heading", { name: "Plugins", exact: true })).toBeVisible(); + await page.getByRole("searchbox", { name: "Search plugins" }).fill("Unikraft"); const card = page.getByRole("list", { name: "Connector list" }).getByRole("listitem").filter({ hasText: "Unikraft" }); await expect(card).toHaveCount(1); // App marks are decorative (empty alt), so they have no accessible img role. diff --git a/tests/runner-e2e/chat-catalog-domains/external-held-gateway.test.ts b/tests/runner-e2e/chat-catalog-domains/external-held-gateway.test.ts index d4abbab4f89..2e4c43ec810 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-held-gateway.test.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-held-gateway.test.ts @@ -9,12 +9,13 @@ import type { ExternalObservation } from "./external-support.js"; function pageFixture(missing?: string, connectorsInFlyout = false) { const actions: string[] = []; const page = { - getByRole: (role: string, options?: { name?: string }) => { - const name = options?.name ?? ""; + getByRole: (role: string, options?: { name?: string | RegExp }) => { + // The Add menu's custom-server item is matched by pattern; record its source. + const name = typeof options?.name === "string" ? options.name : options?.name?.source ?? ""; const locator = { filter: () => locator, first: () => locator, - isVisible: async () => !(connectorsInFlyout && name === "Connectors" && !actions.includes("More workspace pages")), + isVisible: async () => !(connectorsInFlyout && name === "Plugins" && !actions.includes("More workspace pages")), getByRole: (_r: string, o: { name: string }) => ({ click: async () => { if (o.name === missing) throw new Error("Missing real control"); @@ -40,13 +41,13 @@ function pageFixture(missing?: string, connectorsInFlyout = false) { return { page, actions }; } describe("finite held external diagnostics and visible entry correction", () => { - it("uses visible catalog controls including the expanded custom server option", async () => { + it("uses visible catalog controls including the Add menu custom server option", async () => { const { page, actions } = pageFixture(); await enterGenericMcpThroughCatalog(page, "RUN"); expect(actions).toEqual([ - "Connectors", - "Connect", - "Connect your own MCP server", + "Plugins", + "Add", + "MCP server URL", "actual /RUN/apps/byo", ]); }); @@ -55,17 +56,17 @@ describe("finite held external diagnostics and visible entry correction", () => await enterGenericMcpThroughCatalog(page, "RUN"); expect(actions).toEqual([ "More workspace pages", - "Connectors", - "Connect", - "Connect your own MCP server", + "Plugins", + "Add", + "MCP server URL", "actual /RUN/apps/byo", ]); }); it("does not rescue a missing catalog entry with direct navigation", async () => { for (const name of [ - "Connectors", - "Connect", - "Connect your own MCP server", + "Plugins", + "Add", + "MCP server URL", ]) { const { page, actions } = pageFixture(name); await expect(enterGenericMcpThroughCatalog(page, "RUN")).rejects.toThrow( diff --git a/tests/runner-e2e/chat-catalog-domains/external-mcp-failure.ts b/tests/runner-e2e/chat-catalog-domains/external-mcp-failure.ts index 2dc2d031b17..e736c4dd788 100644 --- a/tests/runner-e2e/chat-catalog-domains/external-mcp-failure.ts +++ b/tests/runner-e2e/chat-catalog-domains/external-mcp-failure.ts @@ -18,23 +18,13 @@ export async function enterGenericMcpThroughCatalog( ) { // The Coordinator sidebar keeps Connectors under its More flyout; the // classic sidebar lists it directly. Use whichever the person sees. - const direct = page.getByRole("link", { name: "Connectors", exact: true }); + const direct = page.getByRole("link", { name: "Plugins", exact: true }); if (!(await direct.first().isVisible())) { await page.getByRole("button", { name: "More workspace pages", exact: true }).click(); } await direct.first().click(); - const card = page - .getByRole("listitem") - .filter({ - has: page.getByRole("heading", { - name: "Connect your own tool", - exact: true, - }), - }); - await card.getByRole("button", { name: "Connect", exact: true }).click(); - await card - .getByRole("button", { name: "Connect your own MCP server" }) - .click(); + await page.getByRole("button", { name: "Add", exact: true }).click(); + await page.getByRole("menuitem", { name: /MCP server URL/ }).click(); await page.waitForURL((url) => url.pathname === `/${prefix}/apps/byo`); } export function gradeUnreachableMcp(value: unknown) { diff --git a/tests/runner-e2e/connection-flow.ts b/tests/runner-e2e/connection-flow.ts index ce7b540e08d..77ab07a95bd 100644 --- a/tests/runner-e2e/connection-flow.ts +++ b/tests/runner-e2e/connection-flow.ts @@ -203,7 +203,7 @@ async function createConnectionThroughUi(input: ConnectionFlowInput, agentURL: s (mode === "bedrock" && connection.routing?.region !== input.settings.route?.region)) throw new ConnectionFailure("saved_routing_mismatch"); } else if (connection.provider !== harness.provider) throw new ConnectionFailure("saved_provider_mismatch"); // Navigate away and return through the normal list: proof includes durable UI state. - await page.goto(`${api.origin}/${company.issuePrefix}/apps`, { waitUntil: "domcontentloaded" }); + await page.goto(`${api.origin}/${company.issuePrefix}/apps?source=installed`, { waitUntil: "domcontentloaded" }); await expect(page.getByText(connection.name, { exact: true }).first()).toBeVisible(); await page.reload({ waitUntil: "domcontentloaded" }); await expect(page.getByText(connection.name, { exact: true }).first()).toBeVisible(); diff --git a/tests/runner-e2e/connection-reviews.ts b/tests/runner-e2e/connection-reviews.ts index 2962bdd0a8a..42f946491a7 100644 --- a/tests/runner-e2e/connection-reviews.ts +++ b/tests/runner-e2e/connection-reviews.ts @@ -52,16 +52,8 @@ export async function setupConnectionReview(input: { connection = { id: connected.connectionId }; } else { await page.goto(`/${input.prefix}/apps`, { waitUntil: "domcontentloaded" }); - const connector = page - .getByRole("list", { name: "Connector list" }) - .getByRole("listitem") - .filter({ hasText: "Connect your own tool" }); - await connector - .getByRole("button", { name: "Connect", exact: true }) - .click(); - await connector - .getByRole("button", { name: "Connect your own MCP server" }) - .click(); + await page.getByRole("button", { name: "Add", exact: true }).click(); + await page.getByRole("menuitem", { name: /MCP server URL/ }).click(); await page .getByPlaceholder("https://example.com/actions") .fill(provider.url); diff --git a/tests/runner-e2e/github-review-flow.ts b/tests/runner-e2e/github-review-flow.ts index d43e919ddd8..4e37e48defb 100644 --- a/tests/runner-e2e/github-review-flow.ts +++ b/tests/runner-e2e/github-review-flow.ts @@ -42,7 +42,7 @@ export async function runGitHubReviewFlow(input: { await enterGitHubJourneyCompany(page, api.origin, company); await input.checkpoint("agent", page); await input.phase("connector_navigation"); - await page.getByRole("link", { name: "Connectors", exact: true }).click(); + await page.getByRole("link", { name: "Plugins", exact: true }).click(); const botCard = page.getByRole("listitem").filter({ has: page.getByRole("heading", { name: "GitHub Code Review Bot", exact: true }) }); await botCard.getByRole("button", { name: /^(?:Connect|Add connection) GitHub Code Review Bot$/ }).click(); await page.getByRole("button", { name: /Select agent/ }).click(); diff --git a/tests/runner-e2e/source-sdk-public-inputs.json b/tests/runner-e2e/source-sdk-public-inputs.json index f03d057fd7c..24048435777 100644 --- a/tests/runner-e2e/source-sdk-public-inputs.json +++ b/tests/runner-e2e/source-sdk-public-inputs.json @@ -60,7 +60,7 @@ "packages/shared/src/agent-setup-progress.ts": "44e3b42853c8c3c795d2b5701a371d95c69adf55", "packages/shared/src/agent-url-key.ts": "d0ec20b3ea1636a960bc5372a2c1e5a124bc5511", "packages/shared/src/aggregator-app-catalog.test.ts": "39ee377e55cc9565fce004b928bbe0998268e004", - "packages/shared/src/aggregator-app-catalog.ts": "d6778b07a41356878c549d039ae316553ca9a22b", + "packages/shared/src/aggregator-app-catalog.ts": "83d0009b8509ac3dd3979a72cad51d1cabc13435", "packages/shared/src/aggregator-apps.ts": "2a69a54ee0cb305170275b6f4e97689c107defb1", "packages/shared/src/ai-connection-router.ts": "9fbd89c385a4d5827bc68e1c7f6a66e00453d413", "packages/shared/src/ai-connection-usage.ts": "4b51573ee92f8a2ae0f80dd15288a0e59b4dddc7", diff --git a/tests/speko-native/live-browser.mjs b/tests/speko-native/live-browser.mjs index 3ab85384dbe..696a060401b 100644 --- a/tests/speko-native/live-browser.mjs +++ b/tests/speko-native/live-browser.mjs @@ -107,7 +107,7 @@ try { event('qualification_task_created', {issueId: task.id}); event('existing_connection_used', {endpointId: fixture.endpointId}); } else { - await page.getByRole('link', { name: 'Connectors', exact: true }).first().click(); + await page.getByRole('link', { name: 'Plugins', exact: true }).first().click(); if (fixture.endpointId) { // Resume the saved setup using the same UI route after an earlier failed test. await page.goto(`${origin}/${fixture.companyPrefix}/apps/chat/connect?provider=speko&resume=${fixture.endpointId}`); diff --git a/tests/storybook-visual/feature-gap-render-states.ts b/tests/storybook-visual/feature-gap-render-states.ts index 9d986d9961e..c378dafc9aa 100644 --- a/tests/storybook-visual/feature-gap-render-states.ts +++ b/tests/storybook-visual/feature-gap-render-states.ts @@ -185,7 +185,7 @@ const states: Record> = { }, "feature-plugin-management": { installed: { text: "Preview plugin" }, - empty: { text: "No plugins installed" }, + empty: { text: "No system plugins installed" }, loading: { text: "Loading plugins..." }, failed: { text: "Failed to load plugins." }, "permission-denied": { text: "Failed to load plugins." }, diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 7e07680dd3b..9171af598a8 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -211,6 +211,8 @@ function boardRoutes(streamlinedUiEnabled: boolean, combinedInboxTasksEnabled: b } /> } /> } /> + } /> + } /> } /> } /> } /> diff --git a/ui/src/components/AppsSidebar.production.tsx b/ui/src/components/AppsSidebar.production.tsx index bf50e5d4b2c..51f0aa2e7e0 100644 --- a/ui/src/components/AppsSidebar.production.tsx +++ b/ui/src/components/AppsSidebar.production.tsx @@ -1,13 +1,12 @@ import { useLocation } from "@/lib/router"; import { ChatDetailSidebar } from "./chat/ChatDetailSidebar"; import { ChatSetupSidebar } from "./chat/ChatSetupNavigation"; -import { ChevronLeft, AppWindow, Store, ShieldQuestion } from "lucide-react"; +import { ChevronLeft, AppWindow, Store } from "lucide-react"; import { Link } from "@/lib/router"; import { useCompany } from "@/context/CompanyContext"; import { useSidebar } from "@/context/SidebarContext"; import { DEVELOPER_TABS, advancedTabHref, isExperimentalToolTab } from "@/pages/tools/tool-tabs"; import { useSmokeLabEnabled } from "@/hooks/useSmokeLabEnabled"; -import { useReviewCount } from "@/pages/apps/useReviewCount"; import { SidebarNavItem } from "./SidebarNavItem.production"; /** @@ -32,7 +31,6 @@ export function AppsSidebar() { const { selectedCompany } = useCompany(); const { isMobile, setSidebarOpen } = useSidebar(); - const reviewCount = useReviewCount(); const { enabled: smokeLabEnabled } = useSmokeLabEnabled(); const developerTabs = DEVELOPER_TABS.filter( (tab) => !isExperimentalToolTab(tab.key) || smokeLabEnabled, @@ -57,7 +55,7 @@ export function AppsSidebar() {
- Connectors + Plugins
@@ -66,15 +64,7 @@ export function AppsSidebar() { Connectors
- - 0 ? reviewCount : undefined} - badgeTone="warning" - badgeLabel="waiting for your OK" - /> +
Developer diff --git a/ui/src/components/AppsSidebar.tsx b/ui/src/components/AppsSidebar.tsx index d6bcf310691..de2fc32be64 100644 --- a/ui/src/components/AppsSidebar.tsx +++ b/ui/src/components/AppsSidebar.tsx @@ -1,30 +1,29 @@ -import { NavLink, useLocation } from "@/lib/router"; +import { useLocation } from "@/lib/router"; import { ChatDetailSidebar } from "./chat/ChatDetailSidebar"; import { ChatSetupSidebar } from "./chat/ChatSetupNavigation"; -import { Store, ShieldQuestion } from "lucide-react"; +import { Store } from "lucide-react"; import { DEVELOPER_TABS, advancedTabHref, isExperimentalToolTab } from "@/pages/tools/tool-tabs"; import { useSmokeLabEnabled } from "@/hooks/useSmokeLabEnabled"; -import { useReviewCount } from "@/pages/apps/useReviewCount"; import { SidebarNavItem } from "./SidebarNavItem"; import { contextualSidebarStyles } from "./contextual-sidebar-styles"; -/** - * Secondary sidebar for the Apps area. - * - * Connectors combines discovery, account management, and connection health. - * Review keeps governed actions waiting on the user's approval. Advanced - * developer surfaces remain hidden unless one is explicitly enabled. - */ -export function AppsSidebar() { - const { pathname } = useLocation(); - const reviewCount = useReviewCount(); +/** Developer tabs that are switched on for this instance; Gateways and Profiles stay hidden until they ship. */ +export function useAppsDeveloperTabs() { const { enabled: smokeLabEnabled } = useSmokeLabEnabled(); - const developerTabs = DEVELOPER_TABS.filter((tab) => { - // Temporarily hide Gateways and Profiles until they are ready to ship. - // Keep their tab definitions and routes intact so we can bring them back later. + return DEVELOPER_TABS.filter((tab) => { if (tab.key === "gateways" || tab.key === "profiles") return false; return !isExperimentalToolTab(tab.key) || smokeLabEnabled; }); +} + +/** + * Secondary sidebar for the parts of the Apps area that still need one: chat + * setup and detail, and the developer pages. The Plugins marketplace and + * Review have no rail; their page headers link to each other. + */ +export function AppsSidebar() { + const { pathname } = useLocation(); + const developerTabs = useAppsDeveloperTabs(); if (pathname.endsWith("/apps/chat/connect")) return ; const chatDetail = pathname.match(/\/apps\/chat\/([^/]+)(?:\/(?:settings|access|conversations|activity)|\/reviews(?:\/[^/]+)?)?\/?$/); @@ -33,20 +32,12 @@ export function AppsSidebar() { return ( ); } - -/** Mobile collection navigation replaces the desktop Browse/Review rail. */ -export function AppsMobileNav() { - const reviewCount = useReviewCount(); - const segmentClass = ({ isActive }: { isActive: boolean }) => - `flex min-w-0 flex-1 items-center justify-center gap-2 rounded-md px-3 py-2 text-sm no-underline transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${isActive ? "bg-accent text-foreground" : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`; - return ; -} diff --git a/ui/src/components/CompanySettingsSidebar.production.tsx b/ui/src/components/CompanySettingsSidebar.production.tsx index 2dd61e2837d..a5f0cfd3add 100644 --- a/ui/src/components/CompanySettingsSidebar.production.tsx +++ b/ui/src/components/CompanySettingsSidebar.production.tsx @@ -176,7 +176,7 @@ export function CompanySettingsSidebar() { {showPlugins && ( )} diff --git a/ui/src/components/CompanySettingsSidebar.tsx b/ui/src/components/CompanySettingsSidebar.tsx index 0545cdf3176..1fec9e54541 100644 --- a/ui/src/components/CompanySettingsSidebar.tsx +++ b/ui/src/components/CompanySettingsSidebar.tsx @@ -167,7 +167,7 @@ export function CompanySettingsSidebar() { {showPlugins && ( )} diff --git a/ui/src/components/CoordinatorSidebar.tsx b/ui/src/components/CoordinatorSidebar.tsx index 981293061e7..0b7952b2532 100644 --- a/ui/src/components/CoordinatorSidebar.tsx +++ b/ui/src/components/CoordinatorSidebar.tsx @@ -45,7 +45,7 @@ const moreDestinations = [ { label: "Artifacts", to: "/artifacts", icon: Boxes }, { label: "Agents", to: "/agents/all", icon: Network }, { label: "Skills", to: "/skills", icon: Boxes }, - { label: "Connectors", to: "/apps", icon: Unplug }, + { label: "Plugins", to: "/apps", icon: Unplug }, { label: "Audit", to: "/activity", icon: History }, { label: "Settings", to: "/settings", icon: Settings }, ] as const; diff --git a/ui/src/components/DesignSidebar.tsx b/ui/src/components/DesignSidebar.tsx index 78f66c1c0fa..893a942fd7e 100644 --- a/ui/src/components/DesignSidebar.tsx +++ b/ui/src/components/DesignSidebar.tsx @@ -42,7 +42,7 @@ export function DesignSidebar({ onNewTask, recentTasks = [] }: { onNewTask: () = - + {companyRecentTasks.length > 0 ?
diff --git a/ui/src/components/Layout.production.tsx b/ui/src/components/Layout.production.tsx index ba73b5e0562..6be7ed9e9f6 100644 --- a/ui/src/components/Layout.production.tsx +++ b/ui/src/components/Layout.production.tsx @@ -24,6 +24,7 @@ import { Sidebar } from "./Sidebar.production"; import { CompanySettingsSidebar } from "./CompanySettingsSidebar.production"; import { CompanySettingsNav } from "./access/CompanySettingsNav"; import { AppsSidebar } from "./AppsSidebar.production"; +import { appsRouteHasRail } from "../pages/apps/apps-rail"; import { AppDetailSidebar } from "./AppConnectionSidebar.production"; import { BreadcrumbBar } from "./BreadcrumbBar.production"; import { PropertiesPanel } from "./PropertiesPanel"; @@ -91,6 +92,8 @@ function getCompanyPathSegments( } const RESERVED_APP_SUBPATHS = new Set([ + "plugin", + "category", "browse", "connections", "connect", @@ -208,7 +211,7 @@ export function Layout() { kind="application" applicationId={appDetailApplicationId} /> - ) : isAppsRoute || isToolsRoute ? ( + ) : appsRouteHasRail(companyPathSegments, true) ? ( ) : routeSidebarSlot ? ( ) : appDetailApplicationId ? ( - ) : isAppsRoute || isToolsRoute ? ( + ) : appsRouteHasRail(companyPathSegments, appsDeveloperTabs.length > 0) ? ( ) : routeSidebarSlot ? ( streamlinedUiEnabled ? ( @@ -657,7 +661,6 @@ export function Layout({ sidebarSections }: { sidebarSections?: ReactNode }) { : "overflow-auto [scrollbar-gutter:stable]", )} > - {isMobile && isAppsRoute && (!companyPathSegments[1] || companyPathSegments[1] === "review") ? : null} {hasUnknownCompanyPrefix ? ( - {showApps ? : null} + {showApps ? : null} {/* One entry — /audit merged into the rich Activity feed (PAP-16302). */} diff --git a/ui/src/components/Sidebar.tsx b/ui/src/components/Sidebar.tsx index 2ca0596d7d8..21a96601216 100644 --- a/ui/src/components/Sidebar.tsx +++ b/ui/src/components/Sidebar.tsx @@ -276,7 +276,7 @@ function ClassicSidebar({ children }: { children?: ReactNode }) { > - + ) : null} @@ -294,7 +294,7 @@ function ClassicSidebar({ children }: { children?: ReactNode }) { collapsible={{ open: organizationOpen, onOpenChange: setOrganizationOpen }} > - + diff --git a/ui/src/components/access/CompanySettingsNav.tsx b/ui/src/components/access/CompanySettingsNav.tsx index 50c48da2ba6..f5149997c00 100644 --- a/ui/src/components/access/CompanySettingsNav.tsx +++ b/ui/src/components/access/CompanySettingsNav.tsx @@ -16,7 +16,7 @@ const items = [ { value: "connections", label: "Connections", href: "/company/settings/connections" }, { value: "instance-access", label: "Access", href: `${INSTANCE_SETTINGS_PATH_PREFIX}/access` }, { value: "instance-experimental", label: "Experimental", href: `${INSTANCE_SETTINGS_PATH_PREFIX}/experimental` }, - { value: "instance-plugins", label: "Plugins", href: `${INSTANCE_SETTINGS_PATH_PREFIX}/plugins` }, + { value: "instance-plugins", label: "System plugins", href: `${INSTANCE_SETTINGS_PATH_PREFIX}/plugins` }, { value: "instance-adapters", label: "Adapters", href: `${INSTANCE_SETTINGS_PATH_PREFIX}/adapters` }, ] as const; diff --git a/ui/src/components/ai-connections/AiConnectionPoolConnector.tsx b/ui/src/components/ai-connections/AiConnectionPoolConnector.tsx index e8522e9b601..529f76b7dfc 100644 --- a/ui/src/components/ai-connections/AiConnectionPoolConnector.tsx +++ b/ui/src/components/ai-connections/AiConnectionPoolConnector.tsx @@ -82,7 +82,7 @@ function PoolConnector({ companyId, pluginKey, connection }: { companyId: string } }, [poolsQuery.data, connection, editing, pluginKey, canManage]); useEffect(() => { - setBreadcrumbs([{ label: "Connectors", href: "/apps" }, { label: connection ? draft.name : "Add a connection pool" }]); + setBreadcrumbs([{ label: "Plugins", href: "/apps" }, { label: connection ? draft.name : "Add a connection pool" }]); return () => setBreadcrumbs([]); }, [connection, draft.name, setBreadcrumbs]); useEffect(() => { diff --git a/ui/src/features/connections/ConnectionSetupFlow.tsx b/ui/src/features/connections/ConnectionSetupFlow.tsx index 5062350a23e..85b554609f8 100644 --- a/ui/src/features/connections/ConnectionSetupFlow.tsx +++ b/ui/src/features/connections/ConnectionSetupFlow.tsx @@ -67,6 +67,7 @@ import { } from "@paperclipai/shared"; import { useCloudInstance } from "@/hooks/useCloudInstance"; import { useNavigate, useParams, useSearchParams } from "@/lib/router"; +import { ONE_CLICK_PARAM, SIGN_IN_GUIDANCE_SLUGS, availableToolConnectionMethods, canUseAutomaticOAuthFastPath, hasOneClickPopup, releaseOneClickPopup, takeOneClickPopup } from "./one-click-oauth"; import { useCompany } from "@/context/CompanyContext"; import { useBreadcrumbs } from "@/context/BreadcrumbContext"; import { useToast } from "@/context/ToastContext"; @@ -431,14 +432,6 @@ function connectionMethodsForCredentialSource( : methods; } -function availableToolConnectionMethods( - entry: AppDefinition, -): ConnectionMethodDef[] { - return getAvailableConnectionMethods(entry).filter( - (method) => (method.purpose ?? "tool") !== "channel", - ); -} - function availableToolConnectionMethod( entry: AppDefinition, methodKey?: string | null, @@ -476,22 +469,6 @@ function recommendedManagedConnectorMethod( ); } -// One-method sign-in skips the access step. These providers' warnings (Railway -// project scope, Circleback sharing outside the workspace) must still be read -// before authorizing, so the sign-in screen repeats them. -const SIGN_IN_GUIDANCE_SLUGS = new Set(["railway", "circleback", "github"]); - -function canUseAutomaticOAuthFastPath(entry: AppDefinition | null | undefined): boolean { - if (!entry) return false; - const methods = availableToolConnectionMethods(entry); - const method = methods.length === 1 ? methods[0] : null; - return Boolean( - method - && connectionMethodSupportsAutomaticOAuth(method) - && !connectionMethodRequiresConfiguration(method), - ); -} - function automaticOAuthMethod(entry: AppDefinition | null | undefined): ConnectionMethodDef | null { if (!entry) return null; const methods = availableToolConnectionMethods(entry); @@ -935,6 +912,11 @@ function StandardConnectionSetupFlow({ const reserveOAuthPopup = useCallback(() => { if (oauthPopupRef.current?.closed === false) return; + const handedOver = takeOneClickPopup(); + if (handedOver) { + oauthPopupRef.current = handedOver; + return; + } try { oauthPopupRef.current = window.open("about:blank", "_blank", "popup,width=720,height=760,resizable=yes,scrollbars=yes"); // Task-bound setup can resume in either host and needs its existing @@ -943,6 +925,25 @@ function StandardConnectionSetupFlow({ } catch { oauthPopupRef.current = null; } }, [connectionIntentId]); + // One-click connect: Browse asked for sign-in to start without the + // confirmation screen and already opened the window. The render below says + // whether this app really qualifies; anything else keeps the screen and + // closes the window Browse opened. + const oneClickRequested = searchParams.get(ONE_CLICK_PARAM) === "1"; + const oneClickRef = useRef<{ eligible: boolean; begin: () => void } | null>(null); + const oneClickHandledRef = useRef(false); + oneClickRef.current = null; + useEffect(() => { + if (!oneClickRequested || oneClickHandledRef.current) return; + const decision = oneClickRef.current; + if (!decision) return; + oneClickHandledRef.current = true; + // Only a window opened by the card's own click can carry sign-in. After a + // reload there is none, and the ordinary confirmation screen stays. + if (decision.eligible && hasOneClickPopup()) decision.begin(); + else releaseOneClickPopup(); + }); + const openAuthorization = useCallback((url: string) => { setAuthorizationFallbackUrl(url); const popup = oauthPopupRef.current; @@ -1187,7 +1188,7 @@ function StandardConnectionSetupFlow({ useEffect(() => { if (host !== "page") return; setBreadcrumbs([ - { label: "Connectors", href: "/apps" }, + { label: "Plugins", href: "/apps" }, { label: vercelConnectMode ? "Vercel Connect" : byoOnly ? "Connect your own tool" : "Connect an app" }, ]); return () => setBreadcrumbs([]); @@ -2476,6 +2477,105 @@ function StandardConnectionSetupFlow({ }} />; + const beginDirectOAuth = async () => { + if (!automaticOAuthEntry) return; + if (pendingOAuthLookupRef.current) return; + directOAuthAccessConfirmedRef.current = true; + setOAuthError(null); + setOAuthPhase("starting"); + const connection = connectResult?.connection ?? resumableOAuthConnection; + if (connection && automaticCustomerClientFields && curatedOAuthClientId.trim()) { + // The draft exists but its client must change: resume it through + // connect so the operator's client replaces the refused registration. + customerClientResumeRef.current = connection.id; + connectApp(automaticOAuthEntry); + return; + } + if (connection) { + startOAuth(connection); + return; + } + // Cached empty lists cannot authorize creation. A fresh lookup also + // recovers an earlier create whose response never reached this tab. + // Reserve the dialog window while this click still has user activation. + if (automaticOAuthEntry?.slug !== "google-workspace" || workspaceSelectionRef.current) reserveOAuthPopup(); + const lookup = { scope: oauthLookupScope, account: bindAccount(queryClient) }; + pendingOAuthLookupRef.current = lookup; + const isCurrentLookup = () => pendingOAuthLookupRef.current === lookup && oauthLookupScopeRef.current === lookup.scope && lookup.account.isCurrentScope(); + directOAuthRetryingRef.current = true; + try { + const [applications, connections] = await Promise.all([ + toolsApi.listApplications(selectedCompanyId!, { cache: "no-store", fresh: true }), + toolsApi.listConnections(selectedCompanyId!, { cache: "no-store", fresh: true }), + ]); + if (!isCurrentLookup()) return; + queryClient.setQueryData(queryKeys.tools.applications(selectedCompanyId!), applications); + queryClient.setQueryData(queryKeys.tools.connections(selectedCompanyId!), connections); + const refreshedResumeConnection = resumeConnectionId + ? (connections.connections ?? []).find( + (candidate) => candidate.id === resumeConnectionId && candidate.authKind === "oauth", + ) ?? null + : null; + const refreshedConnection = refreshedResumeConnection ?? reusableOAuthConnection( + directOAuthSource, + applications.applications ?? [], + connections.connections ?? [], + createNewConnection + ? { applicationId: prefill.applicationId, draftOnly: true } + : {}, + ); + if (refreshedConnection && !resumeConnectionId) { + // Adopt the durable draft's identity before resuming it, so the + // stated default on screen matches what is about to be authorized. + setGrantKind( + refreshedConnection.credentialPolicy === "per_user" + ? "user" + : refreshedConnection.credentialPolicy === "per_agent" + ? "agent" + : "organization", + ); + } + if (refreshedConnection) { + startOAuth(refreshedConnection); + } else { + connectApp(automaticOAuthEntry); + } + } catch { + if (!isCurrentLookup()) return; + oauthPopupRef.current?.close(); + oauthPopupRef.current = null; + setOAuthPhase("error"); + setOAuthError("Paperclip couldn’t check for an existing connection. Try again."); + } finally { + if (pendingOAuthLookupRef.current === lookup) { + if (!isCurrentLookup()) { + cancelOAuthLookup(); + setOAuthPhase("entry"); + setOAuthError(null); + } else { + pendingOAuthLookupRef.current = null; + directOAuthRetryingRef.current = false; + } + } + } + }; + if (entry && !directOAuthLookupPending) { + oneClickRef.current = { + eligible: Boolean( + showCuratedOAuthState + && automaticOAuthEntry + && directOAuthEntry + && oauthPhase === "entry" + && !resumeConnectionId + && !SIGN_IN_GUIDANCE_SLUGS.has(entry.slug) + && entry.slug !== "google-workspace" + && additionalSettingsValid + && instructionsValid, + ), + begin: () => void beginDirectOAuth(), + }; + } + if (showCuratedOAuthState && automaticOAuthEntry) { return ( { - if (pendingOAuthLookupRef.current) return; - directOAuthAccessConfirmedRef.current = true; - setOAuthError(null); - setOAuthPhase("starting"); - const connection = connectResult?.connection ?? resumableOAuthConnection; - if (connection && automaticCustomerClientFields && curatedOAuthClientId.trim()) { - // The draft exists but its client must change: resume it through - // connect so the operator's client replaces the refused registration. - customerClientResumeRef.current = connection.id; - connectApp(automaticOAuthEntry); - return; - } - if (connection) { - startOAuth(connection); - return; - } - // Cached empty lists cannot authorize creation. A fresh lookup also - // recovers an earlier create whose response never reached this tab. - // Reserve the dialog window while this click still has user activation. - if (automaticOAuthEntry?.slug !== "google-workspace" || workspaceSelectionRef.current) reserveOAuthPopup(); - const lookup = { scope: oauthLookupScope, account: bindAccount(queryClient) }; - pendingOAuthLookupRef.current = lookup; - const isCurrentLookup = () => pendingOAuthLookupRef.current === lookup && oauthLookupScopeRef.current === lookup.scope && lookup.account.isCurrentScope(); - directOAuthRetryingRef.current = true; - try { - const [applications, connections] = await Promise.all([ - toolsApi.listApplications(selectedCompanyId!, { cache: "no-store", fresh: true }), - toolsApi.listConnections(selectedCompanyId!, { cache: "no-store", fresh: true }), - ]); - if (!isCurrentLookup()) return; - queryClient.setQueryData(queryKeys.tools.applications(selectedCompanyId!), applications); - queryClient.setQueryData(queryKeys.tools.connections(selectedCompanyId!), connections); - const refreshedResumeConnection = resumeConnectionId - ? (connections.connections ?? []).find( - (candidate) => candidate.id === resumeConnectionId && candidate.authKind === "oauth", - ) ?? null - : null; - const refreshedConnection = refreshedResumeConnection ?? reusableOAuthConnection( - directOAuthSource, - applications.applications ?? [], - connections.connections ?? [], - createNewConnection - ? { applicationId: prefill.applicationId, draftOnly: true } - : {}, - ); - if (refreshedConnection && !resumeConnectionId) { - // Adopt the durable draft's identity before resuming it, so the - // stated default on screen matches what is about to be authorized. - setGrantKind( - refreshedConnection.credentialPolicy === "per_user" - ? "user" - : refreshedConnection.credentialPolicy === "per_agent" - ? "agent" - : "organization", - ); - } - if (refreshedConnection) { - startOAuth(refreshedConnection); - } else { - connectApp(automaticOAuthEntry); - } - } catch { - if (!isCurrentLookup()) return; - oauthPopupRef.current?.close(); - oauthPopupRef.current = null; - setOAuthPhase("error"); - setOAuthError("Paperclip couldn’t check for an existing connection. Try again."); - } finally { - if (pendingOAuthLookupRef.current === lookup) { - if (!isCurrentLookup()) { - cancelOAuthLookup(); - setOAuthPhase("entry"); - setOAuthError(null); - } else { - pendingOAuthLookupRef.current = null; - directOAuthRetryingRef.current = false; - } - } - } - }} + onRetry={beginDirectOAuth} onBack={() => { oauthHandoffAbortRef.current?.abort(); setOAuthPhase("entry"); @@ -3038,6 +3058,9 @@ function StandardConnectionSetupFlow({ installCount: installAgentIds.size, lockedAgentId: requestedAgentId ?? null, })} + onChangeDefault={host === "page" && connectResult?.connectionId + ? () => navigate(`/apps/${connectResult.connectionId}/permissions`) + : undefined} onDone={onCancel ?? (() => navigate( host === "page" && connectResult?.connectionId ? `/apps/${connectResult.connectionId}/permissions` @@ -4681,6 +4704,7 @@ export function ConnectionSetupCompletionScreen({ darkLogoUrl, summary, statedDefault, + onChangeDefault, onDone, }: { appName: string; @@ -4693,6 +4717,8 @@ export function ConnectionSetupCompletionScreen({ * the reach that was granted is stated twice on the happy path (PAP-659 C0). */ statedDefault?: string; + /** Opens where the stated default can be changed; one-click connect never showed that choice beforehand. */ + onChangeDefault?: () => void; onDone: () => void; }) { return ( @@ -4704,7 +4730,19 @@ export function ConnectionSetupCompletionScreen({

{appName} is ready.

- {statedDefault ?

{statedDefault}

: null} + {statedDefault ? ( +

+ {statedDefault} + {onChangeDefault ? ( + <> + {" "} + + + ) : null} +

+ ) : null}
{summary.map((line) => (
diff --git a/ui/src/features/connections/one-click-oauth.test.ts b/ui/src/features/connections/one-click-oauth.test.ts new file mode 100644 index 00000000000..b2c08135645 --- /dev/null +++ b/ui/src/features/connections/one-click-oauth.test.ts @@ -0,0 +1,55 @@ +// @vitest-environment jsdom +import { afterEach, describe, expect, it, vi } from "vitest"; +import type { AppDefinition } from "@paperclipai/shared"; +import { getAppStoreDefinition } from "@paperclipai/shared"; +import { isOneClickOAuthApp, releaseOneClickPopup, reserveOneClickPopup, takeOneClickPopup } from "./one-click-oauth"; + +function fakeWindow() { + return { closed: false, opener: {}, close: vi.fn(function (this: { closed: boolean }) { this.closed = true; }) } as unknown as Window & { close: ReturnType }; +} + +afterEach(() => { + releaseOneClickPopup(); + vi.restoreAllMocks(); + vi.useRealTimers(); +}); + +describe("isOneClickOAuthApp", () => { + it("accepts a connector with one automatic sign-in method", () => { + expect(isOneClickOAuthApp(getAppStoreDefinition("notion") as AppDefinition)).toBe(true); + }); + + it("keeps the confirmation screen for connectors with warnings or choices", () => { + expect(isOneClickOAuthApp(getAppStoreDefinition("github") as AppDefinition)).toBe(false); + expect(isOneClickOAuthApp(getAppStoreDefinition("daytona") as AppDefinition)).toBe(false); + expect(isOneClickOAuthApp(null)).toBe(false); + }); +}); + +describe("one-click sign-in window", () => { + it("hands the reserved window to the flow once and cuts its opener", () => { + const popup = fakeWindow(); + vi.spyOn(window, "open").mockReturnValue(popup); + expect(reserveOneClickPopup()).toBe(true); + expect(popup.opener).toBeNull(); + expect(takeOneClickPopup()).toBe(popup); + expect(takeOneClickPopup()).toBeNull(); + expect(popup.close).not.toHaveBeenCalled(); + }); + + it("reports a blocked window so the caller keeps the confirmation screen", () => { + vi.spyOn(window, "open").mockReturnValue(null); + expect(reserveOneClickPopup()).toBe(false); + expect(takeOneClickPopup()).toBeNull(); + }); + + it("closes a window no flow claimed", () => { + vi.useFakeTimers(); + const popup = fakeWindow(); + vi.spyOn(window, "open").mockReturnValue(popup); + reserveOneClickPopup(); + vi.advanceTimersByTime(15_000); + expect(popup.close).toHaveBeenCalledOnce(); + expect(takeOneClickPopup()).toBeNull(); + }); +}); diff --git a/ui/src/features/connections/one-click-oauth.ts b/ui/src/features/connections/one-click-oauth.ts new file mode 100644 index 00000000000..f8cab74f4e7 --- /dev/null +++ b/ui/src/features/connections/one-click-oauth.ts @@ -0,0 +1,85 @@ +import { + connectionMethodRequiresConfiguration, + connectionMethodSupportsAutomaticOAuth, + getAvailableConnectionMethods, + type AppDefinition, + type ConnectionMethodDef, +} from "@paperclipai/shared"; + +/** + * One-method sign-in skips the access step. These providers' warnings (Railway + * project scope, Circleback sharing outside the workspace) must still be read + * before authorizing, so the sign-in screen repeats them. + */ +export const SIGN_IN_GUIDANCE_SLUGS: ReadonlySet = new Set(["railway", "circleback", "github"]); + +export function availableToolConnectionMethods(entry: AppDefinition): ConnectionMethodDef[] { + return getAvailableConnectionMethods(entry).filter((method) => (method.purpose ?? "tool") !== "channel"); +} + +/** A single sign-in method that Paperclip can start on its own, with nothing to fill in first. */ +export function canUseAutomaticOAuthFastPath(entry: AppDefinition | null | undefined): boolean { + if (!entry) return false; + const methods = availableToolConnectionMethods(entry); + const method = methods.length === 1 ? methods[0] : null; + return Boolean(method && connectionMethodSupportsAutomaticOAuth(method) && !connectionMethodRequiresConfiguration(method)); +} + +/** + * Connecting is one click: the fast path applies and there is nothing the + * person must read or choose before the provider's own sign-in page. + */ +export function isOneClickOAuthApp(entry: AppDefinition | null | undefined): boolean { + return Boolean(entry) && canUseAutomaticOAuthFastPath(entry) && !SIGN_IN_GUIDANCE_SLUGS.has(entry!.slug) && entry!.slug !== "google-workspace"; +} + +/** Query flag that asks the connect flow to start sign-in without its confirmation screen. */ +export const ONE_CLICK_PARAM = "autostart"; + +const UNCLAIMED_MS = 15_000; +let reserved: { popup: Window; timer: number } | null = null; + +/** + * Open the sign-in window while a click still has user activation, for a + * connect flow that is about to mount. Browsers refuse the window once the + * click is over, so the flow cannot open it for itself after navigation. + */ +export function reserveOneClickPopup(): boolean { + releaseOneClickPopup(); + let popup: Window | null = null; + try { + popup = window.open("about:blank", "_blank", "popup,width=720,height=760,resizable=yes,scrollbars=yes"); + if (popup) popup.opener = null; + } catch { + popup = null; + } + if (!popup) return false; + reserved = { popup, timer: window.setTimeout(releaseOneClickPopup, UNCLAIMED_MS) }; + return true; +} + +/** Whether a window opened by a card click is waiting for the flow. */ +export function hasOneClickPopup(): boolean { + return Boolean(reserved && !reserved.popup.closed); +} + +/** Hand the reserved window to the flow that will navigate it. */ +export function takeOneClickPopup(): Window | null { + if (!reserved) return null; + const { popup, timer } = reserved; + window.clearTimeout(timer); + reserved = null; + return popup.closed ? null : popup; +} + +/** Close a reserved window nobody is going to use. */ +export function releaseOneClickPopup(): void { + if (!reserved) return; + window.clearTimeout(reserved.timer); + try { + reserved.popup.close(); + } catch { + // The window is already gone. + } + reserved = null; +} diff --git a/ui/src/pages/PluginManager.tsx b/ui/src/pages/PluginManager.tsx index 5049b34f1eb..c2c07b029cd 100644 --- a/ui/src/pages/PluginManager.tsx +++ b/ui/src/pages/PluginManager.tsx @@ -103,7 +103,7 @@ export function PluginManager() { setBreadcrumbs([ { label: selectedCompany?.name ?? "Organization", href: "/dashboard" }, { label: "Settings", href: "/company/settings" }, - { label: "Plugins" }, + { label: "System plugins" }, ]); }, [selectedCompany?.name, setBreadcrumbs]); @@ -210,19 +210,19 @@ export function PluginManager() {
-

Plugin Manager

+

System plugins

- Install Plugin + Install system plugin Enter the npm package name of the plugin you wish to install. @@ -255,7 +255,7 @@ export function PluginManager() {
-

Plugins are alpha.

+

System plugins are alpha.

The plugin runtime and API surface are still changing. Expect breaking changes while this feature settles.

@@ -266,7 +266,7 @@ export function PluginManager() {
-

Available Plugins

+

Available system plugins

Bundled
@@ -376,14 +376,14 @@ export function PluginManager() {
-

Installed Plugins

+

Installed system plugins

{!installedPlugins.length ? ( -

No plugins installed

+

No system plugins installed

Install a plugin to extend functionality.

diff --git a/ui/src/pages/PluginPage.tsx b/ui/src/pages/PluginPage.tsx index 1a8b9a2269c..c0c367f93a5 100644 --- a/ui/src/pages/PluginPage.tsx +++ b/ui/src/pages/PluginPage.tsx @@ -119,7 +119,7 @@ export function PluginPage() { return; } setBreadcrumbs([ - { label: "Plugins", href: "/company/settings/instance/plugins" }, + { label: "System plugins", href: "/company/settings/instance/plugins" }, { label: pageSlot.pluginDisplayName }, ]); }, [pageSlot, pluginRouteSplat, setBreadcrumbs, routeSidebarActive]); diff --git a/ui/src/pages/PluginSettings.tsx b/ui/src/pages/PluginSettings.tsx index 5b4ed5ad3c0..b854a922ced 100644 --- a/ui/src/pages/PluginSettings.tsx +++ b/ui/src/pages/PluginSettings.tsx @@ -129,7 +129,7 @@ export function PluginSettings() { setBreadcrumbs([ { label: selectedCompany?.name ?? "Organization", href: "/dashboard" }, { label: "Settings", href: "/company/settings" }, - { label: "Plugins", href: "/company/settings/instance/plugins" }, + { label: "System plugins", href: "/company/settings/instance/plugins" }, { label: plugin?.manifestJson?.displayName ?? plugin?.packageName ?? "Plugin Details" }, ]); }, [selectedCompany?.name, setBreadcrumbs, companyPrefix, plugin]); diff --git a/ui/src/pages/apps/AppDetail.tsx b/ui/src/pages/apps/AppDetail.tsx index 6ffffad9995..0948e88136f 100644 --- a/ui/src/pages/apps/AppDetail.tsx +++ b/ui/src/pages/apps/AppDetail.tsx @@ -65,6 +65,7 @@ import { AgentConnectionAccess } from "./app-detail/AgentConnectionAccess"; import { ConnectedAggregatorApps } from "./app-detail/ConnectedAggregatorApps"; import { isAppAggregator } from "@paperclipai/shared/aggregator-apps"; import { useConnectionPermissionSave } from "./app-detail/useConnectionPermissionSave"; +import { accessFrom, accessIncludingInstalls, askFirstCatalogIds, enabledCatalogIds } from "./app-detail/saved-permissions"; import { actionPermissionMutation } from "./app-detail/action-permissions"; import { RailwayAccessPanel } from "./app-detail/RailwayAccessPanel"; import { ReviewPanel } from "./app-detail/ReviewPanel"; @@ -283,7 +284,7 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio useEffect(() => { if (!activeTab) return; setBreadcrumbs([ - { label: "Connectors", href: "/apps" }, + { label: "Plugins", href: "/apps" }, { label: appName, href: appTabHref(connectionId, "permissions") }, { label: appTabLabel(activeTab) }, ]); @@ -936,63 +937,3 @@ function StatusBadge({ status }: { status: StatusInfo }) { ); } - -function enabledCatalogIds(profile: ToolProfileConfiguration | undefined): Set { - const ids = new Set(); - for (const entry of profile?.entries ?? []) { - if (entry.effect === "include" && entry.catalogEntryId) ids.add(entry.catalogEntryId); - } - return ids; -} - -function askFirstCatalogIds(policies: ToolPolicy[], connectionId: string): Set { - const ids = new Set(); - for (const policy of policies) { - if (policy.policyType !== "require_approval" || policy.enabled === false) continue; - const config = (policy.config ?? {}) as { source?: unknown; connectionId?: unknown; catalogEntryId?: unknown }; - if (config.source === "app_gallery_finish" && config.connectionId === connectionId && typeof config.catalogEntryId === "string") { - ids.add(config.catalogEntryId); - } - } - return ids; -} - -/** - * Who may use this connection, read back from the app profile's bindings. - * - * `finishApp` replaces a profile's whole binding set, so every save from this - * page — including an action-permission toggle — has to restate this. The - * Permissions tab exposes the bindings as Agent access, while installs remain - * a separate "always loaded" choice. If the profile has no bindings yet, the - * install state remains the safest legacy fallback. - * - * That fallback is the important part. It used to return "all agents" for an - * unbound profile, which turned any unrelated save into a silent company-wide - * grant from a control the reader could not see. Installs authorize their - * targets, so mirroring the install state is both the truthful reading and the - * one that agrees with what the tab displays. - */ -function accessFrom( - profile: ToolProfileConfiguration | undefined, - install: InstallState, -): AccessDraft { - const bindings = profile?.bindings ?? []; - if (bindings.some((b) => b.targetType === "company")) { - return { mode: "all", agentIds: new Set() }; - } - const agentIds = new Set(bindings.filter((b) => b.targetType === "agent").map((b) => b.targetId)); - if (agentIds.size > 0) return { mode: "specific", agentIds }; - return install.onAll - ? { mode: "all", agentIds: new Set() } - : { mode: "specific", agentIds: new Set(install.agentIds) }; -} - -function accessIncludingInstalls(next: AccessDraft, install: InstallState): AccessDraft { - if (install.onAll || next.mode === "all") { - return { mode: "all", agentIds: new Set() }; - } - return { - mode: "specific", - agentIds: new Set([...next.agentIds, ...install.agentIds]), - }; -} diff --git a/ui/src/pages/apps/AppNotConnected.tsx b/ui/src/pages/apps/AppNotConnected.tsx index f57b9d7a858..79cafb5e885 100644 --- a/ui/src/pages/apps/AppNotConnected.tsx +++ b/ui/src/pages/apps/AppNotConnected.tsx @@ -83,7 +83,7 @@ export function AppNotConnected() { useEffect(() => { if (!activeTab) return; setBreadcrumbs([ - { label: "Connectors", href: "/apps" }, + { label: "Plugins", href: "/apps" }, { label: appName, href: appApplicationTabHref(applicationId, "permissions") }, { label: appTabLabel(activeTab) }, ]); diff --git a/ui/src/pages/apps/AppsReview.tsx b/ui/src/pages/apps/AppsReview.tsx index 6728eda7e7d..7d1bd372ff7 100644 --- a/ui/src/pages/apps/AppsReview.tsx +++ b/ui/src/pages/apps/AppsReview.tsx @@ -1,4 +1,7 @@ import { useEffect } from "react"; +import { ArrowLeft } from "lucide-react"; +import { Link } from "@/lib/router"; +import { Button } from "@/components/ui/button"; import { useBreadcrumbs } from "@/context/BreadcrumbContext"; import { useCompany } from "@/context/CompanyContext"; import { ReviewQueueCard } from "./ReviewQueueCard"; @@ -19,7 +22,7 @@ export function AppsReview() { useEffect(() => { setBreadcrumbs([ - { label: "Connectors", href: "/apps" }, + { label: "Plugins", href: "/apps" }, { label: "Review" }, ]); return () => setBreadcrumbs([]); @@ -30,7 +33,10 @@ export function AppsReview() { } return ( -
+
+

Review

diff --git a/ui/src/pages/apps/AssistantConnection.tsx b/ui/src/pages/apps/AssistantConnection.tsx index 0d8c3dc31e0..d090bf0b7f2 100644 --- a/ui/src/pages/apps/AssistantConnection.tsx +++ b/ui/src/pages/apps/AssistantConnection.tsx @@ -106,7 +106,7 @@ export function AssistantConnection({ initialAssistant = "codex" }: { initialAss return client.invalidateQueries({ queryKey: connectionsKey }); } }); useEffect(() => { - setBreadcrumbs([{ label: "Connectors", href: "/apps" }, { label: "Assistant Connection (MCP)" }]); + setBreadcrumbs([{ label: "Plugins", href: "/apps" }, { label: "Assistant Connection (MCP)" }]); return () => setBreadcrumbs([]); }, [setBreadcrumbs]); if (!selectedCompanyId || !selectedCompany) return

Select an organization to connect an assistant.

; diff --git a/ui/src/pages/apps/Browse.pluginTileState.test.ts b/ui/src/pages/apps/Browse.pluginTileState.test.ts new file mode 100644 index 00000000000..42ed84d3bc4 --- /dev/null +++ b/ui/src/pages/apps/Browse.pluginTileState.test.ts @@ -0,0 +1,33 @@ +import { describe, expect, it } from "vitest"; +import type { ToolConnection } from "@paperclipai/shared"; +import { pluginTileState, type ConnectorRowModel } from "./Browse"; + +const gateway = { id: "gateway-1", status: "active", enabled: true, healthStatus: "ok", connectionPurpose: "tool", config: {} } as unknown as ToolConnection; +const gateways = new Map([[gateway.id, gateway]]); + +function aggregatorRow(accountStatus: string, snapshot: Record = {}): ConnectorRowModel { + const app = { slug: "attio", name: "Attio", aliases: [], routes: [] }; + return { + key: "aggregator:attio", slug: "attio", name: "Attio", description: "", brandKey: "attio", entry: null, + applications: [], connections: [], chatEndpoints: [], aggregatorApp: app, upstreamCatalogApp: app, + upstreamApps: [{ connectionId: gateway.id, toolkit: "attio", checkedAt: new Date().toISOString(), freshness: "fresh", accounts: [{ id: "a1", status: accountStatus }], ...snapshot }], + } as unknown as ConnectorRowModel; +} + +describe("pluginTileState", () => { + it("is available until something is connected", () => { + expect(pluginTileState({ ...aggregatorRow("ACTIVE"), upstreamApps: [] }, gateways)).toBe("available"); + }); + + it("reads a healthy aggregator account as connected", () => { + expect(pluginTileState(aggregatorRow("ACTIVE"), gateways)).toBe("connected"); + }); + + it("flags an aggregator account that needs sign-in, is stale, or sits behind an unhealthy gateway", () => { + expect(pluginTileState(aggregatorRow("EXPIRED"), gateways)).toBe("attention"); + expect(pluginTileState(aggregatorRow("INITIATED"), gateways)).toBe("attention"); + expect(pluginTileState(aggregatorRow("ACTIVE", { freshness: "stale" }), gateways)).toBe("attention"); + const paused = new Map([[gateway.id, { ...gateway, status: "draft" } as ToolConnection]]); + expect(pluginTileState(aggregatorRow("ACTIVE"), paused)).toBe("attention"); + }); +}); diff --git a/ui/src/pages/apps/Browse.tsx b/ui/src/pages/apps/Browse.tsx index 6f9d04c3bc8..60f3cf1e66a 100644 --- a/ui/src/pages/apps/Browse.tsx +++ b/ui/src/pages/apps/Browse.tsx @@ -25,16 +25,16 @@ import { useEffect, useMemo, useRef, useState, type ReactNode } from "react"; import { useMutation, useQueries, useQuery, useQueryClient } from "@tanstack/react-query"; import { AlertTriangle, + ArrowLeft, Check, ChevronRight, - ClipboardPaste, Clock3, ExternalLink, Link2, Loader2, MoreHorizontal, PauseCircle, - ServerCog, + Plus, Trash2, } from "lucide-react"; import type { ComposioAppSnapshot, ToolApplication, ToolConnection } from "@paperclipai/shared"; @@ -51,7 +51,14 @@ import { normalizeConnectionQuery, nativeConnectorRequiresCustomerOAuthApp, } from "@paperclipai/shared"; -import { useNavigate } from "@/lib/router"; +import { useNavigate, useParams } from "@/lib/router"; +import { PLUGIN_CATEGORIES, PLUGIN_CATEGORY_ORDER, PLUGIN_GRID, PluginCategories, PluginShelf, PluginTile, isPluginCategoryId, pluginCategoryId, pluginCategorySectionId, type PluginCategoryId, type PluginTileState } from "./PluginMarketplace"; +import { aggregatorPluginCategory } from "./plugin-categories"; +import { PluginSkills } from "./PluginSkills"; +import { ONE_CLICK_PARAM, isOneClickOAuthApp, reserveOneClickPopup } from "@/features/connections/one-click-oauth"; +import { PluginPermissions } from "./PluginPermissions"; +import { PluginsHeader, type PluginsAddOption } from "./PluginsHeader"; +import { PluginConnector, PluginInformation, PluginPageHeader, pluginHost, pluginSignIn } from "./PluginPageSections"; import { useChatConnectorsEnabled, chatProviderVisible } from "@/hooks/useChatConnectorsEnabled"; import { useMemoryConnectorsEnabled } from "@/hooks/useMemoryConnectorsEnabled"; import { useConnectorAvailability } from "@/hooks/useConnectorAvailability"; @@ -127,7 +134,7 @@ import { import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy"; import { cn } from "@/lib/utils"; -type ConnectorRowModel = { +export type ConnectorRowModel = { key: string; slug: string; name: string; @@ -147,6 +154,23 @@ type ConnectorRowModel = { export const CATALOG_PAGE_SIZE = 50; +/** Hand-picked for the "New and noteworthy" shelf; the catalog has no added-on date to sort by. */ +const PLUGIN_ADD_OPTIONS: PluginsAddOption[] = [ + { id: "mcp", title: "MCP server URL", description: "A custom or self-hosted MCP server.", href: "/apps/byo" }, + { id: "config", title: "Paste a config", description: "Connect from an existing setup snippet.", href: "/apps/advanced/paste-config" }, + { id: "assistant", title: "Assistant connection", description: "Use Paperclip from Codex, Claude or OpenCode.", href: "/apps/assistant-connection" }, +]; + +/** How many plugins a category block shows on the browse page before "See all". */ +const CATEGORY_BLOCK_SIZE = 9; + +function rowCategory(row: ConnectorRowModel): PluginCategoryId { + if (row.entry) return pluginCategoryId(row.entry.categories); + return row.aggregatorApp ? aggregatorPluginCategory(row.aggregatorApp) : "other"; +} + +const NOTEWORTHY_PLUGIN_SLUGS = ["cloudflare", "mixpanel", "clickup", "pagerduty", "calendly", "telegram"]; + type ConnectionState = { kind: "connected" | "attention" | "paused" | "draft"; label: string; @@ -323,6 +347,21 @@ function isInstalled(row: ConnectorRowModel) { return row.connections.length > 0 || row.chatEndpoints.length > 0 || Boolean(row.upstreamApps?.some(app => app.accounts.length > 0)) || Boolean(row.networkConnections?.some(connection => connection.status === "connected")); } +export function pluginTileState(row: ConnectorRowModel, connectionById?: ReadonlyMap): PluginTileState { + if (!isInstalled(row)) return "available"; + const needsAction = (state: ConnectionState) => state.kind === "attention" || state.kind === "draft"; + // Accounts an aggregator holds for this app count too: one that needs sign-in, has gone stale + // or sits behind an unhealthy gateway must not read as connected. + const upstreamNeedsAttention = row.upstreamCatalogApp ? (row.upstreamApps ?? []).some((snapshot) => { + const gateway = connectionById?.get(snapshot.connectionId); + return gateway ? snapshot.accounts.some((account) => needsAction(upstreamAccountState(gateway, snapshot, account))) : false; + }) : false; + const needsAttention = upstreamNeedsAttention + || row.connections.some((connection) => needsAction(connectionState(connection))) + || row.chatEndpoints.some((endpoint) => ["attention", "revoked"].includes(endpoint.status) || chatEndpointNeedsSetup(endpoint)); + return needsAttention ? "attention" : "connected"; +} + function connectorAction( row: ConnectorRowModel, chatConnectorsEnabled: boolean, @@ -407,6 +446,8 @@ function accountActionHref( */ export function Browse({ renderAccountDetails = (connection) => connection.connectionPurpose === "ai" && !aiConnectionRouterPluginKey(connection) ? : null }: { renderAccountDetails?: (connection: ToolConnection) => ReactNode } = {}) { const navigate = useNavigate(); + const { pluginKey, categoryId: categoryParam } = useParams<{ pluginKey?: string; categoryId?: string }>(); + const categoryId = isPluginCategoryId(categoryParam) ? categoryParam : null; const preselectedChatAgentId = typeof window === "undefined" ? null @@ -426,8 +467,7 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne const { status: connectivityStatus } = useConnectivity(); const [query, setQuery] = useState(""); const [page, setPage] = useState(1); - const [source, setSource] = useState("paperclip"); - const [expandedSearch, setExpandedSearch] = useState(false); + const [source, setSource] = useState("all"); const [executorToConfigure, setExecutorToConfigure] = useState(null); const [arcadeToConfigure, setArcadeToConfigure] = useState(null); const catalogTop = useRef(null); @@ -438,12 +478,8 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne const [connectionToRemove, setConnectionToRemove] = useState(null); - useEffect(() => { - setBreadcrumbs([{ label: "Connectors" }]); - return () => setBreadcrumbs([]); - }, [setBreadcrumbs]); - useEffect(() => { setQuery(""); setPage(1); setSource("paperclip"); setExpandedSearch(false); setArcadeToConfigure(null); setAggregatorToConnect(null); setAggregatorToManage(null); setInitialAggregatorProvider(undefined); setConnectionToRemove(null); }, [selectedCompanyId]); + useEffect(() => { setQuery(""); setPage(1); setSource("all"); setArcadeToConfigure(null); setAggregatorToConnect(null); setAggregatorToManage(null); setInitialAggregatorProvider(undefined); setConnectionToRemove(null); }, [selectedCompanyId]); useEffect(() => { const params = new URLSearchParams(window.location.search); if (params.get("source") === "installed") setSource("installed"); @@ -946,12 +982,22 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne upstreamAppsBySlug, ]); + const openRow = pluginKey ? rows.find((row) => row.key === pluginKey || row.slug === pluginKey) ?? null : null; + const openRowName = openRow?.name ?? null; + useEffect(() => { + setBreadcrumbs(pluginKey ? [{ label: "Plugins", href: "/apps" }, { label: openRowName ?? "Plugin" }] + : categoryId ? [{ label: "Plugins", href: "/apps" }, { label: PLUGIN_CATEGORIES[categoryId].label }] + : [{ label: "Plugins" }]); + return () => setBreadcrumbs([]); + }, [setBreadcrumbs, pluginKey, openRowName, categoryId]); + useEffect(() => { setQuery(""); setPage(1); }, [categoryId]); + const trimmed = query.trim().toLocaleLowerCase(); const visibleRows = useMemo(() => { const scoped = rows.filter((row) => { + if (categoryId) return rowCategory(row) === categoryId; if (source === "all") return true; if (source === "installed") return isInstalled(row); - if (source === "paperclip") return !row.aggregatorApp || isInstalled(row); return isAppAggregator(source) && ( row.slug === source && isInstalled(row) || row.upstreamApps?.some(snapshot => snapshot.provider === source && snapshot.accounts.length > 0) @@ -961,14 +1007,16 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne if (!trimmed) return scoped; const terms = normalizeConnectionQuery(trimmed).split(" ").filter(Boolean); return scoped.filter((row) => { - const text = normalizeConnectionQuery([row.name, row.slug, row.description, - ...(row.aggregatorApp?.aliases ?? []), ...row.connections.map((connection) => connection.name), - ...(row.networkConnections ?? []).map(connection => connection.name), - ...(row.upstreamApps ?? []).flatMap(app => app.accounts.map(account => account.alias)), - ...row.chatEndpoints.map((endpoint) => endpoint.assignedAgentName)].join(" ")); + // Search reads titles only: the name, its slug and other names the same app goes by. + // The Installed list also shows account names, so those match there. + const text = normalizeConnectionQuery([row.name, row.slug, ...(row.aggregatorApp?.aliases ?? []), + ...(source === "installed" && !categoryId ? [...row.connections.map((connection) => connection.name), + ...(row.networkConnections ?? []).map(connection => connection.name), + ...(row.upstreamApps ?? []).flatMap(app => app.accounts.map(account => account.alias)), + ...row.chatEndpoints.map((endpoint) => endpoint.assignedAgentName)] : [])].join(" ")); return terms.every((term) => text.includes(term)); }); - }, [rows, trimmed, source]); + }, [rows, trimmed, source, categoryId]); const installedRows = visibleRows.filter(isInstalled); const catalogRows = visibleRows.filter(row => !isInstalled(row)); const pageCount = Math.max(1, Math.ceil(catalogRows.length / CATALOG_PAGE_SIZE)); @@ -992,8 +1040,6 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne executor: aggregatorGateways.filter(connection => appConnectionSourceSlug(connection) === "executor"), }), [aggregatorGateways]); function changeQuery(value: string) { - if (source === "paperclip" && !query.trim() && value.trim()) { setSource("all"); setExpandedSearch(true); } - if (expandedSearch && !value.trim()) { setSource("paperclip"); setExpandedSearch(false); } setQuery(value); setPage(1); } function closeAggregatorSetup() { @@ -1011,11 +1057,89 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne } setAggregatorToConnect(app); } - const showAssistantConnection = (source === "paperclip" || source === "all" || + const showAssistantConnection = ( (source === "installed" && (!assistantConnections.loaded || assistantConnections.rows.some(row => !row.revokedAt)))) && (!trimmed || "assistant connection (mcp) paperclip codex claude opencode".includes(trimmed)); - const showCustomConnector = - (source === "paperclip" || source === "all") && (!trimmed || "connect your own tool custom mcp server".includes(trimmed)); + + const marketplace = source === "all" && !trimmed && !categoryId; + const fullRows = (items: T[], max: number) => items.slice(0, Math.min(max, items.length - (items.length % 3 === 0 || items.length < 3 ? 0 : items.length % 3))); + const featuredRows = marketplace ? fullRows(visibleRows.filter((row) => row.entry?.featured), 9) : []; + const noteworthyRows = marketplace ? fullRows(NOTEWORTHY_PLUGIN_SLUGS.flatMap((slug) => visibleRows.filter((row) => row.slug === slug && !row.entry?.featured)), 6) : []; + const shelvedKeys = new Set([...featuredRows, ...noteworthyRows].map((row) => row.key)); + const categoryGroups = marketplace + ? PLUGIN_CATEGORY_ORDER.map((id) => { + const all = visibleRows.filter((row) => rowCategory(row) === id); + return { id, total: all.length, rows: all.filter((row) => !shelvedKeys.has(row.key)).slice(0, CATEGORY_BLOCK_SIZE) }; + }).filter((group) => group.total > 0) + : []; + const openCategory = (id: PluginCategoryId) => { navigate(`/apps/category/${id}`); catalogTop.current?.scrollIntoView?.({ block: "start" }); }; + const setupEnabledFor = (row: ConnectorRowModel) => connectorAvailability.enabled(row.entry ?? getConnectableAppDefinition(row.slug)) + && row.applications.every(application => connectorAvailability.enabled(getAppDefinitionForApplicationKey(application.applicationKey))); + const renderConnectorCard = (row: ConnectorRowModel, variant: "list" | "page" = "list") => ( + void requestConnectionRemoval(target)} + preselectedAgentId={preselectedChatAgentId} + chatConnectorsEnabled={chatConnectorsEnabled} + setupEnabled={setupEnabledFor(row)} + githubReviewBotsEnabled={githubEnabled} + onConnectAggregator={connectAggregator} + onManageAggregator={(app, connectionId) => setAggregatorToManage({ app, connectionId })} + onRefreshAggregator={connectionId => refreshAggregator.mutate(connectionId)} + aggregatorRefreshState={aggregatorRefreshState} + discoveryByConnection={discoveryByConnection} + onConfigureArcade={connection => setArcadeToConfigure(connection)} + onConfigureExecutor={connection => setExecutorToConfigure(connection)} + defaultExpanded={variant === "page" || Boolean(trimmed)} + variant={variant} + searchQuery={trimmed} + /> + ); + const connectActionFor = (row: ConnectorRowModel) => { + if (row.networkConnections || !setupEnabledFor(row)) return null; + const action = connectorAction(row, chatProviderVisible(row.slug, chatConnectorsEnabled, githubEnabled), preselectedChatAgentId); + return { + label: action.label, + title: action.title, + disabled: !action.href && !row.aggregatorApp, + oneClickHref: !isInstalled(row) && !row.aggregatorApp && action.href?.startsWith("/apps/connect?source=") && isOneClickOAuthApp(row.entry) ? action.href : null, + onSelect: () => { + if (row.aggregatorApp && isInstalled(row)) setAggregatorToManage({ app: row.aggregatorApp, connectionId: row.upstreamApps?.find(app => app.accounts.length > 0)?.connectionId }); + else if (row.aggregatorApp) connectAggregator(row.aggregatorApp); + else if (action.href) navigate(row.slug === "agentmail" ? `${action.href}&setupId=${crypto.randomUUID()}` : action.href); + }, + }; + }; + // A one-click connector starts sign-in straight from its card: the window opens with this click and the connect flow takes it over. + const tileAction = (action: ReturnType) => { + const href = action?.oneClickHref; + if (!action || !href) return action; + return { ...action, onSelect: () => navigate(reserveOneClickPopup() ? `${href}&${ONE_CLICK_PARAM}=1` : href) }; + }; + const renderTile = (row: ConnectorRowModel) => { + const state = pluginTileState(row, connectionById); + return ( + navigate(row.networkConnections ? "/apps/tailscale" : `/apps/plugin/${encodeURIComponent(row.key)}`)} + action={tileAction(connectActionFor(row))} + /> + ); + }; if (!selectedCompanyId) { return ( @@ -1035,12 +1159,24 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne // Only a real failure shows the notice; loaded connectors stay through a transient refetch failure. const loadFailure = catalogViews.find((view) => view.kind === "error"); const loadFailed = loadFailure !== undefined; - const nothingMatches = visibleRows.length === 0 && !showCustomConnector && !showAssistantConnection; + const nothingMatches = visibleRows.length === 0 && !showAssistantConnection; return ( -
- { setSource(value); setExpandedSearch(false); setPage(1); }} /> +
+ {pluginKey ? null : categoryId ? ( +
+ +

+ {PLUGIN_CATEGORIES[categoryId].label} + {loading ? null : ({visibleRows.length.toLocaleString()})} +

+
+ ) : } + {pluginKey ? null : { setSource(value); setPage(1); }} />} {loadFailure ? ( connection.conne ))}
- ) : nothingMatches ? ( + ) : nothingMatches && !pluginKey ? (

No connectors match “{query.trim()}”.

) : ( -
- {showAssistantConnection && } - {paginatedRows.map((row) => ( - row.networkConnections ? : +
+ + +
+ {openRow.networkConnections ? ( +
+ ) : isInstalled(openRow) ? ( +
+

+ Accounts {openRow.connections.length + openRow.chatEndpoints.length || null} +

+
{renderConnectorCard(openRow, "page")}
+
+ ) : null} + {openRow.networkConnections ? null : } + connection.id)} onNavigate={navigate} /> + connectionDisplayNameForOwner(connection, openRow.name, connectionOwnerProfile(connection, userProfileById))} onNavigate={navigate} - onRequestRemove={target => void requestConnectionRemoval(target)} - preselectedAgentId={preselectedChatAgentId} - chatConnectorsEnabled={chatConnectorsEnabled} - setupEnabled={connectorAvailability.enabled(row.entry ?? getConnectableAppDefinition(row.slug)) - && row.applications.every(application => connectorAvailability.enabled(getAppDefinitionForApplicationKey(application.applicationKey)))} - githubReviewBotsEnabled={githubEnabled} - onConnectAggregator={connectAggregator} - onManageAggregator={(app, connectionId) => setAggregatorToManage({ app, connectionId })} - onRefreshAggregator={connectionId => refreshAggregator.mutate(connectionId)} - aggregatorRefreshState={aggregatorRefreshState} - discoveryByConnection={discoveryByConnection} - onConfigureArcade={connection => setArcadeToConfigure(connection)} - onConfigureExecutor={connection => setExecutorToConfigure(connection)} - defaultExpanded={Boolean(trimmed)} - searchQuery={trimmed} /> - ))} - {showCustomConnector ? ( - - ) : null} -
+ +
+ ) : pluginKey ? ( +
+

This plugin isn’t in the catalog anymore.

+ +
+ ) : source === "installed" && !categoryId ? ( +
+ {showAssistantConnection && } + {paginatedRows.map((row) => ( + row.networkConnections ? :
{renderConnectorCard(row)}
+ ))} +
+ ) : marketplace ? ( +
+ {featuredRows.length > 0 ? {featuredRows.map(renderTile)} : null} + {noteworthyRows.length > 0 ? {noteworthyRows.map(renderTile)} : null} + {categoryGroups.map((group) => ( + group.rows.length > 0 ? group.rows.length ? () => openCategory(group.id) : undefined}>{group.rows.map(renderTile)} : null + ))} + group.id)} onOpen={openCategory} /> +
+ ) : ( +
+
{paginatedRows.map(renderTile)}
+
+ ) )} {accountLoadErrors.length ?

Couldn’t load {Array.from(new Set(accountLoadErrors)).join(" or ")} accounts. Use Refresh in the connection’s menu to try again.

: null} - {!loading && catalogRows.length > 0 ?
{connected.length > 0 ?
diff --git a/ui/storybook/stories/chat-channels/github-connections.stories.tsx b/ui/storybook/stories/chat-channels/github-connections.stories.tsx index 90746a0e873..7d58d932d49 100644 --- a/ui/storybook/stories/chat-channels/github-connections.stories.tsx +++ b/ui/storybook/stories/chat-channels/github-connections.stories.tsx @@ -91,7 +91,7 @@ const meta = { title: "Apps, channels, and extensions/External chat and email/Connections/GitHub and Code Review Bot", component: GitHubConnections, play: async ({ canvasElement }) => { - await userEvent.type(await within(canvasElement).findByRole("searchbox", { name: "Search connectors" }), "GitHub"); + await userEvent.type(await within(canvasElement).findByRole("searchbox", { name: "Search plugins" }), "GitHub"); }, parameters: { layout: "fullscreen", diff --git a/ui/storybook/stories/gateways-profiles/public-mcp-journey.stories.tsx b/ui/storybook/stories/gateways-profiles/public-mcp-journey.stories.tsx index fa229b0e910..817d517e20b 100644 --- a/ui/storybook/stories/gateways-profiles/public-mcp-journey.stories.tsx +++ b/ui/storybook/stories/gateways-profiles/public-mcp-journey.stories.tsx @@ -51,7 +51,9 @@ export const Unavailable: Story = { parameters: { initialEntries: ["/PAP/apps/as export const Loading: Story = { parameters: { initialEntries: ["/PAP/apps/assistant-connection"], fixture: { loading: true } } }; export const NavigationCheck: Story = { play: async ({ canvasElement }) => { const c = within(canvasElement); - await userEvent.click(await c.findByRole("button", { name: "Set up Assistant Connection (MCP)" })); + // Assistant connection setup now starts from the Add menu on the Plugins page. + await userEvent.click(await c.findByRole("button", { name: "Add" })); + await userEvent.click(await within(canvasElement.ownerDocument.body).findByRole("menuitem", { name: /Assistant connection/ })); await expect(await c.findByRole("button", { name: "Copy invitation" })).toBeVisible(); await userEvent.click(c.getByText("Set up manually")); await expect(c.getByText("opencode mcp auth paperclip")).toBeVisible(); diff --git a/ui/storybook/stories/plugins/plugin-management.stories.tsx b/ui/storybook/stories/plugins/plugin-management.stories.tsx index a388969fc05..37c5af2e7bb 100644 --- a/ui/storybook/stories/plugins/plugin-management.stories.tsx +++ b/ui/storybook/stories/plugins/plugin-management.stories.tsx @@ -46,7 +46,7 @@ export const PermissionDenied: Story = { async function install() { const c = within(document.body); await userEvent.click( - await c.findByRole("button", { name: "Install Plugin" }), + await c.findByRole("button", { name: "Install system plugin" }), ); await userEvent.type( await c.findByRole("textbox"), diff --git a/ui/storybook/stories/runs-adapters/ai-connections.stories.tsx b/ui/storybook/stories/runs-adapters/ai-connections.stories.tsx index 1c94ef27271..4a7a8b3efeb 100644 --- a/ui/storybook/stories/runs-adapters/ai-connections.stories.tsx +++ b/ui/storybook/stories/runs-adapters/ai-connections.stories.tsx @@ -128,9 +128,9 @@ export const ProviderCatalog: Story = { await expect(await canvas.findByRole("button", { name: "Add account Anthropic" })).toBeVisible(); await expect(canvas.getByRole("button", { name: "Connect GitHub" })).toBeVisible(); await expect(canvas.getByRole("button", { name: "Connect Gmail" })).toBeVisible(); - await userEvent.type(canvas.getByPlaceholderText("Search connectors…"), "Claude"); + await userEvent.type(canvas.getByPlaceholderText("Search plugins…"), "Claude"); await expect(canvas.queryByRole("button", { name: "Connect Gmail" })).not.toBeInTheDocument(); - await userEvent.clear(canvas.getByPlaceholderText("Search connectors…")); + await userEvent.clear(canvas.getByPlaceholderText("Search plugins…")); }, }; export const ConnectFromExistingCatalog: Story = { @@ -148,7 +148,9 @@ export const ConnectFromExistingCatalog: Story = { await userEvent.click(canvas.getByRole("button", { name: "Use connection" })); await expect(await canvas.findByLabelText("AI account settings")).toBeVisible(); await expect(canvas.getByRole("heading", { name: "My additional Claude account" })).toBeVisible(); - await userEvent.click(canvas.getByRole("link", { name: "Connectors" })); + await userEvent.click(canvas.getByRole("link", { name: "Plugins" })); + // The catalog opens on plugin cards; accounts are listed under Installed. + await userEvent.click(await canvas.findByRole("radio", { name: "Installed" })); await expect(await canvas.findByRole("button", { name: "Open My additional Claude account permissions" })).toBeVisible(); await expect(canvas.getByRole("button", { name: "Open My Claude subscription permissions" })).toBeVisible(); }, @@ -274,7 +276,8 @@ export const ConnectorDefaultMenu: Story = { parameters: { paperclip: { capabilities: ["runs-adapters/validation", "connection-setup/catalog"], status: "current", implementation: "production", boundary: "fixtures", notes: "Production Browse/ConnectorCard crown and dropdown. Fixture API persists one default per owner/provider across methods; provider authentication and real API authorization are not exercised." } }, play: async ({ canvasElement }) => { - const heading = await within(canvasElement).findByRole("heading", { name: "OpenAI" }); + await userEvent.click(await within(canvasElement).findByRole("radio", { name: "Installed" })); + const heading = await within(canvasElement).findByRole("heading", { name: "OpenAI", level: 2 }); const provider = within(heading.closest('[data-app-slug="openai"]')!); const body = within(canvasElement.ownerDocument.body); await userEvent.click(await provider.findByRole("button", { name: "2 connections" })); @@ -293,7 +296,8 @@ export const ConnectorDefaultRetry: Story = { args: { host: "connections", initialConnections: connectorDefaultAccounts, failDefaultOnce: true }, play: async ({ canvasElement }) => { const canvas = within(canvasElement); - const heading = await canvas.findByRole("heading", { name: "OpenAI" }); + await userEvent.click(await canvas.findByRole("radio", { name: "Installed" })); + const heading = await canvas.findByRole("heading", { name: "OpenAI", level: 2 }); const provider = within(heading.closest('[data-app-slug="openai"]')!); const body = within(canvasElement.ownerDocument.body); await userEvent.click(await provider.findByRole("button", { name: "2 connections" }));