feat(agents): simpler New Task page and composer controls

- New Task page: a narrower box with room for a few lines, a lighter heading, and the
  project, checkout and branch as one quiet line under the box. The agent shows as its
  icon (name and version in its tooltip); the probe line shows only when the agent fails.
- Composer: one + menu for referencing a file, attaching an image and MCP servers; the
  MCP popover opens from it or /mcp. The current-file chip turns IDE context on and off.
- Model and effort: the model button opens one searchable list of model names (pin on
  hover, context size above it); effort is its own picker beside the model.
- Session: the status line moves under the box as one line — branch and worktree on the
  left, changes, context use, time and terminal on the right; "Ready" is no longer shown.
This commit is contained in:
l0ng-ai
2026-11-16 20:28:47 +08:00
parent cbac930a6f
commit 0d432bf1a6
22 changed files with 525 additions and 1031 deletions
+9 -10
View File
@@ -219,8 +219,11 @@ function history(page: Page) {
function modelButton(page: Page) {
return page.getByRole("button", { name: "Model", exact: true }).filter({ visible: true });
}
function effortButton(page: Page) {
return page.getByRole("button", { name: "Reasoning", exact: true }).filter({ visible: true });
}
async function expectEffort(page: Page, name: string) {
await expect(modelButton(page)).toHaveAttribute("title", new RegExp(`Reasoning: ${name}(?: ·|$)`));
await expect(effortButton(page)).toHaveText(name);
}
async function selected(box: Locator) {
return box.evaluate((element) => {
@@ -255,7 +258,7 @@ async function selectDraft(page: Page) {
}
async function chooseModel(page: Page, name: string) {
await modelButton(page).click();
// A model row also holds its Configure button, whose label joins the option's name.
// A model row also holds its Pin button, whose label joins the option's name.
await page.getByRole("option", { name: new RegExp(`^${name}\\b`) }).click();
await page.keyboard.press("Escape");
await box(page).focus();
@@ -292,7 +295,7 @@ for (const placement of ["editor", "toolWindow"] as const) {
option: effortId,
value,
});
await expect(page.getByRole("dialog", { name: "Model & effort settings", exact: true })).toHaveCount(0);
await expect(page.getByRole("listbox", { name: "Reasoning", exact: true })).toHaveCount(0);
}
await expectNoSubmission(page);
await stream.click({ position: { x: 12, y: 20 } });
@@ -350,7 +353,7 @@ test("subagent conversation never changes its hidden parent's effort", async ({
await expectEffort(page, "Gentle");
});
test("Settings and model popup exclude the agent shortcut", async ({ workbench: page }) => {
test("Settings and effort popup exclude the agent shortcut", async ({ workbench: page }) => {
await seed(page, "editor");
await box(page).fill(draft);
await page.keyboard.press("Meta+,");
@@ -361,14 +364,10 @@ test("Settings and model popup exclude the agent shortcut", async ({ workbench:
await expect(search).toBeFocused();
await expect(search).toHaveValue("keymap");
await settings.getByRole("button", { name: "Cancel", exact: true }).click();
await modelButton(page).click();
const popup = page.getByRole("dialog", { name: "Model & effort settings", exact: true });
await effortButton(page).click();
const popup = page.getByRole("listbox", { name: "Reasoning", exact: true });
await expect(popup).toBeVisible();
await popup.getByRole("button", { name: "Configure model", exact: true }).click();
const gentle = popup.getByRole("radio", { name: "Gentle", exact: true });
await gentle.focus();
await page.keyboard.press("Alt+t");
await expect(gentle).toHaveAttribute("aria-checked", "true");
expect(await ipcCalls(page, "agent_set_config")).toEqual([]);
await page.keyboard.press("Escape");
await expectEffort(page, "Gentle");
+9 -3
View File
@@ -1,3 +1,4 @@
import type { Page } from "@playwright/test";
import { expect, test } from "./fixtures";
test.beforeEach(async ({ workbench: page }) => {
@@ -52,7 +53,7 @@ test.beforeEach(async ({ workbench: page }) => {
});
await page.getByRole("button", { name: "Agents", exact: true }).click();
await page.getByRole("button", { name: "New Agent Task", exact: true }).click();
await expect(page.getByText("omp · 18.20.0 · ACP v1", { exact: true })).toBeVisible();
await expectVersion(page, "18.20.0");
});
test("refreshes an upgraded agent's version on window focus without losing the draft", async ({ workbench: page }) => {
@@ -63,7 +64,7 @@ test("refreshes an upgraded agent's version on window focus without losing the d
window.dispatchEvent(new Event("test:agent-upgraded"));
window.dispatchEvent(new Event("focus"));
});
await expect(page.getByText("omp · 18.20.2 · ACP v1", { exact: true })).toBeVisible();
await expectVersion(page, "18.20.2");
await expect(message).toHaveText("Keep this unsent draft");
});
@@ -71,5 +72,10 @@ test("refreshes an upgraded agent's version when New Task is reopened", async ({
await page.getByRole("button", { name: "Close Tab", exact: true }).click();
await page.evaluate(() => window.dispatchEvent(new Event("test:agent-upgraded")));
await page.getByRole("button", { name: "New Agent Task", exact: true }).click();
await expect(page.getByText("omp · 18.20.2 · ACP v1", { exact: true })).toBeVisible();
await expectVersion(page, "18.20.2");
});
/** The agent picker shows its icon; its name and version are in its tooltip. */
async function expectVersion(page: Page, version: string) {
await expect(page.locator(`[data-tooltip$=" ${version}"]`).filter({ visible: true })).toHaveCount(1);
}
+22 -157
View File
@@ -173,9 +173,6 @@
.chipDetail > span {
grid-area: 1 / 1;
}
.chipSizer {
visibility: hidden;
}
.chipChevron {
flex: none;
color: var(--fg-muted);
@@ -222,46 +219,38 @@
color: var(--fg-muted);
cursor: default;
}
.activeModelBar {
/* The model popup's top: effort (and context size) as segmented controls. */
.quickSettings {
display: flex;
flex-direction: column;
gap: var(--space-1-5);
padding: 4px 10px 10px;
margin-bottom: 4px;
border-bottom: 1px solid var(--border);
}
.quickRow {
display: flex;
align-items: center;
gap: var(--space-2);
width: calc(100% - 12px);
margin: 2px 6px 6px;
padding: 6px 8px;
border: 0;
border-radius: var(--radius-control);
background: var(--bg-elev);
box-shadow: inset 0 0 0 1px var(--border);
color: var(--fg-strong);
text-align: left;
cursor: pointer;
transition: background var(--dur-fast) var(--ease);
}
.activeModelBar:hover,
.activeModelBar:focus-visible {
outline: none;
background: var(--bg-hover);
}
.activeModelName {
flex: 1 1 auto;
.quickRow > .segmented {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 600;
}
.activeModelMeta {
.quickLabel {
flex: none;
width: 52px;
color: var(--fg-muted);
font-size: var(--fs-small);
}
.activeModelGear {
display: inline-flex;
align-items: center;
gap: var(--space-0-5);
flex: none;
color: var(--fg-muted);
/* A model's configure button shows on its row's hover only. */
.modelEffortPopup [role="option"] .modelRowConfigure {
opacity: 0;
}
.modelEffortPopup [role="option"]:hover .modelRowConfigure,
.modelEffortPopup [role="option"][aria-selected="true"] .modelRowConfigure,
.modelEffortPopup .modelRowConfigure:focus-visible {
opacity: 1;
}
.modelRowConfigure {
display: grid;
@@ -299,52 +288,9 @@
color: var(--warning);
}
/* Page 2: per-model configuration view. */
.modelDetail {
display: flex;
flex-direction: column;
gap: var(--space-3);
padding: 6px 12px 8px;
}
.modelDetailHeader {
display: flex;
align-items: center;
gap: var(--space-1-5);
}
.modelDetailTitle {
flex: 1 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--fg-strong);
font-weight: 600;
}
.modelDetailActions {
display: inline-flex;
align-items: center;
gap: var(--space-0-5);
flex: none;
}
.pinnedButton {
color: var(--accent);
}
.detailSection {
display: flex;
flex-direction: column;
gap: var(--space-1-5);
}
.detailSectionLabel {
color: var(--fg-strong);
font-weight: 600;
font-size: var(--fs-small);
}
.detailRow {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-3);
}
.segmented {
display: flex;
align-items: stretch;
@@ -384,84 +330,6 @@
color: var(--fg-strong);
font-weight: 600;
}
.costCard {
display: flex;
flex-direction: column;
gap: var(--space-1);
padding: 8px 10px;
border-radius: var(--radius-popup);
background: var(--bg-elev);
box-shadow: inset 0 0 0 1px var(--border);
}
.costCardHeader {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-2);
}
.costCardTitle {
color: var(--fg-strong);
font-weight: 600;
font-size: var(--fs-small);
}
.costCardRow {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: var(--space-3);
color: var(--fg-secondary);
font-size: var(--fs-small);
}
.costCardValue {
color: var(--fg-strong);
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.pricingCard {
display: flex;
flex-direction: column;
border-radius: var(--radius-popup);
background: var(--bg-elev);
box-shadow: inset 0 0 0 1px var(--border);
}
.pricingHeader {
display: flex;
align-items: center;
gap: var(--space-1-5);
width: 100%;
padding: 8px 10px;
border: 0;
border-radius: inherit;
background: transparent;
color: var(--fg-strong);
text-align: left;
cursor: pointer;
}
.pricingHeader:hover,
.pricingHeader:focus-visible {
outline: none;
background: var(--bg-hover);
}
.pricingChevron {
flex: none;
color: var(--fg-muted);
}
.pricingTitle {
flex: 1 1 auto;
font-weight: 600;
font-size: var(--fs-small);
}
.pricingBody {
display: flex;
flex-direction: column;
gap: var(--space-1);
padding: 2px 12px 10px;
}
.pricingSubhead {
margin-bottom: 2px;
color: var(--fg-muted);
font-size: var(--fs-small);
}
.modePopup {
min-width: 200px;
padding: 6px 0;
@@ -561,9 +429,6 @@
gap: 5px;
white-space: nowrap;
}
.pickerName {
color: var(--fg-subtle);
}
/* Above the text: the current file to reference, attached files and images. */
.context {
+44 -29
View File
@@ -33,7 +33,9 @@ import {
Icon,
IconButton,
List,
Menu,
Popup,
type MenuItem,
firstSelectable,
listNavigate,
fileIconName,
@@ -141,6 +143,8 @@ export interface ComposerProps {
toolbar?: ReactNode;
/** Right of the bottom row: send / stop buttons. */
actions?: ReactNode;
/** Extra items for the Add Context menu, after the file and image items. */
addMenu?: MenuItem[];
className?: string;
}
@@ -979,6 +983,18 @@ export function Composer(props: ComposerProps) {
[id, projectRoot, root],
);
const [addOpen, setAddOpen] = useState(false);
const addAnchor = useRef<HTMLButtonElement>(null);
const insertMention = () => {
const view = viewRef.current;
if (!view) return;
// At the caret while typing, else after the text.
const end = view.state.doc.length;
const { from, to } = view.hasFocus ? view.state.selection.main : { from: end, to: end };
const before = view.state.sliceDoc(Math.max(0, from - 1), from);
replace(from, to, before && !/\s/.test(before) ? " @" : "@");
view.focus();
};
const showContext = images.length > 0 || attached.length > 0 || !!suggested;
return (
@@ -1107,14 +1123,23 @@ export function Composer(props: ComposerProps) {
<Icon name={fileIconName(basename(suggested.rel), suggested.rel)} size={14} />
<span className={styles.attachmentName}>{basename(suggested.rel)}</span>
<span className={styles.suggestionHint}>{tx("Current File")}</span>
{/* The chip is the IDE context switch: off here, back on from the dashed chip. */}
<button
type="button"
className={styles.removeChip}
aria-label={tx("Don't Add the Current File")}
onClick={() => setIdeContext(false)}
>
<Icon name="close" size={10} />
</button>
</span>
)}
{suggested && !ideContext && (
<button
type="button"
className={styles.suggestion}
title={tx`Reference ${suggested.rel}`}
onClick={() => addPaths([suggested.path])}
title={tx`Add ${suggested.rel} and the selection to your requests`}
onClick={() => setIdeContext(true)}
>
<Icon name="plus" size={12} />
<Icon name={fileIconName(basename(suggested.rel), suggested.rel)} size={14} />
@@ -1167,35 +1192,25 @@ export function Composer(props: ComposerProps) {
<div className={styles.toolbar}>{props.toolbar}</div>
<div className={styles.actions}>
<IconButton
icon="paperclip"
title="Reference a File (@)"
ref={addAnchor}
icon="plus"
title="Add Context"
aria-haspopup="menu"
aria-expanded={addOpen}
className={styles.composerButton}
onClick={() => {
const view = viewRef.current;
if (!view) return;
// At the caret while typing, else after the text.
const end = view.state.doc.length;
const { from, to } = view.hasFocus ? view.state.selection.main : { from: end, to: end };
const before = view.state.sliceDoc(Math.max(0, from - 1), from);
replace(from, to, before && !/\s/.test(before) ? " @" : "@");
}}
onClick={() => setAddOpen((v) => !v)}
/>
<IconButton
icon="file-code"
title={
ideContext
? "IDE Context Enabled: the current file and selection are added to your request"
: "IDE Context Disabled: the current file and selection are not added to your request"
}
pressed={ideContext}
className={styles.composerButton}
onClick={() => setIdeContext(!ideContext)}
/>
<IconButton
icon="image"
title="Attach Image…"
className={styles.composerButton}
onClick={() => imageInput.current?.click()}
<Menu
open={addOpen}
anchor={addAnchor}
placement="bottom-end"
onClose={() => setAddOpen(false)}
aria-label="Add Context"
items={[
{ id: "reference", label: "Reference a File (@)", icon: "paperclip", run: insertMention },
{ id: "image", label: "Attach Image…", icon: "image", run: () => imageInput.current?.click() },
...(props.addMenu ?? []),
]}
/>
<input
ref={imageInput}
+24 -91
View File
@@ -273,15 +273,19 @@ describe("model and effort button", () => {
},
];
it("shows the model with the agent's effort name and the mode with Allow All", () => {
render(<ConfigPickers config={copilotConfig()} onChange={vi.fn()} />);
const model = screen.getByRole("button", { name: "Model" });
expect(model).toHaveTextContent("Claude Sonnet 5.5medium");
it("shows the effort as its own picker beside the model, and the mode with Allow All", () => {
const onChange = vi.fn();
render(<ConfigPickers config={copilotConfig()} onChange={onChange} />);
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("Claude Sonnet 5.5");
expect(screen.getByRole("button", { name: "Mode" })).toHaveTextContent("AgentAllow All");
expect(screen.queryByRole("button", { name: "Reasoning Effort" })).not.toBeInTheDocument();
const effort = screen.getByRole("button", { name: "Reasoning Effort" });
expect(effort).toHaveTextContent("medium");
fireEvent.click(effort);
fireEvent.click(screen.getByRole("option", { name: "XHigh" }));
expect(onChange).toHaveBeenCalledExactlyOnceWith("reasoning_effort", "xhigh");
});
it("tucks Fast into the model popup with effort", () => {
it("tucks Fast into the model popup", () => {
const config = [
...copilotConfig().filter((o) => o.category !== "thought_level"),
{
@@ -297,23 +301,21 @@ describe("model and effort button", () => {
render(<ConfigPickers config={config} onChange={vi.fn()} />);
expect(screen.queryByRole("switch", { name: "Fast" })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Model" }));
const dialog = screen.getByRole("dialog", { name: "Model & effort settings" });
const dialog = screen.getByRole("dialog", { name: "Model" });
expect(within(dialog).getByRole("switch", { name: "Fast" })).toHaveAttribute("aria-checked", "false");
});
it("navigates to the detail page for segmented effort, Reset, Pin, and cost badge", () => {
it("lists models by name in one page, with context size, cost and pinning", () => {
const onChange = vi.fn();
const cfg = copilotConfig().map((o) =>
o.id === "model"
? {
...o,
values: o.values.map((v) =>
v.value === "claude-sonnet-5.5" ? { ...v, costCategory: "medium", usageMultiplier: "1x" } : v,
v.value === "claude-sonnet-5.5" ? { ...v, costCategory: "medium", description: "Balanced" } : v,
),
}
: o.id === "reasoning_effort"
? { ...o, defaultValue: "medium" }
: o,
: o,
);
cfg.push({
id: "contextTier",
@@ -325,106 +327,37 @@ describe("model and effort button", () => {
via: "option",
values: [value("default", "200K"), value("long_context", "1M")],
});
render(<ConfigPickers config={cfg} values={{ reasoning_effort: "high" }} onChange={onChange} />);
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("Claude Sonnet 5.5high · 1M");
render(<ConfigPickers config={cfg} onChange={onChange} />);
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("Claude Sonnet 5.51M");
fireEvent.click(screen.getByRole("button", { name: "Model" }));
const dialog = screen.getByRole("dialog", { name: "Model & effort settings" });
const dialog = screen.getByRole("dialog", { name: "Model" });
expect(within(dialog).queryByText("Balanced")).not.toBeInTheDocument();
expect(within(dialog).getByText("Medium cost")).toBeVisible();
// Pick another model directly from Page 1.
fireEvent.click(within(dialog).getByRole("option", { name: /GPT-6 Sol/ }));
expect(onChange).toHaveBeenCalledWith("model", "gpt-6-sol");
// Open Page 2 (detail configuration view) for the active model.
fireEvent.click(within(dialog).getByRole("button", { name: "Configure model" }));
const effortGroup = within(dialog).getByRole("radiogroup", { name: "Reasoning Effort" });
expect(within(effortGroup).getByRole("radio", { name: "high" })).toHaveAttribute("aria-checked", "true");
fireEvent.click(within(effortGroup).getByRole("radio", { name: "XHigh" }));
expect(onChange).toHaveBeenCalledWith("reasoning_effort", "xhigh");
const contextGroup = within(dialog).getByRole("radiogroup", { name: "Context Size" });
expect(within(contextGroup).getByRole("radio", { name: "1M" })).toHaveAttribute("aria-checked", "true");
fireEvent.click(within(contextGroup).getByRole("radio", { name: "200K" }));
expect(onChange).toHaveBeenCalledWith("contextTier", "default");
// Cost badge & multiplier render in the detail card.
expect(within(dialog).getByText("Medium cost")).toBeVisible();
expect(within(dialog).getByText("1x")).toBeVisible();
// Reset restores both effort and contextTier to their agent defaults.
onChange.mockClear();
fireEvent.click(within(dialog).getByRole("button", { name: "Reset to defaults" }));
expect(onChange).toHaveBeenCalledWith("reasoning_effort", "medium");
expect(onChange).toHaveBeenCalledWith("contextTier", "default");
// Pin model, navigate back to Page 1, and verify Pinned + Models sections appear.
fireEvent.click(within(dialog).getByRole("button", { name: "Pin model" }));
fireEvent.click(within(dialog).getByRole("button", { name: "Back to models" }));
fireEvent.click(within(dialog).getAllByRole("button", { name: "Pin model" })[0]!);
const listbox = within(dialog).getByRole("listbox", { name: "Model" });
expect(within(listbox).getByText("Pinned")).toBeVisible();
expect(within(listbox).getByText("Models")).toBeVisible();
});
it("updates per-tier token pricing live when switching Context Size", () => {
const cfg = copilotConfig().map((o) =>
o.id === "model"
? {
...o,
values: o.values.map((v) =>
v.value === "claude-sonnet-5.5"
? {
...v,
pricing: {
costTier: "medium",
multiplier: 1,
tiers: {
default: { input: 200, output: 1000, cacheRead: 10, cacheWrite: 0, contextTokens: 200_000 },
long_context: {
input: 400,
output: 2000,
cacheRead: 20,
cacheWrite: 0,
contextTokens: 1_000_000,
},
},
},
}
: v,
),
}
: o,
);
cfg.push({
id: "context_tier",
name: "Context Size",
category: "model_config",
description: null,
current: "long_context",
via: "option",
values: [value("default", "200K"), value("long_context", "1M")],
});
const { rerender } = render(<ConfigPickers config={cfg} onChange={vi.fn()} />);
fireEvent.click(screen.getByRole("button", { name: "Model" }));
fireEvent.click(screen.getByRole("button", { name: "Configure model" }));
expect(screen.getByText("Credits per 1M tokens")).toBeVisible();
expect(screen.getByText("400")).toBeVisible();
expect(screen.getByText("2000")).toBeVisible();
rerender(<ConfigPickers config={cfg} values={{ context_tier: "default" }} onChange={vi.fn()} />);
expect(screen.getByText("200")).toBeVisible();
expect(screen.getByText("1000")).toBeVisible();
fireEvent.click(within(dialog).getByRole("option", { name: /GPT-6 Sol/ }));
expect(onChange).toHaveBeenCalledWith("model", "gpt-6-sol");
expect(screen.queryByRole("dialog", { name: "Model" })).not.toBeInTheDocument();
});
it("filters the model list and picks the highlighted model with the keyboard", () => {
const onChange = vi.fn();
render(<ConfigPickers config={copilotConfig()} onChange={onChange} />);
fireEvent.click(screen.getByRole("button", { name: "Model" }));
const dialog = screen.getByRole("dialog", { name: "Model & effort settings" });
const search = within(dialog).getByPlaceholderText("Search…");
const search = screen.getByPlaceholderText("Search…");
expect(search).toHaveFocus();
fireEvent.change(search, { target: { value: "sol" } });
expect(within(dialog).getAllByRole("option")).toHaveLength(1);
expect(screen.getAllByRole("option")).toHaveLength(1);
fireEvent.keyDown(search, { key: "ArrowDown" });
fireEvent.keyDown(search, { key: "Enter" });
expect(onChange).toHaveBeenLastCalledWith("model", "gpt-6-sol");
+100 -416
View File
@@ -1,21 +1,24 @@
/**
* Model, mode, approvals and thinking-effort controls for a composer's bottom row.
* With a model plus effort, model-config or cost metadata, one button shows the active
* summary and opens a two-page popup: a searchable model list (with pinned models and
* per-row configure buttons) and a per-model configuration view with segmented Effort
* Level, optional segmented Context Size, Reset / Pin actions, and a cost badge.
* Model, effort, mode and approvals controls for a composer's bottom row. The model button
* opens a searchable model list (pinned models first, context size above it); the effort is
* its own picker beside it, one click away.
*/
import { useEffect, useRef, useState, type KeyboardEvent } from "react";
import clsx from "clsx";
import type { AgentConfigOption, AgentModelPricing } from "@/bindings";
import { tx as rawTx, useTx } from "@/platform/i18n";
import type { AgentConfigOption } from "@/bindings";
import { useTx } from "@/platform/i18n";
import { Icon, IconButton, Popup, Select, T, Toggle } from "@/ui";
import { SelectListbox, type SelectOption } from "@/ui/Select";
import { formatCreditRate, isContextOption, mainOptions, modelConfigOptions, modeIcon } from "./composerModel";
import { isContextOption, mainOptions, modelConfigOptions, modeIcon } from "./composerModel";
import { togglePinnedModel, useAgents } from "./store";
import styles from "./Composer.module.css";
export function configPickerOptions(option: AgentConfigOption, pinned: readonly string[] = []): SelectOption[] {
export function configPickerOptions(
option: AgentConfigOption,
pinned: readonly string[] = [],
/** Without each model's description: the model popup lists names only. */
descriptions = true,
): SelectOption[] {
if (option.category !== "model") {
return option.values.map((v) => ({ value: v.value, label: v.name, detail: v.description ?? undefined }));
}
@@ -26,7 +29,9 @@ export function configPickerOptions(option: AgentConfigOption, pinned: readonly
const path = slash >= 0 ? v.value.slice(slash + 1) : "";
const label = path ? path.slice(path.lastIndexOf("/") + 1) : v.name || v.value;
const mult = v.usageMultiplier && !v.description?.startsWith(v.usageMultiplier) ? v.usageMultiplier : undefined;
const parts = [path || undefined, mult, v.description ?? undefined].filter((p): p is string => !!p);
const parts = [path || undefined, mult, (descriptions && v.description) || undefined].filter(
(p): p is string => !!p,
);
const detail = parts.length > 0 ? parts.join(" · ") : undefined;
return { provider, opt: { value: v.value, label, detail, keywords: provider } };
};
@@ -104,14 +109,16 @@ export function ConfigPickers({
const effort = config.find((o) => o.category === "thought_level" && o.values.length > 0);
const modelConfigs = modelConfigOptions(config);
const hasCostMeta = model?.values.some((v) => !!v.costCategory || !!v.usageMultiplier || !!v.pricing) ?? false;
const combinedModel = model && (modelRefresh || effort || modelConfigs.length > 0 || hasCostMeta);
const combinedModel = model && (modelRefresh || modelConfigs.length > 0 || hasCostMeta);
const tuckedModelConfig = new Set(modelConfigs.map((o) => o.id));
const mode = options.find((o) => o.category === "mode");
const allowAll = mode && options.find((o) => switchValues(o));
// Effort sits right after the model, as its own one-click picker.
const inline = options.filter(
(o) => o !== effort && o !== allowAll && !(combinedModel && tuckedModelConfig.has(o.id)),
);
// The compact menu holds everything but the model button (effort + model parameters).
if (effort) inline.splice(model ? inline.indexOf(model) + 1 : 0, 0, effort);
// The compact menu holds everything but the model and effort buttons (and the model's own parameters).
const secondary = options.filter(
(o) => o.category !== "model" && o !== effort && !(combinedModel && tuckedModelConfig.has(o.id)),
);
@@ -120,13 +127,14 @@ export function ConfigPickers({
return (
<>
{inline.map((o) => (
<span key={o.id} className={clsx(styles.configPicker, o.category !== "model" && styles.inlineSetting)}>
<span
key={o.id}
className={clsx(styles.configPicker, o.category !== "model" && o !== effort && styles.inlineSetting)}
>
{o === model && combinedModel ? (
<ModelEffortPicker
<ModelPicker
model={o}
modelValue={valueOf(o)}
effort={effort}
effortValue={effort ? valueOf(effort) : null}
modelConfigs={modelConfigs}
valueOf={valueOf}
onChange={onChange}
@@ -224,24 +232,17 @@ function ConfigPicker({
onChange={(v) => onChange(option.id, v)}
renderValue={
option.category === "thought_level" && !framed
? (current) => (
<span className={styles.pickerValue}>
<span className={styles.pickerName}>{option.name}</span>
{current?.label ?? tx("Default")}
</span>
)
? (current) => <span className={styles.pickerValue}>{current?.label ?? tx("Default")}</span>
: undefined
}
/>
);
}
/** Two-page model & per-model configuration picker (searchable list + detail page). */
function ModelEffortPicker({
/** The model button: a searchable model list, with context size and the model's own settings above it. */
function ModelPicker({
model,
modelValue,
effort,
effortValue,
modelConfigs,
valueOf,
onChange,
@@ -249,8 +250,6 @@ function ModelEffortPicker({
}: {
model: AgentConfigOption;
modelValue: string | null;
effort?: AgentConfigOption;
effortValue: string | null;
modelConfigs: AgentConfigOption[];
valueOf: (o: AgentConfigOption) => string | null;
onChange: (option: string, value: string) => void;
@@ -258,65 +257,26 @@ function ModelEffortPicker({
}) {
const tx = useTx();
const [open, setOpen] = useState(false);
const [page, setPage] = useState<"list" | "detail">("list");
const pinnedModels = useAgents((s) => s.pinnedModels);
const anchor = useRef<HTMLButtonElement>(null);
const selectedModel = selected(model, modelValue);
const unavailable = modelRefresh && modelValue !== null && !selectedModel;
const modelName = unavailable ? tx`${modelValue} (unavailable)` : (selectedModel?.name ?? tx("Default"));
const effortName = effort ? (selected(effort, effortValue)?.name ?? tx("Default")) : null;
const contextOption = modelConfigs.find((o) => isContextOption(o.id) && o.values.length > 0);
const contextValue = contextOption ? valueOf(contextOption) : null;
const contextLabel = contextOption ? (selected(contextOption, contextValue)?.name ?? null) : null;
const otherModelConfigs = modelConfigs.filter((o) => o !== contextOption);
const chipBadges = [effortName, contextLabel].filter((x): x is string => !!x);
const chipBadgeText = chipBadges.join(" · ");
const otherSummary = otherModelConfigs
.map((o) => {
const summary = [
contextLabel ? `${tx("Context Size")}: ${contextLabel}` : null,
...otherModelConfigs.map((o) => {
const current = selected(o, valueOf(o));
return current ? `${tx(o.name)}: ${current.name}` : null;
})
.filter(Boolean)
.join(" · ");
const summary = [
effortName ? `${tx(effort!.name)}: ${effortName}` : null,
contextLabel ? `${tx("Context Size")}: ${contextLabel}` : null,
otherSummary,
}),
]
.filter(Boolean)
.join(" · ");
const canConfigureActive = !!(
effort ||
contextOption ||
otherModelConfigs.length > 0 ||
selectedModel?.costCategory ||
selectedModel?.usageMultiplier ||
selectedModel?.pricing
);
const closePopup = () => {
setOpen(false);
setPage("list");
};
const openDetailFor = (targetModelValue: string) => {
if (targetModelValue !== modelValue) {
onChange(model.id, targetModelValue);
}
setPage("detail");
};
const sizerCandidates =
effort && !contextLabel
? [...new Set([chipBadgeText, ...effort.values.map((v) => v.name)])]
: chipBadgeText
? [chipBadgeText]
: [];
return (
<>
<button
@@ -327,115 +287,91 @@ function ModelEffortPicker({
aria-haspopup="dialog"
aria-expanded={open}
title={`${tx(model.name)}: ${modelName}${summary ? ` · ${summary}` : ""}`}
onClick={() => {
setOpen((prev) => {
if (prev) setPage("list");
return !prev;
});
}}
onClick={() => setOpen((v) => !v)}
>
<span className={styles.chipValue}>{modelName}</span>
{chipBadgeText && (
<span className={styles.chipDetail}>
{sizerCandidates.map((text) => (
<span
key={text}
className={text === chipBadgeText ? undefined : styles.chipSizer}
aria-hidden={text !== chipBadgeText}
>
{text}
</span>
))}
</span>
)}
{contextLabel && <span className={styles.chipDetail}>{contextLabel}</span>}
<Icon name="chevron-down" size={14} className={styles.chipChevron} />
</button>
<Popup
open={open}
anchor={anchor}
onClose={closePopup}
aria-label={tx("Model & effort settings")}
onClose={() => setOpen(false)}
aria-label={tx("Model")}
className={styles.modelEffortPopup}
>
{page === "detail" && selectedModel ? (
<ModelDetailView
modelEntry={selectedModel}
effort={effort}
effortValue={effortValue}
contextOption={contextOption}
contextValue={contextValue}
otherModelConfigs={otherModelConfigs}
valueOf={valueOf}
pinned={pinnedModels.includes(selectedModel.value)}
onBack={() => setPage("list")}
onTogglePin={() => togglePinnedModel(selectedModel.value)}
onChange={onChange}
/>
) : (
<>
{unavailable && (
<p className={styles.catalogError} role="alert">
<T>Choose another model before starting.</T>
</p>
)}
{canConfigureActive && selectedModel && (
<button
type="button"
className={styles.activeModelBar}
aria-label={tx("Configure model")}
onClick={() => setPage("detail")}
>
<span className={styles.activeModelName}>{modelName}</span>
<CostBadge category={selectedModel.costCategory} />
{chipBadgeText && <span className={styles.activeModelMeta}>{chipBadgeText}</span>}
<span className={styles.activeModelGear}>
<Icon name="sliders" size={13} />
<Icon name="chevron-right" size={12} />
{unavailable && (
<p className={styles.catalogError} role="alert">
<T>Choose another model before starting.</T>
</p>
)}
{(contextOption || otherModelConfigs.length > 0) && (
<div className={styles.quickSettings}>
{contextOption && (
<div className={styles.quickRow}>
<span className={styles.quickLabel}>
<T>Context Size</T>
</span>
</button>
<SegmentedControl
ariaLabel={tx("Context Size")}
options={contextOption.values.map((v) => ({
value: v.value,
label: v.name,
description: v.description ?? undefined,
}))}
value={contextValue ?? contextOption.values[0]!.value}
onChange={(v) => onChange(contextOption.id, v)}
/>
</div>
)}
{otherModelConfigs.map((o) => (
<div key={o.id} className={styles.modeFooter}>
<span title={o.description ?? undefined}>{tx(o.name)}</span>
<div key={o.id} className={styles.quickRow}>
<span className={styles.quickLabel} title={o.description ?? undefined}>
{tx(o.name)}
</span>
<ConfigPicker option={o} value={valueOf(o)} onChange={onChange} framed />
</div>
))}
{model.values.length > 0 || !modelRefresh ? (
<SelectListbox
aria-label={tx(model.name)}
value={modelValue}
options={configPickerOptions(model, pinnedModels)}
searchable
listClassName={styles.modelList}
onChoose={(v) => onChange(model.id, v)}
renderAction={(opt) => {
const raw = model.values.find((v) => v.value === opt.value);
if (!raw) return null;
const showRowBadge = !!raw.costCategory && !raw.description;
return (
<>
{showRowBadge && <CostBadge category={raw.costCategory} />}
<button
type="button"
className={styles.modelRowConfigure}
aria-label={rawTx`Configure ${opt.label}`}
title={rawTx`Configure ${opt.label}`}
onClick={() => openDetailFor(opt.value)}
>
<Icon name="sliders" size={12} />
</button>
</>
);
}}
/>
) : (
<p className={styles.catalogNote} role="status">
{modelRefresh?.refreshing ? <T>Loading models…</T> : <T>No models reported by this agent.</T>}
</p>
)}
{modelRefresh && <ModelRefreshFooter key={modelRefresh.retryAtMs} {...modelRefresh} />}
</>
</div>
)}
{model.values.length > 0 || !modelRefresh ? (
<SelectListbox
aria-label={tx(model.name)}
value={modelValue}
options={configPickerOptions(model, pinnedModels, false)}
searchable
listClassName={styles.modelList}
onChoose={(v) => {
onChange(model.id, v);
setOpen(false);
}}
renderAction={(opt) => {
const raw = model.values.find((v) => v.value === opt.value);
if (!raw) return null;
const pinned = pinnedModels.includes(raw.value);
return (
<>
<CostBadge category={raw.costCategory} />
<button
type="button"
className={clsx(styles.modelRowConfigure, pinned && styles.pinnedButton)}
aria-label={pinned ? tx("Unpin model") : tx("Pin model")}
aria-pressed={pinned}
title={pinned ? tx("Unpin model") : tx("Pin model")}
onClick={() => togglePinnedModel(raw.value)}
>
<Icon name="pin" size={12} />
</button>
</>
);
}}
/>
) : (
<p className={styles.catalogNote} role="status">
{modelRefresh?.refreshing ? <T>Loading models…</T> : <T>No models reported by this agent.</T>}
</p>
)}
{modelRefresh && <ModelRefreshFooter key={modelRefresh.retryAtMs} {...modelRefresh} />}
</Popup>
</>
);
@@ -493,258 +429,6 @@ function CostBadge({ category }: { category: string | null | undefined }) {
);
}
/** Page 2: per-model configuration view (segmented Effort, optional Context Size, Reset, Pin, and cost info). */
function ModelDetailView({
modelEntry,
effort,
effortValue,
contextOption,
contextValue,
otherModelConfigs,
valueOf,
pinned,
onBack,
onTogglePin,
onChange,
}: {
modelEntry: AgentConfigOption["values"][number];
effort?: AgentConfigOption;
effortValue: string | null;
contextOption?: AgentConfigOption;
contextValue: string | null;
otherModelConfigs: AgentConfigOption[];
valueOf: (o: AgentConfigOption) => string | null;
pinned: boolean;
onBack: () => void;
onTogglePin: () => void;
onChange: (option: string, value: string) => void;
}) {
const tx = useTx();
const [pricingOpen, setPricingOpen] = useState(true);
const defaultEffort = effort ? (effort.defaultValue ?? effort.current) : null;
const defaultContext = contextOption ? (contextOption.defaultValue ?? contextOption.current) : null;
const effortAtDefault = !effort || !defaultEffort || effortValue === defaultEffort;
const contextAtDefault = !contextOption || !defaultContext || contextValue === defaultContext;
const othersAtDefault = otherModelConfigs.every((o) => {
const def = o.defaultValue ?? o.current;
return !def || valueOf(o) === def;
});
const atDefaults = effortAtDefault && contextAtDefault && othersAtDefault;
const handleReset = () => {
if (effort && defaultEffort && effortValue !== defaultEffort) {
onChange(effort.id, defaultEffort);
}
if (contextOption && defaultContext && contextValue !== defaultContext) {
onChange(contextOption.id, defaultContext);
}
for (const o of otherModelConfigs) {
const def = o.defaultValue ?? o.current;
if (def && valueOf(o) !== def) {
onChange(o.id, def);
}
}
};
const compactEffort = (effort?.values.length ?? 0) >= 5;
const hasCostCard = !!(modelEntry.costCategory || modelEntry.usageMultiplier);
return (
<div className={styles.modelDetail}>
<div className={styles.modelDetailHeader}>
<IconButton
icon="arrow-left"
size="small"
aria-label={tx("Back to models")}
title={tx("Back to models")}
onClick={onBack}
/>
<span className={styles.modelDetailTitle} title={modelEntry.name}>
{modelEntry.name}
</span>
<div className={styles.modelDetailActions}>
<IconButton
icon="undo"
size="small"
disabled={atDefaults}
aria-label={tx("Reset to defaults")}
title={tx("Reset to defaults")}
onClick={handleReset}
/>
<IconButton
icon="pin"
size="small"
aria-label={pinned ? tx("Unpin model") : tx("Pin model")}
title={pinned ? tx("Unpin model") : tx("Pin model")}
aria-pressed={pinned}
className={clsx(pinned && styles.pinnedButton)}
onClick={onTogglePin}
/>
</div>
</div>
{effort && effort.values.length > 0 && (
<div className={styles.detailSection}>
<div className={styles.detailSectionLabel}>
<T>Effort Level</T>
</div>
<SegmentedControl
ariaLabel={tx(effort.name)}
options={effort.values.map((v) => ({
value: v.value,
label: compactEffort && v.value === "xhigh" ? tx("XHigh") : v.name,
description: v.description ?? undefined,
}))}
value={effortValue ?? effort.values[0]!.value}
onChange={(v) => onChange(effort.id, v)}
/>
</div>
)}
{contextOption && contextOption.values.length > 0 && (
<div className={styles.detailSection}>
<div className={styles.detailSectionLabel}>
<T>Context Size</T>
</div>
<SegmentedControl
ariaLabel={tx("Context Size")}
options={contextOption.values.map((v) => ({
value: v.value,
label: v.name,
description: v.description ?? undefined,
}))}
value={contextValue ?? contextOption.values[0]!.value}
onChange={(v) => onChange(contextOption.id, v)}
/>
</div>
)}
{otherModelConfigs.map((o) => (
<div key={o.id} className={styles.detailRow}>
<span className={styles.detailSectionLabel} title={o.description ?? undefined}>
{tx(o.name)}
</span>
<ConfigPicker option={o} value={valueOf(o)} onChange={onChange} framed />
</div>
))}
{modelEntry.pricing ? (
<PricingDetailsCard
pricing={modelEntry.pricing}
activeTier={contextValue}
open={pricingOpen}
onToggle={() => setPricingOpen((v) => !v)}
/>
) : (
hasCostCard && (
<div className={styles.costCard}>
<div className={styles.costCardHeader}>
<span className={styles.costCardTitle}>
<T>Pricing details</T>
</span>
<CostBadge category={modelEntry.costCategory} />
</div>
{modelEntry.usageMultiplier && (
<div className={styles.costCardRow}>
<span>
<T>Multiplier</T>
</span>
<span className={styles.costCardValue}>{modelEntry.usageMultiplier}</span>
</div>
)}
</div>
)
)}
</div>
);
}
/** Collapsible per-tier token pricing breakdown card (`Credits per 1M tokens`). */
function PricingDetailsCard({
pricing,
activeTier,
open,
onToggle,
}: {
pricing: AgentModelPricing;
activeTier: string | null;
open: boolean;
onToggle: () => void;
}) {
const tiers = pricing.tiers ?? {};
const tierData =
(activeTier ? tiers[activeTier] : undefined) ?? tiers["default"] ?? tiers["long_context"] ?? undefined;
const hasRates = tierData && (tierData.input != null || tierData.output != null);
if (!hasRates && pricing.multiplier == null && !pricing.costTier) return null;
return (
<div className={styles.pricingCard}>
<button type="button" className={styles.pricingHeader} aria-expanded={open} onClick={onToggle}>
<Icon name={open ? "chevron-down" : "chevron-right"} size={12} className={styles.pricingChevron} />
<span className={styles.pricingTitle}>
<T>Pricing details</T>
</span>
{pricing.costTier ? (
<CostBadge category={pricing.costTier} />
) : (
pricing.multiplier != null && (
<span className={styles.costBadge}>{`${formatCreditRate(pricing.multiplier)}x`}</span>
)
)}
</button>
{open && (
<div className={styles.pricingBody}>
{hasRates && tierData ? (
<>
<div className={styles.pricingSubhead}>
<T>Credits per 1M tokens</T>
</div>
<div className={styles.costCardRow}>
<span>
<T>Input</T>
</span>
<span className={styles.costCardValue}>{formatCreditRate(tierData.input)}</span>
</div>
<div className={styles.costCardRow}>
<span>
<T>Output</T>
</span>
<span className={styles.costCardValue}>{formatCreditRate(tierData.output)}</span>
</div>
{tierData.cacheRead != null && (
<div className={styles.costCardRow}>
<span>
<T>Cache Read</T>
</span>
<span className={styles.costCardValue}>{formatCreditRate(tierData.cacheRead)}</span>
</div>
)}
{tierData.cacheWrite != null && (
<div className={styles.costCardRow}>
<span>
<T>Cache Write</T>
</span>
<span className={styles.costCardValue}>{formatCreditRate(tierData.cacheWrite)}</span>
</div>
)}
</>
) : (
pricing.multiplier != null && (
<div className={styles.costCardRow}>
<span>
<T>Multiplier</T>
</span>
<span className={styles.costCardValue}>{`${formatCreditRate(pricing.multiplier)}x`}</span>
</div>
)
)}
</div>
)}
</div>
);
}
/** Accessible segmented pill selector (`role="radiogroup"`) with Left/Right arrow navigation. */
function SegmentedControl({
ariaLabel,
+55 -39
View File
@@ -14,8 +14,8 @@
color: var(--fg);
}
.inner {
/* The same width as a running session's composer and conversation. */
width: min(var(--agent-conversation-width), 100%);
/* A compact block in the middle of the page: narrower than a session's conversation. */
width: min(680px, 100%);
display: flex;
flex-direction: column;
gap: var(--space-2);
@@ -24,31 +24,58 @@
width: 100%;
}
.heading {
margin: 0 0 10px;
font-size: calc(18px + var(--agent-font-zoom, 0px));
font-weight: 600;
margin: 0 0 14px;
font-size: calc(22px + var(--agent-font-zoom, 0px));
font-weight: 500;
letter-spacing: -0.01em;
text-align: center;
color: var(--fg-strong);
text-wrap: balance;
}
/* Under the box: the project and where the agent works. */
/* A box to write in, not a search bar: room for a few lines before it grows. */
.composer :global(.cm-content) {
min-height: calc(4.5em + 12px);
}
/* Under the box: one quiet group, the project, checkout and branch side by side. */
.where {
display: flex;
flex-wrap: wrap;
align-items: center;
/* The chips' own padding spaces them. */
gap: var(--space-0-5);
padding: 0 2px;
gap: var(--space-1);
min-width: 0;
padding: 0 6px;
color: var(--fg-subtle);
font-size: var(--fs-small);
}
/* The current branch, read-only: same height and colour as the pickers beside it. */
.branch {
.where > button {
flex: 0 1 auto;
min-width: 0;
color: inherit;
font-size: inherit;
}
/* The row's own gaps space "on" and "from"; the note's padding is for the lines below. */
.where .note {
padding: 0;
.project {
display: inline-flex;
align-items: center;
gap: var(--space-1-5);
min-width: 0;
height: var(--h-control);
padding: 0 4px;
}
.label {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.projectPicker {
max-width: 40%;
}
/* The agent shows as its icon only. */
.agentPicker {
display: flex;
flex: none;
}
.note,
@@ -68,31 +95,20 @@
justify-content: flex-end;
padding: 16px 12px 12px;
}
.docked .inner {
gap: var(--space-2);
.dockedIntro {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
min-height: 0;
padding-bottom: 8vh;
}
.docked .where {
flex-wrap: nowrap;
min-width: 0;
}
.docked .projectPicker,
.docked .projectChip {
flex: 0 1 auto;
min-width: 0;
max-width: 30%;
}
.docked .branch,
.docked .basePicker {
order: 1;
flex: 0 1 auto;
min-width: 0;
}
.docked .isolation {
order: 2;
flex: 0 1 auto;
min-width: 0;
max-width: 45%;
margin-left: auto;
.docked .heading {
margin: 0;
font-size: calc(15px + var(--agent-font-zoom, 0px));
font-weight: 500;
color: var(--fg-muted);
}
.notes {
+22 -16
View File
@@ -77,6 +77,8 @@ beforeEach(() => {
updateComposer(HOME, { text: "Check the project" });
});
const effortButton = () => screen.getByRole("button", { name: "Reasoning" });
async function chooseModel(model: string) {
fireEvent.click(screen.getByRole("button", { name: "Model" }));
fireEvent.click(screen.getByRole("option", { name: model }));
@@ -85,19 +87,16 @@ async function chooseModel(model: string) {
it("switches model-specific levels and restores each draft effort before starting", async () => {
render(<HomeEditor />);
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("bighigh");
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("big");
expect(effortButton()).toHaveTextContent("high");
await chooseModel("small");
fireEvent.click(screen.getByRole("button", { name: "Model" }));
fireEvent.click(screen.getByRole("button", { name: "Configure model" }));
const group = screen.getByRole("radiogroup", { name: "Reasoning" });
expect(group).toBeVisible();
expect(screen.getByRole("radio", { name: "minimal" })).toHaveAttribute("aria-checked", "true");
fireEvent.click(screen.getByRole("radio", { name: "medium" }));
fireEvent.keyDown(document, { key: "Escape" });
expect(effortButton()).toHaveTextContent("minimal");
fireEvent.click(effortButton());
fireEvent.click(screen.getByRole("option", { name: "medium" }));
await chooseModel("big");
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("bighigh");
expect(effortButton()).toHaveTextContent("high");
await chooseModel("small");
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("smallmedium");
expect(effortButton()).toHaveTextContent("medium");
fireEvent.click(screen.getByRole("button", { name: "Start" }));
await waitFor(() => expect(backend.create).toHaveBeenCalled());
expect(backend.create.mock.calls[0]![0].config).toEqual([
@@ -125,9 +124,11 @@ it("uses GitHub Copilot's own defaults and preserves per-model context tier and
};
useAgents.setState({ providers: [copilot], draft: savedDraft({ provider: "copilot", config: {} }) });
render(<HomeEditor />);
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("gemini-4-carbonmedium · default");
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("gemini-4-carbondefault");
expect(effortButton()).toHaveTextContent("medium");
await chooseModel("gpt-5.6-sol");
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("gpt-5.6-solmedium · default");
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("gpt-5.6-soldefault");
expect(effortButton()).toHaveTextContent("medium");
fireEvent.click(screen.getByRole("button", { name: "Start" }));
await waitFor(() => expect(backend.create).toHaveBeenCalled());
expect(backend.create.mock.calls[0]![0].config).toEqual([
@@ -161,7 +162,7 @@ it("ignores old provider-wide effort choices and refreshes unsupported per-model
draft: savedDraft({ provider: "fake", config: { effort: "low" }, thoughtLevels: { big: { effort: "removed" } } }),
});
render(<HomeEditor />);
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("bighigh");
expect(effortButton()).toHaveTextContent("high");
fireEvent.click(screen.getByRole("button", { name: "Start" }));
await waitFor(() => expect(backend.create).toHaveBeenCalled());
expect(backend.create.mock.calls[0]![0].config).toContainEqual({ id: "effort", value: "high" });
@@ -208,10 +209,10 @@ it("refreshes the displayed agent version after a CLI upgrade when the window re
return ok({ provider, name: "omp", version: cached, protocol: "ACP v1", error: null });
});
render(<HomeEditor />);
await screen.findByText("omp · 18.20.0 · ACP v1");
await waitFor(() => expect(agentTooltip()).toMatch(/ 18\.20\.0$/));
installed = "18.20.2";
fireEvent(window, new Event("focus"));
await screen.findByText("omp · 18.20.2 · ACP v1");
await waitFor(() => expect(agentTooltip()).toMatch(/ 18\.20\.2$/));
});
it("does not reuse a previous page's cached agent version when opened again", async () => {
@@ -219,5 +220,10 @@ it("does not reuse a previous page's cached agent version when opened again", as
ok({ provider, name: "omp", version: refresh ? "18.20.2" : "18.20.0", protocol: "ACP v1", error: null }),
);
render(<HomeEditor />);
await screen.findByText("omp · 18.20.2 · ACP v1");
await waitFor(() => expect(agentTooltip()).toMatch(/ 18\.20\.2$/));
});
/** The agent picker shows its icon; the name and version are in its tooltip. */
function agentTooltip() {
return screen.getByRole("button", { name: "Agent" }).parentElement?.getAttribute("data-tooltip");
}
+99 -95
View File
@@ -1,4 +1,4 @@
/** New Task page: one prompt box with the agent and its settings; where it works under it. */
/** New Task page: one prompt box with the agent and its settings; where it works in a quiet line under it. */
import clsx from "clsx";
import { useEffect, useRef, useState } from "react";
import type { AgentProbe, Branch } from "@/bindings";
@@ -6,7 +6,7 @@ import { executeAction } from "@/platform/actions";
import { call, commands } from "@/platform/ipc";
import { useTx, useTxTemplate } from "@/platform/i18n";
import { basename, useProject } from "@/platform/project";
import { Chip, Select, T, type SelectOption } from "@/ui";
import { Icon, Select, T, tooltipAttrs, type SelectOption } from "@/ui";
import { defaultTaskProject } from "./project";
import { maybeEditorService, useEditorShown, type EditorInput } from "@/workbench/contributions";
import { Composer } from "./Composer";
@@ -122,6 +122,10 @@ export function HomeEditor({ docked = false, input }: { docked?: boolean; input?
!starting &&
(!project?.workspace || repoState?.root === root);
const openMcp = () => setMcpOpenRequest((n) => n + 1);
// The agent shows as its icon; its name and version are in the tooltip.
const agentTitle = [provider?.name ?? tx("Agent"), probe?.version].filter(Boolean).join(" ");
const start = () => {
if (!canStart) return;
setStarting(true);
@@ -137,93 +141,25 @@ export function HomeEditor({ docked = false, input }: { docked?: boolean; input?
className={clsx(styles.home, docked && styles.docked, fitWindowWidth && styles.fitWidth)}
style={zoomStyle}
>
{/* In the tool window the box sits at the bottom, under the question centred in the space above. */}
{docked && (
<div className={styles.dockedIntro}>
<h1 className={styles.heading}>
<T>What should the agent do?</T>
</h1>
</div>
)}
<div className={styles.inner}>
{!docked && (
<h1 className={styles.heading}>
<T>What should the agent do?</T>
</h1>
)}
{/* Above the box, like the running session's state line. */}
<div className={styles.where}>
{members.length > 1 ? (
<Select
variant="chip"
aria-label={tx("Project")}
className={styles.projectPicker}
value={root}
options={members.map((path) => ({
value: path,
label: basename(path),
detail: path,
icon: "folder",
}))}
onChange={(path) => {
setSelected(path);
updateDraft({ base: null });
}}
/>
) : projectLabel ? (
<Chip icon="folder" title={root} className={styles.projectChip}>
{projectLabel}
</Chip>
) : null}
{isGit && (
<Select
variant="chip"
aria-label="Isolation"
className={styles.isolation}
value={isolation}
options={[
{ value: "worktree", label: tx("New worktree"), icon: "branch", detail: tx("away from your changes") },
{
value: "local",
label: tx("Local checkout"),
icon: "folder",
detail: tx("edits your files directly"),
},
]}
onChange={(isolation) => updateDraft({ isolation, isolationChosen: true })}
/>
)}
{/* A folder that isn't a repository has no branch: the one Git found below it isn't where the agent runs. */}
{isolation === "local" && isGit && current && (
<>
{!docked && (
<span className={styles.note}>
<T>on</T>
</span>
)}
<Chip icon="branch" title={current} className={styles.branch}>
{current}
</Chip>
</>
)}
{isolation === "worktree" && branches.length > 0 && (
<>
{!docked && (
<span className={styles.note}>
<T>from</T>
</span>
)}
<Select
variant="chip"
aria-label="Base branch"
className={styles.basePicker}
value={base}
options={branches.map((b) => ({ value: b.name, label: b.name, icon: "branch" }))}
onChange={(b) => updateDraft({ base: b === current ? null : b })}
/>
</>
)}
</div>
<Composer
id={HOME}
className={docked ? undefined : styles.composer}
autoFocus
placeholder={
docked
? "Describe a task…"
: "Describe a task for the agent. @ references a file or folder, / runs a command"
}
placeholder={docked ? "Describe a task…" : "Describe a task. @ for files, / for commands"}
root={root}
projectRoot={root}
commands={agentCommands}
@@ -231,19 +167,23 @@ export function HomeEditor({ docked = false, input }: { docked?: boolean; input?
config={config}
onConfig={setDraftOption}
onSubmit={start}
onOpenMcp={() => setMcpOpenRequest((n) => n + 1)}
onOpenMcp={openMcp}
disabled={!canStart}
addMenu={provider ? [{ id: "mcp", label: "MCP Servers…", icon: "plugin", run: openMcp }] : undefined}
toolbar={
<>
<Select
variant="ghost"
aria-label="Agent"
value={provider?.id ?? null}
options={providerOptions}
onChange={(id) =>
id === ADD_AGENT ? void executeAction("agents.addAgent") : updateDraft({ provider: id, config: {} })
}
/>
<span className={styles.agentPicker} {...tooltipAttrs(agentTitle, undefined, true)}>
<Select
variant="ghost"
aria-label="Agent"
value={provider?.id ?? null}
options={providerOptions}
renderValue={(o) => (o?.icon ? <Icon name={o.icon} size={14} /> : <T>Agent</T>)}
onChange={(id) =>
id === ADD_AGENT ? void executeAction("agents.addAgent") : updateDraft({ provider: id, config: {} })
}
/>
</span>
<ConfigPickers
key={provider?.id}
config={config}
@@ -265,6 +205,7 @@ export function HomeEditor({ docked = false, input }: { docked?: boolean; input?
overrides={draft.mcpOverrides}
onChange={setDraftMcpOverrides}
openRequest={mcpOpenRequest}
hideTrigger
/>
)}
</>
@@ -278,6 +219,71 @@ export function HomeEditor({ docked = false, input }: { docked?: boolean; input?
/>
}
/>
{/* Under the box: where the agent works. Project and checkout on the left, the branch on the right. */}
<div className={styles.where}>
{members.length > 1 ? (
<Select
variant="ghost"
aria-label={tx("Project")}
className={styles.projectPicker}
value={root}
options={members.map((path) => ({
value: path,
label: basename(path),
detail: path,
icon: "folder",
}))}
onChange={(path) => {
setSelected(path);
updateDraft({ base: null });
}}
/>
) : projectLabel ? (
<span className={styles.project} title={root}>
<Icon name="folder" size={14} />
<span className={styles.label}>{projectLabel}</span>
</span>
) : null}
{isGit && (
<Select
variant="ghost"
aria-label="Isolation"
value={isolation}
options={[
{
value: "local",
label: tx("Local checkout"),
icon: "folder",
detail: tx("edits your files directly"),
},
{
value: "worktree",
label: tx("New worktree"),
icon: "branch",
detail: tx("away from your changes"),
},
]}
renderValue={(o) => (o?.value === "worktree" ? tx("Worktree") : tx("Local"))}
onChange={(isolation) => updateDraft({ isolation, isolationChosen: true })}
/>
)}
{/* A folder that isn't a repository has no branch: the one Git found below it isn't where the agent runs. */}
{isolation === "local" && isGit && current && (
<span className={styles.project} title={current}>
<Icon name="branch" size={14} />
<span className={styles.label}>{current}</span>
</span>
)}
{isolation === "worktree" && branches.length > 0 && (
<Select
variant="ghost"
aria-label="Base branch"
value={base}
options={branches.map((b) => ({ value: b.name, label: b.name, icon: "branch" }))}
onChange={(b) => updateDraft({ base: b === current ? null : b })}
/>
)}
</div>
{/* Notes under the box don't take part in centring, so the box stays put as they come and go. */}
<div className={styles.notes}>
{effortAnnouncement && (
@@ -290,11 +296,9 @@ export function HomeEditor({ docked = false, input }: { docked?: boolean; input?
<T>Choose another model before starting.</T>
</p>
)}
{probe && (!docked || probe.error) && (
<p className={probe.error ? styles.warning : styles.note}>
{probe.error
? txTemplate(`${provider?.name ?? probe.provider} didn't start: ${probe.error}`)
: [probe.name, probe.version, probe.protocol].filter(Boolean).join(" · ")}
{probe?.error && (
<p className={styles.warning}>
{txTemplate(`${provider?.name ?? probe.provider} didn't start: ${probe.error}`)}
</p>
)}
{(error || (provider && !provider.installed)) && (
+9
View File
@@ -211,3 +211,12 @@
color: var(--fg-muted);
font-size: var(--fs-tiny);
}
/* The composer is the nearest positioned box: its bottom-right corner. */
.hiddenAnchor {
position: absolute;
right: 0;
bottom: 0;
width: 0;
height: 0;
}
+40 -29
View File
@@ -34,6 +34,8 @@ export interface McpPickerProps {
busy?: boolean;
/** Bumped when `/mcp` is invoked from the composer to open this popover. */
openRequest?: number;
/** No button of its own: opened only through `openRequest`, above the composer. */
hideTrigger?: boolean;
/** Optional overrides for unit tests. */
backend?: McpBackend;
testData?: {
@@ -50,6 +52,7 @@ export function McpPicker({
disabled = false,
busy = false,
openRequest = 0,
hideTrigger = false,
backend = defaultMcpBackend,
testData,
}: McpPickerProps) {
@@ -67,7 +70,10 @@ export function McpPicker({
const [seenOpenRequest, setSeenOpenRequest] = useState(openRequest);
const [query, setQuery] = useState("");
const [importingKey, setImportingKey] = useState<string | null>(null);
const anchor = useRef<HTMLButtonElement>(null);
const anchor = useRef<HTMLElement | null>(null);
const setAnchor = (el: HTMLElement | null) => {
anchor.current = el;
};
if (openRequest !== seenOpenRequest) {
setSeenOpenRequest(openRequest);
@@ -134,38 +140,43 @@ export function McpPicker({
return (
<>
<button
ref={anchor}
type="button"
disabled={disabled}
className={styles.trigger}
title={
resolved.overrideCount > 0
? formatMessage(tx("MCP servers ({active}/{total} active · {overrides} session overrides)"), {
active: resolved.activeCount,
total: resolved.totalCount,
overrides: resolved.overrideCount,
})
: formatMessage(tx("MCP servers ({active}/{total} active)"), {
active: resolved.activeCount,
total: resolved.totalCount,
})
}
aria-label={tx("MCP servers")}
aria-haspopup="dialog"
aria-expanded={open}
onClick={toggleOpen}
>
<Icon name="plugin" size={13} />
<span className={styles.triggerLabel}>MCP</span>
<span className={styles.triggerCount}>{countLabel}</span>
{resolved.overrideCount > 0 && <span className={styles.overrideDot} aria-hidden />}
</button>
{hideTrigger ? (
// Pinned to the composer's bottom-right corner: the popover opens under the box, like its other pickers.
<span ref={setAnchor} className={styles.hiddenAnchor} aria-hidden />
) : (
<button
ref={setAnchor}
type="button"
disabled={disabled}
className={styles.trigger}
title={
resolved.overrideCount > 0
? formatMessage(tx("MCP servers ({active}/{total} active · {overrides} session overrides)"), {
active: resolved.activeCount,
total: resolved.totalCount,
overrides: resolved.overrideCount,
})
: formatMessage(tx("MCP servers ({active}/{total} active)"), {
active: resolved.activeCount,
total: resolved.totalCount,
})
}
aria-label={tx("MCP servers")}
aria-haspopup="dialog"
aria-expanded={open}
onClick={toggleOpen}
>
<Icon name="plugin" size={13} />
<span className={styles.triggerLabel}>MCP</span>
<span className={styles.triggerCount}>{countLabel}</span>
{resolved.overrideCount > 0 && <span className={styles.overrideDot} aria-hidden />}
</button>
)}
<Popup
open={open}
anchor={anchor}
placement="top-start"
placement={hideTrigger ? "bottom-end" : "top-start"}
offset={6}
onClose={() => {
setOpen(false);
+28 -46
View File
@@ -83,55 +83,38 @@
max-width: none;
}
.providerIcon {
color: var(--fg-muted);
}
/* The task's state and its terminal and changes, just above the composer. */
/* Under the composer: where the task works on the left; changes, meters and terminal on the right. */
.statusBar {
display: flex;
/* What doesn't fit moves to the next line whole, instead of every fact shrinking to a letter. */
flex-wrap: wrap;
/* The changes chip sits above the line; the facts stay on that line's baseline. */
align-items: flex-end;
gap: var(--space-0-5) var(--space-1-5);
align-items: center;
gap: var(--space-2);
min-width: 0;
padding: 0 2px;
height: 24px;
padding: 0 6px;
overflow: hidden;
color: var(--fg-subtle);
font-size: var(--fs-small);
}
/* The facts on the bar's line are as tall as its chips, so their text shares one centre line. */
.agent {
display: inline-flex;
flex: 0 1 auto;
max-width: 100%;
align-items: center;
gap: var(--space-1);
height: 22px;
min-width: 0;
color: var(--fg-secondary);
}
.agentName {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Where the task works, as the new-task composer shows it. */
.where {
display: inline-flex;
flex: 0 1 auto;
max-width: 100%;
align-items: center;
/* The chips' own padding spaces them. */
gap: var(--space-0-5);
gap: var(--space-2);
min-width: 0;
overflow: hidden;
}
.note {
flex: none;
color: var(--fg-subtle);
.fact {
display: inline-flex;
flex: 0 1 auto;
align-items: center;
gap: var(--space-1);
min-width: 0;
white-space: nowrap;
}
.factText {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.state {
display: inline-flex;
@@ -145,16 +128,15 @@
.statusEnd {
display: inline-flex;
flex: 1 1 auto;
flex-wrap: wrap;
justify-content: flex-end;
align-items: center;
gap: var(--space-0-5) var(--space-2);
gap: var(--space-2);
min-width: 0;
}
/* Shrinks before the terminal buttons do: in a narrow docked session the meters clip, not the controls. */
.statusMeters {
display: inline-flex;
flex: 0 1 auto;
margin-left: auto;
align-items: center;
height: 22px;
gap: var(--space-2);
@@ -177,16 +159,18 @@
min-width: 0;
}
.statusChip {
composes: surface from "../../ui/Chip.module.css";
display: inline-flex;
align-items: center;
gap: var(--space-1-5);
height: 22px;
max-width: 100%;
min-width: 0;
padding: 0 8px;
padding: 0 6px;
overflow: hidden;
border: none;
color: var(--fg-secondary);
border-radius: var(--radius-control);
background: transparent;
color: inherit;
font: inherit;
font-size: var(--fs-small);
font-variant-numeric: tabular-nums;
@@ -397,12 +381,10 @@
--session-card-width: 96%;
}
}
/* A narrow docked session: rather than cut every fact to a letter or two, the bar keeps the
agent's icon and its state; where it works is in the task's tooltip and Changes. */
/* A narrow docked session: where it works gives way first, the changes and meters stay readable. */
@container (max-width: 420px) {
.where,
.agentName {
display: none;
.where {
flex-shrink: 2;
}
.processBody,
.turnBody {
+41 -44
View File
@@ -38,7 +38,6 @@ import { confirm } from "@/workbench/messages";
import {
Button,
Checkbox,
Chip,
EmptyState,
Icon,
IconButton,
@@ -417,41 +416,34 @@ function SessionStatus({
showContextMenu(e, taskMenu([task]));
}}
>
<span className={styles.agent} title={`${providerName(task.provider)} · ${task.cwd}`}>
<Icon name={providerIcon(task.provider)} size={13} className={styles.providerIcon} />
<span className={styles.agentName}>
{providerName(task.provider)}
{/* The composer's model picker shows the model when the agent offers one. */}
{task.model && !pickedModel ? ` · ${task.model}` : ""}
</span>
</span>
{/* The same three facts as the new-task composer: project, checkout, branch. */}
<span className={styles.where}>
{projectName && (
<Chip icon="folder" title={projectRoot ?? undefined}>
{projectName}
</Chip>
{/* Where the task works, in one quiet line like the new-task page: project (in a workspace), branch, worktree. */}
<span className={styles.where} title={task.cwd}>
{project?.workspace && projectName && (
<span className={styles.fact}>
<Icon name="folder" size={13} />
<span className={styles.factText}>{projectName}</span>
</span>
)}
<Chip icon={local ? "folder" : "branch"}>
<T>{local ? "Local checkout" : "New worktree"}</T>
</Chip>
{branch && (
<>
{local && (
<span className={styles.note}>
<T>on</T>
</span>
)}
<Chip icon="branch" title={branch}>
{branch}
</Chip>
</>
<span className={styles.fact}>
<Icon name="branch" size={13} />
<span className={styles.factText}>{branch}</span>
</span>
)}
{!local && (
<span className={styles.fact}>
<T>Worktree</T>
</span>
)}
{task.model && !pickedModel && <span className={styles.fact}>{task.model}</span>}
</span>
<span className={styles.state}>
<T>{statusLabel(task.status)}</T>
{task.status === "limited" && task.resetsMs != null && ` · ${tx`resets ${formatSentAt(task.resetsMs)}`}`}
</span>
{/* Ready is the usual state: only the others are worth a word. */}
{task.status !== "ready" && (
<span className={styles.state}>
<T>{statusLabel(task.status)}</T>
{task.status === "limited" && task.resetsMs != null && ` · ${tx`resets ${formatSentAt(task.resetsMs)}`}`}
</span>
)}
<span className={styles.state} role="status" aria-live="polite" aria-atomic="true">
{effortAnnouncement ? tx("Effort: {level}").replace("{level}", effortAnnouncement) : ""}
</span>
@@ -539,7 +531,7 @@ function Usage({ usage }: { usage: AgentUsage }) {
<span className={styles.usageBar} aria-hidden>
<span style={{ width: `${label.percent}%` }} />
</span>
{label.short}
{`${label.percent}%`}
</span>
);
}
@@ -2906,20 +2898,11 @@ function SessionComposer({
body: String(e),
}),
);
const openMcp = () => setMcpOpenRequest((n) => n + 1);
const shown = useEditorShown();
const effortAnnouncement = useEffortFocus(focusRoot, shown && task.status !== "archived", task.config, setOption);
return (
<div className={styles.composerArea}>
<SessionStatus
task={task}
entries={entries}
head={head}
changes={changes}
commits={commits}
changesOpen={changesOpen}
onToggleChanges={onToggleChanges}
effortAnnouncement={effortAnnouncement}
/>
{task.status === "archived" && (
<div className={styles.banner}>
<span className={styles.bannerText}>
@@ -2958,8 +2941,11 @@ function SessionComposer({
config={task.config}
onConfig={setOption}
onSubmit={send}
onOpenMcp={() => setMcpOpenRequest((n) => n + 1)}
onOpenMcp={openMcp}
disabled={task.status === "archived"}
addMenu={[
{ id: "mcp", label: "MCP Servers…", icon: "plugin", disabled: task.status === "archived", run: openMcp },
]}
toolbar={
<>
<ConfigPickers config={task.config} onChange={setOption} />
@@ -2969,6 +2955,7 @@ function SessionComposer({
disabled={task.status === "archived"}
busy={busy}
openRequest={mcpOpenRequest}
hideTrigger
onChange={(next) =>
void setTaskMcpOverrides(task.id, next).catch((e: unknown) =>
notifications().notify({
@@ -2994,6 +2981,16 @@ function SessionComposer({
</>
}
/>
<SessionStatus
task={task}
entries={entries}
head={head}
changes={changes}
commits={commits}
changesOpen={changesOpen}
onToggleChanges={onToggleChanges}
effortAnnouncement={effortAnnouncement}
/>
</div>
);
}
+6 -8
View File
@@ -318,7 +318,7 @@ describe("Composer editing", () => {
});
describe("Composer current file", () => {
it("offers the focused editor's file until the draft references it", () => {
it("offers the focused editor's file, and adds it with the selection to requests when chosen", () => {
const view = {} as TextEditorHandle["view"];
act(() => setIdeContext(false));
act(() =>
@@ -329,10 +329,10 @@ describe("Composer current file", () => {
const offer = screen.getByRole("button", { name: /main\.ts/ });
expect(offer).toHaveTextContent("Current File");
fireEvent.click(offer);
expect(composerDraft(ID).text).toBe("@src/main.ts ");
expect(toPrompt(composerDraft(ID)).files).toEqual(["/p/src/main.ts"]);
expect(useAgents.getState().ideContext).toBe(true);
expect(composerDraft(ID).text).toBe("");
expect(screen.queryByRole("button", { name: /main\.ts/ })).toBeNull();
expect(document.querySelector("[data-ref-path]")).toHaveAttribute("data-ref-path", "/p/src/main.ts");
expect(screen.getByTitle("src/main.ts is added to your request")).toHaveTextContent("Current File");
} finally {
act(() => useEditorRegistry.setState({ active: null }));
}
@@ -348,8 +348,6 @@ describe("Composer IDE context", () => {
);
try {
renderComposer();
const toggle = screen.getByRole("button", { name: /IDE Context Enabled/ });
expect(toggle).toHaveAttribute("aria-pressed", "true");
expect(screen.queryByRole("button", { name: /main\.ts/ })).toBeNull();
expect(screen.getByTitle("src/main.ts is added to your request")).toHaveTextContent("Current File");
@@ -369,9 +367,9 @@ describe("Composer IDE context", () => {
// A draft that already references the file is sent as written.
expect(await send("see @src/main.ts:1")).toEqual({ text: "see @src/main.ts:1", files: [], images: [] });
fireEvent.click(toggle);
fireEvent.click(screen.getByRole("button", { name: "Don't Add the Current File" }));
expect(useAgents.getState().ideContext).toBe(false);
expect(screen.getByRole("button", { name: /IDE Context Disabled/ })).toHaveAttribute("aria-pressed", "false");
expect(screen.getByRole("button", { name: /main\.ts/ })).toHaveTextContent("Current File");
expect(await send("explain")).toEqual({ text: "explain", files: [], images: [] });
} finally {
act(() => useEditorRegistry.setState({ active: null }));
-8
View File
@@ -385,14 +385,6 @@ export const isContextOption = (id: string) => /^(context_tier|contextTier)$/.te
export const isPerModelOption = (o: AgentConfigOption) =>
o.category === "thought_level" || o.category === "context_tier" || isContextOption(o.id);
/** Formats a per-1M-token credit rate cleanly (`200`, `1000`, `0`, `12.5`). */
export function formatCreditRate(rate: number | null | undefined): string {
if (rate == null || !Number.isFinite(rate)) return "0";
if (rate === 0) return "0";
if (rate < 0.01) return rate.toExponential(2);
return Number(rate.toFixed(4)).toString();
}
const matchesCategory = (o: AgentConfigOption, category: string) =>
o.category === category ||
(category === "model_config" &&
+6 -4
View File
@@ -152,6 +152,7 @@ it("keeps cached choices usable while refreshing and shares the completion/coold
expect(screen.getByRole("button", { name: "Start" })).toBeEnabled();
await waitFor(() => expect(useAgents.getState().modelRequests.size).toBe(0));
emit(catalog("first", { retryAtMs: Date.now() + 30_000 }));
fireEvent.click(screen.getByRole("button", { name: "Model" }));
expect(screen.getByRole("button", { name: /Refresh in \d+s/ })).toBeDisabled();
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("small");
fireEvent.click(screen.getByRole("button", { name: "Start" }));
@@ -213,11 +214,12 @@ it("retains cached model and effort choices after a command failure and retries
draft: savedDraft({ provider: "first", config: { model: "big" }, thoughtLevels: { big: { effort: "low" } } }),
});
render(<HomeEditor />);
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("low");
fireEvent.click(screen.getByRole("button", { name: "Model" }));
expect(await screen.findByRole("alert")).toHaveTextContent("connection lost");
expect(screen.getByRole("button", { name: "Configure model" })).toHaveTextContent("biglow");
fireEvent.click(screen.getByRole("option", { name: "small" }));
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("small");
fireEvent.click(screen.getByRole("button", { name: "Model" }));
fireEvent.click(screen.getByRole("button", { name: "Refresh models" }));
await waitFor(() => expect(screen.queryByRole("alert")).not.toBeInTheDocument());
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("small");
@@ -238,11 +240,11 @@ it("preserves a valid remembered model and effort when discovery changes the def
);
render(<HomeEditor />);
await waitFor(() => expect(useAgents.getState().modelRequests.size).toBe(0));
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("biglow");
expect(screen.getByRole("button", { name: "Model" })).toHaveTextContent("big");
expect(screen.getByRole("button", { name: "Reasoning" })).toHaveTextContent("low");
fireEvent.click(screen.getByRole("button", { name: "Model" }));
expect(screen.getByRole("option", { name: "new" })).toBeVisible();
fireEvent.click(screen.getByRole("button", { name: "Configure model" }));
expect(screen.getByRole("radio", { name: "low" })).toHaveAttribute("aria-checked", "true");
fireEvent.keyDown(document, { key: "Escape" });
fireEvent.click(screen.getByRole("button", { name: "Start" }));
await waitFor(() => expect(backend.create).toHaveBeenCalled());
expect(backend.create.mock.calls[0]![0].config).toEqual([
+3 -1
View File
@@ -2016,7 +2016,9 @@ describe("meters in the task header", () => {
render(<SessionEditor input={input("A")} />);
await screen.findByText("Answer A");
const usage = screen.getByLabelText(/^Context /);
expect(usage).toHaveTextContent("24k/200k (12%)");
// The bar and percent show; the counts are in its label and tooltip.
expect(usage).toHaveTextContent("12%");
expect(usage).toHaveAccessibleName(/24k\/200k \(12%\)/);
expect(usage.querySelector(`.${styles.usageBar} span`)).toHaveStyle({
width: "12%",
});
-14
View File
@@ -58,29 +58,18 @@
"Unpin Agent Tasks": "Unpin Agent Tasks",
"New Agent Task Group": "New Agent Task Group",
"Refresh models": "Refresh models",
"Configure model": "Configure model",
"Configure {name}": "Configure {name}",
"Back to models": "Back to models",
"Reset to defaults": "Reset to defaults",
"Pin model": "Pin model",
"Unpin model": "Unpin model",
"Pinned": "Pinned",
"Models": "Models",
"Effort Level": "Effort Level",
"Context Size": "Context Size",
"Pricing details": "Pricing details",
"Free": "Free",
"Low cost": "Low cost",
"Medium cost": "Medium cost",
"High cost": "High cost",
"Very high cost": "Very high cost",
"Credits per 1M tokens": "Credits per 1M tokens",
"Input": "Input",
"Output": "Output",
"Cache Read": "Cache Read",
"Cache Write": "Cache Write",
"Multiplier": "Multiplier",
"XHigh": "XHigh",
"model": "model",
"Refreshing…": "Refreshing…",
"Refresh in {seconds}s": "Refresh in {seconds}s",
@@ -1629,7 +1618,6 @@
"Archived ({count})": "Archived ({count})",
"Insert": "Insert",
"Drop to reference": "Drop to reference",
"Reference {rel}": "Reference {rel}",
"Folder reference {name}": "Folder reference {name}",
"File reference {name}": "File reference {name}",
"File reference {name}, lines {lines}": "File reference {name}, lines {lines}",
@@ -2018,8 +2006,6 @@
"Add SDK": "Add SDK",
"Remove SDK": "Remove SDK",
"{rel} is added to your request": "{rel} is added to your request",
"IDE Context Enabled: the current file and selection are added to your request": "IDE Context Enabled: the current file and selection are added to your request",
"IDE Context Disabled: the current file and selection are not added to your request": "IDE Context Disabled: the current file and selection are not added to your request",
"Thymeleaf": "Thymeleaf",
"sbt": "sbt",
"sbt actions": "sbt actions",
-1
View File
@@ -3496,7 +3496,6 @@
"Not installed": "No instalado",
"{command} was not found on PATH": "No se encontró {command} en PATH",
"Agent tasks": "Tareas de agente",
"Describe a task for the agent. @ references a file or folder, / runs a command": "Describe una tarea para el agente. @ referencia un archivo o carpeta, / ejecuta un comando",
"away from your changes": "separado de tus cambios",
"edits your files directly": "edita tus archivos directamente",
"from": "desde",
-1
View File
@@ -3369,7 +3369,6 @@
"Not installed": "Non installé",
"{command} was not found on PATH": "{command} est introuvable dans le PATH",
"Agent tasks": "Tâches d'agent",
"Describe a task for the agent. @ references a file or folder, / runs a command": "Décrivez une tâche pour l'agent. @ référence un fichier ou un dossier, / lance une commande",
"away from your changes": "à l'écart de vos modifications",
"edits your files directly": "modifie directement vos fichiers",
"from": "depuis",
-2
View File
@@ -3546,7 +3546,6 @@
"Not installed": "설치되지 않음",
"{command} was not found on PATH": "PATH에서 {command}을(를) 찾을 수 없습니다",
"Agent tasks": "에이전트 작업",
"Describe a task for the agent. @ references a file or folder, / runs a command": "에이전트에게 맡길 작업을 설명하세요. @는 파일·폴더 참조, /는 명령 실행",
"away from your changes": "변경 사항과 분리됨",
"edits your files directly": "파일을 직접 편집함",
"from": "기준",
@@ -6224,7 +6223,6 @@
"Count rows": "행 개수 세기",
"Last Page": "마지막 페이지",
"{first}-{last} of {total}": "{total}개 중 {first}-{last}",
"Model & effort settings": "모델 및 추론 강도 설정",
"Device": "기기",
"No devices": "기기 없음",
"Minimum level": "최소 수준",
+8 -17
View File
@@ -51,27 +51,16 @@
"Unpin Agent Tasks": "取消固定 Agent 任务",
"New Agent Task Group": "新建 Agent 任务组",
"Refresh models": "刷新模型",
"Configure model": "配置模型",
"Configure {name}": "配置 {name}",
"Back to models": "返回模型列表",
"Reset to defaults": "重置为默认值",
"Pin model": "置顶模型",
"Unpin model": "取消置顶模型",
"Models": "模型",
"Effort Level": "思考强度",
"Context Size": "上下文大小",
"Pricing details": "价格详情",
"Free": "免费",
"Low cost": "低开销",
"Medium cost": "中等开销",
"High cost": "高开销",
"Very high cost": "极高开销",
"Credits per 1M tokens": "每百万 Token 点数",
"Input": "输入",
"Cache Read": "缓存读取",
"Cache Write": "缓存写入",
"Multiplier": "倍率",
"XHigh": "超高",
"model": "模型",
"Refreshing…": "正在刷新…",
"Refresh in {seconds}s": "{seconds} 秒后可刷新",
@@ -4222,7 +4211,6 @@
"Not installed": "未安装",
"{command} was not found on PATH": "在 PATH 中找不到 {command}",
"Agent tasks": "Agent 任务",
"Describe a task for the agent. @ references a file or folder, / runs a command": "描述要交给 agent 的任务。@ 引用文件或文件夹,/ 运行命令",
"away from your changes": "不影响你的改动",
"edits your files directly": "直接修改你的文件",
"from": "基于",
@@ -6958,7 +6946,6 @@
"Count rows": "统计行数",
"Last Page": "最后一页",
"{first}-{last} of {total}": "{first}-{last},共 {total}",
"Model & effort settings": "模型与推理强度",
"Logcat": "Logcat 日志",
"Device": "设备",
"No devices": "没有设备",
@@ -8024,7 +8011,6 @@
"Archived ({count})": "归档({count})",
"Insert": "插入",
"Drop to reference": "松开以引用",
"Reference {rel}": "引用 {rel}",
"Folder reference {name}": "文件夹引用 {name}",
"File reference {name}": "文件引用 {name}",
"File reference {name}, lines {lines}": "文件引用 {name},第 {lines} 行",
@@ -8405,8 +8391,6 @@
"Add SDK": "添加 SDK",
"Remove SDK": "移除 SDK",
"{rel} is added to your request": "{rel} 会添加到你的请求中",
"IDE Context Enabled: the current file and selection are added to your request": "IDE 上下文已启用:当前文件和所选内容会添加到你的请求中",
"IDE Context Disabled: the current file and selection are not added to your request": "IDE 上下文已禁用:当前文件和所选内容不会添加到你的请求中",
"Thymeleaf": "Thymeleaf",
"sbt": "sbt",
"sbt actions": "sbt 操作",
@@ -8544,5 +8528,12 @@
"Untitled files were not saved": "未命名文件未保存",
"Missing blank line between subject and body": "主题和正文之间缺少空行",
"Body line {0} is longer than {1} characters": "正文第 {0} 行超过 {1} 个字符",
"Add blank line": "添加空行"
"Add blank line": "添加空行",
"Worktree": "worktree",
"Add Context": "添加上下文",
"MCP Servers…": "MCP 服务器…",
"Describe a task. @ for files, / for commands": "描述一个任务。@ 引用文件,/ 运行命令",
"Effort": "推理",
"Don't Add the Current File": "不附带当前文件",
"Add {rel} and the selection to your requests": "在请求中附带 {rel} 和选区"
}