mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-12 06:10:44 +01:00
## Thinking Path > - Paperclip lets people manage agent work through the board. > - The board reads task, agent, settings, plugin, and run data from the server. > - A deploy can interrupt those reads after content is already visible. > - Local error branches can replace that content with an error or show raw codes. > - This pull request moves the remaining reads to the shared recovery behavior. > - The query-error guard prevents new local error patterns from returning. ## Linked Issues or Issue Description **What happened?** Loaded lists, settings, task panels, and manual reads could clear their content or show errors during a server restart. Some reads also disabled the shared retry policy. **Expected behavior** Keep loaded content during a temporary failure. Show the shared connection banner. Retry reads after recovery. Replace content after a real access denial or missing resource, with readable copy. **Steps to reproduce** Open a task, settings page, or run log. Return 503 with `tenant_app_unavailable` from the API. Restore the API and check that content refreshes. Repeat with 403 and 404 to check the failure state. Related merged work: Refs #15754, Refs #15772, Refs #17960. This change covers remaining reads and enforcement. Browser persistence and the outage browser suite follow separately. ## What Changed - Repair an existing PostgreSQL deadline fixture at UTC boundaries. A daily cap defers a heartbeat until both its original interval and the next UTC day allow it. Keep the counted run in its seeded day and cover noon, just before midnight and the first second after midnight with explicit clocks and real PostgreSQL. Production scheduling is unchanged. - Integrate the saved list, settings, shell, task, and manual-read recovery changes against current master. Preserve the current task, Inbox, and run-log structure. - Add `useResilientFetch` for component-local reads. Preserve loaded data, cancel stale requests, and retry through the shared connectivity policy. Keep browser and pairing capabilities in memory. - Retain run log chunks across stream changes and catch up after recovery without duplicate chunks or stalled requests. - Keep genuine authorization and missing-resource failures visible. Translate known single-word codes such as `forbidden`. Show known skills and disconnected-app failures before sibling loading states. Keep Retry bound to its failed request. - Make the query-error guard enforce by default and run it in the CI policy job. Document the narrow exceptions and the read recovery contract. - Invalidate pending OAuth discovery when the operator leaves setup or its context changes. Keep reserved-popup cleanup bound to the current attempt. ## Verification - Current read head `09d1db29dea` is merge-ready: all 59 check runs are completed (54 successful, three skipped, two neutral), the legacy Snyk status is successful, and both required `ci / verify` and `ci / e2e` gates pass. Greptile Apex reviewed this exact head at 5/5 with no unresolved threads; the branch has no merge conflicts. The current CI run is `41748339602`. - Current read head `09d1db29dea` includes master `683fa4725e9`. The latest change touches only the existing server deadline test fixture. Application source remains the previously verified `86376fa751e` revision: all 60 affected skills/disconnected-app tests and both application UI typechecks passed, along with token gates and the enforcing query-error guard. Those UI suites were not repeated for this test-only repair. - The fixture repair passes all seven deadline integration cases and the complete server typecheck, including the server test layer. The old assertion deterministically fails at 23:59:06.888 UTC; its one-second-old run also fails the first-second-of-day probe. The corrected fixture passes noon and both midnight probes. The permanent three-case coverage uses seeded 2099 clocks. - Twelve new regressions fail against the previous implementation. Both skills variants and disconnected-app pages show either request's 403 or 429 while the sibling pauses or remains fetching. Permission failures stay visible. Retry stays usable for its failed request and recovers independently. An initial test-fixture query-key typo was corrected before the passing run. The finding is replied to and resolved. Greptile reviewed prior application revision `86376fa751e` at 5/5 with no new actionable findings or unresolved threads. The current test-only head has now received its own Apex 5/5 review with no unresolved threads, and its CI is successful as recorded above. - The preceding OAuth fix passed all 237 setup tests on both application branches. Its ten regressions prove that Back, Cancel, unmount, or context changes retire initial discovery without creating a connection, caching old identities, navigating an abandoned popup, or closing a newer attempt. - Earlier master integration `e992f770339` passed all 309 tests across eight affected Slack, recovery, retry, submission and task files, plus UI typecheck, token gates, enforcing query-error scan and seven guard tests. The integration preserves Slack workspace reconnect and shared recovery, readable execution errors, source-inspection company scoping, and current submission behavior. Newly inherited retained-file recovery controls keep cached data through transient failures and hide it after definitive denial. - The preceding cache head `97c0bc3966f` passed 1,038 focused cache/write/editor/account/task/API tests. All 22 built-UI outage/write/loading cases passed in 4.7 minutes on exact browser head `b7deaaee5da`, with strict checking of all three specs. The latest skills/app rendering fix is covered by its affected component suites; those broader cases were not repeated for this separate read path. - Historical broader UI, CLI and build results and unresolved aggregate server/DB/adapter failures remain in the PR discussion. Interrupted CI runs were audited and recorded separately; they are not counted as passes. Controlled local outages do not prove hosted authentication or a real Cloud restart/deploy. Real hosted acceptance remains required after merge and deployment. Commands for the latest fix: ```sh pnpm --filter @paperclipai/ui exec vitest run src/pages/CompanySkills.test.tsx src/pages/apps/AppNotConnected.test.tsx pnpm --filter @paperclipai/ui typecheck pnpm check:token-gates node scripts/check-query-error-rendering.mjs --enforce --summary ``` ## Risks This migration touches many read surfaces. The main risks are initial loading, request cancellation, retained authorization state, and run-log paging. The tests cover those states. There are no server, schema, dependency, or API contract changes. The follow-up browser suite and hosted deploy acceptance are required before release acceptance. Recovered commits retain their original authors. If squash-merging, preserve `Co-Authored-By: Bender (Fable) <bender@agents.paperclip.ing>` and the Paperclip trailer. ## Model Used OpenAI `gpt-6.1-sol` through Codex, with xhigh reasoning effort, tool use, and code execution. The context window size is not exposed. Saved source commits keep their original authorship. ## 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 described the issue in-PR following the bug report template - [x] I have not referenced internal/instance-local Paperclip issues or links - [x] My branch name describes the change and contains no internal ticket id - [x] The affected local tests pass; broader limitations are recorded above - [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 risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: devinfoley <139239+devinfoley@users.noreply.github.com> Co-authored-by: Paperclip <noreply@paperclip.ing> Co-authored-by: Bender (Fable) <bender@agents.paperclip.ing> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
190 lines
17 KiB
TypeScript
190 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";
|
||
|
||
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="font-mono">{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>;
|
||
}
|