mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 01:39:51 +01:00
feat(ui): turn Connectors into a Plugins marketplace (#22869)
## 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 `<Verb> <App name>` 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 <noreply@anthropic.com>
This commit is contained in:
1 parent
3773d0f40f
commit
a336e295f6
78 files changed
+1989
-534
No files matched your search
@@ -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<string, AggregatorAppCatalogEntry>();
|
||||
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) =>
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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$`),
|
||||
|
||||
@@ -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 });
|
||||
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -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$`));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -308,16 +308,8 @@ for (const journey of [
|
||||
const connections: Record<string, { id: string; name: string }> = {};
|
||||
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}`);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
@@ -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}`);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
@@ -185,7 +185,7 @@ const states: Record<string, Record<string, State>> = {
|
||||
},
|
||||
"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." },
|
||||
|
||||
@@ -211,6 +211,8 @@ function boardRoutes(streamlinedUiEnabled: boolean, combinedInboxTasksEnabled: b
|
||||
<Route path="tools" element={<LegacyToolsRedirect />} />
|
||||
<Route path="tools/:tab" element={<LegacyToolsRedirect />} />
|
||||
<Route path="apps" element={<Browse />} />
|
||||
<Route path="apps/plugin/:pluginKey" element={<Browse />} />
|
||||
<Route path="apps/category/:categoryId" element={<Browse />} />
|
||||
<Route path="apps/tailscale" element={<TailscaleConnector />} />
|
||||
<Route path="apps/assistant-connection" element={<AssistantConnection />} />
|
||||
<Route path="apps/browse" element={<Navigate to="/apps" replace />} />
|
||||
|
||||
@@ -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() {
|
||||
</Link>
|
||||
<div className="flex items-center gap-2 px-2 py-1">
|
||||
<AppWindow className="h-4 w-4 text-muted-foreground shrink-0" />
|
||||
<span className="flex-1 truncate text-sm font-bold text-foreground">Connectors</span>
|
||||
<span className="flex-1 truncate text-sm font-bold text-foreground">Plugins</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -66,15 +64,7 @@ export function AppsSidebar() {
|
||||
Connectors
|
||||
</div>
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<SidebarNavItem to="/apps" label="Browse" icon={Store} end />
|
||||
<SidebarNavItem
|
||||
to="/apps/review"
|
||||
label="Review"
|
||||
icon={ShieldQuestion}
|
||||
badge={reviewCount > 0 ? reviewCount : undefined}
|
||||
badgeTone="warning"
|
||||
badgeLabel="waiting for your OK"
|
||||
/>
|
||||
<SidebarNavItem to="/apps" label="All plugins" icon={Store} end />
|
||||
</div>
|
||||
<div className="px-3 pb-1 pt-4 text-(length:--text-micro) font-semibold uppercase tracking-wide text-muted-foreground">
|
||||
Developer
|
||||
|
||||
@@ -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 <ChatSetupSidebar />;
|
||||
const chatDetail = pathname.match(/\/apps\/chat\/([^/]+)(?:\/(?:settings|access|conversations|activity)|\/reviews(?:\/[^/]+)?)?\/?$/);
|
||||
@@ -33,20 +32,12 @@ export function AppsSidebar() {
|
||||
return (
|
||||
<aside className="w-full h-full min-h-0 border-r border-border bg-background flex flex-col">
|
||||
<nav
|
||||
aria-label="Connectors"
|
||||
aria-label="Plugins"
|
||||
data-slot="contextual-sidebar-nav"
|
||||
className={contextualSidebarStyles.nav}
|
||||
>
|
||||
<div data-slot="contextual-sidebar-group" className={contextualSidebarStyles.group}>
|
||||
<SidebarNavItem to="/apps" label="Browse" icon={Store} end />
|
||||
<SidebarNavItem
|
||||
to="/apps/review"
|
||||
label="Review"
|
||||
icon={ShieldQuestion}
|
||||
badge={reviewCount > 0 ? reviewCount : undefined}
|
||||
badgeTone="warning"
|
||||
badgeLabel="waiting for your OK"
|
||||
/>
|
||||
<SidebarNavItem to="/apps" label="All plugins" icon={Store} end />
|
||||
</div>
|
||||
{developerTabs.length > 0 ? (
|
||||
<div data-slot="contextual-sidebar-section" className={contextualSidebarStyles.section}>
|
||||
@@ -79,14 +70,3 @@ export function AppsSidebar() {
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
/** 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 <nav aria-label="Connectors" className="mb-4 flex rounded-lg border border-border bg-background p-1">
|
||||
<NavLink to="/apps" end className={segmentClass}>Browse</NavLink>
|
||||
<NavLink to="/apps/review" className={segmentClass}>Review{reviewCount > 0 && <span className="rounded-full bg-muted px-1.5 text-xs" aria-label={`${reviewCount} waiting for your OK`}>{reviewCount}</span>}</NavLink>
|
||||
</nav>;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ export function CompanySettingsSidebar() {
|
||||
{showPlugins && (
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/plugins`}
|
||||
label="Plugins"
|
||||
label="System plugins"
|
||||
icon={Puzzle}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -167,7 +167,7 @@ export function CompanySettingsSidebar() {
|
||||
{showPlugins && (
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/plugins`}
|
||||
label="Plugins"
|
||||
label="System plugins"
|
||||
icon={Puzzle}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -42,7 +42,7 @@ export function DesignSidebar({ onNewTask, recentTasks = [] }: { onNewTask: () =
|
||||
<SidebarSection label="Org">
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/agents`} label="Agents" icon={Users} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/skills`} label="Skills" icon={Boxes} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/apps`} label="Connectors" icon={Unplug} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/apps`} label="Plugins" icon={Unplug} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/activity`} label="Audit" icon={History} />
|
||||
</SidebarSection>
|
||||
{companyRecentTasks.length > 0 ? <div className="design-sidebar-recents">
|
||||
|
||||
@@ -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) ? (
|
||||
<AppsSidebar />
|
||||
) : routeSidebarSlot ? (
|
||||
<PluginSlotMount
|
||||
|
||||
@@ -12,7 +12,8 @@ import { Outlet, useLocation, useNavigate, useNavigationType, useParams } from "
|
||||
import { Sidebar } from "./Sidebar";
|
||||
import { CompanySettingsSidebar } from "./CompanySettingsSidebar";
|
||||
import { CompanySettingsNav } from "./access/CompanySettingsNav";
|
||||
import { AppsSidebar, AppsMobileNav } from "./AppsSidebar";
|
||||
import { AppsSidebar, useAppsDeveloperTabs } from "./AppsSidebar";
|
||||
import { appsRouteHasRail } from "../pages/apps/apps-rail";
|
||||
import { AppDetailSidebar } from "./AppConnectionSidebar";
|
||||
import { AgentContextualSidebar } from "./AgentContextualSidebar";
|
||||
import { SkillsContextualSidebar } from "./SkillsContextualSidebar";
|
||||
@@ -70,6 +71,8 @@ function getCompanyRouteSegment(pathname: string, companyPrefix: string | undefi
|
||||
}
|
||||
|
||||
const RESERVED_APP_SUBPATHS = new Set([
|
||||
"plugin",
|
||||
"category",
|
||||
"browse",
|
||||
"connections",
|
||||
"assistant-connection",
|
||||
@@ -152,6 +155,7 @@ export function Layout({ sidebarSections }: { sidebarSections?: ReactNode }) {
|
||||
const useInsetTaskDetailHeader = useStreamlinedTaskDetailShell && !isAgentChatRoute;
|
||||
const isToolsRoute = companyPathSegments[0]?.toLowerCase() === "tools";
|
||||
const isAppsRoute = companyPathSegments[0]?.toLowerCase() === "apps";
|
||||
const appsDeveloperTabs = useAppsDeveloperTabs();
|
||||
const appDetailConnectionId =
|
||||
isAppsRoute && companyPathSegments[1] && !RESERVED_APP_SUBPATHS.has(companyPathSegments[1].toLowerCase())
|
||||
? companyPathSegments[1]
|
||||
@@ -209,7 +213,7 @@ export function Layout({ sidebarSections }: { sidebarSections?: ReactNode }) {
|
||||
<AppDetailSidebar kind="connection" connectionId={appDetailConnectionId} />
|
||||
) : appDetailApplicationId ? (
|
||||
<AppDetailSidebar kind="application" applicationId={appDetailApplicationId} />
|
||||
) : isAppsRoute || isToolsRoute ? (
|
||||
) : appsRouteHasRail(companyPathSegments, appsDeveloperTabs.length > 0) ? (
|
||||
<AppsSidebar />
|
||||
) : routeSidebarSlot ? (
|
||||
streamlinedUiEnabled ? (
|
||||
@@ -657,7 +661,6 @@ export function Layout({ sidebarSections }: { sidebarSections?: ReactNode }) {
|
||||
: "overflow-auto [scrollbar-gutter:stable]",
|
||||
)}
|
||||
>
|
||||
{isMobile && isAppsRoute && (!companyPathSegments[1] || companyPathSegments[1] === "review") ? <AppsMobileNav /> : null}
|
||||
{hasUnknownCompanyPrefix ? (
|
||||
<NotFoundPage
|
||||
scope="invalid_company_prefix"
|
||||
|
||||
@@ -217,7 +217,7 @@ export function Sidebar() {
|
||||
|
||||
<SidebarSection label="Company" collapsible={{ open: companyOpen, onOpenChange: setCompanyOpen }}>
|
||||
<SidebarNavItem to="/org" label="Org" icon={Network} />
|
||||
{showApps ? <SidebarNavItem to="/apps" label="Connectors" icon={Unplug} /> : null}
|
||||
{showApps ? <SidebarNavItem to="/apps" label="Plugins" icon={Unplug} /> : null}
|
||||
<SidebarNavItem to="/timeline" label="Timeline" icon={GanttChartSquare} />
|
||||
<SidebarNavItem to="/costs" label="Costs" icon={DollarSign} />
|
||||
{/* One entry — /audit merged into the rich Activity feed (PAP-16302). */}
|
||||
|
||||
@@ -276,7 +276,7 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
>
|
||||
<SidebarNavItem to="/agents" label="Agents" icon={Users} />
|
||||
<SidebarNavItem to="/skills" label="Skills" icon={Boxes} />
|
||||
<SidebarNavItem to="/apps" label="Connectors" icon={Unplug} />
|
||||
<SidebarNavItem to="/apps" label="Plugins" icon={Unplug} />
|
||||
<SidebarNavItem to="/activity" label="Audit" icon={History} />
|
||||
</SidebarSection>
|
||||
) : null}
|
||||
@@ -294,7 +294,7 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
collapsible={{ open: organizationOpen, onOpenChange: setOrganizationOpen }}
|
||||
>
|
||||
<SidebarNavItem to="/org" label="Org" icon={Network} />
|
||||
<SidebarNavItem to="/apps" label="Connectors" icon={Unplug} />
|
||||
<SidebarNavItem to="/apps" label="Plugins" icon={Unplug} />
|
||||
<SidebarNavItem to="/timeline" label="Timeline" icon={GanttChartSquare} />
|
||||
<SidebarNavItem to="/costs" label="Costs" icon={DollarSign} />
|
||||
<SidebarNavItem to="/activity" label="Activity" icon={History} />
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -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 (
|
||||
<OAuthConnectStateScreen
|
||||
@@ -2501,87 +2601,7 @@ function StandardConnectionSetupFlow({
|
||||
settingsValid={additionalSettingsValid && instructionsValid}
|
||||
onOpenAuthorization={openAuthorizationTab}
|
||||
cancelling={cancellingSignIn}
|
||||
onRetry={async () => {
|
||||
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({
|
||||
<AppLogo name={appName} logoUrl={logoUrl} darkLogoUrl={darkLogoUrl} size={28} />
|
||||
<h2 className="text-2xl font-bold tracking-tight">{appName} is ready.</h2>
|
||||
</div>
|
||||
{statedDefault ? <p className="mt-3 text-sm text-muted-foreground">{statedDefault}</p> : null}
|
||||
{statedDefault ? (
|
||||
<p className="mt-3 text-sm text-muted-foreground">
|
||||
{statedDefault}
|
||||
{onChangeDefault ? (
|
||||
<>
|
||||
{" "}
|
||||
<button type="button" className="font-medium text-foreground underline underline-offset-2" onClick={onChangeDefault}>
|
||||
Change
|
||||
</button>
|
||||
</>
|
||||
) : null}
|
||||
</p>
|
||||
) : null}
|
||||
<dl className="mx-auto mt-6 max-w-xs space-y-1 text-left">
|
||||
{summary.map((line) => (
|
||||
<div key={line.label} className="flex items-baseline justify-between gap-4">
|
||||
|
||||
@@ -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<typeof vi.fn> };
|
||||
}
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -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<string> = 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;
|
||||
}
|
||||
@@ -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() {
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Puzzle className="h-6 w-6 text-muted-foreground" />
|
||||
<h1 className="text-xl font-semibold">Plugin Manager</h1>
|
||||
<h1 className="text-xl font-semibold">System plugins</h1>
|
||||
</div>
|
||||
|
||||
<Dialog open={installDialogOpen} onOpenChange={setInstallDialogOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<Button size="sm" className="gap-2">
|
||||
<Plus className="h-4 w-4" />
|
||||
Install Plugin
|
||||
Install system plugin
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Install Plugin</DialogTitle>
|
||||
<DialogTitle>Install system plugin</DialogTitle>
|
||||
<DialogDescription>
|
||||
Enter the npm package name of the plugin you wish to install.
|
||||
</DialogDescription>
|
||||
@@ -255,7 +255,7 @@ export function PluginManager() {
|
||||
<div className="flex items-start gap-3">
|
||||
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0 text-amber-700" />
|
||||
<div className="space-y-1 text-sm">
|
||||
<p className="font-medium text-foreground">Plugins are alpha.</p>
|
||||
<p className="font-medium text-foreground">System plugins are alpha.</p>
|
||||
<p className="text-muted-foreground">
|
||||
The plugin runtime and API surface are still changing. Expect breaking changes while this feature settles.
|
||||
</p>
|
||||
@@ -266,7 +266,7 @@ export function PluginManager() {
|
||||
<section className="space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<FlaskConical className="h-5 w-5 text-muted-foreground" />
|
||||
<h2 className="text-base font-semibold">Available Plugins</h2>
|
||||
<h2 className="text-base font-semibold">Available system plugins</h2>
|
||||
<Badge variant="outline">Bundled</Badge>
|
||||
</div>
|
||||
|
||||
@@ -376,14 +376,14 @@ export function PluginManager() {
|
||||
<section className="space-y-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<Puzzle className="h-5 w-5 text-muted-foreground" />
|
||||
<h2 className="text-base font-semibold">Installed Plugins</h2>
|
||||
<h2 className="text-base font-semibold">Installed system plugins</h2>
|
||||
</div>
|
||||
|
||||
{!installedPlugins.length ? (
|
||||
<Card className="bg-muted/30">
|
||||
<CardContent className="flex flex-col items-center justify-center py-10">
|
||||
<Puzzle className="h-10 w-10 text-muted-foreground mb-4" />
|
||||
<p className="text-sm font-medium">No plugins installed</p>
|
||||
<p className="text-sm font-medium">No system plugins installed</p>
|
||||
<p className="text-xs text-muted-foreground mt-1">
|
||||
Install a plugin to extend functionality.
|
||||
</p>
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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 }) {
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function enabledCatalogIds(profile: ToolProfileConfiguration | undefined): Set<string> {
|
||||
const ids = new Set<string>();
|
||||
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<string> {
|
||||
const ids = new Set<string>();
|
||||
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]),
|
||||
};
|
||||
}
|
||||
@@ -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) },
|
||||
]);
|
||||
|
||||
@@ -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 (
|
||||
<div className="max-w-3xl space-y-6 pb-12">
|
||||
<div className="mx-auto w-full max-w-3xl space-y-6 pb-12">
|
||||
<Button asChild variant="ghost" size="sm" className="-ml-3 h-8 text-muted-foreground">
|
||||
<Link to="/apps"><ArrowLeft className="size-4" aria-hidden />Plugins</Link>
|
||||
</Button>
|
||||
<header>
|
||||
<h1 className="text-2xl font-bold tracking-tight">Review</h1>
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
|
||||
@@ -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 <p className="text-sm text-muted-foreground">Select an organization to connect an assistant.</p>;
|
||||
|
||||
@@ -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<string, unknown> = {}): 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");
|
||||
});
|
||||
});
|
||||
+259
-167
@@ -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<string, ToolConnection>): 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) ? <ManagedAiConnectionRow connection={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<CatalogSource>("paperclip");
|
||||
const [expandedSearch, setExpandedSearch] = useState(false);
|
||||
const [source, setSource] = useState<CatalogSource>("all");
|
||||
const [executorToConfigure, setExecutorToConfigure] = useState<ToolConnection | null>(null);
|
||||
const [arcadeToConfigure, setArcadeToConfigure] = useState<ToolConnection | null>(null);
|
||||
const catalogTop = useRef<HTMLDivElement>(null);
|
||||
@@ -438,12 +478,8 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
const [connectionToRemove, setConnectionToRemove] =
|
||||
useState<ConnectionRemovalTarget | null>(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 = <T,>(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") => (
|
||||
<ConnectorCard
|
||||
renderAccountDetails={renderAccountDetails}
|
||||
aiDefaults={aiDefaults}
|
||||
row={row}
|
||||
userProfileById={userProfileById}
|
||||
chatAgentById={chatAgentById}
|
||||
connectionById={connectionById}
|
||||
onNavigate={navigate}
|
||||
onRequestRemove={target => 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<typeof connectActionFor>) => {
|
||||
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 (
|
||||
<PluginTile
|
||||
key={row.key}
|
||||
slug={row.slug}
|
||||
name={row.name}
|
||||
description={row.description}
|
||||
brandKey={row.brandKey}
|
||||
logoUrl={row.logoUrl}
|
||||
darkLogoUrl={row.darkLogoUrl}
|
||||
state={state}
|
||||
statusLabel={state === "attention" ? "Needs attention" : "Connected"}
|
||||
onOpen={() => 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 (
|
||||
<div ref={catalogTop} className="max-w-5xl space-y-5 pb-12">
|
||||
<ConnectorsToolbar query={query} onQueryChange={changeQuery} source={source}
|
||||
onSourceChange={value => { setSource(value); setExpandedSearch(false); setPage(1); }} />
|
||||
<div ref={catalogTop} className="mx-auto w-full max-w-6xl space-y-8 pb-12">
|
||||
{pluginKey ? null : categoryId ? (
|
||||
<div className="flex flex-col gap-2">
|
||||
<Button type="button" variant="ghost" size="sm" className="-ml-3 h-8 self-start text-muted-foreground" onClick={() => navigate("/apps")}>
|
||||
<ArrowLeft aria-hidden />
|
||||
Plugins
|
||||
</Button>
|
||||
<p className="text-2xl leading-8 font-semibold tracking-tight text-foreground">
|
||||
{PLUGIN_CATEGORIES[categoryId].label}
|
||||
{loading ? null : <span className="font-normal text-muted-foreground tabular-nums"> ({visibleRows.length.toLocaleString()})</span>}
|
||||
</p>
|
||||
</div>
|
||||
) : <PluginsHeader options={PLUGIN_ADD_OPTIONS} onNavigate={navigate} />}
|
||||
{pluginKey ? null : <ConnectorsToolbar query={query} onQueryChange={changeQuery} source={source} hideSources={Boolean(categoryId)}
|
||||
onSourceChange={value => { setSource(value); setPage(1); }} />}
|
||||
|
||||
{loadFailure ? (
|
||||
<QueryErrorState
|
||||
@@ -1069,50 +1205,88 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
<Skeleton key={index} className="h-24 w-full rounded-xl" />
|
||||
))}
|
||||
</div>
|
||||
) : nothingMatches ? (
|
||||
) : nothingMatches && !pluginKey ? (
|
||||
<div className="flex flex-col items-start gap-3 rounded-xl border border-dashed border-border bg-card px-4 py-6 text-sm text-muted-foreground">
|
||||
<p className="flex items-center gap-2"><Link2 className="h-4 w-4" />No connectors match “{query.trim()}”.</p>
|
||||
<Button variant="outline" size="sm" onClick={() => changeQuery("")}>Clear search</Button>
|
||||
</div>
|
||||
) : (
|
||||
<div className={cn("space-y-3", ANALYTICS_MASK_CLASS)} role="list" aria-label="Connector list">
|
||||
{showAssistantConnection && <AssistantConnectionCard onNavigate={navigate} />}
|
||||
{paginatedRows.map((row) => (
|
||||
row.networkConnections ? <TailscaleConnectorCard key={row.key} onNavigate={navigate} /> : <ConnectorCard
|
||||
renderAccountDetails={renderAccountDetails}
|
||||
aiDefaults={aiDefaults}
|
||||
key={row.key}
|
||||
row={row}
|
||||
userProfileById={userProfileById}
|
||||
chatAgentById={chatAgentById}
|
||||
connectionById={connectionById}
|
||||
openRow ? (
|
||||
<div className={cn("mx-auto flex w-full max-w-3xl flex-col gap-8", ANALYTICS_MASK_CLASS)}>
|
||||
<div className="flex flex-col gap-4">
|
||||
<Button type="button" variant="ghost" size="sm" className="-ml-3 h-8 self-start text-muted-foreground" onClick={() => navigate("/apps")}>
|
||||
<ArrowLeft aria-hidden />
|
||||
Plugins
|
||||
</Button>
|
||||
<PluginPageHeader
|
||||
name={openRow.name}
|
||||
kind={`Connector · ${PLUGIN_CATEGORIES[pluginCategoryId(openRow.entry?.categories)].label}`}
|
||||
description={openRow.description}
|
||||
brandKey={openRow.brandKey}
|
||||
logoUrl={openRow.logoUrl}
|
||||
darkLogoUrl={openRow.darkLogoUrl}
|
||||
state={pluginTileState(openRow, connectionById)}
|
||||
docsUrl={openRow.entry?.docsUrl}
|
||||
connect={connectActionFor(openRow)}
|
||||
/>
|
||||
</div>
|
||||
{openRow.networkConnections ? (
|
||||
<div role="list" aria-label="Connector list"><TailscaleConnectorCard onNavigate={navigate} /></div>
|
||||
) : isInstalled(openRow) ? (
|
||||
<section aria-labelledby="plugin-accounts-title" className="flex flex-col gap-2">
|
||||
<h2 id="plugin-accounts-title" className="flex items-baseline gap-2 px-4 text-sm text-muted-foreground">
|
||||
Accounts <span className="tabular-nums">{openRow.connections.length + openRow.chatEndpoints.length || null}</span>
|
||||
</h2>
|
||||
<div role="list" aria-label="Connector list">{renderConnectorCard(openRow, "page")}</div>
|
||||
</section>
|
||||
) : null}
|
||||
{openRow.networkConnections ? null : <PluginConnector name={openRow.name} host={pluginHost(openRow.entry?.methods)} signIn={pluginSignIn(openRow.entry?.methods)} />}
|
||||
<PluginSkills companyId={selectedCompanyId} slug={openRow.slug} name={openRow.name} connectionIds={openRow.connections.map((connection) => connection.id)} onNavigate={navigate} />
|
||||
<PluginPermissions
|
||||
companyId={selectedCompanyId}
|
||||
connections={openRow.connections}
|
||||
accountName={(connection) => 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 ? (
|
||||
<CustomConnectorCard onNavigate={navigate} />
|
||||
) : null}
|
||||
</div>
|
||||
<PluginInformation
|
||||
category={PLUGIN_CATEGORIES[pluginCategoryId(openRow.entry?.categories)].label}
|
||||
signIn={pluginSignIn(openRow.entry?.methods)}
|
||||
host={pluginHost(openRow.entry?.methods)}
|
||||
docsUrl={openRow.entry?.docsUrl}
|
||||
/>
|
||||
</div>
|
||||
) : pluginKey ? (
|
||||
<div className="flex flex-col items-start gap-3 rounded-2xl bg-muted/50 px-4 py-6 text-sm text-muted-foreground">
|
||||
<p>This plugin isn’t in the catalog anymore.</p>
|
||||
<Button variant="outline" size="sm" onClick={() => navigate("/apps")}>Back to Plugins</Button>
|
||||
</div>
|
||||
) : source === "installed" && !categoryId ? (
|
||||
<div className={cn("space-y-3", ANALYTICS_MASK_CLASS)} role="list" aria-label="Connector list">
|
||||
{showAssistantConnection && <AssistantConnectionCard onNavigate={navigate} />}
|
||||
{paginatedRows.map((row) => (
|
||||
row.networkConnections ? <TailscaleConnectorCard key={row.key} onNavigate={navigate} /> : <div key={row.key} role="presentation" className="contents">{renderConnectorCard(row)}</div>
|
||||
))}
|
||||
</div>
|
||||
) : marketplace ? (
|
||||
<div className={cn("flex flex-col gap-10", ANALYTICS_MASK_CLASS)} role="list" aria-label="Connector list">
|
||||
{featuredRows.length > 0 ? <PluginShelf id="plugins-most-used" title="Most used">{featuredRows.map(renderTile)}</PluginShelf> : null}
|
||||
{noteworthyRows.length > 0 ? <PluginShelf id="plugins-noteworthy" title="New and noteworthy">{noteworthyRows.map(renderTile)}</PluginShelf> : null}
|
||||
{categoryGroups.map((group) => (
|
||||
group.rows.length > 0 ? <PluginShelf key={group.id} id={pluginCategorySectionId(group.id)} title={PLUGIN_CATEGORIES[group.id].label} count={group.total}
|
||||
onSeeAll={group.total > group.rows.length ? () => openCategory(group.id) : undefined}>{group.rows.map(renderTile)}</PluginShelf> : null
|
||||
))}
|
||||
<PluginCategories categories={categoryGroups.map((group) => group.id)} onOpen={openCategory} />
|
||||
</div>
|
||||
) : (
|
||||
<div className={cn("flex flex-col gap-3", ANALYTICS_MASK_CLASS)} role="list" aria-label="Connector list">
|
||||
<div className={PLUGIN_GRID}>{paginatedRows.map(renderTile)}</div>
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
|
||||
{accountLoadErrors.length ? <p role="alert" className="text-sm text-destructive">Couldn’t load {Array.from(new Set(accountLoadErrors)).join(" or ")} accounts. Use Refresh in the connection’s menu to try again.</p> : null}
|
||||
|
||||
{!loading && catalogRows.length > 0 ? <nav aria-label="Connector catalog pages" className="flex flex-wrap items-center justify-between gap-3 text-sm">
|
||||
{!loading && !pluginKey && !marketplace && catalogRows.length > 0 ? <nav aria-label="Connector catalog pages" className="flex flex-wrap items-center justify-between gap-3 text-sm">
|
||||
<p className="text-muted-foreground" role="status">{pageStart + 1}–{Math.min(pageStart + CATALOG_PAGE_SIZE, catalogRows.length)} of {catalogRows.length.toLocaleString()} connectors</p>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button variant="outline" size="sm" disabled={currentPage === 1} onClick={() => { setPage(currentPage - 1); catalogTop.current?.scrollIntoView?.({ block: "start" }); }}>Previous</Button>
|
||||
@@ -1224,6 +1398,7 @@ export function ConnectorCard({
|
||||
onConfigureExecutor,
|
||||
defaultExpanded = false,
|
||||
searchQuery = "",
|
||||
variant = "list",
|
||||
}: {
|
||||
renderAccountDetails?: (connection: ToolConnection) => ReactNode;
|
||||
aiDefaults?: ReturnType<typeof useAiConnectionDefaults>;
|
||||
@@ -1249,6 +1424,8 @@ export function ConnectorCard({
|
||||
/** Start with the connection list open, e.g. while a search is narrowing the catalog. */
|
||||
defaultExpanded?: boolean;
|
||||
searchQuery?: string;
|
||||
/** "page" drops the logo and name, which the plugin page header already shows, and keeps every account open. */
|
||||
variant?: "list" | "page";
|
||||
}) {
|
||||
// The user's toggle only applies while the default it overrode still holds, so a new search reopens the list.
|
||||
const [expandedOverride, setExpandedOverride] = useState<{ open: boolean; defaultExpanded: boolean } | null>(null);
|
||||
@@ -1272,9 +1449,14 @@ export function ConnectorCard({
|
||||
+ row.chatEndpoints.filter(endpoint => ["attention", "revoked"].includes(endpoint.status) || chatEndpointNeedsSetup(endpoint)).length;
|
||||
// A single connection stays inline; longer lists fold behind a "N connections" toggle,
|
||||
// but start open when an account needs action so setup and reconnect stay visible.
|
||||
const collapsible = connectionCount > 1;
|
||||
const collapsible = variant !== "page" && connectionCount > 1;
|
||||
const expanded = !collapsible || (expandedOverride?.defaultExpanded === defaultExpanded
|
||||
? expandedOverride.open : defaultExpanded || attentionCount > 0);
|
||||
const onPrimaryAction = () => {
|
||||
if (row.aggregatorApp && isInstalled(row)) onManageAggregator?.(row.aggregatorApp, row.upstreamApps?.find(app => app.accounts.length > 0)?.connectionId);
|
||||
else if (row.aggregatorApp) onConnectAggregator?.(row.aggregatorApp);
|
||||
else if (action.href) onNavigate(row.slug === "agentmail" ? `${action.href}&setupId=${crypto.randomUUID()}` : action.href);
|
||||
};
|
||||
return (
|
||||
<div
|
||||
role="listitem"
|
||||
@@ -1284,9 +1466,9 @@ export function ConnectorCard({
|
||||
? "true"
|
||||
: "false"
|
||||
}
|
||||
className="overflow-hidden rounded-xl border border-border"
|
||||
className={variant === "page" ? "overflow-hidden rounded-2xl bg-muted/50" : "overflow-hidden rounded-xl border border-border"}
|
||||
>
|
||||
<div className="flex flex-wrap items-center gap-3 px-4 py-4">
|
||||
{variant === "page" ? null : <div className="flex flex-wrap items-center gap-3 px-4 py-4">
|
||||
<AppLogo
|
||||
name={row.name}
|
||||
brandKey={row.brandKey}
|
||||
@@ -1319,17 +1501,12 @@ export function ConnectorCard({
|
||||
variant="outline"
|
||||
disabled={!action.href && !row.aggregatorApp}
|
||||
title={action.title}
|
||||
onClick={() => {
|
||||
if (row.aggregatorApp && isInstalled(row)) onManageAggregator?.(row.aggregatorApp, row.upstreamApps?.find(app => app.accounts.length > 0)?.connectionId);
|
||||
else if (row.aggregatorApp) onConnectAggregator?.(row.aggregatorApp);
|
||||
else if (action.href) onNavigate(row.slug === "agentmail"
|
||||
? `${action.href}&setupId=${crypto.randomUUID()}` : action.href);
|
||||
}}
|
||||
onClick={onPrimaryAction}
|
||||
aria-label={`${action.label} ${row.name}`}
|
||||
>
|
||||
{action.label}
|
||||
</Button>}
|
||||
</div>
|
||||
</div>}
|
||||
|
||||
<Collapsible open={expanded} onOpenChange={open => setExpandedOverride({ open, defaultExpanded })}>
|
||||
{collapsible ? (
|
||||
@@ -1339,9 +1516,9 @@ export function ConnectorCard({
|
||||
{attentionCount > 0 ? <span className="text-destructive">· {attentionCount} {attentionCount === 1 ? "needs" : "need"} attention</span> : null}
|
||||
</CollapsibleTrigger>
|
||||
) : null}
|
||||
<CollapsibleContent>
|
||||
<CollapsibleContent className={variant === "page" ? "divide-y divide-border" : undefined}>
|
||||
{row.connections.length > 0 ? (
|
||||
<div className="divide-y divide-border border-t border-border">
|
||||
<div className={cn("divide-y divide-border", variant !== "page" && "border-t border-border")}>
|
||||
{row.connections.map((connection) => (
|
||||
<ConnectionAccountRow
|
||||
details={renderAccountDetails?.(connection)}
|
||||
@@ -1382,7 +1559,7 @@ export function ConnectorCard({
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
{listedUpstreamAccounts.length > 0 ? <div className="divide-y divide-border border-t border-border">
|
||||
{listedUpstreamAccounts.length > 0 ? <div className={cn("divide-y divide-border", variant !== "page" && "border-t border-border")}>
|
||||
{listedUpstreamAccounts.map(({ connection, account, name, snapshot }) => {
|
||||
const state = upstreamAccountState(connection, snapshot, account);
|
||||
const provider = snapshot.provider ?? (isAppAggregator(connection.config?.sourceTemplateKey) ? connection.config?.sourceTemplateKey : "composio");
|
||||
@@ -1402,7 +1579,7 @@ export function ConnectorCard({
|
||||
})}
|
||||
</div> : null}
|
||||
{row.chatEndpoints.length > 0 ? (
|
||||
<div className="divide-y divide-border border-t border-border">
|
||||
<div className={cn("divide-y divide-border", variant !== "page" && "border-t border-border")}>
|
||||
{row.chatEndpoints.map((endpoint) => (
|
||||
<div
|
||||
key={endpoint.id}
|
||||
@@ -1481,6 +1658,14 @@ export function ConnectorCard({
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
{variant === "page" && setupEnabled ? (
|
||||
<div className="flex h-12 items-center px-2">
|
||||
<Button type="button" variant="ghost" size="sm" disabled={!action.href && !row.aggregatorApp} title={action.title} aria-label={`${action.label} ${row.name}`} onClick={onPrimaryAction}>
|
||||
<Plus aria-hidden />
|
||||
{action.label}
|
||||
</Button>
|
||||
</div>
|
||||
) : null}
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
</div>
|
||||
@@ -1662,96 +1847,3 @@ function ConnectionStatusIcon({ state }: { state: ConnectionState }) {
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function CustomConnectorCard({
|
||||
onNavigate,
|
||||
}: {
|
||||
onNavigate: (href: string) => void;
|
||||
}) {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
|
||||
return (
|
||||
<div
|
||||
role="listitem"
|
||||
data-app-slug="custom-mcp"
|
||||
className="overflow-hidden rounded-xl border border-border"
|
||||
>
|
||||
<div className="flex flex-wrap items-center gap-3 px-4 py-4">
|
||||
<div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted text-muted-foreground">
|
||||
<Link2 className="h-4 w-4" />
|
||||
</div>
|
||||
<div className="min-w-0 flex-1">
|
||||
<h2 className="text-sm font-semibold text-foreground">
|
||||
Connect your own tool
|
||||
</h2>
|
||||
<p className="mt-0.5 text-xs text-muted-foreground">
|
||||
Add a custom MCP server or paste an existing configuration.
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
variant="outline"
|
||||
aria-expanded={expanded}
|
||||
aria-controls="custom-connector-options"
|
||||
onClick={() => setExpanded((open) => !open)}
|
||||
>
|
||||
{expanded ? "Close" : "Connect"}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{expanded ? (
|
||||
<div
|
||||
id="custom-connector-options"
|
||||
className="grid gap-2 border-t border-border px-4 py-3 sm:grid-cols-2"
|
||||
>
|
||||
<CustomConnectorOption
|
||||
icon={ServerCog}
|
||||
title="Connect your own MCP server"
|
||||
description="Enter the URL for a custom or self-hosted MCP server."
|
||||
onClick={() => onNavigate("/apps/byo")}
|
||||
/>
|
||||
<CustomConnectorOption
|
||||
icon={ClipboardPaste}
|
||||
title="Paste a config"
|
||||
description="Paste an existing setup snippet and connect it."
|
||||
onClick={() => onNavigate("/apps/advanced/paste-config")}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function CustomConnectorOption({
|
||||
icon: Icon,
|
||||
title,
|
||||
description,
|
||||
onClick,
|
||||
}: {
|
||||
icon: typeof ServerCog;
|
||||
title: string;
|
||||
description: string;
|
||||
onClick: () => void;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="flex items-center gap-3 rounded-lg border border-border px-3 py-3 text-left transition-colors hover:border-foreground/30 hover:bg-accent/40"
|
||||
onClick={onClick}
|
||||
>
|
||||
<span className="inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-border text-muted-foreground">
|
||||
<Icon className="h-4 w-4" />
|
||||
</span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block text-sm font-semibold text-foreground">
|
||||
{title}
|
||||
</span>
|
||||
<span className="block text-xs text-muted-foreground">
|
||||
{description}
|
||||
</span>
|
||||
</span>
|
||||
<ChevronRight className="h-4 w-4 shrink-0 text-muted-foreground" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import { TabFilters } from "@/components/TabBar";
|
||||
|
||||
export const CATALOG_SOURCES = ["paperclip", "composio", "arcade", "installed", "all"] as const;
|
||||
export const CATALOG_SOURCES = ["all", "composio", "arcade", "installed"] as const;
|
||||
export type CatalogSource = typeof CATALOG_SOURCES[number];
|
||||
export const CATALOG_SOURCE_NAMES = { paperclip: "Paperclip", composio: "Composio", arcade: "Arcade", executor: "Executor", installed: "Installed", all: "All" };
|
||||
export const CATALOG_SOURCE_NAMES = { composio: "Composio", arcade: "Arcade", executor: "Executor", installed: "Installed", all: "All" };
|
||||
|
||||
export function CatalogSourceFilters({ source, onChange }: { source: CatalogSource; onChange: (source: CatalogSource) => void }) {
|
||||
return <TabFilters label="App filters" size="standard" items={CATALOG_SOURCES.map(value => ({ value, label: CATALOG_SOURCE_NAMES[value] }))} value={source} onValueChange={onChange} />;
|
||||
|
||||
@@ -132,7 +132,7 @@ export function Connections() {
|
||||
|
||||
useEffect(() => {
|
||||
setBreadcrumbs([
|
||||
{ label: "Connectors", href: "/apps" },
|
||||
{ label: "Plugins", href: "/apps" },
|
||||
{ label: "Connections" },
|
||||
]);
|
||||
return () => setBreadcrumbs([]);
|
||||
|
||||
@@ -2,16 +2,18 @@ import { ToolbarSearch } from "@/components/ToolbarSearch";
|
||||
import { CatalogSourceFilters, type CatalogSource } from "./CatalogSourceFilters";
|
||||
|
||||
/** Shared catalog search and source filters; data and scope changes stay in Browse. */
|
||||
export function ConnectorsToolbar({ query, onQueryChange, source, onSourceChange }: {
|
||||
export function ConnectorsToolbar({ query, onQueryChange, source, onSourceChange, hideSources = false }: {
|
||||
query: string;
|
||||
onQueryChange: (value: string) => void;
|
||||
source: CatalogSource;
|
||||
onSourceChange: (value: CatalogSource) => void;
|
||||
/** A category page searches inside one category, so the source tabs do not apply. */
|
||||
hideSources?: boolean;
|
||||
}) {
|
||||
return <header data-canonical-toolbar="connectors" role="toolbar" aria-label="Connectors controls" className="flex flex-wrap items-center gap-3">
|
||||
<div className="w-full">
|
||||
<ToolbarSearch query={query} onQueryChange={onQueryChange} label="Search connectors" placeholder="Search connectors…" inputType="search" />
|
||||
{hideSources ? null : <CatalogSourceFilters source={source} onChange={onSourceChange} />}
|
||||
<div className="ml-auto w-full sm:w-80 [&_.design-task-search]:w-full!">
|
||||
<ToolbarSearch query={query} onQueryChange={onQueryChange} label="Search plugins" placeholder="Search plugins…" inputType="search" />
|
||||
</div>
|
||||
<CatalogSourceFilters source={source} onChange={onSourceChange} />
|
||||
</header>;
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
import type { ReactNode } from "react";
|
||||
import {
|
||||
BarChart3,
|
||||
Bot,
|
||||
Check,
|
||||
Code,
|
||||
Database,
|
||||
FileText,
|
||||
LayoutGrid,
|
||||
MessageCircle,
|
||||
ShoppingBag,
|
||||
SquareCheck,
|
||||
TriangleAlert,
|
||||
Plus,
|
||||
type LucideIcon,
|
||||
} from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { AppLogo } from "./AppLogo";
|
||||
|
||||
export type PluginTileState = "available" | "connected" | "attention";
|
||||
|
||||
export type PluginTileAction = {
|
||||
label: string;
|
||||
disabled?: boolean;
|
||||
title?: string;
|
||||
onSelect: () => void;
|
||||
};
|
||||
|
||||
const CORNER = "relative z-10 grid size-8 shrink-0 place-items-center rounded-lg";
|
||||
|
||||
function StatusMark({ state, label }: { state: Exclude<PluginTileState, "available">; label: string }) {
|
||||
const attention = state === "attention";
|
||||
const Icon = attention ? TriangleAlert : Check;
|
||||
return (
|
||||
<span
|
||||
title={label}
|
||||
className={cn(CORNER, attention ? "bg-(--status-task-todo)/15 text-(--status-task-icon-todo)" : "bg-(--status-task-done)/15 text-(--status-task-icon-done)")}
|
||||
>
|
||||
<Icon className="size-4" aria-hidden />
|
||||
<span className="sr-only">{label}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** One catalog entry in the Plugins marketplace: logo, name, a corner status or connect control, and a short description. */
|
||||
export function PluginTile({
|
||||
slug,
|
||||
name,
|
||||
description,
|
||||
brandKey,
|
||||
logoUrl,
|
||||
darkLogoUrl,
|
||||
state,
|
||||
statusLabel,
|
||||
action,
|
||||
onOpen,
|
||||
}: {
|
||||
slug: string;
|
||||
name: string;
|
||||
description: string;
|
||||
brandKey: string;
|
||||
logoUrl?: string | null;
|
||||
darkLogoUrl?: string | null;
|
||||
state: PluginTileState;
|
||||
statusLabel: string;
|
||||
action: PluginTileAction | null;
|
||||
onOpen: () => void;
|
||||
}) {
|
||||
const installed = state !== "available";
|
||||
return (
|
||||
<div
|
||||
role="listitem"
|
||||
data-app-slug={slug}
|
||||
data-connected={installed ? "true" : "false"}
|
||||
className="group relative flex min-w-0 flex-col gap-3 rounded-2xl bg-muted/50 p-5 transition-colors hover:bg-muted"
|
||||
>
|
||||
<div className="flex min-h-8 items-center gap-3">
|
||||
<AppLogo name={name} brandKey={brandKey} logoUrl={logoUrl} darkLogoUrl={darkLogoUrl} size={32} compact className="bg-transparent" />
|
||||
<h3 className="min-w-0 flex-1 truncate text-sm font-semibold text-foreground">
|
||||
<button
|
||||
type="button"
|
||||
title={name}
|
||||
className="block max-w-full truncate text-left outline-none after:absolute after:inset-0 after:rounded-2xl focus-visible:after:ring-2 focus-visible:after:ring-ring"
|
||||
onClick={onOpen}
|
||||
>
|
||||
{name}
|
||||
</button>
|
||||
</h3>
|
||||
{action ? (
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className={cn(
|
||||
CORNER,
|
||||
"bg-foreground/5 hover:bg-foreground/10",
|
||||
installed && "opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100",
|
||||
)}
|
||||
disabled={action.disabled}
|
||||
title={action.title ?? `${action.label} ${name}`}
|
||||
aria-label={`${action.label} ${name}`}
|
||||
onClick={action.onSelect}
|
||||
>
|
||||
<Plus aria-hidden />
|
||||
</Button>
|
||||
) : null}
|
||||
{installed ? <StatusMark state={state} label={statusLabel} /> : null}
|
||||
</div>
|
||||
<p className="line-clamp-2 min-h-10 text-sm leading-5 text-muted-foreground">{description}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export const PLUGIN_GRID = "grid gap-3 sm:grid-cols-2 xl:grid-cols-3";
|
||||
|
||||
/** A titled block of plugin tiles. A category block also shows how many plugins it holds and links to all of them. */
|
||||
export function PluginShelf({ id, title, count, onSeeAll, children }: { id: string; title: string; count?: number; onSeeAll?: () => void; children: ReactNode }) {
|
||||
return (
|
||||
<section id={id} aria-labelledby={`${id}-title`} className="flex scroll-mt-6 flex-col gap-3">
|
||||
<div className="flex min-h-8 items-center justify-between gap-4">
|
||||
<h2 id={`${id}-title`} className="text-base font-semibold text-foreground">
|
||||
{title}
|
||||
{count === undefined ? null : <span className="font-normal text-muted-foreground tabular-nums"> ({count.toLocaleString()})</span>}
|
||||
</h2>
|
||||
{onSeeAll ? (
|
||||
<Button type="button" variant="ghost" size="sm" className="-mr-3 h-8 text-muted-foreground" aria-label={`See all ${title}`} onClick={onSeeAll}>
|
||||
See all
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
<div className={PLUGIN_GRID}>{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export const PLUGIN_CATEGORY_ORDER = ["productivity", "developer", "communication", "ai", "data", "analytics", "content", "commerce", "other"] as const;
|
||||
export type PluginCategoryId = (typeof PLUGIN_CATEGORY_ORDER)[number];
|
||||
|
||||
export const PLUGIN_CATEGORIES: Record<PluginCategoryId, { label: string; icon: LucideIcon }> = {
|
||||
productivity: { label: "Productivity", icon: SquareCheck },
|
||||
developer: { label: "Developer tools", icon: Code },
|
||||
communication: { label: "Communication", icon: MessageCircle },
|
||||
ai: { label: "AI models & agents", icon: Bot },
|
||||
data: { label: "Data", icon: Database },
|
||||
analytics: { label: "Analytics", icon: BarChart3 },
|
||||
content: { label: "Content", icon: FileText },
|
||||
commerce: { label: "Commerce", icon: ShoppingBag },
|
||||
other: { label: "Other", icon: LayoutGrid },
|
||||
};
|
||||
|
||||
export const pluginCategoryId = (categories: readonly string[] | undefined): PluginCategoryId => {
|
||||
const first = categories?.[0];
|
||||
return first && first in PLUGIN_CATEGORIES ? (first as PluginCategoryId) : "other";
|
||||
};
|
||||
|
||||
export const pluginCategorySectionId = (id: PluginCategoryId) => `plugins-category-${id}`;
|
||||
|
||||
export const isPluginCategoryId = (value: string | undefined): value is PluginCategoryId => Boolean(value) && value! in PLUGIN_CATEGORIES;
|
||||
|
||||
/** List of the categories that have plugins; each opens that category's own page. */
|
||||
export function PluginCategories({ categories, onOpen }: { categories: PluginCategoryId[]; onOpen: (id: PluginCategoryId) => void }) {
|
||||
if (categories.length === 0) return null;
|
||||
return (
|
||||
<nav aria-labelledby="plugins-categories-title" className="flex flex-col gap-3">
|
||||
<h2 id="plugins-categories-title" className="text-base font-semibold text-foreground">
|
||||
Categories
|
||||
</h2>
|
||||
<ul className="-mx-2 grid gap-x-6 sm:grid-cols-2 lg:grid-cols-4">
|
||||
{categories.map((id) => {
|
||||
const { label, icon: Icon } = PLUGIN_CATEGORIES[id];
|
||||
return (
|
||||
<li key={id} className="min-w-0">
|
||||
<button
|
||||
type="button"
|
||||
className="flex h-10 w-full min-w-0 items-center gap-3 rounded-lg px-2 text-left text-sm text-foreground outline-none hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring"
|
||||
onClick={() => onOpen(id)}
|
||||
>
|
||||
<Icon className="size-4 shrink-0 text-muted-foreground" aria-hidden />
|
||||
<span className="min-w-0 flex-1 truncate">{label}</span>
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { ConnectionMethodDef } from "@paperclipai/shared";
|
||||
import { pluginHost, pluginSignIn } from "./PluginPageSections";
|
||||
|
||||
const method = (auth: ConnectionMethodDef["auth"], serverUrl?: string) =>
|
||||
({ key: auth, transport: "mcp_remote", auth, ownershipModes: [], whenToUse: "", defaults: serverUrl ? { serverUrl } : undefined }) as unknown as ConnectionMethodDef;
|
||||
|
||||
describe("plugin page facts", () => {
|
||||
it("reads the host from the first method that names a valid server", () => {
|
||||
expect(pluginHost([method("oauth"), method("api_key", "not a url"), method("api_key", "https://api.example.com/mcp/")])).toBe("api.example.com");
|
||||
expect(pluginHost([method("oauth")])).toBeNull();
|
||||
expect(pluginHost(undefined)).toBeNull();
|
||||
});
|
||||
|
||||
it("lists each sign-in kind once, in definition order", () => {
|
||||
expect(pluginSignIn([method("oauth"), method("api_key"), method("oauth")])).toBe("OAuth or API key");
|
||||
expect(pluginSignIn([method("none")])).toBe("No sign-in");
|
||||
expect(pluginSignIn([])).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,169 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { ArrowUpRight, Check, Plug, TriangleAlert } from "lucide-react";
|
||||
import type { ConnectionMethodDef } from "@paperclipai/shared";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { AppLogo } from "./AppLogo";
|
||||
import type { PluginTileState } from "./PluginMarketplace";
|
||||
|
||||
const AUTH_LABEL: Record<ConnectionMethodDef["auth"], string> = { oauth: "OAuth", api_key: "API key", none: "No sign-in" };
|
||||
|
||||
/** The host a connector talks to, when its definition names one. */
|
||||
export function pluginHost(methods: readonly ConnectionMethodDef[] | undefined): string | null {
|
||||
for (const method of methods ?? []) {
|
||||
const url = method.defaults?.serverUrl;
|
||||
if (!url) continue;
|
||||
try {
|
||||
return new URL(url).host;
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Sign-in kinds a connector offers, in the order its definition lists them. */
|
||||
export function pluginSignIn(methods: readonly ConnectionMethodDef[] | undefined): string | null {
|
||||
const labels = [...new Set((methods ?? []).map((method) => AUTH_LABEL[method.auth]))];
|
||||
return labels.length > 0 ? labels.join(" or ") : null;
|
||||
}
|
||||
|
||||
/** A labelled block on the plugin page: a quiet heading with an optional count over one grouped surface. */
|
||||
export function PluginGroup({ id, label, count, children }: { id: string; label: string; count?: number; children: ReactNode }) {
|
||||
return (
|
||||
<section aria-labelledby={id} className="flex flex-col gap-2">
|
||||
<h2 id={id} className="flex items-baseline gap-2 px-4 text-sm text-muted-foreground">
|
||||
{label}
|
||||
{count === undefined ? null : <span className="tabular-nums">{count}</span>}
|
||||
</h2>
|
||||
<div className="overflow-hidden rounded-2xl bg-muted/50">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function StatusMark({ state, name }: { state: Exclude<PluginTileState, "available">; name: string }) {
|
||||
const attention = state === "attention";
|
||||
const Icon = attention ? TriangleAlert : Check;
|
||||
return (
|
||||
<span
|
||||
role="img"
|
||||
aria-label={attention ? `${name} needs attention` : `${name} connected`}
|
||||
title={attention ? "Needs attention" : "Connected"}
|
||||
className={cn("grid size-7 shrink-0 place-items-center rounded-lg", attention ? "bg-(--status-task-todo)/15 text-(--status-task-icon-todo)" : "bg-(--status-task-done)/15 text-(--status-task-icon-done)")}
|
||||
>
|
||||
<Icon className="size-4" aria-hidden />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export type PluginConnectAction = { disabled?: boolean; title?: string; onSelect: () => void };
|
||||
|
||||
/** Plugin page header: logo, name with its status, what it is, and the one primary action. */
|
||||
export function PluginPageHeader({
|
||||
name,
|
||||
kind,
|
||||
description,
|
||||
brandKey,
|
||||
logoUrl,
|
||||
darkLogoUrl,
|
||||
state,
|
||||
docsUrl,
|
||||
connect,
|
||||
}: {
|
||||
name: string;
|
||||
kind: string;
|
||||
description: string;
|
||||
brandKey: string;
|
||||
logoUrl?: string | null;
|
||||
darkLogoUrl?: string | null;
|
||||
state: PluginTileState;
|
||||
docsUrl?: string;
|
||||
connect: PluginConnectAction | null;
|
||||
}) {
|
||||
return (
|
||||
<header className="flex flex-col gap-4">
|
||||
<div className="flex flex-wrap items-center gap-4">
|
||||
<span className="grid size-16 shrink-0 place-items-center rounded-2xl bg-foreground/5">
|
||||
<AppLogo name={name} brandKey={brandKey} logoUrl={logoUrl} darkLogoUrl={darkLogoUrl} size={40} className="bg-transparent" />
|
||||
</span>
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-0.5">
|
||||
<div className="flex items-center gap-3">
|
||||
<p className="truncate text-2xl leading-8 font-semibold tracking-tight text-foreground">{name}</p>
|
||||
{state === "available" ? null : <StatusMark state={state} name={name} />}
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">{kind}</p>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
{state !== "available" && docsUrl ? (
|
||||
<Button asChild variant="ghost">
|
||||
<a href={docsUrl} target="_blank" rel="noopener noreferrer">
|
||||
Docs
|
||||
<ArrowUpRight aria-hidden />
|
||||
</a>
|
||||
</Button>
|
||||
) : null}
|
||||
{state === "available" && connect ? (
|
||||
<Button type="button" disabled={connect.disabled} title={connect.title} aria-label={`Connect ${name}`} onClick={connect.onSelect}>
|
||||
Connect
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
<p className="max-w-prose text-base leading-6 text-pretty text-foreground">{description}</p>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
/** The connector a plugin installs: what it is, where it runs and how it signs in. */
|
||||
export function PluginConnector({ name, host, signIn }: { name: string; host: string | null; signIn: string | null }) {
|
||||
return (
|
||||
<PluginGroup id="plugin-connector-title" label="Connector">
|
||||
<div className="flex min-h-14 items-center gap-3 px-4 py-2.5">
|
||||
<span className="grid size-8 shrink-0 place-items-center rounded-lg bg-foreground/5 text-foreground">
|
||||
<Plug className="size-4" aria-hidden />
|
||||
</span>
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<p className="truncate text-sm font-semibold text-foreground">{name}</p>
|
||||
<p className="truncate text-sm text-muted-foreground">
|
||||
Connector{host ? <> · <span className="font-mono text-xs">{host}</span></> : null}
|
||||
</p>
|
||||
</div>
|
||||
{signIn ? <span className="shrink-0 text-sm text-muted-foreground">{signIn}</span> : null}
|
||||
</div>
|
||||
</PluginGroup>
|
||||
);
|
||||
}
|
||||
|
||||
function Fact({ label, children }: { label: string; children: ReactNode }) {
|
||||
return (
|
||||
<div className="flex min-h-11 items-center justify-between gap-4 px-4 py-2">
|
||||
<dt className="shrink-0 text-sm text-muted-foreground">{label}</dt>
|
||||
<dd className="flex min-w-0 justify-end text-right text-sm text-foreground">{children}</dd>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Reference facts about a plugin, drawn from its catalog definition. */
|
||||
export function PluginInformation({ category, signIn, host, docsUrl }: { category: string; signIn: string | null; host: string | null; docsUrl?: string }) {
|
||||
return (
|
||||
<PluginGroup id="plugin-information-title" label="Information">
|
||||
<dl className="flex flex-col divide-y divide-border">
|
||||
<Fact label="Category">{category}</Fact>
|
||||
{signIn ? <Fact label="Sign-in">{signIn}</Fact> : null}
|
||||
{host ? (
|
||||
<Fact label="Server">
|
||||
<span className="truncate font-mono text-xs">{host}</span>
|
||||
</Fact>
|
||||
) : null}
|
||||
{docsUrl ? (
|
||||
<Fact label="Docs">
|
||||
<a href={docsUrl} target="_blank" rel="noopener noreferrer" className="inline-flex min-w-0 items-center gap-1 underline underline-offset-2">
|
||||
<span className="truncate">{docsUrl.replace(/^https?:\/\//, "").replace(/\/$/, "")}</span>
|
||||
<ArrowUpRight className="size-3.5 shrink-0" aria-hidden />
|
||||
</a>
|
||||
</Fact>
|
||||
) : null}
|
||||
</dl>
|
||||
</PluginGroup>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { actionPolicy, groupPolicy } from "./PluginPermissions";
|
||||
|
||||
const enabled = new Set(["read", "ask", "stale-ask"]);
|
||||
const askFirst = new Set(["ask", "off-ask"]);
|
||||
|
||||
describe("plugin permission policies", () => {
|
||||
it("reads one action's policy from the enabled and ask-first sets", () => {
|
||||
expect(actionPolicy("read", enabled, askFirst)).toBe("allowed");
|
||||
expect(actionPolicy("ask", enabled, askFirst)).toBe("ask");
|
||||
expect(actionPolicy("off-ask", enabled, askFirst)).toBe("off");
|
||||
expect(actionPolicy("missing", enabled, askFirst)).toBe("off");
|
||||
});
|
||||
|
||||
it("names a group policy only when every action agrees", () => {
|
||||
expect(groupPolicy(["read", "stale-ask"], enabled, askFirst)).toBe("allowed");
|
||||
expect(groupPolicy(["read", "ask"], enabled, askFirst)).toBe("custom");
|
||||
expect(groupPolicy(["missing", "off-ask"], enabled, askFirst)).toBe("off");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,253 @@
|
||||
import { useId, useMemo, useState } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { ChevronDown, ChevronRight } from "lucide-react";
|
||||
import type { ToolCatalogEntry, ToolConnection } from "@paperclipai/shared";
|
||||
import { toolsApi } from "@/api/tools";
|
||||
import { describeError } from "@/api/errors";
|
||||
import { QueryErrorState } from "@/components/QueryView";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuRadioGroup,
|
||||
DropdownMenuRadioItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { installStateFrom } from "@/lib/tool-installs";
|
||||
import { queryKeys } from "@/lib/queryKeys";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { actionLabel, actionPermissionMutation } from "./app-detail/action-permissions";
|
||||
import { accessFrom, askFirstCatalogIds, enabledCatalogIds } from "./app-detail/saved-permissions";
|
||||
import { useConnectionPermissionSave } from "./app-detail/useConnectionPermissionSave";
|
||||
|
||||
export type ActionPolicy = "allowed" | "ask" | "off";
|
||||
|
||||
const POLICY_ORDER: ActionPolicy[] = ["allowed", "ask", "off"];
|
||||
const POLICY_LABEL: Record<ActionPolicy, string> = { allowed: "Allowed", ask: "Ask first", off: "Off" };
|
||||
const TONE: Record<ActionPolicy | "custom", string> = {
|
||||
allowed: "text-foreground",
|
||||
ask: "text-(--status-task-icon-todo)",
|
||||
off: "text-muted-foreground",
|
||||
custom: "text-foreground",
|
||||
};
|
||||
|
||||
/** The policy an action has today: off unless enabled, and Ask first only while enabled. */
|
||||
export function actionPolicy(id: string, enabledIds: ReadonlySet<string>, askFirstIds: ReadonlySet<string>): ActionPolicy {
|
||||
if (!enabledIds.has(id)) return "off";
|
||||
return askFirstIds.has(id) ? "ask" : "allowed";
|
||||
}
|
||||
|
||||
/** One policy when every action in the group shares it, otherwise "custom". */
|
||||
export function groupPolicy(ids: readonly string[], enabledIds: ReadonlySet<string>, askFirstIds: ReadonlySet<string>): ActionPolicy | "custom" {
|
||||
const first = actionPolicy(ids[0], enabledIds, askFirstIds);
|
||||
return ids.every((id) => actionPolicy(id, enabledIds, askFirstIds) === first) ? first : "custom";
|
||||
}
|
||||
|
||||
function PolicyMenu({ value, label, disabled, onChange }: { value: ActionPolicy | "custom"; label: string; disabled: boolean; onChange: (next: ActionPolicy) => void }) {
|
||||
const text = value === "custom" ? "Custom" : POLICY_LABEL[value];
|
||||
if (disabled) return <span className={cn("shrink-0 text-sm", TONE[value])}>{text}</span>;
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button type="button" variant="ghost" size="sm" className={cn("-mr-2 h-8 shrink-0", TONE[value])} aria-label={`${label}: ${text}`}>
|
||||
{text}
|
||||
<ChevronDown className="text-muted-foreground" aria-hidden />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className={cn("w-40", ANALYTICS_MASK_CLASS)}>
|
||||
<DropdownMenuRadioGroup value={value} onValueChange={(next) => onChange(next as ActionPolicy)}>
|
||||
{POLICY_ORDER.map((policy) => (
|
||||
<DropdownMenuRadioItem key={policy} value={policy}>
|
||||
{POLICY_LABEL[policy]}
|
||||
</DropdownMenuRadioItem>
|
||||
))}
|
||||
</DropdownMenuRadioGroup>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
}
|
||||
|
||||
function ActionBlock({
|
||||
title,
|
||||
entries,
|
||||
enabledIds,
|
||||
askFirstIds,
|
||||
disabled,
|
||||
onChange,
|
||||
}: {
|
||||
title: string;
|
||||
entries: ToolCatalogEntry[];
|
||||
enabledIds: ReadonlySet<string>;
|
||||
askFirstIds: ReadonlySet<string>;
|
||||
disabled: boolean;
|
||||
onChange: (ids: string[], next: ActionPolicy) => void;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const region = useId();
|
||||
const ids = entries.map((entry) => entry.id);
|
||||
const Chevron = open ? ChevronDown : ChevronRight;
|
||||
return (
|
||||
<div className="flex flex-col rounded-2xl bg-muted/50">
|
||||
<div className="flex h-12 items-center justify-between gap-4 px-4">
|
||||
<button
|
||||
type="button"
|
||||
aria-expanded={open}
|
||||
aria-controls={region}
|
||||
onClick={() => setOpen((current) => !current)}
|
||||
className="-ml-1 flex h-8 items-center gap-2 rounded-md pr-2 pl-1 text-sm font-semibold text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
>
|
||||
<Chevron className="size-4 text-muted-foreground" aria-hidden />
|
||||
{title}
|
||||
<span className="font-normal text-muted-foreground tabular-nums">{entries.length}</span>
|
||||
</button>
|
||||
<PolicyMenu value={groupPolicy(ids, enabledIds, askFirstIds)} label={`All ${title.toLowerCase()}`} disabled={disabled} onChange={(next) => onChange(ids, next)} />
|
||||
</div>
|
||||
<ul id={region} hidden={!open} className="flex flex-col pb-2">
|
||||
{entries.map((entry) => {
|
||||
const label = actionLabel(entry);
|
||||
return (
|
||||
<li key={entry.id} className="flex min-h-10 items-center justify-between gap-4 pr-4 pl-11">
|
||||
<span className="flex min-w-0 items-baseline gap-2.5">
|
||||
<span className="truncate text-sm text-foreground">{label}</span>
|
||||
{label === entry.toolName ? null : <span className="truncate font-mono text-xs text-muted-foreground">{entry.toolName}</span>}
|
||||
</span>
|
||||
<PolicyMenu value={actionPolicy(entry.id, enabledIds, askFirstIds)} label={label} disabled={disabled} onChange={(next) => onChange([entry.id], next)} />
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const NOTE = "rounded-2xl bg-muted/50 px-4 py-3 text-sm text-muted-foreground";
|
||||
|
||||
function ConnectionPermissions({ companyId, connection }: { companyId: string; connection: ToolConnection }) {
|
||||
const connectionId = connection.id;
|
||||
const [saveError, setSaveError] = useState<string | null>(null);
|
||||
const catalogQuery = useQuery({ queryKey: queryKeys.tools.catalog(connectionId), queryFn: () => toolsApi.listCatalog(connectionId) });
|
||||
const profilesQuery = useQuery({
|
||||
queryKey: queryKeys.tools.connectionProfileConfiguration(companyId, connectionId),
|
||||
queryFn: ({ signal }) => toolsApi.listConnectionProfileConfiguration(connectionId, { signal, fresh: true }),
|
||||
});
|
||||
const policiesQuery = useQuery({
|
||||
queryKey: queryKeys.tools.policies(companyId),
|
||||
queryFn: ({ signal }) => toolsApi.listPolicies(companyId, { signal, fresh: true }),
|
||||
});
|
||||
const installsQuery = useQuery({
|
||||
queryKey: queryKeys.tools.connectionInstalls(connectionId),
|
||||
queryFn: ({ signal }) => toolsApi.getConnectionInstalls(connectionId, { signal, fresh: true }),
|
||||
});
|
||||
const grantsQuery = useQuery({
|
||||
queryKey: queryKeys.tools.connectionGrants(connectionId),
|
||||
queryFn: ({ signal }) => toolsApi.listConnectionGrants(connectionId, { signal }),
|
||||
});
|
||||
const { draft, pending, save } = useConnectionPermissionSave({
|
||||
companyId,
|
||||
connectionId,
|
||||
connection,
|
||||
catalog: catalogQuery.data?.catalog ?? [],
|
||||
onError: (error) => setSaveError(describeError(error).body),
|
||||
});
|
||||
|
||||
const { reads, writes } = useMemo(() => {
|
||||
const byName = (left: ToolCatalogEntry, right: ToolCatalogEntry) => actionLabel(left).localeCompare(actionLabel(right));
|
||||
const active = (catalogQuery.data?.catalog ?? []).filter((entry) => entry.status === "active");
|
||||
return { reads: active.filter((entry) => entry.isReadOnly).sort(byName), writes: active.filter((entry) => !entry.isReadOnly).sort(byName) };
|
||||
}, [catalogQuery.data]);
|
||||
const profile = useMemo(() => (profilesQuery.data?.profiles ?? []).find((entry) => entry.profileKey === `app:${connectionId}`), [profilesQuery.data, connectionId]);
|
||||
const savedEnabled = useMemo(() => enabledCatalogIds(profile), [profile]);
|
||||
const savedAskFirst = useMemo(() => askFirstCatalogIds(policiesQuery.data?.policies ?? [], connectionId), [policiesQuery.data, connectionId]);
|
||||
const savedAccess = useMemo(() => accessFrom(profile, installStateFrom(installsQuery.data?.installs ?? connection.installs)), [profile, installsQuery.data, connection.installs]);
|
||||
const enabledIds = draft?.enabled ?? savedEnabled;
|
||||
const askFirstIds = draft?.askFirst ?? savedAskFirst;
|
||||
|
||||
// A failed read only blocks the section while it has nothing to show; a failed
|
||||
// background refresh keeps the loaded actions on screen.
|
||||
const queries = [catalogQuery, profilesQuery, policiesQuery, installsQuery, grantsQuery];
|
||||
const unloaded = queries.filter((query) => query.error != null && query.data === undefined);
|
||||
if (unloaded.length > 0) {
|
||||
return (
|
||||
<QueryErrorState
|
||||
error={unloaded[0].error}
|
||||
action="load this account’s actions"
|
||||
onRetry={() => unloaded.forEach((query) => void query.refetch())}
|
||||
retrying={unloaded.some((query) => query.isFetching)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
const loaded = queries.every((query) => query.data !== undefined);
|
||||
if (!loaded) return <p className={NOTE}>Loading actions…</p>;
|
||||
if (reads.length + writes.length === 0) return <p className={NOTE}>This account hasn’t listed any actions yet.</p>;
|
||||
|
||||
const canConfigure = grantsQuery.data?.capabilities?.canConfigure === true;
|
||||
const change = (ids: string[], next: ActionPolicy) => {
|
||||
setSaveError(null);
|
||||
save({ ...actionPermissionMutation(ids, next, enabledIds, askFirstIds), access: savedAccess });
|
||||
};
|
||||
return (
|
||||
<>
|
||||
{reads.length > 0 ? <ActionBlock title="Reads" entries={reads} enabledIds={enabledIds} askFirstIds={askFirstIds} disabled={!canConfigure || pending} onChange={change} /> : null}
|
||||
{writes.length > 0 ? <ActionBlock title="Writes" entries={writes} enabledIds={enabledIds} askFirstIds={askFirstIds} disabled={!canConfigure || pending} onChange={change} /> : null}
|
||||
{saveError ? (
|
||||
<p role="alert" className="px-4 text-sm text-destructive">
|
||||
Couldn’t save that. {saveError}
|
||||
</p>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** Tool permissions for a connected plugin: one block for what it reads and one for what it changes, per account. */
|
||||
export function PluginPermissions({
|
||||
companyId,
|
||||
connections,
|
||||
accountName,
|
||||
onNavigate,
|
||||
}: {
|
||||
companyId: string;
|
||||
connections: readonly ToolConnection[];
|
||||
accountName: (connection: ToolConnection) => string;
|
||||
onNavigate: (href: string) => void;
|
||||
}) {
|
||||
const tools = connections.filter((connection) => connection.connectionPurpose !== "ai");
|
||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||
const selected = tools.find((connection) => connection.id === selectedId) ?? tools[0];
|
||||
if (!selected) return null;
|
||||
return (
|
||||
<section aria-labelledby="plugin-permissions-title" className="flex flex-col gap-2">
|
||||
<div className="flex min-h-8 items-center justify-between gap-4 px-4">
|
||||
<h2 id="plugin-permissions-title" className="text-sm text-muted-foreground">
|
||||
Tool permissions
|
||||
</h2>
|
||||
{tools.length > 1 ? (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button type="button" variant="ghost" size="sm" className="-mr-2 h-8 max-w-64 text-muted-foreground" aria-label={`Account: ${accountName(selected)}`}>
|
||||
<span className="truncate">{accountName(selected)}</span>
|
||||
<ChevronDown aria-hidden />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className={ANALYTICS_MASK_CLASS}>
|
||||
<DropdownMenuRadioGroup value={selected.id} onValueChange={setSelectedId}>
|
||||
{tools.map((connection) => (
|
||||
<DropdownMenuRadioItem key={connection.id} value={connection.id}>
|
||||
{accountName(connection)}
|
||||
</DropdownMenuRadioItem>
|
||||
))}
|
||||
</DropdownMenuRadioGroup>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
) : null}
|
||||
</div>
|
||||
<ConnectionPermissions key={selected.id} companyId={companyId} connection={selected} />
|
||||
<p className="px-4 text-xs text-muted-foreground">
|
||||
Ask first sends the action to Review before it runs.{" "}
|
||||
<button type="button" className="underline underline-offset-2 hover:text-foreground" onClick={() => onNavigate(`/apps/${selected.id}/permissions`)}>
|
||||
Agent access and more settings
|
||||
</button>
|
||||
</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// @vitest-environment jsdom
|
||||
import { act } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { PluginSkills } from "./PluginSkills";
|
||||
|
||||
const api = vi.hoisted(() => ({ published: vi.fn(), catalog: vi.fn(), installed: vi.fn() }));
|
||||
vi.mock("@/api/mcpSkills", () => ({ mcpSkillsApi: { list: api.published } }));
|
||||
vi.mock("@/api/companySkills", () => ({ companySkillsApi: { catalogList: api.catalog, list: api.installed, installCatalog: vi.fn() } }));
|
||||
|
||||
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
|
||||
|
||||
async function render(slug: string, connectionIds: string[]) {
|
||||
const host = document.createElement("div");
|
||||
document.body.append(host);
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||
const root = createRoot(host);
|
||||
await act(async () => {
|
||||
root.render(
|
||||
<QueryClientProvider client={client}>
|
||||
<PluginSkills companyId="company-1" slug={slug} name="Linear" connectionIds={connectionIds} onNavigate={() => {}} />
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
});
|
||||
await act(async () => { await new Promise((resolve) => setTimeout(resolve, 0)); });
|
||||
return { host, unmount: () => act(() => root.unmount()) };
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe("PluginSkills", () => {
|
||||
it("renders nothing when a connector has no skills", async () => {
|
||||
api.published.mockResolvedValue([]);
|
||||
const view = await render("linear", ["connection-1"]);
|
||||
expect(view.host.textContent).toBe("");
|
||||
await view.unmount();
|
||||
});
|
||||
|
||||
it("shows a failed read with a retry, where it used to show nothing", async () => {
|
||||
api.published.mockRejectedValue(new Error("boom"));
|
||||
const view = await render("linear", ["connection-1"]);
|
||||
expect(view.host.textContent).toContain("Skills");
|
||||
expect([...view.host.querySelectorAll("button")].some((button) => button.textContent?.includes("Retry"))).toBe(true);
|
||||
await view.unmount();
|
||||
});
|
||||
|
||||
it("ignores a failed read that this plugin does not use", async () => {
|
||||
api.catalog.mockRejectedValue(new Error("boom"));
|
||||
api.installed.mockRejectedValue(new Error("boom"));
|
||||
const github = await render("github", []);
|
||||
expect(github.host.textContent).toContain("Skills");
|
||||
await github.unmount();
|
||||
api.published.mockResolvedValue([]);
|
||||
const linear = await render("linear", ["connection-1"]);
|
||||
expect(linear.host.textContent).toBe("");
|
||||
await linear.unmount();
|
||||
});
|
||||
|
||||
it("does not offer Add skill while the installed list failed to load", async () => {
|
||||
api.catalog.mockResolvedValue([{ id: "paperclipai:bundled:software-development:github-pr-workflow", key: "github-pr-workflow", name: "github-pr-workflow", description: "Prepare a pull request." }]);
|
||||
api.installed.mockRejectedValue(new Error("boom"));
|
||||
const view = await render("github", []);
|
||||
expect(view.host.textContent).toContain("github-pr-workflow");
|
||||
expect(view.host.textContent).not.toContain("Add skill");
|
||||
expect([...view.host.querySelectorAll("button")].some((button) => button.textContent?.includes("Retry"))).toBe(true);
|
||||
await view.unmount();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,155 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { Check, Loader2, Package } from "lucide-react";
|
||||
import { companySkillsApi } from "@/api/companySkills";
|
||||
import { mcpSkillsApi } from "@/api/mcpSkills";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { describeError } from "@/api/errors";
|
||||
import { QueryErrorState } from "@/components/QueryView";
|
||||
import { queryKeys } from "@/lib/queryKeys";
|
||||
|
||||
/** Skills Paperclip applies on its own while an agent is assigned the connector (server/src/services/connector-runtime.ts). */
|
||||
const BUILT_IN_SKILLS: Record<string, { name: string; description: string }> = {
|
||||
slack: { name: "slack", description: "How to read and post in Slack through the governed Slack tools." },
|
||||
agentmail: { name: "agentmail", description: "How to send, read and reply to email from an assigned inbox." },
|
||||
"browser-use-cloud": { name: "browser-use-cloud", description: "How to drive a cloud browser session for web tasks." },
|
||||
speko: { name: "speko", description: "How to place and handle phone calls with Speko." },
|
||||
};
|
||||
|
||||
/** Catalog skills that pair with a connector. The pairing lives here until the catalog can declare it. */
|
||||
const CATALOG_SKILL_IDS: Record<string, string[]> = {
|
||||
github: ["paperclipai:bundled:software-development:github-pr-workflow"],
|
||||
};
|
||||
|
||||
const CATALOG_QUERY_KEY = ["company-skills", "catalog", "plugin-bundles"] as const;
|
||||
|
||||
const ROW = "flex min-h-14 items-center gap-3 px-4 py-2.5";
|
||||
|
||||
function SkillRow({ name, detail, children }: { name: string; detail: string; children?: ReactNode }) {
|
||||
return (
|
||||
<li className={ROW}>
|
||||
<span className="grid size-8 shrink-0 place-items-center rounded-lg bg-foreground/5 text-foreground">
|
||||
<Package className="size-4" aria-hidden />
|
||||
</span>
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<p className="truncate font-mono text-sm font-semibold text-foreground">{name}</p>
|
||||
<p className="truncate text-sm text-muted-foreground">{detail}</p>
|
||||
</div>
|
||||
{children}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
/** The skills that come with a connector: built in, published by its connected server, or paired from the catalog. */
|
||||
export function PluginSkills({
|
||||
companyId,
|
||||
slug,
|
||||
name,
|
||||
connectionIds,
|
||||
onNavigate,
|
||||
}: {
|
||||
companyId: string;
|
||||
slug: string;
|
||||
name: string;
|
||||
connectionIds: readonly string[];
|
||||
onNavigate: (href: string) => void;
|
||||
}) {
|
||||
const queryClient = useQueryClient();
|
||||
const builtIn = BUILT_IN_SKILLS[slug];
|
||||
const catalogIds = CATALOG_SKILL_IDS[slug] ?? [];
|
||||
const publishedQuery = useQuery({
|
||||
queryKey: queryKeys.mcpSkills.list(companyId),
|
||||
queryFn: () => mcpSkillsApi.list(companyId),
|
||||
enabled: connectionIds.length > 0,
|
||||
});
|
||||
const catalogQuery = useQuery({
|
||||
queryKey: CATALOG_QUERY_KEY,
|
||||
queryFn: () => companySkillsApi.catalogList(),
|
||||
enabled: catalogIds.length > 0,
|
||||
});
|
||||
const installedQuery = useQuery({
|
||||
queryKey: queryKeys.companySkills.list(companyId),
|
||||
queryFn: () => companySkillsApi.list(companyId),
|
||||
enabled: catalogIds.length > 0,
|
||||
});
|
||||
const install = useMutation({
|
||||
mutationFn: (catalogSkillId: string) => companySkillsApi.installCatalog(companyId, { catalogSkillId }),
|
||||
onSuccess: () => queryClient.invalidateQueries({ queryKey: queryKeys.companySkills.list(companyId) }),
|
||||
});
|
||||
|
||||
const published = (publishedQuery.data ?? []).filter((skill) => connectionIds.includes(skill.connectionId) && skill.status !== "unavailable");
|
||||
const catalog = (catalogQuery.data ?? []).filter((skill) => catalogIds.includes(skill.id));
|
||||
const installedKeys = new Set((installedQuery.data ?? []).map((skill) => skill.key));
|
||||
const count = (builtIn ? 1 : 0) + published.length + catalog.length;
|
||||
// A failed read is not an empty result: say so and offer a retry, and never
|
||||
// show a skill as addable while its installed state is unknown.
|
||||
// Only reads this plugin actually uses count: a disabled query can still hold another plugin's cached error.
|
||||
const failed = [
|
||||
...(connectionIds.length > 0 ? [publishedQuery] : []),
|
||||
...(catalogIds.length > 0 ? [catalogQuery, installedQuery] : []),
|
||||
].filter((query) => query.error != null && query.data === undefined);
|
||||
if (count === 0 && failed.length === 0) return null;
|
||||
const installedKnown = installedQuery.data !== undefined;
|
||||
|
||||
return (
|
||||
<section aria-labelledby="plugin-skills-title" className="flex flex-col gap-2">
|
||||
<h2 id="plugin-skills-title" className="flex items-baseline gap-2 px-4 text-sm text-muted-foreground">
|
||||
Skills {count > 0 ? <span className="tabular-nums">{count}</span> : null}
|
||||
</h2>
|
||||
{failed.length > 0 ? (
|
||||
<QueryErrorState
|
||||
error={failed[0].error}
|
||||
action={`load the skills that come with ${name}`}
|
||||
onRetry={() => failed.forEach((query) => void query.refetch())}
|
||||
retrying={failed.some((query) => query.isFetching)}
|
||||
/>
|
||||
) : null}
|
||||
{count > 0 ? <ul aria-label={`Skills that come with ${name}`} className="divide-y divide-border rounded-2xl bg-muted/50">
|
||||
{builtIn ? (
|
||||
<SkillRow name={builtIn.name} detail={builtIn.description}>
|
||||
<span className="shrink-0 text-xs text-muted-foreground">Added for agents assigned {name}</span>
|
||||
</SkillRow>
|
||||
) : null}
|
||||
{published.map((skill) => (
|
||||
<SkillRow key={skill.id} name={skill.name} detail={skill.description}>
|
||||
{skill.status === "approved" ? (
|
||||
<span className="flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<Check className="size-3.5" aria-hidden />
|
||||
Approved
|
||||
</span>
|
||||
) : (
|
||||
<Button type="button" variant="outline" size="sm" className="shrink-0" onClick={() => onNavigate("/skills")}>
|
||||
{skill.status === "pending_review" ? "Review" : "Open in Skills"}
|
||||
</Button>
|
||||
)}
|
||||
</SkillRow>
|
||||
))}
|
||||
{catalog.map((skill) => {
|
||||
const installed = installedKeys.has(skill.key);
|
||||
const pending = install.isPending && install.variables === skill.id;
|
||||
return (
|
||||
<SkillRow key={skill.id} name={skill.name} detail={skill.description}>
|
||||
{!installedKnown ? null : installed ? (
|
||||
<Button type="button" variant="ghost" size="sm" className="shrink-0" onClick={() => onNavigate("/skills")}>
|
||||
<Check aria-hidden />
|
||||
Added · choose agents
|
||||
</Button>
|
||||
) : (
|
||||
<Button type="button" variant="outline" size="sm" className="shrink-0" disabled={pending} aria-label={`Add ${skill.name}`} onClick={() => install.mutate(skill.id)}>
|
||||
{pending ? <Loader2 className="animate-spin" aria-hidden /> : null}
|
||||
Add skill
|
||||
</Button>
|
||||
)}
|
||||
</SkillRow>
|
||||
);
|
||||
})}
|
||||
</ul> : null}
|
||||
{install.error ? (
|
||||
<p role="alert" className="px-4 text-sm text-destructive">
|
||||
{describeError(install.error).body}
|
||||
</p>
|
||||
) : null}
|
||||
<p className="px-4 text-xs text-muted-foreground">Skills stay editable in Skills, where you choose which agents use them.</p>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// @vitest-environment jsdom
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { PluginsHeader } from "./PluginsHeader";
|
||||
|
||||
const reviewCount = vi.hoisted(() => ({ value: 0 }));
|
||||
vi.mock("./useReviewCount", () => ({ useReviewCount: () => reviewCount.value }));
|
||||
vi.mock("@/lib/router", () => ({
|
||||
Link: ({ to, children, ...rest }: { to: string; children: React.ReactNode }) => <a href={to} {...rest}>{children}</a>,
|
||||
}));
|
||||
|
||||
const options = [{ id: "mcp", title: "MCP server URL", description: "A custom server.", href: "/apps/byo" }];
|
||||
|
||||
describe("PluginsHeader", () => {
|
||||
it("links to Review and offers Add when nothing is waiting", () => {
|
||||
reviewCount.value = 0;
|
||||
const html = renderToStaticMarkup(<PluginsHeader options={options} onNavigate={() => {}} />);
|
||||
expect(html).toContain('href="/apps/review"');
|
||||
expect(html).toContain('aria-label="Open Review"');
|
||||
expect(html).toContain("Add");
|
||||
});
|
||||
|
||||
it("counts the requests waiting for review", () => {
|
||||
reviewCount.value = 3;
|
||||
const html = renderToStaticMarkup(<PluginsHeader options={options} onNavigate={() => {}} />);
|
||||
expect(html).toContain('aria-label="3 to review, open Review"');
|
||||
expect(html).toContain("3 to review");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
import { ChevronDown, ChevronRight } from "lucide-react";
|
||||
import { Link } from "@/lib/router";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { useReviewCount } from "./useReviewCount";
|
||||
|
||||
export type PluginsAddOption = { id: string; title: string; description: string; href: string };
|
||||
|
||||
/** Opens the Review page, and counts the requests waiting for the user's OK when there are any. */
|
||||
function ReviewButton() {
|
||||
const count = useReviewCount();
|
||||
return (
|
||||
<Button asChild variant="ghost" className="h-9 shrink-0 gap-2 px-3 text-muted-foreground">
|
||||
<Link to="/apps/review" aria-label={count > 0 ? `${count} to review, open Review` : "Open Review"}>
|
||||
{count > 0 ? (
|
||||
<span className="inline-flex h-6 items-center rounded-md bg-(--status-task-todo)/15 px-2 text-xs font-normal text-(--status-task-icon-todo) tabular-nums">
|
||||
{count} to review
|
||||
</span>
|
||||
) : (
|
||||
"Review"
|
||||
)}
|
||||
<ChevronRight className="size-4" aria-hidden />
|
||||
</Link>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
/** Page header for the Plugins marketplace: title, the Review shortcut, and the Add menu for bringing your own. */
|
||||
export function PluginsHeader({ options, onNavigate }: { options: PluginsAddOption[]; onNavigate: (href: string) => void }) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-start justify-between gap-x-6 gap-y-3">
|
||||
<div className="flex min-w-0 flex-col gap-1">
|
||||
<p className="text-2xl leading-8 font-semibold tracking-tight text-foreground">Plugins</p>
|
||||
<p className="text-sm leading-5 text-muted-foreground">
|
||||
Connect the apps your agents work in. Some come with skills you can add along the way.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
<ReviewButton />
|
||||
{options.length > 0 ? (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button type="button" className="h-9 shrink-0 px-4">
|
||||
Add
|
||||
<ChevronDown className="size-4" aria-hidden />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className={`w-72 ${ANALYTICS_MASK_CLASS}`}>
|
||||
{options.map((option) => (
|
||||
<DropdownMenuItem key={option.id} className="flex flex-col items-start gap-0.5 py-2" onSelect={() => onNavigate(option.href)}>
|
||||
<span className="text-sm font-semibold text-foreground">{option.title}</span>
|
||||
<span className="text-xs text-muted-foreground">{option.description}</span>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export function TailscaleConnector() {
|
||||
onSuccess: () => { authorization.cancel(); return client.invalidateQueries({ queryKey: tailscaleConnectionsKey(selectedCompanyId) }); } });
|
||||
useEffect(() => authorization.cancel, [selectedCompanyId, authorization.cancel]);
|
||||
useEffect(() => {
|
||||
setBreadcrumbs([{ label: "Connectors", href: "/apps" }, { label: "Tailscale" }]);
|
||||
setBreadcrumbs([{ label: "Plugins", href: "/apps" }, { label: "Tailscale" }]);
|
||||
return () => setBreadcrumbs([]);
|
||||
}, [setBreadcrumbs]);
|
||||
if (!selectedCompanyId) return <p className="text-sm text-muted-foreground">Select an organization to connect Tailscale.</p>;
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import type { ToolPolicy, ToolProfileConfiguration } from "@paperclipai/shared";
|
||||
import type { InstallState } from "@/lib/tool-installs";
|
||||
import type { AccessDraft } from "./types";
|
||||
|
||||
export function enabledCatalogIds(profile: ToolProfileConfiguration | undefined): Set<string> {
|
||||
const ids = new Set<string>();
|
||||
for (const entry of profile?.entries ?? []) {
|
||||
if (entry.effect === "include" && entry.catalogEntryId) ids.add(entry.catalogEntryId);
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
export function askFirstCatalogIds(policies: ToolPolicy[], connectionId: string): Set<string> {
|
||||
const ids = new Set<string>();
|
||||
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.
|
||||
*/
|
||||
export 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) };
|
||||
}
|
||||
|
||||
export 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]),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { appsRouteHasRail } from "./apps-rail";
|
||||
|
||||
describe("appsRouteHasRail", () => {
|
||||
it("gives the marketplace pages no rail", () => {
|
||||
for (const segments of [["apps"], ["apps", "review"], ["apps", "plugin", "github"], ["apps", "connect"]]) {
|
||||
expect(appsRouteHasRail(segments, true)).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps the chat setup and detail rail", () => {
|
||||
expect(appsRouteHasRail(["apps", "chat", "connect"], false)).toBe(true);
|
||||
expect(appsRouteHasRail(["apps", "chat", "endpoint-1", "settings"], false)).toBe(true);
|
||||
expect(appsRouteHasRail(["apps", "chat"], false)).toBe(false);
|
||||
});
|
||||
|
||||
it("shows the developer rail only while a developer tab is on", () => {
|
||||
for (const segments of [["apps", "advanced", "smoke-lab"], ["apps", "gateways"], ["tools"]]) {
|
||||
expect(appsRouteHasRail(segments, true)).toBe(true);
|
||||
expect(appsRouteHasRail(segments, false)).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it("ignores routes outside the Apps area", () => {
|
||||
expect(appsRouteHasRail(["skills"], true)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Whether an Apps-area route keeps a second rail beside the main navigation.
|
||||
* The marketplace pages (browse, a plugin, Review) carry their own header and
|
||||
* links, so they have none; chat setup and detail keep theirs, and the
|
||||
* developer pages keep one only while a developer tab is switched on.
|
||||
*/
|
||||
export function appsRouteHasRail(segments: readonly string[], developerTabs: boolean): boolean {
|
||||
const area = segments[0]?.toLowerCase();
|
||||
if (area === "tools") return developerTabs;
|
||||
if (area !== "apps") return false;
|
||||
const section = segments[1]?.toLowerCase();
|
||||
if (section === "chat") return Boolean(segments[2]);
|
||||
if (section === "advanced" || section === "gateways" || section === "connections") return developerTabs;
|
||||
return false;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ export function ChatEndpointDetail() {
|
||||
useEffect(() => {
|
||||
if (!endpoint || !activeTab) return;
|
||||
setBreadcrumbs([
|
||||
{ label: "Connectors", href: "/apps" },
|
||||
{ label: "Plugins", href: "/apps" },
|
||||
{
|
||||
label: `${endpoint.assignedAgentName} · ${providerNames[endpoint.provider]}`,
|
||||
href: `/apps/chat/${endpoint.id}/settings`,
|
||||
|
||||
@@ -122,7 +122,7 @@ export function ChatConnectionPurpose({ provider, onChat, onTools, slackLabels }
|
||||
}) {
|
||||
const { setBreadcrumbs } = useBreadcrumbs();
|
||||
useEffect(() => {
|
||||
setBreadcrumbs([{ label: "Connectors", href: "/apps" }, { label: "Choose connection" }]);
|
||||
setBreadcrumbs([{ label: "Plugins", href: "/apps" }, { label: "Choose connection" }]);
|
||||
return () => setBreadcrumbs([]);
|
||||
}, [setBreadcrumbs]);
|
||||
return (
|
||||
@@ -212,7 +212,7 @@ function ChatSdkEndpointSetup() {
|
||||
|
||||
useEffect(() => {
|
||||
setBreadcrumbs([
|
||||
{ label: "Connectors", href: "/apps" },
|
||||
{ label: "Plugins", href: "/apps" },
|
||||
{ label: "Connect chat" },
|
||||
]);
|
||||
return () => setBreadcrumbs([]);
|
||||
|
||||
@@ -198,7 +198,7 @@ export function GitHubChatSetup() {
|
||||
}, [connected, bot, selectedAgent, state, queryClient, navigate]);
|
||||
useEffect(() => {
|
||||
setBreadcrumbs([
|
||||
{ label: "Connectors", href: "/apps" },
|
||||
{ label: "Plugins", href: "/apps" },
|
||||
{ label: "GitHub Code Review Bot" },
|
||||
]);
|
||||
return () => setBreadcrumbs([]);
|
||||
|
||||
@@ -104,7 +104,7 @@ export function GatewayDetail() {
|
||||
useEffect(() => {
|
||||
if (!gateway) return;
|
||||
setBreadcrumbs([
|
||||
{ label: "Connectors", href: "/apps" },
|
||||
{ label: "Plugins", href: "/apps" },
|
||||
{ label: "Gateways", href: "/apps/gateways" },
|
||||
{ label: gateway.name },
|
||||
]);
|
||||
|
||||
@@ -41,7 +41,7 @@ export function GatewaysList() {
|
||||
|
||||
useEffect(() => {
|
||||
setBreadcrumbs([
|
||||
{ label: "Connectors", href: "/apps" },
|
||||
{ label: "Plugins", href: "/apps" },
|
||||
{ label: "Gateways" },
|
||||
]);
|
||||
return () => setBreadcrumbs([]);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { AGGREGATOR_APP_CATALOG } from "@paperclipai/shared/aggregator-app-catalog";
|
||||
import { aggregatorPluginCategory } from "./plugin-categories";
|
||||
|
||||
describe("aggregatorPluginCategory", () => {
|
||||
it("uses the provider's own category when the catalog states one", () => {
|
||||
expect(aggregatorPluginCategory({ name: "Anything", category: "development" })).toBe("developer");
|
||||
expect(aggregatorPluginCategory({ name: "Anything", category: "payments" })).toBe("commerce");
|
||||
});
|
||||
|
||||
it("falls back to keywords in the name, and to Other when none match", () => {
|
||||
expect(aggregatorPluginCategory({ name: "Agile CRM" })).toBe("productivity");
|
||||
expect(aggregatorPluginCategory({ name: "Bulk Email Checker" })).toBe("communication");
|
||||
expect(aggregatorPluginCategory({ name: "Coinbase Wallet" })).toBe("commerce");
|
||||
expect(aggregatorPluginCategory({ name: "AllTrails" })).toBe("other");
|
||||
});
|
||||
|
||||
it("carries Arcade categories through the shared catalog", () => {
|
||||
expect(AGGREGATOR_APP_CATALOG.some((app) => app.category === "productivity")).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { AggregatorAppCatalogEntry } from "@paperclipai/shared/aggregator-app-catalog";
|
||||
import type { PluginCategoryId } from "./PluginMarketplace";
|
||||
|
||||
/** Arcade's own category names, mapped onto the Plugins categories. */
|
||||
const PROVIDER_CATEGORY: Record<string, PluginCategoryId> = {
|
||||
productivity: "productivity",
|
||||
sales: "productivity",
|
||||
development: "developer",
|
||||
databases: "data",
|
||||
search: "data",
|
||||
"customer-support": "communication",
|
||||
social: "communication",
|
||||
entertainment: "content",
|
||||
payments: "commerce",
|
||||
};
|
||||
|
||||
/**
|
||||
* Name keywords for apps whose catalog states no category (all of Composio's).
|
||||
* The first category with a matching word wins, so the more specific lists come
|
||||
* first. This is a best guess from the name alone; anything unmatched is "other".
|
||||
*/
|
||||
const KEYWORDS: [PluginCategoryId, RegExp][] = [
|
||||
["ai", /\b(ai|gpt|llm|openai|anthropic|cohere|deepseek|mistral|gemini|perplexity|replicate|elevenlabs|assemblyai|deepgram|groq|ollama|chatbot\w*|bot\w*|agent\w*)\b/],
|
||||
["commerce", /\b(shop\w*|pay\w*|stripe|commerce|store|cart|invoic\w*|billing|checkout|square|order\w*|subscription\w*|bank\w*|accounting|quickbooks|xero|coin\w*|crypto\w*|wallet|btc\w*|brex|ecommerce|woocommerce)\b/],
|
||||
["analytics", /\b(analytics|amplitude|mixpanel|posthog|segment|metrics|insight\w*|seo|ahrefs|semrush|chart\w*|report\w*|track\w*|baremetrics|databox|hotjar|plausible)\b/],
|
||||
["data", /\b(database|sql|postgres\w*|mysql|mongo\w*|redis|snowflake|bigquery|databricks|clickhouse|airtable|baserow|sheets?|csv\w*|data\w*|warehouse|elastic\w*|algolia|pinecone|supabase|scrap\w*|crawl\w*|search)\b/],
|
||||
["developer", /\b(github|gitlab|bitbucket|circleci|buildkite|sentry|datadog|vercel|netlify|cloudflare|aws|azure|gcp|docker|kubernetes|api\w*|sdk|browser\w*|code\w*|dev\w*|deploy\w*|bug\w*|test\w*|terraform|heroku|firebase|npm|webhook\w*|server|cloud\w*|monitor\w*)\b/],
|
||||
["communication", /\b(e?mail\w*|sms|slack|discord|teams|telegram|whatsapp|chat\w*|messag\w*|twilio|zoom|meet\w*|call\w*|voice|intercom|crisp|inbox|phone|texter|newsletter|webinar)\b/],
|
||||
["content", /\b(cms|content\w*|pdf\w*|docs?|image\w*|video\w*|photo\w*|media|design\w*|canva|figma|wordpress|blog\w*|webflow|youtube|podcast\w*|audio\w*|transcri\w*|translat\w*|caption\w*|screenshot\w*)\b/],
|
||||
["productivity", /\b(calendar\w*|tasks?|todo\w*|projects?|notion|asana|trello|jira|clickup|crm|forms?|survey\w*|schedul\w*|notes?|hr|time\w*|booking\w*|sign|workflow\w*|automation|zapier|proposal\w*|recruit\w*|appointment\w*)\b/],
|
||||
];
|
||||
|
||||
/** Which Plugins category an aggregator app belongs in. */
|
||||
export function aggregatorPluginCategory(app: Pick<AggregatorAppCatalogEntry, "name" | "category">): PluginCategoryId {
|
||||
const stated = app.category ? PROVIDER_CATEGORY[app.category] : undefined;
|
||||
if (stated) return stated;
|
||||
const name = app.name.toLowerCase().replace(/[^a-z0-9]+/g, " ");
|
||||
return KEYWORDS.find(([, words]) => words.test(name))?.[0] ?? "other";
|
||||
}
|
||||
@@ -7,7 +7,12 @@ import { Input } from "@/components/ui/input";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import { CATALOG_PAGE_SIZE, ConnectorCard } from "@/pages/apps/Browse";
|
||||
import { appCopyFor } from "@/lib/app-gallery-copy";
|
||||
import { CatalogSourceFilters, CATALOG_SOURCE_NAMES as SOURCE_NAMES, type CatalogSource as Source } from "@/pages/apps/CatalogSourceFilters";
|
||||
import { TabFilters } from "@/components/TabBar";
|
||||
|
||||
// This prototype keeps the five-source model it was reviewed with; the shipped page has since merged "Paperclip" into "All".
|
||||
const SOURCES = ["paperclip", "composio", "arcade", "installed", "all"] as const;
|
||||
type Source = (typeof SOURCES)[number];
|
||||
const SOURCE_NAMES = { paperclip: "Paperclip", composio: "Composio", arcade: "Arcade", executor: "Executor", installed: "Installed", all: "All" };
|
||||
|
||||
type Row = ComponentProps<typeof ConnectorCard>["row"];
|
||||
const NATIVE_SLUGS = ["notion", "composio", "agentmail", "arcade", "browser-use-cloud", "discord", "executor", "github", "linear", "posthog", "railway", "slack", "telegram", "zapier"];
|
||||
@@ -146,7 +151,7 @@ export function ConnectorCatalogNavigation({
|
||||
{query ? <button aria-label="Clear search" className="absolute right-3 top-1/2 -translate-y-1/2 rounded-sm text-muted-foreground hover:text-foreground"
|
||||
onClick={() => changeQuery("")}><X className="size-4" /></button> : null}
|
||||
</div>
|
||||
<CatalogSourceFilters source={source} onChange={browse} />
|
||||
<TabFilters label="App filters" size="standard" items={SOURCES.map(value => ({ value, label: SOURCE_NAMES[value] }))} value={source} onValueChange={browse} />
|
||||
</header>
|
||||
|
||||
{connected.length > 0 ? <section aria-label="Connected apps" className="flex flex-col gap-3">
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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<HTMLElement>('[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<HTMLElement>('[data-app-slug="openai"]')!);
|
||||
const body = within(canvasElement.ownerDocument.body);
|
||||
await userEvent.click(await provider.findByRole("button", { name: "2 connections" }));
|
||||
|
||||
Reference in new issue
Block a user