From 234f147d6da5b594da710c53875fafaa79aa5f9e Mon Sep 17 00:00:00 2001 From: Leo Li Date: Fri, 30 Oct 2026 12:49:19 -0700 Subject: [PATCH 1/7] cmux NEXT: the mode menu lists only the modes; grants are revoked in Session Info Leo, 2026-10-29: "What the hell is this? Why the fuck is this? Grant access, trust this. What is this bottom fucking bullshit? ... It's not fucking good." The composer's permission-mode menu drew a "Granted access" section under the modes (a "Trusted " row and an "Allow for this chat" row, each with an x), added in #20339. The menu now lists the modes alone. The two grants move to Session Info's Environment section as rows with Revoke, through the same callbacks (folder trust undo, chat.permission_chat.revoke). Chats that offer no modes no longer draw a lock-only Access chip for a grant. Removes access-grants-columns.test.ts (#27579), which measured only the section's columns, and the LockIcon left without a caller. Co-Authored-By: Claude Opus 5.5 Agent-Session: https://cmux.com/deeplink/agent?id=aid-f2206f5448805d85f14b --- webviews/src/agent-session/acpmux/App.tsx | 80 +++++----- .../src/agent-session/acpmux/Composer.tsx | 8 +- .../acpmux/ComposerPickers.gallery.tsx | 32 ++-- .../agent-session/acpmux/ComposerPickers.tsx | 61 ++------ .../acpmux/bottomStack.gallery.ts | 9 +- .../agent-session/acpmux/composerLocation.css | 55 ------- .../acpmux/inspector/ChatInspector.tsx | 14 +- .../acpmux/inspector/EnvironmentSection.tsx | 28 +++- .../test/access-chip-pending-warning.test.tsx | 23 ++- webviews/test/access-grants-columns.test.ts | 142 ------------------ .../test/chat-inspector-environment.test.tsx | 25 +++ webviews/test/gallery-coverage.allowlist.json | 1 - 12 files changed, 138 insertions(+), 340 deletions(-) delete mode 100644 webviews/test/access-grants-columns.test.ts diff --git a/webviews/src/agent-session/acpmux/App.tsx b/webviews/src/agent-session/acpmux/App.tsx index a42e01fc831f..d7e836569c00 100644 --- a/webviews/src/agent-session/acpmux/App.tsx +++ b/webviews/src/agent-session/acpmux/App.tsx @@ -154,7 +154,8 @@ import { remoteRecordingAttachment, } from "./attachments"; import type { KeptAttachments } from "./composer/keptAttachments"; -import { ComposerPickers, PICKER_LABELS, type ComposerPermissionAccess } from "./ComposerPickers"; +import { ComposerPickers, PICKER_LABELS } from "./ComposerPickers"; +import type { AccessGrant } from "./inspector/EnvironmentSection"; import { openPicker } from "./pickerOpeners"; import { EmptyState, type EmptyStateProjects, isNewChat, projectName } from "./EmptyState"; import { ChatUnavailableState } from "./ChatUnavailableState"; @@ -4502,14 +4503,12 @@ const NEW_TAB_CLOSE_EVENT = "acpmux-newtab-close"; function DefaultComposerChips({ snapshot, cwd, - permissionAccess, onAddAgent, startsChat = false, }: { snapshot: AcpmuxSnapshot; /// The folder a chat the chips start opens in (the New Tab page's project). cwd?: string; - permissionAccess?: ComposerPermissionAccess; onAddAgent?(): void; /// The chips belong to a page with no chat yet: a model, mode or effort pick starts one first. startsChat?: boolean; @@ -4557,7 +4556,6 @@ function DefaultComposerChips({ snapshot.switching !== undefined || (startsChat && !!snapshot.summary?.harness && window.cmuxAcpmuxActions?.["chat.new"] !== undefined) } - permissionAccess={permissionAccess} onModel={(modelId) => { start(); void callNative("chat.model", { modelId }); @@ -6745,11 +6743,47 @@ function AcpmuxPane() { workflows.length > 0 ? { list: workflows, onStop: stopSubagent, onOpenAgent: showWorkflowAgent } : undefined, [workflows, stopSubagent, showWorkflowAgent], ); + // What the chat was granted, revoked from Session Info's Environment (EnvironmentSection.tsx), + // never from the composer's mode menu, which lists the modes alone (Leo, 2026-10-29). The trusted + // grant names where the answer lives (the repository, a worktree's root, the folder), from the + // answer just given or the last read; its × forgets it there. + const trustScope = + trustAsk.ask?.state === "decided" && trustAsk.ask.level === "trusted" ? trustAsk.ask : trustAsk.scope; + const trustLabel = trustScope + ? isAgentHome(trustScope.cwd) + ? t("trust.trustedPrivate") + : trustedLabel(t, trustScope) + : undefined; + const accessGrants: AccessGrant[] = [ + ...(trustAsk.trusted + ? [ + { + id: "folder-trust", + label: trustLabel ?? t("trust.trustedPrivate"), + onRemove: trustAsk.undo, + }, + ] + : []), + ...(snapshot.permissionGroups?.chatAllowance + ? [ + { + id: "chat-permission", + label: t("permission.allowChat"), + // A grant shown from the chat's last read until its refresh lands: removable once it is read. + onRemove: () => + snapshot.permissionGroups?.ready === false + ? undefined + : void callNative("chat.permission_chat.revoke", {}), + }, + ] + : []), + ]; const inspector = useChatInspector({ snapshot, machineName, repository: githubRepository, shell, + grants: accessGrants, onOpenOutput: quick ? undefined : inspectorSubagent ? openSubagentOutput : openOutput, onOpenSourceFile: quick || !inspectorLocal ? undefined : (path) => openSourceFile(path, callNative), onOpenUrl: quick @@ -8966,7 +9000,7 @@ function AcpmuxPane() { // the early New Tab flag, one object from a useState initializer). }, [harnessSwitch, newChatPrewarm, queryClient, toggleInspector, earlyNewTab, restartGate, sandbox]); const registryChips = (window.cmuxAcpmuxRegistry as unknown as Record | undefined)?.composerChips as - | React.ComponentType<{ snapshot: AcpmuxSnapshot; permissionAccess?: ComposerPermissionAccess }> + | React.ComponentType<{ snapshot: AcpmuxSnapshot }> | undefined; const ComposerChips = registryChips ?? DefaultComposerChips; // The catalog arrives through the query cache, which composerSnapshot carries. @@ -10122,41 +10156,6 @@ function AcpmuxPane() { )} ) : null; - // The trusted grant names where the answer lives (the repository, a worktree's root, the - // folder), from the answer just given or the last read; its × forgets it there. - const trustScope = - trustAsk.ask?.state === "decided" && trustAsk.ask.level === "trusted" ? trustAsk.ask : trustAsk.scope; - const trustLabel = trustScope - ? isAgentHome(trustScope.cwd) - ? t("trust.trustedPrivate") - : trustedLabel(t, trustScope) - : undefined; - const permissionAccess: ComposerPermissionAccess = { - grants: [ - ...(trustAsk.trusted - ? [ - { - id: "folder-trust", - label: trustLabel ?? t("trust.trustedPrivate"), - onRemove: trustAsk.undo, - }, - ] - : []), - ...(snapshot.permissionGroups?.chatAllowance - ? [ - { - id: "chat-permission", - label: t("permission.allowChat"), - // A grant shown from the chat's last read until its refresh lands: removable once it is read. - onRemove: () => - snapshot.permissionGroups?.ready === false - ? undefined - : void callNative("chat.permission_chat.revoke", {}), - }, - ] - : []), - ], - }; // A failed start of a folder harness says what it waits for, in place of the switch's Retry // card: Enable (sent from the button's click, then the chat starts again), or the Trust answer. const block = @@ -10402,7 +10401,6 @@ function AcpmuxPane() { placeholder={isSideSession ? t("sideSession.placeholder") : undefined} switching={Boolean(switchView.intent)} chips={ComposerChips} - permissionAccess={permissionAccess} onOpenContext={inspector.reveal ? () => inspector.reveal?.("context") : undefined} draft={draft} onUnsentDraft={quick ? undefined : onNewChatDraft} diff --git a/webviews/src/agent-session/acpmux/Composer.tsx b/webviews/src/agent-session/acpmux/Composer.tsx index 3f5ca97ef1fe..778fe213385b 100644 --- a/webviews/src/agent-session/acpmux/Composer.tsx +++ b/webviews/src/agent-session/acpmux/Composer.tsx @@ -29,7 +29,6 @@ import { SlashIcon, ReturnIcon, StopIcon, - type ComposerPermissionAccess, } from "./ComposerPickers"; import { FileSearch } from "./FileSearch"; import { PromptFocus } from "./promptFocus"; @@ -237,7 +236,7 @@ type Props = { /// (`projectDraft`) moves `snapshot`'s cwd but not the tab's until the chat starts, so the /// header's PR belongs to another folder then. headerCwd?: string; - chips: React.ComponentType<{ snapshot: AcpmuxSnapshot; permissionAccess?: ComposerPermissionAccess }>; + chips: React.ComponentType<{ snapshot: AcpmuxSnapshot }>; /// Sends a prompt. False when nothing can take it yet (no acpmux), so the prompt keeps it. A /// promise holds the prompt in the composer until the host takes it: it clears when the promise /// resolves and stays (for the user to send again) when it rejects, so a refusal loses nothing. @@ -268,8 +267,6 @@ type Props = { switching?: boolean; /// The bar's left button, such as attach; by default + opens the agent's commands. `null` leaves the slot empty. leading?: React.ReactNode; - /// Granted folder trust and chat-wide permission state, rendered inside Access. - permissionAccess?: ComposerPermissionAccess; /// Buttons before Send, such as the dictation mic. accessory?: React.ReactNode; /// A dictation session is waiting for words: the empty prompt reads "Listening…" in italic. @@ -394,7 +391,6 @@ export function Composer({ queueImage, draft, leading, - permissionAccess, accessory, dictating = false, prompt, @@ -2117,7 +2113,7 @@ export function Composer({ } chips={ - + } // Claude Code ends the quiet row on the context ring. It keeps its place before the chat diff --git a/webviews/src/agent-session/acpmux/ComposerPickers.gallery.tsx b/webviews/src/agent-session/acpmux/ComposerPickers.gallery.tsx index f403749a4f2b..9989f36b4ba4 100644 --- a/webviews/src/agent-session/acpmux/ComposerPickers.gallery.tsx +++ b/webviews/src/agent-session/acpmux/ComposerPickers.gallery.tsx @@ -3,7 +3,7 @@ import { useEffect, useMemo, useState } from "react"; import { componentEntry } from "../../gallery/format"; import type { Play } from "../../gallery/play"; import type { AcpmuxSnapshot } from "./model"; -import { ComposerPickers, type ComposerPermissionGrant } from "./ComposerPickers"; +import { ComposerPickers } from "./ComposerPickers"; import { BUNDLED_MODEL_CATALOG, buildPickerCatalog } from "./modelCatalogData"; import { ChatAccountsContext, readChatAccounts, type ChatAccounts } from "./chatAccounts"; import { rememberFullAccess } from "./startMode"; @@ -198,10 +198,6 @@ function GalleryComposerPickers({ claude, accounts, managed }: Props) { const [mode, setMode] = useState(initialSnapshot.summary!.modes!.currentModeId!); const [effort, setEffort] = useState("medium"); const [fast, setFast] = useState("off"); - const [grants, setGrants] = useState([ - { id: "folder", label: "Trusted cmux-tui", onRemove: () => setGrants((current) => current.slice(1)) }, - { id: "git-grep", label: "Allow git grep in cmux for this session", onRemove: () => setGrants([]) }, - ]); const snapshot = useMemo( () => ({ ...initialSnapshot, @@ -243,7 +239,6 @@ function GalleryComposerPickers({ claude, accounts, managed }: Props) { (id === "fast-mode" ? setFast(value) : setEffort(value))} @@ -415,20 +410,13 @@ const managedMode: Play = async (ctx) => { throw new Error("Full access must say it is managed by the organization"); }; -const accessGrants: Play = async (ctx) => { - const trigger = ctx.find({ role: "button", name: "Mode" }); - if (trigger.textContent?.includes("Trusted")) throw new Error("Trust state leaked into the Access trigger"); - // The allowed rules live in the menu only; the trigger shows no count beside the mode. - if (trigger.querySelector(".acpmux-access-grant-count") || /\d/.test(trigger.textContent ?? "")) - throw new Error("Access trigger shows an allowed-rule count"); +// The mode menu lists the modes alone (Leo, 2026-10-29): granted access is revoked in Session +// Info's Environment (inspector/EnvironmentSection.tsx), never from this menu. +const modesOnly: Play = async (ctx) => { await ctx.click({ role: "button", name: "Mode" }); - await ctx.waitFor(() => ctx.document.querySelector(".acpmux-access-grants") !== null); - const grants = [...ctx.document.querySelectorAll(".acpmux-access-grant")]; - if (grants.length !== 2) throw new Error(`Expected two allowed rules, found ${grants.length}`); - if (!grants.every((row) => row.querySelector(".acpmux-access-grant-remove"))) - throw new Error("Allowed rules must each have a remove button"); - await ctx.click({ selector: ".acpmux-access-grant-remove" }); - await ctx.waitFor(() => ctx.document.querySelectorAll(".acpmux-access-grant").length === 1); + await ctx.waitFor(() => ctx.document.querySelector('[role="menuitemradio"]') !== null); + if (ctx.document.querySelector(".acpmux-access-grants, .acpmux-access-grant")) + throw new Error("The mode menu shows granted access"); await ctx.press("Escape"); }; @@ -542,10 +530,10 @@ export default componentEntry({ props: { managed: true }, play: managedMode, }, - "access-grants": { - note: "Allowed folder and chat rules stay inside Access; the footer shows only a compact count and the menu offers removal.", + "modes-only": { + note: "The mode menu lists the modes alone: no Granted access section (Leo, 2026-10-29); grants are revoked in Session Info's Environment.", props: {}, - play: accessGrants, + play: modesOnly, }, "permission-focus": { note: "The numeric mode shortcut picks Full access; Escape from a reopen returns focus to Mode.", diff --git a/webviews/src/agent-session/acpmux/ComposerPickers.tsx b/webviews/src/agent-session/acpmux/ComposerPickers.tsx index 4bef1cd2fb29..20c6c6617eed 100644 --- a/webviews/src/agent-session/acpmux/ComposerPickers.tsx +++ b/webviews/src/agent-session/acpmux/ComposerPickers.tsx @@ -156,8 +156,6 @@ const browserSettleTimer: SettleTimer = (run, ms) => { type Props = { snapshot: AcpmuxSnapshot; - /** Granted folder trust and chat-wide permission state, folded into the Access menu. */ - permissionAccess?: ComposerPermissionAccess; onModel(modelId: string): void; /** A rejected promise (or a throw) means the agent refused the mode: the access chip goes back to the mode in force. */ onMode(modeId: string): void | Promise; @@ -199,16 +197,6 @@ type Props = { holdsModePick?: boolean; }; -export type ComposerPermissionGrant = { - id: string; - label: string; - onRemove(): void; -}; - -export type ComposerPermissionAccess = { - grants: readonly ComposerPermissionGrant[]; -}; - /// The composer bar's controls after the + button: one model button that names the model and its /// effort (its tooltip says how much of the context window the chat has used; its menu holds /// Effort, More models, Account and Fast mode), the permission mode (in the warning color when it @@ -217,7 +205,6 @@ export type ComposerPermissionAccess = { /// Send/Stop alone. export function ComposerPickers({ snapshot, - permissionAccess, onModel, onMode, onEffort, @@ -307,7 +294,6 @@ export function ComposerPickers({ // Plan is its own toggle, unless the harness's own menu lists it as a mode (Claude Code's does). const plan = modeMenu?.rows.some((row) => isPlan(row.id)) ? undefined : allModes.find((choice) => isPlan(choice.id)); const modes = allModes.filter((choice) => choice !== plan); - const hasGrants = (permissionAccess?.grants.length ?? 0) > 0; const currentId = summary?.modes?.currentModeId; const planning = plan !== undefined && currentId === plan.id; // Leaving Plan returns to the permission mode this session had before it, never another session's. @@ -1001,7 +987,6 @@ export function ComposerPickers({ place (#24517). */} {picksModel && modes.length === 0 && - !hasGrants && startMode && startModeName && pendingAccessModes.length === 0 && ( @@ -1011,8 +996,7 @@ export function ComposerPickers({ icon={pendingMenu?.rows.find((row) => row.id === shownStart?.modeId)?.icon} /> )} - {/* Granted folder trust and chat allowance stay revocable when the harness offers no modes. */} - {(modes.length > 0 || hasGrants || pendingAccessModes.length > 0) && ( + {(modes.length > 0 || pendingAccessModes.length > 0) && ( 0 ? modes : pendingAccessModes} @@ -1023,7 +1007,6 @@ export function ComposerPickers({ managedReason={t(PICKER_LABELS.fullAccessManaged)} help={t(PICKER_LABELS.modeHelp)} refusedReason={t(PICKER_LABELS.modeRefused)} - permissionAccess={permissionAccess} approvesAll={summary?.enforcement?.policy === "approve-all"} onMode={onMode} {...(pendingMenu @@ -1095,9 +1078,11 @@ function PendingMode({ label, modeId, icon }: { label: string; modeId?: unknown; ); } -/** The permission control stays quiet in the footer: the mode's shield names the control (a lock - * when the harness offers no modes and only grants remain) and the menu carries the mode title - * and one-line explanation, each row with its own shield. Base UI owns focus, typeahead and Escape. */ +/** The permission control stays quiet in the footer: the mode's shield names the control and the + * menu carries the mode title and one-line explanation, each row with its own shield. The menu + * lists the modes alone: granted folder trust and chat allowance are revoked in Session Info's + * Environment (EnvironmentSection.tsx), not here (Leo, 2026-10-29). Base UI owns focus, typeahead + * and Escape. */ /// Runs a mode pick; resolves false when the agent refused it (a rejected promise or a throw). function settle(run: () => void | Promise): Promise { try { @@ -1120,7 +1105,6 @@ function AccessMenu({ managedReason, help, refusedReason, - permissionAccess, approvesAll = false, onMode, heading, @@ -1136,7 +1120,6 @@ function AccessMenu({ managedReason: string; help: string; refusedReason: string; - permissionAccess?: ComposerPermissionAccess; /// acpmux's policy for the chat answers every permission prompt (approve-all, `enforcement`), so /// the chat acts without asking whatever its harness mode is (cmux#27847). approvesAll?: boolean; @@ -1179,7 +1162,6 @@ function AccessMenu({ ? { id: value, name: t(PICKER_LABELS.approvesAll), icon: "shield-alert" } : reportedMode; const fullAccess = answeredForYou || unrestricted(value); - const grants = permissionAccess?.grants ?? []; const pick = (next: string) => { if (blocked(next)) return; setOptimistic({ sessionId, modeId: next }); @@ -1199,10 +1181,9 @@ function AccessMenu({ // A numbered menu (Claude Code's) draws no icon column, as Claude Code's mode menu does; the // button keeps the mode's symbol. const iconless = numbered && heading !== undefined; - // Nothing left to pick (every other mode refused, no grants): a plain label, never a dead menu. + // Nothing left to pick (every other mode refused): a plain label, never a dead menu. if ( refusedIds.length > 0 && - grants.length === 0 && // A full-access row managed off, the current one included, keeps the menu: it stays, disabled // and saying why (reviews 37 and 48). modes.every( @@ -1239,9 +1220,9 @@ function AccessMenu({ title={tooltip} aria-haspopup="menu" > - {modes.length > 0 ? : } + - {currentMode?.name ?? (modes.length === 0 ? grants[0]?.label : undefined) ?? label} + {currentMode?.name ?? label} @@ -1297,24 +1278,6 @@ function AccessMenu({ ))} )} - {grants.length > 0 && ( -
-
{t("permission.grants")}
- {grants.map((grant) => ( -
- {grant.label} - -
- ))} -
- )} @@ -1880,12 +1843,6 @@ const ShieldPlainIcon = ({ shield }: { shield?: string }) => ( ); -export const LockIcon = () => ( - - - - -); /** One shield family for the permission mode, the same on the trigger and in the menu: the mark * inside the shield carries the risk (compact-composer verdict, 2026-10-14). The svg itself * carries data-shield, with no wrapper: it stays the trigger's first child, as the lock was, so diff --git a/webviews/src/agent-session/acpmux/bottomStack.gallery.ts b/webviews/src/agent-session/acpmux/bottomStack.gallery.ts index d39916a4ba10..7c71f56e546d 100644 --- a/webviews/src/agent-session/acpmux/bottomStack.gallery.ts +++ b/webviews/src/agent-session/acpmux/bottomStack.gallery.ts @@ -163,11 +163,10 @@ const trustThenPermission: Play = async (ctx) => { ctx.find({ role: "button", name: allowAlways }); ctx.find({ role: "button", name: allowOnce }); geometry(ctx); - // These chats offer no modes: Access still mounts for the folder grant, so trust stays revocable. - await ctx.click({ selector: ".acpmux-access-trigger" }); - await ctx.waitFor(() => ctx.document.querySelector(".acpmux-access-grant-remove") !== null); - await ctx.click({ selector: ".acpmux-access-grant-remove" }); - await checkTrust(ctx); + // The granted trust is revoked in Session Info's Environment, never from the composer's mode menu + // (Leo, 2026-10-29): these chats offer no modes, so the composer draws no Access menu for it. + if (ctx.document.querySelector(".acpmux-access-trigger, .acpmux-access-grant")) + throw new Error("The composer shows a mode menu for granted access"); }; const waitingInLine: Play = async (ctx) => { await ctx.waitFor(() => ctx.document.querySelector(".acpmux-permission-ask")); diff --git a/webviews/src/agent-session/acpmux/composerLocation.css b/webviews/src/agent-session/acpmux/composerLocation.css index 9cd518871417..bfa84dab2cf4 100644 --- a/webviews/src/agent-session/acpmux/composerLocation.css +++ b/webviews/src/agent-session/acpmux/composerLocation.css @@ -323,61 +323,6 @@ line-height: 16px; letter-spacing: var(--text-detail--letter-spacing); } -/* The allowed rules under the modes (Leo 2026-10-27, on the PR button's full-row highlight: "why are you - giving it the entire row when it's only this small little section? Just don't do that. Don't ever do - that."). A rule's row is not a control, so it takes no hover wash: only its remove x lights, on its - own pill. The section's heading and each rule start on the mode rows' text column, and the x - centers on their trailing column, where a mode's number or check sits: 16 from the menu's edge. - The section sits 4 in from the rows' edges (its hairline is the menu's separator inset), so a mode - row's 4px padding is already spent; a menu whose modes draw their shield adds the icon column - (16 + 8). A fieldset's own padding (0.35em 0.75em 0.625em) is cleared, never inherited: it put the - heading and rules on two other columns. The lead is inline-start padding, so a right-to-left menu - keeps the same columns from its right edge. */ -.acpmux-access-grants { - --acpmux-grant-lead: 0px; - min-inline-size: 0; - border: 0; - margin: 8px 4px 2px; - padding: 8px 0 0; - border-top: .5px solid var(--acpmux-composer-edge); -} -.acpmux-access-menu:has(.acpmux-access-item:not(.acpmux-access-item-iconless)) .acpmux-access-grants { - --acpmux-grant-lead: 24px; -} -.acpmux-access-grants-heading { - padding: 0 0 4px; - padding-inline-start: var(--acpmux-grant-lead); - color: var(--agent-muted); - font-size: var(--text-detail); - letter-spacing: var(--text-detail--letter-spacing); -} -.acpmux-access-grant { - display: grid; - grid-template-columns: minmax(0, 1fr) 16px; - align-items: center; - column-gap: 8px; - min-height: var(--ui-row-height); - padding: 0; - padding-inline-start: var(--acpmux-grant-lead); -} -.acpmux-access-grant-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--agent-soft); font-size: var(--text-detail); letter-spacing: var(--text-detail--letter-spacing); } -.acpmux-access-grant-remove { - justify-self: center; - width: 22px; - height: 22px; - padding: 0; - border: 0; - border-radius: 6px; - background: transparent; - color: var(--agent-muted); - font-family: var(--font-ui); - font-size: var(--text-control); - line-height: var(--text-control--line-height); - cursor: pointer; - letter-spacing: var(--text-control--letter-spacing); -} -.acpmux-access-grant-remove:hover { color: var(--agent-text); background: var(--agent-control-hover); } -.acpmux-access-grant-remove:focus-visible { outline: 1.5px solid var(--agent-text); outline-offset: -1px; } /* The card's corner. A question in the stack over it (the folder trust bar) takes the same token, so the two always match. */ diff --git a/webviews/src/agent-session/acpmux/inspector/ChatInspector.tsx b/webviews/src/agent-session/acpmux/inspector/ChatInspector.tsx index 90c68ec56cc1..8982823b7afe 100644 --- a/webviews/src/agent-session/acpmux/inspector/ChatInspector.tsx +++ b/webviews/src/agent-session/acpmux/inspector/ChatInspector.tsx @@ -67,7 +67,7 @@ import { ChangesSection, headerStatus, visibleChanges, type InspectorPullRequest import { useChangesStatuses, useStableUrls, withHeader } from "./changesStatus"; import { ConnectorsSection } from "./ConnectorsSection"; import { ContextSection } from "./ContextSection"; -import { EnvironmentSection, type ProjectRowLook } from "./EnvironmentSection"; +import { EnvironmentSection, type AccessGrant, type ProjectRowLook } from "./EnvironmentSection"; import { InspectorGroup } from "./InspectorGroup"; import { InspectorSection } from "./InspectorSection"; import { SourcesSection } from "./SourcesSection"; @@ -286,6 +286,7 @@ export function useChatInspector({ machineName, repository, shell, + grants, onOpenOutput, onOpenSourceFile, onOpenUrl, @@ -329,6 +330,8 @@ export function useChatInspector({ repository?: string; /// The pane's shell: the Inspector measures it to float or push. shell?: HTMLElement | null; + /// What the chat was granted (folder trust, a chat-wide allowance), each revocable in Environment. + grants?: readonly AccessGrant[]; /// Opens a file's diff (App.tsx openOutput: beside the chat, else in place). onOpenOutput?: (path: string) => void; onOpenSourceFile?: (path: string) => unknown; @@ -481,6 +484,7 @@ export function useChatInspector({ machineName={machineName} repository={repository} shell={shell} + grants={grants} beside={beside} wide={wide} openedOutputAt={openedOutputAt} @@ -530,6 +534,7 @@ function InspectorPresence({ machineName, repository, shell, + grants, beside, wide, openedOutputAt, @@ -562,6 +567,7 @@ function InspectorPresence({ machineName?: string; repository?: string; shell?: HTMLElement | null; + grants?: readonly AccessGrant[]; /// The side panel beside the chat, as it opens or closes: the chat's room is measured again. beside?: unknown; /// A handoff review's form shows: the shift is measured against it. @@ -745,6 +751,8 @@ function InspectorPresence({ machineName={machineName} peerKinds={snapshot.peerKinds} repository={repository} + // A subagent's view lists its own things: the grants are the chat's. + grants={scope ? undefined : grants} made={made} links={links} artifacts={artifacts} @@ -929,6 +937,7 @@ export function ChatInspector({ machineName, peerKinds, repository, + grants, made, links = [], artifacts = 0, @@ -972,6 +981,8 @@ export function ChatInspector({ machineName?: string; peerKinds?: Readonly>; repository?: string; + /// What the chat was granted, revocable in Environment. + grants?: readonly AccessGrant[]; /// What the chat produced (sessionSummary). made?: Pick & Partial>; links?: readonly OutputLink[]; @@ -1123,6 +1134,7 @@ export function ChatInspector({ peerKinds={peerKinds} repository={repository} remoteControl={remoteControl} + grants={grants} onSave={onSaveEnvironment} onOpenFolder={onOpenFolder} projectLook={projectRowLook} diff --git a/webviews/src/agent-session/acpmux/inspector/EnvironmentSection.tsx b/webviews/src/agent-session/acpmux/inspector/EnvironmentSection.tsx index e93e62f56da4..2762409269bf 100644 --- a/webviews/src/agent-session/acpmux/inspector/EnvironmentSection.tsx +++ b/webviews/src/agent-session/acpmux/inspector/EnvironmentSection.tsx @@ -2,7 +2,9 @@ // that says so. The machine by its own name and kind (this Mac, an SSH machine, a Cloud machine), // never "This computer", with Save; then the chat's project (chatFolders.ts), named by its // repository, whose full path only a hover shows; the GitHub repository; the branch. Then Remote -// Control, when the App offers it. A chat in a temporary or internal folder (a harness's scratchpad) +// Control, when the App offers it. Last, what the chat was granted (the folder's trust, a chat-wide +// allowance), each with Revoke: their one home, since the composer's mode menu lists the modes +// alone (Leo, 2026-10-29). A chat in a temporary or internal folder (a harness's scratchpad) // has no project row and no Save: only its machine. Every row does something: the project opens in // the Files tree beside the chat, the repository and the branch are links to GitHub, which the pane // opens in the browser as it opens a reply's link. @@ -18,6 +20,13 @@ import { chatProject } from "./chatFolders"; type Summary = NonNullable; +/// Something the chat was granted (App.tsx `accessGrants`): its label, and how Revoke takes it back. +export type AccessGrant = { + id: string; + label: string; + onRemove(): void; +}; + const ROW_ICON = rowIconSize(12); /// How the project row reads. `name` (shipped): the repository's name alone, the branch its own row. @@ -115,6 +124,7 @@ export function EnvironmentSection({ peerKinds, repository, remoteControl, + grants = [], onSave, onOpenFolder, projectLook = "name", @@ -126,6 +136,8 @@ export function EnvironmentSection({ repository?: string; /// Remote Control's state and switch, when the App offers it for this chat. remoteControl?: { on: boolean; set: (on: boolean) => void }; + /// What the chat was granted, each with Revoke. + grants?: readonly AccessGrant[]; /// Saves this machine and folder as a reusable environment, when the App offers it. onSave?: () => Promise | void; /// Opens a folder in the Files tree beside the chat (a chat on this Mac). @@ -231,6 +243,20 @@ export function EnvironmentSection({ )} + {grants.map((grant) => ( +
  • + + {grant.label} + +
  • + ))} ); } diff --git a/webviews/test/access-chip-pending-warning.test.tsx b/webviews/test/access-chip-pending-warning.test.tsx index 0e836b29dae6..ab6e5b2d1632 100644 --- a/webviews/test/access-chip-pending-warning.test.tsx +++ b/webviews/test/access-chip-pending-warning.test.tsx @@ -89,10 +89,6 @@ afterAll(() => { }); type Summary = Record | undefined; -type PermissionAccess = { - grants: readonly { id: string; label: string; onRemove(): void }[]; -}; - function reported(sessionId: string, currentModeId: string): Summary { return { sessionId, @@ -110,7 +106,7 @@ function reported(sessionId: string, currentModeId: string): Summary { } /// Renders the composer's chips for `summary` (undefined: a new chat whose session has not reported). -async function render(summary: Summary, cwd?: string, permissionAccess?: PermissionAccess, holdsModePick = true) { +async function render(summary: Summary, cwd?: string, holdsModePick = true) { const { createRoot } = await import("react-dom/client"); const { QueryClient, QueryClientProvider } = await import("@tanstack/react-query"); const { ComposerPickers } = await import("../src/agent-session/acpmux/ComposerPickers"); @@ -140,7 +136,6 @@ async function render(summary: Summary, cwd?: string, permissionAccess?: Permiss return ( undefined} onMode={() => undefined} @@ -202,7 +197,7 @@ async function fresh(cwd?: string, holdsModePick = true) { act(() => root?.unmount()); root = undefined; host.replaceChildren(); - await render(undefined, cwd, undefined, holdsModePick); + await render(undefined, cwd, holdsModePick); } test("a new chat acpmux starts in full access draws its warning chip on the first frame", async () => { @@ -227,12 +222,11 @@ test("a new chat acpmux starts in full access draws its warning chip on the firs expect(access()).toEqual({ label: "Bypass permissions", warning: true }); }); -test("the access chip keeps grant details in its menu without a count in the pill", async () => { - await render(reported("chat", "default"), undefined, { - grants: [{ id: "grant-1", label: "Always allow shell", onRemove: () => undefined }], - }); +// Leo, 2026-10-29, on the mode menu's "Granted access" section: "What is this bottom fucking +// bullshit?" The menu lists the modes alone; grants are revoked in Session Info's Environment. +test("the access menu lists the modes alone, with no granted access section", async () => { + await render(reported("chat", "default")); const chip = host.querySelector(".acpmux-mode")!; - expect(chip.querySelector(".acpmux-access-grant-count")).toBeNull(); expect(chip.querySelector(".acpmux-mode-text")?.textContent?.trim()).toBe("Manual"); await act(async () => { const trigger = chip.querySelector(".acpmux-access-trigger")!; @@ -240,8 +234,9 @@ test("the access chip keeps grant details in its menu without a count in the pil Object.defineProperties(press, { pointerId: { value: 1 }, pointerType: { value: "mouse" } }); trigger.dispatchEvent(press); }); - expect(document.querySelector(".acpmux-access-grant-label")?.textContent).toBe("Always allow shell"); - expect(document.querySelector(".acpmux-access-grant-remove")).not.toBeNull(); + expect(document.querySelectorAll('[role="menuitemradio"]').length).toBeGreaterThan(0); + expect(document.querySelector(".acpmux-access-grants, .acpmux-access-grant")).toBeNull(); + expect(document.body.textContent).not.toContain("Granted access"); }); test("a kept answer that is wrong gives way to acpmux's answer", async () => { diff --git a/webviews/test/access-grants-columns.test.ts b/webviews/test/access-grants-columns.test.ts deleted file mode 100644 index 209c656e7d1a..000000000000 --- a/webviews/test/access-grants-columns.test.ts +++ /dev/null @@ -1,142 +0,0 @@ -// cmux-web-test-timeout: 300 -// The permission menu's allowed rules (ComposerPickers.tsx, "Granted access") sit on the mode rows' -// columns, and only their remove x lights on hover. The section is a fieldset, and the fieldset's own -// padding put the heading 6px and each rule 4px left of the modes' text, with the x 21px inside their -// number and check column; the whole rule row took a hover wash around its small x (Leo 2026-10-27: -// "why are you giving it the entire row when it's only this small little section? Just don't do -// that. Don't ever do that."). design/grid.md: every row type starts its text on the surface's -// `text` line and centers its trailing mark on `trail`, from the inline start in a right-to-left menu too. -// Real Chromium and WebKit (the app's engine) on the gallery stage. CI fails the file when it cannot -// launch them (requireBrowserLane). Locally: CMUX_BROWSER_TESTS=1 bun test test/access-grants-columns.test.ts -import { afterAll, beforeAll, describe, expect, setDefaultTimeout, test } from "bun:test"; -import path from "node:path"; -import { chromium, webkit, type Browser, type BrowserType, type Page } from "playwright"; -import { galleryFrame, warmGalleryFrame } from "./support/galleryFrame"; -import { requireBrowserLane } from "./support/requireBrowserLane"; - -await requireBrowserLane("access-grants-columns.test.ts", async () => { - setDefaultTimeout(240_000); - const engines: [string, BrowserType][] = []; - for (const engine of [ - ["chromium", chromium], - ["webkit", webkit], - ] as [string, BrowserType][]) { - try { - await (await engine[1].launch({ headless: true })).close(); - engines.push(engine); - } catch { - console.warn(`access grants: ${engine[0]} cannot launch here`); - } - } - if (engines.length === 0) { - describe.skip("access grants", () => test("browsers", () => {})); - return; - } - - const ENTRY = "agent-pane.composer-pickers"; - // The closed stage: the access-grants variant's play removes a rule before a test could read the menu. - const VARIANT = "closed"; - const { createServer } = await import("vite"); - const webviews = path.resolve(import.meta.dir, ".."); - let vite: Awaited> | undefined; - const browsers = new Map(); - const stageURL = (theme: string) => - `http://127.0.0.1:${(vite!.httpServer!.address() as { port: number }).port}${galleryFrame(ENTRY, { variant: VARIANT, frame: "component", width: 640, theme })}`; - - beforeAll(async () => { - vite = await createServer({ - configFile: path.join(webviews, "vite.config.gallery-dev.ts"), - server: { port: 0, host: "127.0.0.1", strictPort: false }, - logLevel: "error", - }); - await vite.listen(); - for (const [name, engine] of engines) browsers.set(name, await engine.launch({ headless: true })); - await warmGalleryFrame(vite, ENTRY, { browser: [...browsers.values()][0], params: { variant: VARIANT } }); - }); - afterAll(async () => { - for (const browser of browsers.values()) await browser.close(); - await vite?.close(); - }); - - const open = async (engine: string, theme: string, dir: "ltr" | "rtl"): Promise => { - const page = await browsers.get(engine)!.newPage({ viewport: { width: 640, height: 640 } }); - await page.goto(stageURL(theme)); - await page.waitForFunction(() => document.documentElement.dataset.galleryReady === "1", undefined, { - timeout: 120_000, - }); - await page.evaluate(() => document.fonts.ready); - // The gallery has no direction switch; the menu portals into the document and inherits its dir. - await page.evaluate((value) => { - document.documentElement.dir = value; - }, dir); - await page.getByRole("button", { name: "Mode", exact: true }).click(); - await page.locator(".acpmux-access-grants .acpmux-access-grant").first().waitFor(); - return page; - }; - - const cases: [string, "ltr" | "rtl"][] = [ - ["Catppuccin Mocha", "ltr"], - ["Apple System Colors Light", "ltr"], - ["Catppuccin Mocha", "rtl"], - ]; - for (const [engine] of engines) - for (const [theme, dir] of cases) - test(`${engine}, ${theme}, ${dir}: allowed rules start on the modes' text column and their x on the modes' trailing column`, async () => { - const page = await open(engine, theme, dir); - const geometry = await page.evaluate(() => { - const menu = document.querySelector(".acpmux-access-menu")!; - const rtl = getComputedStyle(menu).direction === "rtl"; - // Where a line of text starts: its left edge, or its right edge in a right-to-left menu. - const textStart = (element: Element) => { - const range = document.createRange(); - range.selectNodeContents(element); - const box = range.getBoundingClientRect(); - return rtl ? box.right : box.left; - }; - const center = (element: Element) => { - const box = element.getBoundingClientRect(); - return box.left + box.width / 2; - }; - const modes = [...menu.querySelectorAll(".acpmux-access-item")]; - // A mode's trailing mark: its number, or the check on the chosen row. - const marks = modes - .map((row) => - [...row.querySelectorAll(".ui-menu-shortcut, .ui-menu-check")].find( - (mark) => mark.getBoundingClientRect().width > 0 && getComputedStyle(mark).visibility !== "hidden", - ), - ) - .filter((mark): mark is Element => mark !== undefined); - return { - direction: getComputedStyle(menu).direction, - modeText: modes.map((row) => textStart(row.querySelector(".acpmux-menu-label")!)), - modeTrail: marks.map(center), - heading: textStart(menu.querySelector(".acpmux-access-grants-heading")!), - grantText: [...menu.querySelectorAll(".acpmux-access-grant-label")].map(textStart), - grantTrail: [...menu.querySelectorAll(".acpmux-access-grant-remove")].map(center), - }; - }); - expect(geometry.direction, "the menu takes the document's direction").toBe(dir); - expect(geometry.modeText.length, "the fixture has modes").toBeGreaterThan(0); - expect(geometry.modeTrail.length, "the modes show a number or check").toBeGreaterThan(0); - expect(geometry.grantText.length, "the fixture has allowed rules").toBe(2); - const text = geometry.modeText[0]!; - const trail = geometry.modeTrail[0]!; - for (const left of geometry.modeText) - expect(Math.abs(left - text), "the modes share one text column").toBeLessThan(0.5); - expect(Math.abs(geometry.heading - text), "the heading starts on the modes' text").toBeLessThan(0.5); - for (const left of geometry.grantText) - expect(Math.abs(left - text), "a rule starts on the modes' text").toBeLessThan(0.5); - for (const x of geometry.grantTrail) - expect(Math.abs(x - trail), "a rule's x centers on the modes' trailing column").toBeLessThan(0.5); - - // Hovering a rule lights nothing; hovering its x lights the x alone. - const row = page.locator(".acpmux-access-grant").first(); - await row.locator(".acpmux-access-grant-label").hover(); - const wash = () => row.evaluate((element) => getComputedStyle(element).backgroundColor); - const clear = (color: string) => color === "transparent" || /^rgba\(.*,\s*0\)$/.test(color); - expect(clear(await wash()), "a rule's row takes no hover wash").toBe(true); - await row.locator(".acpmux-access-grant-remove").hover(); - expect(clear(await wash()), "hovering the x lights no row").toBe(true); - await page.close(); - }); -}); diff --git a/webviews/test/chat-inspector-environment.test.tsx b/webviews/test/chat-inspector-environment.test.tsx index c79d423514c3..ce722e7e4eeb 100644 --- a/webviews/test/chat-inspector-environment.test.tsx +++ b/webviews/test/chat-inspector-environment.test.tsx @@ -284,3 +284,28 @@ test("Environment Save also handles a synchronous callback failure", async () => expect(button.disabled).toBe(false); expect(container.querySelector('[role="alert"]')).not.toBeNull(); }); + +// Leo, 2026-10-29, on the composer mode menu's "Granted access" section: "What is this bottom +// fucking bullshit?" The grants moved here: each one is a row with its own Revoke. +test("what the chat was granted is listed last, each with Revoke", async () => { + const base = chat(scratchRows); + const revoked: string[] = []; + const environment = await renderInspector({ + summary: { ...base.summary!, cwd: SCRATCHPAD, branch: undefined, worktree: undefined }, + machineName: "studio-mac", + rows: scratchRows, + grants: [ + { id: "folder-trust", label: "Trusted scratchpad", onRemove: () => revoked.push("folder-trust") }, + { id: "chat-permission", label: "Allow for this chat", onRemove: () => revoked.push("chat-permission") }, + ], + }); + const rows = [...environment.querySelectorAll("li[data-grant]")]; + expect(rows.map((row) => row.dataset.grant)).toEqual(["folder-trust", "chat-permission"]); + expect(rows[0]!.textContent).toContain("Trusted scratchpad"); + const revoke = rows[0]!.querySelector("button")!; + expect(revoke.textContent).toBe(translate("permission.revoke")); + expect(revoke.getAttribute("aria-label")).toBe(`${translate("permission.revoke")}: Trusted scratchpad`); + await act(async () => revoke.click()); + await act(async () => rows[1]!.querySelector("button")!.click()); + expect(revoked).toEqual(["folder-trust", "chat-permission"]); +}); diff --git a/webviews/test/gallery-coverage.allowlist.json b/webviews/test/gallery-coverage.allowlist.json index 574d3f2fcb0b..f03b6ff27d33 100644 --- a/webviews/test/gallery-coverage.allowlist.json +++ b/webviews/test/gallery-coverage.allowlist.json @@ -12,7 +12,6 @@ "agent-session/acpmux/ComposerPickers.tsx#CheckIcon", "agent-session/acpmux/ComposerPickers.tsx#ChevronIcon", "agent-session/acpmux/ComposerPickers.tsx#ChevronRightIcon", - "agent-session/acpmux/ComposerPickers.tsx#LockIcon", "agent-session/acpmux/ComposerPickers.tsx#MicIcon", "agent-session/acpmux/ComposerPickers.tsx#PaperclipIcon", "agent-session/acpmux/ComposerPickers.tsx#PlanIcon", From 617a991f101c144be1d886ce22f1e0b84338b398 Mon Sep 17 00:00:00 2001 From: Leo Date: Fri, 30 Oct 2026 15:57:03 -0700 Subject: [PATCH 2/7] cmux NEXT: Environment gallery shows grants with Revoke; drop stale grant comments Adds the Environment gallery's granted variant (folder trust and a chat allowance, each with Revoke), updates three comments that still placed grants in the mode menu, and removes the now-unused permission.grants string. Co-Authored-By: Claude Opus 5.5 Agent-Session: https://cmux.com/deeplink/agent?id=aid-f2206f5448805d85f14b --- .../src/agent-session/acpmux/ComposerBox.tsx | 2 +- .../acpmux/Localizable.xcstrings | 132 ------------------ .../inspector/EnvironmentSave.gallery.tsx | 27 +++- .../acpmux/permissions/Panel.gallery.tsx | 4 +- webviews/test/composer-row-layout.test.ts | 2 +- 5 files changed, 26 insertions(+), 141 deletions(-) diff --git a/webviews/src/agent-session/acpmux/ComposerBox.tsx b/webviews/src/agent-session/acpmux/ComposerBox.tsx index 446a29addf87..642fd0ff7696 100644 --- a/webviews/src/agent-session/acpmux/ComposerBox.tsx +++ b/webviews/src/agent-session/acpmux/ComposerBox.tsx @@ -227,7 +227,7 @@ export function ComposerBox({ > {leading} {/* The granted-permission status gets no slot of its own in this row (hq#1957 item 15 - compact row): grants live in the permission mode's Access menu, one lock. */} + compact row): grants are revoked in Session Info's Environment. */} {!quietRow && shownChips} {/* Codex's look: the context ring before the model, where Codex shows its own. */} {!quietRow && plainFooter && ring} diff --git a/webviews/src/agent-session/acpmux/Localizable.xcstrings b/webviews/src/agent-session/acpmux/Localizable.xcstrings index 06023906d221..39b097d04300 100644 --- a/webviews/src/agent-session/acpmux/Localizable.xcstrings +++ b/webviews/src/agent-session/acpmux/Localizable.xcstrings @@ -5924,138 +5924,6 @@ } } }, - "permission.grants": { - "comment": "Agent pane: heading over folder trust and chat-wide permission grants in the composer's Access menu", - "extractionState": "manual", - "localizations": { - "ar": { - "stringUnit": { - "state": "needs_review", - "value": "الأذونات الممنوحة" - } - }, - "bs": { - "stringUnit": { - "state": "needs_review", - "value": "Odobren pristup" - } - }, - "da": { - "stringUnit": { - "state": "needs_review", - "value": "Tildelt adgang" - } - }, - "de": { - "stringUnit": { - "state": "needs_review", - "value": "Gewährter Zugriff" - } - }, - "en": { - "stringUnit": { - "state": "translated", - "value": "Granted access" - } - }, - "es": { - "stringUnit": { - "state": "needs_review", - "value": "Acceso concedido" - } - }, - "fr": { - "stringUnit": { - "state": "needs_review", - "value": "Accès accordé" - } - }, - "it": { - "stringUnit": { - "state": "needs_review", - "value": "Accesso concesso" - } - }, - "ja": { - "stringUnit": { - "state": "needs_review", - "value": "許可済みのアクセス" - } - }, - "km": { - "stringUnit": { - "state": "needs_review", - "value": "ការចូលប្រើដែលបានអនុញ្ញាត" - } - }, - "ko": { - "stringUnit": { - "state": "needs_review", - "value": "허용된 접근" - } - }, - "nb": { - "stringUnit": { - "state": "needs_review", - "value": "Gitt tilgang" - } - }, - "pl": { - "stringUnit": { - "state": "needs_review", - "value": "Przyznany dostęp" - } - }, - "pt-BR": { - "stringUnit": { - "state": "needs_review", - "value": "Acesso concedido" - } - }, - "ru": { - "stringUnit": { - "state": "needs_review", - "value": "Предоставленный доступ" - } - }, - "th": { - "stringUnit": { - "state": "needs_review", - "value": "สิทธิ์ที่อนุญาตแล้ว" - } - }, - "tr": { - "stringUnit": { - "state": "needs_review", - "value": "Verilen erişim" - } - }, - "uk": { - "stringUnit": { - "state": "needs_review", - "value": "Наданий доступ" - } - }, - "vi": { - "stringUnit": { - "state": "needs_review", - "value": "Quyền đã cấp" - } - }, - "zh-Hans": { - "stringUnit": { - "state": "needs_review", - "value": "已授予的权限" - } - }, - "zh-Hant": { - "stringUnit": { - "state": "needs_review", - "value": "已授予的權限" - } - } - } - }, "rail.context": { "comment": "Agent pane", "extractionState": "manual", diff --git a/webviews/src/agent-session/acpmux/inspector/EnvironmentSave.gallery.tsx b/webviews/src/agent-session/acpmux/inspector/EnvironmentSave.gallery.tsx index 159d6ac41e52..db98aab32f27 100644 --- a/webviews/src/agent-session/acpmux/inspector/EnvironmentSave.gallery.tsx +++ b/webviews/src/agent-session/acpmux/inspector/EnvironmentSave.gallery.tsx @@ -1,19 +1,29 @@ // l10n-allow-file: gallery-only fixture data and controls. -import { useRef } from "react"; +import { useRef, useState } from "react"; import { componentEntry } from "../../../gallery/format"; import { chat } from "../../../gallery/fixtures/acpmux"; -import { EnvironmentSection } from "./EnvironmentSection"; +import { EnvironmentSection, type AccessGrant } from "./EnvironmentSection"; import { InspectorPanel } from "./ChatInspector"; -type Props = { failFirst: boolean }; -function EnvironmentSave({ failFirst }: Props) { +type Props = { failFirst: boolean; granted?: boolean }; +function EnvironmentSave({ failFirst, granted = false }: Props) { const attempts = useRef(0); + // What the chat was granted, each with Revoke: the composer's mode menu no longer lists them. + const [grants, setGrants] = useState(() => + granted + ? [ + { id: "folder-trust", label: "Trusted atlas", onRemove: () => setGrants((all) => all.slice(1)) }, + { id: "chat-permission", label: "Allow for this chat", onRemove: () => setGrants((all) => all.slice(0, -1)) }, + ] + : [], + ); return (
    { attempts.current++; if (failFirst && attempts.current === 1) return Promise.reject(new Error("Fixture host refused save")); @@ -27,7 +37,7 @@ function EnvironmentSave({ failFirst }: Props) { export default componentEntry({ id: "agent-pane.environment-save", - title: "Environment save recovery", + title: "Environment save and grants", area: "Agent pane", pane: true, height: 260, @@ -37,5 +47,12 @@ export default componentEntry({ variants: { success: { note: "The host saves the environment.", props: { failFirst: false } }, refused: { note: "First Save fails; the next succeeds.", props: { failFirst: true } }, + granted: { + note: "The folder's trust and a chat-wide allowance, each with Revoke: their home since the composer's mode menu lists the modes alone (Leo, 2026-10-29).", + props: { failFirst: false, granted: true }, + play: async (ctx) => { + await ctx.waitFor(() => ctx.document.querySelectorAll("li[data-grant]").length === 2); + }, + }, }, }); diff --git a/webviews/src/agent-session/acpmux/permissions/Panel.gallery.tsx b/webviews/src/agent-session/acpmux/permissions/Panel.gallery.tsx index 6200e48e133a..1166ba862922 100644 --- a/webviews/src/agent-session/acpmux/permissions/Panel.gallery.tsx +++ b/webviews/src/agent-session/acpmux/permissions/Panel.gallery.tsx @@ -170,8 +170,8 @@ const openReceipt: Play = async (ctx) => { await ctx.waitFor(() => Boolean(ctx.document.querySelector(".acpmux-permission-receipt[open]"))); }; -/// A chat-wide allowance alone draws no card: its remove lives in the composer's access menu -/// (ComposerPickers.gallery `access-grants`). The panel still answers the Revoke menu action, which +/// A chat-wide allowance alone draws no card: its Revoke lives in Session Info's Environment +/// (inspector/EnvironmentSection.tsx). The panel still answers the Revoke menu action, which /// the app relays as `cmux-acpmux-permissionRevoke`. const revokeAllowance: Play = async (ctx) => { if (ctx.document.querySelector(".acpmux-permission-panel")) throw new Error("An allowance alone drew a card"); diff --git a/webviews/test/composer-row-layout.test.ts b/webviews/test/composer-row-layout.test.ts index 8e5734dd2467..65ff79fd77fd 100644 --- a/webviews/test/composer-row-layout.test.ts +++ b/webviews/test/composer-row-layout.test.ts @@ -149,7 +149,7 @@ await requireBrowserLane("composer-row-layout.test.ts", async () => { '.acpmux-context, .acpmux-context-ring, [role="progressbar"], [class*="spinner"], [class*="-ring"]', ), ].map((element) => element.className.toString() || element.tagName), - // LockIcon (ComposerPickers.tsx): its shackle path. + // A lock's shackle path: the row draws none (the mode menu no longer holds grants). locks: bar.querySelectorAll('svg path[d^="M5.5 7V5.6"]').length, status: bar.querySelector(".acpmux-permission-status") !== null, effortChip: document.querySelector(".acpmux-effort") !== null, From 456cd8771b8a7bfbae22049afb525eaeab9f3782 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Sat, 31 Oct 2026 02:42:26 +0000 Subject: [PATCH 3/7] cmux NEXT: grants stay revocable from the chat menu; Session Info's Revoke shows on its row's hover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review of #28617 at 617a991f (P1): with default settings Session Info is off (Debug Settings `agent.inspector`), and once trust is decided the trust bar is gone, so a trusted folder had no visible way back. The chat menu (…), in every chat, now ends its tools rows with Revoke Granted Access when the chat has grants: a submenu naming each one (the folder's trust, a chat-wide allowance), whose pick revokes it through the same callbacks. Never the composer's mode menu (Leo, 2026-10-29: "What is this bottom fucking bullshit?"). header/grantsMenu.ts builds the grants once for both places. chat-menu-revoke-access.test.tsx: with Session Info off and a decided trust grant, the chat menu lists the grant and picking it revokes (red with no row, green with it). P2: Session Info's Environment shows a grant's Revoke only while that row is hovered or holds focus, at once with no fade, as the pull request chips' x does (#28533); it stays in the Tab order. Gallery: header-tools `menu-revoke-access`; environment-save `granted-hover`. The design-token baseline shrinks by the access-grants height the first commit removed. Co-Authored-By: Claude Opus 5.5 Agent-Session: https://cmux.com/deeplink/agent?id=aid-63b9964940c20354b639 --- webviews/scripts/design-tokens-baseline.jsonl | 2 +- webviews/src/agent-session/acpmux/App.tsx | 49 +++-- .../src/agent-session/acpmux/ComposerBox.tsx | 2 +- .../acpmux/ComposerPickers.gallery.tsx | 6 +- .../agent-session/acpmux/ComposerPickers.tsx | 24 ++- .../acpmux/Localizable.xcstrings | 3 +- .../acpmux/bottomStack.gallery.ts | 3 +- .../acpmux/header/ChatHeaderTools.gallery.tsx | 27 +++ .../agent-session/acpmux/header/grantsMenu.ts | 61 +++++++ .../inspector/EnvironmentSave.gallery.tsx | 14 ++ .../acpmux/inspector/EnvironmentSection.tsx | 7 +- .../acpmux/inspector/inspector.css | 11 ++ .../test/chat-menu-revoke-access.test.tsx | 169 ++++++++++++++++++ 13 files changed, 325 insertions(+), 53 deletions(-) create mode 100644 webviews/src/agent-session/acpmux/header/grantsMenu.ts create mode 100644 webviews/test/chat-menu-revoke-access.test.tsx diff --git a/webviews/scripts/design-tokens-baseline.jsonl b/webviews/scripts/design-tokens-baseline.jsonl index 3dc9e5a7a5b3..536361942481 100644 --- a/webviews/scripts/design-tokens-baseline.jsonl +++ b/webviews/scripts/design-tokens-baseline.jsonl @@ -41,7 +41,7 @@ {"file":"agent-session/acpmux/composerControls.css","kind":"height","property":"height","values":{"1px":1,"calc(23.5px * var(--cmux-interface-scale, 1))":1,"calc(15px * var(--cmux-interface-scale, 1))":1,"3px":1,"16px":1}} {"file":"agent-session/acpmux/composerControls.css","kind":"spacing","property":"gap","values":{"6px":1}} {"file":"agent-session/acpmux/composerControls.css","kind":"spacing","property":"padding","values":{"0 8px 6px":1,"6px 10px 4px":1,"0 6px 0 8px":1}} -{"file":"agent-session/acpmux/composerLocation.css","kind":"height","property":"height","values":{"46px":1,"calc(46px + var(--acpmux-strip-gap, 4px))":2,"22px":4,"1px":3,"12px":1,"16px":3,"6px":1}} +{"file":"agent-session/acpmux/composerLocation.css","kind":"height","property":"height","values":{"46px":1,"calc(46px + var(--acpmux-strip-gap, 4px))":2,"22px":3,"1px":3,"12px":1,"16px":3,"6px":1}} {"file":"agent-session/acpmux/composerLocation.css","kind":"height","property":"min-height","values":{"52px":1,"16px":1}} {"file":"agent-session/acpmux/composerLocation.css","kind":"spacing","property":"gap","values":{"1px":1,"6px":1,"3px":1}} {"file":"agent-session/acpmux/composerLocation.css","kind":"spacing","property":"padding","values":{"0 var(--acpmux-strip-inset, 3px)":1,"0 6px":2,"0 3px":1,"5px 4px":1,"4px 4px 2px":1,"0 5px":1,"0 calc(var(--acpmux-top-strip-edge) - var(--acpmux-tray-inset) - 6px) var(--acpmux-tray-tuck)":1,"0 0 calc(2px + var(--acpmux-tray-tuck)) calc(var(--acpmux-top-strip-edge) - var(--acpmux-tray-inset))":1,"6px 8px":1,"1px 4px":1,"calc(11px * var(--cmux-interface-scale, 1)) max(0px, calc(8px * var(--cmux-interface-scale, 1) - var(--cmux-scroller-size, 8px))) calc(11px * var(--cmux-interface-scale, 1)) calc(7px * var(--cmux-interface-scale, 1))":1}} diff --git a/webviews/src/agent-session/acpmux/App.tsx b/webviews/src/agent-session/acpmux/App.tsx index d7e836569c00..32e3cf5399cc 100644 --- a/webviews/src/agent-session/acpmux/App.tsx +++ b/webviews/src/agent-session/acpmux/App.tsx @@ -155,7 +155,7 @@ import { } from "./attachments"; import type { KeptAttachments } from "./composer/keptAttachments"; import { ComposerPickers, PICKER_LABELS } from "./ComposerPickers"; -import type { AccessGrant } from "./inspector/EnvironmentSection"; +import { chatAccessGrants, revokeAccessRows } from "./header/grantsMenu"; import { openPicker } from "./pickerOpeners"; import { EmptyState, type EmptyStateProjects, isNewChat, projectName } from "./EmptyState"; import { ChatUnavailableState } from "./ChatUnavailableState"; @@ -6743,10 +6743,11 @@ function AcpmuxPane() { workflows.length > 0 ? { list: workflows, onStop: stopSubagent, onOpenAgent: showWorkflowAgent } : undefined, [workflows, stopSubagent, showWorkflowAgent], ); - // What the chat was granted, revoked from Session Info's Environment (EnvironmentSection.tsx), - // never from the composer's mode menu, which lists the modes alone (Leo, 2026-10-29). The trusted - // grant names where the answer lives (the repository, a worktree's root, the folder), from the - // answer just given or the last read; its × forgets it there. + // What the chat was granted (header/grantsMenu.ts): revoked from the chat menu's Revoke Granted + // Access, always there, and from Session Info's Environment when it shows; never from the + // composer's mode menu, which lists the modes alone (Leo, 2026-10-29). The trusted grant names + // where the answer lives (the repository, a worktree's root, the folder), from the answer just + // given or the last read. const trustScope = trustAsk.ask?.state === "decided" && trustAsk.ask.level === "trusted" ? trustAsk.ask : trustAsk.scope; const trustLabel = trustScope @@ -6754,30 +6755,18 @@ function AcpmuxPane() { ? t("trust.trustedPrivate") : trustedLabel(t, trustScope) : undefined; - const accessGrants: AccessGrant[] = [ - ...(trustAsk.trusted - ? [ - { - id: "folder-trust", - label: trustLabel ?? t("trust.trustedPrivate"), - onRemove: trustAsk.undo, - }, - ] - : []), - ...(snapshot.permissionGroups?.chatAllowance - ? [ - { - id: "chat-permission", - label: t("permission.allowChat"), - // A grant shown from the chat's last read until its refresh lands: removable once it is read. - onRemove: () => - snapshot.permissionGroups?.ready === false - ? undefined - : void callNative("chat.permission_chat.revoke", {}), - }, - ] - : []), - ]; + const accessGrants = chatAccessGrants( + { + trusted: trustAsk.trusted, + trustLabel, + untrust: trustAsk.undo, + chatAllowance: Boolean(snapshot.permissionGroups?.chatAllowance), + // A grant shown from the chat's last read until its refresh lands: removable once it is read. + allowanceUnread: snapshot.permissionGroups?.ready === false, + revokeAllowance: () => void callNative("chat.permission_chat.revoke", {}), + }, + t, + ); const inspector = useChatInspector({ snapshot, machineName, @@ -9462,6 +9451,8 @@ function AcpmuxPane() { }, ] : []), + // Revoke Granted Access: the chat's grants, revocable with default settings (header/grantsMenu.ts). + ...revokeAccessRows(accessGrants, t), ]; // Quick Chat's panel is not a tab: only the chat's own actions. if (quick) return menuGroups(fork, continueIn, copy ? [copy] : [], tools); diff --git a/webviews/src/agent-session/acpmux/ComposerBox.tsx b/webviews/src/agent-session/acpmux/ComposerBox.tsx index 642fd0ff7696..c9c7255aee79 100644 --- a/webviews/src/agent-session/acpmux/ComposerBox.tsx +++ b/webviews/src/agent-session/acpmux/ComposerBox.tsx @@ -227,7 +227,7 @@ export function ComposerBox({ > {leading} {/* The granted-permission status gets no slot of its own in this row (hq#1957 item 15 - compact row): grants are revoked in Session Info's Environment. */} + compact row): grants are revoked from the chat menu (header/grantsMenu.ts). */} {!quietRow && shownChips} {/* Codex's look: the context ring before the model, where Codex shows its own. */} {!quietRow && plainFooter && ring} diff --git a/webviews/src/agent-session/acpmux/ComposerPickers.gallery.tsx b/webviews/src/agent-session/acpmux/ComposerPickers.gallery.tsx index 9989f36b4ba4..6fdd40ad9d4d 100644 --- a/webviews/src/agent-session/acpmux/ComposerPickers.gallery.tsx +++ b/webviews/src/agent-session/acpmux/ComposerPickers.gallery.tsx @@ -410,8 +410,8 @@ const managedMode: Play = async (ctx) => { throw new Error("Full access must say it is managed by the organization"); }; -// The mode menu lists the modes alone (Leo, 2026-10-29): granted access is revoked in Session -// Info's Environment (inspector/EnvironmentSection.tsx), never from this menu. +// The mode menu lists the modes alone (Leo, 2026-10-29): granted access is revoked from the chat +// menu's Revoke Granted Access (header/grantsMenu.ts), never from this menu. const modesOnly: Play = async (ctx) => { await ctx.click({ role: "button", name: "Mode" }); await ctx.waitFor(() => ctx.document.querySelector('[role="menuitemradio"]') !== null); @@ -531,7 +531,7 @@ export default componentEntry({ play: managedMode, }, "modes-only": { - note: "The mode menu lists the modes alone: no Granted access section (Leo, 2026-10-29); grants are revoked in Session Info's Environment.", + note: "The mode menu lists the modes alone: no Granted access section (Leo, 2026-10-29); grants are revoked from the chat menu's Revoke Granted Access.", props: {}, play: modesOnly, }, diff --git a/webviews/src/agent-session/acpmux/ComposerPickers.tsx b/webviews/src/agent-session/acpmux/ComposerPickers.tsx index 20c6c6617eed..84eb1c97add1 100644 --- a/webviews/src/agent-session/acpmux/ComposerPickers.tsx +++ b/webviews/src/agent-session/acpmux/ComposerPickers.tsx @@ -985,17 +985,13 @@ export function ComposerPickers({ catalog fallback's, a harness acpmux does not have, so the row shows none of them. While acpmux has not listed its harnesses yet, `picksModel` holds and the placeholder keeps its place (#24517). */} - {picksModel && - modes.length === 0 && - startMode && - startModeName && - pendingAccessModes.length === 0 && ( - row.id === shownStart?.modeId)?.icon} - /> - )} + {picksModel && modes.length === 0 && startMode && startModeName && pendingAccessModes.length === 0 && ( + row.id === shownStart?.modeId)?.icon} + /> + )} {(modes.length > 0 || pendingAccessModes.length > 0) && ( void | Promise): Promise { try { diff --git a/webviews/src/agent-session/acpmux/Localizable.xcstrings b/webviews/src/agent-session/acpmux/Localizable.xcstrings index 39b097d04300..34804b1f3546 100644 --- a/webviews/src/agent-session/acpmux/Localizable.xcstrings +++ b/webviews/src/agent-session/acpmux/Localizable.xcstrings @@ -243109,7 +243109,8 @@ "retry.menu": {"comment":"Agent pane: the name and tooltip of the more-actions button on a failed subagent's line (subagents/SubagentDoneLine.tsx)","extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Subagent actions"}},"ar":{"stringUnit":{"state":"needs_review","value":"إجراءات الوكيل الفرعي"}},"bs":{"stringUnit":{"state":"needs_review","value":"Radnje podagenta"}},"da":{"stringUnit":{"state":"needs_review","value":"Underagenthandlinger"}},"de":{"stringUnit":{"state":"needs_review","value":"Subagent-Aktionen"}},"es":{"stringUnit":{"state":"needs_review","value":"Acciones del subagente"}},"fr":{"stringUnit":{"state":"needs_review","value":"Actions du sous-agent"}},"it":{"stringUnit":{"state":"needs_review","value":"Azioni del subagente"}},"ja":{"stringUnit":{"state":"needs_review","value":"サブエージェントの操作"}},"km":{"stringUnit":{"state":"needs_review","value":"សកម្មភាពភ្នាក់ងាររង"}},"ko":{"stringUnit":{"state":"needs_review","value":"하위 에이전트 작업"}},"nb":{"stringUnit":{"state":"needs_review","value":"Underagenthandlinger"}},"pl":{"stringUnit":{"state":"needs_review","value":"Akcje podagenta"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Ações do subagente"}},"ru":{"stringUnit":{"state":"needs_review","value":"Действия субагента"}},"th":{"stringUnit":{"state":"needs_review","value":"การทำงานของเอเจนต์ย่อย"}},"tr":{"stringUnit":{"state":"needs_review","value":"Alt ajan eylemleri"}},"uk":{"stringUnit":{"state":"needs_review","value":"Дії субагента"}},"vi":{"stringUnit":{"state":"needs_review","value":"Thao tác tác tử con"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"子代理操作"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"子代理程式動作"}}}}, "chatMenu.pauseMachine": {"comment":"Agent pane chat menu: pause the Cloud machine this chat runs on","extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Pause Machine"}},"ar":{"stringUnit":{"state":"needs_review","value":"إيقاف الجهاز مؤقتًا"}},"bs":{"stringUnit":{"state":"needs_review","value":"Pauziraj mašinu"}},"da":{"stringUnit":{"state":"needs_review","value":"Sæt maskine på pause"}},"de":{"stringUnit":{"state":"needs_review","value":"Maschine pausieren"}},"es":{"stringUnit":{"state":"needs_review","value":"Pausar máquina"}},"fr":{"stringUnit":{"state":"needs_review","value":"Mettre la machine en pause"}},"it":{"stringUnit":{"state":"needs_review","value":"Metti in pausa la macchina"}},"ja":{"stringUnit":{"state":"needs_review","value":"マシンを一時停止"}},"km":{"stringUnit":{"state":"needs_review","value":"ផ្អាកម៉ាស៊ីន"}},"ko":{"stringUnit":{"state":"needs_review","value":"머신 일시 정지"}},"nb":{"stringUnit":{"state":"needs_review","value":"Sett maskinen på pause"}},"pl":{"stringUnit":{"state":"needs_review","value":"Wstrzymaj maszynę"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Pausar máquina"}},"ru":{"stringUnit":{"state":"needs_review","value":"Приостановить машину"}},"th":{"stringUnit":{"state":"needs_review","value":"หยุดเครื่องชั่วคราว"}},"tr":{"stringUnit":{"state":"needs_review","value":"Makineyi duraklat"}},"uk":{"stringUnit":{"state":"needs_review","value":"Призупинити машину"}},"vi":{"stringUnit":{"state":"needs_review","value":"Tạm dừng máy"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"暂停机器"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"暫停機器"}}}}, "chatMenu.stopAndPauseMachine": {"comment":"Agent pane chat menu: stop the chat's running turn, then pause the Cloud machine it runs on","extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Stop and Pause Machine"}},"ar":{"stringUnit":{"state":"needs_review","value":"إيقاف الدور ثم إيقاف الجهاز مؤقتًا"}},"bs":{"stringUnit":{"state":"needs_review","value":"Zaustavi i pauziraj mašinu"}},"da":{"stringUnit":{"state":"needs_review","value":"Stop og sæt maskine på pause"}},"de":{"stringUnit":{"state":"needs_review","value":"Stoppen und Maschine pausieren"}},"es":{"stringUnit":{"state":"needs_review","value":"Detener y pausar máquina"}},"fr":{"stringUnit":{"state":"needs_review","value":"Arrêter et mettre la machine en pause"}},"it":{"stringUnit":{"state":"needs_review","value":"Interrompi e metti in pausa la macchina"}},"ja":{"stringUnit":{"state":"needs_review","value":"停止してマシンを一時停止"}},"km":{"stringUnit":{"state":"needs_review","value":"បញ្ឈប់ ហើយផ្អាកម៉ាស៊ីន"}},"ko":{"stringUnit":{"state":"needs_review","value":"중지하고 머신 일시 정지"}},"nb":{"stringUnit":{"state":"needs_review","value":"Stopp og sett maskinen på pause"}},"pl":{"stringUnit":{"state":"needs_review","value":"Zatrzymaj i wstrzymaj maszynę"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Parar e pausar máquina"}},"ru":{"stringUnit":{"state":"needs_review","value":"Остановить и приостановить машину"}},"th":{"stringUnit":{"state":"needs_review","value":"หยุดและหยุดเครื่องชั่วคราว"}},"tr":{"stringUnit":{"state":"needs_review","value":"Durdur ve makineyi duraklat"}},"uk":{"stringUnit":{"state":"needs_review","value":"Зупинити й призупинити машину"}},"vi":{"stringUnit":{"state":"needs_review","value":"Dừng và tạm dừng máy"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"停止并暂停机器"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"停止並暫停機器"}}}}, - "chatMenu.resumeMachine": {"comment":"Agent pane chat menu: resume the paused Cloud machine this chat runs on","extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Resume Machine"}},"ar":{"stringUnit":{"state":"needs_review","value":"استئناف الجهاز"}},"bs":{"stringUnit":{"state":"needs_review","value":"Nastavi mašinu"}},"da":{"stringUnit":{"state":"needs_review","value":"Genoptag maskine"}},"de":{"stringUnit":{"state":"needs_review","value":"Maschine fortsetzen"}},"es":{"stringUnit":{"state":"needs_review","value":"Reanudar máquina"}},"fr":{"stringUnit":{"state":"needs_review","value":"Reprendre la machine"}},"it":{"stringUnit":{"state":"needs_review","value":"Riprendi la macchina"}},"ja":{"stringUnit":{"state":"needs_review","value":"マシンを再開"}},"km":{"stringUnit":{"state":"needs_review","value":"បន្តម៉ាស៊ីន"}},"ko":{"stringUnit":{"state":"needs_review","value":"머신 재개"}},"nb":{"stringUnit":{"state":"needs_review","value":"Gjenoppta maskinen"}},"pl":{"stringUnit":{"state":"needs_review","value":"Wznów maszynę"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Retomar máquina"}},"ru":{"stringUnit":{"state":"needs_review","value":"Возобновить машину"}},"th":{"stringUnit":{"state":"needs_review","value":"ทำงานเครื่องต่อ"}},"tr":{"stringUnit":{"state":"needs_review","value":"Makineyi sürdür"}},"uk":{"stringUnit":{"state":"needs_review","value":"Відновити машину"}},"vi":{"stringUnit":{"state":"needs_review","value":"Tiếp tục máy"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"恢复机器"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"恢復機器"}}}} + "chatMenu.resumeMachine": {"comment":"Agent pane chat menu: resume the paused Cloud machine this chat runs on","extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Resume Machine"}},"ar":{"stringUnit":{"state":"needs_review","value":"استئناف الجهاز"}},"bs":{"stringUnit":{"state":"needs_review","value":"Nastavi mašinu"}},"da":{"stringUnit":{"state":"needs_review","value":"Genoptag maskine"}},"de":{"stringUnit":{"state":"needs_review","value":"Maschine fortsetzen"}},"es":{"stringUnit":{"state":"needs_review","value":"Reanudar máquina"}},"fr":{"stringUnit":{"state":"needs_review","value":"Reprendre la machine"}},"it":{"stringUnit":{"state":"needs_review","value":"Riprendi la macchina"}},"ja":{"stringUnit":{"state":"needs_review","value":"マシンを再開"}},"km":{"stringUnit":{"state":"needs_review","value":"បន្តម៉ាស៊ីន"}},"ko":{"stringUnit":{"state":"needs_review","value":"머신 재개"}},"nb":{"stringUnit":{"state":"needs_review","value":"Gjenoppta maskinen"}},"pl":{"stringUnit":{"state":"needs_review","value":"Wznów maszynę"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Retomar máquina"}},"ru":{"stringUnit":{"state":"needs_review","value":"Возобновить машину"}},"th":{"stringUnit":{"state":"needs_review","value":"ทำงานเครื่องต่อ"}},"tr":{"stringUnit":{"state":"needs_review","value":"Makineyi sürdür"}},"uk":{"stringUnit":{"state":"needs_review","value":"Відновити машину"}},"vi":{"stringUnit":{"state":"needs_review","value":"Tiếp tục máy"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"恢复机器"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"恢復機器"}}}}, + "chatMenu.revokeAccess": {"comment":"Agent pane chat menu: the submenu that lists what the chat was granted (folder trust, a chat-wide allowance); picking one revokes it","extractionState":"manual","localizations":{"en":{"stringUnit":{"state":"translated","value":"Revoke Granted Access"}},"ar":{"stringUnit":{"state":"needs_review","value":"إلغاء الأذونات الممنوحة"}},"bs":{"stringUnit":{"state":"needs_review","value":"Opozovi odobreni pristup"}},"da":{"stringUnit":{"state":"needs_review","value":"Træk tildelt adgang tilbage"}},"de":{"stringUnit":{"state":"needs_review","value":"Gewährten Zugriff widerrufen"}},"es":{"stringUnit":{"state":"needs_review","value":"Revocar acceso concedido"}},"fr":{"stringUnit":{"state":"needs_review","value":"Révoquer l’accès accordé"}},"it":{"stringUnit":{"state":"needs_review","value":"Revoca accesso concesso"}},"ja":{"stringUnit":{"state":"needs_review","value":"許可済みのアクセスを取り消す"}},"km":{"stringUnit":{"state":"needs_review","value":"ដកហូតការចូលប្រើដែលបានអនុញ្ញាត"}},"ko":{"stringUnit":{"state":"needs_review","value":"허용된 접근 취소"}},"nb":{"stringUnit":{"state":"needs_review","value":"Trekk tilbake gitt tilgang"}},"pl":{"stringUnit":{"state":"needs_review","value":"Cofnij przyznany dostęp"}},"pt-BR":{"stringUnit":{"state":"needs_review","value":"Revogar acesso concedido"}},"ru":{"stringUnit":{"state":"needs_review","value":"Отозвать предоставленный доступ"}},"th":{"stringUnit":{"state":"needs_review","value":"เพิกถอนสิทธิ์ที่อนุญาตแล้ว"}},"tr":{"stringUnit":{"state":"needs_review","value":"Verilen erişimi iptal et"}},"uk":{"stringUnit":{"state":"needs_review","value":"Відкликати наданий доступ"}},"vi":{"stringUnit":{"state":"needs_review","value":"Thu hồi quyền đã cấp"}},"zh-Hans":{"stringUnit":{"state":"needs_review","value":"撤销已授予的权限"}},"zh-Hant":{"stringUnit":{"state":"needs_review","value":"撤銷已授予的權限"}}}} }, "version": "1.0" } diff --git a/webviews/src/agent-session/acpmux/bottomStack.gallery.ts b/webviews/src/agent-session/acpmux/bottomStack.gallery.ts index 7c71f56e546d..1ed7c65b1133 100644 --- a/webviews/src/agent-session/acpmux/bottomStack.gallery.ts +++ b/webviews/src/agent-session/acpmux/bottomStack.gallery.ts @@ -163,7 +163,8 @@ const trustThenPermission: Play = async (ctx) => { ctx.find({ role: "button", name: allowAlways }); ctx.find({ role: "button", name: allowOnce }); geometry(ctx); - // The granted trust is revoked in Session Info's Environment, never from the composer's mode menu + // The granted trust is revoked from the chat menu's Revoke Granted Access (or Session Info's + // Environment), never from the composer's mode menu // (Leo, 2026-10-29): these chats offer no modes, so the composer draws no Access menu for it. if (ctx.document.querySelector(".acpmux-access-trigger, .acpmux-access-grant")) throw new Error("The composer shows a mode menu for granted access"); diff --git a/webviews/src/agent-session/acpmux/header/ChatHeaderTools.gallery.tsx b/webviews/src/agent-session/acpmux/header/ChatHeaderTools.gallery.tsx index bf223ef98800..2b144f297e4a 100644 --- a/webviews/src/agent-session/acpmux/header/ChatHeaderTools.gallery.tsx +++ b/webviews/src/agent-session/acpmux/header/ChatHeaderTools.gallery.tsx @@ -4,6 +4,7 @@ import type { ReactNode } from "react"; import { componentEntry } from "../../../gallery/format"; import type { Play, PlayContext } from "../../../gallery/play"; import { avatarRows } from "./avatarRow"; +import { revokeAccessRows } from "./grantsMenu"; import { cloudMachineRows } from "../cloudMachineMenu"; import { translate } from "../i18n"; import type { ChatMenuItem } from "./ChatHeaderTools"; @@ -313,6 +314,15 @@ const keyboardMenu: Play = async (ctx) => { }); }; +// The chat's grants, revocable with default settings: the chat menu's Revoke Granted Access lists +// each one (header/grantsMenu.ts), now that the composer's mode menu lists the modes alone. +const revokeAccessOpen: Play = async (ctx) => { + await openMenu(ctx); + await ctx.focus({ role: "menuitem", name: "Revoke Granted Access" }); + await ctx.press("ArrowRight"); + await ctx.waitFor(() => ctx.document.querySelectorAll('[role="menu"]').length === 2); +}; + const keyboardSubmenu: Play = async (ctx) => { await openMenu(ctx); await ctx.focus({ role: "menuitem", name: "Hand off to…" }); @@ -596,6 +606,23 @@ export default componentEntry({ }, play: openMenu, }, + "menu-revoke-access": { + height: 860, + note: "A chat whose folder is trusted and that allows a command for the chat: Revoke Granted Access ends the tools rows and lists each grant; a pick revokes it. Grants live here, in every chat with default settings, not in the composer's mode menu (Leo, 2026-10-29).", + props: { + ...base, + menu: () => { + const rows = menuRows(); + const archive = rows.findIndex((row) => row !== "separator" && row.key === "archive"); + const revoke = revokeAccessRows([ + { id: "folder-trust", label: "Trusted atlas", onRemove: noop }, + { id: "chat-permission", label: "Allow for this chat", onRemove: noop }, + ]); + return [...rows.slice(0, archive), ...revoke, "separator", ...rows.slice(archive)]; + }, + }, + play: revokeAccessOpen, + }, "menu-cloud-machine-running": { height: 860, note: "A chat on a running Cloud machine (Labs > Preview features): Pause Machine sits before the tools rows (cloudMachineMenu.ts).", diff --git a/webviews/src/agent-session/acpmux/header/grantsMenu.ts b/webviews/src/agent-session/acpmux/header/grantsMenu.ts new file mode 100644 index 000000000000..30bd0a621a73 --- /dev/null +++ b/webviews/src/agent-session/acpmux/header/grantsMenu.ts @@ -0,0 +1,61 @@ +// What the chat was granted (the folder's trust, a chat-wide allowance), and the chat menu's +// Revoke Granted Access row that takes each back. The composer's mode menu lists the modes alone +// (Leo, 2026-10-29: "What is this bottom fucking bullshit?"), so a grant needs a home that is +// always there: the chat menu (…) is in every chat with default settings, where Session Info's +// Environment (inspector/EnvironmentSection.tsx) shows only with Debug Settings `agent.inspector` +// on. Once trust is decided the trust bar is gone, so without this row a trusted folder had no +// visible way back with default settings. +import { type Translate, translate } from "../i18n"; +import type { AccessGrant } from "../inspector/EnvironmentSection"; +import type { ChatMenuItem } from "./ChatHeaderTools"; + +export type GrantSources = { + /// The chat's folder is trusted (decided, not asked): `useFolderTrustAsk().trusted`. + trusted: boolean; + /// Where the trust lives, as the grant names it ("Trusted cmux"); the private folder's name when absent. + trustLabel?: string; + /// Forgets the trust (`useFolderTrustAsk().undo`). + untrust: () => void; + /// The chat holds a chat-wide allowance (`permissionGroups.chatAllowance`). + chatAllowance: boolean; + /// The allowance comes from the chat's last read and its refresh has not landed: not yet removable. + allowanceUnread: boolean; + /// Revokes the allowance (`chat.permission_chat.revoke`). + revokeAllowance: () => void; +}; + +/// The chat's grants, each with how to take it back: Session Info's Environment rows and the chat +/// menu's Revoke Granted Access submenu read the same list. +export function chatAccessGrants(sources: GrantSources, t: Translate = translate): AccessGrant[] { + return [ + ...(sources.trusted + ? [{ id: "folder-trust", label: sources.trustLabel ?? t("trust.trustedPrivate"), onRemove: sources.untrust }] + : []), + ...(sources.chatAllowance + ? [ + { + id: "chat-permission", + label: t("permission.allowChat"), + onRemove: () => (sources.allowanceUnread ? undefined : sources.revokeAllowance()), + }, + ] + : []), + ]; +} + +/// The chat menu's Revoke Granted Access: a submenu naming each grant, whose pick revokes it (the +/// second, deliberate click is the confirmation). No row when nothing is granted. +export function revokeAccessRows( + grants: readonly AccessGrant[], + t: Translate = translate, +): Exclude[] { + if (grants.length === 0) return []; + return [ + { + key: "revokeAccess", + label: t("chatMenu.revokeAccess"), + icon: "security.lock", + children: grants.map((grant) => ({ key: grant.id, label: grant.label, onSelect: grant.onRemove })), + }, + ]; +} diff --git a/webviews/src/agent-session/acpmux/inspector/EnvironmentSave.gallery.tsx b/webviews/src/agent-session/acpmux/inspector/EnvironmentSave.gallery.tsx index db98aab32f27..aef4f57d85f4 100644 --- a/webviews/src/agent-session/acpmux/inspector/EnvironmentSave.gallery.tsx +++ b/webviews/src/agent-session/acpmux/inspector/EnvironmentSave.gallery.tsx @@ -54,5 +54,19 @@ export default componentEntry({ await ctx.waitFor(() => ctx.document.querySelectorAll("li[data-grant]").length === 2); }, }, + "granted-hover": { + note: "Pointing at a grant shows its own Revoke, at once and on that row alone; the other grant's Revoke stays out of sight (still reachable with Tab).", + props: { failFirst: false, granted: true }, + play: async (ctx) => { + await ctx.waitFor(() => ctx.document.querySelectorAll("li[data-grant]").length === 2); + await ctx.hover({ selector: 'li[data-grant="folder-trust"]' }); + await ctx.waitFor(() => { + const shown = (id: string) => + ctx.document.defaultView!.getComputedStyle(ctx.document.querySelector(`li[data-grant="${id}"] > button`)!) + .opacity; + return shown("folder-trust") === "1" && shown("chat-permission") === "0"; + }); + }, + }, }, }); diff --git a/webviews/src/agent-session/acpmux/inspector/EnvironmentSection.tsx b/webviews/src/agent-session/acpmux/inspector/EnvironmentSection.tsx index 2762409269bf..131b1d4ad742 100644 --- a/webviews/src/agent-session/acpmux/inspector/EnvironmentSection.tsx +++ b/webviews/src/agent-session/acpmux/inspector/EnvironmentSection.tsx @@ -3,8 +3,9 @@ // never "This computer", with Save; then the chat's project (chatFolders.ts), named by its // repository, whose full path only a hover shows; the GitHub repository; the branch. Then Remote // Control, when the App offers it. Last, what the chat was granted (the folder's trust, a chat-wide -// allowance), each with Revoke: their one home, since the composer's mode menu lists the modes -// alone (Leo, 2026-10-29). A chat in a temporary or internal folder (a harness's scratchpad) +// allowance), each with Revoke on its own row's hover or focus. The chat menu's Revoke Granted +// Access (header/grantsMenu.ts) lists the same grants in every chat; the composer's mode menu lists +// the modes alone (Leo, 2026-10-29). A chat in a temporary or internal folder (a harness's scratchpad) // has no project row and no Save: only its machine. Every row does something: the project opens in // the Files tree beside the chat, the repository and the branch are links to GitHub, which the pane // opens in the browser as it opens a reply's link. @@ -244,7 +245,7 @@ export function EnvironmentSection({ )} {grants.map((grant) => ( -
  • +
  • {grant.label}