diff --git a/tests/ai-connections-app/connection-pools.spec.ts b/tests/ai-connections-app/connection-pools.spec.ts index 5019742e306..f3d3c276e87 100644 --- a/tests/ai-connections-app/connection-pools.spec.ts +++ b/tests/ai-connections-app/connection-pools.spec.ts @@ -70,7 +70,7 @@ test("native catalog setup, account edits, conflicts and removal persist through const saved = async () => (await listPools(request)).find(pool => pool.id === poolId)!; expect(await saved()).toMatchObject({ enabled: false, mode: "round_robin", thresholdPercent: 90 }); expect((await saved()).members.map(member => member.binding.connectionId)).toEqual([accounts[1]!.id, accounts[0]!.id]); - await expect(page.getByRole("link", { name: "Settings", exact: true })).toBeVisible(); + await expect(page.getByRole("link", { name: "Back to Plugins", exact: true })).toBeVisible(); await expect(page.getByRole("link", { name: "Review", exact: true })).toHaveCount(0); await expect(page.getByRole("checkbox", { name: "Enable this pool", exact: true })).not.toBeChecked(); await expect(page.getByRole("region", { name: "Used by", exact: true })).toContainText("No agents yet."); @@ -116,7 +116,7 @@ test("native catalog setup, account edits, conflicts and removal persist through await expect(confirmation).toContainText("The connections in this pool are kept."); await confirmation.getByRole("button", { name: "Cancel", exact: true }).click(); expect(await saved()).toBeTruthy(); - await page.getByRole("link", { name: "All connectors", exact: true }).click(); + await page.getByRole("link", { name: "Back to Plugins", exact: true }).click(); await page.getByRole("button", { name: `Manage ${name} connection`, exact: true }).click(); await page.getByRole("menuitem", { name: "Remove connection", exact: true }).click(); await page.getByRole("alertdialog").getByRole("button", { name: "Remove connection", exact: true }).click(); diff --git a/ui/src/components/Layout.production.tsx b/ui/src/components/Layout.production.tsx index 848bd86e667..070f9b94a46 100644 --- a/ui/src/components/Layout.production.tsx +++ b/ui/src/components/Layout.production.tsx @@ -145,12 +145,6 @@ export function Layout() { ); const isToolsRoute = companyPathSegments[0]?.toLowerCase() === "tools"; const isAppsRoute = companyPathSegments[0]?.toLowerCase() === "apps"; - const appDetailConnectionId = - isAppsRoute && - companyPathSegments[1] && - !RESERVED_APP_SUBPATHS.has(companyPathSegments[1].toLowerCase()) - ? companyPathSegments[1] - : null; const appDetailApplicationId = isAppsRoute && companyPathSegments[1]?.toLowerCase() === "app" && @@ -205,8 +199,6 @@ export function Layout() { ); const secondarySidebar = isCompanySettingsRoute ? ( - ) : appDetailConnectionId ? ( - ) : appDetailApplicationId ? ( ) : !streamlinedUiEnabled && shellRoute.builtInContextualSurface === "skills" ? ( - ) : appDetailConnectionId ? ( - ) : appDetailApplicationId ? ( ) : appsRouteHasRail(companyPathSegments, appsDeveloperTabs.length > 0) ? ( diff --git a/ui/src/components/ai-connections/AiConnectionPoolConnector.tsx b/ui/src/components/ai-connections/AiConnectionPoolConnector.tsx index 529f76b7dfc..752dd2631dc 100644 --- a/ui/src/components/ai-connections/AiConnectionPoolConnector.tsx +++ b/ui/src/components/ai-connections/AiConnectionPoolConnector.tsx @@ -14,7 +14,7 @@ import { useToast } from "@/context/ToastContext"; import { Link, useNavigate } from "@/lib/router"; import { queryKeys } from "@/lib/queryKeys"; import { AppLogo } from "@/pages/apps/AppLogo"; -import { AppDetailHeader } from "@/pages/apps/AppDetail"; +import { AppDetailHeader, ConnectionBackLink } from "@/pages/apps/AppDetail"; import { StepHeader } from "@/features/connections/ConnectionSetupHeader"; import { Button } from "@/components/ui/button"; import { QueryErrorState, useQueryView } from "@/components/QueryView"; @@ -146,7 +146,8 @@ function PoolConnector({ companyId, pluginKey, connection }: { companyId: string })} {draft.members.length === 0 &&
  • Add a connection to get started.
  • } ; - return
    + return
    + {connection ? : null} {connection ?
    { if (!disabled) { setNameDraft(draft.name); setRenaming(true); } }} onRenameCancel={() => setRenaming(false)} onRenameSubmit={value => void save({ ...draft, name: value })} /> { setError(""); setRemoving(true); }}>Remove connection diff --git a/ui/src/lib/analytics/replay-masking.test.tsx b/ui/src/lib/analytics/replay-masking.test.tsx index 545040d9ebc..eb903873d6c 100644 --- a/ui/src/lib/analytics/replay-masking.test.tsx +++ b/ui/src/lib/analytics/replay-masking.test.tsx @@ -65,7 +65,7 @@ const MASKED_SURFACES: Array<{ file: string; content: string }> = [ { file: "pages/apps/Browse.tsx", content: "“{connection.name}”" }, { file: "pages/apps/Connections.tsx", content: ">{row.displayName}" }, { file: "pages/apps/AppDetail.tsx", content: "

    {appName}" }, - { file: "pages/apps/AppDetail.tsx", content: "

    {appName}" }, + { file: "pages/apps/AppDetail.tsx", content: "

    {appName}" }, { file: "components/AppConnectionSidebar.tsx", content: "{appName}" }, { file: "features/connections/ConnectionChoiceList.tsx", content: ">{choice.name}" }, { file: "features/connections/ConnectionIntentInteractionBody.tsx", content: "${accessRequest.connectionName}" }, diff --git a/ui/src/pages/apps/AppDetail.tsx b/ui/src/pages/apps/AppDetail.tsx index 0948e88136f..0a29e841d44 100644 --- a/ui/src/pages/apps/AppDetail.tsx +++ b/ui/src/pages/apps/AppDetail.tsx @@ -12,7 +12,7 @@ import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } fro import { EmailConnectionAccess } from "@/components/EmailConnectionAccess"; import { EmailConnectionInboxes } from "./chat/EmailEndpointSetup"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; -import { Check, Loader2, Pencil } from "lucide-react"; +import { ArrowLeft, Check, Loader2, Pencil } from "lucide-react"; import type { ToolConnection, ToolPolicy, @@ -24,7 +24,7 @@ import { aiSubscriptionNeedsIsolatedLogin, isToolConnectionAttentionHealth as isAttentionHealthStatus, } from "@paperclipai/shared"; -import { Navigate, useParams, useNavigate, useSearchParams } from "@/lib/router"; +import { Link, Navigate, useParams, useNavigate, useSearchParams } from "@/lib/router"; import { useCompany } from "@/context/CompanyContext"; import { useBreadcrumbs } from "@/context/BreadcrumbContext"; import { useToast } from "@/context/ToastContext"; @@ -57,7 +57,7 @@ import { galleryEntryFor, type AppGalleryDisplayEntry, } from "./app-definition-display"; -import { appTabHref, appTabLabel, isAppTabKey, type AppTabKey } from "./app-tabs"; +import { APP_TABS, appTabHref, isAppTabKey, type AppTabKey } from "./app-tabs"; import { ConnectionProvenanceChip } from "./ConnectionProvenanceChip"; import { IdentitiesSection } from "./app-detail/IdentitiesSection"; import { PermissionsPanel } from "./app-detail/PermissionsPanel"; @@ -258,6 +258,8 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio const appName = connection ? connectionDisplayNameForOwner(connection, baseAppName, owner) : "App"; + // A connection made from the catalog belongs to a plugin page; anything else goes back to the marketplace. + const pluginHref = logoEntry ? `/apps/plugin/${encodeURIComponent(appDefinitionSlug(logoEntry))}` : null; const successNoticeShownFor = useRef(null); useEffect(() => { @@ -285,11 +287,11 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio if (!activeTab) return; setBreadcrumbs([ { label: "Plugins", href: "/apps" }, - { label: appName, href: appTabHref(connectionId, "permissions") }, - { label: appTabLabel(activeTab) }, + ...(pluginHref ? [{ label: baseAppName, href: pluginHref }] : []), + { label: appName }, ]); return () => setBreadcrumbs([]); - }, [setBreadcrumbs, appName, connectionId, activeTab]); + }, [setBreadcrumbs, appName, baseAppName, pluginHref, activeTab]); const { catalog, active, quarantined, readOnly, canChange } = useMemo(() => { const catalog = catalogQuery.data?.catalog ?? []; @@ -543,7 +545,7 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio } if (connectionQuery.isLoading || connectionView.kind === "reconnecting") { return ( -
    +
    @@ -591,9 +593,11 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio const permissionsFailure = permissionsViews.find((view) => view.kind === "error"); return ( -
    +
    {authorization.fallback} {workspaceGate.dialog} +
    + -
    + +
    +
    {status.tone === "attention" && connection.requiresReauthorization === false && ( : permissionsLoading ? - :
    + :
    {isAppAggregator(brandKey) && grantsQuery.data?.capabilities.canConfigure === true ? : null} {connection.config?.sourceTemplateKey === "honcho" && } @@ -708,10 +714,10 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio onReplaceAudience={(grant, memberUserIds) => replaceAudience.mutate({ grantId: grant.id, memberUserIds })} /> - {connection.config?.sourceTemplateKey === "composio" ?

    + {connection.config?.sourceTemplateKey === "composio" ?

    These permissions apply to all apps available through this Composio connection. Manage app accounts and sign-in in Composio.

    : null} - {connection.config?.sourceTemplateKey !== "composio" && isRemoteMcpConnectorMethod(connection.config?.sourceTemplateKey, connection.config?.connectionMethodKey) &&

    Paperclip controls access to the tools listed here. App and action permissions inside these tools are managed in {baseAppName}.

    } + {connection.config?.sourceTemplateKey !== "composio" && isRemoteMcpConnectorMethod(connection.config?.sourceTemplateKey, connection.config?.connectionMethodKey) &&

    Paperclip controls access to the tools listed here. App and action permissions inside these tools are managed in {baseAppName}.

    } {instructionsTemplate && }{renderAgentSettings?.(connection)}} actions={actionsContent} @@ -759,7 +765,7 @@ function StandardAppDetail({ renderActions, renderAgentSettings, renderConnectio onDisconnect={() => disconnectRemote.mutateAsync()} />} {grantsQuery.data?.capabilities.canConfigure === true && connection.connectionPurpose === "tool" && ( -
    +
    )} @@ -805,76 +811,119 @@ export function AppDetailHeader({ onRenameSubmit: (value: string) => void; }) { const unverifiedHost = unverifiedRemoteHost(connection); + const hint = connectionDisplaySecondaryHint(connection); return ( -
    -
    - -
    - {renaming ? ( -
    { - event.preventDefault(); - onRenameSubmit(nameDraft.trim()); - }} +
    + +
    + {renaming ? ( + { + event.preventDefault(); + onRenameSubmit(nameDraft.trim()); + }} + > + onNameDraftChange(event.target.value)} + className="h-9 w-64 text-lg font-semibold" + autoFocus + /> + + + + ) : ( +
    +

    {appName}

    + - - - ) : ( -
    -

    {appName}

    - -
    - )} -
    - - {connection.config?.provider !== "agentmail" && actionCount !== null && ( - - {actionCount} {actionCount === 1 ? "action" : "actions"} available - - )} - {connectionDisplaySecondaryHint(connection) ? ( - - {connectionDisplaySecondaryHint(connection)} - - ) : null} - {unverifiedHost ? : null} - + +
    + )} +
    + + {connection.config?.provider !== "agentmail" && actionCount !== null && ( + + {actionCount} {actionCount === 1 ? "action" : "actions"} available + + )} + {hint ? {hint} : null} + {unverifiedHost ? : null} +
    ); } +/** Returns from a connection to the plugin it belongs to, or to the marketplace when it has none. */ +export function ConnectionBackLink({ label, href }: { label: string; href: string }) { + return ( + + ); +} + +/** Permissions and Review for one connection, with how many requests and new actions are waiting. */ +function ConnectionTabs({ connectionId, active }: { connectionId: string; active: AppTabKey }) { + const { selectedCompanyId } = useCompany(); + const counts = useQuery({ + queryKey: queryKeys.apps.connectionReviewCounts(selectedCompanyId ?? "__none__", connectionId), + queryFn: () => toolsApi.getConnectionReviewCounts(connectionId), + enabled: !!selectedCompanyId && !!connectionId, + refetchInterval: 30_000, + }); + const waiting = (counts.data?.pendingActionRequestCount ?? 0) + ((counts.data?.quarantinedCatalogEntryCount ?? 0) > 0 ? 1 : 0); + return ( + + ); +} + function ToolsLoading({ mcpActions = false }: { mcpActions?: boolean }) { return (
    @@ -921,18 +970,13 @@ function statusFor(connection: ToolConnection): StatusInfo { function StatusBadge({ status }: { status: StatusInfo }) { const klass: Record = { - connected: "border-emerald-500/40 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300", - attention: "border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-300", - paused: "border-border bg-muted text-muted-foreground", + connected: "bg-(--status-task-done)/15 text-(--status-task-icon-done)", + attention: "bg-(--status-task-todo)/15 text-(--status-task-icon-todo)", + paused: "bg-muted text-muted-foreground", }; return ( - - {status.tone === "connected" && } + + {status.tone === "connected" && } {status.label} ); diff --git a/ui/src/pages/apps/Browse.tsx b/ui/src/pages/apps/Browse.tsx index 82b476cfb97..f62a97da27c 100644 --- a/ui/src/pages/apps/Browse.tsx +++ b/ui/src/pages/apps/Browse.tsx @@ -1731,7 +1731,12 @@ function ConnectionAccountRow({ : "Reconnect" : "Finish setup"} - ) : null} + ) : state.kind === "draft" ? null : ( + + )} @@ -310,24 +313,21 @@ function GitHubConnectionSummary({ ? "No repositories selected" : `${github.repositoryCount} selected ${github.repositoryCount === 1 ? "repository" : "repositories"}`; return ( -
    -
    -
    GitHub account
    - +
    + -
    +
    Repositories
    {repositoryWarning ? (
    {onRefreshAccess && configurationUrl ? ( - ) : null} @@ -380,7 +380,7 @@ function GitHubConnectionSummary({ } function IdentitiesHeading() { - return

    Which humans can use this credential?

    ; + return

    Which humans can use this credential?

    ; } function HumanAccessCards({ @@ -407,7 +407,7 @@ function HumanAccessCards({ { if (!canEditAudience || personal) return; if (next === "company") onChooseAll(); @@ -438,7 +438,7 @@ function HumanAccessCards({ ]} /> {connectedName && status !== null ? ( -
    +
    {status === "active" ? null : }
    @@ -461,7 +461,7 @@ function IdentityRow({ actions: ReactNode; }) { return ( -
    +
    {title} diff --git a/ui/src/pages/apps/app-detail/PermissionsPanel.tsx b/ui/src/pages/apps/app-detail/PermissionsPanel.tsx index 37068158453..bd5be4252f9 100644 --- a/ui/src/pages/apps/app-detail/PermissionsPanel.tsx +++ b/ui/src/pages/apps/app-detail/PermissionsPanel.tsx @@ -24,6 +24,8 @@ function NoIcon() { import type { AccessDraft, AppDetailSectionProps } from "./types"; import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy"; +const NOTE = "rounded-2xl bg-muted/50 px-4 py-3 text-sm text-muted-foreground"; + type ActionPermission = "off" | "ask" | "allowed"; type ActionKindFilter = "all" | "read" | "write"; @@ -76,7 +78,7 @@ export function PermissionsPanel({ }) { const [searchParams] = useSearchParams(); return ( -
    +
    -
    -

    Which agents can use this connection?

    +
    +
    +

    Which agents can use this connection?

    {disabled ? Saving… : null}
    @@ -147,7 +149,7 @@ function AgentAccessSection({ ariaLabel="Which agents can use this connection" value={access.mode} disabled={disabled} - className="sm:grid-cols-2" + className="*:rounded-2xl sm:grid-cols-2" onValueChange={(next) => { if (next === "all") onSave({ mode: "all", agentIds: new Set() }); else onSave({ @@ -191,13 +193,13 @@ function AgentAccessSection({ ) : null}
    ) : access.mode === "all" ? ( -

    Any agent can use this connection.

    +

    Any agent can use this connection.

    ) : selectedAgents.length === 0 ? ( -

    No agents can use this connection.

    +

    No agents can use this connection.

    ) : ( -
    +
    {selectedAgents.map((agent) => ( -
    +
    {agent.name}
    @@ -257,23 +259,20 @@ export function ActionsSection({ return ( -
    -
    -

    Actions

    +
    +
    +

    Actions

    {canConfigure ? (
    {disabled ? Saving… : null}
    @@ -310,18 +309,19 @@ export function ActionsSection({ setKindFilter("read")} /> setKindFilter("write")} />
    -

    {visibleCount} matches · sorted A–Z

    +

    {visibleCount} {visibleCount === 1 ? "match" : "matches"}, sorted A–Z

    {visibleCount === 0 ? ( -
    +
    No actions match “{query}”. Clear the search to see them all.
    ) : ( -
    +
    {label} @@ -384,6 +383,7 @@ function matchesAction(entry: ToolCatalogEntry, needle: string) { function ActionGroup({ kind, + label, title, actions, connectionId, @@ -396,6 +396,8 @@ function ActionGroup({ onSetPermission, }: { kind: "read" | "write"; + /** The visible name; `title` keeps the count in the name assistive tech and tests read. */ + label: string; title: string; actions: ToolCatalogEntry[]; connectionId: string; @@ -419,9 +421,12 @@ function ActionGroup({ : ""; })(); return ( -
    -
    -

    {title}

    +
    +
    +

    + {label} + {actions.length} +

    {canConfigure ? ( // PAP-659 C6b: set the whole group at once, so narrowing a fresh // connection's writes is one choice rather than one per action; @@ -438,7 +443,7 @@ function ActionGroup({ // the last call overwrite the others. onSetPermission(actions.map((action) => action.id), event.target.value as ActionPermission); }} - className="h-7 rounded-md border border-input bg-background px-2 text-xs text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30" + className="h-8 rounded-lg bg-transparent px-2 text-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring" > {groupValue === "" ? : null} {PERMISSION_OPTIONS.map((option) => ( @@ -448,7 +453,7 @@ function ActionGroup({ ) : null}
    -
    +
    {visibleActions.map((action) => ( {visibleLimit < actions.length ? ( - +
    + +
    ) : null}
    ); @@ -515,8 +522,8 @@ const ActionRow = memo(function ActionRow({
    @@ -530,7 +537,7 @@ const ActionRow = memo(function ActionRow({ what each action was classified as. A misfiled tool is then one glance to spot and one click to move. */} {action.riskLevel} @@ -545,7 +552,7 @@ const ActionRow = memo(function ActionRow({
    {PERMISSION_OPTIONS.map((option) => { const Icon = option.icon; @@ -561,7 +568,7 @@ const ActionRow = memo(function ActionRow({ disabled={disabled} onClick={() => onSetPermission([action.id], option.value)} className={cn( - "flex h-8 w-8 items-center justify-center rounded-sm text-muted-foreground outline-none transition-colors", + "flex size-8 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors", "hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:opacity-50", selected && "bg-background text-foreground shadow-xs", @@ -582,8 +589,8 @@ const ActionRow = memo(function ActionRow({ {PERMISSION_OPTIONS.find((option) => option.value === value)?.label} )} -