Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(chat): show ACP effort beside model

Louis Beaumontbb3063535fcd
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/acp-config-selector.test.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/acp-config-selector.test.tsx
index 0b614a9cf..8421d9a33 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/acp-config-selector.test.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/acp-config-selector.test.tsx
@@ -11,12 +11,26 @@
import React from "react";
import { afterEach, describe, expect, it, vi } from "vitest";
-import { cleanup, fireEvent, render, screen } from "@testing-library/react";
-import { AcpConfigSelector } from "./acp-config-selector";
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from "@testing-library/react";
+import { AcpConfigSelector, AcpEffortSelector } from "./acp-config-selector";
import { useAcpSessionConfig } from "@/lib/stores/acp-session-config";
import type { AIPreset } from "@/lib/utils/tauri";
-vi.mock("@/lib/utils/tauri", () => ({ commands: {} }));
+const mocks = vi.hoisted(() => ({
+ setConfigOption: vi.fn(),
+}));
+
+vi.mock("@/lib/utils/tauri", () => ({
+ commands: {
+ piAcpSetConfigOption: mocks.setConfigOption,
+ },
+}));
const SESSION = "chat-1";
@@ -44,6 +58,7 @@ function presetWith(config: Record<string, string>): AIPreset {
afterEach(() => {
cleanup();
+ mocks.setConfigOption.mockReset();
useAcpSessionConfig.setState({ sessions: {}, byAgent: {} });
});
@@ -156,6 +171,102 @@ describe("ACP config trigger", () => {
expect(screen.queryByLabelText("Mode")).not.toBeInTheDocument();
});
+ it("can move effort into its dedicated composer control", () => {
+ seedSession([
+ modelOption("sonnet"),
+ {
+ id: "effort",
+ name: "Effort",
+ type: "select",
+ currentValue: "high",
+ values: [
+ { value: "low", name: "Low" },
+ { value: "medium", name: "Medium" },
+ { value: "high", name: "High" },
+ ],
+ },
+ ]);
+
+ render(
+ <AcpConfigSelector
+ sessionId={SESSION}
+ agentId="claude-acp"
+ hideEffortControl
+ />,
+ );
+
+ fireEvent.click(screen.getByTestId("acp-config-trigger"));
+ expect(screen.getByLabelText("Model")).toBeInTheDocument();
+ expect(screen.queryByTestId("acp-effort-slider")).not.toBeInTheDocument();
+ expect(screen.queryByLabelText("Effort")).not.toBeInTheDocument();
+ });
+
+ it("surfaces and persists an adapter's live effort choice", async () => {
+ seedSession([
+ {
+ id: "reasoning_effort",
+ name: "Reasoning effort",
+ type: "select",
+ currentValue: "low",
+ values: [
+ { value: "low", name: "Low" },
+ { value: "medium", name: "Medium" },
+ { value: "high", name: "High" },
+ ],
+ },
+ ]);
+ mocks.setConfigOption.mockResolvedValue({ status: "ok", data: null });
+ const onPersistDefault = vi.fn();
+
+ render(
+ <AcpEffortSelector
+ sessionId={SESSION}
+ agentId="codex-acp"
+ onPersistDefault={onPersistDefault}
+ />,
+ );
+
+ fireEvent.click(screen.getByTestId("acp-effort-trigger"));
+ fireEvent.click(document.querySelector('[data-effort-step="high"]') as HTMLElement);
+
+ expect(onPersistDefault).toHaveBeenCalledWith({
+ optionId: "reasoning_effort",
+ value: "high",
+ });
+ await waitFor(() =>
+ expect(mocks.setConfigOption).toHaveBeenCalledWith(
+ SESSION,
+ "reasoning_effort",
+ "high",
+ null,
+ ),
+ );
+ });
+
+ it("keeps a two-value effort axis visible as a select", () => {
+ seedSession([
+ {
+ id: "effort",
+ name: "Effort",
+ type: "select",
+ currentValue: "standard",
+ values: [
+ { value: "standard", name: "Standard" },
+ { value: "deep", name: "Deep" },
+ ],
+ },
+ ]);
+
+ render(<AcpEffortSelector sessionId={SESSION} agentId="custom" />);
+
+ expect(screen.getByTestId("acp-effort-trigger")).toHaveTextContent(
+ "Effort: Standard",
+ );
+ fireEvent.click(screen.getByTestId("acp-effort-trigger"));
+ expect(screen.getByLabelText("Effort").tagName).toBe("SELECT");
+ expect(screen.queryByTestId("acp-effort-slider")).not.toBeInTheDocument();
+ });
+
it("keeps a non-permission mode such as Pi thinking in general config", () => {
seedSession([
modelOption("sonnet"),
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/acp-config-selector.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/acp-config-selector.tsx
index b13d89f21..4528de6f1 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/acp-config-selector.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/acp-config-selector.tsx
@@ -13,6 +13,7 @@ import {
} from "@/components/chat/standalone/composer-settings-popover";
import {
ComposerEffortSlider,
+ isEffortAxis,
isEffortOption,
} from "@/components/chat/standalone/composer-effort-slider";
import { commands, type AIPreset } from "@/lib/utils/tauri";
@@ -59,11 +60,11 @@ function pickModelOption(selects: AcpConfigOption[]): AcpConfigOption | null {
);
}
-/** One collapsed "config" control for everything the ACP adapter advertised for
- * the active session — its modes (e.g. permission modes), select options
- * (model, reasoning, ...) and boolean toggles — stacked inside a single
- * popover instead of sprawling across the composer. Renders nothing for raw
- * Pi sessions or adapters that advertised neither. Native selects on purpose:
+/** One general config control for what the ACP adapter advertised for the
+ * active session. Composer clients can promote high-signal axes such as
+ * permissions and effort into dedicated controls, leaving models, secondary
+ * selects, toggles, and re-authentication here. Renders nothing for raw Pi
+ * sessions or adapters that advertised neither. Native selects on purpose:
* the OS renders their menu above the webview (Radix menus get painted over on
* Windows). */
export function AcpConfigSelector({
@@ -73,6 +74,7 @@ export function AcpConfigSelector({
onPersistDefault,
onReauthenticate,
hideModeControl = false,
+ hideEffortControl = false,
}: {
sessionId: string | null | undefined;
/** The preset's ACP adapter id, used to fall back to the session-agnostic
@@ -90,8 +92,11 @@ export function AcpConfigSelector({
onReauthenticate?: () => void;
/** A client can promote an agent's permission/mode axis into a dedicated
* composer control. Hide that duplicated select from this general config
- * popover while leaving model, effort, toggles, and re-authentication here. */
+ * popover. */
hideModeControl?: boolean;
+ /** The composer promotes effort into its own visible control beside model.
+ * Hide the duplicate from this general configuration popover. */
+ hideEffortControl?: boolean;
}) {
const live = useAcpSessionConfig((state) =>
sessionId ? state.sessions[sessionId] : undefined,
@@ -119,9 +124,12 @@ export function AcpConfigSelector({
const modeOption = hideModeControl
? findAcpPermissionModeOption(config)
: findAcpModeOption(config);
- const selects = hideModeControl
+ const modeFilteredSelects = hideModeControl
? allSelects.filter((option) => option.id !== modeOption?.id)
: allSelects;
+ const selects = hideEffortControl
+ ? modeFilteredSelects.filter((option) => !isEffortAxis(option))
+ : modeFilteredSelects;
// Boolean options (e.g. Codex "fast mode") advertise no value list; render
// them as toggles rather than dropping them.
const toggles = (config?.options ?? []).filter((option) => option.type === "boolean");
@@ -314,3 +322,104 @@ export function AcpConfigSelector({
</ComposerSettingsPopover>
);
}
+
+/** The ACP adapter's effort axis as a first-class composer control. Model,
+ * permissions and effort are separate decisions in Claude Code, Codex, Pi,
+ * and compatible agents; hiding effort inside the model popover made ACP look
+ * less capable than raw Pi even though the adapter advertised it. Values stay
+ * adapter-owned and session-scoped—there is no hardcoded provider matrix. */
+export function AcpEffortSelector({
+ sessionId,
+ agentId,
+ activePreset,
+ onPersistDefault,
+}: {
+ sessionId: string | null | undefined;
+ agentId?: string | null;
+ activePreset?: AIPreset | null;
+ onPersistDefault?: (change: AcpConfigDefaultChange) => void;
+}) {
+ const live = useAcpSessionConfig((state) =>
+ sessionId ? state.sessions[sessionId] : undefined,
+ );
+ const cached = useAcpSessionConfig((state) =>
+ agentId ? state.byAgent[agentId] : undefined,
+ );
+ const liveHasChoices =
+ !!live && ((live.options?.length ?? 0) > 0 || !!live.modes);
+ const config = liveHasChoices ? live : (cached ?? live);
+ const option = (config?.options ?? []).find(
+ (candidate) =>
+ candidate.type === "select" &&
+ candidate.values.length > 0 &&
+ isEffortAxis(candidate),
+ );
+ const [open, setOpen] = useState(false);
+ const [pending, setPending] = useState(false);
+
+ if (!sessionId || !option) return null;
+
+ const presetConfig = activePreset?.acpAgent?.config ?? {};
+ const selectedValue = liveHasChoices
+ ? String(option.currentValue ?? "")
+ : (presetConfig[option.id] ?? String(option.currentValue ?? ""));
+ const selectedLabel =
+ option.values.find((value) => value.value === selectedValue)?.name ||
+ selectedValue ||
+ option.name;
+
+ const apply = (value: string) => {
+ onPersistDefault?.({ optionId: option.id, value });
+ setPending(true);
+ void commands
+ .piAcpSetConfigOption(sessionId, option.id, value, null)
+ .then((result) => {
+ if (
+ result.status === "error" &&
+ result.error &&
+ !isAgentNotRunning(result.error)
+ ) {
+ throw new Error(result.error);
+ }
+ })
+ .catch((error) => {
+ toast.error(`could not change ${option.name.toLowerCase()}`, {
+ description: String(error),
+ });
+ })
+ .finally(() => setPending(false));
+ };
+
+ return (
+ <ComposerSettingsPopover
+ label={`${option.name}: ${selectedLabel}`}
+ title={`${option.name}: ${selectedLabel}`}
+ ariaLabel={`${option.name}: ${selectedLabel}`}
+ triggerTestId="acp-effort-trigger"
+ contentTestId="acp-effort-popover"
+ open={open}
+ onOpenChange={setOpen}
+ disabled={pending}
+ >
+ {isEffortOption(option) ? (
+ <ComposerEffortSlider
+ label={option.name}
+ testId="acp-effort-slider"
+ value={selectedValue}
+ disabled={pending}
+ steps={option.values}
+ onValueChange={apply}
+ />
+ ) : (
+ <ComposerSettingsSelect
+ label={option.name}
+ value={selectedValue}
+ disabled={pending}
+ title={option.description || option.name}
+ options={option.values}
+ onValueChange={apply}
+ />
+ )}
+ </ComposerSettingsPopover>
+ );
+}
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/composer-controls-row.test.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/composer-controls-row.test.tsx
index 127825acf..a3567e3d1 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/composer-controls-row.test.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/composer-controls-row.test.tsx
@@ -34,6 +34,9 @@ vi.mock("@/components/chat/standalone/composer-utility-menu", () => ({
}));
vi.mock("@/components/chat/standalone/acp-config-selector", () => ({
AcpConfigSelector: () => null,
+ AcpEffortSelector: ({ agentId }: { agentId: string }) => (
+ <div data-testid="mock-acp-effort">{agentId}</div>
+ ),
}));
vi.mock("@/components/chat/standalone/acp-permission-selector", () => ({
AcpPermissionSelector: ({ agentId }: { agentId: string }) => (
@@ -139,6 +142,9 @@ describe("ComposerControlsRow preset selection", () => {
expect(screen.getByTestId("mock-acp-permission")).toHaveTextContent(
"codex-acp",
);
+ expect(screen.getByTestId("mock-acp-effort")).toHaveTextContent(
+ "codex-acp",
+ );
rerender(
<ComposerControlsRow
@@ -161,6 +167,9 @@ describe("ComposerControlsRow preset selection", () => {
expect(screen.getByTestId("mock-acp-permission")).toHaveTextContent(
"claude-acp",
);
+ expect(screen.getByTestId("mock-acp-effort")).toHaveTextContent(
+ "claude-acp",
+ );
rerender(
<ComposerControlsRow
@@ -180,5 +189,6 @@ describe("ComposerControlsRow preset selection", () => {
);
expect(screen.queryByTestId("mock-acp-permission")).not.toBeInTheDocument();
+ expect(screen.queryByTestId("mock-acp-effort")).not.toBeInTheDocument();
});
});
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/composer-controls-row.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/composer-controls-row.tsx
index ba2fbae06..f9a5db17f 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/composer-controls-row.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/composer-controls-row.tsx
@@ -11,7 +11,10 @@ import {
PopoverTrigger,
} from "@/components/ui/popover";
import { AIPresetsSelector } from "@/components/rewind/ai-presets-selector";
-import { AcpConfigSelector } from "@/components/chat/standalone/acp-config-selector";
+import {
+ AcpConfigSelector,
+ AcpEffortSelector,
+} from "@/components/chat/standalone/acp-config-selector";
import { AcpPermissionSelector } from "@/components/chat/standalone/acp-permission-selector";
import { ThinkingLevelSelector } from "@/components/thinking-level-selector";
import { ComposerUtilityMenu } from "@/components/chat/standalone/composer-utility-menu";
@@ -152,10 +155,10 @@ export function ComposerControlsRow({
}
}}
/>
- {/* ACP presets get the "config" popover; raw pi gets the thinking-level
- selector. Gated on the active preset (not on stale session config) so
- switching to a non-ACP preset hides the config control immediately
- instead of lingering until the old ACP session tears down. */}
+ {/* ACP presets get their advertised model/config plus a dedicated effort
+ control; raw pi gets its thinking-level control. Gated on the active
+ preset (not stale session config) so switching away from ACP hides its
+ controls immediately instead of waiting for session teardown. */}
{isAcp ? (
<AcpConfigSelector
sessionId={modelControls.currentQueueSessionId}
@@ -164,6 +167,7 @@ export function ComposerControlsRow({
onPersistDefault={modelControls.onAcpConfigDefault}
onReauthenticate={modelControls.onReauthenticate}
hideModeControl
+ hideEffortControl
/>
) : (
<ThinkingLevelSelector
@@ -171,6 +175,14 @@ export function ComposerControlsRow({
sessionId={modelControls.currentQueueSessionId}
/>
)}
+ {isAcp && (
+ <AcpEffortSelector
+ sessionId={modelControls.currentQueueSessionId}
+ agentId={acpAgentId}
+ activePreset={modelControls.activePreset}
+ onPersistDefault={modelControls.onAcpConfigDefault}
+ />
+ )}
<UsagePopover />
<Button
type={sendButton.isStopMode ? "button" : "submit"}
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/composer-effort-slider.test.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/composer-effort-slider.test.tsx
index c2a9c7c05..b75e9bc4b 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/composer-effort-slider.test.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/composer-effort-slider.test.tsx
@@ -13,7 +13,11 @@
import React from "react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
-import { ComposerEffortSlider, isEffortOption } from "./composer-effort-slider";
+import {
+ ComposerEffortSlider,
+ isEffortAxis,
+ isEffortOption,
+} from "./composer-effort-slider";
const STEPS = [
{ value: "low", name: "Low" },
@@ -145,6 +149,8 @@ describe("effort detection", () => {
});
it("claims the known effort axes", () => {
+ expect(isEffortAxis(opt("reasoning_effort", "Reasoning effort"))).toBe(true);
+ expect(isEffortAxis(opt("effort", "Effort", 2))).toBe(true);
expect(isEffortOption(opt("reasoning_effort", "Reasoning effort"))).toBe(true);
expect(isEffortOption(opt("effort", "Effort"))).toBe(true);
expect(isEffortOption(opt("thinking", "Thinking level"))).toBe(true);
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/composer-effort-slider.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/composer-effort-slider.tsx
index 04ca5b2ff..294537098 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/composer-effort-slider.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/composer-effort-slider.tsx
@@ -192,19 +192,19 @@ export function ComposerEffortSlider({
}
/**
- * Whether an advertised option is the effort axis rather than a plain list.
+ * Whether an advertised option names the effort axis rather than a plain list.
*
- * Deliberately narrow. Misreading an unordered option as a scale would put a
- * "faster to smarter" claim on something that has no such ordering, which is
- * worse than leaving it as a dropdown, so this matches the known names and
- * requires enough steps to be a scale at all.
+ * Detection is deliberately separate from slider eligibility. An ACP adapter
+ * may advertise only two effort values; that is still an effort control worth
+ * surfacing in the composer, but a two-stop dial would falsely imply a useful
+ * scale. Callers can render that edge case as a select instead.
*/
-export function isEffortOption(option: {
+export function isEffortAxis(option: {
id: string;
name: string;
values: readonly { value: string }[];
}): boolean {
- if (option.values.length < 3 || option.values.length > 6) return false;
+ if (option.values.length === 0) return false;
const haystack = `${option.id} ${option.name}`.toLowerCase();
return (
haystack.includes("effort") ||
@@ -212,3 +212,20 @@ export function isEffortOption(option: {
haystack.includes("thinking")
);
}
+
+/**
+ * Whether an advertised effort axis has enough ordered values for the dial.
+ *
+ * Deliberately narrow. Misreading an unordered option as a scale would put a
+ * "faster to smarter" claim on something that has no such ordering, which is
+ * worse than leaving it as a dropdown, so this matches the known names and
+ * requires enough steps to be a scale at all.
+ */
+export function isEffortOption(option: {
+ id: string;
+ name: string;
+ values: readonly { value: string }[];
+}): boolean {
+ if (option.values.length < 3 || option.values.length > 6) return false;
+ return isEffortAxis(option);
+}
diff --git a/apps/screenpipe-app-tauri/components/chat/standalone/composer-settings-popover.test.tsx b/apps/screenpipe-app-tauri/components/chat/standalone/composer-settings-popover.test.tsx
index eb9518509..8e5e5629b 100644
--- a/apps/screenpipe-app-tauri/components/chat/standalone/composer-settings-popover.test.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/standalone/composer-settings-popover.test.tsx
@@ -13,7 +13,7 @@
import React from "react";
import { afterEach, describe, expect, it, vi } from "vitest";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
-import { AcpConfigSelector } from "./acp-config-selector";
+import { AcpConfigSelector, AcpEffortSelector } from "./acp-config-selector";
import { ThinkingLevelSelector } from "@/components/thinking-level-selector";
import { useAcpSessionConfig } from "@/lib/stores/acp-session-config";
@@ -118,8 +118,11 @@ describe("composer settings control", () => {
} as never,
byAgent: {},
});
- render(<AcpConfigSelector sessionId={SESSION} agentId="codex-acp" />);
- fireEvent.click(screen.getByTestId("acp-config-trigger"));
+ render(<AcpEffortSelector sessionId={SESSION} agentId="codex-acp" />);
+ expect(screen.getByTestId("acp-effort-trigger")).toHaveTextContent(
+ "Reasoning effort: High",
+ );
+ fireEvent.click(screen.getByTestId("acp-effort-trigger"));
const acpSlider = screen.getByTestId("acp-effort-slider");
expect(acpSlider).toHaveAttribute("role", "slider");
expect(screen.getByTestId("acp-effort-slider-value")).toHaveTextContent("High");