mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-23 21:24:45 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Hosted Paperclip Cloud records browser sessions with PostHog session replay > - Replay masked all text and showed only an allowlist of chrome, so most replays showed only stars > - The team cannot see how people use the board, and the allowlist needed a review for each new label > - The owner decided to show text by default and mask only marked customer content, the way PostHog normally works > - This pull request flips the default, removes the allowlist, and marks every surface that can show connected-account content > - The benefit is readable replays, while Google user data and Slack data stay masked ## Linked Issues or Issue Description **Subsystem affected** Hosted Cloud browser analytics: PostHog session replay in the board UI (`ui/src/lib/analytics/`). **Problem or motivation** Replay masked every text node. Only sidebar items and opt-in components showed text. Replays were almost unreadable. Each new label needed an `analyticsChrome` opt-in and an allowlist review. **Proposed solution** Record text as it is. Mask text only inside `ph-mask` (customer content), `ph-no-capture` (secrets, blocked) and editable content. Add `ANALYTICS_MASK_CLASS` to every surface that can show connected-account content (Gmail, Calendar, Drive and Docs, Slack) or other free-form text from agents or customers. **Alternatives considered** Keep "mask all" and grow the allowlist. This needs a review for each label and still hides most of the board. ## What Changed - `privacy.ts`: `ANALYTICS_MASK_TEXT_SELECTOR` is now `.ph-mask, .ph-no-capture, [contenteditable]:not([contenteditable="false"])`. rrweb masks a text node only when its parent or an ancestor matches the selector. Removed `maskReplayText`, `isReplayTextRevealed`, `ANALYTICS_UNMASK_ATTRIBUTE` and `ANALYTICS_UNMASK_PROPS`. - `product-analytics.ts`: removed `maskTextFn`, so rrweb uses its default star masking. `maskAllInputs`, `blockClass`, `maskAttributeFn`, `mask_all_text` and `mask_all_element_attributes` do not change. - Removed the `analyticsChrome` prop from `Button`, `Label`, `TabsTrigger`, `EmptyState` and `SidebarNavItem`, and from all sidebar call sites. - Added `ANALYTICS_MASK_CLASS` to the content element (not the chrome) of these surfaces: - Link preview cards, task quicklook description, external object pills and rows, related-work titles. - Email message cards and email send intents. - Connected account names and email addresses (Browse, Connections, app detail headers, app sidebar, connection choice list, connection access and repair cards), GitHub login and repositories, Slack workspace names, chat channel and linked user labels. - Inbox and decision rows (subject and detail), obligation evidence, Needs You notes and receipts, decision options and result summaries, and the interaction card roots (questions, options, answers, tool action requests, suggested tasks). - Approval payloads, action card input and reason, recovery card headline, evidence and options, run ledger retry detail, interrupt handoff previews. - Run transcripts, run failure details and run events on the agent page. - Search result snippets, toast bodies, voice and call transcripts, case summary, files and fields, attachment previews, artifact previews (text, tables, patches and documents). - Replaced `unmask-allowlist.test.ts` with `replay-masking.test.tsx`. It checks that unmarked chrome records as it is, that each marker masks, that a rendered voice transcript and run transcript mask, that each surface above has the class, and that autocapture records no element text. Updated `privacy.test.ts`, `shared-chrome.test.tsx` and `product-analytics.test.ts`. - Updated `doc/cloud-browser-analytics.md`: new default, marker classes, masked surfaces, and residual risk. ## Verification - `pnpm exec vitest run src/lib/analytics` in `ui/`: 83 tests pass. - Vitest for the 48 test files next to the changed components: 994 tests pass. - `tsc --noEmit -p ui/tsconfig.json`: no new errors (only the existing generated Storybook catalog errors). - `pnpm verify` exits 2 because a doc is a global CI input. Required CI supplies the broad coverage. - Manual: I ran an isolated local instance with a Cloud-like browser analytics config. `PAPERCLIP_POSTHOG_HOST` pointed to a local capture server, not PostHog. I opened a task page in headless Chromium, hovered a GitHub pull request link, and decoded the captured `/s/` replay payloads: - Clear text: sidebar (`New task`, `Chat`, `Tasks`, `Inbox`, `More`), breadcrumb, task title `Quarterly launch checklist`, `REP-1`, the Connectors promo heading and button. - Masked (stars only): the markdown task body, the chat comment, the link preview card (pull request title, author, URL, status), and the company menu. - Marker strings in the body, comment and preview never appeared in clear text in any payload. - The page `<title>` (task title and company name) is in the replay head. This is accepted residual risk. ## Risks - Text that is not marked is now recorded. Task titles, agent names, project names, company names, routine names, artifact and document titles, and activity rows are visible in replays. The owner accepted this. An agent can copy email or Slack text into a task title. - A new surface that shows connected-account content without `ANALYTICS_MASK_CLASS` is recorded until somebody marks it. `replay-masking.test.tsx` and the doc list the marked surfaces. - The masking options in `posthog.init` take precedence over the PostHog project masking settings (posthog-js 1.450), so a dashboard change cannot unmask content. Keep the project settings empty to avoid a console warning. - Some masked areas also mask nearby fixed labels (for example the interaction card buttons). This is safe. - Analytics is off on self-hosted and local installs, so they see no change. > 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 Opus 5.5 (claude-opus-5-5), Anthropic, with tool use and code execution in Claude Code. ## 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) - [x] 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 - [x] 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 - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
192 lines
17 KiB
TypeScript
192 lines
17 KiB
TypeScript
import { useEffect, useState } from "react";
|
||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||
import { Globe, Paperclip } from "lucide-react";
|
||
import { Link, useParams } from "@/lib/router";
|
||
import type { McpConnection, McpConnectionRequest, McpDotPairingPreview } from "@paperclipai/shared";
|
||
import { deriveInitials, Identity } from "@/components/Identity";
|
||
import { assistantConnectionDisplayName } from "./apps/connection-owner";
|
||
import { QueryErrorState, useQueryView } from "@/components/QueryView";
|
||
import { Button } from "@/components/ui/button";
|
||
import { Card } from "@/components/ui/card";
|
||
import { Checkbox } from "@/components/ui/checkbox";
|
||
import { Input } from "@/components/ui/input";
|
||
import { CompanyPatternIcon } from "@/components/CompanyPatternIcon";
|
||
import { useResilientFetch } from "@/hooks/useResilientFetch";
|
||
import { api } from "../api/client";
|
||
import { describeError } from "../api/errors";
|
||
import { cn } from "@/lib/utils";
|
||
import { ANALYTICS_NO_CAPTURE_CLASS } from "@/lib/analytics/privacy";
|
||
|
||
const PAIRING_CODE_PATTERN = /^[A-Za-z0-9_-]{32}$/;
|
||
|
||
// Bundle known-origin icons so opening consent never contacts a client-selected site.
|
||
// Client-supplied names never select branding.
|
||
function ClientOrigin({ origin }: { origin: string }) {
|
||
const [failed, setFailed] = useState(false);
|
||
let favicon: string | undefined;
|
||
try {
|
||
const url = new URL(origin);
|
||
if (url.origin === "https://claude.ai") favicon = "/brands/claude-color.svg";
|
||
else if (["https://chatgpt.com", "https://chat.openai.com", "https://openai.com"].includes(url.origin)) favicon = "/brands/codex-color.svg";
|
||
} catch { /* An unavailable origin keeps the neutral site icon. */ }
|
||
return <div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||
{favicon && !failed ? <img src={favicon} alt="" className="size-4 shrink-0 object-contain" referrerPolicy="no-referrer" crossOrigin="anonymous" onError={() => setFailed(true)} /> : <Globe className="size-4 shrink-0" aria-hidden="true" />}
|
||
<bdi className="min-w-0 break-all">{origin}</bdi>
|
||
</div>;
|
||
}
|
||
|
||
export function McpConnectPage({ agentPairingOnly = false }: { agentPairingOnly?: boolean } = {}) {
|
||
const { id = "" } = useParams();
|
||
return <McpConnectRequest key={id} id={id} agentPairingOnly={agentPairingOnly} />;
|
||
}
|
||
|
||
export function McpDevicePage({ initialCode }: { initialCode?: string } = {}) {
|
||
const [code, setCode] = useState(initialCode ?? new URLSearchParams(window.location.search).get("user_code") ?? "");
|
||
const [submitted, setSubmitted] = useState(code);
|
||
if (submitted) return <McpConnectRequest key={submitted} id={submitted} device onEditCode={() => setSubmitted("")} />;
|
||
return <div className="mx-auto max-w-xl py-10"><Card className="space-y-4 p-6"><div className="flex items-center gap-3"><Paperclip className="size-8 shrink-0" /><h1 className="min-w-0 text-xl font-semibold">Connect your assistant to Paperclip</h1></div>
|
||
<form className="space-y-4" onSubmit={event => { event.preventDefault(); setSubmitted(code.trim()); }}>
|
||
<label htmlFor="device-code" className="text-sm">Enter the code shown by your assistant</label>
|
||
<Input id="device-code" autoComplete="off" value={code} onChange={event => setCode(event.target.value)} required maxLength={12} />
|
||
<div className="flex justify-end"><Button type="submit">Continue</Button></div>
|
||
</form></Card></div>;
|
||
}
|
||
|
||
function McpConnectRequest({ id, device = false, agentPairingOnly = false, onEditCode }: { id: string; device?: boolean; agentPairingOnly?: boolean; onEditCode?: () => void }) {
|
||
const requestPrefix = agentPairingOnly ? "/dot-mcp/requests" : "/mcp/requests";
|
||
const [companyId, setCompanyId] = useState("");
|
||
const [pairingCode, setPairingCode] = useState("");
|
||
const [writeEnabled, setWriteEnabled] = useState(true);
|
||
const [deviceResult, setDeviceResult] = useState<"approved" | "denied" | null>(null);
|
||
const request = useQuery({ queryKey: [device ? "mcp-device" : agentPairingOnly ? "dot-mcp-request" : "mcp-request", id], queryFn: () => api.get<McpConnectionRequest>(device ? `/mcp/device?user_code=${encodeURIComponent(id)}` : `${requestPrefix}/${encodeURIComponent(id)}`) });
|
||
const requestView = useQueryView(request);
|
||
const data = request.data;
|
||
const trimmedPairingCode = pairingCode.trim();
|
||
const previewEnabled = Boolean(data?.agentConnection) && !device && PAIRING_CODE_PATTERN.test(trimmedPairingCode);
|
||
// A read-only preview behind a POST. The code is part of the key so an older
|
||
// preview is dropped the moment the code changes and a late response for an
|
||
// old code is ignored; it stays in this component's memory, never in the
|
||
// shared query cache.
|
||
const preview = useResilientFetch({
|
||
key: ["dot-pairing-preview", requestPrefix, id, trimmedPairingCode],
|
||
enabled: previewEnabled,
|
||
fetcher: (signal) => api.post<McpDotPairingPreview>(`${requestPrefix}/${encodeURIComponent(id)}/dot-pairing/preview`, { pairingCode: trimmedPairingCode }, { signal }),
|
||
});
|
||
const pairingPreview = previewEnabled && (preview.view.kind === "ready" || preview.view.kind === "stale") ? preview.data ?? null : null;
|
||
const previewPending = previewEnabled && (preview.view.kind === "loading" || preview.view.kind === "reconnecting");
|
||
const selectedCompanyId = data?.requestedCompanyId ?? (companyId || data?.companies[0]?.id || "");
|
||
// Pin the default once loaded so a refetch cannot silently switch organizations.
|
||
useEffect(() => {
|
||
if (!companyId && !data?.requestedCompanyId && data?.companies[0]) setCompanyId(data.companies[0].id);
|
||
}, [companyId, data]);
|
||
const clientName = data?.clientName.trim();
|
||
const assistantName = clientName && !/^(assistant|mcp client)$/i.test(clientName) ? clientName : "your assistant";
|
||
const clientOrigin = data?.clientOrigin || data?.redirectOrigin;
|
||
const company = data?.companies.find((item) => item.id === selectedCompanyId);
|
||
const canApproveWrites = Boolean(!data?.agentConnection && company?.canWrite && writeEnabled);
|
||
const allowWrites = Boolean(data?.requestedWrite && canApproveWrites);
|
||
const allowConfiguration = Boolean(data?.requestedConfigure && canApproveWrites);
|
||
const consent = useMutation({
|
||
mutationFn: (decision: "approve" | "deny") => api.post<{ redirectUrl?: string; status?: "approved" | "denied" }>(device ? "/mcp/device/consent" : `/mcp/requests/${encodeURIComponent(id)}/consent`, { decision, companyId: selectedCompanyId || undefined, allowWrites: decision === "approve" && allowWrites, allowConfiguration: decision === "approve" && allowConfiguration, ...(device ? { userCode: id } : {}) }),
|
||
onSuccess: ({ redirectUrl, status }) => { if (device && status) setDeviceResult(status); else if (redirectUrl) window.location.assign(redirectUrl); },
|
||
});
|
||
const pairDot = useMutation({
|
||
mutationFn: () => api.post<{ redirectUrl: string }>(`${requestPrefix}/${encodeURIComponent(id)}/dot-pairing`, { pairingCode: pairingCode.trim() }),
|
||
onSuccess: ({ redirectUrl }) => { setPairingCode(""); window.location.assign(redirectUrl); },
|
||
});
|
||
if (deviceResult) return <div className="mx-auto max-w-xl py-10"><Card className="block space-y-4 p-6"><Paperclip className="size-8" /><h1 className="text-xl font-semibold">{deviceResult === "approved" ? "Access approved" : "Connection declined"}</h1><p className="text-sm">{deviceResult === "approved" ? "Return to your assistant. It will finish connecting automatically." : "No access was granted. You can start a new connection from your assistant."}</p><Button variant="outline" asChild><Link to="/">Back to Paperclip</Link></Button></Card></div>;
|
||
const returnPath = device ? `/mcp-device?user_code=${encodeURIComponent(id)}` : `${agentPairingOnly ? "/dot-connect" : "/mcp-connect"}/${id}`;
|
||
return <div className="mx-auto max-w-xl py-10">
|
||
<Card className="block space-y-4 p-6">
|
||
<div className="flex items-center gap-3">
|
||
<Paperclip className="size-8 shrink-0 text-foreground" role="img" aria-label="Paperclip" />
|
||
<h1 className="min-w-0 break-words text-xl font-semibold">Connect <bdi>{assistantName}</bdi> to Paperclip</h1>
|
||
</div>
|
||
{clientOrigin && <ClientOrigin key={clientOrigin} origin={clientOrigin} />}
|
||
{!device && data?.redirectOrigin && data.redirectOrigin !== clientOrigin && <ClientOrigin key={data.redirectOrigin} origin={data.redirectOrigin} />}
|
||
{device && <p className="text-sm">Confirm this matches the code shown by your assistant: <strong className={cn("font-mono", ANALYTICS_NO_CAPTURE_CLASS)}>{id.toUpperCase()}</strong></p>}
|
||
{(requestView.kind === "loading" || requestView.kind === "reconnecting") && <p role="status" className="text-sm text-muted-foreground">Loading connection request…</p>}
|
||
{requestView.kind === "error" && <QueryErrorState error={requestView.error} action="load this connection request" onRetry={requestView.retry} retrying={requestView.isFetching} />}
|
||
{requestView.kind === "error" && <p className="text-sm text-muted-foreground">Start a new connection from your assistant.</p>}
|
||
{device && requestView.kind === "error" && <Button variant="outline" onClick={onEditCode}>Enter a different code</Button>}
|
||
{data?.agentConnection && !device && <form className="space-y-3" onSubmit={event => { event.preventDefault(); pairDot.mutate(); }}>
|
||
<p className="text-sm">Enter the one-use code from Paperclip’s agent setup to review this connection’s access. Keep the code out of Bot chat. Access is granted only when you approve the named agent below.</p>
|
||
<label htmlFor="dot-pairing-code" className="text-sm">Pairing code</label>
|
||
<Input id="dot-pairing-code" type="password" autoComplete="off" value={pairingCode} onChange={event => setPairingCode(event.target.value)} required maxLength={32} />
|
||
{previewPending && <p role="status" className="text-sm text-muted-foreground">Checking pairing code…</p>}
|
||
{pairingPreview?.providerKind === "grok_bot" && <p className="text-sm font-medium">Allow this connection to work as {pairingPreview.agent.name} in {pairingPreview.company.name}.</p>}
|
||
{pairingPreview && <dl className="space-y-2 rounded-md border border-border p-3 text-sm">
|
||
<div><dt className="text-muted-foreground">Company</dt><dd>{pairingPreview.company.name} <span className="text-xs text-muted-foreground">({pairingPreview.company.id})</span></dd></div>
|
||
<div><dt className="text-muted-foreground">Agent</dt><dd>{pairingPreview.agent.name} <span className="text-xs text-muted-foreground">({pairingPreview.agent.id})</span></dd></div>
|
||
<div><dt className="text-muted-foreground">Permissions</dt><dd>{pairingPreview.permissions}</dd></div>
|
||
{pairingPreview.authorizingPerson && <div><dt className="text-muted-foreground">Authorized by</dt><dd>{pairingPreview.authorizingPerson}</dd></div>}
|
||
<div><dt className="text-muted-foreground">Access duration</dt><dd>{pairingPreview.accessDuration}</dd></div>
|
||
</dl>}
|
||
{previewEnabled && preview.view.kind === "error" && <QueryErrorState size="inline" error={preview.error} action="check this pairing code" onRetry={preview.view.retry} retrying={preview.view.isFetching} />}
|
||
{pairDot.error && <p role="alert" className="text-sm text-destructive">{describeError(pairDot.error, { action: "connect Dot" }).body}</p>}
|
||
<div className="flex justify-end"><Button type="submit" disabled={!pairingPreview || !PAIRING_CODE_PATTERN.test(trimmedPairingCode) || pairDot.isPending}>{pairDot.isPending ? "Connecting…" : "Allow agent connection"}</Button></div>
|
||
</form>}
|
||
{data && <>
|
||
{data.requiresSignIn ? <Button asChild><Link to={`/auth?next=${encodeURIComponent(returnPath)}`}>Sign in / Create account</Link></Button> : <>
|
||
{data.requestedCompanyId ? <div className="flex items-center gap-4 rounded-md border border-border p-4">
|
||
{company && <CompanyPatternIcon companyName={company.name} logoUrl={company.logoUrl} className="size-14 shrink-0 rounded-lg text-xl" />}
|
||
<div className="min-w-0 space-y-1">
|
||
<p className="text-xs text-muted-foreground">Organization</p>
|
||
{company ? <p className="break-words text-lg font-semibold">{company.name}</p> : <p className="text-sm text-destructive">The selected organization is no longer available to this account. Cancel and reconnect from your assistant to choose an organization you can access.</p>}
|
||
</div>
|
||
</div> : <fieldset className="space-y-2" disabled={consent.isPending}>
|
||
<legend className="mb-2 text-sm font-medium">Organization</legend>
|
||
{data.companies.map((item) => <label key={item.id} className="flex items-center gap-3 rounded-md border border-border p-3 text-sm">
|
||
<input type="radio" name="company" aria-label={item.name} value={item.id} checked={selectedCompanyId === item.id} onChange={() => setCompanyId(item.id)} />
|
||
<CompanyPatternIcon companyName={item.name} logoUrl={item.logoUrl} className="size-12 shrink-0 rounded-lg" />
|
||
<span className="min-w-0 break-words font-medium">{item.name}</span>
|
||
</label>)}
|
||
{!data.companies.length && <p className="text-sm text-muted-foreground">This account has no available organizations. Ask an organization owner to add you, then reconnect from your assistant.</p>}
|
||
</fieldset>}
|
||
<p className="text-sm">{data.agentConnection ? "Connect Dot as a Paperclip agent. Pair it with an agent after connecting; assigned work uses that agent’s permissions." : "Read all of your Paperclip data"}</p>
|
||
{(data.requestedWrite || data.requestedConfigure) && !data.agentConnection && <label htmlFor="mcp-allow-writes" className="flex items-start gap-3 text-sm leading-6">
|
||
<span className="flex h-6 shrink-0 items-center">
|
||
<Checkbox id="mcp-allow-writes" checked={canApproveWrites} disabled={!company?.canWrite || consent.isPending} onCheckedChange={(checked) => setWriteEnabled(checked === true)} />
|
||
</span>
|
||
<span>Write all of your Paperclip data</span>
|
||
</label>}
|
||
{company && !company.canWrite && <p className="text-sm text-muted-foreground">Your role in this organization is read-only.</p>}
|
||
{consent.error && <p role="alert" className="text-sm text-destructive">{describeError(consent.error).body}</p>}
|
||
<div className="flex items-center justify-between gap-3">
|
||
<Button variant="outline" disabled={consent.isPending} onClick={() => consent.mutate("deny")}>Cancel</Button>
|
||
<Button className="h-auto min-h-10 min-w-0 shrink whitespace-normal" disabled={!company || (data.agentConnection && !company.canWrite) || consent.isPending} onClick={() => consent.mutate("approve")}>{consent.isPending ? "Connecting…" : data.agentConnection ? "Connect Dot agent" : "Connect organization"}</Button>
|
||
</div>
|
||
</>}
|
||
</>}
|
||
</Card>
|
||
</div>;
|
||
}
|
||
|
||
export function AssistantConnectionsPage() {
|
||
const client = useQueryClient();
|
||
const connections = useQuery({ queryKey: ["mcp-connections"], queryFn: () => api.get<McpConnection[]>("/mcp/connections") });
|
||
const connectionsView = useQueryView(connections);
|
||
const active = connections.data?.filter(connection => !connection.revokedAt);
|
||
const revoke = useMutation({ mutationFn: (id: string) => api.delete(`/mcp/connections/${id}`), onSuccess: (_, id) => {
|
||
client.setQueryData<McpConnection[]>(["mcp-connections"], rows => rows?.filter(row => row.id !== id));
|
||
return client.invalidateQueries({ queryKey: ["mcp-connections"] });
|
||
} });
|
||
return <div className="mx-auto max-w-xl space-y-4 py-10">
|
||
<h1 className="text-xl font-semibold">Assistant connections</h1>
|
||
<p className="text-sm text-muted-foreground">Revoking a connection stops its future tool calls. Work already delegated continues under your organization’s normal controls.</p>
|
||
{(connectionsView.kind === "loading" || connectionsView.kind === "reconnecting") && <p role="status" className="text-sm text-muted-foreground">Loading connections…</p>}
|
||
{connectionsView.kind === "error" && <QueryErrorState error={connectionsView.error} action="load assistant connections" onRetry={connectionsView.retry} retrying={connectionsView.isFetching} />}
|
||
{revoke.error && <p role="alert" className="text-sm text-destructive">{describeError(revoke.error, { action: "revoke the connection" }).body}</p>}
|
||
{active?.length === 0 && <p className="text-sm">No assistant connections.</p>}
|
||
{active?.map((connection) => <Card key={connection.id} className="block space-y-2 p-4">
|
||
<h2 className="font-medium"><Identity name={assistantConnectionDisplayName(connection)} avatarUrl={connection.user?.image} initials={deriveInitials(connection.user?.name ?? "You")} /></h2>
|
||
<p className="text-sm text-muted-foreground">Organization: {connection.companyName}</p>
|
||
{connection.agent && <p className="text-sm">Works as <Link className="underline" to={`/${connection.companyPrefix ?? connection.companyId}/agents/${connection.agent.id}/runtime`}>{connection.agent.name}</Link>{connection.user ? ` · Authorized by ${connection.user.name}` : ""}</p>}
|
||
<p className="text-sm">{connection.scopes.includes("paperclip:agent") ? "Agent connection" : connection.scopes.includes("paperclip:write") ? "Read and edit work" : "Read only"}</p>
|
||
{connection.scopes.includes("paperclip:configure") && <p className="text-sm">Configure agents, projects and skills</p>}
|
||
<Button variant="outline" disabled={revoke.isPending} onClick={() => revoke.mutate(connection.id)}>Revoke connection</Button>
|
||
</Card>)}
|
||
<Link className="text-sm underline" to="/">Back to Paperclip</Link>
|
||
</div>;
|
||
}
|