mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-18 06:01:49 +01:00
feat(analytics): show session replay text by default, mask only customer content (#22057)
## 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>
This commit is contained in:
1 parent
84b75502c0
commit
b56f240f45
196 files changed
+1848
-677
No files matched your search
@@ -93,27 +93,40 @@ This value is used only for location, never for limits.
|
||||
|
||||
## Privacy
|
||||
|
||||
Masking is deny by default. A surface that nobody marked stays masked.
|
||||
Session replay shows text by default, the way PostHog normally works. Text is
|
||||
masked only inside marked customer content. Input values and attribute values
|
||||
are always masked.
|
||||
|
||||
- Session replay masks every input value and every text node.
|
||||
`maskReplayText` in `ui/src/lib/analytics/privacy.ts` shows text only inside
|
||||
elements with `ANALYTICS_UNMASK_PROPS`: sidebar items whose label is a fixed
|
||||
string, and a shared `Button`, `Label`, `TabsTrigger` or `EmptyState` only
|
||||
when its caller passes `analyticsChrome`. None of them opts in by default,
|
||||
because they also render customer text such as agent names and titles.
|
||||
- Session replay masks every input value (`maskAllInputs`).
|
||||
- Replay masks text only inside these markers (`ANALYTICS_MASK_TEXT_SELECTOR`
|
||||
in `ui/src/lib/analytics/privacy.ts`, passed as rrweb `maskTextSelector`):
|
||||
- `ANALYTICS_MASK_CLASS` (`ph-mask ph-sensitive`): customer content.
|
||||
- `ANALYTICS_NO_CAPTURE_CLASS` (`ph-no-capture`): secrets. Replay blocks
|
||||
these elements entirely.
|
||||
- `contenteditable` editors (not `contenteditable="false"`).
|
||||
|
||||
rrweb masks a text node only when its parent matches the selector or has an
|
||||
ancestor that matches it. All other text, for example navigation, headings,
|
||||
buttons, task titles, agent names, project names and company names, is
|
||||
recorded as it is.
|
||||
- Replay also masks attribute values (`maskReplayAttribute`): only layout
|
||||
attributes (`class`, `style`, `role`, `data-state`, SVG geometry and similar),
|
||||
rrweb metadata and stylesheet links keep their values. `title`,
|
||||
`aria-label`, `alt`, `placeholder`, `src`, `href`, `data-*` values and
|
||||
element references (`id`, `for`, `aria-labelledby`) are always masked, even on unmasked chrome, so images record as empty boxes and
|
||||
link targets (for example download links with file paths) never leave.
|
||||
- `ANALYTICS_MASK_CLASS` keeps customer content masked even inside unmasked
|
||||
chrome: rendered markdown (task bodies, comments, chat messages, documents),
|
||||
task and issue chat threads, the comment timeline, the rich editor and the
|
||||
file viewer. Text in a `contenteditable` editor is always masked.
|
||||
element references (`id`, `for`, `aria-labelledby`) are always masked, so
|
||||
images record as empty boxes and link targets (for example download links
|
||||
with file paths) never leave.
|
||||
- The masking options in `posthog.init` take precedence over the PostHog
|
||||
project's "Privacy and masking" settings (posthog-js 1.450). posthog-js
|
||||
ignores the project setting and logs a warning when the two differ. Keep the
|
||||
project masking settings empty, and change masking only in `privacy.ts`. The
|
||||
`ph-mask` class is also the posthog-js default `maskTextClass`.
|
||||
- `ANALYTICS_NO_CAPTURE_CLASS` replaces secrets with a blank box in replays:
|
||||
every password-type `Input`, environment variable values and new secret
|
||||
values.
|
||||
every password-type `Input`, environment variable values, new secret
|
||||
values, and secrets shown as text: one-time sign-in and device codes,
|
||||
pairing and setup prompts, identity confirmation links, newly issued API
|
||||
keys and gateway tokens, gateway client snippets, webhook URLs and secrets,
|
||||
invite claim secrets, raw provider frames and SSH fallback commands.
|
||||
- Every event and replay meta event goes through `scrubCapturedEvent`
|
||||
(`before_send`). Every URL keeps only its origin and path: query and hash
|
||||
values never leave, because they can hold credentials, file paths or search
|
||||
@@ -125,11 +138,72 @@ Masking is deny by default. A surface that nobody marked stays masked.
|
||||
- Autocapture never records element text or attribute values
|
||||
(`mask_all_text`, `mask_all_element_attributes`). It keeps the click, the
|
||||
element tree and the page.
|
||||
- Connected-account content (Gmail bodies, Calendar events, Slack messages
|
||||
in tasks, chat, tool results and previews) is Google user data or Slack
|
||||
data. No human may read it in a replay (Google API Limited Use). It is never
|
||||
inside the unmask allowlist, and autocapture records no element text at all.
|
||||
`ui/src/lib/analytics/unmask-allowlist.test.ts` pins the allowlist: a new
|
||||
unmask needs a reviewed entry there.
|
||||
- Connected-account content is Google user data or Slack data. No human may
|
||||
read it in a replay (privacy policy and Google API Limited Use). The
|
||||
surfaces below, and other free-form text that agents or customers write,
|
||||
carry `ANALYTICS_MASK_CLASS` on their content element (not on the chrome
|
||||
around it):
|
||||
- Rendered markdown (task bodies, comments, chat messages, documents), the
|
||||
rich editor, task and issue chat threads (messages, tool calls, tool
|
||||
results, interaction cards), the comment timeline and the file viewer.
|
||||
- Link preview cards, task quicklook descriptions, external object pills and
|
||||
rows, and related-work titles.
|
||||
- Email message cards and email send intents.
|
||||
- Connection names, connected account names, aliases and email addresses
|
||||
(Browse rows and the remove dialog, Connections, app detail headers, the
|
||||
app sidebar, connection choice lists and instructions, aggregator and
|
||||
Composio account dialogs, Tailscale networks, agent tool and audit
|
||||
tables, AI connection names, pickers, selects, account details and
|
||||
controls, pool run details, subscription and quota panels, adapter
|
||||
sign-in status, connection access and repair cards), GitHub logins
|
||||
(identity rows, bot people, chat setup, run identity history) and
|
||||
repositories, Slack workspace names (list and selected value), Slack
|
||||
account pickers, chat channels, linked user labels, the external task
|
||||
banner and chat identity pages.
|
||||
- Connection and account management surfaces are masked by section, not
|
||||
label by label: the Browse connector list, the App detail body below its
|
||||
header, the Connections table, Tailscale networks, the chat connection
|
||||
detail body and its account subtitle, GitHub chat setup, the AI
|
||||
connection pool editor and the chat identity confirmation. Every dialog,
|
||||
alert dialog, select (trigger and list), popover, dropdown, sheet and
|
||||
tooltip under `pages/apps`, `features/connections` and
|
||||
`components/ai-connections` carries its own mask, because portals escape
|
||||
the page's masked container; `replay-masking.test.tsx` fails when one
|
||||
does not.
|
||||
- App action test results (parsed preview and raw response).
|
||||
- Inbox and decision rows (subject and detail line), obligation evidence,
|
||||
Needs You notes and receipts, decision cards and compact decisions,
|
||||
decision records, and interaction cards (questions, options, answers,
|
||||
tool action requests, suggested tasks) wherever they render.
|
||||
- Approval payloads, action card input and reason, recovery card headline,
|
||||
evidence and options, run ledger retry details and interrupt handoff
|
||||
previews.
|
||||
- Run transcripts, run failure details, run events, run stdout and stderr
|
||||
excerpts (agent page and execution workspace operations), the run
|
||||
invocation command, notes, prompt, context and environment, Runner
|
||||
inspector frames, and every preformatted block that shows run output,
|
||||
tool or webhook payloads, request or response bodies, instructions,
|
||||
skills or package files.
|
||||
- Saved connection instructions for agents.
|
||||
- Document and case revision diffs.
|
||||
- Search result snippets, toasts (title and body), voice and call
|
||||
transcripts, case summaries, files and fields, attachment previews and
|
||||
artifact previews (text, tables, patches and documents).
|
||||
|
||||
Component tests render these surfaces with distinctive fixture text and
|
||||
assert, through `ui/src/lib/analytics/replay-recording.test-utils.ts`, that
|
||||
the text is rendered but not recorded (or is blocked, for secrets),
|
||||
including alternate branches, dialog portals and selected values in
|
||||
closed pickers. `ui/src/lib/analytics/replay-masking.test.tsx` also pins
|
||||
the remaining surfaces at source level. A new surface that shows
|
||||
connected-account content needs the class and a test.
|
||||
- Residual risk: text that the owner accepted as visible can still hold
|
||||
customer words. Task titles, agent names, project names, company names,
|
||||
routine names, artifact and document titles, and activity rows (which name
|
||||
the task or entity) are recorded as they are. Paperclip member names and
|
||||
email addresses on member, access and profile pages are recorded too. An
|
||||
agent can copy email or Slack text into a task title. Masking is opt-in per
|
||||
surface, so a new surface that renders connected-account content without
|
||||
the class is recorded until somebody marks it.
|
||||
- The UI never captures an event that the server already sends
|
||||
(`PAPERCLIP_EVENTS`); `product-analytics-events.test.ts` enforces this.
|
||||
@@ -0,0 +1,16 @@
|
||||
// @vitest-environment jsdom
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { afterEach, expect, it } from "vitest";
|
||||
import { AccountQuotaPanels } from "./AccountQuotaPanels";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
afterEach(() => { document.body.innerHTML = ""; });
|
||||
|
||||
it("masks the subscription account label in session replay", () => {
|
||||
document.body.innerHTML = renderToStaticMarkup(<AccountQuotaPanels accounts={[{
|
||||
provider: "anthropic", accountKey: "key", accountLabel: "fenwick.oriel@example.test", ok: true,
|
||||
windows: [{ label: "Weekly limit", usedPercent: 40, valueLabel: null, resetsAt: null, detail: null }],
|
||||
}]} />);
|
||||
expect(replayLeaks("fenwick.oriel@example.test")).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Weekly limit")).toEqual({ rendered: true, recorded: true });
|
||||
});
|
||||
@@ -2,6 +2,8 @@ import type { ProviderQuotaResult } from "@paperclipai/shared";
|
||||
import { formatDateTime } from "../lib/utils";
|
||||
import { QuotaBar } from "./QuotaBar";
|
||||
import { quotaUnavailableMessage } from "../lib/quota-refresh";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function AccountQuotaPanels({
|
||||
accounts,
|
||||
@@ -17,7 +19,7 @@ export function AccountQuotaPanels({
|
||||
className="space-y-2"
|
||||
key={account.accountKey ?? account.provider}
|
||||
>
|
||||
<p className="text-sm font-medium">
|
||||
<p className={cn("text-sm font-medium", ANALYTICS_MASK_CLASS)}>
|
||||
{account.accountLabel ?? "Subscription account"}
|
||||
</p>
|
||||
{(failed || !account.ok) && (
|
||||
|
||||
@@ -6,11 +6,13 @@ import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type React from "react";
|
||||
import {
|
||||
LocalProviderLoginInstructions,
|
||||
OnboardingLoginCard,
|
||||
OnboardingCardField,
|
||||
OnboardingLoginCodeRow,
|
||||
onboardingCardInputClass,
|
||||
} from "./AdapterLoginChrome";
|
||||
import { isBlockedFromReplay, replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
/**
|
||||
* The connect step's canvas holds one of two cards, and the credential switch
|
||||
@@ -253,3 +255,27 @@ describe("the displayed code's auto-copy", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("session replay", () => {
|
||||
const login = { preparing: false, error: null, retry: vi.fn() };
|
||||
|
||||
it("blocks the one-time login code", async () => {
|
||||
await render(<OnboardingLoginCodeRow code="QZRT-77XKV" />);
|
||||
expect(isBlockedFromReplay("QZRT-77XKV", document.body)).toBe(true);
|
||||
});
|
||||
|
||||
it("blocks the displayed device code in the provider sign-in card", async () => {
|
||||
await render(<LocalProviderLoginInstructions adapterType="codex_local" login={{ ...login, authorizationUrl: "https://auth.example.test/device", code: "MNPL-48WQD" }} />);
|
||||
expect(isBlockedFromReplay("MNPL-48WQD", document.body)).toBe(true);
|
||||
});
|
||||
|
||||
it("blocks the terminal sign-in command", async () => {
|
||||
await render(<LocalProviderLoginInstructions adapterType="grok_local" login={{ ...login, command: "grok login --token-hint vexmoor-9182" }} />);
|
||||
expect(isBlockedFromReplay("grok login --token-hint vexmoor-9182", document.body)).toBe(true);
|
||||
});
|
||||
|
||||
it("masks the signed-in account label", async () => {
|
||||
await render(<LocalProviderLoginInstructions adapterType="claude_local" login={{ ...login, status: "ready", accountLabel: "hollis.brennan@example.test" }} />);
|
||||
expect(replayLeaks("hollis.brennan@example.test", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
});
|
||||
});
|
||||
@@ -12,6 +12,8 @@ import {
|
||||
COPIED_REVEAL_DELAY_MS,
|
||||
COPIED_REVEAL_TRAVEL,
|
||||
} from "./onboarding/onboarding-motion";
|
||||
import { ANALYTICS_MASK_CLASS, ANALYTICS_NO_CAPTURE_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/**
|
||||
* Which shell a login panel draws itself in.
|
||||
@@ -293,7 +295,7 @@ export function OnboardingLoginCodeRow({
|
||||
|
||||
return (
|
||||
<div className="flex h-(--sz-44px) items-center gap-2 rounded-lg bg-muted px-4">
|
||||
<span className="min-w-0 flex-1 truncate text-sm text-foreground">
|
||||
<span className={cn("min-w-0 flex-1 truncate text-sm text-foreground", ANALYTICS_NO_CAPTURE_CLASS)}>
|
||||
{code}
|
||||
</span>
|
||||
<AnimatePresence initial={false}>
|
||||
@@ -515,7 +517,7 @@ export function LocalProviderLoginInstructions({ adapterType, login }: {
|
||||
const ready = login?.status === "ready";
|
||||
return <div className="min-w-0 max-w-full space-y-3 text-sm text-muted-foreground">
|
||||
{ready ? <>
|
||||
<p role="status" className="flex items-center gap-2 text-foreground"><Check className="size-4 shrink-0 text-(--status-task-icon-done)" />{login?.accountLabel ?? provider} is signed in. Click Connect to use this account.</p>
|
||||
<p role="status" className={cn("flex items-center gap-2 text-foreground", ANALYTICS_MASK_CLASS)}><Check className="size-4 shrink-0 text-(--status-task-icon-done)" />{login?.accountLabel ?? provider} is signed in. Click Connect to use this account.</p>
|
||||
{!showCommand && <button type="button" className="underline underline-offset-4" onClick={() => browserLogin ? login?.retry() : setShowCommand(true)}>Use a different account</button>}
|
||||
</> : !browserLogin && <p>{isolated ? `Sign in to ${provider} for this connection on the machine running Paperclip. Your existing terminal login stays separate.` : `Connect uses your local ${provider} account on the machine running Paperclip.`}</p>}
|
||||
{browserLogin && !ready && !login?.authorizationUrl && !login?.error && <p role="status">Preparing browser sign-in…</p>}
|
||||
@@ -537,7 +539,7 @@ export function LocalProviderLoginInstructions({ adapterType, login }: {
|
||||
{!browserLogin && (!ready || showCommand) && !login?.error && <>
|
||||
<p>Run this in a terminal on that machine and finish signing in in your browser. We’ll check automatically when you return.</p>
|
||||
{command && <div className="flex min-w-0 max-w-full items-start gap-2 rounded-md border bg-muted p-3 text-foreground">
|
||||
<pre className="min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-xs"><code>{command}</code></pre>
|
||||
<pre className={cn("min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-xs", ANALYTICS_NO_CAPTURE_CLASS)}><code>{command}</code></pre>
|
||||
<LoginCardCopyButton value={command} label="Copy sign-in command" />
|
||||
</div>}
|
||||
</>}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ToastProvider } from "../context/ToastContext";
|
||||
import { AgentConfigForm, AdapterLoginPanel, ModelDropdown, subtractPersistedOverlay, type AdapterLoginDescriptor } from "./AgentConfigForm";
|
||||
import { AgentLifecycleStatus, useAgentLifecycleStatus } from "./AgentLifecycleStatus";
|
||||
import { queryKeys } from "../lib/queryKeys";
|
||||
import { isBlockedFromReplay } from "@/lib/analytics/replay-recording.test-utils";
|
||||
import { defaultCreateValues } from "./agent-config-defaults";
|
||||
import { buildNewAgentHirePayload } from "../lib/new-agent-hire-payload";
|
||||
import { ApiError } from "../api/client";
|
||||
@@ -2439,6 +2440,17 @@ describe("AgentConfigForm environment selector", () => {
|
||||
expect(urlIndex).toBeGreaterThan(codeIndex);
|
||||
});
|
||||
|
||||
it("blocks the displayed login code from session replay", async () => {
|
||||
mockAgentsApi.testEnvironment.mockResolvedValue(AUTH_MISSING_RESULT);
|
||||
const result = await renderCodexSandbox();
|
||||
roots.push(result.root);
|
||||
|
||||
await runTest(result.container);
|
||||
await startLogin(result.container);
|
||||
|
||||
expect(isBlockedFromReplay("WXYZ-1234", document.body)).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps the code and URL visible after a later poll returns no prompt", async () => {
|
||||
mockAgentsApi.testEnvironment.mockResolvedValue(AUTH_MISSING_RESULT);
|
||||
// The server delivers the one-time prompt on the first owner read only. The
|
||||
|
||||
@@ -113,6 +113,7 @@ import {
|
||||
type CreateConfigValues,
|
||||
} from "@paperclipai/adapter-utils";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ANALYTICS_NO_CAPTURE_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/* ---- Props ---- */
|
||||
|
||||
@@ -3053,7 +3054,7 @@ function DisplayedCodeLoginPanel({
|
||||
<div className="text-(length:--text-micro) uppercase tracking-wide text-muted-foreground">
|
||||
1. Code
|
||||
</div>
|
||||
<span className="font-mono text-xs text-foreground break-all">{prompt.code}</span>
|
||||
<span className={cn("font-mono text-xs text-foreground break-all", ANALYTICS_NO_CAPTURE_CLASS)}>{prompt.code}</span>
|
||||
</div>
|
||||
<AdapterLoginCopyButton value={prompt.code} label="Copy code" />
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// @vitest-environment jsdom
|
||||
import { act } from "react";
|
||||
import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
||||
import { AgentSetupPrompt } from "./AgentSetupPrompt";
|
||||
import { isBlockedFromReplay } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
|
||||
|
||||
let root: Root;
|
||||
let container: HTMLDivElement;
|
||||
beforeEach(() => {
|
||||
vi.stubGlobal("matchMedia", (query: string) => ({ matches: query.includes("reduce"), media: query, addEventListener: vi.fn(), removeEventListener: vi.fn(), addListener: vi.fn(), removeListener: vi.fn() }));
|
||||
Object.defineProperty(navigator, "clipboard", { configurable: true, value: { writeText: vi.fn(async () => {}) } });
|
||||
container = document.createElement("div");
|
||||
document.body.append(container);
|
||||
root = createRoot(container);
|
||||
});
|
||||
afterEach(async () => {
|
||||
await act(async () => root.unmount());
|
||||
container.remove();
|
||||
vi.unstubAllGlobals();
|
||||
Reflect.deleteProperty(navigator, "clipboard");
|
||||
});
|
||||
|
||||
it("blocks the setup prompt preview, which carries pairing tokens, from session replay", async () => {
|
||||
const prompt = "Run: paperclipai pair --token pcp_pair_8f3kQz2LmWv";
|
||||
await act(async () => root.render(<AgentSetupPrompt prompt={prompt} />));
|
||||
await act(async () => container.querySelector<HTMLButtonElement>("button")!.click());
|
||||
expect(document.querySelector("pre[aria-label='Setup prompt']")).not.toBeNull();
|
||||
expect(isBlockedFromReplay("pcp_pair_8f3kQz2LmWv", document.body)).toBe(true);
|
||||
});
|
||||
@@ -8,6 +8,7 @@ import { usePrefersReducedMotion } from "@/hooks/usePrefersReducedMotion";
|
||||
import { copyTextToClipboard } from "@/lib/clipboard";
|
||||
import { motionMilliseconds, motionNumber } from "@/lib/onboarding-motion-tokens";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ANALYTICS_NO_CAPTURE_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export interface AgentSetupPromptProps {
|
||||
/** The complete text to preview and copy; never truncated on the clipboard. */
|
||||
@@ -244,7 +245,7 @@ export function AgentSetupPrompt({
|
||||
className="agent-setup-preview resize-none rounded-lg bg-muted/50 p-3 pt-5 font-mono text-xs leading-relaxed"
|
||||
/>
|
||||
) : (
|
||||
<pre tabIndex={0} aria-label="Setup prompt" className="agent-setup-preview m-0 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border/60 bg-muted/50 p-3 pt-5 font-mono text-xs leading-relaxed text-muted-foreground">{prompt}</pre>
|
||||
<pre tabIndex={0} aria-label="Setup prompt" className={cn("agent-setup-preview m-0 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border/60 bg-muted/50 p-3 pt-5 font-mono text-xs leading-relaxed text-muted-foreground", ANALYTICS_NO_CAPTURE_CLASS)}>{prompt}</pre>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ import {
|
||||
type AppGalleryDisplayEntry,
|
||||
} from "@/pages/apps/app-definition-display";
|
||||
import { SidebarNavItem } from "./SidebarNavItem";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type AppDetailSidebarProps =
|
||||
| { kind: "connection"; connectionId: string }
|
||||
@@ -103,7 +105,7 @@ export function AppDetailSidebar(props: AppDetailSidebarProps) {
|
||||
darkLogoUrl={appDefinitionDarkLogoUrl(logoEntry)}
|
||||
size={28}
|
||||
/>
|
||||
<span className="flex-1 truncate text-sm font-bold text-foreground">{appName}</span>
|
||||
<span className={cn("flex-1 truncate text-sm font-bold text-foreground", ANALYTICS_MASK_CLASS)}>{appName}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { UserPlus, Lightbulb, ShieldAlert, ShieldCheck } from "lucide-react";
|
||||
import { MarkdownBody } from "./MarkdownBody";
|
||||
import { formatCents } from "../lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export const typeLabel: Record<string, string> = {
|
||||
hire_agent: "Hire Agent",
|
||||
@@ -51,7 +53,7 @@ function PayloadField({ label, value }: { label: string; value: unknown }) {
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-muted-foreground w-20 sm:w-24 shrink-0 text-xs">{label}</span>
|
||||
<span>{String(value)}</span>
|
||||
<span className={ANALYTICS_MASK_CLASS}>{String(value)}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -116,12 +118,12 @@ export function CeoStrategyPayload({ payload }: { payload: Record<string, unknow
|
||||
<div className="mt-3 space-y-1.5 text-sm">
|
||||
<PayloadField label="Title" value={payload.title} />
|
||||
{!!plan && (
|
||||
<div className="mt-2 rounded-md bg-muted/40 px-3 py-2 text-sm text-muted-foreground whitespace-pre-wrap font-mono text-xs max-h-48 overflow-y-auto">
|
||||
<div className={cn("mt-2 rounded-md bg-muted/40 px-3 py-2 text-sm text-muted-foreground whitespace-pre-wrap font-mono text-xs max-h-48 overflow-y-auto", ANALYTICS_MASK_CLASS)}>
|
||||
{String(plan)}
|
||||
</div>
|
||||
)}
|
||||
{!plan && (
|
||||
<pre className="mt-2 rounded-md bg-muted/40 px-3 py-2 text-xs text-muted-foreground overflow-x-auto max-h-48">
|
||||
<pre className={cn("mt-2 rounded-md bg-muted/40 px-3 py-2 text-xs text-muted-foreground overflow-x-auto max-h-48", ANALYTICS_MASK_CLASS)}>
|
||||
{JSON.stringify(payload, null, 2)}
|
||||
</pre>
|
||||
)}
|
||||
@@ -143,7 +145,7 @@ export function BudgetOverridePayload({ payload }: { payload: Record<string, unk
|
||||
</div>
|
||||
) : null}
|
||||
{!!payload.guidance && (
|
||||
<p className="text-muted-foreground">{String(payload.guidance)}</p>
|
||||
<p className={cn("text-muted-foreground", ANALYTICS_MASK_CLASS)}>{String(payload.guidance)}</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
@@ -229,7 +231,7 @@ function BoardApprovalPayloadContent({ payload }: { payload: Record<string, unkn
|
||||
<p className="text-(length:--text-micro) font-medium uppercase tracking-(--tracking-label) text-muted-foreground">
|
||||
Proposed comment
|
||||
</p>
|
||||
<pre className="max-h-48 overflow-auto rounded-lg border border-border/60 bg-muted/50 px-3.5 py-3 font-mono text-xs leading-5 text-muted-foreground whitespace-pre-wrap">
|
||||
<pre className={cn("max-h-48 overflow-auto rounded-lg border border-border/60 bg-muted/50 px-3.5 py-3 font-mono text-xs leading-5 text-muted-foreground whitespace-pre-wrap", ANALYTICS_MASK_CLASS)}>
|
||||
{proposedComment}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -66,8 +66,8 @@ export function AppsSidebar() {
|
||||
Connectors
|
||||
</div>
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<SidebarNavItem analyticsChrome to="/apps" label="Browse" icon={Store} end />
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem to="/apps" label="Browse" icon={Store} end />
|
||||
<SidebarNavItem
|
||||
to="/apps/review"
|
||||
label="Review"
|
||||
icon={ShieldQuestion}
|
||||
@@ -83,7 +83,7 @@ export function AppsSidebar() {
|
||||
Advanced setup for developers. Most teams never open this.
|
||||
</p>
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<SidebarNavItem analyticsChrome to="/apps/connections" label="Connections" icon={AppWindow} end />
|
||||
<SidebarNavItem to="/apps/connections" label="Connections" icon={AppWindow} end />
|
||||
{developerTabs.map((tab) => (
|
||||
<SidebarNavItem
|
||||
key={tab.key}
|
||||
|
||||
@@ -38,8 +38,8 @@ export function AppsSidebar() {
|
||||
className={contextualSidebarStyles.nav}
|
||||
>
|
||||
<div data-slot="contextual-sidebar-group" className={contextualSidebarStyles.group}>
|
||||
<SidebarNavItem analyticsChrome to="/apps" label="Browse" icon={Store} end />
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem to="/apps" label="Browse" icon={Store} end />
|
||||
<SidebarNavItem
|
||||
to="/apps/review"
|
||||
label="Review"
|
||||
icon={ShieldQuestion}
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { AttentionItem } from "@paperclipai/shared";
|
||||
import { Link } from "@/lib/router";
|
||||
import { attentionEvidenceLabel, attentionEvidenceText } from "@/lib/attention-obligations";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/**
|
||||
* The rest of one obligation, folded into its lead card (PAP-749 plan §2,
|
||||
@@ -28,7 +29,7 @@ export function AttentionObligationEvidence({
|
||||
{evidence.map((entry) => {
|
||||
const { title, detail } = attentionEvidenceText(entry);
|
||||
return (
|
||||
<li key={entry.id} data-attention-evidence={entry.id} data-attention-evidence-source={entry.sourceKind}>
|
||||
<li className={ANALYTICS_MASK_CLASS} key={entry.id} data-attention-evidence={entry.id} data-attention-evidence-source={entry.sourceKind}>
|
||||
<span className="font-medium text-foreground">{attentionEvidenceLabel(item, entry)}: </span>
|
||||
{entry.subject.href ? (
|
||||
<Link to={entry.subject.href} className="inline-flex items-center gap-1 hover:text-foreground">
|
||||
|
||||
@@ -51,6 +51,7 @@ import { DecisionResolver } from "./DecisionResolver";
|
||||
import { StalledReviewActions } from "./StalledReviewActions";
|
||||
import { readIssueReviewPolicyMetadata } from "../lib/review-policy";
|
||||
import { attentionOtherAudienceUserId } from "../lib/attention-close";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
// Decision-action buttons: a comfortable tap target when the row is narrow
|
||||
// (h-9 / text-sm), shrinking back to the dense pill (h-6 / text-xs) once the
|
||||
@@ -334,10 +335,10 @@ export const AttentionQueueRow = memo(function AttentionQueueRow({
|
||||
}
|
||||
: {})}
|
||||
>
|
||||
<span className="line-clamp-2 text-sm font-medium text-foreground" title={item.subject.title ?? undefined}>
|
||||
<span className={cn("line-clamp-2 text-sm font-medium text-foreground", ANALYTICS_MASK_CLASS)} title={item.subject.title ?? undefined}>
|
||||
{item.subject.title ?? meta.label}
|
||||
</span>
|
||||
<p className="mt-0.5 line-clamp-2 text-xs text-muted-foreground">{detailLine}</p>
|
||||
<p className={cn("mt-0.5 line-clamp-2 text-xs text-muted-foreground", ANALYTICS_MASK_CLASS)}>{detailLine}</p>
|
||||
</div>
|
||||
|
||||
{/* Why this card is here (PAP-749 plan §1, Rule 4): "Why me?", "For
|
||||
|
||||
@@ -6,6 +6,7 @@ import { IssueReferencePill } from "@/components/IssueReferencePill";
|
||||
import { Link, useCaseHref } from "@/lib/router";
|
||||
import { copyTextToClipboard } from "@/lib/clipboard";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// CaseFieldsPanel (PAP-12968 §3) — the generic key-value renderer for a case's
|
||||
@@ -223,7 +224,7 @@ export function CaseFieldValue({
|
||||
);
|
||||
}
|
||||
return (
|
||||
<pre className="max-w-full whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground">
|
||||
<pre className={cn("max-w-full whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{JSON.stringify(value, null, 2)}
|
||||
</pre>
|
||||
);
|
||||
@@ -330,7 +331,7 @@ export function CaseFieldsTable({ fields }: { fields: Record<string, unknown> })
|
||||
return <p className="text-sm text-muted-foreground">No fields set</p>;
|
||||
}
|
||||
return (
|
||||
<table aria-label="Case fields" className="w-full table-fixed border-collapse font-mono text-xs leading-5">
|
||||
<table aria-label="Case fields" className={cn("w-full table-fixed border-collapse font-mono text-xs leading-5", ANALYTICS_MASK_CLASS)}>
|
||||
<tbody>
|
||||
{rows.map(({ id, path, value }) => (
|
||||
<tr key={id} className="even:bg-muted/50">
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { AnchorHTMLAttributes } from "react";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { CaseDocumentRevisions } from "@/api/cases";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
import { CaseRevisionRail } from "./CaseRevisionRail";
|
||||
|
||||
function act(callback: () => void) {
|
||||
@@ -122,4 +123,18 @@ describe("CaseRevisionRail", () => {
|
||||
expect(container.querySelector('[data-testid="md"]')?.textContent).toBe("# First version");
|
||||
act(() => root.unmount());
|
||||
});
|
||||
|
||||
it("keeps revision diff lines out of session replay", async () => {
|
||||
mockCasesApi.listRevisions.mockResolvedValue(revisions);
|
||||
const root = await render();
|
||||
const compare = Array.from(container.querySelectorAll("button")).find((b) => /compare|diff/i.test(b.textContent ?? "") || /compare|diff/i.test(b.getAttribute("aria-label") ?? ""));
|
||||
expect(compare).toBeTruthy();
|
||||
act(() => compare!.dispatchEvent(new MouseEvent("click", { bubbles: true })));
|
||||
await flush();
|
||||
const dialog = document.querySelector('[role="dialog"]');
|
||||
expect(dialog).not.toBeNull();
|
||||
expect(replayLeaks("Second version", dialog!)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("First version", dialog!)).toEqual({ rendered: true, recorded: false });
|
||||
act(() => root.unmount());
|
||||
});
|
||||
});
|
||||
@@ -14,6 +14,7 @@ import { MarkdownBody } from "@/components/MarkdownBody";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { cn, relativeTime } from "@/lib/utils";
|
||||
import { Diff } from "lucide-react";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/** Author + via-issue attribution line for a revision. */
|
||||
function RevisionByline({ revision }: { revision: CaseDocumentRevision }) {
|
||||
@@ -150,7 +151,7 @@ function CaseDocumentDiffModal({
|
||||
<span className="select-none px-3 text-center text-muted-foreground">
|
||||
{markerByKind[row.kind]}
|
||||
</span>
|
||||
<pre className="overflow-x-auto whitespace-pre-wrap break-words px-3 py-0 text-inherit">
|
||||
<pre className={cn("overflow-x-auto whitespace-pre-wrap break-words px-3 py-0 text-inherit", ANALYTICS_MASK_CLASS)}>
|
||||
{row.text.length > 0 ? row.text : " "}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -100,9 +100,9 @@ export function CompanySettingsSidebar() {
|
||||
|
||||
<nav className="flex-1 min-h-0 overflow-y-auto scrollbar-auto-hide px-3 py-2">
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<SidebarNavItem analyticsChrome to="/company/settings" label="General" icon={SlidersHorizontal} end />
|
||||
<SidebarNavItem to="/company/settings" label="General" icon={SlidersHorizontal} end />
|
||||
{showPage("instance.profile") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/profile`}
|
||||
label="Profile"
|
||||
icon={UserRoundPen}
|
||||
@@ -110,7 +110,7 @@ export function CompanySettingsSidebar() {
|
||||
/>
|
||||
)}
|
||||
{showPage("company.members") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to="/company/settings/members"
|
||||
label="Members"
|
||||
icon={Users}
|
||||
@@ -130,22 +130,22 @@ export function CompanySettingsSidebar() {
|
||||
/>
|
||||
))}
|
||||
{showPage("company.invites") && (
|
||||
<SidebarNavItem analyticsChrome to="/company/settings/invites" label="Invites" icon={MailPlus} end />
|
||||
<SidebarNavItem to="/company/settings/invites" label="Invites" icon={MailPlus} end />
|
||||
)}
|
||||
{showPage("company.secrets") && (
|
||||
<SidebarNavItem analyticsChrome to="/company/settings/secrets" label="Secrets" icon={KeyRound} end />
|
||||
<SidebarNavItem to="/company/settings/secrets" label="Secrets" icon={KeyRound} end />
|
||||
)}
|
||||
{showPage("instance.environments") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/environments`}
|
||||
label="Environments"
|
||||
icon={MonitorCog}
|
||||
end
|
||||
/>
|
||||
)}
|
||||
<SidebarNavItem analyticsChrome to="/company/settings/connections" label="Connections" icon={Link2} end />
|
||||
<SidebarNavItem to="/company/settings/connections" label="Connections" icon={Link2} end />
|
||||
{showPage("instance.access") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/access`}
|
||||
label="Access"
|
||||
icon={Shield}
|
||||
@@ -153,7 +153,7 @@ export function CompanySettingsSidebar() {
|
||||
/>
|
||||
)}
|
||||
{showPage("instance.heartbeats") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/heartbeats`}
|
||||
label="Heartbeats"
|
||||
icon={Clock3}
|
||||
@@ -161,20 +161,20 @@ export function CompanySettingsSidebar() {
|
||||
/>
|
||||
)}
|
||||
{showPage("company.export") && (
|
||||
<SidebarNavItem analyticsChrome to="/company/export" label="Export" icon={Download} />
|
||||
<SidebarNavItem to="/company/export" label="Export" icon={Download} />
|
||||
)}
|
||||
{!isCloud && showPage("company.import") && (
|
||||
<SidebarNavItem analyticsChrome to="/company/import" label="Import" icon={Upload} end />
|
||||
<SidebarNavItem to="/company/import" label="Import" icon={Upload} end />
|
||||
)}
|
||||
{showPage("instance.experimental") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/experimental`}
|
||||
label="Experimental"
|
||||
icon={FlaskConical}
|
||||
/>
|
||||
)}
|
||||
{showPlugins && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/plugins`}
|
||||
label="Plugins"
|
||||
icon={Puzzle}
|
||||
@@ -202,7 +202,7 @@ export function CompanySettingsSidebar() {
|
||||
</div>
|
||||
) : null}
|
||||
{showPage("instance.adapters") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/adapters`}
|
||||
label="Adapters"
|
||||
icon={Cpu}
|
||||
|
||||
@@ -93,7 +93,7 @@ export function CompanySettingsSidebar() {
|
||||
className="flex h-(--sz-60px) shrink-0 items-center px-3"
|
||||
>
|
||||
<div data-slot="settings-back-group" className={`${primarySidebarStyles.group} w-full`}>
|
||||
<SidebarNavItem analyticsChrome to="/dashboard" label="Back to app" icon={ArrowLeft} />
|
||||
<SidebarNavItem to="/dashboard" label="Back to app" icon={ArrowLeft} />
|
||||
</div>
|
||||
</div>
|
||||
<nav
|
||||
@@ -102,9 +102,9 @@ export function CompanySettingsSidebar() {
|
||||
className={primarySidebarStyles.nav}
|
||||
>
|
||||
<div data-slot="contextual-sidebar-group" className={primarySidebarStyles.group}>
|
||||
<SidebarNavItem analyticsChrome to="/company/settings" label="General" icon={SlidersHorizontal} end />
|
||||
<SidebarNavItem to="/company/settings" label="General" icon={SlidersHorizontal} end />
|
||||
{showPage("instance.profile") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/profile`}
|
||||
label="Profile"
|
||||
icon={UserRoundPen}
|
||||
@@ -112,7 +112,7 @@ export function CompanySettingsSidebar() {
|
||||
/>
|
||||
)}
|
||||
{showPage("company.members") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to="/company/settings/members"
|
||||
label="Members"
|
||||
icon={Users}
|
||||
@@ -132,19 +132,19 @@ export function CompanySettingsSidebar() {
|
||||
/>
|
||||
))}
|
||||
{showPage("company.secrets") && (
|
||||
<SidebarNavItem analyticsChrome to="/company/settings/secrets" label="Secrets" icon={KeyRound} end />
|
||||
<SidebarNavItem to="/company/settings/secrets" label="Secrets" icon={KeyRound} end />
|
||||
)}
|
||||
{showPage("instance.environments") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/environments`}
|
||||
label="Environments"
|
||||
icon={MonitorCog}
|
||||
end
|
||||
/>
|
||||
)}
|
||||
<SidebarNavItem analyticsChrome to="/company/settings/connections" label="Connections" icon={Link2} end />
|
||||
<SidebarNavItem to="/company/settings/connections" label="Connections" icon={Link2} end />
|
||||
{showPage("instance.access") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/access`}
|
||||
label="Access"
|
||||
icon={Shield}
|
||||
@@ -152,20 +152,20 @@ export function CompanySettingsSidebar() {
|
||||
/>
|
||||
)}
|
||||
{showPage("company.export") && (
|
||||
<SidebarNavItem analyticsChrome to="/company/export" label="Export" icon={Download} />
|
||||
<SidebarNavItem to="/company/export" label="Export" icon={Download} />
|
||||
)}
|
||||
{!isCloud && showPage("company.import") && (
|
||||
<SidebarNavItem analyticsChrome to="/company/import" label="Import" icon={Upload} end />
|
||||
<SidebarNavItem to="/company/import" label="Import" icon={Upload} end />
|
||||
)}
|
||||
{showPage("instance.experimental") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/experimental`}
|
||||
label="Experimental"
|
||||
icon={FlaskConical}
|
||||
/>
|
||||
)}
|
||||
{showPlugins && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/plugins`}
|
||||
label="Plugins"
|
||||
icon={Puzzle}
|
||||
@@ -193,7 +193,7 @@ export function CompanySettingsSidebar() {
|
||||
</div>
|
||||
) : null}
|
||||
{showPage("instance.adapters") && (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={`${INSTANCE_SETTINGS_PATH_PREFIX}/adapters`}
|
||||
label="Adapters"
|
||||
icon={Cpu}
|
||||
|
||||
@@ -167,13 +167,13 @@ export function CoordinatorSidebar({ children }: { children?: ReactNode }) {
|
||||
<div className="design-sidebar-primary">
|
||||
{rail ? <Tooltip><TooltipTrigger asChild>{newTaskButton}</TooltipTrigger><TooltipContent side="right">New task</TooltipContent></Tooltip> : newTaskButton}
|
||||
<div className="design-sidebar-primary my-2">
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to="/chats" label="Chat" icon={MessageCircle} badge={unreadChatCount} badgeLabel="unread chats" />
|
||||
<SidebarNavItem className="design-sidebar-item" to="/chats" label="Chat" icon={MessageCircle} badge={unreadChatCount} badgeLabel="unread chats" />
|
||||
<div className="group/coordinator-new relative">
|
||||
<SidebarNavItem analyticsChrome to="/issues" label="Tasks" icon={CircleCheck} className={cn("design-sidebar-item", !rail && "pr-9")} />
|
||||
<SidebarNavItem to="/issues" label="Tasks" icon={CircleCheck} className={cn("design-sidebar-item", !rail && "pr-9")} />
|
||||
{!rail && <button type="button" aria-label="New task" title="New task" onClick={() => openNewIssue()}
|
||||
className="absolute right-3 top-1/2 -translate-y-1/2 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity group-hover/coordinator-new:opacity-100 group-focus-within/coordinator-new:opacity-100 pointer-coarse:opacity-100 hover:bg-sidebar-accent focus-visible:ring-2 focus-visible:ring-ring"><Plus className="size-4" /></button>}
|
||||
</div>
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to="/decisions" label="Inbox" icon={Inbox} badge={attentionCount} badgeLabel="decisions" />
|
||||
<SidebarNavItem className="design-sidebar-item" to="/decisions" label="Inbox" icon={Inbox} badge={attentionCount} badgeLabel="decisions" />
|
||||
{orderedPins.length > 0 && <PinnedNavigationList key={`${companyId}:${userId}`} items={orderedPins} rail={rail} onReorder={pinnedNavigation.reorder} onUnpin={pinnedNavigation.toggle} />}
|
||||
</div>
|
||||
<Flyout open={moreOpen} onOpenChange={setMoreOpen}>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { DecisionCard, type DecisionIssueRef } from "./DecisionCard";
|
||||
import type { Decision, DecisionEffectExecution } from "../api/decisions";
|
||||
import { ThemeProvider } from "../context/ThemeContext";
|
||||
import { TooltipProvider } from "./ui/tooltip";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
let container: HTMLDivElement | null = null;
|
||||
let root: Root | null = null;
|
||||
@@ -319,3 +320,15 @@ describe("DecisionCard", () => {
|
||||
expect(expired.textContent).not.toContain("expiry deadline");
|
||||
});
|
||||
});
|
||||
|
||||
describe("DecisionCard session replay", () => {
|
||||
it("keeps agent-written option labels, descriptions and field labels out of session replay", () => {
|
||||
const el = render({ decision: mkDecision({
|
||||
options: [{ id: "reply", label: "Reply to Globex renewal", description: "Draft answer to jane@globex.com", effects: [{ type: "comment_on_issue", targetIssueId: "issue-target", staleness: "lenient", bodyMarkdown: "nudge" }] }],
|
||||
inputs: [{ id: "note", label: "Note for jane@globex.com", type: "text" }] as unknown as Decision["inputs"],
|
||||
}) });
|
||||
expect(replayLeaks("Reply to Globex renewal", el)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Draft answer to jane@globex.com", el)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Note for jane@globex.com", el)).toEqual({ rendered: true, recorded: false });
|
||||
});
|
||||
});
|
||||
@@ -22,6 +22,7 @@ import { Button } from "./ui/button";
|
||||
import { Input } from "./ui/input";
|
||||
import { Textarea } from "./ui/textarea";
|
||||
import { MarkdownBody } from "./MarkdownBody";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/**
|
||||
* Presentational card for a single Decisions-v1 decision (PAP-14966 / PAP-14939
|
||||
@@ -325,6 +326,7 @@ export function DecisionCard({
|
||||
SHELL[tone],
|
||||
dimmed && "opacity-80",
|
||||
className,
|
||||
ANALYTICS_MASK_CLASS,
|
||||
)}
|
||||
data-decision-state={badgeLabel.toLowerCase()}
|
||||
>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { flushSync } from "react-dom";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { DecisionOutcome } from "../api/decisions";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
const state = vi.hoisted(() => ({ issueStatus: "todo", queriedIssueIds: [] as string[] }));
|
||||
|
||||
@@ -20,7 +21,7 @@ vi.mock("@tanstack/react-query", async (importOriginal) => ({
|
||||
originIssueId: "origin-1",
|
||||
status: "open",
|
||||
targetSnapshots: { "target-1": { updatedAt: "2026-07-31T00:00:00.000Z" } },
|
||||
options: [{ id: "yes", label: "Yes", effects: [
|
||||
options: [{ id: "yes", label: "Yes", description: "Send the Globex renewal reply", effects: [
|
||||
{
|
||||
type: "create_issue",
|
||||
targetIssueId: "target-1",
|
||||
@@ -123,4 +124,13 @@ describe("DecisionResolver", () => {
|
||||
|
||||
flushSync(() => root.unmount());
|
||||
});
|
||||
|
||||
it("keeps the compact view's option text out of session replay", () => {
|
||||
const root = createRoot(container);
|
||||
flushSync(() => root.render(<DecisionResolver companyId="company-1" decisionId="decision-1" leading={<span>Lead</span>} />));
|
||||
expect(container.querySelector('[data-testid="decision-status"]')).toBeNull();
|
||||
expect(replayLeaks("Yes", container).recorded).toBe(false);
|
||||
expect(replayLeaks("Yes", container).rendered).toBe(true);
|
||||
flushSync(() => root.unmount());
|
||||
});
|
||||
});
|
||||
@@ -13,6 +13,7 @@ import { MarkdownBody } from "./MarkdownBody";
|
||||
import { NeedsYouPanel, NeedsYouPanelNote } from "./coordinator/NeedsYouCardKit";
|
||||
import { Button } from "./ui/button";
|
||||
import { Textarea } from "./ui/textarea";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
interface DecisionResolverProps {
|
||||
companyId: string;
|
||||
@@ -91,7 +92,7 @@ function CompactDecision({ decision, resolveIssue, targetChanged, busy, errorMes
|
||||
.some((effect) => effect.staleness === "strict" && decisionEffectTargetIssueIds(effect).some((target) => stale.has(target))) ?? false;
|
||||
const body = decision.body?.trim();
|
||||
return (
|
||||
<div className="space-y-4" data-decision-state="pending">
|
||||
<div className={cn("space-y-4", ANALYTICS_MASK_CLASS)} data-decision-state="pending">
|
||||
<div className="space-y-3">
|
||||
<h2 data-decision-prompt className="text-base font-medium">{decision.title}</h2>
|
||||
{body ? <div className="text-sm text-muted-foreground"><MarkdownBody className="paperclip-markdown-on-accent">{body}</MarkdownBody></div> : null}
|
||||
|
||||
@@ -30,20 +30,20 @@ export function DesignSidebar({ onNewTask, recentTasks = [] }: { onNewTask: () =
|
||||
<nav className="design-sidebar-navigation" aria-label="Main navigation">
|
||||
<div className="design-sidebar-primary">
|
||||
<Button variant="ghost" className="design-sidebar-new-task" onClick={onNewTask}><CirclePlus aria-hidden />New Task</Button>
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/dashboard`} label="Dashboard" icon={LayoutDashboard} />
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/chats`} label="Chat" icon={MessageCircle} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/dashboard`} label="Dashboard" icon={LayoutDashboard} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/chats`} label="Chat" icon={MessageCircle} />
|
||||
</div>
|
||||
<SidebarSection label="Work">
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/issues`} label="Tasks" icon={CircleCheck} />
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/projects`} label="Projects" icon={FolderOpen} />
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/routines`} label="Routines" icon={Repeat} />
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/artifacts`} label="Artifacts" icon={Package} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/issues`} label="Tasks" icon={CircleCheck} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/projects`} label="Projects" icon={FolderOpen} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/routines`} label="Routines" icon={Repeat} />
|
||||
<SidebarNavItem className="design-sidebar-item" to={`${root}/artifacts`} label="Artifacts" icon={Package} />
|
||||
</SidebarSection>
|
||||
<SidebarSection label="Org">
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/agents`} label="Agents" icon={Users} />
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/skills`} label="Skills" icon={Boxes} />
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/apps`} label="Connectors" icon={Unplug} />
|
||||
<SidebarNavItem analyticsChrome className="design-sidebar-item" to={`${root}/activity`} label="Audit" icon={History} />
|
||||
<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}/activity`} label="Audit" icon={History} />
|
||||
</SidebarSection>
|
||||
{companyRecentTasks.length > 0 ? <div className="design-sidebar-recents">
|
||||
<SidebarSection label="Recent Tasks">
|
||||
|
||||
@@ -20,6 +20,8 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function getRevisionLabel(revision: DocumentRevision) {
|
||||
const actor = revision.createdByUserId
|
||||
@@ -168,7 +170,7 @@ export function DocumentDiffModal({
|
||||
<span className="select-none px-3 text-center text-muted-foreground">
|
||||
{markerByKind[row.kind]}
|
||||
</span>
|
||||
<pre className="overflow-x-auto whitespace-pre-wrap break-words px-3 py-0 text-inherit">
|
||||
<pre className={cn("overflow-x-auto whitespace-pre-wrap break-words px-3 py-0 text-inherit", ANALYTICS_MASK_CLASS)}>
|
||||
{row.text.length > 0 ? row.text : " "}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,8 @@ import type {
|
||||
} from "@paperclipai/shared";
|
||||
import { useEmailThread } from "@/hooks/useEmailThread";
|
||||
import { issuesApi } from "@/api/issues";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
const EmailContext = createContext<EmailThreadSummary | null>(null);
|
||||
export function EmailThreadProvider({
|
||||
companyId,
|
||||
@@ -59,7 +61,7 @@ export function EmailMessageCard({
|
||||
aria-label={
|
||||
message.direction === "inbound" ? "Email received" : "Email sent"
|
||||
}
|
||||
className={contextNotice ? "task-context-notice space-y-3" : "space-y-4 rounded-xl border border-border bg-card p-5"}
|
||||
className={cn(contextNotice ? "task-context-notice space-y-3" : "space-y-4 rounded-xl border border-border bg-card p-5", ANALYTICS_MASK_CLASS)}
|
||||
>
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<span className="flex items-center gap-2 text-sm font-semibold">
|
||||
|
||||
@@ -8,6 +8,8 @@ import { Input } from "@/components/ui/input";
|
||||
import { describeError } from "@/api/errors";
|
||||
import { QueryErrorState, useQueryView } from "./QueryView";
|
||||
import type { EmailPublicationSummary } from "@paperclipai/shared";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
// Email actions belong to the agent's task conversation. Only surface mail
|
||||
// without a task comment yet and delivery outcomes that need attention here.
|
||||
@@ -93,7 +95,7 @@ function EmailDelivery({
|
||||
{p.request && !p.providerMessageId && (
|
||||
<article
|
||||
aria-label="Email send intent"
|
||||
className="task-context-notice space-y-3"
|
||||
className={cn("task-context-notice space-y-3", ANALYTICS_MASK_CLASS)}
|
||||
>
|
||||
<p className="font-semibold">{p.request.subject ?? "Email reply"}</p>
|
||||
{p.request.to && <p>To: {p.request.to.join(", ")}</p>}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Plus } from "lucide-react";
|
||||
import type { LucideIcon } from "lucide-react";
|
||||
import type { ReactNode } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ANALYTICS_UNMASK_PROPS } from "@/lib/analytics/privacy";
|
||||
|
||||
interface EmptyStateProps {
|
||||
icon: LucideIcon;
|
||||
@@ -17,8 +16,6 @@ interface EmptyStateProps {
|
||||
onAction?: () => void;
|
||||
/** Hide the leading "+" glyph on the action button (e.g. for a "Set up" CTA). */
|
||||
hideActionIcon?: boolean;
|
||||
/** The text is fixed product copy, so session replay may show it. */
|
||||
analyticsChrome?: boolean;
|
||||
}
|
||||
|
||||
export function EmptyState({
|
||||
@@ -30,10 +27,9 @@ export function EmptyState({
|
||||
action,
|
||||
onAction,
|
||||
hideActionIcon = false,
|
||||
analyticsChrome = false,
|
||||
}: EmptyStateProps) {
|
||||
return (
|
||||
<div {...(analyticsChrome ? ANALYTICS_UNMASK_PROPS : {})} className={graphic ? "empty-state-artwork flex flex-col items-center justify-center gap-5 py-16 text-center" : "flex flex-col items-center justify-center py-16 text-center"}>
|
||||
<div className={graphic ? "empty-state-artwork flex flex-col items-center justify-center gap-5 py-16 text-center" : "flex flex-col items-center justify-center py-16 text-center"}>
|
||||
{graphic ? <div className="empty-state-graphic" aria-hidden="true">{graphic}</div> : <div className="bg-muted/50 p-4 mb-4">
|
||||
<Icon className="h-10 w-10 text-muted-foreground/50" />
|
||||
</div>}
|
||||
|
||||
@@ -17,6 +17,8 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "./ui/dialog";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type ExecutionWorkspaceCloseDialogProps = {
|
||||
workspaceId: string;
|
||||
@@ -268,7 +270,7 @@ export function ExecutionWorkspaceCloseDialog({
|
||||
<div className="font-medium">{action.label}</div>
|
||||
<div className="mt-1 break-words text-muted-foreground">{action.description}</div>
|
||||
{action.command ? (
|
||||
<pre className="mt-2 whitespace-pre-wrap break-all rounded-lg bg-background px-3 py-2 font-mono text-xs text-foreground">
|
||||
<pre className={cn("mt-2 whitespace-pre-wrap break-all rounded-lg bg-background px-3 py-2 font-mono text-xs text-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{action.command}
|
||||
</pre>
|
||||
) : null}
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
externalObjectTypeLabel,
|
||||
} from "../lib/external-objects";
|
||||
import { cn } from "../lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export interface ExternalObjectPillData {
|
||||
providerKey: string | null;
|
||||
@@ -153,7 +154,7 @@ export function ExternalObjectPill({
|
||||
sizeClassName="h-3 w-3"
|
||||
label={`${providerLabel}: ${statusLabel}`}
|
||||
/>
|
||||
<span className="max-w-(--sz-16rem) truncate font-medium">{valueLabel}</span>
|
||||
<span className={cn("max-w-(--sz-16rem) truncate font-medium", ANALYTICS_MASK_CLASS)}>{valueLabel}</span>
|
||||
</>
|
||||
);
|
||||
const countSuffix = typeof sourceCount === "number" && sourceCount > 1 ? (
|
||||
@@ -164,7 +165,7 @@ export function ExternalObjectPill({
|
||||
{showProviderIcon && ProviderIcon ? (
|
||||
<ProviderIcon aria-hidden="true" className="h-3 w-3 shrink-0" />
|
||||
) : null}
|
||||
<span className="inline-flex min-w-0 items-center gap-1">
|
||||
<span className={cn("inline-flex min-w-0 items-center gap-1", ANALYTICS_MASK_CLASS)}>
|
||||
{labelText}
|
||||
</span>
|
||||
{countSuffix}
|
||||
|
||||
@@ -356,7 +356,7 @@ export function FileContentViewer({ content, highlightedLine, onLoaded, previewM
|
||||
tabIndex={0}
|
||||
className={cn("paperclip-file-viewer-code min-w-0 flex-1 overflow-auto bg-(--code-bg-resolved) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset", ANALYTICS_MASK_CLASS)}
|
||||
>
|
||||
<pre className="m-0 font-mono text-xs leading-5">
|
||||
<pre className={cn("m-0 font-mono text-xs leading-5", ANALYTICS_MASK_CLASS)}>
|
||||
{lines.map((lineText, index) => {
|
||||
const lineNumber = index + 1;
|
||||
const isHighlighted = lineNumber === highlightedLine;
|
||||
|
||||
@@ -5,6 +5,8 @@ import { agentsApi } from "../api/agents";
|
||||
import { describeError } from "../api/errors";
|
||||
import { Button } from "./ui/button";
|
||||
import { QueryErrorState, useQueryView } from "./QueryView";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function InstructionHistory({
|
||||
agentId,
|
||||
@@ -129,13 +131,13 @@ export function InstructionHistory({
|
||||
{diff.data && (
|
||||
<>
|
||||
<p className="text-sm text-muted-foreground">Selected revision</p>
|
||||
<pre className="whitespace-pre-wrap break-words rounded-md border border-border p-3 font-mono text-sm">
|
||||
<pre className={cn("whitespace-pre-wrap break-words rounded-md border border-border p-3 font-mono text-sm", ANALYTICS_MASK_CLASS)}>
|
||||
{diff.data.from.content}
|
||||
</pre>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Changes from selected revision to current
|
||||
</p>
|
||||
<pre className="whitespace-pre-wrap break-words rounded-md border border-border p-3 font-mono text-sm">
|
||||
<pre className={cn("whitespace-pre-wrap break-words rounded-md border border-border p-3 font-mono text-sm", ANALYTICS_MASK_CLASS)}>
|
||||
{diff.data.removed && `Removed:\n${diff.data.removed}\n`}
|
||||
{diff.data.added && `Added:\n${diff.data.added}`}
|
||||
{!diff.data.removed &&
|
||||
|
||||
@@ -16,6 +16,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover
|
||||
import { StatusGlyph } from "@/components/StatusGlyph";
|
||||
import { ProjectTile } from "@/components/ProjectTile";
|
||||
import { useFlyoutAppearance } from "@/components/ui/flyout-appearance";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Single-flight quicklook store */
|
||||
@@ -211,7 +212,7 @@ export function IssueQuicklookCard({
|
||||
</RouterDom.Link>
|
||||
|
||||
{description ? (
|
||||
<p data-slot="task-preview-description" className="text-xs leading-5 text-muted-foreground [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:4] overflow-hidden">
|
||||
<p data-slot="task-preview-description" className={cn("text-xs leading-5 text-muted-foreground [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:4] overflow-hidden", ANALYTICS_MASK_CLASS)}>
|
||||
{description}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
@@ -51,6 +51,7 @@ import {
|
||||
readRecoveryRetryLineage,
|
||||
type RecoveryRetryLineage,
|
||||
} from "@/lib/recovery-lineage";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export type RecoveryCardCardState = RecoveryDisplayState;
|
||||
export const deriveRecoveryCardState = deriveRecoveryDisplayState;
|
||||
@@ -1167,7 +1168,7 @@ export function IssueRecoveryActionCard({
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
<p className="mt-1 text-sm leading-6">{headline}</p>
|
||||
<p className={cn("mt-1 text-sm leading-6", ANALYTICS_MASK_CLASS)}>{headline}</p>
|
||||
</div>
|
||||
</header>
|
||||
{variant === "compact" ? null : (
|
||||
@@ -1306,11 +1307,11 @@ export function IssueRecoveryActionCard({
|
||||
<MetadataRow label="Evidence">
|
||||
{evidenceSummary ? (
|
||||
evidenceSummary.isCode ? (
|
||||
<span className="break-words font-mono text-(length:--text-micro) text-foreground/80">
|
||||
<span className={cn("break-words font-mono text-(length:--text-micro) text-foreground/80", ANALYTICS_MASK_CLASS)}>
|
||||
{evidenceSummary.text}
|
||||
</span>
|
||||
) : (
|
||||
<span className="text-xs leading-5 text-foreground/80">{evidenceSummary.text}</span>
|
||||
<span className={cn("text-xs leading-5 text-foreground/80", ANALYTICS_MASK_CLASS)}>{evidenceSummary.text}</span>
|
||||
)
|
||||
) : (
|
||||
<MissingValue />
|
||||
@@ -1381,7 +1382,7 @@ export function IssueRecoveryActionCard({
|
||||
)}
|
||||
>
|
||||
<span className="font-medium leading-5">{option.label}</span>
|
||||
<span className="text-(length:--text-micro) leading-4 text-muted-foreground">{option.description}</span>
|
||||
<span className={cn("text-(length:--text-micro) leading-4 text-muted-foreground", ANALYTICS_MASK_CLASS)}>{option.description}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,8 @@ import { ExternalObjectPill } from "./ExternalObjectPill";
|
||||
import type { IssueExternalObjectGroup } from "../hooks/useIssueExternalObjects";
|
||||
import { externalObjectToneSeverity } from "../lib/external-objects";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type GroupedSource = {
|
||||
label: string;
|
||||
@@ -147,7 +149,7 @@ function ExternalObjectsSection({
|
||||
>
|
||||
<ExternalObjectPill object={pill} sourceCount={mentionCount} sourceSummary={sourceLabels.join(", ")} />
|
||||
{pill.displayTitle ? (
|
||||
<span className="min-w-0 flex-1 truncate text-sm text-muted-foreground">
|
||||
<span className={cn("min-w-0 flex-1 truncate text-sm text-muted-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{pill.displayTitle}
|
||||
</span>
|
||||
) : null}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { RunForIssue } from "../api/activity";
|
||||
import type { ActiveRunForIssue } from "../api/heartbeats";
|
||||
import { IssueRunLedgerContent } from "./IssueRunLedger";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
vi.mock("@/lib/router", () => ({
|
||||
Link: ({ children, to, ...props }: { children: ReactNode; to: string } & ComponentProps<"a">) => (
|
||||
@@ -319,6 +320,7 @@ describe("IssueRunLedger", () => {
|
||||
expect(container.textContent).toContain("Retry exhausted");
|
||||
expect(container.textContent).toContain("no further automatic retry will be queued");
|
||||
expect(container.textContent).toContain("Manual intervention required");
|
||||
expect(replayLeaks("Bounded retry exhausted after 4 scheduled attempts", container)).toEqual({ rendered: true, recorded: false });
|
||||
});
|
||||
|
||||
it("labels max-turn stops and continuation retries without confusing them with per-run turns", () => {
|
||||
|
||||
@@ -37,6 +37,7 @@ import {
|
||||
runRequestedProviderTrace,
|
||||
} from "./ProviderTraceStatusBadge";
|
||||
import { readFromIssueChatBootstrap } from "@/lib/issue-chat-bootstrap";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
type IssueRunLedgerProps = {
|
||||
issueId: string;
|
||||
@@ -973,7 +974,7 @@ export function IssueRunLedgerContent({
|
||||
</div>
|
||||
|
||||
{retryState ? (
|
||||
<div className="rounded-md border border-border/70 bg-accent/20 px-2 py-2 text-xs leading-5 text-muted-foreground">
|
||||
<div className={cn("rounded-md border border-border/70 bg-accent/20 px-2 py-2 text-xs leading-5 text-muted-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{retryState.detail ? <p>{retryState.detail}</p> : null}
|
||||
{retryState.secondary ? (
|
||||
<p>{retryState.secondary}</p>
|
||||
|
||||
@@ -58,6 +58,7 @@ import { DecisionCardFooter } from "./DecisionCardFooter";
|
||||
import { ToolActionAuditHashCopy } from "./ToolActionAuditHashCopy";
|
||||
import { NeedsYouPanel, NeedsYouPanelNote, NeedsYouPanelRow } from "./coordinator/NeedsYouCardKit";
|
||||
import { claimReviseDraftWork, clearReviseDraft, releaseReviseDraftWork, reviseDraftKey, useReviseDraft, type ReviseDraftWork } from "@/lib/revise-draft-store";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
const OTHER_ANSWER_ID = "__paperclip_other__";
|
||||
|
||||
@@ -1982,7 +1983,7 @@ function ToolActionResolution({
|
||||
</button>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<pre className="mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted p-3 font-mono text-xs text-foreground">{formattedOutput}</pre>
|
||||
<pre className={cn("mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted p-3 font-mono text-xs text-foreground", ANALYTICS_MASK_CLASS)}>{formattedOutput}</pre>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
) : <p className="flex items-center gap-1.5">{status}</p>}
|
||||
@@ -2065,7 +2066,7 @@ function RequestToolActionCard({
|
||||
const preview = payload.previewMarkdown?.trim() ?? "";
|
||||
const previewIsLine = Boolean(preview) && !preview.includes("\n") && preview.length <= 120;
|
||||
return (
|
||||
<div className="space-y-4 text-foreground">
|
||||
<div className={cn("space-y-4 text-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
<div className="space-y-3">
|
||||
<CompactDecisionAsk>{ask}</CompactDecisionAsk>
|
||||
<CompactDecisionNote note={compactDecisionNote(interaction, [ask, payload.previewMarkdown])} />
|
||||
@@ -2074,7 +2075,7 @@ function RequestToolActionCard({
|
||||
{preview && !previewIsLine ? <DecisionPanelMarkdown markdown={preview} lead={false} externalReferences={externalReferences} /> : null}
|
||||
{isPending ? inspectableArguments ? <details>
|
||||
<summary className="cursor-pointer text-xs font-medium text-muted-foreground">Arguments</summary>
|
||||
<pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground">{payload.argumentsSummaryJson}</pre>
|
||||
<pre className={cn("mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground", ANALYTICS_MASK_CLASS)}>{payload.argumentsSummaryJson}</pre>
|
||||
<ToolActionAuditHashCopy hash={payload.argumentsHash} />
|
||||
</details> : <p className="text-xs text-muted-foreground">Request arguments are unavailable.</p> : null}
|
||||
{isPending ? (
|
||||
@@ -2116,7 +2117,7 @@ function RequestToolActionCard({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="text-foreground">
|
||||
<div className={cn("text-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
<div className="flex items-start gap-3">
|
||||
<span role="img" aria-label={payload.appDisplayName || payload.toolDisplayName}>
|
||||
<AppLogo name={payload.appDisplayName || payload.toolDisplayName} size={36} />
|
||||
@@ -2131,7 +2132,7 @@ function RequestToolActionCard({
|
||||
<summary className="cursor-pointer text-xs font-medium text-muted-foreground">
|
||||
Arguments
|
||||
</summary>
|
||||
<pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground">
|
||||
<pre className={cn("mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{payload.argumentsSummaryJson}
|
||||
</pre>
|
||||
<ToolActionAuditHashCopy hash={payload.argumentsHash} />
|
||||
@@ -2885,7 +2886,7 @@ function RequestConnectionAuthorizationCard({
|
||||
<div className="space-y-3">
|
||||
<p className="text-sm text-muted-foreground" data-testid="connection-authorization-body">{lead}</p>
|
||||
<DecisionPanel>
|
||||
<NeedsYouPanelRow icon={<Lock />} title={connectionName && connectionName !== providerName ? `${providerName} · ${connectionName}` : providerName} meta="Not connected" />
|
||||
<NeedsYouPanelRow icon={<Lock />} title={connectionName && connectionName !== providerName ? <>{providerName} · <span className={ANALYTICS_MASK_CLASS}>{connectionName}</span></> : providerName} meta="Not connected" />
|
||||
<NeedsYouPanelNote>{consentSentence}</NeedsYouPanelNote>
|
||||
</DecisionPanel>
|
||||
</div>
|
||||
@@ -4437,7 +4438,7 @@ export function IssueThreadInteractionCard({
|
||||
if (coordinatorEnabled && !compactDecision && interaction.kind === "suggest_tasks") {
|
||||
return <InteractionAudienceContext.Provider value={audience}>
|
||||
<CoordinatorTaskCommitment interaction={interaction}>
|
||||
<div className="p-4 space-y-3">
|
||||
<div className={cn("p-4 space-y-3", ANALYTICS_MASK_CLASS)}>
|
||||
{interaction.status === "pending" ? <InteractionAudienceLine audience={audience} /> : null}
|
||||
<SuggestTasksCard interaction={interaction} agentMap={agentMap} currentUserId={currentUserId}
|
||||
userLabelMap={userLabelMap} onAcceptInteraction={onAcceptInteraction} onRejectInteraction={onRejectInteraction} />
|
||||
@@ -4447,7 +4448,7 @@ export function IssueThreadInteractionCard({
|
||||
}
|
||||
if (!compactDecision && interaction.kind === "connection_intent" && interaction.payload.accessRequest) {
|
||||
return (
|
||||
<div id={`interaction-${interaction.id}`}>
|
||||
<div className={ANALYTICS_MASK_CLASS} id={`interaction-${interaction.id}`}>
|
||||
<ConnectionIntentInteractionBody
|
||||
footerSlot={footerSlot}
|
||||
interaction={interaction}
|
||||
@@ -4526,7 +4527,7 @@ export function IssueThreadInteractionCard({
|
||||
// denial with the same audience the header states (PAP-17287).
|
||||
<InteractionAudienceContext.Provider value={audience}>
|
||||
<CompactArtifactRowContext.Provider value={compactDecision ? artifactRow : null}>
|
||||
<div data-presentation={presentationVariant} className={compactDecision ? "coordinator-decision-content space-y-4" : cn("rounded-lg border p-5 shadow-none", styles.shell)}>
|
||||
<div data-presentation={presentationVariant} className={compactDecision ? cn("coordinator-decision-content space-y-4", ANALYTICS_MASK_CLASS) : cn("rounded-lg border p-5 shadow-none", styles.shell, ANALYTICS_MASK_CLASS)}>
|
||||
{compactDecision ? <>
|
||||
{!bodyNamesDecision ? <CompactDecisionAsk><PromptText>{compactTitle}</PromptText></CompactDecisionAsk> : null}
|
||||
{/* Questions and confirmations put the note under their ask (UI1). */}
|
||||
|
||||
@@ -6,6 +6,8 @@ import type { LinkPreview as Preview, LinkPreviewResult, LinkPreviewState, LinkP
|
||||
import { useLinkPreviewContext, type LinkPreviewContextValue } from "@/context/LinkPreviewContext";
|
||||
import { timeAgo } from "@/lib/timeAgo";
|
||||
import { linkPreviewQueryOptions } from "@/lib/link-preview-query";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export const linkPreviewStateLabel: Record<LinkPreviewState, string> = {
|
||||
unknown: "Status unknown", open: "Open", merged: "Merged", conflicts: "Merge conflicts", draft: "Draft", closed: "Closed",
|
||||
@@ -19,7 +21,7 @@ function PreviewCardContents({ target, preview, loading }: { target: LinkPreview
|
||||
const state = preview?.state ?? "unknown";
|
||||
const Icon = linkPreviewStateIcon[state] ?? linkPreviewStateIcon.unknown;
|
||||
const updated = preview?.updatedAt && Number.isFinite(Date.parse(preview.updatedAt)) ? preview.updatedAt : null;
|
||||
return <div className="flex min-w-0 flex-col gap-3" data-link-preview-state={state}>
|
||||
return <div className={cn("flex min-w-0 flex-col gap-3", ANALYTICS_MASK_CLASS)} data-link-preview-state={state}>
|
||||
<div className="flex items-center gap-2 text-xs text-muted-foreground">
|
||||
<Icon aria-hidden="true" className="link-preview-status size-4 shrink-0" data-state={state} />
|
||||
<span className="min-w-0 break-all font-mono">{target.label}</span>
|
||||
|
||||
@@ -6,6 +6,7 @@ import type { Project } from "@paperclipai/shared";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { projectsApi } from "@/api/projects";
|
||||
import { ProjectGitAuthorization } from "./ProjectGitAuthorization";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
vi.mock("@/api/projects", () => ({
|
||||
projectsApi: {
|
||||
@@ -76,4 +77,42 @@ describe("ProjectGitAuthorization", () => {
|
||||
client.clear();
|
||||
}
|
||||
});
|
||||
|
||||
it("masks GitHub logins in session replay", async () => {
|
||||
const saved = {
|
||||
grantId: "grant-a",
|
||||
authorizedByUserId: "user-a",
|
||||
options: [
|
||||
{ grantId: "grant-a", connectionName: "Work GitHub", login: "saved-octo-quillon" },
|
||||
{ grantId: "grant-b", connectionName: "Side GitHub", login: "picked-octo-varnell" },
|
||||
],
|
||||
};
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false, staleTime: Infinity } } });
|
||||
client.setQueryData(["project-git-authorization", "company-a", "project-b"], saved);
|
||||
const container = document.createElement("div"),
|
||||
root = createRoot(container);
|
||||
document.body.appendChild(container);
|
||||
try {
|
||||
await act(async () =>
|
||||
root.render(
|
||||
<QueryClientProvider client={client}>
|
||||
<ProjectGitAuthorization project={{ id: "project-b", companyId: "company-a" } as Project} />
|
||||
</QueryClientProvider>,
|
||||
),
|
||||
);
|
||||
expect(replayLeaks("saved-octo-quillon", container)).toEqual({ rendered: true, recorded: false });
|
||||
const trigger = container.querySelector<HTMLElement>('[role="combobox"]')!;
|
||||
await act(async () => {
|
||||
trigger.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true }));
|
||||
});
|
||||
expect(replayLeaks("picked-octo-varnell", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
const option = [...document.querySelectorAll<HTMLElement>('[role="option"]')].find((item) => item.textContent?.includes("picked-octo-varnell"))!;
|
||||
await act(async () => option.click());
|
||||
expect(replayLeaks("picked-octo-varnell", trigger)).toEqual({ rendered: true, recorded: false });
|
||||
} finally {
|
||||
await act(async () => root.unmount());
|
||||
container.remove();
|
||||
client.clear();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -4,6 +4,8 @@ import type { Project } from "@paperclipai/shared";
|
||||
import { projectsApi } from "@/api/projects";
|
||||
import { Button } from "./ui/button";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./ui/select";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function ProjectGitAuthorization({ project }: { project: Project }) {
|
||||
const client = useQueryClient();
|
||||
@@ -31,7 +33,7 @@ export function ProjectGitAuthorization({ project }: { project: Project }) {
|
||||
Task runs continue to use their own identity.
|
||||
</p>
|
||||
{data?.grantId && (
|
||||
<p role="status" className="text-sm">
|
||||
<p role="status" className={cn("text-sm", ANALYTICS_MASK_CLASS)}>
|
||||
Authorized:{" "}
|
||||
{data.options.find((option) => option.grantId === data.grantId)?.login ??
|
||||
"selected grant (unavailable or owned by another member)"}
|
||||
@@ -40,12 +42,12 @@ export function ProjectGitAuthorization({ project }: { project: Project }) {
|
||||
{data && (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<Select value={selected} onValueChange={setSelected} disabled={save.isPending}>
|
||||
<SelectTrigger aria-label="Your GitHub authorization">
|
||||
<SelectTrigger aria-label="Your GitHub authorization" className={ANALYTICS_MASK_CLASS}>
|
||||
<SelectValue placeholder="Select your GitHub account" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{data.options.map((option) => (
|
||||
<SelectItem key={option.grantId} value={option.grantId}>
|
||||
<SelectItem key={option.grantId} value={option.grantId} className={ANALYTICS_MASK_CLASS}>
|
||||
{option.login} · {option.connectionName}
|
||||
</SelectItem>
|
||||
))}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState } from "react";
|
||||
import { ChevronRight } from "lucide-react";
|
||||
import type { ActivityEvent } from "@paperclipai/shared";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export type RoutineActivityEvent = Pick<ActivityEvent, "id" | "action" | "details" | "createdAt">;
|
||||
|
||||
@@ -89,7 +90,7 @@ export function RoutineActivityRow({ event }: { event: RoutineActivityEvent }) {
|
||||
) : null}
|
||||
</button>
|
||||
{expanded && hasPayload ? (
|
||||
<pre className="mx-2 mb-2 overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs text-foreground">
|
||||
<pre className={cn("mx-2 mb-2 overflow-x-auto rounded-md bg-muted p-3 font-mono text-xs text-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{JSON.stringify(event.details, null, 2)}
|
||||
</pre>
|
||||
) : null}
|
||||
|
||||
@@ -104,12 +104,12 @@ export function RoutineContextualSidebar({
|
||||
Operate
|
||||
</p>
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={routineDetailHref(routineId, "runs")}
|
||||
label="Runs"
|
||||
icon={Play}
|
||||
/>
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={routineDetailHref(routineId, "activity")}
|
||||
label="Activity"
|
||||
icon={Activity}
|
||||
|
||||
@@ -38,6 +38,8 @@ import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { EmptyState } from "./EmptyState";
|
||||
import { MarkdownBody } from "./MarkdownBody";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type AgentLookup = Map<string, { id: string; name: string }>;
|
||||
type ProjectLookup = Map<string, { id: string; name: string }>;
|
||||
@@ -970,7 +972,7 @@ function DiffTable({ rows }: { rows: DiffRow[] }) {
|
||||
<span className="select-none px-3 text-center text-muted-foreground">
|
||||
{markerByKind[row.kind]}
|
||||
</span>
|
||||
<pre className="overflow-x-auto whitespace-pre-wrap break-words px-3 py-0 text-inherit">
|
||||
<pre className={cn("overflow-x-auto whitespace-pre-wrap break-words px-3 py-0 text-inherit", ANALYTICS_MASK_CLASS)}>
|
||||
{row.text.length > 0 ? row.text : " "}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { ApiError } from "@/api/client";
|
||||
import { ConnectivityProvider, createConnectivityStore, type ConnectivityStore } from "@/lib/connectivity";
|
||||
import { RunnerInspector } from "./RunnerInspector";
|
||||
import { isBlockedFromReplay, replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
const accessMock = vi.hoisted(() => vi.fn());
|
||||
const eventsMock = vi.hoisted(() => vi.fn());
|
||||
@@ -273,6 +274,7 @@ describe("RunnerInspector", () => {
|
||||
flushSync(() => reveal?.click());
|
||||
await flush();
|
||||
expect(container.textContent).toContain("run-one-secret");
|
||||
expect(isBlockedFromReplay("run-one-secret", document.body)).toBe(true);
|
||||
|
||||
flushSync(() =>
|
||||
root.render(
|
||||
@@ -290,6 +292,44 @@ describe("RunnerInspector", () => {
|
||||
expect(container.textContent).not.toContain("run-one-secret");
|
||||
});
|
||||
|
||||
it("blocks an exact frame revealed in the trace view from session replay", async () => {
|
||||
traceMock.mockResolvedValue(traceInspection("run-1", "run-1-redacted"));
|
||||
revealMock.mockResolvedValue({
|
||||
schema: "paperclip.provider_trace_frame.v1",
|
||||
frameId: 1,
|
||||
timestamp: "1",
|
||||
direction: "provider_to_client",
|
||||
transport: "stdio_jsonl",
|
||||
provider: "codex",
|
||||
byteLength: 31,
|
||||
digest: `sha256:${"b".repeat(64)}`,
|
||||
rawBase64: btoa(JSON.stringify({ authorization: "Bearer trace-view-Kq72Lx" })),
|
||||
});
|
||||
vi.spyOn(window, "confirm").mockReturnValue(true);
|
||||
|
||||
flushSync(() =>
|
||||
root.render(
|
||||
<RunnerInspector
|
||||
runId="run-1"
|
||||
run={{ status: "succeeded", resultJson: null }}
|
||||
open
|
||||
onOpenChange={vi.fn()}
|
||||
/>,
|
||||
),
|
||||
);
|
||||
await flush();
|
||||
flushSync(() =>
|
||||
Array.from(document.querySelectorAll<HTMLButtonElement>('[role="tab"]')).find((tab) => tab.textContent?.includes("Exact trace"))!.click(),
|
||||
);
|
||||
await flush();
|
||||
expect(replayLeaks("run-1-redacted", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
flushSync(() =>
|
||||
Array.from(document.querySelectorAll("button")).find((button) => button.textContent?.includes("Reveal exact frame"))!.click(),
|
||||
);
|
||||
await flush();
|
||||
expect(isBlockedFromReplay("Bearer trace-view-Kq72Lx", document.body)).toBe(true);
|
||||
});
|
||||
|
||||
it("clears exact frames when raw-trace access is revoked while open", async () => {
|
||||
traceMock.mockResolvedValue(traceInspection("run-1", "run-1-redacted"));
|
||||
revealMock.mockResolvedValue({
|
||||
|
||||
@@ -57,6 +57,7 @@ import {
|
||||
SheetTitle,
|
||||
} from "@/components/ui/sheet";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS, ANALYTICS_NO_CAPTURE_CLASS } from "@/lib/analytics/privacy";
|
||||
import { useCopyAction } from "@/lib/use-copy-action";
|
||||
|
||||
type TraceEntry = Record<string, unknown>;
|
||||
@@ -489,7 +490,7 @@ function JsonNode({
|
||||
function JsonExplorer({ value, label = "Search this JSON" }: { value: unknown; label?: string }) {
|
||||
const [query, setQuery] = useState("");
|
||||
return (
|
||||
<div className="overflow-hidden rounded-md border border-border bg-muted/20">
|
||||
<div className={cn("overflow-hidden rounded-md border border-border bg-muted/20", ANALYTICS_MASK_CLASS)}>
|
||||
<div className="relative border-b border-border bg-background/60">
|
||||
<Search className="absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground" />
|
||||
<Input
|
||||
@@ -1172,7 +1173,7 @@ export function RunnerInspector({
|
||||
<JsonExplorer value={selectedFrame.parsed} />
|
||||
{Array.isArray(selectedFrame.withheldPaths) && selectedFrame.withheldPaths.length > 0 ? <div className="flex items-start gap-2 rounded-md border border-border bg-accent/30 px-3 py-2 text-xs text-muted-foreground"><ShieldAlert className="mt-0.5 h-3.5 w-3.5 shrink-0 text-accent-foreground" /><span>Withheld paths: {selectedFrame.withheldPaths.join(", ")}</span></div> : null}
|
||||
{canInspectRaw === true ? <Button size="sm" variant="outline" onClick={() => void reveal(Number(selectedFrame.frameId))}><Eye className="mr-1.5 h-4 w-4" />Reveal exact frame</Button> : null}
|
||||
{revealedFrame ? <div className="rounded-md border border-destructive/30 p-2"><p className="mb-2 flex items-center gap-1.5 text-xs font-medium text-destructive"><ShieldAlert className="h-3.5 w-3.5" />Exact unredacted frame</p><JsonExplorer value={decodeExactFrame(revealedFrame.rawBase64)} label="Search exact frame" /></div> : null}
|
||||
{revealedFrame ? <div className={cn("rounded-md border border-destructive/30 p-2", ANALYTICS_NO_CAPTURE_CLASS)}><p className="mb-2 flex items-center gap-1.5 text-xs font-medium text-destructive"><ShieldAlert className="h-3.5 w-3.5" />Exact unredacted frame</p><JsonExplorer value={decodeExactFrame(revealedFrame.rawBase64)} label="Search exact frame" /></div> : null}
|
||||
</div>
|
||||
) : <p className="text-sm text-muted-foreground">This PRP event has no recoverable raw frame.</p>}
|
||||
</section>
|
||||
@@ -1226,7 +1227,7 @@ export function RunnerInspector({
|
||||
{view === "trace" ? (
|
||||
<div className="grid min-h-0 flex-1 md:grid-cols-(--gtc-runner-inspector-trace)">
|
||||
<ScrollArea className="border-r border-border"><div className="p-2">{frames.length ? [...frames].sort((left, right) => Number(left.frameId) - Number(right.frameId)).map((frame) => <button key={Number(frame.frameId)} type="button" onClick={() => { const operation = operations.find((candidate) => candidate.frames.some((candidateFrame) => Number(candidateFrame.frameId) === Number(frame.frameId))); if (operation) setSelectedKey(operation.key); setSelectedFrameId(Number(frame.frameId)); }} className={cn("mb-1 w-full rounded-md border px-3 py-2 text-left", Number(frame.frameId) === Number(selectedFrame?.frameId) ? "border-primary/40 bg-primary/10" : "border-transparent hover:bg-muted/50")}><span className="flex items-center gap-2 text-sm font-medium"><span className="font-mono text-xs text-muted-foreground">#{String(frame.frameId)}</span><span className="truncate">{frameMethod(frame) || text(frame.direction)}</span></span><span className="mt-1 block text-(length:--text-nano) text-muted-foreground">{text(frame.direction).replaceAll("_", " ")} · {formatBytes(Number(frame.byteLength) || 0)}</span></button>) : <p className="p-3 text-sm text-muted-foreground">No raw frames were captured for this run.</p>}</div></ScrollArea>
|
||||
<ScrollArea><div className="space-y-3 p-5">{selectedFrame ? <><div className="flex flex-wrap items-center gap-2"><h3 className="text-sm font-semibold">Exact trace frame #{String(selectedFrame.frameId)}</h3><Badge variant="outline">{frameMethod(selectedFrame) || text(selectedFrame.direction)}</Badge></div><JsonExplorer value={selectedFrame.parsed} />{canInspectRaw === true ? <Button size="sm" variant="outline" onClick={() => void reveal(Number(selectedFrame.frameId))}><Eye className="mr-1.5 h-4 w-4" />Reveal exact frame</Button> : null}{revealedFrame ? <JsonExplorer value={decodeExactFrame(revealedFrame.rawBase64)} label="Search exact frame" /> : null}</> : <p className="text-sm text-muted-foreground">Select a frame from the chronological trace.</p>}</div></ScrollArea>
|
||||
<ScrollArea><div className="space-y-3 p-5">{selectedFrame ? <><div className="flex flex-wrap items-center gap-2"><h3 className="text-sm font-semibold">Exact trace frame #{String(selectedFrame.frameId)}</h3><Badge variant="outline">{frameMethod(selectedFrame) || text(selectedFrame.direction)}</Badge></div><JsonExplorer value={selectedFrame.parsed} />{canInspectRaw === true ? <Button size="sm" variant="outline" onClick={() => void reveal(Number(selectedFrame.frameId))}><Eye className="mr-1.5 h-4 w-4" />Reveal exact frame</Button> : null}{revealedFrame ? <div className={ANALYTICS_NO_CAPTURE_CLASS}><JsonExplorer value={decodeExactFrame(revealedFrame.rawBase64)} label="Search exact frame" /></div> : null}</> : <p className="text-sm text-muted-foreground">Select a frame from the chronological trace.</p>}</div></ScrollArea>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
|
||||
@@ -149,9 +149,9 @@ export function Sidebar() {
|
||||
width; a nav row also keeps search reachable from the
|
||||
collapsed rail, where the old header icon was dropped entirely.
|
||||
Cmd/Ctrl+K remains the keyboard path (command palette). */}
|
||||
<SidebarNavItem analyticsChrome to="/search" label="Search" icon={Search} />
|
||||
<SidebarNavItem analyticsChrome to="/dashboard" label="Dashboard" icon={LayoutDashboard} liveCount={liveRunCount} />
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem to="/search" label="Search" icon={Search} />
|
||||
<SidebarNavItem to="/dashboard" label="Dashboard" icon={LayoutDashboard} liveCount={liveRunCount} />
|
||||
<SidebarNavItem
|
||||
to="/inbox"
|
||||
label="Inbox"
|
||||
icon={Inbox}
|
||||
@@ -161,7 +161,7 @@ export function Sidebar() {
|
||||
alert={inboxBadge.failedRuns > 0}
|
||||
/>
|
||||
{showDecisions ? (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to="/decisions"
|
||||
label="Decisions"
|
||||
icon={ListChecks}
|
||||
@@ -170,21 +170,21 @@ export function Sidebar() {
|
||||
/>
|
||||
) : null}
|
||||
{showStatusCards ? (
|
||||
<SidebarNavItem analyticsChrome to="/status" label="Status" icon={LayoutGrid} textBadge="beta" />
|
||||
<SidebarNavItem to="/status" label="Status" icon={LayoutGrid} textBadge="beta" />
|
||||
) : null}
|
||||
{conferenceRoomChatEnabled ? (
|
||||
<SidebarNavItem analyticsChrome to="/board-chat" label="Conference Room" icon={MessagesSquare} />
|
||||
<SidebarNavItem to="/board-chat" label="Conference Room" icon={MessagesSquare} />
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<SidebarSection label="Work" collapsible={{ open: workOpen, onOpenChange: setWorkOpen }}>
|
||||
<SidebarNavItem analyticsChrome to="/issues" label="Tasks" icon={CircleDot} />
|
||||
<SidebarNavItem to="/issues" label="Tasks" icon={CircleDot} />
|
||||
{showCases ? (
|
||||
<SidebarNavItem analyticsChrome to="/cases" label="Cases" icon={Layers} textBadge="beta" />
|
||||
<SidebarNavItem to="/cases" label="Cases" icon={Layers} textBadge="beta" />
|
||||
) : null}
|
||||
<SidebarNavItem analyticsChrome to="/routines" label="Routines" icon={Repeat} />
|
||||
<SidebarNavItem to="/routines" label="Routines" icon={Repeat} />
|
||||
{showGoalsLink ? (
|
||||
<SidebarNavItem analyticsChrome to="/goals" label="Goals" icon={Target} />
|
||||
<SidebarNavItem to="/goals" label="Goals" icon={Target} />
|
||||
) : goalsLinkPending ? (
|
||||
<div
|
||||
data-testid="sidebar-goals-placeholder"
|
||||
@@ -192,14 +192,14 @@ export function Sidebar() {
|
||||
aria-hidden="true"
|
||||
/>
|
||||
) : null}
|
||||
<SidebarNavItem analyticsChrome to="/artifacts" label="Artifacts" icon={Package} />
|
||||
<SidebarNavItem analyticsChrome to="/skills" label="Skills" icon={Boxes} />
|
||||
<SidebarNavItem to="/artifacts" label="Artifacts" icon={Package} />
|
||||
<SidebarNavItem to="/skills" label="Skills" icon={Boxes} />
|
||||
{showWorkspacesLink ? (
|
||||
<SidebarNavItem analyticsChrome to="/workspaces" label="Workspaces" icon={GitBranch} />
|
||||
<SidebarNavItem to="/workspaces" label="Workspaces" icon={GitBranch} />
|
||||
) : null}
|
||||
{streamlined ? (
|
||||
<>
|
||||
<SidebarNavItem analyticsChrome to="/projects" label="Projects" icon={FolderOpen} />
|
||||
<SidebarNavItem to="/projects" label="Projects" icon={FolderOpen} />
|
||||
<SidebarStarredProjects />
|
||||
</>
|
||||
) : null}
|
||||
@@ -224,14 +224,14 @@ export function Sidebar() {
|
||||
<SidebarAgents streamlined={streamlined} />
|
||||
|
||||
<SidebarSection label="Company" collapsible={{ open: companyOpen, onOpenChange: setCompanyOpen }}>
|
||||
<SidebarNavItem analyticsChrome to="/org" label="Org" icon={Network} />
|
||||
{showApps ? <SidebarNavItem analyticsChrome to="/apps" label="Connectors" icon={Unplug} /> : null}
|
||||
<SidebarNavItem analyticsChrome to="/timeline" label="Timeline" icon={GanttChartSquare} />
|
||||
<SidebarNavItem analyticsChrome to="/costs" label="Costs" icon={DollarSign} />
|
||||
<SidebarNavItem to="/org" label="Org" icon={Network} />
|
||||
{showApps ? <SidebarNavItem to="/apps" label="Connectors" 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). */}
|
||||
<SidebarNavItem analyticsChrome to="/activity" label="Activity" icon={History} />
|
||||
<SidebarNavItem analyticsChrome to="/activity/commentary" label="Commentary" icon={History} />
|
||||
<SidebarNavItem analyticsChrome to="/company/settings" label="Settings" icon={Settings} />
|
||||
<SidebarNavItem to="/activity" label="Activity" icon={History} />
|
||||
<SidebarNavItem to="/activity/commentary" label="Commentary" icon={History} />
|
||||
<SidebarNavItem to="/company/settings" label="Settings" icon={Settings} />
|
||||
</SidebarSection>
|
||||
|
||||
<PluginSlotOutlet
|
||||
|
||||
@@ -176,10 +176,10 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
width; a nav row also keeps search reachable from the
|
||||
collapsed rail, where the old header icon was dropped entirely.
|
||||
Cmd/Ctrl+K remains the keyboard path (command palette). */}
|
||||
<SidebarNavItem analyticsChrome to="/search" label="Search" icon={Search} />
|
||||
<SidebarNavItem analyticsChrome to="/dashboard" label="Dashboard" icon={LayoutDashboard} liveCount={liveRunCount} />
|
||||
<SidebarNavItem to="/search" label="Search" icon={Search} />
|
||||
<SidebarNavItem to="/dashboard" label="Dashboard" icon={LayoutDashboard} liveCount={liveRunCount} />
|
||||
{!combinedInboxTasks ? (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to="/inbox"
|
||||
label="Inbox"
|
||||
icon={Inbox}
|
||||
@@ -189,9 +189,9 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
alert={inboxBadge.failedRuns > 0}
|
||||
/>
|
||||
) : null}
|
||||
{agentChatEnabled && !chatRail ? <SidebarNavItem analyticsChrome to="/chats" label="Chat" icon={MessageCircle} badge={unreadChatCount} badgeLabel="unread chats" /> : null}
|
||||
{agentChatEnabled && !chatRail ? <SidebarNavItem to="/chats" label="Chat" icon={MessageCircle} badge={unreadChatCount} badgeLabel="unread chats" /> : null}
|
||||
{showDecisions ? (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to="/decisions"
|
||||
label="Decisions"
|
||||
icon={ListChecks}
|
||||
@@ -200,10 +200,10 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
/>
|
||||
) : null}
|
||||
{showStatusCards ? (
|
||||
<SidebarNavItem analyticsChrome to="/status" label="Status" icon={LayoutGrid} textBadge="beta" />
|
||||
<SidebarNavItem to="/status" label="Status" icon={LayoutGrid} textBadge="beta" />
|
||||
) : null}
|
||||
{conferenceRoomChatEnabled ? (
|
||||
<SidebarNavItem analyticsChrome to="/board-chat" label="Conference Room" icon={MessagesSquare} />
|
||||
<SidebarNavItem to="/board-chat" label="Conference Room" icon={MessagesSquare} />
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -212,12 +212,12 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
agents you talk to live in the Chat surface's own secondary rail
|
||||
(ChatContextualSidebar), not in the primary nav. */}
|
||||
{chatRail ? (
|
||||
<SidebarNavItem analyticsChrome to="/chats" label="Chat" icon={MessageCircle} badge={unreadChatCount} badgeLabel="unread chats" />
|
||||
<SidebarNavItem to="/chats" label="Chat" icon={MessageCircle} badge={unreadChatCount} badgeLabel="unread chats" />
|
||||
) : null}
|
||||
{/* Combined Inbox + Task List: Inbox is a view inside Tasks, so the
|
||||
unread/failed-run badge rides on Tasks. */}
|
||||
{combinedInboxTasks ? (
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to="/issues"
|
||||
label="Tasks"
|
||||
icon={CircleCheck}
|
||||
@@ -227,21 +227,21 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
alert={inboxBadge.failedRuns > 0}
|
||||
/>
|
||||
) : (
|
||||
<SidebarNavItem analyticsChrome to="/issues" label="Tasks" icon={CircleCheck} />
|
||||
<SidebarNavItem to="/issues" label="Tasks" icon={CircleCheck} />
|
||||
)}
|
||||
{streamlinedUiEnabled ? (
|
||||
<>
|
||||
<SidebarNavItem analyticsChrome to="/projects" label="Projects" icon={FolderOpen} />
|
||||
<SidebarNavItem to="/projects" label="Projects" icon={FolderOpen} />
|
||||
<SidebarStarredProjects />
|
||||
</>
|
||||
) : null}
|
||||
<SidebarNavItem analyticsChrome to="/routines" label="Routines" icon={Repeat} />
|
||||
<SidebarNavItem analyticsChrome to="/artifacts" label="Artifacts" icon={Package} />
|
||||
<SidebarNavItem to="/routines" label="Routines" icon={Repeat} />
|
||||
<SidebarNavItem to="/artifacts" label="Artifacts" icon={Package} />
|
||||
{showCases ? (
|
||||
<SidebarNavItem analyticsChrome to="/cases" label="Cases" icon={Layers} textBadge="beta" />
|
||||
<SidebarNavItem to="/cases" label="Cases" icon={Layers} textBadge="beta" />
|
||||
) : null}
|
||||
{showGoalsLink ? (
|
||||
<SidebarNavItem analyticsChrome to="/goals" label="Goals" icon={Target} />
|
||||
<SidebarNavItem to="/goals" label="Goals" icon={Target} />
|
||||
) : goalsLinkPending ? (
|
||||
<div
|
||||
data-testid="sidebar-goals-placeholder"
|
||||
@@ -250,7 +250,7 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
/>
|
||||
) : null}
|
||||
{showWorkspacesLink ? (
|
||||
<SidebarNavItem analyticsChrome to="/workspaces" label="Workspaces" icon={GitBranch} />
|
||||
<SidebarNavItem to="/workspaces" label="Workspaces" icon={GitBranch} />
|
||||
) : null}
|
||||
<PluginSlotOutlet
|
||||
slotTypes={["sidebar"]}
|
||||
@@ -272,10 +272,10 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
label="Org"
|
||||
collapsible={{ open: organizationOpen, onOpenChange: setOrganizationOpen }}
|
||||
>
|
||||
<SidebarNavItem analyticsChrome to="/agents" label="Agents" icon={Users} />
|
||||
<SidebarNavItem analyticsChrome to="/skills" label="Skills" icon={Boxes} />
|
||||
<SidebarNavItem analyticsChrome to="/apps" label="Connectors" icon={Unplug} />
|
||||
<SidebarNavItem analyticsChrome to="/activity" label="Audit" icon={History} />
|
||||
<SidebarNavItem to="/agents" label="Agents" icon={Users} />
|
||||
<SidebarNavItem to="/skills" label="Skills" icon={Boxes} />
|
||||
<SidebarNavItem to="/apps" label="Connectors" icon={Unplug} />
|
||||
<SidebarNavItem to="/activity" label="Audit" icon={History} />
|
||||
</SidebarSection>
|
||||
) : null}
|
||||
|
||||
@@ -291,13 +291,13 @@ function ClassicSidebar({ children }: { children?: ReactNode }) {
|
||||
label="Organization"
|
||||
collapsible={{ open: organizationOpen, onOpenChange: setOrganizationOpen }}
|
||||
>
|
||||
<SidebarNavItem analyticsChrome to="/org" label="Org" icon={Network} />
|
||||
<SidebarNavItem analyticsChrome to="/apps" label="Connectors" icon={Unplug} />
|
||||
<SidebarNavItem analyticsChrome to="/timeline" label="Timeline" icon={GanttChartSquare} />
|
||||
<SidebarNavItem analyticsChrome to="/costs" label="Costs" icon={DollarSign} />
|
||||
<SidebarNavItem analyticsChrome to="/activity" label="Activity" icon={History} />
|
||||
<SidebarNavItem analyticsChrome to="/activity/commentary" label="Commentary" icon={History} />
|
||||
<SidebarNavItem analyticsChrome to="/company/settings" label="Settings" icon={Settings} />
|
||||
<SidebarNavItem to="/org" label="Org" icon={Network} />
|
||||
<SidebarNavItem to="/apps" label="Connectors" icon={Unplug} />
|
||||
<SidebarNavItem to="/timeline" label="Timeline" icon={GanttChartSquare} />
|
||||
<SidebarNavItem to="/costs" label="Costs" icon={DollarSign} />
|
||||
<SidebarNavItem to="/activity" label="Activity" icon={History} />
|
||||
<SidebarNavItem to="/activity/commentary" label="Commentary" icon={History} />
|
||||
<SidebarNavItem to="/company/settings" label="Settings" icon={Settings} />
|
||||
</SidebarSection>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { createContext, useContext, type ReactNode } from "react";
|
||||
import { NavLink } from "@/lib/router";
|
||||
import { SIDEBAR_SCROLL_RESET_STATE } from "../lib/navigation-scroll";
|
||||
import { cn, SIDEBAR_RAIL_HIDDEN_LABEL } from "../lib/utils";
|
||||
import { ANALYTICS_UNMASK_PROPS } from "@/lib/analytics/privacy";
|
||||
import { useSidebar } from "../context/SidebarContext";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import type { LucideIcon } from "lucide-react";
|
||||
@@ -36,8 +35,6 @@ export function useSidebarNavExpanded() {
|
||||
interface SidebarNavItemProps {
|
||||
to: string;
|
||||
label: string;
|
||||
/** The label is fixed product copy, so session replay may show it. */
|
||||
analyticsChrome?: boolean;
|
||||
icon?: LucideIcon;
|
||||
/**
|
||||
* Pre-rendered icon element for rows whose icon isn't a plain Lucide
|
||||
@@ -75,7 +72,6 @@ interface SidebarNavItemProps {
|
||||
export function SidebarNavItem({
|
||||
to,
|
||||
label,
|
||||
analyticsChrome = false,
|
||||
icon: Icon,
|
||||
iconNode,
|
||||
end,
|
||||
@@ -123,7 +119,6 @@ export function SidebarNavItem({
|
||||
to={to}
|
||||
state={SIDEBAR_SCROLL_RESET_STATE}
|
||||
end={end}
|
||||
{...(analyticsChrome ? ANALYTICS_UNMASK_PROPS : {})}
|
||||
aria-label={railAriaLabel}
|
||||
onClick={() => { if (isMobile) setSidebarOpen(false); }}
|
||||
className={({ isActive }) =>
|
||||
|
||||
@@ -3,7 +3,6 @@ import { NavLink } from "@/lib/router";
|
||||
import type { IssueNavigationPrefetchHandlers } from "@/hooks/useIssueNavigationPrefetch";
|
||||
import { SIDEBAR_SCROLL_RESET_STATE } from "../lib/navigation-scroll";
|
||||
import { cn, SIDEBAR_RAIL_HIDDEN_LABEL } from "../lib/utils";
|
||||
import { ANALYTICS_UNMASK_PROPS } from "@/lib/analytics/privacy";
|
||||
import { useSidebar } from "../context/SidebarContext";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import type { LucideIcon } from "lucide-react";
|
||||
@@ -36,8 +35,6 @@ export function useSidebarNavExpanded() {
|
||||
interface SidebarNavItemProps {
|
||||
to: string;
|
||||
label: string;
|
||||
/** The label is fixed product copy, so session replay may show it. */
|
||||
analyticsChrome?: boolean;
|
||||
icon?: LucideIcon;
|
||||
/**
|
||||
* Pre-rendered icon element for rows whose icon isn't a plain Lucide
|
||||
@@ -77,7 +74,6 @@ interface SidebarNavItemProps {
|
||||
export function SidebarNavItem({
|
||||
to,
|
||||
label,
|
||||
analyticsChrome = false,
|
||||
icon: Icon,
|
||||
iconNode,
|
||||
end,
|
||||
@@ -127,7 +123,6 @@ export function SidebarNavItem({
|
||||
to={to}
|
||||
state={SIDEBAR_SCROLL_RESET_STATE}
|
||||
end={end}
|
||||
{...(analyticsChrome ? ANALYTICS_UNMASK_PROPS : {})}
|
||||
aria-label={railAriaLabel}
|
||||
{...linkHandlers}
|
||||
onClick={() => { if (isMobile) setSidebarOpen(false); }}
|
||||
|
||||
@@ -36,21 +36,21 @@ export function SkillsContextualSidebar() {
|
||||
className={contextualSidebarStyles.nav}
|
||||
>
|
||||
<div data-slot="contextual-sidebar-group" className={contextualSidebarStyles.group}>
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={SKILLS_NAVIGATION_HREFS.installed}
|
||||
label="Installed"
|
||||
icon={Library}
|
||||
active={activeView === "installed"}
|
||||
end
|
||||
/>
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={SKILLS_NAVIGATION_HREFS.discover}
|
||||
label="Discover"
|
||||
icon={Compass}
|
||||
active={activeView === "discover"}
|
||||
end
|
||||
/>
|
||||
<SidebarNavItem analyticsChrome to={SKILLS_NAVIGATION_HREFS.sources} label="Sources" icon={GithubIcon} active={activeView === "sources"} />
|
||||
<SidebarNavItem to={SKILLS_NAVIGATION_HREFS.sources} label="Sources" icon={GithubIcon} active={activeView === "sources"} />
|
||||
</div>
|
||||
|
||||
<div data-slot="contextual-sidebar-section" className={contextualSidebarStyles.section}>
|
||||
@@ -67,7 +67,7 @@ export function SkillsContextualSidebar() {
|
||||
Skills you create, edit, and test.
|
||||
</p>
|
||||
<div data-slot="contextual-sidebar-group" className={contextualSidebarStyles.group}>
|
||||
<SidebarNavItem analyticsChrome
|
||||
<SidebarNavItem
|
||||
to={SKILLS_NAVIGATION_HREFS.authored}
|
||||
label="My Skills"
|
||||
icon={PencilRuler}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { SubscriptionCostReport } from "@paperclipai/shared";
|
||||
import { SubscriptionCostCard } from "./SubscriptionCostCard";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
const mocks = vi.hoisted(() => ({ update: vi.fn(), link: vi.fn() }));
|
||||
vi.mock("../api/subscriptions", () => ({ subscriptionsApi: mocks }));
|
||||
@@ -132,4 +133,14 @@ describe("subscription costs", () => {
|
||||
await click("Link accounts");
|
||||
await vi.waitFor(() => expect(mocks.link).toHaveBeenCalledWith("company", "account-1", "account-2", 0, 3));
|
||||
});
|
||||
it("masks subscription account and owner names in session replay", async () => {
|
||||
const report = fixture();
|
||||
report.accounts[0] = { ...report.accounts[0], name: "Thistlewood Claude", ownerName: "Marisol Quenby" };
|
||||
report.accounts.push({ ...report.accounts[0], id: "account-2", name: "Larkspur Claude seat", price: { ...report.accounts[0].price, revision: 3 } });
|
||||
await render(report); await click("View details");
|
||||
expect(replayLeaks("Thistlewood Claude", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Marisol Quenby", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
await click("Edit price");
|
||||
expect(replayLeaks("Larkspur Claude seat", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
});
|
||||
});
|
||||
@@ -2,13 +2,14 @@ import { useState } from "react";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { SUBSCRIPTION_CURRENCIES, centsToUsd, usdToCents, type SubscriptionAccountReport, type SubscriptionCostReport, type SubscriptionUsage } from "@paperclipai/shared";
|
||||
import { subscriptionsApi } from "../api/subscriptions";
|
||||
import { formatCents, formatDateTime, formatTokens, providerDisplayName } from "../lib/utils";
|
||||
import { cn, formatCents, formatDateTime, formatTokens, providerDisplayName } from "../lib/utils";
|
||||
import { Button } from "./ui/button";
|
||||
import { Badge } from "./ui/badge";
|
||||
import { Card } from "./ui/card";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "./ui/dialog";
|
||||
import { Input } from "./ui/input";
|
||||
import { Label } from "./ui/label";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export function subscriptionMoney(cents: string, currency: string) {
|
||||
return currency === "USD" ? formatCents(Number(cents))
|
||||
@@ -55,7 +56,7 @@ function SubscriptionEditor({ account, accounts, companyId, onDone }: {
|
||||
</form>
|
||||
{targets.length > 0 && <div className="space-y-2 border-t border-border pt-4">
|
||||
<Label htmlFor="subscription-link">Same subscription as another account?</Label>
|
||||
<select id="subscription-link" className={selectClass} value={targetId} onChange={event => setTargetId(event.target.value)}><option value="">Choose an account</option>{targets.map(row => <option key={row.id} value={row.id}>{row.name} · {row.price.plan}</option>)}</select>
|
||||
<select id="subscription-link" className={cn(selectClass, ANALYTICS_MASK_CLASS)} value={targetId} onChange={event => setTargetId(event.target.value)}><option value="">Choose an account</option>{targets.map(row => <option key={row.id} value={row.id}>{row.name} · {row.price.plan}</option>)}</select>
|
||||
<p className="text-xs text-muted-foreground">Linking counts these accounts once, combines their Paperclip usage, and keeps the selected account’s price. Only link the same subscription or paid seat.</p>
|
||||
{link.error && <p role="alert" className="text-sm text-destructive">Could not link these accounts. Reopen their details and try again.</p>}
|
||||
<Button type="button" variant="outline" disabled={!targetId || busy} onClick={() => link.mutate()}>Link accounts</Button>
|
||||
@@ -97,7 +98,7 @@ export function SubscriptionCostCard({ companyId, report, error, onChanged }: {
|
||||
{report?.accounts.length === 0 && <p className="text-sm text-muted-foreground">No subscriptions are visible to you yet. Connect an AI account or run an agent with a connected subscription.</p>}
|
||||
{report?.accounts.map(account => <div key={account.id} className="space-y-2 border-b border-border pb-4 last:border-0">
|
||||
<div className="flex flex-wrap items-start justify-between gap-3">
|
||||
<div><div className="font-medium">{account.name}</div><div className="text-xs text-muted-foreground">{account.shared ? "Shared" : account.ownerName ?? (account.ownerUserId ? "Account owner" : "Personal accounts")} · {providerDisplayName(account.provider)} · {account.price.plan}</div></div>
|
||||
<div className={ANALYTICS_MASK_CLASS}><div className="font-medium">{account.name}</div><div className="text-xs text-muted-foreground">{account.shared ? "Shared" : account.ownerName ?? (account.ownerUserId ? "Account owner" : "Personal accounts")} · {providerDisplayName(account.provider)} · {account.price.plan}</div></div>
|
||||
<div className="text-right"><div className="font-mono">{account.price.status !== "active" ? account.price.status === "ended" ? "Ended" : "Excluded" : account.price.monthlyCents == null ? "Price unknown" : `${subscriptionMoney(account.price.monthlyCents, account.price.currency)}/month`}</div><div className="text-xs text-muted-foreground">{account.price.source === "catalog" ? "Estimated · before tax" : account.price.source === "user" ? "User supplied" : ""}{account.price.cadence === "year" ? " · annual payment ÷ 12" : ""}</div></div>
|
||||
</div>
|
||||
<SubscriptionTokenUsage usage={account.usage} />
|
||||
|
||||
@@ -6,6 +6,8 @@ import { useTailscaleConnections } from "@/hooks/useTailscaleConnections";
|
||||
import { Link } from "@/lib/router";
|
||||
import { Button } from "./ui/button";
|
||||
import { Field } from "./agent-config-primitives";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export function TailscaleSshMachine(props: {
|
||||
companyId: string; connectionId: string; deviceId: string;
|
||||
@@ -32,7 +34,7 @@ export function TailscaleSshMachine(props: {
|
||||
<p className="text-sm text-muted-foreground"><Link className="underline" to="/apps/tailscale">Manage Tailscale connector</Link></p>
|
||||
{showConnectionSelector ? <div className="flex items-center gap-3">
|
||||
<Field label="Tailnet connection">
|
||||
<select className="w-full rounded-md border border-border bg-transparent px-2.5 py-1.5 text-sm" value={props.connectionId}
|
||||
<select className={cn("w-full rounded-md border border-border bg-transparent px-2.5 py-1.5 text-sm", ANALYTICS_MASK_CLASS)} value={props.connectionId}
|
||||
onChange={event => props.onChange({ connectionId: event.target.value, deviceId: "", host: "" })}>
|
||||
<option value="">Choose a connection</option>
|
||||
{props.connectionId && !connected.some(connection => connection.id === props.connectionId) ? <option value={props.connectionId} disabled>Unavailable connection</option> : null}
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { DecisionOutcome } from "@/api/decisions";
|
||||
import type { DecisionHistoryItem } from "@paperclipai/shared";
|
||||
import { CoordinatorDecisionReceipt } from "./coordinator/CoordinatorDecisionReceipt";
|
||||
import { TaskDecisionRecord } from "./TaskDecisionRecord";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
const mocks = vi.hoisted(() => ({ get: vi.fn(), resolver: vi.fn() }));
|
||||
vi.mock("@/api/decisions", () => ({ decisionsApi: { get: mocks.get } }));
|
||||
@@ -76,3 +77,13 @@ it("refreshes the mounted record after company decision events invalidate its re
|
||||
expect(mocks.get).toHaveBeenCalledTimes(2);
|
||||
expect(mocks.resolver).toHaveBeenLastCalledWith(expect.objectContaining({ recordedDecision: decision }));
|
||||
});
|
||||
it("keeps the recorded choice, inputs and receipt label out of session replay", async () => {
|
||||
await act(async () => root.render(<QueryClientProvider client={client}><MemoryRouter initialEntries={["/ORG/issues/ORG-1#decision-decision-1"]}>
|
||||
<CoordinatorDecisionReceipt item={{ href: "/ORG/issues/ORG-1#decision-decision-1", label: "Own blog first" } as DecisionHistoryItem} onOpen={() => {}} />
|
||||
<TaskDecisionRecord companyId="company" issueId="task-1" viewerId="person" />
|
||||
</MemoryRouter></QueryClientProvider>));
|
||||
await vi.waitFor(() => expect(host.textContent).toContain("The draft is ready"));
|
||||
expect(replayLeaks("Own blog first", host)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("The draft is ready", host)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Decision record", host)).toEqual({ rendered: true, recorded: true });
|
||||
});
|
||||
@@ -7,6 +7,8 @@ import { queryKeys } from "@/lib/queryKeys";
|
||||
import { taskChatHashAnchor } from "./task-chat/scroll-navigation";
|
||||
import { DecisionResolver } from "./DecisionResolver";
|
||||
import { Button } from "./ui/button";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/** A selected Decisions-v1 record belongs to its task, not a second history tab. */
|
||||
export function TaskDecisionRecord({ companyId, issueId, viewerId, agentMap }: {
|
||||
@@ -28,7 +30,7 @@ export function TaskDecisionRecord({ companyId, issueId, viewerId, agentMap }: {
|
||||
{["loading", "reconnecting"].includes(recordView.kind) ? <p role="status" className="text-sm text-muted-foreground">Loading decision…</p> : (recordView.kind === "error") ? (
|
||||
<div role="alert" className="text-sm"><p>Could not load this decision.</p><Button size="sm" variant="ghost" onClick={() => void record.refetch()}>Retry</Button></div>
|
||||
) : !matchesTask ? <p role="alert" className="text-sm text-muted-foreground">This decision is not available in this task.</p> : <>
|
||||
{decision.status !== "open" ? <dl className="space-y-2 text-sm">
|
||||
{decision.status !== "open" ? <dl className={cn("space-y-2 text-sm", ANALYTICS_MASK_CLASS)}>
|
||||
<div><dt className="text-muted-foreground">Recorded choice</dt><dd>{choice?.label ?? (decision.chosenOptionId === "dismissed" ? "Dismissed" : decision.status)}</dd></div>
|
||||
{(decision.inputs ?? []).filter((input) => decision.inputValues?.[input.id] !== undefined).map((input) => <div key={input.id}>
|
||||
<dt className="text-muted-foreground">{input.label}</dt><dd className="whitespace-pre-wrap">{decision.inputValues![input.id]}</dd>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { createRoot } from "react-dom/client";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { ToastProvider, useToastActions, type ToastInput } from "../context/ToastContext";
|
||||
import { ToastViewport } from "./ToastViewport";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
|
||||
vi.stubGlobal("requestAnimationFrame", (callback: () => void) => setTimeout(callback, 0));
|
||||
@@ -25,3 +26,14 @@ describe("notification avatars", () => {
|
||||
} finally { act(() => root.unmount()); }
|
||||
});
|
||||
});
|
||||
describe("toast session replay", () => {
|
||||
it("masks both the title and the body", () => {
|
||||
const container = document.createElement("div");
|
||||
const root = createRoot(container);
|
||||
try {
|
||||
act(() => root.render(<ToastProvider><Notify toast={{ title: "Default set to ops@globex.com", body: "Globex workspace connected" }} /></ToastProvider>));
|
||||
expect(replayLeaks("ops@globex.com", container)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Globex workspace connected", container)).toEqual({ rendered: true, recorded: false });
|
||||
} finally { act(() => root.unmount()); }
|
||||
});
|
||||
});
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
type ToastTone,
|
||||
} from "../context/ToastContext";
|
||||
import { cn } from "../lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
const toneClasses: Record<ToastTone, string> = {
|
||||
info: "border-sky-300 bg-sky-50 text-sky-900 dark:border-sky-500/25 dark:bg-sky-950/60 dark:text-sky-100",
|
||||
@@ -61,7 +62,7 @@ function AnimatedToast({
|
||||
) : (
|
||||
<span className={cn("mt-1 h-2 w-2 shrink-0 rounded-full", toneDotClasses[toast.tone])} />
|
||||
)}
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className={cn("min-w-0 flex-1", ANALYTICS_MASK_CLASS)}>
|
||||
<p className="text-sm font-semibold leading-5">{toast.title}</p>
|
||||
{toast.body && (
|
||||
<p className="mt-1 text-xs leading-4 opacity-70">
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
||||
import { EnforcementBanner } from "@/components/EnforcementBanner";
|
||||
import { CapabilityBadges, DecisionBadge, RiskBadge } from "@/pages/tools/shared";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/**
|
||||
* Action approval card (PAP-10787 / PAP-10778, surfaces 11/12/99).
|
||||
@@ -267,7 +268,7 @@ export function ActionCard({
|
||||
{/* JSON input */}
|
||||
<div className="space-y-1">
|
||||
<p className="text-xs font-medium uppercase tracking-normal text-muted-foreground">Input</p>
|
||||
<pre className="overflow-x-auto rounded-md border border-border bg-muted/40 p-3 font-mono text-xs leading-relaxed text-foreground">
|
||||
<pre className={cn("overflow-x-auto rounded-md border border-border bg-muted/40 p-3 font-mono text-xs leading-relaxed text-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{json}
|
||||
</pre>
|
||||
</div>
|
||||
@@ -275,7 +276,7 @@ export function ActionCard({
|
||||
{/* Why I'm asking */}
|
||||
<div className="space-y-1">
|
||||
<p className="text-xs font-medium uppercase tracking-normal text-muted-foreground">Why I'm asking</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
<p className={cn("text-sm text-muted-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{reason}
|
||||
{policyNumber != null ? (
|
||||
<>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// @vitest-environment jsdom
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { afterEach, expect, it, vi } from "vitest";
|
||||
import type { ConnectionGrant } from "@paperclipai/shared";
|
||||
import { AiConnectionAccountControls } from "./AiConnectionAccountControls";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
afterEach(() => { document.body.innerHTML = ""; });
|
||||
|
||||
it("masks the account label line in session replay", () => {
|
||||
document.body.innerHTML = renderToStaticMarkup(<AiConnectionAccountControls
|
||||
account={{ id: "connection", grantId: "grant", companyId: "company", provider: "openai", method: "subscription",
|
||||
name: "Team ChatGPT", accountLabel: "tamsin.vale@example.test", ownership: "shared", status: "connected" }}
|
||||
grant={{ id: "grant", capabilities: { canRevoke: true, canEditAudience: false } } as ConnectionGrant}
|
||||
currentUserId="user" onMakeDefault={vi.fn()} onReconnect={vi.fn()} onRevoke={vi.fn()} />);
|
||||
expect(replayLeaks("tamsin.vale@example.test")).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Reconnect")).toEqual({ rendered: true, recorded: true });
|
||||
});
|
||||
@@ -8,6 +8,7 @@ import { AI_PROVIDERS, type AiConnectionSummary } from "./model";
|
||||
import { describeError } from "@/api/errors";
|
||||
import { AiDefaultCrown } from "./AiConnectionDefault";
|
||||
import { isOwnAiAccount } from "./useAiConnectionDefaults";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/** AI-only account controls; identity, access and navigation belong to AppDetail. */
|
||||
export function AiConnectionAccountControls({
|
||||
@@ -48,7 +49,7 @@ export function AiConnectionAccountControls({
|
||||
)}
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="min-w-0 text-sm">
|
||||
<p className="break-words text-xs text-muted-foreground">{account.method === "subscription" ? "Subscription" : "API key"}{account.accountLabel ? ` · ${account.accountLabel}` : ""}</p>
|
||||
<p className={cn("break-words text-xs text-muted-foreground", ANALYTICS_MASK_CLASS)}>{account.method === "subscription" ? "Subscription" : "API key"}{account.accountLabel ? ` · ${account.accountLabel}` : ""}</p>
|
||||
</div>
|
||||
{!readOnly && grant.capabilities?.canRevoke && (
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
|
||||
@@ -7,6 +7,7 @@ import type { AiConnectionAccountIdentity, AiManagedConnectionSummary, Connectio
|
||||
import { AiConnectionAccountDetails } from "./AiConnectionAccountDetails";
|
||||
import { ManagedAiConnectionDetails } from "./ManagedAiConnectionDetails";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
vi.mock("@/lib/router", () => ({ useNavigate: () => vi.fn() }));
|
||||
vi.mock("@/api/auth", () => ({ authApi: { getSession: vi.fn(async () => ({ user: { id: "user" } })) } }));
|
||||
@@ -156,3 +157,10 @@ it("reuses recent identity observations and invalidates them after reconnect", a
|
||||
expect(host.textContent).toContain("new-account@example.test");
|
||||
expect(host.textContent).not.toContain("avery@example.test");
|
||||
});
|
||||
|
||||
it("masks the provider account and organization labels in session replay", async () => {
|
||||
observation = { ...known, accountLabel: "perrin.ashdown@example.test", organizationLabel: "Brackenridge Analytics" };
|
||||
await render();
|
||||
expect(replayLeaks("perrin.ashdown@example.test", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Brackenridge Analytics", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
});
|
||||
@@ -5,6 +5,8 @@ import { describeError } from "@/api/errors";
|
||||
import { retryTransientOnly } from "@/lib/query-client";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { AI_PROVIDERS, aiMethodLabel } from "./model";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/** Provider profile loading is independent of account access and maintenance controls. */
|
||||
export function AiConnectionAccountDetails({ account, grant }: {
|
||||
@@ -28,10 +30,10 @@ export function AiConnectionAccountDetails({ account, grant }: {
|
||||
<h3 className="text-sm font-semibold">Connected account</h3>
|
||||
<dl className="grid grid-cols-2 gap-3 text-sm">
|
||||
<dt className="text-muted-foreground">{AI_PROVIDERS[account.provider].name} account</dt>
|
||||
<dd className="break-words">{accountLabel ?? "Not available"}</dd>
|
||||
<dd className={cn("break-words", ANALYTICS_MASK_CLASS)}>{accountLabel ?? "Not available"}</dd>
|
||||
{(isChatGpt || identity.data?.organizationLabel) && <>
|
||||
<dt className="text-muted-foreground">{isChatGpt ? "ChatGPT workspace" : "Organization"}</dt>
|
||||
<dd className="break-words">{identity.data?.organizationLabel ?? (identity.isPending && canLookUp ? "Checking…" : "Not available")}</dd>
|
||||
<dd className={cn("break-words", ANALYTICS_MASK_CLASS)}>{identity.data?.organizationLabel ?? (identity.isPending && canLookUp ? "Checking…" : "Not available")}</dd>
|
||||
</>}
|
||||
<dt className="text-muted-foreground">Sign-in method</dt>
|
||||
<dd>{aiMethodLabel(account.provider, account.method)}</dd>
|
||||
|
||||
@@ -15,6 +15,7 @@ import { instanceSettingsApi } from "@/api/instanceSettings";
|
||||
import { queryKeys } from "@/lib/queryKeys";
|
||||
import { resolveAdapterTestEnvironmentId, resolveLocalDefaultEnvironmentId, resolveManagedSandboxEnvironmentId } from "@/lib/adapter-test-environment";
|
||||
import { resolveForcedKubernetesEnvironment } from "@/lib/forced-kubernetes-environment";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
type Props = {
|
||||
companyId: string;
|
||||
@@ -87,8 +88,8 @@ function SubscriptionConnectionStep({ companyId, provider, initialMethod, fixedM
|
||||
return <div className="mx-auto w-full min-w-0 max-w-xl space-y-6">
|
||||
{!hideName && <label className="block space-y-2 text-sm">Connection name<Input value={name} onChange={(event) => setName(event.target.value)} disabled={Boolean(connectionId)} /></label>}
|
||||
{!suppliedEnvironmentId && !forced.forced && loginEnvironments.length > 1 && <Select value={environmentId ?? ""} onValueChange={setChosenEnvironment}>
|
||||
<SelectTrigger aria-label="Sign-in environment"><SelectValue placeholder="Sign-in environment" /></SelectTrigger>
|
||||
<SelectContent>{loginEnvironments.map((env) => <SelectItem key={env.id} value={env.id}>{env.name}</SelectItem>)}</SelectContent>
|
||||
<SelectTrigger className={ANALYTICS_MASK_CLASS} aria-label="Sign-in environment"><SelectValue placeholder="Sign-in environment" /></SelectTrigger>
|
||||
<SelectContent className={ANALYTICS_MASK_CLASS}>{loginEnvironments.map((env) => <SelectItem key={env.id} value={env.id}>{env.name}</SelectItem>)}</SelectContent>
|
||||
</Select>}
|
||||
{loadError ? <QueryErrorState size="inline" error={loadError.error} action="prepare sign-in" onRetry={loadError.retry} retrying={loadError.isFetching} />
|
||||
: environmentError ? <p role="alert" className="text-sm text-destructive">{environmentError}</p> : null}
|
||||
@@ -131,8 +132,8 @@ function ApiKeyConnectionStep({ companyId, provider, connectionId, name: initial
|
||||
{save.error && <p role="alert" className="text-sm text-destructive">{describeError(save.error).body}</p>}
|
||||
{copilot && <p className="text-sm text-muted-foreground">Use a personal fine-grained token with Copilot Requests permission. <a className="underline" href="https://docs.github.com/en/copilot/how-tos/copilot-cli/set-up-copilot-cli/authenticate-copilot-cli" target="_blank" rel="noreferrer">GitHub token instructions</a>. Verification discovers models in the selected environment and sends no model prompt. Repository access uses a separate connection.</p>}
|
||||
{copilot && !suppliedEnvironmentId && <Select value={environmentId ?? ""} onValueChange={setChosenEnvironment} disabled={preparing || save.isPending}>
|
||||
<SelectTrigger aria-label="Copilot execution environment"><SelectValue placeholder="Execution environment" /></SelectTrigger>
|
||||
<SelectContent>{(envs.data ?? []).filter(env => env.status === "active").map(env => <SelectItem key={env.id} value={env.id}>{env.name}</SelectItem>)}</SelectContent>
|
||||
<SelectTrigger className={ANALYTICS_MASK_CLASS} aria-label="Copilot execution environment"><SelectValue placeholder="Execution environment" /></SelectTrigger>
|
||||
<SelectContent className={ANALYTICS_MASK_CLASS}>{(envs.data ?? []).filter(env => env.status === "active").map(env => <SelectItem key={env.id} value={env.id}>{env.name}</SelectItem>)}</SelectContent>
|
||||
</Select>}
|
||||
{environmentError && <p role="alert" className="text-sm text-destructive">{environmentError}</p>}
|
||||
{defaults}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { AI_PROVIDERS } from "./model";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export function AiDefaultCrown({ account }: { account: Pick<AiManagedConnectionSummary, "provider"> }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -16,7 +17,7 @@ export function AiDefaultCrown({ account }: { account: Pick<AiManagedConnectionS
|
||||
<Crown className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>{label}</TooltipContent>
|
||||
<TooltipContent className={ANALYTICS_MASK_CLASS}>{label}</TooltipContent>
|
||||
</Tooltip>;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { AiManagedConnectionSummary } from "@paperclipai/shared";
|
||||
import { AiConnectionField, aiProviderForAdapter } from "./AiConnectionField";
|
||||
import { ApiError } from "@/api/client";
|
||||
import type { AiConnectionCredentialStep } from "./AiConnectionCredentialStep";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
const mocks = vi.hoisted(() => ({ list: vi.fn(), setDefault: vi.fn() }));
|
||||
let credentialProps: ComponentProps<typeof AiConnectionCredentialStep> | undefined;
|
||||
@@ -235,3 +236,21 @@ it("shows readable copy with a retry when connections cannot be loaded", async (
|
||||
expect(document.body.textContent).toContain("Reconnect account");
|
||||
expect(document.body.textContent).not.toContain("Retry connections");
|
||||
});
|
||||
|
||||
it("masks the adoption dialog's account label in session replay", async () => {
|
||||
const personal = account({ id: "00000000-0000-4000-8000-000000000011", grantId: "00000000-0000-4000-8000-000000000012", provider: "openai", method: "api_key", name: "OpenAI", accountLabel: "solenne.drake@example.test", status: "connected", isDefault: false });
|
||||
mocks.list.mockResolvedValue({ currentUserId: "owner", connections: [personal], canManageConnections: true });
|
||||
flushSync(() => root.render(<QueryClientProvider client={client}>
|
||||
<AiConnectionField companyId="company" agentId="agent" agentName="Nova" adapterType="codex_local" legacy onChange={onChange} />
|
||||
</QueryClientProvider>));
|
||||
await settle();
|
||||
await click("Choose a managed connection");
|
||||
const trigger = container.querySelector('[role="combobox"][aria-label="Connection"]')!;
|
||||
flushSync(() => trigger.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true })));
|
||||
await settle();
|
||||
flushSync(() => [...document.querySelectorAll<HTMLElement>('[role="option"]')].find(choice => choice.textContent?.includes("solenne.drake@example.test"))!.click());
|
||||
await settle();
|
||||
const dialog = document.querySelector('[role="dialog"]')!;
|
||||
expect(replayLeaks("solenne.drake@example.test", dialog)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Adopt Connections for Nova", dialog)).toEqual({ rendered: true, recorded: false });
|
||||
});
|
||||
@@ -27,6 +27,8 @@ import {
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
} from "@/components/ui/dialog";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function aiProviderForAdapter(
|
||||
adapterType: string,
|
||||
@@ -143,7 +145,7 @@ export function AiConnectionField({
|
||||
)}
|
||||
{(compatiblePools.length > 0 || value?.mode === "router") && <label className="block space-y-1 text-sm">
|
||||
AI connection
|
||||
<select className="block w-full rounded-md border bg-background px-3 py-2" disabled={readOnly} value={value?.mode === "router" ? value.connectionId : ""} onChange={event => {
|
||||
<select className={cn("block w-full rounded-md border bg-background px-3 py-2", ANALYTICS_MASK_CLASS)} disabled={readOnly} value={value?.mode === "router" ? value.connectionId : ""} onChange={event => {
|
||||
if (event.target.value) changeBinding({ mode: "router", connectionId: event.target.value });
|
||||
else changeBinding({ mode: "responsible_user", provider, method });
|
||||
}}>
|
||||
@@ -178,14 +180,14 @@ export function AiConnectionField({
|
||||
if (!open) setPendingAdoption(undefined);
|
||||
}}
|
||||
>
|
||||
<DialogContent className="max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl" onCloseAutoFocus={restoreFocus}>
|
||||
<DialogContent className={cn("max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl", ANALYTICS_MASK_CLASS)} onCloseAutoFocus={restoreFocus}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{pendingAdoption?.mode === "router" ? `Use ${accounts.data?.pools?.find(pool => pool.id === pendingAdoption.connectionId)?.name ?? "this pool"}?` : `Adopt Connections for ${agentName}`}</DialogTitle>
|
||||
<DialogTitle className={ANALYTICS_MASK_CLASS}>{pendingAdoption?.mode === "router" ? `Use ${accounts.data?.pools?.find(pool => pool.id === pendingAdoption.connectionId)?.name ?? "this pool"}?` : `Adopt Connections for ${agentName}`}</DialogTitle>
|
||||
<DialogDescription>
|
||||
{pendingAdoption?.mode === "router" ? "Reset existing sessions that use an account outside this pool." : "Saving validates access to the selected connection. Existing sessions keep their account or require an explicit reset before adoption."}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
{pendingAdoption?.mode !== "router" && <p className="text-sm">
|
||||
{pendingAdoption?.mode !== "router" && <p className={cn("text-sm", ANALYTICS_MASK_CLASS)}>
|
||||
{pendingAdoption?.mode === "responsible_user"
|
||||
? `Responsible user’s default. For you: ${pendingAccount ? aiConnectionDisplayLabel(pendingAccount) : "Not connected"}. Other users use their own default.`
|
||||
: pendingAccount && aiConnectionDisplayLabel(pendingAccount)}
|
||||
@@ -213,7 +215,7 @@ export function AiConnectionField({
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
<Dialog open={connecting} onOpenChange={(open) => { if (!selectDefault.isPending) setConnecting(open); }}>
|
||||
<DialogContent className="max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl" onCloseAutoFocus={restoreFocus}>
|
||||
<DialogContent className={cn("max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl", ANALYTICS_MASK_CLASS)} onCloseAutoFocus={restoreFocus}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{reconnecting ? "Reconnect account" : "Connect account"}</DialogTitle>
|
||||
<DialogDescription>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// @vitest-environment jsdom
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { afterEach, expect, it } from "vitest";
|
||||
import { AiConnectionIdentity } from "./AiConnectionIdentity";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
afterEach(() => { document.body.innerHTML = ""; });
|
||||
|
||||
it("masks the connection name and account label in session replay", () => {
|
||||
document.body.innerHTML = renderToStaticMarkup(<AiConnectionIdentity connection={{
|
||||
id: "connection", grantId: "grant", companyId: "company", provider: "anthropic", method: "subscription",
|
||||
name: "Zephyr Labs Claude", accountLabel: "quill.marten@example.test", ownership: "shared", status: "connected",
|
||||
}} />);
|
||||
expect(replayLeaks("Zephyr Labs Claude")).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("quill.marten@example.test")).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Company shared")).toEqual({ rendered: true, recorded: true });
|
||||
});
|
||||
@@ -5,6 +5,8 @@ import {
|
||||
aiMethodLabel,
|
||||
type AiConnectionSummary,
|
||||
} from "./model";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function AiConnectionIdentity({
|
||||
connection,
|
||||
@@ -17,10 +19,10 @@ export function AiConnectionIdentity({
|
||||
<div className="flex min-w-0 items-start gap-3">
|
||||
<AppLogo name={provider.name} brandKey={connection.provider} logoUrl={provider.logo} size={24} />
|
||||
<div className="flex min-w-0 flex-col gap-1">
|
||||
<span className="break-words text-sm font-medium">
|
||||
<span className={cn("break-words text-sm font-medium", ANALYTICS_MASK_CLASS)}>
|
||||
{connection.name}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
<span className={cn("text-xs text-muted-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{provider.name} ·{" "}
|
||||
{aiMethodLabel(connection.provider, connection.method)}
|
||||
{connection.accountLabel ? ` · ${connection.accountLabel}` : ""}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// @vitest-environment jsdom
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { afterEach, expect, it, vi } from "vitest";
|
||||
import { AiConnectionPicker } from "./AiConnectionPicker";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
afterEach(() => { document.body.innerHTML = ""; });
|
||||
|
||||
it("masks a shared connection's account label in session replay", () => {
|
||||
document.body.innerHTML = renderToStaticMarkup(<AiConnectionPicker
|
||||
requirement={{ companyId: "company", provider: "anthropic" }}
|
||||
connections={[{ id: "connection", grantId: "grant", companyId: "company", provider: "anthropic", method: "api_key",
|
||||
name: "Shared Claude key", accountLabel: "orla.brisk@example.test", ownership: "shared", status: "connected" }]}
|
||||
currentUserId="user" agentId="agent" agentName="Nova" onChange={vi.fn()} onConnect={vi.fn()} />);
|
||||
expect(replayLeaks("orla.brisk@example.test")).toEqual({ rendered: true, recorded: false });
|
||||
});
|
||||
|
||||
it("masks the responsible user's default connection name in session replay", () => {
|
||||
document.body.innerHTML = renderToStaticMarkup(<AiConnectionPicker
|
||||
requirement={{ companyId: "company", provider: "anthropic" }}
|
||||
connections={[{ id: "mine", grantId: "grant", companyId: "company", provider: "anthropic", method: "subscription",
|
||||
name: "Orla's Claude Max", ownership: "personal", ownerUserId: "user", isDefault: true, status: "connected" }]}
|
||||
currentUserId="user" agentId="agent" agentName="Nova" onChange={vi.fn()} onConnect={vi.fn()} />);
|
||||
expect(replayLeaks("Orla's Claude Max")).toEqual({ rendered: true, recorded: false });
|
||||
});
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
type AiConnectionRequirement,
|
||||
type AiConnectionSummary,
|
||||
} from "./model";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export interface AiConnectionPickerProps {
|
||||
requirement: AiConnectionRequirement;
|
||||
@@ -110,13 +111,13 @@ export function AiConnectionPicker({
|
||||
selectedId={value?.mode === "responsible_user" ? "responsible_user" : value?.connectionId}
|
||||
choices={[
|
||||
{ id: "responsible_user", name: "Responsible user’s connection", description: <>
|
||||
<span className="block">For you: {personalDefault?.name ?? "Not connected"}</span>
|
||||
<span className="block">For you: <span className={ANALYTICS_MASK_CLASS}>{personalDefault?.name ?? "Not connected"}</span></span>
|
||||
<span className="block">Other users’ tasks use their own {AI_PROVIDERS[requirement.provider].name} connection.</span>
|
||||
</> },
|
||||
...compatible.filter((connection) => connection.ownership === "shared").map((connection) => ({
|
||||
id: connection.id, name: connection.name,
|
||||
disabled: Boolean(aiConnectionProblem(connection)),
|
||||
description: <>Company shared · {aiMethodLabel(connection.provider, connection.method)}{connection.accountLabel ? ` · ${connection.accountLabel}` : ""}{aiConnectionProblem(connection) ? ` · ${aiConnectionProblem(connection)}` : ""}</>,
|
||||
description: <>Company shared · {aiMethodLabel(connection.provider, connection.method)}{connection.accountLabel ? <span className={ANALYTICS_MASK_CLASS}>{` · ${connection.accountLabel}`}</span> : ""}{aiConnectionProblem(connection) ? ` · ${aiConnectionProblem(connection)}` : ""}</>,
|
||||
})),
|
||||
]}
|
||||
onSelect={(id) => {
|
||||
|
||||
@@ -26,6 +26,8 @@ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent,
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
||||
import { AiConnectionUsagePanel } from "./AiConnectionUsagePanel";
|
||||
import { AI_PROVIDERS, aiMethodLabel } from "./model";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
const configOf = ({ name, enabled, members, mode, thresholdPercent }: AiConnectionPoolConfig): AiConnectionPoolConfig => ({ name, enabled, members, mode, thresholdPercent });
|
||||
const emptyConfig = (): AiConnectionPoolConfig => ({ name: "AI connection pool", enabled: false, members: [], mode: "round_robin", thresholdPercent: 90 });
|
||||
@@ -134,7 +136,7 @@ function PoolConnector({ companyId, pluginKey, connection }: { companyId: string
|
||||
return <li key={member.id} className="flex items-center gap-3 px-4 py-3">
|
||||
<span className="w-4 text-center text-xs text-muted-foreground">{index + 1}</span>
|
||||
<AppLogo name={provider.name} logoUrl={provider.logo} size={32} />
|
||||
<div className="min-w-0 flex-1"><p className="truncate text-sm font-medium">{account?.name ?? "Connection unavailable"}</p><p className="text-xs text-muted-foreground">{account ? aiMethodLabel(account.provider, account.method) : "Restore access to this connection."}</p>{connection && draft.mode === "usage_aware" && account && <details className="mt-2 text-xs text-muted-foreground"><summary className="cursor-pointer">Usage</summary><div className="pt-3">{inspectionError ? <p role="status">{inspectionError}</p> : <AiConnectionUsagePanel account={account} cachedOnly observation={inspection[member.id]?.usage} />}</div></details>}</div>
|
||||
<div className="min-w-0 flex-1"><p className={cn("truncate text-sm font-medium", ANALYTICS_MASK_CLASS)}>{account?.name ?? "Connection unavailable"}</p><p className="text-xs text-muted-foreground">{account ? aiMethodLabel(account.provider, account.method) : "Restore access to this connection."}</p>{connection && draft.mode === "usage_aware" && account && <details className="mt-2 text-xs text-muted-foreground"><summary className="cursor-pointer">Usage</summary><div className="pt-3">{inspectionError ? <p role="status">{inspectionError}</p> : <AiConnectionUsagePanel account={account} cachedOnly observation={inspection[member.id]?.usage} />}</div></details>}</div>
|
||||
<div className="flex shrink-0 items-center gap-1">
|
||||
<Button type="button" variant="ghost" size="icon-sm" disabled={disabled || index === 0} aria-label={`Move ${account?.name ?? "connection"} up`} onClick={() => move(index, -1)}><ArrowUp className="size-4" /></Button>
|
||||
<Button type="button" variant="ghost" size="icon-sm" disabled={disabled || index === draft.members.length - 1} aria-label={`Move ${account?.name ?? "connection"} down`} onClick={() => move(index, 1)}><ArrowDown className="size-4" /></Button>
|
||||
@@ -147,12 +149,12 @@ function PoolConnector({ companyId, pluginKey, connection }: { companyId: string
|
||||
return <div className={connection ? "space-y-6" : "mx-auto max-w-2xl"}>
|
||||
{connection ? <div className="flex items-start justify-between gap-4">
|
||||
<AppDetailHeader appName={draft.name} connection={connection} logoEntry={logoEntry} brandKey={logoEntry.slug} allowRemoteLogo canRename={!disabled} status={editing?.enabled ? { label: "Connected", tone: "connected" } : { label: "Paused", tone: "paused" }} actionCount={null} renaming={renaming} nameDraft={nameDraft} renamePending={disabled} onNameDraftChange={setNameDraft} onRenameStart={() => { if (!disabled) { setNameDraft(draft.name); setRenaming(true); } }} onRenameCancel={() => setRenaming(false)} onRenameSubmit={value => void save({ ...draft, name: value })} />
|
||||
<DropdownMenu><DropdownMenuTrigger asChild><Button variant="ghost" size="icon-sm" aria-label="Manage connection pool"><MoreHorizontal className="size-4" /></Button></DropdownMenuTrigger><DropdownMenuContent align="end"><DropdownMenuItem variant="destructive" disabled={busy || !canManage} onSelect={() => { setError(""); setRemoving(true); }}><Trash2 />Remove connection</DropdownMenuItem></DropdownMenuContent></DropdownMenu>
|
||||
<DropdownMenu><DropdownMenuTrigger asChild><Button variant="ghost" size="icon-sm" aria-label="Manage connection pool"><MoreHorizontal className="size-4" /></Button></DropdownMenuTrigger><DropdownMenuContent className={ANALYTICS_MASK_CLASS} align="end"><DropdownMenuItem variant="destructive" disabled={busy || !canManage} onSelect={() => { setError(""); setRemoving(true); }}><Trash2 />Remove connection</DropdownMenuItem></DropdownMenuContent></DropdownMenu>
|
||||
</div> : <StepHeader title="Add a connection pool" subtitle={step === 0 ? "Choose connections you already use." : "New tasks rotate in this order."} step="connect" activeIndex={step} labels={["Connections", "Order"]} appIdentity={{ name, logoUrl: logoEntry.branding.logoUrl }} />}
|
||||
{unavailable && <p role="alert" className="text-sm text-destructive">{entry?.availability?.reason ?? "Enable the connection pool plugin in Plugins."}</p>}
|
||||
{!canManage && <p role="alert" className="text-sm text-muted-foreground">A connection manager can edit this pool.</p>}
|
||||
{error && !removing && <p role="alert" className="text-sm text-destructive">{error}</p>}
|
||||
{!connection && step === 0 ? <ConnectionPicker accounts={accounts} selected={draft.members} disabled={disabled} onChange={members => setDraft({ ...draft, members })} onRefresh={() => void accountsQuery.refetch()} /> : <div className="space-y-4">
|
||||
{!connection && step === 0 ? <ConnectionPicker accounts={accounts} selected={draft.members} disabled={disabled} onChange={members => setDraft({ ...draft, members })} onRefresh={() => void accountsQuery.refetch()} /> : <div className={cn("space-y-4", ANALYTICS_MASK_CLASS)}>
|
||||
{connection && <div className="flex items-center justify-between gap-3"><h2 className="text-sm font-semibold">Connections</h2><Button variant="outline" size="sm" disabled={disabled} onClick={() => { setPickerMembers(draft.members); setPickerOpen(true); }}><Plus className="size-4" />Add connections</Button></div>}
|
||||
{orderedMembers}
|
||||
<p className="text-xs text-muted-foreground">{connection ? "Order changes apply to new tasks." : "Created paused. Enable it when you’re ready."}</p>
|
||||
@@ -161,7 +163,7 @@ function PoolConnector({ companyId, pluginKey, connection }: { companyId: string
|
||||
<details className="rounded-lg border border-border"><summary className="cursor-pointer px-4 py-3 text-sm font-medium">Advanced</summary><fieldset disabled={disabled} className="space-y-4 border-t border-border p-4">
|
||||
<label className="flex items-center gap-2 text-sm"><Checkbox checked={draft.mode === "usage_aware"} onCheckedChange={checked => setDraft({ ...draft, mode: checked ? "usage_aware" : "round_robin" })} />Skip connections near their usage limit</label>
|
||||
{draft.mode === "usage_aware" && <label className="flex items-center gap-3 text-sm">Skip at<Input className="w-20" aria-label="Usage threshold" type="number" min={1} max={100} step={1} value={draft.thresholdPercent} onChange={event => setDraft({ ...draft, thresholdPercent: Number(event.target.value) })} />% usage</label>}
|
||||
{draft.members.map((member, index) => <div key={member.id} className="space-y-2"><p className="text-sm font-medium">{accounts.find(account => account.id === member.binding.connectionId)?.name ?? "Connection unavailable"}</p><div className="grid gap-3 sm:grid-cols-2"><label className="space-y-1 text-xs text-muted-foreground">Model<Input aria-label={`Model for connection ${index + 1}`} value={member.profile.model} onChange={event => setDraft({ ...draft, members: draft.members.map(row => row.id === member.id ? { ...row, profile: { ...row.profile, model: event.target.value } } : row) })} /></label><label className="space-y-1 text-xs text-muted-foreground">Effort (optional)<Input aria-label={`Effort for connection ${index + 1}`} value={member.profile.effort ?? ""} onChange={event => { const { effort: _old, ...profile } = member.profile; setDraft({ ...draft, members: draft.members.map(row => row.id === member.id ? { ...row, profile: { ...profile, ...(event.target.value.trim() ? { effort: event.target.value.trim() } : {}) } } : row) }); }} /></label></div></div>)}
|
||||
{draft.members.map((member, index) => <div key={member.id} className="space-y-2"><p className={cn("text-sm font-medium", ANALYTICS_MASK_CLASS)}>{accounts.find(account => account.id === member.binding.connectionId)?.name ?? "Connection unavailable"}</p><div className="grid gap-3 sm:grid-cols-2"><label className="space-y-1 text-xs text-muted-foreground">Model<Input aria-label={`Model for connection ${index + 1}`} value={member.profile.model} onChange={event => setDraft({ ...draft, members: draft.members.map(row => row.id === member.id ? { ...row, profile: { ...row.profile, model: event.target.value } } : row) })} /></label><label className="space-y-1 text-xs text-muted-foreground">Effort (optional)<Input aria-label={`Effort for connection ${index + 1}`} value={member.profile.effort ?? ""} onChange={event => { const { effort: _old, ...profile } = member.profile; setDraft({ ...draft, members: draft.members.map(row => row.id === member.id ? { ...row, profile: { ...profile, ...(event.target.value.trim() ? { effort: event.target.value.trim() } : {}) } } : row) }); }} /></label></div></div>)}
|
||||
</fieldset></details>
|
||||
<section aria-labelledby="pool-used-by" className="space-y-3">
|
||||
<h2 id="pool-used-by" className="text-sm font-semibold">Used by</h2>
|
||||
@@ -176,17 +178,17 @@ function PoolConnector({ companyId, pluginKey, connection }: { companyId: string
|
||||
<Button variant="ghost" disabled={busy} onClick={() => connection ? navigate("/apps") : step ? setStep(0) : navigate("/apps")}>{!connection && step ? "Back" : "Cancel"}</Button>
|
||||
<Button disabled={disabled || draft.members.length === 0 || !Number.isInteger(draft.thresholdPercent) || draft.thresholdPercent < 1 || draft.thresholdPercent > 100} onClick={() => !connection && step === 0 ? setStep(1) : void save()}>{busy && <Loader2 className="size-4 animate-spin" />}{busy ? "Saving…" : connection ? "Save changes" : step ? "Create pool" : "Continue"}</Button>
|
||||
</div>
|
||||
<Dialog open={pickerOpen} onOpenChange={setPickerOpen}><DialogContent className="sm:max-w-2xl"><DialogHeader><DialogTitle>Add connections</DialogTitle><DialogDescription>Choose connections you already use.</DialogDescription></DialogHeader><ConnectionPicker accounts={accounts} selected={pickerMembers} disabled={disabled} onChange={setPickerMembers} onRefresh={() => void accountsQuery.refetch()} /><div className="flex items-center justify-between gap-3"><Button variant="ghost" onClick={() => setPickerOpen(false)}>Cancel</Button><Button onClick={() => { setDraft({ ...draft, members: pickerMembers }); setPickerOpen(false); }}>Done</Button></div></DialogContent></Dialog>
|
||||
<AlertDialog open={removing} onOpenChange={open => { if (!busy) setRemoving(open); }}><AlertDialogContent><AlertDialogHeader><AlertDialogTitle>Remove {draft.name}?</AlertDialogTitle><AlertDialogDescription>The connections in this pool are kept.</AlertDialogDescription></AlertDialogHeader>{error && <p role="alert" className="text-sm text-destructive">{error}</p>}<AlertDialogFooter className="sm:justify-between"><AlertDialogCancel disabled={busy}>Cancel</AlertDialogCancel><AlertDialogAction className="bg-destructive text-destructive-foreground hover:bg-destructive/90" disabled={busy} onClick={event => { event.preventDefault(); void remove(); }}>{busy ? "Removing…" : "Remove connection"}</AlertDialogAction></AlertDialogFooter></AlertDialogContent></AlertDialog>
|
||||
<Dialog open={pickerOpen} onOpenChange={setPickerOpen}><DialogContent className={cn("sm:max-w-2xl", ANALYTICS_MASK_CLASS)}><DialogHeader><DialogTitle>Add connections</DialogTitle><DialogDescription>Choose connections you already use.</DialogDescription></DialogHeader><ConnectionPicker accounts={accounts} selected={pickerMembers} disabled={disabled} onChange={setPickerMembers} onRefresh={() => void accountsQuery.refetch()} /><div className="flex items-center justify-between gap-3"><Button variant="ghost" onClick={() => setPickerOpen(false)}>Cancel</Button><Button onClick={() => { setDraft({ ...draft, members: pickerMembers }); setPickerOpen(false); }}>Done</Button></div></DialogContent></Dialog>
|
||||
<AlertDialog open={removing} onOpenChange={open => { if (!busy) setRemoving(open); }}><AlertDialogContent className={ANALYTICS_MASK_CLASS}><AlertDialogHeader><AlertDialogTitle className={ANALYTICS_MASK_CLASS}>Remove {draft.name}?</AlertDialogTitle><AlertDialogDescription>The connections in this pool are kept.</AlertDialogDescription></AlertDialogHeader>{error && <p role="alert" className="text-sm text-destructive">{error}</p>}<AlertDialogFooter className="sm:justify-between"><AlertDialogCancel disabled={busy}>Cancel</AlertDialogCancel><AlertDialogAction className="bg-destructive text-destructive-foreground hover:bg-destructive/90" disabled={busy} onClick={event => { event.preventDefault(); void remove(); }}>{busy ? "Removing…" : "Remove connection"}</AlertDialogAction></AlertDialogFooter></AlertDialogContent></AlertDialog>
|
||||
</div>;
|
||||
}
|
||||
function ConnectionPicker({ accounts, selected, disabled, onChange, onRefresh }: { accounts: AiManagedConnectionSummary[]; selected: AiConnectionPoolMember[]; disabled: boolean; onChange: (members: AiConnectionPoolMember[]) => void; onRefresh: () => void }) {
|
||||
const [search, setSearch] = useState("");
|
||||
const filtered = accounts.filter(account => `${account.name} ${AI_PROVIDERS[account.provider].name}`.toLowerCase().includes(search.toLowerCase()));
|
||||
return <div className="space-y-4">
|
||||
return <div className={cn("space-y-4", ANALYTICS_MASK_CLASS)}>
|
||||
<div className="relative"><Search className="pointer-events-none absolute left-3 top-3 size-4 text-muted-foreground" /><Input aria-label="Search connections" placeholder="Search connections…" value={search} onChange={event => setSearch(event.target.value)} className="pl-9" /></div>
|
||||
<div className="max-h-80 overflow-y-auto rounded-lg border border-border divide-y divide-border">
|
||||
{filtered.map(account => { const existing = selected.find(member => member.binding.connectionId === account.id); const checked = existing?.binding.grantId === account.grantId; return <label key={account.grantId} className="flex cursor-pointer items-center gap-3 px-4 py-3 hover:bg-accent/50"><Checkbox checked={checked} disabled={disabled || (!checked && (account.status !== "connected" || Boolean(existing)))} onCheckedChange={value => onChange(value ? [...selected, memberOf(account)] : selected.filter(member => member.binding.connectionId !== account.id))} aria-label={account.name} /><AppLogo name={AI_PROVIDERS[account.provider].name} logoUrl={AI_PROVIDERS[account.provider].logo} size={32} /><span className="min-w-0 flex-1"><span className="block truncate text-sm font-medium">{account.name}</span><span className="block text-xs text-muted-foreground">{aiMethodLabel(account.provider, account.method)} · {account.ownership === "shared" ? "Shared" : "Personal"}</span></span>{account.status !== "connected" && <span className="text-xs text-muted-foreground">Needs attention</span>}</label>; })}
|
||||
{filtered.map(account => { const existing = selected.find(member => member.binding.connectionId === account.id); const checked = existing?.binding.grantId === account.grantId; return <label key={account.grantId} className="flex cursor-pointer items-center gap-3 px-4 py-3 hover:bg-accent/50"><Checkbox checked={checked} disabled={disabled || (!checked && (account.status !== "connected" || Boolean(existing)))} onCheckedChange={value => onChange(value ? [...selected, memberOf(account)] : selected.filter(member => member.binding.connectionId !== account.id))} aria-label={account.name} /><AppLogo name={AI_PROVIDERS[account.provider].name} logoUrl={AI_PROVIDERS[account.provider].logo} size={32} /><span className="min-w-0 flex-1"><span className={cn("block truncate text-sm font-medium", ANALYTICS_MASK_CLASS)}>{account.name}</span><span className="block text-xs text-muted-foreground">{aiMethodLabel(account.provider, account.method)} · {account.ownership === "shared" ? "Shared" : "Personal"}</span></span>{account.status !== "connected" && <span className="text-xs text-muted-foreground">Needs attention</span>}</label>; })}
|
||||
{filtered.length === 0 && <p className="px-4 py-6 text-sm text-muted-foreground">{accounts.length ? "No matching connections." : "No AI connections yet."}</p>}
|
||||
</div>
|
||||
<div className="flex items-center justify-between gap-3 text-sm"><Link to="/apps" target="_blank" rel="noopener noreferrer" className="inline-flex items-center gap-1 text-muted-foreground hover:text-foreground">Connect a new account<ExternalLink className="size-3.5" /></Link><Button variant="ghost" size="sm" onClick={onRefresh}>Refresh</Button></div>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// @vitest-environment jsdom
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { afterEach, expect, it } from "vitest";
|
||||
import { AiConnectionPoolRunDetails } from "./AiConnectionPoolRunDetails";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
afterEach(() => { document.body.innerHTML = ""; });
|
||||
|
||||
it("masks the pinned pool account name in session replay", () => {
|
||||
document.body.innerHTML = renderToStaticMarkup(<AiConnectionPoolRunDetails context={{
|
||||
aiRouterSelection: { binding: { provider: "anthropic" }, runtimeConfig: { model: "claude-sonnet" }, notes: [] },
|
||||
aiConnection: { accountName: "Juniper Ops Pool Account", connectionId: "connection" },
|
||||
}} />);
|
||||
expect(replayLeaks("Juniper Ops Pool Account")).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("claude-sonnet")).toEqual({ rendered: true, recorded: true });
|
||||
});
|
||||
@@ -1,4 +1,6 @@
|
||||
import type { AiConnectionRouterSelection } from "@paperclipai/shared";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function AiConnectionPoolRunDetails({ context }: { context: Record<string, unknown> | null }) {
|
||||
const selection = context?.aiRouterSelection as AiConnectionRouterSelection | undefined;
|
||||
@@ -7,7 +9,7 @@ export function AiConnectionPoolRunDetails({ context }: { context: Record<string
|
||||
const config = selection.runtimeConfig;
|
||||
const effort = config.modelReasoningEffort ?? config.reasoningEffort ?? config.effort ?? config.variant;
|
||||
return <div className="rounded-lg border p-4 text-sm space-y-1">
|
||||
<p className="font-medium">Task-pinned pool account · {account?.accountName ?? account?.connectionId ?? "Selected account"}</p>
|
||||
<p className={cn("font-medium", ANALYTICS_MASK_CLASS)}>Task-pinned pool account · {account?.accountName ?? account?.connectionId ?? "Selected account"}</p>
|
||||
<p>{[selection.binding.provider, config.provider, config.acpxAgent, config.model, effort].filter(Boolean).map(String).join(" · ")}</p>
|
||||
{selection.notes.length > 0 && <p className="text-muted-foreground">{selection.notes.join(" ")}</p>}
|
||||
</div>;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// @vitest-environment jsdom
|
||||
import { flushSync } from "react-dom";
|
||||
import { createRoot, type Root } from "react-dom/client";
|
||||
import { afterEach, beforeEach, expect, it, vi } from "vitest";
|
||||
import { AiConnectionSelect } from "./AiConnectionSelect";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
vi.mock("@/pages/apps/AppLogo", () => ({ AppLogo: () => null }));
|
||||
|
||||
let root: Root;
|
||||
let container: HTMLDivElement;
|
||||
beforeEach(() => {
|
||||
container = document.createElement("div");
|
||||
document.body.append(container);
|
||||
root = createRoot(container);
|
||||
});
|
||||
afterEach(() => { flushSync(() => root.unmount()); container.remove(); });
|
||||
|
||||
it("masks the selected connection in the trigger and the account labels in the open list", async () => {
|
||||
const connections = [
|
||||
{ id: "selected", grantId: "selected-grant", companyId: "company", provider: "anthropic" as const, method: "api_key" as const,
|
||||
name: "Claude key", accountLabel: "wren.halloway@example.test", ownership: "shared" as const, status: "connected" as const },
|
||||
{ id: "other", grantId: "other-grant", companyId: "company", provider: "anthropic" as const, method: "api_key" as const,
|
||||
name: "Claude backup", accountLabel: "ivo.castellan@example.test", ownership: "shared" as const, status: "connected" as const },
|
||||
];
|
||||
flushSync(() => root.render(<AiConnectionSelect requirement={{ companyId: "company", provider: "anthropic" }}
|
||||
connections={connections} currentUserId="user" agentId="agent" agentName="Nova" adapterType="claude_local"
|
||||
value={{ provider: "anthropic", method: "api_key", mode: "shared", connectionId: "selected", grantId: "selected-grant" }}
|
||||
onChange={vi.fn()} onConnect={vi.fn()} />));
|
||||
const trigger = container.querySelector<HTMLElement>('[role="combobox"][aria-label="Connection"]')!;
|
||||
expect(replayLeaks("wren.halloway@example.test", trigger)).toEqual({ rendered: true, recorded: false });
|
||||
flushSync(() => trigger.dispatchEvent(new KeyboardEvent("keydown", { key: "ArrowDown", bubbles: true })));
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
flushSync(() => {});
|
||||
expect(document.querySelectorAll('[role="option"]').length).toBeGreaterThan(0);
|
||||
expect(replayLeaks("ivo.castellan@example.test", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("wren.halloway@example.test", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
expect(replayLeaks("Connect an account", document.body)).toEqual({ rendered: true, recorded: false });
|
||||
});
|
||||
@@ -17,12 +17,14 @@ import { Button } from "@/components/ui/button";
|
||||
import { aiConnectionDisplayLabel, aiConnectionProblem, personalAiDefault } from "./model";
|
||||
import type { AiConnectionPickerProps } from "./AiConnectionPicker";
|
||||
import type { AiConnectionSummary } from "./model";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function ConnectionLabel({ connection, label, wrap = false }: { connection: AiConnectionSummary; label?: string; wrap?: boolean }) {
|
||||
return (
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<AppLogo name={connection.name} brandKey={aiConnectionCatalogSlug(connection.provider, connection.routing)} size={20} compact />
|
||||
<span className={wrap ? "min-w-0 break-words whitespace-normal" : "truncate"}>{label ?? aiConnectionDisplayLabel(connection)}</span>
|
||||
<span className={cn(wrap ? "min-w-0 break-words whitespace-normal" : "truncate", ANALYTICS_MASK_CLASS)}>{label ?? aiConnectionDisplayLabel(connection)}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -119,7 +121,7 @@ export function AiConnectionSelect({
|
||||
onValueChange={change}
|
||||
disabled={readOnly || loading || Boolean(error)}
|
||||
>
|
||||
<SelectTrigger id={selectId} aria-label="Connection" title={selected ? aiConnectionDisplayLabel(selected) : undefined} className="w-full">
|
||||
<SelectTrigger id={selectId} aria-label="Connection" title={selected ? aiConnectionDisplayLabel(selected) : undefined} className={cn("w-full", ANALYTICS_MASK_CLASS)}>
|
||||
<SelectValue
|
||||
placeholder={
|
||||
loading ? "Loading connections…" : "Choose a connection"
|
||||
@@ -132,7 +134,7 @@ export function AiConnectionSelect({
|
||||
: value ? "Unavailable connection" : undefined}
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectContent className={ANALYTICS_MASK_CLASS}>
|
||||
{incompatible && selected && (
|
||||
<SelectItem value={selected.id} disabled>
|
||||
<ConnectionLabel connection={selected} label={`${aiConnectionDisplayLabel(selected)} · Incompatible`} wrap />
|
||||
|
||||
@@ -26,6 +26,8 @@ import {
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { AiConnectionCredentialStep } from "./AiConnectionCredentialStep";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const providers = [
|
||||
{
|
||||
@@ -356,10 +358,10 @@ export function AiProviderSetup({
|
||||
}}
|
||||
disabled={Boolean(reconnect) || Boolean(initialProtocol)}
|
||||
>
|
||||
<SelectTrigger aria-label="API format" className="w-full">
|
||||
<SelectTrigger aria-label="API format" className={cn("w-full", ANALYTICS_MASK_CLASS)}>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectContent className={ANALYTICS_MASK_CLASS}>
|
||||
<SelectItem value="responses">
|
||||
OpenAI Responses · Codex
|
||||
</SelectItem>
|
||||
@@ -393,10 +395,10 @@ export function AiProviderSetup({
|
||||
onValueChange={(v) => setAuth(v as typeof auth)}
|
||||
disabled={Boolean(reconnect)}
|
||||
>
|
||||
<SelectTrigger aria-label="Authentication" className="w-full">
|
||||
<SelectTrigger aria-label="Authentication" className={cn("w-full", ANALYTICS_MASK_CLASS)}>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectContent className={ANALYTICS_MASK_CLASS}>
|
||||
<SelectItem value="bearer">
|
||||
{provider === "bedrock"
|
||||
? "Bedrock API key"
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Download, ExternalLink, Paperclip, Play } from "lucide-react";
|
||||
import type { CompanyArtifact } from "@/api/artifacts";
|
||||
import { Link } from "@/lib/router";
|
||||
import { cn, formatDate } from "@/lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
interface ArtifactCardProps {
|
||||
artifact: CompanyArtifact;
|
||||
@@ -141,7 +142,7 @@ function TextPreview({ artifact }: { artifact: PreviewArtifact }) {
|
||||
return (
|
||||
<PreviewFrame className="bg-card">
|
||||
<div className="absolute inset-0 overflow-hidden p-3">
|
||||
<p className="max-h-full overflow-hidden whitespace-pre-wrap break-words text-base leading-6 text-muted-foreground/75">
|
||||
<p className={cn("max-h-full overflow-hidden whitespace-pre-wrap break-words text-base leading-6 text-muted-foreground/75", ANALYTICS_MASK_CLASS)}>
|
||||
{preview}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -31,6 +31,8 @@ import {
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
// Renderers contain UI labels only. All artifact-specific content is passed in.
|
||||
// Example values live exclusively in the individual stories' args.
|
||||
@@ -306,7 +308,7 @@ export function CommitCard(props: CommitCardProps) {
|
||||
|
||||
function Markdown({ body, preview = false }: { body: string; preview?: boolean }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-3 text-sm leading-relaxed">
|
||||
<div className={cn("flex flex-col gap-3 text-sm leading-relaxed", ANALYTICS_MASK_CLASS)}>
|
||||
<ReactMarkdown
|
||||
components={{
|
||||
pre: ({ children }) => <pre className={preview
|
||||
@@ -386,9 +388,9 @@ export interface DocumentCardProps extends ArtifactIdentity {
|
||||
export function DocumentCard(props: DocumentCardProps) {
|
||||
const patch = props.patch ?? isPatchFile(props.filename);
|
||||
const content = (body: string, preview = false) => patch
|
||||
? <pre className={preview
|
||||
? <pre className={cn(ANALYTICS_MASK_CLASS, preview
|
||||
? "paperclip-patch-preview m-0 min-w-0 overflow-hidden whitespace-pre font-mono text-xs leading-5"
|
||||
: "m-0 min-w-0 whitespace-pre-wrap wrap-anywhere font-mono text-xs leading-5"}><code><PatchLines text={body} /></code></pre>
|
||||
: "m-0 min-w-0 whitespace-pre-wrap wrap-anywhere font-mono text-xs leading-5", ANALYTICS_MASK_CLASS)}><code><PatchLines text={body} /></code></pre>
|
||||
: <Markdown body={body} preview={preview} />;
|
||||
return (
|
||||
<Card>
|
||||
@@ -451,7 +453,7 @@ export interface DataCardProps extends ArtifactIdentity {
|
||||
function DataTable({ columns, rows }: Pick<DataCardProps, "columns" | "rows">) {
|
||||
return (
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-left text-xs">
|
||||
<table className={cn("w-full text-left text-xs", ANALYTICS_MASK_CLASS)}>
|
||||
<thead>
|
||||
<tr>
|
||||
{columns.map((column, i) => (
|
||||
|
||||
@@ -6,6 +6,8 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { queryKeys } from "@/lib/queryKeys";
|
||||
import { Link } from "@/lib/router";
|
||||
import { useChatConnectorsEnabled, chatProviderVisible } from "@/hooks/useChatConnectorsEnabled";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
const providerNames: Record<ChatProvider, string> = {
|
||||
speko: "Speko",
|
||||
@@ -74,7 +76,7 @@ export function AgentChannelsPanel({
|
||||
<p className="text-sm font-semibold">
|
||||
{providerNames[endpoint.provider]}
|
||||
</p>
|
||||
<p className="truncate text-xs text-muted-foreground">
|
||||
<p className={cn("truncate text-xs text-muted-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{endpoint.botLabel ??
|
||||
endpoint.providerAccountLabel ??
|
||||
"Provider identity"}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { ExternallyConnectedTaskBanner } from "./ExternallyConnectedTaskBanner";
|
||||
import { boardSendDraftKey, readBoardSendDraft } from "./board-send-draft";
|
||||
import { ApiError } from "@/api/client";
|
||||
import { queryKeys } from "@/lib/queryKeys";
|
||||
import { replayLeaks } from "@/lib/analytics/replay-recording.test-utils";
|
||||
const mockSession = vi.hoisted(() => ({ userId: "user-1" }));
|
||||
vi.mock("@/api/auth", () => ({
|
||||
authApi: { getSession: vi.fn(async () => ({ user: { id: mockSession.userId } })) },
|
||||
@@ -177,6 +178,12 @@ describe("ExternallyConnectedTaskBanner publication truth", () => {
|
||||
autoResendOverride.stalled = false;
|
||||
});
|
||||
|
||||
it("keeps the connected channel label out of session replay", async () => {
|
||||
const client = await renderBanner();
|
||||
expect(replayLeaks("#paperclip", container)).toEqual({ rendered: true, recorded: false });
|
||||
client.clear();
|
||||
});
|
||||
|
||||
it("cancels an automatic resend and hides its draft after an account change", async () => {
|
||||
mockChatEndpointsApi.publishBoardMessage.mockRejectedValue(new ApiError("Bad gateway", 502, {}));
|
||||
const client = await renderBanner();
|
||||
|
||||
@@ -41,6 +41,7 @@ import {
|
||||
} from "./board-send-draft";
|
||||
|
||||
import { LegacyBoardSendNotice } from "./LegacyBoardSendNotice";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
const providerNames: Record<ChatProvider, string> = {
|
||||
speko: "Speko",
|
||||
@@ -558,7 +559,7 @@ function ConnectedTaskComposer({
|
||||
<p className="font-medium">
|
||||
Connected to {providerNames[binding.provider]}
|
||||
</p>
|
||||
<p className="truncate text-xs text-muted-foreground">
|
||||
<p className={cn("truncate text-xs text-muted-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{binding.externalLabel} · {binding.provider === "slack"
|
||||
? "Messages you send here and agent replies are also posted to Slack."
|
||||
: "Agent assignment is fixed for this external task."}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { ArrowUpRight, Check } from "lucide-react";
|
||||
import type { DecisionHistoryItem } from "@paperclipai/shared";
|
||||
import { decisionHistoryContext, decisionHistoryHeadline } from "@/lib/coordinator-attention";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
/** A recorded decision links to its context; it is not a second approval form. */
|
||||
export function CoordinatorDecisionReceipt({ item, onOpen, userLabelMap }: {
|
||||
@@ -12,7 +14,7 @@ export function CoordinatorDecisionReceipt({ item, onOpen, userLabelMap }: {
|
||||
const handledFor = item.handledForUserId ? userLabelMap?.get(item.handledForUserId) ?? "someone else" : null;
|
||||
return <button type="button" onClick={() => onOpen(item.href)} data-decision-history-item={item.id} className="coordinator-decision-receipt flex w-full items-center gap-3 rounded-xl border border-border bg-card p-4 text-left hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring">
|
||||
<Check className="size-4 shrink-0 text-muted-foreground" aria-hidden />
|
||||
<span className="min-w-0 flex-1 space-y-1">
|
||||
<span className={cn("min-w-0 flex-1 space-y-1", ANALYTICS_MASK_CLASS)}>
|
||||
<span className="block text-sm font-medium">{decisionHistoryHeadline(item, userLabelMap)}{handledFor ? <span className="font-normal text-muted-foreground"> · for @{handledFor}</span> : null}</span>
|
||||
<span className="block truncate text-sm text-muted-foreground">{decisionHistoryContext(item)}</span>
|
||||
{/* Who withdrew it is in the headline; the reason they gave is here (PAP-749 plan §3). */}
|
||||
|
||||
@@ -43,6 +43,8 @@ import { BlockedTaskCardBody, RecoveryCardBody, ReviewTaskCardBody } from "./Nee
|
||||
import { NEEDS_YOU_SECTIONS, NeedsYouPanelRow, needsYouSection, type NeedsYouSection } from "./NeedsYouCardKit";
|
||||
import { NeedsYouAudience, NeedsYouReceiptCard, NeedsYouRequester, NeedsYouTaskLink, NeedsYouTypeLabel, needsYouTaskRef } from "./NeedsYouCardParts";
|
||||
import { CoordinatorNeedsYouSidePanel, needsYouReviewTab, needsYouReviewTabId, needsYouTabArtifact, type NeedsYouReviewPayload } from "./CoordinatorNeedsYouSidePanel";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type Group = "type" | "none" | "task" | "agent" | "project";
|
||||
|
||||
@@ -320,7 +322,7 @@ export function CoordinatorNeedsYou() {
|
||||
const title = coordinatorCardTitle(item);
|
||||
const detail = coordinatorCardDetail(item, attentionDetailLine(item));
|
||||
// The ask, with one plain line under it (UI1).
|
||||
const heading = <div className="space-y-1.5"><h2>{title}</h2>{detail && !sameText(detail, title) ? <p className="text-sm text-muted-foreground">{detail}</p> : null}</div>;
|
||||
const heading = <div className={cn("space-y-1.5", ANALYTICS_MASK_CLASS)}><h2>{title}</h2>{detail && !sameText(detail, title) ? <p className="text-sm text-muted-foreground">{detail}</p> : null}</div>;
|
||||
const footerContext = <AttentionObligationEvidence item={item} evidence={attentionObligationEvidence(obligations, item)} />;
|
||||
const type = attentionCardType(item);
|
||||
return <motion.div id={item.sourceKind === "decision" ? `coordinator-decision-${item.subject.id}` : undefined} tabIndex={item.sourceKind === "decision" ? -1 : undefined} layout={reducedMotion ? false : "position"} layoutId={reducedMotion ? undefined : id} transition={{ duration }} key={id}>
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { ReactNode } from "react";
|
||||
import { ArrowUpRight } from "lucide-react";
|
||||
import { attentionCardKind, attentionCardType, type AttentionCardType, type AttentionItem } from "@paperclipai/shared";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/**
|
||||
* The parts every Needs You card is built from (PAP-775, Paper "A · Compact
|
||||
@@ -90,5 +91,5 @@ export function NeedsYouPanelRow({ icon, title, meta, onOpen, href, label }: {
|
||||
|
||||
/** The small grey line at the bottom of a panel. */
|
||||
export function NeedsYouPanelNote({ children }: { children: ReactNode }) {
|
||||
return <p data-needs-you-note className="text-xs leading-4.5 text-muted-foreground">{children}</p>;
|
||||
return <p data-needs-you-note className={cn("text-xs leading-4.5 text-muted-foreground", ANALYTICS_MASK_CLASS)}>{children}</p>;
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { cn } from "@/lib/utils";
|
||||
import { timeAgo } from "@/lib/timeAgo";
|
||||
import { DecisionCardFooter } from "@/components/DecisionCardFooter";
|
||||
import { NeedsYouPanel, NeedsYouPanelRow, needsYouCardLabel } from "./NeedsYouCardKit";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/**
|
||||
* Who is asking (PAP-775, UI2): the requester's avatar and name, agent or
|
||||
@@ -143,8 +144,8 @@ export function NeedsYouReceiptCard({ receipt, userLabelMap, onDismiss, onOpen,
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<h2>{receipt.title ?? "Your request"}</h2>
|
||||
{receipt.reason ? <p className="text-sm text-muted-foreground">{receipt.reason}</p> : null}
|
||||
<h2 className={ANALYTICS_MASK_CLASS}>{receipt.title ?? "Your request"}</h2>
|
||||
{receipt.reason ? <p className={cn("text-sm text-muted-foreground", ANALYTICS_MASK_CLASS)}>{receipt.reason}</p> : null}
|
||||
</div>
|
||||
<NeedsYouPanel>
|
||||
<NeedsYouPanelRow icon={negative ? <StatusIcon status="cancelled" /> : <Check className="text-(--status-task-icon-done)" />}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { decisionModelsApi } from "@/api/decision-models";
|
||||
import { Link } from "@/lib/router";
|
||||
import { formatDateTime, formatTokens, formatDetailedCents } from "@/lib/utils";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export function DecisionHistoryTable({ entries, fastResponse = false, fastResponsesEnabled = true }: { entries: (DecisionHistoryEntry & { publicationStatus?: string; connectionName?: string | null })[]; fastResponse?: boolean; fastResponsesEnabled?: boolean }) {
|
||||
if (!entries.length) return <p className="text-sm text-muted-foreground">{fastResponse ? "No fast responses in this period." : "No decision requests in this period."} <Link to={fastResponse && !fastResponsesEnabled ? "/company/settings/instance/experimental" : "/company/settings/connections"} className="underline underline-offset-4">{fastResponse ? fastResponsesEnabled ? "Configure fast response" : "Enable experimental fast responses" : "Configure a decision model"}</Link> to run a test.</p>;
|
||||
@@ -15,7 +16,7 @@ export function DecisionHistoryTable({ entries, fastResponse = false, fastRespon
|
||||
<td className="px-3 py-3"><div className="whitespace-nowrap">{formatDateTime(row.startedAt)}</div><div className="text-xs text-muted-foreground">{row.feature === "settings.test" ? "Setup test" : row.feature}</div></td>
|
||||
<td className="px-3 py-3">{row.actorType === "system" ? "Paperclip services" : row.userName ?? (row.responsibleUserId === "local-board" ? "Board" : "Former user")}</td>
|
||||
<td className="px-3 py-3">{row.issueId ? <Link className="underline underline-offset-4" to={`/issues/${row.issueIdentifier ?? row.issueId}`}>{row.issueIdentifier ?? "View task"}</Link> : "—"}</td>
|
||||
{fastResponse && <td className="px-3 py-3">{row.connectionName ?? (row.connectionId ? "Removed connection" : "—")}</td>}
|
||||
{fastResponse && <td className={`px-3 py-3 ${ANALYTICS_MASK_CLASS}`}>{row.connectionName ?? (row.connectionId ? "Removed connection" : "—")}</td>}
|
||||
<td className="px-3 py-3 font-mono text-xs">{row.model}</td>
|
||||
<td className="px-3 py-3"><div>{row.status === "succeeded" ? "Succeeded" : row.status === "running" ? "Running" : row.status === "unknown" ? "Unresolved" : row.status === "skipped" ? "Skipped" : row.status === "pending" ? "Pending" : "Failed"}</div>{row.publicationStatus && <div className="text-xs text-muted-foreground">{row.publicationStatus}</div>}{row.errorCode && <div className="text-xs text-muted-foreground">{row.errorCode.replaceAll("_", " ")}</div>}</td>
|
||||
<td className="px-3 py-3 font-mono">{row.durationMs === null ? "—" : `${(row.durationMs / 1000).toFixed(1)}s`}</td>
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
type ReassignInterruptCopy,
|
||||
type TimelineAssigneeLike,
|
||||
} from "../../lib/interrupt-handoff";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
/**
|
||||
* Presentational views for the interrupt-handoff UX clarity surfaces (PAP-10669).
|
||||
@@ -174,7 +175,7 @@ export function ComposerHandoffPreviewRow({
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
>
|
||||
<span>{preview.text}</span>
|
||||
<span className={ANALYTICS_MASK_CLASS}>{preview.text}</span>
|
||||
{preview.chip ? <PreviewChip chip={preview.chip} resolvers={resolvers} /> : null}
|
||||
{preview.suffix ? <span>{preview.suffix}</span> : null}
|
||||
</div>
|
||||
@@ -337,7 +338,7 @@ export function PauseAffectsSummaryView({
|
||||
>
|
||||
<span className="font-medium text-foreground">{bucket.label}:</span>
|
||||
<span className="tabular-nums text-foreground">{bucket.count}</span>
|
||||
<span className="text-muted-foreground">— {bucket.detail}</span>
|
||||
<span className={cn("text-muted-foreground", ANALYTICS_MASK_CLASS)}>— {bucket.detail}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -16,6 +16,7 @@ import { cn } from "../../lib/utils";
|
||||
import { ExternalObjectStatusIcon } from "../ExternalObjectStatusIcon";
|
||||
import { PropertyRow } from "./primitives";
|
||||
import { ExpandRelationListButton } from "./relation-controls";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
const EXTERNAL_OBJECT_PROPERTY_PREVIEW_COUNT = 5;
|
||||
|
||||
@@ -45,7 +46,7 @@ function externalObjectRowLabel(group: IssueExternalObjectGroup): ReactNode {
|
||||
return (
|
||||
<span className="inline-flex min-w-0 items-start gap-1" title={displayKey}>
|
||||
{Icon ? <Icon aria-hidden="true" className="h-3.5 w-3.5 shrink-0 mt-0.5" /> : null}
|
||||
<span className="truncate">{displayKey}</span>
|
||||
<span className={cn("truncate", ANALYTICS_MASK_CLASS)}>{displayKey}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -115,7 +116,7 @@ function ExternalObjectPropertyValue({ group }: { group: IssueExternalObjectGrou
|
||||
sizeClassName="h-3.5 w-3.5"
|
||||
label={`${providerLabel}: ${statusLabel}`}
|
||||
/>
|
||||
<span className="min-w-0 truncate">{value}</span>
|
||||
<span className={cn("min-w-0 truncate", ANALYTICS_MASK_CLASS)}>{value}</span>
|
||||
</>
|
||||
);
|
||||
const className = cn(
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// @vitest-environment jsdom
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { afterEach, expect, it } from "vitest";
|
||||
import { CopyField } from "./WebhookFields";
|
||||
import { isBlockedFromReplay } from "@/lib/analytics/replay-recording.test-utils";
|
||||
|
||||
afterEach(() => { document.body.innerHTML = ""; });
|
||||
|
||||
it("blocks the webhook URL and secret from session replay", () => {
|
||||
document.body.innerHTML = renderToStaticMarkup(<>
|
||||
<CopyField label="Webhook URL" value="https://paperclip.example.test/api/routine-triggers/hook_k4Zr9Qe1" />
|
||||
<CopyField label="Authentication key" value="whsec_Tq8vLm2Rz7Np" />
|
||||
</>);
|
||||
expect(isBlockedFromReplay("hook_k4Zr9Qe1", document.body)).toBe(true);
|
||||
expect(isBlockedFromReplay("whsec_Tq8vLm2Rz7Np", document.body)).toBe(true);
|
||||
});
|
||||
@@ -4,6 +4,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { copyTextToClipboard } from "@/lib/clipboard";
|
||||
import { AgentSetupPrompt } from "@/components/AgentSetupPrompt";
|
||||
import { ANALYTICS_NO_CAPTURE_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export function CopyField({
|
||||
label,
|
||||
@@ -20,7 +21,7 @@ export function CopyField({
|
||||
<div className="space-y-1.5">
|
||||
<Label className="text-xs">{label}</Label>
|
||||
<div className="flex min-w-0 items-center gap-2 rounded-md border border-border bg-background px-3 py-2">
|
||||
<code title={value} className="min-w-0 flex-1 truncate text-xs">
|
||||
<code title={value} className={`min-w-0 flex-1 truncate text-xs ${ANALYTICS_NO_CAPTURE_CLASS}`}>
|
||||
{value}
|
||||
</code>
|
||||
<Button
|
||||
|
||||
@@ -39,6 +39,7 @@ import {
|
||||
RunInvocationCard,
|
||||
redactPathText,
|
||||
} from "./RunDetails";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export function LogViewer({ run, adapterType }: { run: HeartbeatRun; adapterType: string }) {
|
||||
const { visible } = usePageVisibility();
|
||||
@@ -557,7 +558,7 @@ export function LogViewer({ run, adapterType }: { run: HeartbeatRun; adapterType
|
||||
</div>
|
||||
|
||||
{(run.status === "failed" || run.status === "timed_out") && (
|
||||
<div className="rounded-lg border border-red-300 dark:border-red-500/30 bg-red-50 dark:bg-red-950/20 p-3 space-y-2">
|
||||
<div className={cn("rounded-lg border border-red-300 dark:border-red-500/30 bg-red-50 dark:bg-red-950/20 p-3 space-y-2", ANALYTICS_MASK_CLASS)}>
|
||||
<div className="text-xs font-medium text-red-700 dark:text-red-300">Failure details</div>
|
||||
{run.error && (
|
||||
<div className="text-xs text-red-600 dark:text-red-200">
|
||||
@@ -568,7 +569,7 @@ export function LogViewer({ run, adapterType }: { run: HeartbeatRun; adapterType
|
||||
{run.stderrExcerpt && run.stderrExcerpt.trim() && (
|
||||
<div>
|
||||
<div className="text-xs text-red-700 dark:text-red-300 mb-1">stderr excerpt</div>
|
||||
<pre className="bg-red-50 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap text-red-800 dark:text-red-100">
|
||||
<pre className={cn("bg-red-50 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap text-red-800 dark:text-red-100", ANALYTICS_MASK_CLASS)}>
|
||||
{redactPathText(run.stderrExcerpt, censorUsernameInLogs)}
|
||||
</pre>
|
||||
</div>
|
||||
@@ -576,7 +577,7 @@ export function LogViewer({ run, adapterType }: { run: HeartbeatRun; adapterType
|
||||
{run.resultJson && (
|
||||
<div>
|
||||
<div className="text-xs text-red-700 dark:text-red-300 mb-1">adapter result JSON</div>
|
||||
<pre className="bg-red-50 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap text-red-800 dark:text-red-100">
|
||||
<pre className={cn("bg-red-50 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap text-red-800 dark:text-red-100", ANALYTICS_MASK_CLASS)}>
|
||||
{JSON.stringify(redactPathValue(run.resultJson, censorUsernameInLogs), null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
@@ -584,7 +585,7 @@ export function LogViewer({ run, adapterType }: { run: HeartbeatRun; adapterType
|
||||
{run.stdoutExcerpt && run.stdoutExcerpt.trim() && !run.resultJson && (
|
||||
<div>
|
||||
<div className="text-xs text-red-700 dark:text-red-300 mb-1">stdout excerpt</div>
|
||||
<pre className="bg-red-50 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap text-red-800 dark:text-red-100">
|
||||
<pre className={cn("bg-red-50 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap text-red-800 dark:text-red-100", ANALYTICS_MASK_CLASS)}>
|
||||
{redactPathText(run.stdoutExcerpt, censorUsernameInLogs)}
|
||||
</pre>
|
||||
</div>
|
||||
@@ -601,7 +602,7 @@ export function LogViewer({ run, adapterType }: { run: HeartbeatRun; adapterType
|
||||
{loadingMoreEvents ? "Loading..." : eventsError ? "Retry events" : "Load more events"}
|
||||
</Button>
|
||||
)}
|
||||
<div className="bg-neutral-100 dark:bg-neutral-950 rounded-lg p-3 font-mono text-xs space-y-0.5">
|
||||
<div className={cn("bg-neutral-100 dark:bg-neutral-950 rounded-lg p-3 font-mono text-xs space-y-0.5", ANALYTICS_MASK_CLASS)}>
|
||||
{events.map((evt) => {
|
||||
const color = evt.color
|
||||
?? (evt.level ? levelColors[evt.level] : null)
|
||||
|
||||
@@ -9,6 +9,7 @@ import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "@/component
|
||||
import { type HeartbeatRun, type WorkspaceOperation } from "@paperclipai/shared";
|
||||
import { redactHomePathUserSegments, redactHomePathUserSegmentsInValue } from "@paperclipai/adapter-utils";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export const RUN_LOG_PAGE_BYTES = 256_000;
|
||||
|
||||
@@ -208,7 +209,7 @@ export function RunInvocationCard({
|
||||
{commandLine && (
|
||||
<div className="text-xs break-all">
|
||||
<span className="text-muted-foreground">Command: </span>
|
||||
<span className="font-mono">{commandLine}</span>
|
||||
<span className={cn("font-mono", ANALYTICS_MASK_CLASS)}>{commandLine}</span>
|
||||
</div>
|
||||
)}
|
||||
{Array.isArray(payload.commandNotes) && payload.commandNotes.length > 0 && (
|
||||
@@ -218,7 +219,7 @@ export function RunInvocationCard({
|
||||
{payload.commandNotes
|
||||
.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
||||
.map((note, idx) => (
|
||||
<li key={`${idx}-${note}`} className="text-xs break-all font-mono">
|
||||
<li key={`${idx}-${note}`} className={cn("text-xs break-all font-mono", ANALYTICS_MASK_CLASS)}>
|
||||
{note}
|
||||
</li>
|
||||
))}
|
||||
@@ -228,7 +229,7 @@ export function RunInvocationCard({
|
||||
{payload.prompt !== undefined && (
|
||||
<div>
|
||||
<div className="text-xs text-muted-foreground mb-1">Prompt</div>
|
||||
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap">
|
||||
<pre className={cn("bg-neutral-100 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap", ANALYTICS_MASK_CLASS)}>
|
||||
{typeof payload.prompt === "string"
|
||||
? redactPathText(payload.prompt, censorUsernameInLogs)
|
||||
: JSON.stringify(redactPathValue(payload.prompt, censorUsernameInLogs), null, 2)}
|
||||
@@ -238,7 +239,7 @@ export function RunInvocationCard({
|
||||
{payload.context !== undefined && (
|
||||
<div>
|
||||
<div className="text-xs text-muted-foreground mb-1">Context</div>
|
||||
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap">
|
||||
<pre className={cn("bg-neutral-100 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap", ANALYTICS_MASK_CLASS)}>
|
||||
{JSON.stringify(redactPathValue(payload.context, censorUsernameInLogs), null, 2)}
|
||||
</pre>
|
||||
</div>
|
||||
@@ -246,7 +247,7 @@ export function RunInvocationCard({
|
||||
{payload.env !== undefined && (
|
||||
<div>
|
||||
<div className="text-xs text-muted-foreground mb-1">Environment</div>
|
||||
<pre className="bg-neutral-100 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap font-mono">
|
||||
<pre className={cn("bg-neutral-100 dark:bg-neutral-950 rounded-md p-2 text-xs overflow-x-auto whitespace-pre-wrap font-mono", ANALYTICS_MASK_CLASS)}>
|
||||
{formatEnvForDisplay(payload.env, censorUsernameInLogs)}
|
||||
</pre>
|
||||
</div>
|
||||
@@ -462,7 +463,7 @@ export function WorkspaceOperationsSection({
|
||||
{operation.stderrExcerpt && operation.stderrExcerpt.trim() && (
|
||||
<div>
|
||||
<div className="mb-1 text-xs text-red-700 dark:text-red-300">stderr excerpt</div>
|
||||
<pre className="rounded-md bg-red-50 p-2 text-xs whitespace-pre-wrap break-all text-red-800 dark:bg-neutral-950 dark:text-red-100">
|
||||
<pre className={cn("rounded-md bg-red-50 p-2 text-xs whitespace-pre-wrap break-all text-red-800 dark:bg-neutral-950 dark:text-red-100", ANALYTICS_MASK_CLASS)}>
|
||||
{redactPathText(operation.stderrExcerpt, censorUsernameInLogs)}
|
||||
</pre>
|
||||
</div>
|
||||
@@ -470,7 +471,7 @@ export function WorkspaceOperationsSection({
|
||||
{operation.stdoutExcerpt && operation.stdoutExcerpt.trim() && (
|
||||
<div>
|
||||
<div className="mb-1 text-xs text-muted-foreground">stdout excerpt</div>
|
||||
<pre className="rounded-md bg-neutral-100 p-2 text-xs whitespace-pre-wrap break-all dark:bg-neutral-950">
|
||||
<pre className={cn("rounded-md bg-neutral-100 p-2 text-xs whitespace-pre-wrap break-all dark:bg-neutral-950", ANALYTICS_MASK_CLASS)}>
|
||||
{redactPathText(operation.stdoutExcerpt, censorUsernameInLogs)}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { StatusIcon } from "../StatusIcon";
|
||||
import { Identity } from "../Identity";
|
||||
import { HighlightedText, type HighlightedTextProps } from "./HighlightedText";
|
||||
import { taskStatusIconProps } from "@/lib/task-status-presentation";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
type SnippetStyle = {
|
||||
Icon: ComponentType<SVGProps<SVGSVGElement>>;
|
||||
@@ -265,7 +266,7 @@ function SnippetLine({ text, highlights, field, fallbackLabel, multiline = false
|
||||
<HighlightedText
|
||||
text={text}
|
||||
highlights={highlights}
|
||||
className={multiline ? "line-clamp-2 leading-relaxed" : "line-clamp-1 truncate"}
|
||||
className={cn(multiline ? "line-clamp-2 leading-relaxed" : "line-clamp-1 truncate", ANALYTICS_MASK_CLASS)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Button } from '@/components/ui/button';
|
||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
||||
import { RadioCardGroup } from '@/components/ui/radio-card';
|
||||
import { SkillSourceBranchRepair } from './SkillSourceBranchRepair';
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
export function SkillSourceConnectionRepair({ companyId, source, onClose, onSaved, onReturnFocus }: {
|
||||
companyId: string; source: SkillSource; onClose: () => void; onSaved: () => Promise<void>;
|
||||
@@ -41,7 +42,7 @@ export function SkillSourceConnectionRepair({ companyId, source, onClose, onSave
|
||||
<div className="min-h-0 overflow-y-auto space-y-4">
|
||||
{query.isPending && <p role="status" className="text-sm text-muted-foreground">Loading connections…</p>}
|
||||
{query.error && <p role="alert" className="text-sm text-destructive">{describeError(query.error).body} <Button variant="ghost" size="sm" onClick={() => void query.refetch()}>Try again</Button></p>}
|
||||
<RadioCardGroup ariaLabel="GitHub connection" value={connectionId} onValueChange={setConnectionId} disabled={save.isPending}
|
||||
<RadioCardGroup ariaLabel="GitHub connection" className={ANALYTICS_MASK_CLASS} value={connectionId} onValueChange={setConnectionId} disabled={save.isPending}
|
||||
options={connections.map(connection => ({ value: connection.id, title: connection.name }))} />
|
||||
{query.isSuccess && connections.length === 0 && <p className="text-sm text-muted-foreground">Connect GitHub to continue.</p>}
|
||||
<Button asChild variant="link" className="justify-start p-0"><Link to="/apps">Manage GitHub connections</Link></Button>
|
||||
|
||||
@@ -9,6 +9,8 @@ import { useToastActions } from "../../context/ToastContext";
|
||||
import { formatBytes } from "../../lib/issue-output";
|
||||
import { queryKeys } from "../../lib/queryKeys";
|
||||
import { describeError } from "@/api/errors";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const STATUS_LABEL: Record<CompanyMcpSkill["status"], string> = {
|
||||
pending_review: "Needs review",
|
||||
@@ -129,7 +131,7 @@ export function ConnectedAppSkillsList({ skills, pendingSkillId, preview, onPrev
|
||||
preview?.error ? <p className="text-sm text-destructive">{preview.error}</p>
|
||||
: preview?.loading || !previewCurrent ? <p className="text-sm text-muted-foreground">Loading instructions…</p>
|
||||
// Shown as text: the content comes from the app and is never rendered as a page.
|
||||
: <pre className="max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-3 font-mono text-xs">{preview?.markdown}</pre>
|
||||
: <pre className={cn("max-h-96 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-3 font-mono text-xs", ANALYTICS_MASK_CLASS)}>{preview?.markdown}</pre>
|
||||
) : null}
|
||||
</li>
|
||||
);
|
||||
|
||||
@@ -76,6 +76,7 @@ import {
|
||||
} from "./TaskChatComposerTakeoverContext";
|
||||
import { TaskChatPlanPreviewCard } from "./TaskChatPlanPreviewCard";
|
||||
import { TaskChatRichInput } from "./TaskChatRichInput";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
const TAKEOVER_TEXTAREA_CLASS =
|
||||
"min-h-16 resize-y border-0 bg-muted/35 text-sm shadow-none focus-visible:ring-0 focus-visible:ring-offset-0";
|
||||
@@ -578,7 +579,7 @@ function ReceiptDisclosure({
|
||||
{interaction.payload.toolAction.previewMarkdown}
|
||||
</MarkdownBody>
|
||||
</div>
|
||||
<pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-xs">
|
||||
<pre className={cn("mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-xs", ANALYTICS_MASK_CLASS)}>
|
||||
{interaction.payload.toolAction.argumentsSummaryJson}
|
||||
</pre>
|
||||
<ToolActionAuditHashCopy hash={interaction.payload.toolAction.argumentsHash} />
|
||||
@@ -954,7 +955,7 @@ function ConfirmationCard({
|
||||
<summary className="cursor-pointer text-xs font-medium text-muted-foreground">
|
||||
Arguments
|
||||
</summary>
|
||||
<pre className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground">
|
||||
<pre className={cn("mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-xs text-foreground", ANALYTICS_MASK_CLASS)}>
|
||||
{interaction.payload.toolAction.argumentsSummaryJson}
|
||||
</pre>
|
||||
<ToolActionAuditHashCopy hash={interaction.payload.toolAction.argumentsHash} />
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
protocolActivityPresentation,
|
||||
providerNoticeSeverity,
|
||||
} from "./task-chat-activity-presentation";
|
||||
import { ANALYTICS_MASK_CLASS } from "@/lib/analytics/privacy";
|
||||
|
||||
const COMPACT_RESEARCH_RESULT_LIMIT = 5;
|
||||
const COMPACT_WORKSPACE_FILE_LIMIT = 8;
|
||||
@@ -176,7 +177,7 @@ function ProviderDetails({ item, neutral = false }: { item: TaskChatProviderActi
|
||||
<DetailList details={item.details} />
|
||||
) : null}
|
||||
{item.output ? (
|
||||
<pre className="max-h-(--sz-64) overflow-auto whitespace-pre-wrap rounded-sm bg-muted/50 p-2 font-mono text-(length:--text-micro) text-foreground">{item.output}</pre>
|
||||
<pre className={cn("max-h-(--sz-64) overflow-auto whitespace-pre-wrap rounded-sm bg-muted/50 p-2 font-mono text-(length:--text-micro) text-foreground", ANALYTICS_MASK_CLASS)}>{item.output}</pre>
|
||||
) : null}
|
||||
{item.outputTruncated ? <p className="text-muted-foreground">Output truncated to 8 KiB.</p> : null}
|
||||
</div>
|
||||
@@ -224,7 +225,7 @@ function WorkspaceFileDetails({ item }: { item: TaskChatWorkspaceFileItem }) {
|
||||
item.presentation === "document" ? (
|
||||
<div className="max-h-(--sz-64) overflow-auto rounded-sm bg-muted/30 p-2 text-foreground"><MarkdownBody>{item.preview}</MarkdownBody></div>
|
||||
) : (
|
||||
<pre className="max-h-(--sz-64) overflow-auto whitespace-pre-wrap rounded-sm bg-muted/50 p-2 font-mono text-(length:--text-micro) text-foreground">{item.preview}</pre>
|
||||
<pre className={cn("max-h-(--sz-64) overflow-auto whitespace-pre-wrap rounded-sm bg-muted/50 p-2 font-mono text-(length:--text-micro) text-foreground", ANALYTICS_MASK_CLASS)}>{item.preview}</pre>
|
||||
)
|
||||
) : <p className="text-muted-foreground">Preview unavailable.</p>}
|
||||
{item.previewTruncated ? <p className="text-muted-foreground">Preview truncated by the runner.</p> : null}
|
||||
|
||||
Loaded 100 of 196 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user