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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(chat): simplify ACP model controls
Louis Beaumont7bcb6f5dfa3c
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.tsxindex 487fda191..91609956a 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@@ -18,7 +18,7 @@ import {screen,waitFor,} from "@testing-library/react";-import { AcpConfigSelector, AcpEffortSelector } from "./acp-config-selector";+import { AcpConfigSelector } from "./acp-config-selector";import { useAcpSessionConfig } from "@/lib/stores/acp-session-config";import type { AIPreset } from "@/lib/utils/tauri";@@ -94,7 +94,8 @@ describe("ACP config trigger", () => {render(<AcpConfigSelector sessionId={SESSION} agentId="claude-acp" />);const trigger = screen.getByTestId("acp-config-trigger");- expect(trigger).toHaveTextContent("Opus 5 (1M context)");+ expect(trigger).toHaveTextContent("Opus 5");+ expect(trigger).not.toHaveTextContent("1M context");expect(trigger).not.toHaveTextContent("Default (recommended)");expect(trigger).toHaveAttribute("title",@@ -105,6 +106,25 @@ describe("ACP config trigger", () => {expect(screen.getByText(/currently resolves to Opus 5/)).toBeInTheDocument();});+ it("trims a context suffix from a directly advertised model name", () => {+ seedSession([+ {+ id: "model",+ name: "Model",+ type: "select",+ currentValue: "opus",+ values: [{ value: "opus", name: "Opus 5 (1M context)" }],+ },+ ]);++ render(<AcpConfigSelector sessionId={SESSION} agentId="claude-acp" />);++ expect(screen.getByTestId("acp-config-trigger")).toHaveTextContent("Opus 5");+ expect(screen.getByTestId("acp-config-trigger")).not.toHaveTextContent(+ "context",+ );+ });+it("shows the saved preset default before a live session advertises", () => {// No live advertisement yet (fresh chat): the cached adapter config carries// the choices, and the user's saved preset default is the chosen value.@@ -243,7 +263,7 @@ describe("ACP config trigger", () => {expect(screen.queryByLabelText("Allow All")).not.toBeInTheDocument();});- it("can move effort into its dedicated composer control", () => {+ it("keeps model and effort in one popover", () => {seedSession([modelOption("sonnet"),{@@ -259,22 +279,20 @@ describe("ACP config trigger", () => {},]);- render(- <AcpConfigSelector- sessionId={SESSION}- agentId="claude-acp"- hideEffortControl- />,- );+ render(<AcpConfigSelector sessionId={SESSION} agentId="claude-acp" />);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();+ expect(screen.getByTestId("acp-effort-slider")).toBeInTheDocument();+ expect(screen.getByTestId("acp-config-popover")).toContainElement(+ screen.getByTestId("acp-effort-slider"),+ );+ expect(screen.queryByTestId("acp-effort-trigger")).not.toBeInTheDocument();});it("surfaces and persists an adapter's live effort choice", async () => {seedSession([+ modelOption("sonnet"),{id: "reasoning_effort",name: "Reasoning effort",@@ -291,14 +309,14 @@ describe("ACP config trigger", () => {const onPersistDefault = vi.fn();render(- <AcpEffortSelector+ <AcpConfigSelectorsessionId={SESSION}agentId="codex-acp"onPersistDefault={onPersistDefault}/>,);- fireEvent.click(screen.getByTestId("acp-effort-trigger"));+ fireEvent.click(screen.getByTestId("acp-config-trigger"));fireEvent.click(document.querySelector('[data-effort-step="high"]') as HTMLElement);expect(onPersistDefault).toHaveBeenCalledWith({@@ -317,6 +335,7 @@ describe("ACP config trigger", () => {it("keeps a two-value effort axis visible as a select", () => {seedSession([+ modelOption("sonnet"),{id: "effort",name: "Effort",@@ -329,16 +348,13 @@ describe("ACP config trigger", () => {},]);- render(<AcpEffortSelector sessionId={SESSION} agentId="custom" />);+ render(<AcpConfigSelector sessionId={SESSION} agentId="custom" />);- expect(screen.getByTestId("acp-effort-trigger")).toHaveTextContent(- "Effort: Standard",+ expect(screen.getByTestId("acp-config-trigger")).toHaveTextContent(+ "Sonnet 4.6",);- expect(screen.getByTestId("acp-effort-trigger")).toHaveClass("w-7");- expect(- screen.getByTestId("acp-effort-trigger").querySelector("svg"),- ).not.toBeNull();- fireEvent.click(screen.getByTestId("acp-effort-trigger"));+ expect(screen.queryByTestId("acp-effort-trigger")).not.toBeInTheDocument();+ fireEvent.click(screen.getByTestId("acp-config-trigger"));expect(screen.getByLabelText("Effort").tagName).toBe("SELECT");expect(screen.queryByTestId("acp-effort-slider")).not.toBeInTheDocument();});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.tsxindex b3930a20b..71d4b6ef7 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@@ -4,7 +4,7 @@"use client";import { useState } from "react";-import { Gauge, Loader2, SlidersHorizontal } from "lucide-react";+import { Loader2, SlidersHorizontal } from "lucide-react";import { toast } from "sonner";import { Switch } from "@/components/ui/switch";import {@@ -13,7 +13,6 @@ 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";@@ -89,6 +88,15 @@ function resolvedModelFromDescription(description: string): string | null {return balanced || null;}+/** Context size is useful inside model details, but it makes the always-visible+ * composer label noisy. Keep the concrete model name and trim only a trailing+ * adapter-advertised context annotation. */+function compactModelLabel(value: string): string {+ return value+ .replace(/\s*\(\s*\d+(?:\.\d+)?\s*[kmgt]?\s+context(?:\s+window)?\s*\)\s*$/i, "")+ .trim();+}+export function acpConfigValueLabel(option: AcpConfigOption,selectedValue: string,@@ -100,22 +108,20 @@ export function acpConfigValueLabel(/^(?:default|auto)(?:\s*\(recommended\))?$/i.test(advertisedName.trim(),);- if (!isGenericAlias) return advertisedName;+ if (!isGenericAlias) return compactModelLabel(advertisedName);const resolved = resolvedModelFromDescription(selected?.description ?? "");- return (- resolved ||- advertisedName.replace(/\s*\(recommended\)\s*$/i, "").trim()+ return compactModelLabel(+ resolved || advertisedName.replace(/\s*\(recommended\)\s*$/i, "").trim(),);}/** 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). */+ * active session. Model and effort stay together because both tune how the+ * selected model answers; permission remains a separate safety boundary.+ * 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({sessionId,agentId,@@ -123,7 +129,6 @@ 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@@ -143,9 +148,6 @@ export function AcpConfigSelector({* composer control. Hide that duplicated select or boolean toggle from* this general config 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,@@ -179,9 +181,7 @@ export function AcpConfigSelector({const modeFilteredSelects = hideModeControl? allSelects.filter((option) => option.id !== permissionModeOption?.id): allSelects;- const selects = hideEffortControl- ? modeFilteredSelects.filter((option) => !isEffortAxis(option))- : modeFilteredSelects;+ const selects = 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(@@ -400,106 +400,3 @@ 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"- triggerIcon={Gauge}- iconOnly- 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.tsxindex 064cabc9d..067020269 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@@ -33,9 +33,8 @@ vi.mock("@/components/chat/standalone/composer-utility-menu", () => ({ComposerUtilityMenu: () => null,}));vi.mock("@/components/chat/standalone/acp-config-selector", () => ({- AcpConfigSelector: () => null,- AcpEffortSelector: ({ agentId }: { agentId: string }) => (- <div data-testid="mock-acp-effort">{agentId}</div>+ AcpConfigSelector: ({ agentId }: { agentId: string }) => (+ <div data-testid="mock-acp-config">{agentId}</div>),}));vi.mock("@/components/chat/standalone/acp-permission-selector", () => ({@@ -115,7 +114,7 @@ describe("ComposerControlsRow preset selection", () => {expect(onPresetSaved).toHaveBeenCalledWith(newPreset);});- it("shares the permission control across ACP presets only", () => {+ it("shares permission and combined model controls across ACP presets only", () => {const commonProps = {canChat: true,filters: {@@ -156,7 +155,7 @@ describe("ComposerControlsRow preset selection", () => {expect(screen.getByTestId("mock-acp-permission")).toHaveTextContent("codex-acp",);- expect(screen.getByTestId("mock-acp-effort")).toHaveTextContent(+ expect(screen.getByTestId("mock-acp-config")).toHaveTextContent("codex-acp",);expect(screen.getByTestId("mock-usage-preset")).toHaveTextContent(@@ -184,7 +183,7 @@ describe("ComposerControlsRow preset selection", () => {expect(screen.getByTestId("mock-acp-permission")).toHaveTextContent("claude-acp",);- expect(screen.getByTestId("mock-acp-effort")).toHaveTextContent(+ expect(screen.getByTestId("mock-acp-config")).toHaveTextContent("claude-acp",);expect(screen.getByTestId("mock-usage-preset")).toHaveTextContent(@@ -209,7 +208,7 @@ describe("ComposerControlsRow preset selection", () => {);expect(screen.queryByTestId("mock-acp-permission")).not.toBeInTheDocument();- expect(screen.queryByTestId("mock-acp-effort")).not.toBeInTheDocument();+ expect(screen.queryByTestId("mock-acp-config")).not.toBeInTheDocument();expect(screen.getByTestId("mock-usage-preset")).toHaveTextContent("cloud|chat-1",);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.tsxindex e2c60e7ce..1f8be03db 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,10 +11,7 @@ import {PopoverTrigger,} from "@/components/ui/popover";import { AIPresetsSelector } from "@/components/rewind/ai-presets-selector";-import {- AcpConfigSelector,- AcpEffortSelector,-} from "@/components/chat/standalone/acp-config-selector";+import { AcpConfigSelector } 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";@@ -162,8 +159,8 @@ export function ComposerControlsRow({}}}/>- {/* ACP presets get their advertised model/config plus a dedicated effort- control; raw pi gets its thinking-level control. Gated on the active+ {/* ACP presets keep their advertised model and effort in one config+ popover; raw pi gets its thinking-level control. Gated on the activepreset (not stale session config) so switching away from ACP hides itscontrols immediately instead of waiting for session teardown. */}{isAcp ? (@@ -174,7 +171,6 @@ export function ComposerControlsRow({onPersistDefault={modelControls.onAcpConfigDefault}onReauthenticate={modelControls.onReauthenticate}hideModeControl- hideEffortControl/>) : (<ThinkingLevelSelector@@ -182,14 +178,6 @@ export function ComposerControlsRow({sessionId={modelControls.currentQueueSessionId}/>)}- {isAcp && (- <AcpEffortSelector- sessionId={modelControls.currentQueueSessionId}- agentId={acpAgentId}- activePreset={modelControls.activePreset}- onPersistDefault={modelControls.onAcpConfigDefault}- />- )}<UsagePopoveractivePreset={modelControls.activePreset}sessionId={modelControls.currentQueueSessionId}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.tsxindex e7b4053c6..6bd3aee89 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, AcpEffortSelector } from "./acp-config-selector";+import { AcpConfigSelector } from "./acp-config-selector";import { ThinkingLevelSelector } from "@/components/thinking-level-selector";import { useAcpSessionConfig } from "@/lib/stores/acp-session-config";@@ -81,13 +81,20 @@ describe("composer settings control", () => {expect(screen.getByTestId("thinking-level-trigger")).toHaveTextContent("Medium");});- it("gives effort the same dial on both providers", () => {+ it("keeps ACP effort with its model and gives both providers the same dial", () => {// The point of the shared control: an adapter's reasoning effort and Pi's// thinking level are the same decision, so they must not look like two.useAcpSessionConfig.setState({sessions: {[SESSION]: {options: [+ {+ id: "model",+ name: "Model",+ type: "select",+ currentValue: "sonnet",+ values: [{ value: "sonnet", name: "Sonnet 4.6" }],+ },{id: "reasoning_effort",name: "Reasoning effort",@@ -105,12 +112,12 @@ describe("composer settings control", () => {} as never,byAgent: {},});- render(<AcpEffortSelector sessionId={SESSION} agentId="codex-acp" />);- expect(screen.getByTestId("acp-effort-trigger")).toHaveTextContent(- "Reasoning effort: High",+ render(<AcpConfigSelector sessionId={SESSION} agentId="codex-acp" />);+ expect(screen.getByTestId("acp-config-trigger")).toHaveTextContent(+ "Sonnet 4.6",);- expect(screen.getByTestId("acp-effort-trigger")).toHaveClass("w-7");- fireEvent.click(screen.getByTestId("acp-effort-trigger"));+ expect(screen.queryByTestId("acp-effort-trigger")).not.toBeInTheDocument();+ fireEvent.click(screen.getByTestId("acp-config-trigger"));const acpSlider = screen.getByTestId("acp-effort-slider");expect(acpSlider).toHaveAttribute("role", "slider");expect(screen.getByTestId("acp-effort-slider-value")).toHaveTextContent("High");