Skip to content
Python

OPE-136: GUI — honest approval cards, one tool-review dialect, connectors clarity

Devika Verma4a42d8ffc942
diff --git a/surfaces/gui/e2e/approval-card.spec.ts b/surfaces/gui/e2e/approval-card.spec.ts
index be922dda..a67dcb53 100644
--- a/surfaces/gui/e2e/approval-card.spec.ts
+++ b/surfaces/gui/e2e/approval-card.spec.ts
@@ -1,6 +1,6 @@
// §35 (UX-018): approval cards speak the transcript's language. Routine workspace writes
-// are a compact ROW (humanized title, inline args-preview, short "Always allow" with the
-// full rule on hover); everything else is a full card — shell titles with the model's
+// are a compact ROW (humanized title, inline args-preview, short "Allow for this session"
+// with the full rule on hover); everything else is a full card — shell titles with the model's
// description, external actions wear the leaves-this-Mac note. No "PERMISSION REQUIRED"
// kicker, no raw args dump, no solid-fill buttons.
import { expect } from "@playwright/test";
@@ -17,10 +17,9 @@ test("routine write → compact row: humanized title, inline preview, Allow reso
const row = page.getByTestId("approval-row");
await expect(row).toContainText("Write fetch_data.py");
await expect(row).not.toContainText(/permission required/i);
- await expect(row.getByRole("button", { name: "Always allow", exact: true })).toHaveAttribute(
- "title",
- /for this session/,
- );
+ await expect(
+ row.getByRole("button", { name: "Allow for this session", exact: true }),
+ ).toHaveAttribute("title", /rest of this session/);
// Preview expands INLINE from the tool args — the file doesn't exist yet.
await row.getByText("preview ▾").click();
@@ -47,7 +46,9 @@ test("run_shell → full card: description title, command preview, stays-on-this
await expect(page.getByText("Run a command").last()).toBeVisible();
await expect(page.getByText("stays on this computer").last()).toBeVisible();
await expect(page.getByText("The coworker wants to run a command.").first()).toBeVisible();
- await expect(page.getByRole("button", { name: "Always allow this command" }).last()).toBeVisible();
+ await expect(
+ page.getByRole("button", { name: "Allow this command for this session" }).last(),
+ ).toBeVisible();
await expect(page.getByText(/local action/)).toHaveCount(0);
await page.screenshot({ path: "test-results/ux018-shell-card.png", fullPage: false });
diff --git a/surfaces/gui/e2e/mcp-add-test.spec.ts b/surfaces/gui/e2e/mcp-add-test.spec.ts
index c429d03f..b60381ef 100644
--- a/surfaces/gui/e2e/mcp-add-test.spec.ts
+++ b/surfaces/gui/e2e/mcp-add-test.spec.ts
@@ -25,10 +25,16 @@ test("remote URL add: probe flips the row to Live with tool count", async ({ pag
await modal.getByTestId("mcp-add-url").fill("https://mcp.example.com/mcp");
await modal.getByRole("button", { name: "Add & test" }).click();
- const row = page.getByTestId("mcp-row-notes");
- await expect(row).toContainText("Testing…");
- await expect(row).toContainText("Live", { timeout: 10_000 });
- await expect(row).toContainText("6 tools");
+ // Adding lands STRAIGHT on the detail page (OPE-136: the connect-time tool
+ // review ceremony lives there) — the probe's status plays out in its header.
+ const detail = page.getByTestId("mcp-detail-notes");
+ await expect(detail).toContainText("Testing…");
+ await expect(detail).toContainText("Ready", { timeout: 10_000 });
+ await expect(detail).toContainText("6 tools");
+
+ // Back on the list, the row carries the same receipt.
+ await page.getByText("‹ Connectors").click();
+ await expect(page.getByTestId("mcp-row-notes")).toContainText("Ready");
});
test("guarded server: 401 → Needs sign-in chip → OAuth switch on the detail page", async ({
@@ -41,17 +47,14 @@ test("guarded server: 401 → Needs sign-in chip → OAuth switch on the detail
await modal.getByTestId("mcp-add-url").fill("https://mcp.locked.example/mcp");
await modal.getByRole("button", { name: "Add & test" }).click();
- // The anonymous probe 401s: the row says needs sign-in; the fix lives one
- // click deep on the detail page (with the error excerpt).
- const row = page.getByTestId("mcp-row-locked-crm");
- await expect(row).toContainText("Needs sign-in", { timeout: 10_000 });
- await row.click();
-
+ // Adding lands on the detail page; the anonymous probe 401s there — chip and
+ // error excerpt on the same screen as the fix.
const detail = page.getByTestId("mcp-detail-locked-crm");
+ await expect(detail).toContainText("Needs sign-in", { timeout: 10_000 });
await expect(detail).toContainText("authentication required");
await detail.getByTestId("mcp-authfix-locked-crm").click();
await expect(detail).toContainText("Signing in…");
- await expect(detail).toContainText("Live", { timeout: 10_000 });
+ await expect(detail).toContainText("Ready", { timeout: 10_000 });
});
test("JSON tab adds stdio as Not tested; detail Test flips it to Live", async ({ page }) => {
@@ -64,16 +67,15 @@ test("JSON tab adds stdio as Not tested; detail Test flips it to Live", async ({
.fill('{"files": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem"]}}');
await modal.getByRole("button", { name: "Add", exact: true }).click();
- // A pasted stdio server is configured, not connected — the chip says so.
- const row = page.getByTestId("mcp-row-files");
- await expect(row).toContainText("Not tested");
- await expect(row).toContainText("stdio");
-
- await row.click();
+ // Adding lands on the detail page. A pasted stdio server is configured, not
+ // connected — the chip says so, right where Test can fix it.
const detail = page.getByTestId("mcp-detail-files");
+ await expect(detail).toContainText("Not tested");
+ await expect(detail).toContainText("stdio");
+
await detail.getByTestId("mcp-test-files").click();
await expect(detail).toContainText("Testing…");
- await expect(detail).toContainText("Live", { timeout: 10_000 });
+ await expect(detail).toContainText("Ready", { timeout: 10_000 });
await expect(detail).toContainText("6 tools");
// Remove from the detail page returns to the list without the row.
diff --git a/surfaces/gui/e2e/mcp-oauth.spec.ts b/surfaces/gui/e2e/mcp-oauth.spec.ts
index 05e615cc..92a34976 100644
--- a/surfaces/gui/e2e/mcp-oauth.spec.ts
+++ b/surfaces/gui/e2e/mcp-oauth.spec.ts
@@ -14,24 +14,23 @@ async function openConnectors(page) {
test("granola: quick-add card → sign-in flow → Live → sign out", async ({ page }) => {
await openConnectors(page);
- // Curated card renders in the Custom · MCP group while granola isn't configured.
+ // Curated OFFER renders among the Available connectors while granola isn't
+ // configured (never inside Custom · MCP — a row there means a server you own).
const preset = page.getByTestId("mcp-preset-granola");
await expect(preset).toContainText("Granola");
await expect(preset).toContainText("Meeting notes");
- // Connect: adds the server with OAuth pending and starts the browser flow.
+ // Connect: adds the server, starts the browser sign-in, and lands STRAIGHT on
+ // the detail page (OPE-136: the connect-time tool review ceremony lives there).
await preset.getByRole("button", { name: "Connect" }).click();
- await expect(page.getByTestId("mcp-preset-granola")).toHaveCount(0);
- const row = page.getByTestId("mcp-row-granola");
- await expect(row).toContainText("Signing in…");
+ const detail = page.getByTestId("mcp-detail-granola");
+ await expect(detail).toContainText("Signing in…");
// The status poll flips the mock to connected with its 6 tools.
- await expect(row).toContainText("Live", { timeout: 10_000 });
- await expect(row).toContainText("6 tools");
+ await expect(detail).toContainText("Ready", { timeout: 10_000 });
+ await expect(detail).toContainText("6 tools");
- // Sign out on the detail page forgets tokens; the chip needs sign-in again.
- await row.click();
- const detail = page.getByTestId("mcp-detail-granola");
+ // Sign out forgets tokens; the chip needs sign-in again.
await detail.getByTestId("mcp-signout-granola").click();
await expect(detail).toContainText("Needs sign-in");
await expect(detail.getByTestId("mcp-signin-granola")).toBeVisible();
diff --git a/surfaces/gui/e2e/slack-health.spec.ts b/surfaces/gui/e2e/slack-health.spec.ts
index 9ff2a44b..b86d0394 100644
--- a/surfaces/gui/e2e/slack-health.spec.ts
+++ b/surfaces/gui/e2e/slack-health.spec.ts
@@ -45,7 +45,7 @@ test("signed out: chip and status line say Sign-in needed", async ({ page }) =>
test("signed in + live socket: Live everywhere", async ({ page }) => {
await forceStatus(page, {});
await openConnectors(page);
- await expect(page.getByTestId("connector-slack")).toContainText("Live");
+ await expect(page.getByTestId("connector-slack")).toContainText("Ready");
await page.getByTestId("connector-slack").click();
await expect(page.getByTestId("slack-mode-badge")).toContainText("Live · managed relay");
});
diff --git a/surfaces/gui/e2e/standing-approvals.spec.ts b/surfaces/gui/e2e/standing-approvals.spec.ts
index ca46263a..134edf26 100644
--- a/surfaces/gui/e2e/standing-approvals.spec.ts
+++ b/surfaces/gui/e2e/standing-approvals.spec.ts
@@ -53,7 +53,7 @@ test("a run session's approval card offers Allow every time and sends always_tas
const allowEvery = page.getByRole("button", { name: "Allow every time" });
await expect(allowEvery).toBeVisible();
// The task-persistent grant replaces the session-scoped Always-allow in run context.
- await expect(page.getByRole("button", { name: "Always allow", exact: true })).toHaveCount(0);
+ await expect(page.getByRole("button", { name: "Allow for this session", exact: true })).toHaveCount(0);
await allowEvery.click();
// The decision that rode the socket is the task-persistent one.
@@ -74,7 +74,7 @@ test("a plain session never offers Allow every time, even for an eligible call",
// the session-scoped Always-allow remains.
await expect(page.getByRole("button", { name: "Allow once" }).last()).toBeVisible();
await expect(page.getByRole("button", { name: "Allow every time" })).toHaveCount(0);
- await expect(page.getByRole("button", { name: "Always allow", exact: true }).last()).toBeVisible();
+ await expect(page.getByRole("button", { name: "Allow for this session", exact: true }).last()).toBeVisible();
});
test("task detail lists standing rules under 'Allowed without asking'; Revoke removes one", async ({
diff --git a/surfaces/gui/package-lock.json b/surfaces/gui/package-lock.json
index 8e895216..d4eb573b 100644
--- a/surfaces/gui/package-lock.json
+++ b/surfaces/gui/package-lock.json
@@ -100,6 +100,7 @@
"integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@babel/code-frame": "^7.29.7",
"@babel/generator": "^7.29.7",
@@ -448,6 +449,7 @@
}
],
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=18"
},
@@ -471,6 +473,7 @@
}
],
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=18"
}
@@ -1800,6 +1803,7 @@
"integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
@@ -1953,6 +1957,7 @@
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.30.tgz",
"integrity": "sha512-3ek6mwJL5/VBewBcY4S66cqlCtK3qi4WIq37Z0m/NHw1hjhI7274Mx1qz/+ggSzyBCOEf7eHjBN6INjPAWYfYw==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"@types/prop-types": "*",
"csstype": "^3.2.2"
@@ -1964,6 +1969,7 @@
"integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"peerDependencies": {
"@types/react": "^18.0.0"
}
@@ -2317,6 +2323,7 @@
}
],
"license": "MIT",
+ "peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.10.38",
"caniuse-lite": "^1.0.30001799",
@@ -3271,6 +3278,7 @@
}
],
"license": "MIT",
+ "peer": true,
"peerDependencies": {
"typescript": "^5 || ^6 || ^7"
},
@@ -3430,6 +3438,7 @@
"integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==",
"dev": true,
"license": "MIT",
+ "peer": true,
"bin": {
"jiti": "bin/jiti.js"
}
@@ -3446,6 +3455,7 @@
"integrity": "sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"cssstyle": "^4.1.0",
"data-urls": "^5.0.0",
@@ -4751,6 +4761,7 @@
}
],
"license": "MIT",
+ "peer": true,
"dependencies": {
"nanoid": "^3.3.12",
"picocolors": "^1.1.1",
@@ -4955,6 +4966,7 @@
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"loose-envify": "^1.1.0"
},
@@ -4967,6 +4979,7 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"loose-envify": "^1.1.0",
"scheduler": "^0.23.2"
@@ -5546,6 +5559,7 @@
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
"dev": true,
"license": "MIT",
+ "peer": true,
"engines": {
"node": ">=12"
},
@@ -5675,6 +5689,7 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"devOptional": true,
"license": "Apache-2.0",
+ "peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -5851,6 +5866,7 @@
"integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"esbuild": "^0.21.3",
"postcss": "^8.4.43",
diff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsx
index cafa1fcf..67cff675 100644
--- a/surfaces/gui/src/App.tsx
+++ b/surfaces/gui/src/App.tsx
@@ -54,7 +54,7 @@ import { baseName } from "./paths";
import { itemsFromMessages } from "./itemsFromMessages";
import { addTurnUsage, emptyUsage, usageFromMessages } from "./usage";
import { streamMode } from "./streamGate";
-import { InboxItemCard } from "./components/InboxItemCard";
+import { InboxItemCard, approvalItemFromParked } from "./components/InboxItemCard";
import { chooseFolder, isTauri, platformOS, startWindowDrag } from "./tauri";
import { Icon } from "./components/Icon";
import { Sidebar } from "./components/Sidebar";
@@ -789,6 +789,7 @@ export function App() {
provenance: d.provenance || undefined,
reviewerUnsure: d.reviewer_unsure || undefined,
readonlyOk: !!d.readonly_ok,
+ mcpDestination: d.mcp_destination || undefined,
},
]);
break;
@@ -2145,8 +2146,32 @@ export function App() {
compact
/>
) : sessionInbox[0] ? (
- // Unattended session blocked on an Inbox item — answer it in context.
- <InboxItemCard item={sessionInbox[0]} onResolve={resolveSessionInbox} compact />
+ // Session blocked on a parked Inbox item — answer it in context. A parked
+ // APPROVAL with tool data renders through the REAL ApprovalCard (OPE-136:
+ // one renderer, no second dress to drift out of evidence or buttons); its
+ // decisions resolve through the same server-validated vocabulary as the
+ // live path. Everything else keeps the Inbox card.
+ (() => {
+ const parked = approvalItemFromParked(sessionInbox[0]);
+ const d = sessionInbox[0].data;
+ return parked ? (
+ <ApprovalCard
+ item={parked}
+ onApprove={(decision) =>
+ void resolveSessionInbox(sessionInbox[0].id, decision)
+ }
+ runTask={
+ d?.task_id
+ ? { id: String(d.task_id), title: String(d.task_title || "") }
+ : null
+ }
+ autoApprove={mode === "auto-approve"}
+ compact
+ />
+ ) : (
+ <InboxItemCard item={sessionInbox[0]} onResolve={resolveSessionInbox} compact />
+ );
+ })()
) : undefined
}
/>
diff --git a/surfaces/gui/src/api.ts b/surfaces/gui/src/api.ts
index d87322d3..a69e0cec 100644
--- a/surfaces/gui/src/api.ts
+++ b/surfaces/gui/src/api.ts
@@ -501,6 +501,40 @@ export async function getMcpTools(
return res.json();
}
+// OPE-136 §4/§5: the server's standing trust — which tools carry a durable "don't ask"
+// rule, plus whether the legacy server-wide requires_approval:false is still present.
+export async function getMcpTrust(
+ name: string,
+): Promise<{ ok: boolean; tools: string[]; legacy_dont_ask: boolean }> {
+ const res = await fetch(`${httpBase()}/v1/mcp/${encodeURIComponent(name)}/trust`);
+ return res.json();
+}
+
+export async function revokeMcpTrust(name: string, tool: string) {
+ const res = await fetch(
+ `${httpBase()}/v1/mcp/${encodeURIComponent(name)}/trust/${encodeURIComponent(tool)}`,
+ { method: "DELETE" },
+ );
+ return res.json();
+}
+
+/** Migrate the legacy server-wide don't-ask flag to named per-tool trust rules. */
+export async function convertMcpTrust(
+ name: string,
+): Promise<{ ok: boolean; error?: string; trusted?: string[] }> {
+ const res = await fetch(`${httpBase()}/v1/mcp/${encodeURIComponent(name)}/trust/convert`, {
+ method: "POST",
+ });
+ return res.json();
+}
+
+/** Reveal the global mcp.json in the OS file manager — the ONE file every custom
+ * server lives in (the per-server Configuration mirror was removed in its favor). */
+export async function revealMcpConfig(): Promise<{ ok: boolean; error?: string; path?: string }> {
+ const res = await fetch(`${httpBase()}/v1/mcp/config/reveal`, { method: "POST" });
+ return res.json();
+}
+
export async function reloadMcp() {
const res = await fetch(`${httpBase()}/v1/mcp/reload`, { method: "POST" });
return res.json();
diff --git a/surfaces/gui/src/components/ApprovalCard.test.tsx b/surfaces/gui/src/components/ApprovalCard.test.tsx
index de2fd5dc..4d385976 100644
--- a/surfaces/gui/src/components/ApprovalCard.test.tsx
+++ b/surfaces/gui/src/components/ApprovalCard.test.tsx
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { ApprovalCard } from "./ApprovalCard";
-import { InboxItemCard } from "./InboxItemCard";
+import { InboxItemCard, approvalItemFromParked } from "./InboxItemCard";
import type { Item } from "../types";
import type { InboxItem } from "../api";
@@ -33,7 +33,7 @@ describe("ApprovalCard — standing scoped approvals (§25)", () => {
);
fireEvent.click(screen.getByText("Allow every time"));
expect(onApprove).toHaveBeenCalledWith("always_task");
- expect(screen.queryByText("Always allow")).toBeNull();
+ expect(screen.queryByText("Allow for this session")).toBeNull();
cleanup();
// No run context (a plain session) → never offered.
@@ -160,7 +160,7 @@ describe("ApprovalCard — §35 shapes", () => {
expect(screen.getByText(/Run a command — fetch semiconductor stock data/)).toBeTruthy();
expect(screen.getByText(/python3 fetch\.py/)).toBeTruthy();
expect(screen.getByText(/stays on this computer/)).toBeTruthy();
- expect(screen.getByText("Always allow this command")).toBeTruthy();
+ expect(screen.getByText("Allow this command for this session")).toBeTruthy();
});
});
@@ -221,6 +221,238 @@ describe("InboxItemCard — Allow every time on parked run approvals", () => {
});
});
+describe("ApprovalCard — no silent truncation on long-tail tools (OPE-136 finding 7)", () => {
+ const LONG_BODY =
+ "Hi Priya, attached is the proposal we discussed. Please review section three carefully — " +
+ "the revised milestones move delivery to March and the payment schedule follows suit. " +
+ "The engineering estimate now includes the migration work we scoped last week, and the " +
+ "support retainer is priced separately as you asked. The onboarding plan assumes two " +
+ "workshops in the first month, with the second one optional if the team ramps quickly. " +
+ "Let me know if the terms work for your side before Thursday's call. " +
+ "P.S. Our internal cost floor is $40k — the smuggled tail must be visible.";
+
+ const emailApproval = (): ApprovalItem => ({
+ kind: "approval",
+ name: "gmail_send_email",
+ args: { to: "[email protected]", subject: "Q3 proposal", body: LONG_BODY },
+ reason: "requires approval",
+ category: "connector",
+ });
+
+ it("a long value renders as a complete labeled block, not the 96-char line", () => {
+ render(<ApprovalCard item={emailApproval()} onApprove={vi.fn()} />);
+ // The labeled block discloses the field and its true size…
+ const block = screen.getByTestId("approval-longarg-body");
+ expect(block.textContent).toContain("body");
+ expect(block.textContent).toContain(`${LONG_BODY.length} chars`);
+ // …and content beyond the old 96-char cliff is visible without any click.
+ expect(screen.getByText(/revised milestones move delivery to March/)).toBeTruthy();
+ // The one-liner keeps only what it can show whole.
+ expect(screen.getByText(/to=client@example\.com/)).toBeTruthy();
+ });
+
+ it("the smuggled tail is reachable — show-all reveals the final sentence", () => {
+ render(<ApprovalCard item={emailApproval()} onApprove={vi.fn()} />);
+ fireEvent.click(screen.getByText(/show/i));
+ expect(screen.getByText(/the smuggled tail must be visible/)).toBeTruthy();
+ });
+
+ it("short-args-only tools keep the compact line, no blocks", () => {
+ render(
+ <ApprovalCard
+ item={{
+ kind: "approval",
+ name: "gcal_delete_event",
+ args: { event_id: "evt_123" },
+ reason: "requires approval",
+ category: "connector",
+ }}
+ onApprove={vi.fn()}
+ />,
+ );
+ expect(screen.getByText(/event_id=evt_123/)).toBeTruthy();
+ expect(screen.queryByTestId("approval-longarg-event_id")).toBeNull();
+ });
+});
+
+describe("ApprovalCard — the run grant rung (OPE-136 'Allow for this request')", () => {
+ it("EXTERNAL family offers it and it sends this_run", () => {
+ const onApprove = vi.fn();
+ render(
+ <ApprovalCard
+ item={{
+ kind: "approval",
+ name: "mcp__my_jira__searchJiraIssuesUsingJql",
+ args: { jql: "ORDER BY created" },
+ reason: "requires approval",
+ category: "mcp",
+ }}
+ onApprove={onApprove}
+ />,
+ );
+ fireEvent.click(screen.getByTestId("approval-this-run"));
+ expect(onApprove).toHaveBeenCalledWith("this_run");
+ // The tooltip states the trade plainly — later calls run unseen, nothing survives.
+ expect(
+ screen.getByTestId("approval-this-run").getAttribute("title"),
+ ).toContain("without showing you their arguments");
+ // The durable rung still stands beside it on MCP cards.
+ expect(screen.getByTestId("approval-always-trust")).toBeTruthy();
+ });
+
+ it("connector tools get the rung too — their only rung besides once", () => {
+ const onApprove = vi.fn();
+ render(
+ <ApprovalCard
+ item={{
+ kind: "approval",
+ name: "gmail_send_email",
+ args: { to: "[email protected]", subject: "hi", body: "short" },
+ reason: "requires approval",
+ category: "connector",
+ }}
+ onApprove={onApprove}
+ />,
+ );
+ fireEvent.click(screen.getByTestId("approval-this-run"));
+ expect(onApprove).toHaveBeenCalledWith("this_run");
+ expect(screen.queryByTestId("approval-always-trust")).toBeNull();
+ });
+
+ it("EXEC and EGRESS never see it, and Auto-approve hides it (§1.5)", () => {
+ render(
+ <ApprovalCard
+ item={{ kind: "approval", name: "run_shell", args: { command: "rm -rf x" }, reason: "requires approval" }}
+ onApprove={vi.fn()}
+ />,
+ );
+ expect(screen.queryByTestId("approval-this-run")).toBeNull();
+ cleanup();
+
+ render(
+ <ApprovalCard
+ item={{ kind: "approval", name: "web_fetch", args: { url: "https://x.y/z" }, reason: "requires approval" }}
+ onApprove={vi.fn()}
+ />,
+ );
+ expect(screen.queryByTestId("approval-this-run")).toBeNull();
+ cleanup();
+
+ render(
+ <ApprovalCard
+ item={{
+ kind: "approval",
+ name: "mcp__my_jira__getJiraIssue",
+ args: {},
+ reason: "requires approval",
+ category: "mcp",
+ }}
+ onApprove={vi.fn()}
+ autoApprove
+ />,
+ );
+ expect(screen.queryByTestId("approval-this-run")).toBeNull();
+ });
+});
+
+describe("InboxItemCard — parked MCP approvals carry the live card's evidence (OPE-136)", () => {
+ const mcpItem = (data: Record<string, any>, body = ""): InboxItem => ({
+ id: "i2",
+ session_id: "s1",
+ kind: "approval",
+ title: "Run `mcp__my_jira__searchJiraIssuesUsingJql`?",
+ body,
+ state: "pending",
+ resolution: null,
+ inbox: "default",
+ created_at: "",
+ resolved_at: null,
+ data,
+ });
+
+ it("shows the destination chip and the FULL argument envelope, not the truncated body", () => {
+ render(
+ <InboxItemCard
+ item={mcpItem(
+ {
+ tool: "mcp__my_jira__searchJiraIssuesUsingJql",
+ arguments: { cloudId: "0bbb", jql: "ORDER BY created DESC" },
+ category: "mcp",
+ mcp_destination: { transport: "http", host: "mcp.atlassian.com" },
+ },
+ "cloudId: 0bbb",
+ )}
+ onResolve={vi.fn()}
+ />,
+ );
+ // Same chip the live card shows — never the vague "acts through an MCP server".
+ expect(screen.getByText(/leaves this computer → mcp\.atlassian\.com/)).toBeTruthy();
+ expect(screen.queryByText("acts through an MCP server")).toBeNull();
+ // Full JSON evidence block (arguments are the only evidence for a stranger's tool);
+ // the one-line truncated body is subsumed and must not render alongside.
+ expect(screen.getByText(/ORDER BY created DESC/)).toBeTruthy();
+ expect(screen.queryByText("cloudId: 0bbb", { exact: true })).toBeNull();
+ });
+
+ it("renders a real reason from data (the body may be skipped, the reason must survive)", () => {
+ render(
+ <InboxItemCard
+ item={mcpItem({
+ tool: "mcp__my_jira__editJiraIssue",
+ arguments: { issueIdOrKey: "OPE-1" },
+ category: "mcp",
+ mcp_destination: { transport: "http", host: "mcp.atlassian.com" },
+ reason: "the reviewer wasn't sure this edit was asked for",
+ })}
+ onResolve={vi.fn()}
+ />,
+ );
+ expect(screen.getByText("the reviewer wasn't sure this edit was asked for")).toBeTruthy();
+ });
+
+ it("a redelivered parked approval rebuilds the REAL card — full trust ladder included", () => {
+ // OPE-136 one-renderer fix: the session view maps parked data back into the live
+ // ApprovalCard, so a reconnect/navigation can never lose evidence or buttons again.
+ const parked = approvalItemFromParked(
+ mcpItem({
+ tool: "mcp__my_jira__getVisibleJiraProjects",
+ arguments: { cloudId: "0bbb" },
+ category: "mcp",
+ mcp_destination: { transport: "http", host: "mcp.atlassian.com" },
+ }),
+ );
+ expect(parked).not.toBeNull();
+ const onApprove = vi.fn();
+ render(<ApprovalCard item={parked!} onApprove={onApprove} />);
+ expect(screen.getByText(/leaves this computer → mcp\.atlassian\.com/)).toBeTruthy();
+ fireEvent.click(screen.getByTestId("approval-always-trust"));
+ expect(onApprove).toHaveBeenCalledWith("always_trust");
+ });
+
+ it("a legacy parked row without tool data maps to null — the lean card keeps it", () => {
+ const bare: Parameters<typeof approvalItemFromParked>[0] = {
+ ...mcpItem({}),
+ data: undefined,
+ };
+ expect(approvalItemFromParked(bare)).toBeNull();
+ });
+
+ it("legacy parked rows (no stored destination) fall back honestly, not vaguely wrong", () => {
+ render(
+ <InboxItemCard
+ item={mcpItem({
+ tool: "mcp__my_jira__getVisibleJiraProjects",
+ arguments: { cloudId: "0bbb" },
+ })}
+ onResolve={vi.fn()}
+ />,
+ );
+ // No destination on record → the honest unknown, never "stays on this computer".
+ expect(screen.getByText("acts through an MCP server")).toBeTruthy();
+ expect(screen.queryByText(/stays on this computer/)).toBeNull();
+ });
+});
+
describe("ApprovalCard — save_skill (SKILLS-SPEC §5.2)", () => {
const skillApproval = (extra: Partial<ApprovalItem> = {}): ApprovalItem =>
sendApproval({
@@ -255,7 +487,7 @@ describe("ApprovalCard — save_skill (SKILLS-SPEC §5.2)", () => {
it("uses the §7 button copy and never offers a session-wide always", () => {
const onApprove = vi.fn();
render(<ApprovalCard item={skillApproval()} onApprove={onApprove} />);
- expect(screen.queryByText("Always allow")).toBeNull(); // every proposal gets its own review
+ expect(screen.queryByText("Allow for this session")).toBeNull(); // every proposal gets its own review
expect(screen.queryByText("Deny")).toBeNull();
fireEvent.click(screen.getByText("Add to my skills"));
expect(onApprove).toHaveBeenCalledWith("once");
@@ -278,15 +510,15 @@ describe("ApprovalCard — §1.9 egress cards", () => {
const onApprove = vi.fn();
render(<ApprovalCard item={fetchApproval()} onApprove={onApprove} />);
// The grant button names exactly what it covers — the spelling the server mints.
- fireEvent.click(screen.getByText("Always allow bbc.com this session"));
+ fireEvent.click(screen.getByText("Allow bbc.com for this session"));
expect(onApprove).toHaveBeenCalledWith("always_domain");
- expect(screen.queryByText("Always allow")).toBeNull(); // no tool-wide button
+ expect(screen.queryByText("Allow for this session")).toBeNull(); // no tool-wide button
expect(screen.getByText(/leaves this computer → bbc\.com/)).toBeTruthy();
});
it("web_fetch with an unparseable url falls back to once/deny only", () => {
render(<ApprovalCard item={fetchApproval({ args: { url: "not a url" } })} onApprove={vi.fn()} />);
- expect(screen.queryByText(/Always allow/)).toBeNull();
+ expect(screen.queryByText(/for this session/)).toBeNull();
expect(screen.getByText("Allow once")).toBeTruthy();
});
@@ -305,14 +537,14 @@ describe("ApprovalCard — §1.9 egress cards", () => {
expect(
screen.getByText(/Queries go to your configured search provider \(currently: duckduckgo\)\./),
).toBeTruthy();
- fireEvent.click(screen.getByText("Always allow searches this session"));
+ fireEvent.click(screen.getByText("Allow searches for this session"));
expect(onApprove).toHaveBeenCalledWith("always_tool"); // tool-wide IS provider-wide here
expect(screen.getByText(/leaves this computer → your search provider/)).toBeTruthy();
});
it("Auto-Approve fall-through cards hide every session 'always' (§1.5: grants don't skip the reviewer)", () => {
render(<ApprovalCard item={fetchApproval()} onApprove={vi.fn()} autoApprove />);
- expect(screen.queryByText(/Always allow/)).toBeNull();
+ expect(screen.queryByText(/for this session/)).toBeNull();
cleanup();
render(
<ApprovalCard
@@ -321,7 +553,7 @@ describe("ApprovalCard — §1.9 egress cards", () => {
autoApprove
/>,
);
- expect(screen.queryByText(/Always allow/)).toBeNull();
+ expect(screen.queryByText(/for this session/)).toBeNull();
cleanup();
render(
<ApprovalCard
@@ -330,7 +562,7 @@ describe("ApprovalCard — §1.9 egress cards", () => {
autoApprove
/>,
);
- expect(screen.queryByText("Always allow this command")).toBeNull();
+ expect(screen.queryByText("Allow this command for this session")).toBeNull();
expect(screen.getByText("Allow once")).toBeTruthy();
expect(screen.getByText("Deny")).toBeTruthy();
});
@@ -392,7 +624,7 @@ describe("ApprovalCard — session read-only grant", () => {
fireEvent.click(screen.getByTestId("allow-readonly-session"));
expect(onApprove).toHaveBeenCalledWith("readonly_session");
// The command-scoped grant stays alongside — different scopes, both legitimate.
- expect(screen.getByText("Always allow this command")).toBeTruthy();
+ expect(screen.getByText("Allow this command for this session")).toBeTruthy();
cleanup();
// Not classified read-only (a write) → the button never renders.
@@ -449,3 +681,127 @@ describe("ApprovalCard — file provenance", () => {
expect(screen.getByText(/downloaded by the agent/)).toBeTruthy();
});
});
+
+// OPE-136 findings 4+5: the card tells the truth about where an MCP call goes, and
+// hides no evidence behind a truncation the attacker can ride past.
+describe("ApprovalCard — honest MCP and egress evidence (OPE-136)", () => {
+ const mcpApproval = (extra: Partial<ApprovalItem> = {}): ApprovalItem => ({
+ kind: "approval",
+ name: "mcp__atlassian__createJiraIssue",
+ args: { projectKey: "OPS", summary: "Rotate keys" },
+ reason: "requires approval",
+ category: "mcp",
+ ...extra,
+ });
+
+ it("an HTTP MCP call says it leaves this computer, naming the server host", () => {
+ render(
+ <ApprovalCard
+ item={mcpApproval({ mcpDestination: { transport: "http", host: "mcp.atlassian.com" } })}
+ onApprove={vi.fn()}
+ />,
+ );
+ expect(screen.getByText(/leaves this computer → mcp\.atlassian\.com/)).toBeTruthy();
+ expect(screen.queryByText(/stays on this computer/)).toBeNull();
+ });
+
+ it("a stdio MCP call says it runs a local program — never the stays-here catch-all", () => {
+ render(
+ <ApprovalCard
+ item={mcpApproval({ mcpDestination: { transport: "stdio", host: "" } })}
+ onApprove={vi.fn()}
+ />,
+ );
+ expect(screen.getByText("runs a local program on this computer")).toBeTruthy();
+ });
+
+ it("an MCP card with no destination info says so honestly instead of guessing", () => {
+ render(<ApprovalCard item={mcpApproval()} onApprove={vi.fn()} />);
+ expect(screen.getByText("acts through an MCP server")).toBeTruthy();
+ expect(screen.queryByText(/stays on this computer/)).toBeNull();
+ });
+
+ it("MCP arguments render in the expandable block — a payload past char 96 is reachable", () => {
+ const secret = "AKIA" + "X".repeat(150) + "_THE_SMUGGLED_TAIL";
+ render(
+ <ApprovalCard
+ item={mcpApproval({ args: { projectKey: "OPS", summary: "y".repeat(200), note: secret } })}
+ onApprove={vi.fn()}
+ />,
+ );
+ fireEvent.click(screen.getByText(/show all|show the full message/));
+ expect(screen.getByText(/_THE_SMUGGLED_TAIL/)).toBeTruthy();
+ });
+
+ it("web_fetch shows the FULL URL — the query string where exfiltration rides", () => {
+ const url =
+ "https://api.legit-analytics.example/v3/collect?session=abc&pad=" +
+ "z".repeat(400) +
+ "&payload=SECRET_PAST_THE_CUTOFF";
+ render(
+ <ApprovalCard
+ item={mcpApproval({ name: "web_fetch", args: { url }, category: undefined })}
+ onApprove={vi.fn()}
+ />,
+ );
+ // Titled by destination, not "Use web_fetch".
+ expect(screen.getByText(/Fetch from/)).toBeTruthy();
+ fireEvent.click(screen.getByText(/show all|show the full message/));
+ expect(screen.getByText(/SECRET_PAST_THE_CUTOFF/)).toBeTruthy();
+ });
+
+ it("web_search shows the full query in the preview", () => {
+ render(
+ <ApprovalCard
+ item={mcpApproval({
+ name: "web_search",
+ args: { query: "q".repeat(500) + " TAIL_OF_THE_QUERY" },
+ category: undefined,
+ })}
+ onApprove={vi.fn()}
+ />,
+ );
+ fireEvent.click(screen.getByText(/show all|show the full message/));
+ expect(screen.getByText(/TAIL_OF_THE_QUERY/)).toBeTruthy();
+ });
+});
+
+// OPE-136 §4 — the MCP trust ladder: once / durable trust / deny. The session-scoped
+// "Allow for this session" is HIDDEN for MCP tools (the server already refused that
+// grant — a button the server downgrades is a lie), and the durable button never
+// appears in Auto-approve (§1.5: a reviewer-escalated card must not mint a permanent
+// skip).
+describe("ApprovalCard — MCP trust ladder (OPE-136 §4)", () => {
+ const mcpItem = (extra: Partial<ApprovalItem> = {}): ApprovalItem => ({
+ kind: "approval",
+ name: "mcp__atlassian__getJiraIssue",
+ args: { issueKey: "OPS-1" },
+ reason: "requires approval",
+ category: "mcp",
+ ...extra,
+ });
+
+ it("offers Always allow this tool (durable) and NOT the session-scoped grant", () => {
+ const onApprove = vi.fn();
+ render(<ApprovalCard item={mcpItem()} onApprove={onApprove} />);
+ expect(screen.queryByText("Allow for this session")).toBeNull();
+ fireEvent.click(screen.getByTestId("approval-always-trust"));
+ expect(onApprove).toHaveBeenCalledWith("always_trust");
+ });
+
+ it("hides the durable button in Auto-approve mode (§1.5)", () => {
+ render(<ApprovalCard item={mcpItem()} onApprove={vi.fn()} autoApprove />);
+ expect(screen.queryByTestId("approval-always-trust")).toBeNull();
+ expect(screen.getByText("Allow once")).toBeTruthy();
+ });
+
+ it("never offers the durable button on non-MCP cards", () => {
+ render(
+ <ApprovalCard
+ item={mcpItem({ name: "send_message", args: { target: "slack:T1/C1", text: "x" }, category: "messaging" })}
+ onApprove={vi.fn()}
+ />,
+ );
+ expect(screen.queryByTestId("approval-always-trust")).toBeNull();
+ });
+});
diff --git a/surfaces/gui/src/components/ApprovalCard.tsx b/surfaces/gui/src/components/ApprovalCard.tsx
index f703887d..53ce1c71 100644
--- a/surfaces/gui/src/components/ApprovalCard.tsx
+++ b/surfaces/gui/src/components/ApprovalCard.tsx
@@ -115,12 +115,29 @@ export function scopeNote(
name: string,
args: any,
category?: string,
+ mcpDest?: { transport: string; host?: string },
): { text: string; external: boolean } {
const tt = getI18n().getFixedT(null, "translation");
// save_skill's corner answers WHERE (SKILLS-SPEC §5.2): the exact place to find, edit,
// or turn off the skill afterwards.
if (name === "save_skill") return { text: tt("approval.scope.save_skill"), external: false };
if (category === "connector") return { text: tt("approval.scope.connector"), external: true };
+ // MCP tools (OPE-136 finding 4): the one family the old fallthrough mislabeled
+ // "stays on this computer". The destination comes from the server DEF — the user's
+ // own config — never from anything the server claims. No destination known (e.g. a
+ // parked Inbox replay of an old row) → say so honestly rather than guessing.
+ if (name.startsWith("mcp__")) {
+ if (mcpDest?.transport === "http")
+ return {
+ text: tt("approval.scope.leaves_mac", {
+ dest: mcpDest.host || tt("approval.scope.mcp_server_fallback"),
+ }),
+ external: true,
+ };
+ if (mcpDest?.transport === "stdio")
+ return { text: tt("approval.scope.mcp_local"), external: false };
+ return { text: tt("approval.scope.mcp_unknown"), external: true };
+ }
// Egress (§1.9): the request itself reaches the network — never "stays on this computer".
if (name === "web_fetch")
return {
@@ -178,6 +195,59 @@ export function PreviewBlock({ text, mono = true }: { text: string; mono?: boole
);
}
+// OPE-136 finding 7: the long-tail fallback must never silently truncate. shortArgs
+// cuts every value at 96 chars with newlines flattened — the smuggled tail rides in
+// the part the card doesn't render (a 2,000-char email body approved on a 96-char
+// glimpse). Split the arguments: values the one-liner can show WHOLE stay on it;
+// anything longer (or multi-line — flattening is silent distortion too) gets its own
+// labeled, complete, expandable block. Keyed to this fallback path — never to tool
+// names — so every future connector inherits the guarantee with no code change.
+const LONG_ARG_CHARS = 96;
+
+export function splitLongArgs(args: any): {
+ short: Record<string, any>;
+ long: [string, string][];
+} {
+ const short: Record<string, any> = {};
+ const long: [string, string][] = [];
+ if (args && typeof args === "object") {
+ for (const [k, v] of Object.entries(args)) {
+ const s = typeof v === "string" ? v : JSON.stringify(v) ?? "";
+ if (s.length > LONG_ARG_CHARS || s.includes("\n")) long.push([k, s]);
+ else short[k] = v;
+ }
+ }
+ return { short, long };
+}
+
+// "body · 1,912 chars" / "payload · 2.3 MB · binary" — the label says what the block
+// holds and how big it really is, so even a collapsed block discloses its true size.
+function argSizeNote(value: string): string {
+ const t = getI18n().getFixedT(null, "translation");
+ const binary = value.length > 1024 && !/\s/.test(value);
+ if (binary) {
+ const kb = value.length / 1024;
+ const size = kb >= 1024 ? `${(kb / 1024).toFixed(1)} MB` : `${Math.round(kb)} KB`;
+ return t("approval.arg_binary", { size });
+ }
+ return t("approval.arg_chars", { count: value.length });
+}
+
+export function LongArgBlocks({ long }: { long: [string, string][] }) {
+ return (
+ <>
+ {long.map(([k, v]) => (
+ <div key={k} data-testid={`approval-longarg-${k}`}>
+ <div className="approval-rest">
+ {k} · {argSizeNote(v)}
+ </div>
+ <PreviewBlock text={v} />
+ </div>
+ ))}
+ </>
+ );
+}
+
// Outbound message text: short one-liners keep the cozy inline quote; anything
// long (or multi-line) gets the clamped preview so the card stays card-sized.
function MessagePreview({ text, label }: { text: string; label?: string }) {
@@ -219,19 +289,41 @@ function Buttons({
// has a fixed destination (the configured provider), so tool-wide IS provider-wide and
// the button is labelled by what it actually grants: searches.
const fetchHost = item.name === "web_fetch" ? grantHost(item.args?.url) : "";
+ // MCP tools (OPE-136 §4): the session-scoped tool grant was already refused
+ // server-side for them (_grant_offered: tool-wide + argument-unbounded), so the
+ // button was a lie — hidden now. Their sanctioned lever is the DURABLE per-tool
+ // trust rule below.
+ const isMcp = item.name.startsWith("mcp__") && !connector;
const noSessionGrant =
autoApprove ||
offerStanding ||
connector ||
+ isMcp ||
item.name === "run_shell" ||
item.name === "save_skill" ||
item.name === "web_fetch" ||
item.name === "web_search";
+ // OPE-136 run grant: the rung between "once" and "always", EXTERNAL family only —
+ // MCP, connectors, and the core outward tools. EXEC keeps its command-scoped
+ // grants and EGRESS its domain grant (server-refused here anyway). Hidden in a
+ // run context (§25: the task-persistent grant is that flow's one grant) and in
+ // Auto-approve (§1.5: in-flow grants don't skip the judge).
+ const externalFamily = isMcp || connector || EXTERNAL.has(item.name);
return (
<div className="approval-btns">
<button className="btn approval-primary" onClick={() => onApprove("once")}>
{primaryLabel}
</button>
+ {!autoApprove && !offerStanding && externalFamily && (
+ <button
+ className="btn"
+ title={t("approval.btn.this_run_title", { name: item.name })}
+ onClick={() => onApprove("this_run")}
+ data-testid="approval-this-run"
+ >
+ {t("approval.btn.this_run")}
+ </button>
+ )}
{offerStanding && (
<button
className="btn"
@@ -246,6 +338,12 @@ function Buttons({
exactly the scope distinction §25 exists to draw. Same rule for run_shell:
the command-scoped button below is the specific (safer) grant, so the
tool-wide one stays out of the card. */}
+ {/* Button vocabulary (owner call 2026-08-29): "Always" is reserved for grants that
+ actually survive the session — today only the automation-scoped "Allow every
+ time". Session grants live in RAM and die on close, so their labels say "for
+ this session"; the old "Always allow" copy oversold them and sent users hunting
+ for something durable (the requires_approval flag — OPE-136). The label STRINGS
+ live in locales/en.json + zh.json under approval.btn.* — keep them truthful there. */}
{/* save_skill: no session-wide "always" — every skill proposal gets its own review
(SKILLS-SPEC §5: one gate, always). */}
{!noSessionGrant && (
@@ -257,6 +355,20 @@ function Buttons({
{t("approval.btn.always_allow")}
</button>
)}
+ {/* OPE-136 §4 durable trust — the one button that has earned the word "Always":
+ writes a per-tool rule to the user-local store; survives sessions; revocable
+ on the server's detail page. Never in Auto-approve (§1.5: a card the
+ reviewer escalated must not mint a permanent skip). */}
+ {!autoApprove && !offerStanding && isMcp && (
+ <button
+ className="btn"
+ title={t("approval.btn.always_trust_title", { name: item.name })}
+ onClick={() => onApprove("always_trust")}
+ data-testid="approval-always-trust"
+ >
+ {t("approval.btn.always_trust")}
+ </button>
+ )}
{!autoApprove && !offerStanding && item.name === "web_fetch" && fetchHost && (
<button
className="btn"
@@ -322,7 +434,7 @@ export function ApprovalCard({
const { t } = useTranslation();
const [peek, setPeek] = useState(false);
const title = humanizeApprovalTitle(item.name, item.args);
- const scope = scopeNote(item.name, item.args, item.category);
+ const scope = scopeNote(item.name, item.args, item.category, item.mcpDestination);
const grants = item.name === "create_scheduled_task" ? permissionLines(item.args) : [];
// "requires approval" is the engine's default boilerplate — only surface a real reason.
const reason = item.reason && item.reason !== "requires approval" ? item.reason : "";
@@ -408,6 +520,16 @@ export function ApprovalCard({
)}
{/* save_skill (SKILLS-SPEC §5.2): the arguments ARE the review surface. */}
{item.name === "save_skill" && <SaveSkillPreview args={item.args} />}
+ {/* Egress evidence (OPE-136 finding 5): the FULL URL/query in the expandable
+ block — §1.9 gives the reviewer the whole envelope because the path and query
+ are where exfiltration rides; the human's own card must see no less. Never
+ the 96-char truncating one-liner. */}
+ {item.name === "web_fetch" && item.args?.url && (
+ <PreviewBlock text={String(item.args.url)} />
+ )}
+ {item.name === "web_search" && item.args?.query && (
+ <PreviewBlock text={String(item.args.query)} />
+ )}
{/* web_search (§1.9): name the LIVE destination — "currently", never "default",
because the card must show the setting as it stands right now. */}
{item.name === "web_search" && (
@@ -417,6 +539,11 @@ export function ApprovalCard({
: t("approval.search_note")}
</div>
)}
+ {/* MCP arguments (OPE-136 finding 5): everything the call carries, expandable —
+ for a stranger's tool the arguments are the only evidence there is. */}
+ {item.name.startsWith("mcp__") && item.args && Object.keys(item.args).length > 0 && (
+ <PreviewBlock text={JSON.stringify(item.args, null, 2)} />
+ )}
{grants.length > 0 && (
<div className="approval-grants" data-testid="approval-grants">
@@ -438,11 +565,23 @@ export function ApprovalCard({
})}
</div>
)}
- {/* Long-tail tools: no bespoke preview — fall back to the compact args line. */}
+ {/* Long-tail tools: no bespoke preview — the compact line carries only values
+ it can show WHOLE; anything longer renders as a complete labeled block
+ (finding 7: no silent truncation, on any tool, ever). MCP and egress tools
+ are excluded: they render full evidence above. */}
{!FILE_WRITES.has(item.name) &&
- !["run_shell", "send_message", "send_file", "save_skill"].includes(item.name) &&
+ !["run_shell", "send_message", "send_file", "save_skill", "web_fetch", "web_search"].includes(item.name) &&
+ !item.name.startsWith("mcp__") &&
!grants.length &&
- shortArgs(item.args) && <div className="approval-rest">{shortArgs(item.args)}</div>}
+ (() => {
+ const { short, long } = splitLongArgs(item.args);
+ return (
+ <>
+ {shortArgs(short) && <div className="approval-rest">{shortArgs(short)}</div>}
+ <LongArgBlocks long={long} />
+ </>
+ );
+ })()}
{provenance}
{reviewerUnsure}
{reason && <div className="approval-reason">{reason}</div>}
diff --git a/surfaces/gui/src/components/InboxItemCard.tsx b/surfaces/gui/src/components/InboxItemCard.tsx
index f5bc18df..a173697f 100644
--- a/surfaces/gui/src/components/InboxItemCard.tsx
+++ b/surfaces/gui/src/components/InboxItemCard.tsx
@@ -1,7 +1,7 @@
import { useState, type ReactNode } from "react";
import { useTranslation } from "react-i18next";
import type { InboxItem } from "../api";
-import type { QuestionOption } from "../types";
+import type { Item, QuestionOption } from "../types";
import { humanizeApprovalTitle } from "../humanize";
import {
approvalActionLabels,
@@ -39,6 +39,29 @@ const ROW_BASE = "w-full text-left rounded-lg border px-3 py-2 transition-colors
const ROW_OFF = "border-line bg-paper hover:border-accent hover:bg-accentSoft/50";
const ROW_ON = "border-accent bg-accentSoft";
+// Rebuild a LIVE approval item from a parked Inbox row, so the session view can
+// render the real ApprovalCard for it — ONE renderer, no second dress to drift
+// (OPE-136 found-in-testing: the redelivered parked card kept losing the live
+// card's upgrades — first evidence, then the trust ladder). Returns null for
+// legacy rows without tool data (they keep this file's lean treatment) — and the
+// cross-session Inbox list keeps the lean card on purpose: standing grants are
+// not offered out of context. The decision vocabulary the ApprovalCard sends
+// ("once" / "always_*" / "deny") resolves through the same server-side
+// approval_outcome() as the live path, validation included.
+export function approvalItemFromParked(item: InboxItem): Extract<Item, { kind: "approval" }> | null {
+ const d = item.data;
+ if (item.kind !== "approval" || !d?.tool) return null;
+ return {
+ kind: "approval",
+ name: String(d.tool),
+ args: d.arguments ?? {},
+ reason: typeof d.reason === "string" ? d.reason : "",
+ ...(d.category ? { category: String(d.category) } : {}),
+ ...(d.standing_target ? { standingTarget: String(d.standing_target) } : {}),
+ ...(d.mcp_destination ? { mcpDestination: d.mcp_destination } : {}),
+ };
+}
+
// -- question normalization ---------------------------------------------------
interface NormOption {
@@ -318,7 +341,15 @@ export function InboxItemCard({
<div className="flex items-center justify-between gap-3">
<TitleText line={humanizeApprovalTitle(item.data.tool, item.data.arguments)} />
{(() => {
- const s = scopeNote(item.data.tool, item.data.arguments);
+ // OPE-136 §35 parity: the parked chip gets the same category + MCP
+ // destination the live card gets — "leaves this computer → host", not
+ // the vague fallback. Older parked rows lack both and fall back honestly.
+ const s = scopeNote(
+ item.data.tool,
+ item.data.arguments,
+ item.data.category,
+ item.data.mcp_destination,
+ );
return (
<span className={"text-[11px] whitespace-nowrap pt-0.5 " + (s.external ? "text-warnInk" : "text-faint")}>
{s.text}
@@ -339,9 +370,23 @@ export function InboxItemCard({
<PreviewBlock text={item.data.arguments.content} />
) : item.kind === "approval" && item.data?.tool && typeof item.data.arguments?.command === "string" ? (
<PreviewBlock text={item.data.arguments.command} />
+ ) : item.kind === "approval" &&
+ item.data?.tool?.startsWith("mcp__") &&
+ item.data.arguments &&
+ Object.keys(item.data.arguments).length > 0 ? (
+ // MCP arguments (OPE-136 finding 5, same rule as the live card): for a
+ // stranger's tool the arguments are the only evidence there is — the full
+ // envelope in an expandable block, never the one-line truncated preview
+ // (the body, subsumed by this block, is skipped for this branch).
+ <PreviewBlock text={JSON.stringify(item.data.arguments, null, 2)} />
) : !isQuestion && item.body ? (
<div className="text-[13px] text-muted mt-1 whitespace-pre-wrap">{item.body}</div>
) : null}
+ {/* A real (non-boilerplate) reason travels in data — the body may be skipped
+ above, and the reason must survive that (e.g. a reviewer-unsure note). */}
+ {item.kind === "approval" && item.data?.reason ? (
+ <div className="text-[12px] text-muted mt-1">{item.data.reason}</div>
+ ) : null}
{!isQuestion && chip}
{item.kind === "approval" ? (
<div className="flex items-center gap-2 mt-2.5 flex-wrap">
diff --git a/surfaces/gui/src/components/Transcript.test.tsx b/surfaces/gui/src/components/Transcript.test.tsx
index 44ec4c9a..204307e0 100644
--- a/surfaces/gui/src/components/Transcript.test.tsx
+++ b/surfaces/gui/src/components/Transcript.test.tsx
@@ -83,6 +83,53 @@ describe("TurnGroup (Transcript §33)", () => {
});
});
+// OPE-136: two DIFFERENT standing sources can waive an MCP card, and the chip must
+// name the right one — a user's own trust rule was being described as the server's
+// mcp.json flag (owner-hit 2026-08-30).
+describe("origin chips — standing MCP trust names its source", () => {
+ const toolWith = (origin: string): Item[] => [
+ { kind: "user", text: "search jira" },
+ { kind: "tool", id: "t1", name: "mcp__jira__search", args: { jql: "x" }, status: "ok", approvalOrigin: origin },
+ ];
+ const chipFor = (origin: string) => {
+ const { container } = render(<Transcript items={toolWith(origin)} onApprove={vi.fn()} />);
+ fireEvent.click(container.querySelector("summary.stepgroup-head")!);
+ const chip = screen.getByTestId("tool-approval-origin");
+ return { text: chip.textContent, title: chip.getAttribute("title") };
+ };
+
+ it("a user trust rule says so, and points at the tool page to revoke", () => {
+ const chip = chipFor("trusted_rule");
+ expect(chip.text).toBe("allowed by your trust rule");
+ expect(chip.title).toContain("Always allow this tool");
+ expect(chip.title).toContain("Connectors page");
+ });
+
+ it("the legacy server flag keeps the server-trust label pointing at mcp.json", () => {
+ cleanup();
+ const chip = chipFor("trusted_server");
+ expect(chip.text).toBe("allowed by server trust");
+ expect(chip.title).toContain("mcp.json");
+ });
+
+ it("pre-split transcripts (origin 'trusted') fall back to a generic honest label", () => {
+ cleanup();
+ const chip = chipFor("trusted");
+ expect(chip.text).toBe("allowed by standing trust");
+ expect(chip.title).not.toContain("mcp.json"); // never claims the wrong source
+ });
+
+ it("a run-grant covered call says so, and names the expiry", () => {
+ // OPE-136 "Allow for this request": covered calls run cardless but never
+ // invisible — the chip names the user's own in-run click as the source.
+ cleanup();
+ const chip = chipFor("run_grant");
+ expect(chip.text).toBe("allowed for this request");
+ expect(chip.title).toContain("Allow for this request");
+ expect(chip.title).toContain("expired when the answer finished");
+ });
+});
+
describe("live turns (§33 flicker fix)", () => {
const LIVE: Item[] = [
{ kind: "user", text: "build the app" },
diff --git a/surfaces/gui/src/components/Transcript.tsx b/surfaces/gui/src/components/Transcript.tsx
index b10f0a19..34213cee 100644
--- a/surfaces/gui/src/components/Transcript.tsx
+++ b/surfaces/gui/src/components/Transcript.tsx
@@ -179,7 +179,20 @@ function originChip(origin: string | undefined, note: string | undefined, grant?
</span>
);
}
- if (origin !== "reviewer" && origin !== "bypass") return null;
+ // Two DIFFERENT standing sources can waive an MCP card, and the chip must name the
+ // right one: a per-tool rule the USER minted ("Always allow this tool" — undo lives
+ // on the server's tool page) vs the legacy server-wide don't-ask flag (undo lives in
+ // mcp.json / the Convert banner). One generic label misled a real user into thinking
+ // the server had marked their own rule (owner-hit 2026-08-30). Plain "trusted" is
+ // the pre-split origin persisted in old transcripts — kept as a generic fallback.
+ const TRUST_ORIGINS = new Set(["trusted", "trusted_rule", "trusted_server"]);
+ if (
+ origin !== "reviewer" &&
+ origin !== "bypass" &&
+ origin !== "run_grant" &&
+ !TRUST_ORIGINS.has(origin ?? "")
+ )
+ return null;
return (
<span
className="text-[11px] text-faint shrink-0"
@@ -187,10 +200,28 @@ function originChip(origin: string | undefined, note: string | undefined, grant?
title={
origin === "reviewer"
? note || t("transcript.approval.reviewer_allowed_title")
- : t("transcript.approval.bypass_title")
+ : origin === "trusted_rule"
+ ? t("transcript.approval.trusted_rule_title")
+ : origin === "trusted_server"
+ ? t("transcript.approval.trusted_title")
+ : origin === "trusted"
+ ? t("transcript.approval.trusted_generic_title")
+ : origin === "run_grant"
+ ? t("transcript.approval.run_grant_title")
+ : t("transcript.approval.bypass_title")
}
>
- {origin === "reviewer" ? t("transcript.approval.auto_approved") : t("transcript.approval.bypassed")}
+ {origin === "reviewer"
+ ? t("transcript.approval.auto_approved")
+ : origin === "trusted_rule"
+ ? t("transcript.approval.trusted_rule")
+ : origin === "trusted_server"
+ ? t("transcript.approval.trusted")
+ : origin === "trusted"
+ ? t("transcript.approval.trusted_generic")
+ : origin === "run_grant"
+ ? t("transcript.approval.run_grant")
+ : t("transcript.approval.bypassed")}
</span>
);
}
diff --git a/surfaces/gui/src/components/connectors/AccountsDetail.tsx b/surfaces/gui/src/components/connectors/AccountsDetail.tsx
index cb2e0e8d..a42372fa 100644
--- a/surfaces/gui/src/components/connectors/AccountsDetail.tsx
+++ b/surfaces/gui/src/components/connectors/AccountsDetail.tsx
@@ -127,11 +127,16 @@ function Row({
{a.account_id}
</span>
)}
- {a.default && <span className={TAG_ACCENT}>{t("connector.default")}</span>}
+ {a.default && (
+ <span className={TAG_ACCENT} title={t("accounts.default_tip")}>
+ {t("connector.default")}
+ </span>
+ )}
</span>
{!a.default && (
<button
className="text-[12px] text-muted hover:text-ink shrink-0"
+ title={t("accounts.default_tip")}
data-testid={`account-make-default-${a.account_id}`}
onClick={async () => {
await setDefaultAccount(connector, a.account_id);
@@ -143,7 +148,7 @@ function Row({
)}
<button
className={XBTN}
- title={t("accounts.disconnect_account_title")}
+ title={t("accounts.disconnect_tip")}
data-testid={`account-disconnect-${a.account_id}`}
disabled={busy}
onClick={async () => {
diff --git a/surfaces/gui/src/components/connectors/AvailableDetail.tsx b/surfaces/gui/src/components/connectors/AvailableDetail.tsx
index efc36164..a59616f0 100644
--- a/surfaces/gui/src/components/connectors/AvailableDetail.tsx
+++ b/surfaces/gui/src/components/connectors/AvailableDetail.tsx
@@ -3,7 +3,8 @@ import { useTranslation } from "react-i18next";
import { type CloudStatus, type Connector } from "../../api";
import { ConnectorBadge } from "../../connectors/ConnectorIcon";
import { AddConnectionModal } from "./AddConnectionModal";
-import { FOOT, GRP, GRP_H, PILL_ACCENT, ROW, TAG_QUIET } from "./ui";
+import { ApprovalChip } from "./ToolReview";
+import { FOOT, GRP, GRP_H, PILL_ACCENT, ROW } from "./ui";
// Pre-connect detail page (UX-DECISIONS §38): what a connector is for and what
// access it gets, BEFORE any credentials exist. About paragraph, honest Access
@@ -81,7 +82,8 @@ export function AvailableDetail({
<span className="text-[13px]">{tool.label}</span>
<span className="block text-[12px] text-muted">{tool.description}</span>
</span>
- {tool.kind !== "read" && <span className={TAG_QUIET}>{tt("available.asks_first")}</span>}
+ {/* Same chip, same tooltip, as the connected page's tool list. */}
+ <ApprovalChip kind={tool.kind !== "read" ? "asks_first" : "read"} />
</div>
))}
</div>
diff --git a/surfaces/gui/src/components/connectors/ConnectorsList.tsx b/surfaces/gui/src/components/connectors/ConnectorsList.tsx
index 69a79695..597475f2 100644
--- a/surfaces/gui/src/components/connectors/ConnectorsList.tsx
+++ b/surfaces/gui/src/components/connectors/ConnectorsList.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { type CloudStatus, type Connector, type McpServer, type SlackStatus } from "../../api";
import { ConnectorBadge } from "../../connectors/ConnectorIcon";
import { AddConnectionModal } from "./AddConnectionModal";
-import { AddMcpModal, CustomMcpGroup } from "./CustomMcp";
+import { AddMcpModal, CustomMcpGroup, McpPresetRows, mcpPresetOffers } from "./CustomMcp";
import { CHIP_OK, CHIP_OFF, CHIP_WARN, GRP, GRP_H, FOOT, PILL_QUIET, ROW } from "./ui";
// The Connectors LIST (UX-DECISIONS §21): connected first in their own inset group —
@@ -61,6 +61,10 @@ export function ConnectorsList({
/>
</div>
+ {/* No legend, no tooltips (owner call 2026-08-30): with only Ready and
+ Connect the vocabulary is self-explanatory — the earlier legend existed
+ to explain a Live/Ready split that has been deleted. */}
+
{/* No cloud strip here anymore (§26): the sidebar's account row is the permanent
sign-in home, and the connect modals keep their inline sign-in panes. */}
{connected.length > 0 && (
@@ -93,7 +97,9 @@ export function ConnectorsList({
onChanged={onChanged}
/>
- <div className={GRP_H}>{t("connector.available")}</div>
+ {/* The FULL offer count, not the folded slice — the header is the only
+ honest total visible before "show all" (owner rule: headers count rows). */}
+ <div className={GRP_H}>{t("connector.available", { count: available.length })}</div>
<div className={GRP}>
{shown.map((c) => (
/* The row navigates to the pre-connect detail page (§38); the pill
@@ -121,7 +127,14 @@ export function ConnectorsList({
</span>
</button>
))}
- {shown.length === 0 && (
+ {/* Curated MCP quick-add OFFERS live here among the available connectors —
+ never inside Custom · MCP, where a row means "a server you own". */}
+ <McpPresetRows
+ presets={mcpPresetOffers(mcpServers, filter)}
+ onOpen={(name) => onOpen("mcp:" + name)}
+ onChanged={onChanged}
+ />
+ {shown.length === 0 && mcpPresetOffers(mcpServers, filter).length === 0 && (
<div className={ROW + " text-[13px] text-muted"}>{t("connector.nothing_matches")}</div>
)}
</div>
@@ -142,7 +155,13 @@ export function ConnectorsList({
onChanged={onChanged}
/>
)}
- {addingMcp && <AddMcpModal onClose={() => setAddingMcp(false)} onChanged={onChanged} />}
+ {addingMcp && (
+ <AddMcpModal
+ onClose={() => setAddingMcp(false)}
+ onChanged={onChanged}
+ onAdded={(name) => onOpen("mcp:" + name)}
+ />
+ )}
</div>
);
}
@@ -169,9 +188,13 @@ function healthChip(c: Connector, slack: SlackStatus | null, t: (k: string, opts
return <span className={CHIP_WARN}>{"● " + t("connector.reconnecting")}</span>;
if (Object.values(slack.teams).some((tm) => !tm.token_ok))
return <span className={CHIP_WARN}>{"⚠ " + t("connector.token")}</span>;
- return <span className={CHIP_OK}>{"● " + t("connector.live")}</span>;
+ return <span className={CHIP_OK}>{"● " + t("connector.ready")}</span>;
}
- if (c.two_way && c.connected) return <span className={CHIP_OK}>{"● " + t("connector.live")}</span>;
+ // ONE healthy word (owner call 2026-08-30): Live-vs-Ready distinguished the
+ // plumbing (standing socket vs on-demand), not anything the user would DO
+ // differently — and MCP's "Live" wasn't heartbeat-monitored anyway. The
+ // runtime difference shows where it matters: the problem chips above
+ // (Reconnecting / Offline / Needs sign-in / Error) are per-transport honest.
return <span className={CHIP_OK}>{"● " + t("connector.ready")}</span>;
}
diff --git a/surfaces/gui/src/components/connectors/CustomMcp.test.tsx b/surfaces/gui/src/components/connectors/CustomMcp.test.tsx
new file mode 100644
index 00000000..7888c03b
--- /dev/null
+++ b/surfaces/gui/src/components/connectors/CustomMcp.test.tsx
@@ -0,0 +1,269 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { cleanup, render, screen, waitFor, fireEvent } from "@testing-library/react";
+
+// OPE-136 §3 — the connect-time tool review: checkboxes decide EXISTENCE (an
+// unchecked tool is never registered), saved as `include_tools`; server growth is
+// fail-closed (new tools arrive unchecked, badged).
+
+const getMcpTools =
+ vi.fn<(name: string) => Promise<{ ok: boolean; error?: string; tools: { name: string; description: string }[] }>>();
+const patchMcpServer = vi.fn<(name: string, changes: unknown) => Promise<{ ok: boolean }>>(
+ async () => ({ ok: true }),
+);
+const getMcpTrust = vi.fn<
+ (name: string) => Promise<{ ok: boolean; tools: string[]; legacy_dont_ask: boolean }>
+>(async () => ({ ok: true, tools: [], legacy_dont_ask: false }));
+const revokeMcpTrust = vi.fn<(name: string, tool: string) => Promise<{ ok: boolean }>>(
+ async () => ({ ok: true }),
+);
+const convertMcpTrust = vi.fn<
+ (name: string) => Promise<{ ok: boolean; trusted?: string[] }>
+>(async () => ({ ok: true, trusted: [] }));
+vi.mock("../../api", () => ({
+ addMcpServer: vi.fn(),
+ connectMcp: vi.fn(),
+ deleteMcpServer: vi.fn(),
+ getMcpTools: (name: string) => getMcpTools(name),
+ patchMcpServer: (name: string, changes: unknown) => patchMcpServer(name, changes),
+ getMcpTrust: (name: string) => getMcpTrust(name),
+ revokeMcpTrust: (name: string, tool: string) => revokeMcpTrust(name, tool),
+ convertMcpTrust: (name: string) => convertMcpTrust(name),
+ signoutMcp: vi.fn(),
+}));
+
+import { McpToolReview } from "./CustomMcp";
+import type { McpServer } from "../../api";
+
+const OFFERED = [
+ { name: "getIssue", description: "Read a Jira issue" },
+ { name: "createIssue", description: "Create a Jira issue" },
+ { name: "deleteIssue", description: "Delete an issue permanently" },
+];
+
+const server = (config: Record<string, unknown> = {}): McpServer => ({
+ name: "jirax",
+ enabled: true,
+ transport: "http",
+ requires_approval: true,
+ status: "connected",
+ tool_count: 3,
+ config: { type: "http", url: "https://mcp.example.com/v1/mcp", ...config },
+});
+
+afterEach(() => {
+ cleanup();
+ getMcpTools.mockReset();
+ patchMcpServer.mockClear();
+ revokeMcpTrust.mockClear();
+ convertMcpTrust.mockClear();
+ getMcpTrust.mockReset();
+ getMcpTrust.mockResolvedValue({ ok: true, tools: [], legacy_dont_ask: false });
+});
+
+describe("McpToolReview (OPE-136 §3)", () => {
+ it("first review: auto-loads, everything checked, Keep writes the full include list", async () => {
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ render(<McpToolReview server={server()} onChanged={vi.fn()} />);
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-check-getIssue")).toBeTruthy());
+ for (const t of OFFERED) {
+ expect((screen.getByTestId(`mcp-tool-check-${t.name}`) as HTMLInputElement).checked).toBe(true);
+ }
+ // Saving with everything checked still writes the list — that is what locks in
+ // fail-closed growth (a later server tool won't be on it).
+ fireEvent.click(screen.getByTestId("mcp-tools-save-jirax"));
+ await waitFor(() =>
+ expect(patchMcpServer).toHaveBeenCalledWith("jirax", {
+ include_tools: ["getIssue", "createIssue", "deleteIssue"],
+ exclude_tools: [],
+ }),
+ );
+ });
+
+ it("unchecking a tool drops it from the saved list, preserving server order", async () => {
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ render(<McpToolReview server={server()} onChanged={vi.fn()} />);
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-check-deleteIssue")).toBeTruthy());
+ fireEvent.click(screen.getByTestId("mcp-tool-check-deleteIssue"));
+ fireEvent.click(screen.getByTestId("mcp-tools-save-jirax"));
+ await waitFor(() =>
+ expect(patchMcpServer).toHaveBeenCalledWith("jirax", {
+ include_tools: ["getIssue", "createIssue"],
+ // The first-review ceremony reviews the whole list: the uncheck is an
+ // explicit decline, recorded so it never wears the "new" badge later.
+ exclude_tools: ["deleteIssue"],
+ }),
+ );
+ });
+
+ it("a tool the server added after the review arrives UNCHECKED with a new badge", async () => {
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ render(
+ <McpToolReview
+ server={server({ include_tools: ["getIssue", "createIssue"] })}
+ onChanged={vi.fn()}
+ />,
+ );
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-check-deleteIssue")).toBeTruthy());
+ expect((screen.getByTestId("mcp-tool-check-deleteIssue") as HTMLInputElement).checked).toBe(false);
+ expect(screen.getByTestId("mcp-tool-new-deleteIssue")).toBeTruthy();
+ expect((screen.getByTestId("mcp-tool-check-getIssue") as HTMLInputElement).checked).toBe(true);
+ });
+
+ it("after the first review, toggles auto-save — no button, a Saved tick instead", async () => {
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ render(
+ <McpToolReview
+ server={server({ include_tools: ["getIssue", "createIssue", "deleteIssue"] })}
+ onChanged={vi.fn()}
+ />,
+ );
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-check-deleteIssue")).toBeTruthy());
+ fireEvent.click(screen.getByTestId("mcp-tool-check-deleteIssue"));
+ // The write happens without any save button click…
+ await waitFor(() =>
+ expect(patchMcpServer).toHaveBeenCalledWith("jirax", {
+ include_tools: ["getIssue", "createIssue"],
+ exclude_tools: ["deleteIssue"],
+ }),
+ );
+ expect(screen.queryByTestId("mcp-tools-save-jirax")).toBeNull();
+ // …and leaves a visible receipt.
+ await waitFor(() => expect(screen.getByTestId("mcp-tools-saved-jirax")).toBeTruthy());
+ });
+
+ it("a declined tool is remembered as DECLINED — absent, but never 'new'", async () => {
+ // Owner catch 2026-08-30: unchecking a tool earned it the "new" badge, because
+ // the include list alone can't tell "you said no" from "the server added it".
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ render(
+ <McpToolReview
+ server={server({ include_tools: ["getIssue", "createIssue"], exclude_tools: ["deleteIssue"] })}
+ onChanged={vi.fn()}
+ />,
+ );
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-check-deleteIssue")).toBeTruthy());
+ expect((screen.getByTestId("mcp-tool-check-deleteIssue") as HTMLInputElement).checked).toBe(false);
+ expect(screen.queryByTestId("mcp-tool-new-deleteIssue")).toBeNull();
+ });
+
+ it("an autosaved uncheck moves ONLY the toggled tool — server-new tools keep their badge", async () => {
+ // deleteIssue is server-new (on neither list). Unchecking createIssue must not
+ // sweep deleteIssue into the declined list — a whole-list recompute would
+ // silently convert "new, needs review" into "declined".
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ render(
+ <McpToolReview
+ server={server({ include_tools: ["getIssue", "createIssue"] })}
+ onChanged={vi.fn()}
+ />,
+ );
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-check-createIssue")).toBeTruthy());
+ fireEvent.click(screen.getByTestId("mcp-tool-check-createIssue"));
+ await waitFor(() =>
+ expect(patchMcpServer).toHaveBeenCalledWith("jirax", {
+ include_tools: ["getIssue"],
+ exclude_tools: ["createIssue"],
+ }),
+ );
+ expect(screen.getByTestId("mcp-tool-new-deleteIssue")).toBeTruthy();
+ });
+
+ it("a reviewed list collapses to the connector-style summary row; first review stays open", async () => {
+ // One dialect (owner ask 2026-08-30): after the ceremony the MCP list wears the
+ // same quiet "› Tools · N of M enabled" summary the connector pages use.
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ render(
+ <McpToolReview
+ server={server({ include_tools: ["getIssue", "createIssue"] })}
+ onChanged={vi.fn()}
+ />,
+ );
+ await waitFor(() => expect(screen.getByText("› Tools")).toBeTruthy());
+ // Exactly once — in the summary; the fine print carries only the explanations
+ // (owner catch 2026-08-30: the count printed twice in adjacent lines).
+ expect(screen.getAllByText(/2 of 3 enabled/).length).toBe(1);
+ // The shared fine print is present in the expandable content.
+ expect(screen.getByText(/unchecked tools never reach a session/)).toBeTruthy();
+ expect(screen.getByText(/every tool asks before running unless always-allowed/)).toBeTruthy();
+ cleanup();
+
+ // First review: no summary row — the ceremony IS the open list.
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ render(<McpToolReview server={server()} onChanged={vi.fn()} />);
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-check-getIssue")).toBeTruthy());
+ expect(screen.queryByText("› Tools")).toBeNull();
+ expect(screen.getByTestId("mcp-tools-save-jirax")).toBeTruthy();
+ });
+
+ it("a saved review with no changes offers no save button", async () => {
+ getMcpTools.mockResolvedValue({
+ ok: true,
+ tools: OFFERED.slice(0, 2),
+ });
+ render(
+ <McpToolReview
+ server={server({ include_tools: ["getIssue", "createIssue"] })}
+ onChanged={vi.fn()}
+ />,
+ );
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-check-getIssue")).toBeTruthy());
+ expect(screen.queryByTestId("mcp-tools-save-jirax")).toBeNull();
+ });
+
+ it("descriptions render as the server's own words, quoted", async () => {
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED.slice(0, 1) });
+ render(<McpToolReview server={server()} onChanged={vi.fn()} />);
+ await waitFor(() => expect(screen.getByText(/“Read a Jira issue”/)).toBeTruthy());
+ });
+});
+
+// OPE-136 §4/§5 — standing trust on the review list, and the legacy flag made loud.
+describe("McpToolReview — trust markers and the legacy flag", () => {
+ it("a trusted tool shows the Always-allowed chip; Revoke removes the rule", async () => {
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ getMcpTrust.mockResolvedValue({ ok: true, tools: ["getIssue"], legacy_dont_ask: false });
+ render(<McpToolReview server={server({ include_tools: ["getIssue", "createIssue"] })} onChanged={vi.fn()} />);
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-trusted-getIssue")).toBeTruthy());
+ expect(screen.queryByTestId("mcp-tool-trusted-createIssue")).toBeNull();
+ // The chip echoes the card button that created it, and the tooltip closes the
+ // loop. Lowercase, like its read/asks-first tag siblings (owner call 2026-08-30).
+ expect(screen.getByText("always allowed")).toBeTruthy();
+ expect(screen.getByText("always allowed").getAttribute("title")).toContain(
+ "You chose 'Always allow this tool'",
+ );
+ // Granted authority surfaces in the summary line before anyone scrolls.
+ expect(screen.getByText(/1 always allowed/)).toBeTruthy();
+ fireEvent.click(screen.getByText("Revoke"));
+ await waitFor(() => expect(revokeMcpTrust).toHaveBeenCalledWith("jirax", "getIssue"));
+ });
+
+ it("an unchecked-but-trusted tool keeps a dimmed idle chip — standing rules never vanish", async () => {
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ getMcpTrust.mockResolvedValue({ ok: true, tools: ["getIssue"], legacy_dont_ask: false });
+ // getIssue is trusted but NOT in include_tools → it can never be called, yet the
+ // rule still exists on disk and must stay visible on the screen that audits it.
+ render(<McpToolReview server={server({ include_tools: ["createIssue"] })} onChanged={vi.fn()} />);
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-trusted-getIssue")).toBeTruthy());
+ const marker = screen.getByTestId("mcp-tool-trusted-getIssue");
+ expect(marker.className).toContain("opacity-50");
+ expect(screen.getByText("always allowed").getAttribute("title")).toContain("Idle");
+ });
+
+ it("the legacy don't-ask flag shows the loud banner; convert calls the migration", async () => {
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ getMcpTrust.mockResolvedValue({ ok: true, tools: [], legacy_dont_ask: true });
+ render(<McpToolReview server={server()} onChanged={vi.fn()} />);
+ await waitFor(() => expect(screen.getByTestId("mcp-legacy-warn-jirax")).toBeTruthy());
+ expect(screen.getByText("This server never asks")).toBeTruthy();
+ fireEvent.click(screen.getByTestId("mcp-legacy-convert-jirax"));
+ await waitFor(() => expect(convertMcpTrust).toHaveBeenCalledWith("jirax"));
+ });
+
+ it("no banner when the config is clean", async () => {
+ getMcpTools.mockResolvedValue({ ok: true, tools: OFFERED });
+ getMcpTrust.mockResolvedValue({ ok: true, tools: [], legacy_dont_ask: false });
+ render(<McpToolReview server={server()} onChanged={vi.fn()} />);
+ await waitFor(() => expect(screen.getByTestId("mcp-tool-check-getIssue")).toBeTruthy());
+ expect(screen.queryByTestId("mcp-legacy-warn-jirax")).toBeNull();
+ });
+});
diff --git a/surfaces/gui/src/components/connectors/CustomMcp.tsx b/surfaces/gui/src/components/connectors/CustomMcp.tsx
index 532ab5eb..5e030bf1 100644
--- a/surfaces/gui/src/components/connectors/CustomMcp.tsx
+++ b/surfaces/gui/src/components/connectors/CustomMcp.tsx
@@ -1,11 +1,15 @@
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { getI18n, useTranslation } from "react-i18next";
import {
addMcpServer,
connectMcp,
+ convertMcpTrust,
deleteMcpServer,
getMcpTools,
+ getMcpTrust,
patchMcpServer,
+ revealMcpConfig,
+ revokeMcpTrust,
signoutMcp,
type McpServer,
} from "../../api";
@@ -22,7 +26,9 @@ import {
PILL_ACCENT,
PILL_QUIET,
ROW,
+ TAG_QUIET,
} from "./ui";
+import { SavedTick, ToolRow, ToolsCountLine, useSavedTick } from "./ToolReview";
// Custom/BYO MCP servers on the Connectors page (UX-DECISIONS §21 + UX-034: the
// separate MCP tab is retired). They render as a "Custom · MCP" group at the end
@@ -54,7 +60,9 @@ export function mcpChip(s: McpServer) {
if (!s.enabled) return <span className={CHIP_OFF}>● {t("mcp.status_off")}</span>;
if (s.status === "authorizing")
return <span className={CHIP_WARN}>● {isOauth ? t("mcp.status_signing_in") : t("mcp.status_testing")}</span>;
- if (s.status === "connected") return <span className={CHIP_OK}>● {t("connector.live")}</span>;
+ // One healthy word (owner call 2026-08-30): connected and merely-tested both
+ // read Ready — problems get their own chips; the plumbing is not the user's.
+ if (s.status === "connected") return <span className={CHIP_OK}>● {t("connector.ready")}</span>;
if (s.auth_hint || s.status === "needs_auth")
return <span className={CHIP_WARN}>● {t("mcp.status_needs_sign_in")}</span>;
if (s.status === "error") return <span className={CHIP_ERR}>● {t("mcp.status_error")}</span>;
@@ -113,12 +121,31 @@ export function CustomMcpGroup({
const t = setInterval(onChanged, 1000);
return () => clearInterval(t);
}, [anyAuthorizing, onChanged]);
- const presets = MCP_PRESETS.filter((p) => !servers.some((s) => s.name === p.name));
- if (servers.length === 0 && presets.length === 0) return null;
+ // Not-yet-added preset OFFERS render among the AVAILABLE connectors (McpPresetRows),
+ // never here: a row in this group means "a server you own". When Remove used to make
+ // the offer reappear in this same section, it was indistinguishable from a server
+ // that survived removal (owner catch 2026-08-30).
+ if (servers.length === 0) return null;
return (
<>
- <div className={GRP_H}>{t("mcp.group_custom")}</div>
+ {/* Every group header counts its own rows (owner rule 2026-08-30) —
+ matching "Connected · N". Ownership count, not health: a needs-sign-in
+ server still lists (and counts) here; the per-row chips carry health. */}
+ <div className={GRP_H + " flex items-baseline gap-2"}>
+ <span>{t("mcp.group_custom", { count: servers.length })}</span>
+ {/* ONE common window into the file all servers share (owner call
+ 2026-08-30): reveal mcp.json in the file manager — never auto-open,
+ the default app for .json is a lottery across machines. */}
+ <button
+ className="font-normal normal-case tracking-normal text-faint hover:text-ink"
+ title={t("mcp.config_reveal_tip")}
+ data-testid="mcp-config-reveal"
+ onClick={() => void revealMcpConfig()}
+ >
+ {t("mcp.config_reveal")}
+ </button>
+ </div>
<div className={GRP} data-testid="custom-mcp-group">
{servers.map((s) => (
<button
@@ -136,31 +163,63 @@ export function CustomMcpGroup({
<span className="text-faint text-[14px] shrink-0">›</span>
</button>
))}
- {presets.map((p) => (
- <div key={p.name} className={ROW} data-testid={`mcp-preset-${p.name}`}>
- <McpGlyph />
- <span className="min-w-0 flex-1">
- <span className="font-medium text-[13px]">{p.label}</span>
- <span className="block text-[12px] text-muted truncate">{t(p.blurb)}</span>
- </span>
- <span
- className={PILL_QUIET + " cursor-pointer"}
- role="button"
- onClick={async () => {
- await addMcpServer(p.name, p.config);
- await connectMcp(p.name); // opens the browser sign-in right away
- onChanged();
- }}
- >
- {t("connector.connect")}
- </span>
- </div>
- ))}
</div>
</>
);
}
+/** The curated quick-add offers that are NOT yet added, filtered by the page's search. */
+export function mcpPresetOffers(servers: McpServer[], query: string) {
+ const q = query.trim().toLowerCase();
+ return MCP_PRESETS.filter(
+ (p) =>
+ !servers.some((s) => s.name === p.name) &&
+ (!q || p.label.toLowerCase().includes(q) || p.name.includes(q)),
+ );
+}
+
+// Preset offer rows for the AVAILABLE group. Connect creates the entry, starts the
+// browser sign-in, and navigates STRAIGHT to the detail page — so the connect-time
+// tool review (OPE-136 §3) happens while the user is right there. Skipping that
+// navigation left the server listless: every tool, including ones the server adds
+// later, reached sessions until someone happened to open the detail page.
+export function McpPresetRows({
+ presets,
+ onOpen,
+ onChanged,
+}: {
+ presets: ReturnType<typeof mcpPresetOffers>;
+ onOpen: (name: string) => void;
+ onChanged: () => void;
+}) {
+ const { t } = useTranslation();
+ return (
+ <>
+ {presets.map((p) => (
+ <div key={p.name} className={ROW} data-testid={`mcp-preset-${p.name}`}>
+ <McpGlyph />
+ <span className="min-w-0 flex-1">
+ <span className="font-medium text-[13px]">{p.label}</span>
+ <span className="block text-[12px] text-muted truncate">{t(p.blurb)}</span>
+ </span>
+ <span
+ className={PILL_QUIET + " cursor-pointer"}
+ role="button"
+ onClick={async () => {
+ await addMcpServer(p.name, p.config);
+ await connectMcp(p.name); // opens the browser sign-in right away
+ onChanged();
+ onOpen(p.name); // land on the detail page: the tool review awaits there
+ }}
+ >
+ {t("connector.connect")}
+ </span>
+ </div>
+ ))}
+ </>
+ );
+}
+
// -- Add custom server (UX-033 two-tab form, in the page's modal chrome) --------
const EXAMPLE = `{
@@ -195,9 +254,13 @@ function nameFromUrl(raw: string): string {
export function AddMcpModal({
onClose,
onChanged,
+ onAdded,
}: {
onClose: () => void;
onChanged: () => void;
+ // OPE-136 §3: land the user on the server's detail page right after adding — the
+ // connect moment is when the tool review has their attention.
+ onAdded?: (name: string) => void;
}) {
const { t } = useTranslation();
const [tab, setTab] = useState<"url" | "json">("url");
@@ -230,6 +293,7 @@ export function AddMcpModal({
await connectMcp(n);
onChanged();
onClose();
+ onAdded?.(n);
};
const saveJson = async () => {
@@ -254,6 +318,9 @@ export function AddMcpModal({
}
onChanged();
onClose();
+ // A single pasted server gets the same review moment; a bulk paste lands on the
+ // list, where each row is one click from its review.
+ if (entries.length === 1) onAdded?.(String(entries[0][0]));
};
const tabBtn = (active: boolean) =>
@@ -331,6 +398,352 @@ export function AddMcpModal({
// -- Detail subpage (§21): tools, Test, config, error excerpt, remove -----------
+// -- Connect-time tool review (OPE-136 §3: the existence lever) ---------------------
+// One checkbox per tool the server OFFERS. Checked names are written to the entry's
+// `include_tools` in mcp.json — an unchecked tool is never registered into a session:
+// the model never sees its name or schema. Because include_tools is an include-list,
+// tools the server ships later arrive UNCHECKED with a "new" badge (fail-closed
+// growth). Descriptions are the server's own words — displayed as quotes, never
+// interpreted. First review (no include_tools yet): everything starts checked, and
+// saving writes the full list to lock the fail-closed property in.
+export function McpToolReview({
+ server,
+ onChanged,
+}: {
+ server: McpServer;
+ onChanged: () => void;
+}) {
+ const { t } = useTranslation();
+ const [offered, setOffered] = useState<{ name: string; description: string }[] | null>(null);
+ const [busy, setBusy] = useState(false);
+ const [err, setErr] = useState<string | null>(null);
+ const [checked, setChecked] = useState<Set<string> | null>(null);
+ const [saving, setSaving] = useState(false);
+ // OPE-136 §4/§5: standing trust — which tools don't ask, and whether the legacy
+ // server-wide flag is still in the config (shown loud, with the migration button).
+ const [trust, setTrust] = useState<{ tools: string[]; legacy: boolean } | null>(null);
+ const [converting, setConverting] = useState(false);
+
+ const loadTrust = async () => {
+ const res = await getMcpTrust(server.name);
+ if (res.ok) setTrust({ tools: res.tools, legacy: res.legacy_dont_ask });
+ };
+ useEffect(() => {
+ void loadTrust();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [server.name]);
+
+ const included: string[] | undefined = Array.isArray(server.config?.include_tools)
+ ? server.config.include_tools.map(String)
+ : undefined;
+ const firstReview = included === undefined;
+ // The DECLINED list (owner catch 2026-08-30): with only an include list, "you
+ // reviewed this and said no" and "the server added this since your review" are
+ // indistinguishable — both merely absent — so unchecking a tool earned it a
+ // "new" badge. exclude_tools (already honored, subtractively, at wiring) records
+ // the decline; "new" is now ONLY a name neither list has ever seen.
+ const excluded: string[] = Array.isArray(server.config?.exclude_tools)
+ ? server.config.exclude_tools.map(String)
+ : [];
+
+ const load = async () => {
+ setBusy(true);
+ setErr(null);
+ const res = await getMcpTools(server.name);
+ setBusy(false);
+ if (!res.ok) {
+ setErr(res.error || t("mcp.err_failed_connect"));
+ return;
+ }
+ setOffered(res.tools);
+ // First review: all checked. Later: the saved list, so anything the server
+ // added since arrives unchecked.
+ setChecked(new Set(firstReview ? res.tools.map((tool) => tool.name) : included));
+ };
+
+ // The review moment: a connected server's list loads without another click. For
+ // anything else (needs sign-in, stdio not yet spawned) loading would trigger a
+ // connect, so it stays behind the button.
+ useEffect(() => {
+ if (server.status === "connected" && offered === null && !busy && !err) void load();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [server.status]);
+
+ const dirty =
+ offered !== null &&
+ checked !== null &&
+ (firstReview ||
+ included.length !== checked.size ||
+ included.some((n) => !checked.has(n)));
+
+ // Post-review toggles auto-save (owner ask 2026-08-30) — a brief "Saved" tick
+ // is the receipt. The FIRST review keeps its explicit button: that save is the
+ // consent moment that creates the include list and locks in fail-closed growth.
+ const [savedTick, flashTick] = useSavedTick();
+ const persist = async (next: Set<string>, declined: string[]) => {
+ if (!offered) return;
+ setSaving(true);
+ await patchMcpServer(server.name, {
+ include_tools: offered.map((tool) => tool.name).filter((n) => next.has(n)),
+ exclude_tools: declined,
+ });
+ setSaving(false);
+ onChanged();
+ };
+
+ const save = async () => {
+ // The first-review ceremony reviews the WHOLE visible list: everything
+ // unchecked at the moment of "Keep these tools" is an explicit decline.
+ if (!checked || !offered) return;
+ await persist(
+ checked,
+ offered.map((tool) => tool.name).filter((n) => !checked.has(n)),
+ );
+ };
+
+ const toggle = (name: string) => {
+ if (!checked) return;
+ const next = new Set(checked);
+ const nowChecked = !next.has(name);
+ if (nowChecked) next.add(name);
+ else next.delete(name);
+ setChecked(next);
+ if (!firstReview) {
+ // Delta, not a recompute: only the TOGGLED tool moves between lists. A
+ // whole-list recompute would sweep un-acknowledged server-new tools into
+ // the declined list on any unrelated toggle, silently killing their badge.
+ const declined = nowChecked
+ ? excluded.filter((n) => n !== name)
+ : excluded.includes(name)
+ ? excluded
+ : [...excluded, name];
+ void persist(next, declined).then(flashTick);
+ }
+ };
+
+ return (
+ <div className={GRP} data-testid={`mcp-tools-review-${server.name}`}>
+ {/* The legacy server-wide don't-ask flag, finally VISIBLE (finding 3) — with the
+ one-click migration to named, bounded, per-tool trust rules. */}
+ {trust?.legacy && (
+ <div
+ className="px-4 py-3 flex items-start gap-2.5 border-b border-line"
+ data-testid={`mcp-legacy-warn-${server.name}`}
+ >
+ <span className="text-warnInk shrink-0">
+ <Icon name="warning" size={15} />
+ </span>
+ <span className="min-w-0 flex-1 text-[13px]">
+ <span className="font-medium block">{t("mcp.legacy_warn_title")}</span>
+ <span className="block text-[12px] text-muted">{t("mcp.legacy_warn_body")}</span>
+ </span>
+ <span
+ className={PILL_ACCENT + " cursor-pointer shrink-0" + (converting ? " opacity-50" : "")}
+ role="button"
+ data-testid={`mcp-legacy-convert-${server.name}`}
+ onClick={
+ converting
+ ? undefined
+ : async () => {
+ setConverting(true);
+ const res = await convertMcpTrust(server.name);
+ setConverting(false);
+ if (res.ok) {
+ await loadTrust();
+ onChanged();
+ }
+ }
+ }
+ >
+ {converting ? "…" : t("mcp.legacy_convert")}
+ </span>
+ </div>
+ )}
+ {(() => {
+ const trustCount = trust?.tools.length ?? 0;
+ // The reviewed list collapses to the same quiet summary row the connector
+ // pages use (owner ask 2026-08-30: one dialect) — the first review stays
+ // forced open, because the ceremony IS the open list.
+ const reviewed = !firstReview && offered !== null && checked !== null;
+
+ const finePrint = offered && checked && (
+ <div className="px-4 pb-1.5">
+ <ToolsCountLine
+ checked={checked.size}
+ total={offered.length}
+ // The details summary above already carries the count.
+ showCount={!reviewed}
+ extra={
+ <>
+ {" · "}
+ {t("mcp.tools_growth_note")}
+ {/* MCP rows carry no per-row risk chips (a server's word is not
+ evidence) — the blanket truth is stated ONCE instead. The
+ always-allowed count lives in the summary row, not here. */}
+ {" · "}
+ {t("tools.mcp_all_ask")}
+ </>
+ }
+ />
+ </div>
+ );
+
+ const errLine = err && (
+ <div className="px-4 py-2.5 text-[13px] text-danger">{err}</div>
+ );
+
+ const list = offered && checked && (
+ <div className="py-1 max-h-[320px] overflow-y-auto hairline-scroll">
+ {offered.length === 0 && (
+ <div className="text-[12px] text-faint px-4 py-1">{t("manage.mcp_no_tools")}</div>
+ )}
+ {offered.map((tool) => {
+ // "new" = the SERVER's menu grew: a name neither list has ever seen.
+ // A tool you declined sits on the exclude list — absent, but not new.
+ const isNew =
+ !firstReview &&
+ !included.includes(tool.name) &&
+ !excluded.includes(tool.name);
+ return (
+ <ToolRow
+ key={tool.name}
+ checked={checked.has(tool.name)}
+ checkboxTestId={`mcp-tool-check-${tool.name}`}
+ onToggle={() => toggle(tool.name)}
+ // Raw mono name, deliberately: the exact string IS the security
+ // identity (trust rules and collision defenses key on it).
+ name={tool.name}
+ mono
+ badge={
+ isNew ? (
+ <span
+ className="ml-1.5 text-[11px] px-1.5 rounded-full bg-warnSoft text-warnInk"
+ data-testid={`mcp-tool-new-${tool.name}`}
+ >
+ {t("mcp.tools_new_badge")}
+ </span>
+ ) : undefined
+ }
+ description={
+ tool.description ? (
+ <span className="block text-[12px] text-muted truncate" title={tool.description}>
+ “{tool.description}”
+ </span>
+ ) : undefined
+ }
+ // Right-aligned approval status (owner ask 2026-08-30): existence
+ // lives on the left (checkbox), granted authority on the right.
+ // Neutral chip, never success-colored. Absence of a chip IS the
+ // default ("asks each time"), so untrusted rows stay quiet. An
+ // unchecked-but-trusted tool keeps a dimmed chip: standing
+ // authority never disappears from the screen that audits it.
+ right={
+ trust?.tools.includes(tool.name) ? (
+ <span
+ className={
+ "flex items-center gap-1.5 shrink-0 self-start mt-0.5" +
+ (checked.has(tool.name) ? "" : " opacity-50")
+ }
+ data-testid={`mcp-tool-trusted-${tool.name}`}
+ >
+ <span
+ className={TAG_QUIET}
+ title={
+ checked.has(tool.name)
+ ? t("mcp.trust_tooltip")
+ : t("mcp.trust_idle_tooltip")
+ }
+ >
+ {t("mcp.trust_marker")}
+ </span>
+ <button
+ className="text-[11px] underline text-muted hover:text-danger"
+ data-testid={`mcp-tool-revoke-${tool.name}`}
+ onClick={async (e) => {
+ e.preventDefault();
+ await revokeMcpTrust(server.name, tool.name);
+ await loadTrust();
+ }}
+ >
+ {t("mcp.trust_revoke")}
+ </button>
+ </span>
+ ) : undefined
+ }
+ />
+ );
+ })}
+ </div>
+ );
+
+ if (reviewed)
+ return (
+ <details>
+ <summary className={ROW + " cursor-pointer hover:bg-paper/60 list-none [&::-webkit-details-marker]:hidden"}>
+ <span className="text-[13px] text-muted w-24 shrink-0">
+ {t("connector.tools_label")}
+ </span>
+ <span className="min-w-0 flex-1 text-[13px] text-muted">
+ {t("tools.enabled_count", { checked: checked!.size, total: offered!.length })}
+ {/* Granted authority stays advertised even while collapsed. */}
+ {trustCount > 0 && <> · {t("mcp.trust_count", { count: trustCount })}</>}
+ </span>
+ <SavedTick show={savedTick} testId={`mcp-tools-saved-${server.name}`} />
+ </summary>
+ {finePrint}
+ {errLine}
+ {list}
+ </details>
+ );
+
+ return (
+ <>
+ <div className={ROW}>
+ <span className="text-[13px] flex-1">
+ {t("available.tools")}
+ {offered && checked && (
+ <ToolsCountLine
+ checked={checked.size}
+ total={offered.length}
+ extra={
+ <>
+ {" · "}
+ {t("mcp.tools_growth_note")}
+ </>
+ }
+ />
+ )}
+ </span>
+ {offered === null && (
+ <button
+ className="text-[13px] text-muted hover:text-ink"
+ onClick={load}
+ disabled={busy}
+ data-testid={`mcp-tools-load-${server.name}`}
+ >
+ {busy ? "…" : t("mcp.show")}
+ </button>
+ )}
+ {dirty && firstReview && (
+ <button
+ className={PILL_ACCENT + " cursor-pointer"}
+ onClick={save}
+ disabled={saving}
+ data-testid={`mcp-tools-save-${server.name}`}
+ >
+ {saving ? "…" : t("mcp.tools_keep")}
+ </button>
+ )}
+ </div>
+ {errLine}
+ {list}
+ </>
+ );
+ })()}
+ </div>
+ );
+}
+
export function McpServerDetail({
server,
onChanged,
@@ -341,14 +754,34 @@ export function McpServerDetail({
onGone: () => void;
}) {
const { t } = useTranslation();
- const [tools, setTools] = useState<{ name: string; description: string }[] | null>(null);
- const [busy, setBusy] = useState(false);
- const [toolErr, setToolErr] = useState<string | null>(null);
const isOauth = server.auth === "oauth";
- const authorizing = server.status === "authorizing";
+ // LOCAL testing state (owner catch 2026-08-30): the server reports "connected"
+ // ahead of "authorizing", so re-testing a HEALTHY server never flips the status
+ // this page used to watch — the button looked dead. Track the click ourselves:
+ // disabled + "Testing…" until the receipt (last_test_at) or an error moves,
+ // with a timeout backstop so a wedged probe can't disable the button forever.
+ const [testing, setTesting] = useState(false);
+ // The green result line is TRANSIENT (owner call): it announces the completion,
+ // then leaves — the durable "tested Nm ago" receipt lives in the header.
+ const [freshResult, setFreshResult] = useState(false);
+ const lastSeen = useRef({ at: server.last_test_at, err: server.last_error });
+ useEffect(() => {
+ const moved =
+ server.last_test_at !== lastSeen.current.at ||
+ server.last_error !== lastSeen.current.err;
+ lastSeen.current = { at: server.last_test_at, err: server.last_error };
+ if (moved && testing) {
+ setTesting(false);
+ setFreshResult(true);
+ window.setTimeout(() => setFreshResult(false), 6000);
+ }
+ }, [server.last_test_at, server.last_error, testing]);
+ const authorizing = server.status === "authorizing" || testing;
const runTest = async () => {
+ setTesting(true);
+ window.setTimeout(() => setTesting(false), 20000); // backstop, never stuck
await connectMcp(server.name);
onChanged();
// The connect runs as a background task; if the first refresh outpaced its
@@ -363,19 +796,6 @@ export function McpServerDetail({
onChanged();
};
- const loadTools = async () => {
- if (tools) {
- setTools(null);
- return;
- }
- setBusy(true);
- setToolErr(null);
- const res = await getMcpTools(server.name);
- setBusy(false);
- if (res.ok) setTools(res.tools);
- else setToolErr(res.error || t("mcp.err_failed_connect"));
- };
-
return (
<div className="space-y-4" data-testid={`mcp-detail-${server.name}`}>
<div className="flex items-center gap-3">
@@ -433,42 +853,35 @@ export function McpServerDetail({
</span>
)}
</div>
+ {/* The Test RESULT lands where the click happened (owner catch 2026-08-30:
+ "tested just now" only updated the header subtitle — same font, same
+ color, nowhere near the button). TRANSIENT (second owner catch): shown
+ for a few seconds after the test that just ran, then gone — a stale
+ "server responded · 42m ago" read as if it were still announcing. The
+ durable receipt stays in the header. Failures stay persistent in red. */}
+ {freshResult && server.status === "connected" && server.last_test_at ? (
+ <div
+ className="px-4 py-2 text-[12px] text-ok"
+ data-testid={`mcp-test-ok-${server.name}`}
+ >
+ ✓ {t("mcp.test_ok", { count: server.tool_count ?? 0, rel: relTime(server.last_test_at) })}
+ </div>
+ ) : null}
{server.last_error && server.status !== "connected" && (
<div className="px-4 py-2.5 text-[13px] text-danger break-words">
{server.last_error}
</div>
)}
- <div className={ROW}>
- <span className="text-[13px] flex-1">{t("available.tools")}</span>
- <button className="text-[13px] text-muted hover:text-ink" onClick={loadTools} disabled={busy}>
- {busy ? "…" : tools ? t("mcp.hide") : t("mcp.show")}
- </button>
- </div>
- {toolErr && <div className="px-4 py-2.5 text-[13px] text-danger">{toolErr}</div>}
- {tools && (
- <div className="px-4 py-3 flex flex-wrap gap-1.5">
- {tools.length === 0 && <div className="text-[12px] text-faint">{t("manage.mcp_no_tools")}</div>}
- {tools.map((t) => (
- <span
- key={t.name}
- title={t.description}
- className="font-mono text-[12px] px-1.5 py-0.5 rounded-md bg-paper border border-line"
- >
- {t.name}
- </span>
- ))}
- </div>
- )}
</div>
- <div className={GRP}>
- <div className="px-4 py-3">
- <div className="text-[12px] font-semibold text-muted mb-1.5">{t("mcp.configuration")}</div>
- <pre className="font-mono text-[12px] text-muted whitespace-pre-wrap break-all">
- {JSON.stringify(server.config, null, 2)}
- </pre>
- </div>
- </div>
+ {/* OPE-136 §3: the tool review — which of this server's tools exist in sessions. */}
+ <McpToolReview server={server} onChanged={onChanged} />
+
+ {/* No Configuration mirror here anymore (owner call 2026-08-30): one file
+ serves every server, so the ground truth is revealed from ONE common
+ place — the "Show file" affordance under the Custom · MCP group. The
+ file itself carries what this page doesn't row-ify (headers, stdio
+ command/env, hand-edit parse checks). */}
<div className="flex items-center gap-4">
{isOauth && server.status === "connected" && (
@@ -479,6 +892,7 @@ export function McpServerDetail({
onChanged();
}}
data-testid={`mcp-signout-${server.name}`}
+ title={t("mcp.signout_tip")}
>
{t("sidebar.sign_out")}
</button>
@@ -491,6 +905,7 @@ export function McpServerDetail({
onGone();
}}
data-testid={`mcp-remove-${server.name}`}
+ title={t("mcp.remove_tip")}
>
{t("mcp.remove_server")}
</button>
diff --git a/surfaces/gui/src/components/connectors/ToolReview.tsx b/surfaces/gui/src/components/connectors/ToolReview.tsx
new file mode 100644
index 00000000..93be73c6
--- /dev/null
+++ b/surfaces/gui/src/components/connectors/ToolReview.tsx
@@ -0,0 +1,130 @@
+import { useState, type ReactNode } from "react";
+import { useTranslation } from "react-i18next";
+import { TAG_QUIET, TAG_WARN } from "./ui";
+
+// Shared grammar for per-tool review lists (owner ask 2026-08-30): the MCP server
+// page and the catalog-connector pages sit side by side on Connectors, so their tool
+// lists must speak one dialect — same row anatomy, same chip family, same count
+// line, same save receipt. Both lists RENDER THROUGH these primitives; imitation
+// would drift, extraction cannot.
+//
+// What deliberately stays per-surface (do not "unify" these — each difference is a
+// security decision, not sloppiness):
+// - read/asks-first chips exist ONLY for catalog connectors: their kinds are pinned
+// by our own audited code. An MCP server claiming "read-only" would be the server
+// describing itself — a label, not evidence — so MCP rows carry no risk chips and
+// the page states the blanket truth ("every tool asks…") once instead.
+// - MCP names render mono and raw: the exact string IS the security identity
+// (trust rules and collision defenses key on it). Connector labels are ours.
+// - The "new" badge is MCP-only (remote menus drift; the catalog ships with the app).
+// - The first-review ceremony is MCP-only (it creates the fail-closed contract).
+
+/** One tool row: checkbox · name (+badge) · description · right-aligned status. */
+export function ToolRow({
+ checked,
+ onToggle,
+ name,
+ mono = false,
+ badge,
+ description,
+ right,
+ title,
+ checkboxTestId,
+}: {
+ checked: boolean;
+ onToggle: () => void;
+ name: string;
+ mono?: boolean;
+ badge?: ReactNode;
+ description?: ReactNode;
+ right?: ReactNode;
+ title?: string;
+ checkboxTestId?: string;
+}) {
+ return (
+ <label
+ className="flex items-start gap-2.5 px-4 py-2 cursor-pointer hover:bg-paper/40"
+ title={title}
+ >
+ <input
+ type="checkbox"
+ className="mt-0.5"
+ checked={checked}
+ data-testid={checkboxTestId}
+ onChange={onToggle}
+ />
+ <span className="min-w-0 flex-1">
+ <span className={mono ? "font-mono text-[12px]" : "text-[13px] font-medium"}>{name}</span>
+ {badge}
+ {description}
+ </span>
+ {right}
+ </label>
+ );
+}
+
+/** The right-column chip answers ONE question: what happens when this is called?
+ * Offered only where the answer is OUR code's word (catalog connectors). */
+export function ApprovalChip({ kind }: { kind: "read" | "asks_first" }) {
+ const { t } = useTranslation();
+ return kind === "read" ? (
+ <span className={TAG_QUIET + " mt-0.5"} title={t("tools.read_tip")}>
+ {t("tools.read")}
+ </span>
+ ) : (
+ <span className={TAG_WARN + " mt-0.5"} title={t("tools.asks_first_tip")}>
+ {t("tools.asks_first")}
+ </span>
+ );
+}
+
+/** "N of M enabled — unchecked tools never reach a session" — one phrasing, both
+ * pages; per-surface extras (growth note, always-allowed count) append after.
+ * Inside an expanded disclosure the summary row above already shows the count,
+ * so `showCount: false` renders the explanation clauses alone (owner catch
+ * 2026-08-30: the count printed twice in adjacent lines). */
+export function ToolsCountLine({
+ checked,
+ total,
+ extra,
+ showCount = true,
+}: {
+ checked: number;
+ total: number;
+ extra?: ReactNode;
+ showCount?: boolean;
+}) {
+ const { t } = useTranslation();
+ return (
+ <span className="block text-[12px] text-faint">
+ {showCount && (
+ <>
+ {t("tools.enabled_count", { checked, total })}
+ {" — "}
+ </>
+ )}
+ {t("tools.never_reach")}
+ {extra}
+ </span>
+ );
+}
+
+/** The save receipt: flash "Saved" for a moment after an auto-save lands. */
+export function useSavedTick(): [boolean, () => void] {
+ const [on, setOn] = useState(false);
+ const flash = () => {
+ setOn(true);
+ window.setTimeout(() => setOn(false), 1500);
+ };
+ return [on, flash];
+}
+
+export function SavedTick({ show, testId }: { show: boolean; testId?: string }) {
+ const { t } = useTranslation();
+ if (!show) return null;
+ return (
+ <span className="text-[12px] text-ok" data-testid={testId}>
+ {t("tools.saved")}
+ </span>
+ );
+}
diff --git a/surfaces/gui/src/components/connectors/ToolsDisclosure.test.tsx b/surfaces/gui/src/components/connectors/ToolsDisclosure.test.tsx
new file mode 100644
index 00000000..520b4c8a
--- /dev/null
+++ b/surfaces/gui/src/components/connectors/ToolsDisclosure.test.tsx
@@ -0,0 +1,67 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+
+const updateConnectorTools = vi.fn<
+ (name: string, changes: Record<string, boolean>) => Promise<{ ok: boolean }>
+>(async () => ({ ok: true }));
+vi.mock("../../api", () => ({
+ updateConnectorTools: (name: string, changes: Record<string, boolean>) =>
+ updateConnectorTools(name, changes),
+}));
+
+import { ToolsDisclosure } from "./ToolsDisclosure";
+import type { Connector } from "../../api";
+
+// The connector tools list renders through the SAME primitives as the MCP review
+// (ToolReview.tsx, owner ask 2026-08-30) — these tests pin the shared dialect:
+// the chips explain themselves, the count line explains unchecking, saves leave
+// a receipt.
+const connector = (): Connector =>
+ ({
+ name: "attio",
+ title: "Attio",
+ connected: true,
+ tools: [
+ { name: "attio_list_objects", label: "List objects", description: "List Attio object types.", kind: "read", enabled: true },
+ { name: "attio_log_note", label: "Log note", description: "Write a note onto a record.", kind: "write", enabled: true },
+ ],
+ }) as unknown as Connector;
+
+afterEach(() => {
+ cleanup();
+ updateConnectorTools.mockClear();
+});
+
+describe("ToolsDisclosure — the shared tool-review dialect", () => {
+ it("chips answer 'what happens when called?' and carry explanatory tooltips", () => {
+ render(<ToolsDisclosure c={connector()} onChanged={vi.fn()} />);
+ const read = screen.getByText("read");
+ expect(read.getAttribute("title")).toContain("runs without an approval card");
+ const asks = screen.getByText("asks first");
+ expect(asks.getAttribute("title")).toContain("approval card before running");
+ });
+
+ it("the count line explains what unchecking means — same words as the MCP page", () => {
+ render(<ToolsDisclosure c={connector()} onChanged={vi.fn()} />);
+ // Exactly once — in the summary; the fine print carries only the explanations.
+ expect(screen.getAllByText(/2 of 2 enabled/).length).toBe(1);
+ expect(screen.getByText(/unchecked tools never reach a session/)).toBeTruthy();
+ });
+
+ it("a toggle saves immediately and leaves the Saved receipt", async () => {
+ render(<ToolsDisclosure c={connector()} onChanged={vi.fn()} />);
+ fireEvent.click(screen.getByTestId("connector-tool-check-attio-attio_log_note"));
+ await waitFor(() =>
+ expect(updateConnectorTools).toHaveBeenCalledWith("attio", { attio_log_note: false }),
+ );
+ await waitFor(() =>
+ expect(screen.getByTestId("connector-tools-saved-attio")).toBeTruthy(),
+ );
+ });
+
+ it("row tooltips disclose the real tool name behind the friendly label", () => {
+ render(<ToolsDisclosure c={connector()} onChanged={vi.fn()} />);
+ const row = screen.getByText("List objects").closest("label")!;
+ expect(row.getAttribute("title")).toContain("attio_list_objects");
+ });
+});
diff --git a/surfaces/gui/src/components/connectors/ToolsDisclosure.tsx b/surfaces/gui/src/components/connectors/ToolsDisclosure.tsx
index e37ebb87..41da331e 100644
--- a/surfaces/gui/src/components/connectors/ToolsDisclosure.tsx
+++ b/surfaces/gui/src/components/connectors/ToolsDisclosure.tsx
@@ -1,12 +1,15 @@
import { useTranslation } from "react-i18next";
import { updateConnectorTools, type Connector } from "../../api";
-import { GRP, ROW, TAG_QUIET, TAG_WARN } from "./ui";
+import { ApprovalChip, SavedTick, ToolRow, ToolsCountLine, useSavedTick } from "./ToolReview";
+import { GRP, ROW } from "./ui";
// Collapsed-by-default Tools group, shared by every connector detail page
-// (UX-DECISIONS §21): the lever exists everywhere but stays quiet — expanding
-// shows one row per tool with its read/write tag; writes always ask first.
+// (UX-DECISIONS §21): the lever exists everywhere but stays quiet. Rows, chips,
+// count line, and the save receipt come from ToolReview.tsx — the SAME primitives
+// the MCP tool review renders through (owner ask 2026-08-30: one dialect).
export function ToolsDisclosure({ c, onChanged }: { c: Connector; onChanged: () => void }) {
const { t } = useTranslation();
+ const [savedTick, flashTick] = useSavedTick();
if (!c.tools?.length) return null;
const enabled = c.tools.filter((tool) => tool.enabled).length;
return (
@@ -15,24 +18,29 @@ export function ToolsDisclosure({ c, onChanged }: { c: Connector; onChanged: ()
<summary className={ROW + " cursor-pointer hover:bg-paper/60 list-none [&::-webkit-details-marker]:hidden"}>
<span className="text-[13px] text-muted w-24 shrink-0">{t("connector.tools_label")}</span>
<span className="min-w-0 flex-1 text-[13px] text-muted">
- {t("connector.tools_enabled", { enabled, total: c.tools.length })}
+ {t("tools.enabled_count", { checked: enabled, total: c.tools.length })}
</span>
+ <SavedTick show={savedTick} testId={`connector-tools-saved-${c.name}`} />
</summary>
+ {/* The same explanation the MCP page gives — it is equally true here.
+ The summary row above already carries the count. */}
+ <div className="px-4 pb-1.5">
+ <ToolsCountLine checked={enabled} total={c.tools.length} showCount={false} />
+ </div>
{c.tools.map((tool) => (
- <label key={tool.name} className={ROW + " cursor-pointer"} title={`${tool.name} — ${tool.description}`}>
- <input
- type="checkbox"
- checked={tool.enabled}
- onChange={async (e) => {
- await updateConnectorTools(c.name, { [tool.name]: e.target.checked });
- onChanged();
- }}
- />
- <span className="min-w-0 flex-1 text-[13px] font-medium">{tool.label}</span>
- <span className={tool.kind === "write" ? TAG_WARN : TAG_QUIET}>
- {tool.kind === "write" ? t("connector.asks_first") : t("connector.read")}
- </span>
- </label>
+ <ToolRow
+ key={tool.name}
+ checked={tool.enabled}
+ checkboxTestId={`connector-tool-check-${c.name}-${tool.name}`}
+ onToggle={async () => {
+ await updateConnectorTools(c.name, { [tool.name]: !tool.enabled });
+ onChanged();
+ flashTick();
+ }}
+ name={tool.label}
+ title={`${tool.name} — ${tool.description}`}
+ right={<ApprovalChip kind={tool.kind === "write" ? "asks_first" : "read"} />}
+ />
))}
</details>
</div>
diff --git a/surfaces/gui/src/humanize.ts b/surfaces/gui/src/humanize.ts
index f24c7f31..88939c0d 100644
--- a/surfaces/gui/src/humanize.ts
+++ b/surfaces/gui/src/humanize.ts
@@ -140,6 +140,19 @@ export function humanizeApprovalTitle(name: string, args: any): HumanLine {
return a.name
? { pre: "Add skill ", obj: String(a.name), post: " to your skills" }
: { pre: "Add a skill to your skills" };
+ // Egress cards (OPE-136 finding 5): name the destination in the headline; the full
+ // URL/query renders in the card's expandable preview.
+ case "web_fetch": {
+ let host = "";
+ try {
+ host = new URL(String(a.url ?? "")).host;
+ } catch {
+ /* unparseable url → generic title; the preview still shows the raw string */
+ }
+ return host ? { pre: "Fetch from ", obj: host } : { pre: "Fetch a web page" };
+ }
+ case "web_search":
+ return { pre: "Search the web" };
default:
return { pre: `Use ${name}` };
}
diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.json
index 25cbc260..869ea739 100644
--- a/surfaces/gui/src/locales/en.json
+++ b/surfaces/gui/src/locales/en.json
@@ -170,7 +170,15 @@
"reviewer_allowed_title": "allowed by the auto-approve reviewer",
"bypass_title": "ran without approval — bypass-approvals mode",
"auto_approved": "auto-approved",
- "bypassed": "approval bypassed"
+ "bypassed": "approval bypassed",
+ "trusted": "allowed by server trust",
+ "trusted_title": "this MCP server is marked don't-ask in mcp.json — the card was waived; mode gates, the reviewer, and the audit trail still applied",
+ "trusted_rule": "allowed by your trust rule",
+ "trusted_rule_title": "you chose 'Always allow this tool' on an approval card — the card was waived; revoke the rule on this server's Connectors page. Mode gates, the reviewer, and the audit trail still applied",
+ "trusted_generic": "allowed by standing trust",
+ "trusted_generic_title": "a standing trust setting (a per-tool rule, or the server's don't-ask flag) waived the card; mode gates, the reviewer, and the audit trail still applied",
+ "run_grant": "allowed for this request",
+ "run_grant_title": "you chose 'Allow for this request' earlier in this answer — this call ran without a card. Its full arguments are in this transcript and the audit log; the grant expired when the answer finished"
},
"step": {
"raw": "raw",
@@ -586,29 +594,39 @@
"overwrite_suffix": "· overwrites the existing file",
"save_skill": "saves to Settings ▸ Skills",
"web_fallback": "the web",
- "search_provider_dest": "your search provider"
+ "search_provider_dest": "your search provider",
+ "mcp_server_fallback": "the MCP server",
+ "mcp_local": "runs a local program on this computer",
+ "mcp_unknown": "acts through an MCP server"
},
"btn": {
"allow_every_time": "Allow every time",
- "always_allow": "Always allow",
- "always_command": "Always allow this command",
+ "always_allow": "Allow for this session",
+ "always_command": "Allow this command for this session",
"deny": "Deny",
"this_automation": "this automation",
"always_task_title": "Always allow {{name}} → {{target}} for “{{task}}” — revoke any time on its Automations page",
- "always_tool_title": "Always allow {{name}} for this session",
+ "always_tool_title": "Allow {{name}} without asking for the rest of this session",
"add_to_skills": "Add to my skills",
"not_now": "Not now",
- "always_domain": "Always allow {{host}} this session",
+ "always_domain": "Allow {{host}} for this session",
"always_domain_title": "Every fetch to {{host}} (and its subdomains) runs without asking for the rest of this session",
- "always_search": "Always allow searches this session",
+ "always_search": "Allow searches for this session",
"always_search_title": "Every web search runs without asking for the rest of this session — the grant ends if you change the search provider",
"readonly_session": "Allow read-only commands",
- "readonly_session_title": "Auto-allow read-only commands (local reads and pipelines only — no network, writes, or interpreters) for the rest of this session"
+ "readonly_session_title": "Auto-allow read-only commands (local reads and pipelines only — no network, writes, or interpreters) for the rest of this session",
+ "always_trust": "Always allow this tool",
+ "always_trust_title": "Allow {{name}} without asking, permanently — survives restarts; revoke any time on the server's page in Connectors",
+ "this_run": "Allow for this request",
+ "this_run_title": "Covers {{name}} until the agent finishes answering your current message. Later calls in this answer run without showing you their arguments first — you'll see them in the transcript afterward. Nothing survives past this answer."
},
"preview_less": "show less",
"preview_all_lines": "show all {{n}} lines",
"preview_full": "show the full message",
"preview_label": "preview",
+ "arg_chars_one": "{{count}} char",
+ "arg_chars_other": "{{count}} chars",
+ "arg_binary": "{{size}} · binary",
"tool_title": "Tool: {{name}}",
"file_fallback": "file",
"as_png_screenshot": "· as a PNG screenshot",
@@ -842,7 +860,7 @@
"loading": "Loading…",
"back_to_connectors": "‹ Connectors",
"search": "Search",
- "available": "Available",
+ "available": "Available · {{count}}",
"nothing_matches": "Nothing matches.",
"more_count": "{{count}} more ·",
"show_all": "show all",
@@ -856,16 +874,12 @@
"allow_deliver": "Allow & deliver",
"dismiss": "Dismiss",
"unsubscribe_title": "Unsubscribe this session",
- "live": "Live",
"ready": "Ready",
"offline": "Offline",
"reconnecting": "Reconnecting",
"sign_in_needed": "Sign-in needed",
"token": "Token",
"tools_label": "› Tools",
- "tools_enabled": "{{enabled}} of {{total}} enabled",
- "asks_first": "asks first",
- "read": "read",
"add_custom_mcp": "+ Add custom MCP server",
"account_count_one": "{{count}} account",
"account_count_other": "{{count}} accounts",
@@ -1050,6 +1064,8 @@
"add_an_account": "Add an account",
"accounts": "Accounts",
"disconnect_account_title": "Disconnect this account",
+ "disconnect_tip": "Disconnects this account and forgets its token — your other accounts stay.",
+ "default_tip": "The account tools use when the agent doesn't name one.",
"foot": "Each account stays separate — tool results and approvals name the account they used."
},
"available": {
@@ -1059,7 +1075,6 @@
"tools": "Tools",
"hide": "Hide",
"view": "View",
- "asks_first": "asks first",
"tools_added_one": "{{count}} tool this connector adds",
"tools_added_other": "{{count}} tools this connector adds"
},
@@ -1615,7 +1630,7 @@
"tool_count_one": "{{count}} tool",
"tool_count_other": "{{count}} tools",
"tested_rel": "tested {{rel}}",
- "group_custom": "Custom · MCP",
+ "group_custom": "Custom · MCP · {{count}}",
"add_title": "Add custom MCP server",
"tab_remote_url": "Remote URL",
"tab_json": "JSON",
@@ -1633,8 +1648,35 @@
"err_failed_connect": "failed to connect",
"hide": "hide",
"show": "show",
- "configuration": "Configuration",
- "remove_server": "Remove server"
+ "remove_server": "Remove server",
+ "tools_growth_note": "tools the server adds later start unchecked",
+ "tools_new_badge": "new",
+ "tools_keep": "Keep these tools",
+ "trust_marker": "always allowed",
+ "trust_revoke": "Revoke",
+ "trust_tooltip": "You chose 'Always allow this tool' on an approval card — its calls run without asking. 'Revoke' undoes this.",
+ "trust_idle_tooltip": "Idle — this tool isn't enabled, so nothing can call it. The rule applies again if you re-enable the tool. 'Revoke' removes it.",
+ "trust_count_one": "{{count}} always allowed",
+ "trust_count_other": "{{count}} always allowed",
+ "signout_tip": "Forgets the sign-in — config, tool selection, and trust rules stay.",
+ "remove_tip": "Deletes this server's config, its sign-in, and its always-allow rules.",
+ "config_reveal": "Show mcp.json",
+ "config_reveal_tip": "Opens your file manager with mcp.json selected — the one file every custom server lives in (headers, stdio commands, hand edits).",
+ "test_ok_one": "server responded · {{count}} tool · {{rel}}",
+ "test_ok_other": "server responded · {{count}} tools · {{rel}}",
+ "legacy_warn_title": "This server never asks",
+ "legacy_warn_body": "requires_approval is false in its config — every tool listed here runs without an approval card. Convert it to named per-tool trust: same behavior today, but tools the server adds later will ask.",
+ "legacy_convert": "Convert to per-tool trust"
+ },
+ "tools": {
+ "enabled_count": "{{checked}} of {{total}} enabled",
+ "never_reach": "unchecked tools never reach a session",
+ "read": "read",
+ "read_tip": "A pure read — runs without an approval card.",
+ "asks_first": "asks first",
+ "asks_first_tip": "Shows an approval card before running.",
+ "saved": "Saved",
+ "mcp_all_ask": "every tool asks before running unless always-allowed"
},
"bindmenu": {
"filter_placeholder": "Filter…",
diff --git a/surfaces/gui/src/locales/locales.test.ts b/surfaces/gui/src/locales/locales.test.ts
new file mode 100644
index 00000000..6c14cecb
--- /dev/null
+++ b/surfaces/gui/src/locales/locales.test.ts
@@ -0,0 +1,39 @@
+import { describe, expect, it } from "vitest";
+import en from "./en.json";
+import zh from "./zh.json";
+
+// OPE-136 test plan #23: every UI string must exist in BOTH locales, or the Chinese
+// UI silently falls back to English one key at a time. Flattens both trees and
+// compares the full key sets — additions to one file without the other fail here,
+// not in production.
+function flatten(obj: Record<string, unknown>, prefix = ""): string[] {
+ const keys: string[] = [];
+ for (const [k, v] of Object.entries(obj)) {
+ const path = prefix ? `${prefix}.${k}` : k;
+ if (v && typeof v === "object" && !Array.isArray(v)) {
+ keys.push(...flatten(v as Record<string, unknown>, path));
+ } else {
+ keys.push(path);
+ }
+ }
+ return keys.sort();
+}
+
+// i18next pluralization: English declares `_one`/`_other` pairs; Chinese has no
+// singular category, so it legitimately carries only `_other`. Compare base keys —
+// a missing plural VARIANT is correct per-language grammar, a missing base key is
+// a real gap.
+function baseKeys(keys: string[]): string[] {
+ return [...new Set(keys.map((k) => k.replace(/_(zero|one|two|few|many|other)$/, "")))].sort();
+}
+
+describe("locale completeness", () => {
+ it("en.json and zh.json declare the same key set", () => {
+ const enKeys = baseKeys(flatten(en as Record<string, unknown>));
+ const zhKeys = baseKeys(flatten(zh as Record<string, unknown>));
+ const missingInZh = enKeys.filter((k) => !zhKeys.includes(k));
+ const missingInEn = zhKeys.filter((k) => !enKeys.includes(k));
+ expect(missingInZh, `keys missing in zh.json: ${missingInZh.join(", ")}`).toEqual([]);
+ expect(missingInEn, `keys missing in en.json: ${missingInEn.join(", ")}`).toEqual([]);
+ });
+});
diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.json
index 65c3389d..6ac0f33c 100644
--- a/surfaces/gui/src/locales/zh.json
+++ b/surfaces/gui/src/locales/zh.json
@@ -168,7 +168,15 @@
"reviewer_allowed_title": "已由自动批准审查器允许",
"bypass_title": "未经批准即运行 —— 跳过批准模式",
"auto_approved": "已自动批准",
- "bypassed": "已跳过批准"
+ "bypassed": "已跳过批准",
+ "trusted": "按服务器信任放行",
+ "trusted_title": "该 MCP 服务器在 mcp.json 中标记为免询问 —— 已跳过审批卡片;模式限制、审查器与审计记录仍然生效",
+ "trusted_rule": "按您的信任规则放行",
+ "trusted_rule_title": "您曾在审批卡上选择“始终允许此工具”——已跳过审批卡片;可在该服务器的连接器页面撤销此规则。模式限制、审查器与审计记录仍然生效",
+ "trusted_generic": "按既有信任放行",
+ "trusted_generic_title": "某项既有信任设置(按工具的规则,或服务器的免询问标记)跳过了审批卡片;模式限制、审查器与审计记录仍然生效",
+ "run_grant": "本次请求内已允许",
+ "run_grant_title": "您在本次回答早些时候选择了“本次请求内允许”——此调用未显示审批卡片。完整参数保存在会话记录与审计日志中;回答结束后该授权已失效"
},
"step": {
"raw": "原始",
@@ -576,29 +584,38 @@
"overwrite_suffix": "· 覆盖现有文件",
"save_skill": "保存到 设置 ▸ 技能",
"web_fallback": "网络",
- "search_provider_dest": "你的搜索服务商"
+ "search_provider_dest": "你的搜索服务商",
+ "mcp_server_fallback": "MCP 服务器",
+ "mcp_local": "在本机运行一个本地程序",
+ "mcp_unknown": "通过 MCP 服务器执行操作"
},
"btn": {
"allow_every_time": "每次都允许",
- "always_allow": "总是允许",
- "always_command": "总是允许此命令",
+ "always_allow": "本次会话内允许",
+ "always_command": "本次会话内允许此命令",
"deny": "拒绝",
"this_automation": "此自动化",
"always_task_title": "为「{{task}}」总是允许 {{name}} → {{target}} —— 可在其自动化页面随时撤销",
- "always_tool_title": "本次会话总是允许 {{name}}",
+ "always_tool_title": "本次会话剩余时间内允许{{name}},无需再询问",
"add_to_skills": "添加到我的技能",
"not_now": "暂不",
- "always_domain": "本次会话总是允许 {{host}}",
+ "always_domain": "本次会话内允许 {{host}}",
"always_domain_title": "本次会话剩余时间内,对 {{host}}(及其子域名)的每次抓取都无需再询问",
- "always_search": "本次会话总是允许搜索",
+ "always_search": "本次会话内允许搜索",
"always_search_title": "本次会话剩余时间内,每次网页搜索都无需再询问 —— 更换搜索服务商后授权即失效",
"readonly_session": "允许只读命令",
- "readonly_session_title": "本次会话剩余时间内自动允许只读命令(仅限本地读取和管道 —— 不含网络、写入或解释器)"
+ "readonly_session_title": "本次会话剩余时间内自动允许只读命令(仅限本地读取和管道 —— 不含网络、写入或解释器)",
+ "always_trust": "总是允许此工具",
+ "always_trust_title": "永久允许{{name}}且不再询问 —— 重启后依然生效;可随时在连接器中该服务器页面撤销",
+ "this_run": "本次请求内允许",
+ "this_run_title": "在智能体回答完您当前这条消息之前,{{name}} 的后续调用将不再展示参数、直接执行 —— 事后可在会话记录中查看。回答结束后此授权即失效,不会保留任何设置。"
},
"preview_less": "收起",
"preview_all_lines": "展开全部 {{n}} 行",
"preview_full": "展开完整消息",
"preview_label": "预览",
+ "arg_chars_other": "{{count}} 字符",
+ "arg_binary": "{{size}} · 二进制",
"tool_title": "工具:{{name}}",
"file_fallback": "文件",
"as_png_screenshot": "· 作为 PNG 截图",
@@ -831,7 +848,7 @@
"loading": "加载中…",
"back_to_connectors": "‹ 连接器",
"search": "搜索",
- "available": "可用",
+ "available": "可用 · {{count}}",
"nothing_matches": "没有匹配项。",
"more_count": "还有 {{count}} 个 ·",
"show_all": "显示全部",
@@ -845,16 +862,12 @@
"allow_deliver": "允许并送达",
"dismiss": "忽略",
"unsubscribe_title": "取消订阅此会话",
- "live": "在线",
"ready": "就绪",
"offline": "离线",
"reconnecting": "重新连接中",
"sign_in_needed": "需要登录",
"token": "令牌",
"tools_label": "› 工具",
- "tools_enabled": "{{enabled}} / {{total}} 已启用",
- "asks_first": "先询问",
- "read": "读取",
"add_custom_mcp": "+ 添加自定义 MCP 服务器",
"account_count_other": "{{count}} 个账户",
"portal_count_other": "{{count}} 个门户",
@@ -1035,6 +1048,8 @@
"add_an_account": "添加账户",
"accounts": "账户",
"disconnect_account_title": "断开此账户",
+ "disconnect_tip": "断开此账户并清除其令牌——其他账户不受影响。",
+ "default_tip": "当智能体未指明账户时,工具默认使用此账户。",
"foot": "每个账户独立保留 —— 工具结果和批准会指明所使用的账户。"
},
"available": {
@@ -1044,7 +1059,6 @@
"tools": "工具",
"hide": "隐藏",
"view": "查看",
- "asks_first": "先询问",
"tools_added_other": "此连接器新增 {{count}} 个工具"
},
"modal": {
@@ -1583,7 +1597,7 @@
"status_not_tested": "未测试",
"tool_count_other": "{{count}} 个工具",
"tested_rel": "测试于 {{rel}}",
- "group_custom": "自定义 · MCP",
+ "group_custom": "自定义 · MCP · {{count}}",
"add_title": "添加自定义 MCP 服务器",
"tab_remote_url": "远程 URL",
"tab_json": "JSON",
@@ -1601,8 +1615,33 @@
"err_failed_connect": "连接失败",
"hide": "收起",
"show": "展开",
- "configuration": "配置",
- "remove_server": "移除服务器"
+ "remove_server": "移除服务器",
+ "tools_growth_note": "服务器日后新增的工具默认不勾选",
+ "tools_new_badge": "新增",
+ "tools_keep": "保留这些工具",
+ "trust_marker": "始终允许",
+ "trust_revoke": "撤销",
+ "trust_tooltip": "您曾在审批卡上选择“始终允许此工具”——其调用将不再询问。“撤销”可取消此设置。",
+ "trust_idle_tooltip": "闲置——该工具未启用,无法被调用。重新启用后此规则将再次生效。“撤销”可移除该规则。",
+ "trust_count_other": "{{count}} 个始终允许",
+ "signout_tip": "仅清除登录信息——配置、工具选择与信任规则保留。",
+ "remove_tip": "删除该服务器的配置、登录信息及其始终允许规则。",
+ "config_reveal": "显示 mcp.json",
+ "config_reveal_tip": "在文件管理器中定位 mcp.json——所有自定义服务器共用的配置文件(请求头、stdio 命令、手工编辑均在其中)。",
+ "test_ok_other": "服务器已响应 · {{count}} 个工具 · {{rel}}",
+ "legacy_warn_title": "该服务器从不询问",
+ "legacy_warn_body": "其配置中 requires_approval 为 false —— 此处列出的每个工具都会跳过审批卡片直接运行。可转换为按工具命名的信任:当前行为不变,但服务器日后新增的工具将会询问。",
+ "legacy_convert": "转换为按工具信任"
+ },
+ "tools": {
+ "enabled_count": "已启用 {{checked}}/{{total}}",
+ "never_reach": "未勾选的工具不会进入任何会话",
+ "read": "读取",
+ "read_tip": "纯读取——无需审批卡片即可运行。",
+ "asks_first": "先询问",
+ "asks_first_tip": "运行前会先显示审批卡片。",
+ "saved": "已保存",
+ "mcp_all_ask": "除非设为始终允许,每个工具运行前都会询问"
},
"bindmenu": {
"filter_placeholder": "筛选…",
diff --git a/surfaces/gui/src/types.ts b/surfaces/gui/src/types.ts
index 475cfc5c..9168995b 100644
--- a/surfaces/gui/src/types.ts
+++ b/surfaces/gui/src/types.ts
@@ -45,6 +45,12 @@ export type ApprovalDecision =
| "always_command"
| "always_domain"
| "always_task"
+ // OPE-136 §4: durable per-MCP-tool trust — writes a rule to the user-local
+ // override store; survives sessions; revocable on the server's detail page.
+ | "always_trust"
+ // OPE-136 run grant: covers the exact tool for the remainder of the current
+ // answer only; in-memory, cleared at the run boundary. EXTERNAL family only.
+ | "this_run"
| "readonly_session";
export interface TodoItem {
@@ -162,6 +168,10 @@ export type Item =
// Server-classified: this shell command only reads locally, so the card may offer
// the session-wide "Allow read-only commands" grant.
readonlyOk?: boolean;
+ // OPE-136 finding 4: where an MCP call actually goes, from the server DEF (the
+ // user's own config, never the server's claims). Drives the honest scope chip —
+ // "leaves this computer → host" (http) / "runs a local program" (stdio).
+ mcpDestination?: { transport: string; host?: string };
resolved?: ApprovalDecision;
}
| {