Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(settings): simplify and reposition computer use

vastsa983f8402606f
diff --git a/apps/desktop/src/features/settings/SettingsPage.tsx b/apps/desktop/src/features/settings/SettingsPage.tsx
index 7e9e2c22f..860ad3fd8 100644
--- a/apps/desktop/src/features/settings/SettingsPage.tsx
+++ b/apps/desktop/src/features/settings/SettingsPage.tsx
@@ -532,7 +532,6 @@ export function SettingsPage() {
{tab === "ai" && settings && (
<div className="settings-stack">
- <ComputerUseSettings t={t} settings={settings} saveSettings={saveSettings} />
<SettingsCard title={t("settings.permissions")}>
<SettingsRow
title={t("settings.permissionMode")}
@@ -633,6 +632,7 @@ export function SettingsPage() {
/>
</SettingsCard>
+ <ComputerUseSettings t={t} settings={settings} saveSettings={saveSettings} />
</div>
)}
diff --git a/apps/desktop/src/features/settings/computer-use/ComputerUseSettings.tsx b/apps/desktop/src/features/settings/computer-use/ComputerUseSettings.tsx
index 1706d09d4..73fa2c892 100644
--- a/apps/desktop/src/features/settings/computer-use/ComputerUseSettings.tsx
+++ b/apps/desktop/src/features/settings/computer-use/ComputerUseSettings.tsx
@@ -19,9 +19,8 @@ import { useComputerPermission } from "../../computer-use/use-computer-permissio
*
* The three things only the user can decide live here: whether the capability
* exists at all, which model may drive it, and whether a run may take pixels.
- * The switch is the consent — the agent mints its own desktop-scope grant once
- * it is on — so the row says what that means rather than implying a later
- * per-window decision that no longer exists.
+ * The switch is the consent: the agent mints its own desktop-scope grant once
+ * it is on. The compact card keeps controls and actionable status only.
*
* There is no input-approval row: `confirm-each` has no approval card behind it
* yet, and a control that narrows nothing would misrepresent the capability.
@@ -75,16 +74,14 @@ export function ComputerUseSettings({
void saveSettings({ computerUse: { ...value, ...next } });
return (
- <SettingsCard title={t("computerUse.title")} description={t("computerUse.description")}>
- <SettingsRow title={t("computerUse.enable")} description={t("computerUse.enableDesc")}>
+ <SettingsCard title={t("computerUse.title")}>
+ <SettingsRow title={t("computerUse.enable")}>
<SettingsToggle
label={t("computerUse.enable")}
checked={value.enabled}
onChange={() => patch({ enabled: !value.enabled })}
/>
</SettingsRow>
- {/* The scope is no longer a choice, so it has to be a statement. */}
- <p className="settings-hint">{t("computerUse.scopeNote")}</p>
{/* Readable before enabling: a platform without a backend should say so
rather than let the user turn on a feature that cannot act. */}
@@ -132,7 +129,7 @@ export function ComputerUseSettings({
{value.enabled && (
<>
- <SettingsRow title={t("computerUse.model")} description={t("computerUse.modelDesc")}>
+ <SettingsRow title={t("computerUse.model")}>
<SettingsMenuSelect
label={t("computerUse.model")}
value={selectedModel}
@@ -149,7 +146,7 @@ export function ComputerUseSettings({
</SettingsRow>
{!value.model && <div className="settings-hint">{t("computerUse.modelMissing")}</div>}
- <SettingsRow title={t("computerUse.capture")} description={t("computerUse.captureDesc")}>
+ <SettingsRow title={t("computerUse.capture")}>
<SettingsMenuSelect
label={t("computerUse.capture")}
value={value.defaultCapture ?? COMPUTER_USE_DEFAULTS.capture}
diff --git a/apps/desktop/test/computer-use-settings-surface.test.mjs b/apps/desktop/test/computer-use-settings-surface.test.mjs
new file mode 100644
index 000000000..cc947727f
--- /dev/null
+++ b/apps/desktop/test/computer-use-settings-surface.test.mjs
@@ -0,0 +1,43 @@
+import assert from "node:assert/strict";
+import { readFile } from "node:fs/promises";
+import test from "node:test";
+import { fileURLToPath } from "node:url";
+import { createServer } from "vite";
+
+test("AI settings place computer use after permissions and defaults", async () => {
+ const source = await readFile(new URL("../src/features/settings/SettingsPage.tsx", import.meta.url), "utf8");
+ const ai = source.slice(source.indexOf('{tab === "ai"'), source.indexOf('{tab === "voice"'));
+ assert.ok(ai.indexOf('t("settings.permissions")') < ai.indexOf('t("settings.defaultsTitle")'));
+ assert.ok(ai.indexOf('t("settings.defaultsTitle")') < ai.indexOf("<ComputerUseSettings"));
+ assert.match(ai, /<ComputerUseSettings[^>]+\/>\s*<\/div>/);
+});
+
+test("computer use keeps controls and required status without explanatory copy", async (t) => {
+ const server = await createServer({
+ root: fileURLToPath(new URL("..", import.meta.url)), configFile: false,
+ server: { middlewareMode: true, hmr: false, ws: false }, appType: "custom",
+ optimizeDeps: { noDiscovery: true, include: [] },
+ });
+ t.after(() => server.close());
+ const React = await import("react");
+ const { renderToStaticMarkup } = await import("react-dom/server");
+ const { ComputerUseSettings } = await server.ssrLoadModule(
+ "/src/features/settings/computer-use/ComputerUseSettings.tsx",
+ );
+ for (const enabled of [false, true]) {
+ const html = renderToStaticMarkup(React.createElement(ComputerUseSettings, {
+ t: (key) => key, settings: { computerUse: { enabled } },
+ saveSettings: async () => { throw new Error("Rendering must not save settings"); },
+ }));
+ for (const key of ["title", "enable", "platform", "platformUnknown"]) {
+ assert.ok(html.includes(`computerUse.${key}`), `missing ${key}`);
+ }
+ for (const key of ["description", "enableDesc", "scopeNote", "modelDesc", "captureDesc"]) {
+ assert.ok(!html.includes(`computerUse.${key}`), `explanatory copy remains: ${key}`);
+ }
+ assert.equal(html.includes("computerUse.modelMissing"), enabled);
+ assert.equal(html.includes("computerUse.captureA11yOnly"), enabled);
+ assert.match(html, /role="switch"/);
+ assert.equal(html.includes('aria-checked="true"'), enabled);
+ }
+});
diff --git a/docs/spec/03-runtime/computer-use.md b/docs/spec/03-runtime/computer-use.md
index 31e70171e..f1230fb55 100644
--- a/docs/spec/03-runtime/computer-use.md
+++ b/docs/spec/03-runtime/computer-use.md
@@ -281,12 +281,14 @@ never a no-op reported as success.
- Computer Use is off by default. Enabling it does not itself request an OS
permission, capture a frame, or enumerate a window — but it does authorise the
- agent to start a desktop-wide grant on its next `Computer` call, so the row
- says that instead of describing a later handover.
-- Settings states the scope rather than offering it: one window at a time, the
- agent may switch, PI-Desktop's own windows and credential surfaces are never
- reachable, and Stop ends the run. There is no input-approval row while
- `confirm-each` has no card behind it.
+ agent to start a desktop-wide grant on its next `Computer` call.
+- The card is last in Settings → AI, after Permissions and Defaults. It shows
+ controls and actionable status without card/row descriptions or a static
+ scope note. Permission diagnostics and the missing-model hint remain visible.
+ The scope is not selectable: one window at a time, the agent may switch,
+ PI-Desktop's own windows and credential surfaces are never reachable, and
+ Stop ends the run. There is no input-approval row while `confirm-each` has
+ no card behind it.
- The model binding is explicit. Settings offers the provider rows the user
already configured; an enabled feature with no binding is a visible
unconfigured state, not a silent fallback to the conversation model.
diff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.md
index 6d666241b..bdee9fc5c 100644
--- a/docs/spec/04-ux/06-settings-ia.md
+++ b/docs/spec/04-ux/06-settings-ia.md
@@ -293,6 +293,9 @@ Settings is a **full-window page** that replaces the app sidebar + main chrome (
Password changes are key rewrapping, not revocation of unlocked devices.
### 全局 AI (`ai` tab)
+- Card order is **Permissions → Defaults → Computer use**. Computer use omits
+ card/row explanatory copy and the static scope note; controls, platform and
+ permission status, errors, and the missing-model hint remain unchanged.
- **Permissions** card: the global permission-mode control
(ask / accept-edits / auto) that governs how autonomously the agent acts.
The control is a menu select on the shared anchored-menu surface rather than
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 6e6842d74..7a0131836 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -19736,6 +19736,13 @@ permission-request UI below has isolated fixture automation.
### E2E-COMPUTER-USE-request-accessibility-from-settings
+- **Layout regression**: Open Settings → AI. Computer use is the final card,
+ after Permissions and Defaults, without card/row explanations or a static
+ scope note. Its switch, platform/permission status, enabled model/capture
+ controls, missing-model hint, and permission error/retry path remain present.
+ `apps/desktop/test/computer-use-settings-surface.test.mjs` covers order and
+ compact rendering with the feature both disabled and enabled.
+
- **Preconditions**: Isolated Electron fixture profile; OS calls mocked at IPC
and Electron boundaries; computer use disabled; no provider or real OS prompt.
- **Steps**: Open Settings with missing Accessibility; focus and click its status