feat(app): redesign the goal pill (#60001)

The goal plugin's pill gets its own glyphs: a ripple for an active goal, a faded dot when paused and a check once reached. They are three SVG files the plugin declares and names through ctx.icons, so the host colors them by tone, keeps the ripple running while the pill renders again and holds it under reduced motion. The labels now read Following goal, Goal paused and Goal reached.

The popover leads with the objective. Once the goal has a reason, a divider and the colored status follow with the reason under it. Pause or Resume sit beside a red Clear, and a reached goal offers only Dismiss.

A pill's own popover (menu) no longer gets a host heading. The host keeps the popover's frame, and everything inside belongs to the plugin; the view's title names the popover for assistive technology.

A pill that starts with an icon now sits it 8px from the edge with a 6px gap to its label, through one rule on the shared pill. The activity menu's rows follow the capsule's new inset and gap.

Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com>
This commit is contained in:
Aarav Sareen
2026-11-18 15:41:22 +05:30
committed by GitHub
Unverified
parent 22377659a8
commit d412042beb
17 changed files with 196 additions and 69 deletions
@@ -2042,7 +2042,7 @@ story("composer pills show per session, open their rows, and fail only their own
await expect(page.locator("body")).toHaveAttribute("data-picked", "12")
})
story("a composer pill with a menu opens the plugin's content under the host's heading", async ({ page }) => {
story("a composer pill with a menu opens only the plugin's content, named by the view", async ({ page }) => {
await page.evaluate(async (fixture) => {
const { mountComposerPills, until, ComposerPill } = await import(fixture)
@@ -2078,7 +2078,9 @@ story("a composer pill with a menu opens the plugin's content under the host's h
await pill.click()
const popover = page.locator('[data-slot="session-plugin-pill-popover"]')
await expect(popover.getByText("Ship the release")).toBeVisible()
// The popover is the plugin's alone: the title names it but the host draws no heading.
await expect(popover).toHaveAttribute("aria-label", "Ship the release")
await expect(popover.getByText("Ship the release")).toHaveCount(0)
await expect(popover.locator('[data-slot="session-plugin-pill-row"]')).toHaveCount(0)
await expect(popover.getByTestId("goal-pause")).toHaveText("Pause /repo")
@@ -8,7 +8,7 @@
/*
* The open panel sits just above the capsule, with their inline-start edges aligned, and its rows share the capsule's
* grid: the same hairline and 10px inset put row glyphs on the capsule's glyph, and the same 16px glyph and 8px gap put
* grid: the same hairline and 8px inset put row glyphs on the capsule's glyph, and the same 16px glyph and 6px gap put
* row text on the capsule's label. Rows are subgrids of one table, so agent names, descriptions and run times each
* line up in a column; descriptions take the remaining width and truncate only when the panel reaches its maximum.
*/
@@ -37,7 +37,7 @@
display: grid;
grid-template-columns: auto auto minmax(0, 1fr) auto;
align-content: start;
column-gap: 8px;
column-gap: 6px;
}
[data-slot="menu-v2-item-content"] > span[dir] {
@@ -49,17 +49,19 @@
unicode-bidi: isolate;
}
/* With the list's 4px padding, rows inset 10px like the capsule's content, at the end as at the start. */
/* With the list's 4px padding, rows inset 8px like the capsule's content, at the end as at the start. */
[data-component="menu-v2-item"],
[data-slot="menu-v2-item-content"] {
display: grid;
grid-column: 1 / -1;
grid-template-columns: subgrid;
align-items: center;
/* The table's gap in place of a menu row's own 8px, which would shift each row's columns off the table's. */
column-gap: 6px;
}
[data-component="menu-v2-item"] {
padding-inline: 6px;
padding-inline: 4px;
border-radius: 4px;
}
@@ -180,7 +180,9 @@ export function SessionActivityChips(props: {
class="tabular-nums duration-150 ease-out motion-reduce:animate-none"
classList={{ "animate-in fade-in": view().enter }}
>
<SessionProgressIndicatorV2 class="shrink-0" />
<span data-composer-pill-icon class="flex size-4 shrink-0 items-center justify-center">
<SessionProgressIndicatorV2 />
</span>
<span data-slot="session-activity-summary" class="flex min-w-0 items-center gap-2 overflow-hidden">
{language.activitySummaryRich(counts(), (text) => (
<span class="truncate">
@@ -59,6 +59,12 @@
}
}
/* A leading icon sits closer to the edge and to its label than text does. */
[data-composer-pill]:has(> [data-composer-pill-icon]:first-child) {
gap: 6px;
padding-inline-start: 8px;
}
/* The popover a pill opens, just above it. */
[data-composer-pill-panel] {
max-width: calc(100vw - 56px);
@@ -113,11 +113,6 @@ function PluginPill(props: { pill: ComposerPill; input: ComposerPillProps; align
data-composer-pill-panel
class="w-80 p-1"
>
<div class="px-2 pt-1 pb-1.5 text-[11px] font-[530] tracking-[0.05px] leading-[var(--line-height-tight)] text-v2-text-text-faint">
<span dir="auto" class="line-clamp-3 break-words">
{current().title ?? current().label}
</span>
</div>
{/* Untracked: the content renders once per open; its own reactivity updates it in place. */}
{untrack(() =>
menu()({
@@ -197,11 +192,13 @@ function PillIcon(props: { name?: IconName; tone?: ComposerPillTone }) {
return (
<Show when={props.name}>
{(name) => (
<Icon
name={name()}
size="small"
class={`shrink-0 ${props.tone ? tones[props.tone] : "text-v2-icon-icon-muted"}`}
/>
<span data-composer-pill-icon class="flex size-4 shrink-0 items-center justify-center">
<Icon
name={name()}
size="small"
class={`shrink-0 ${props.tone ? tones[props.tone] : "text-v2-icon-icon-muted"}`}
/>
</span>
)}
</Show>
)
@@ -1,8 +1,3 @@
[data-composer-pill][data-slot="session-todo-pill"] {
gap: 6px;
padding-inline-start: 8px;
}
[data-composer-pill-panel][data-slot="session-todo-panel"] {
width: max-content;
min-width: max(var(--kb-popper-anchor-width, 0px), 240px);
@@ -44,7 +44,9 @@ export function SessionTodoPill(props: { todos: readonly Todo[]; defaultOpen?: b
<Show when={current()}>
{(todo) => (
<>
<TodoGlyph status={todo().status} />
<span data-composer-pill-icon class="flex size-4 shrink-0 items-center justify-center">
<TodoGlyph status={todo().status} />
</span>
<span dir="auto" class="min-w-0 max-w-[260px] truncate">
{todo().content}
</span>
+13 -8
View File
@@ -269,28 +269,33 @@ Every SDK icon field (`SettingsPage.icon`, `ComposerPillView.icon`, `ComposerNot
- **Stored names.** A name is a plain string. A composer note or quote keeps it with the draft and the sent message, and a closed tab keeps it in the session's layout. While the plugin that declared the icon is not active, the icon draws nothing and keeps its size.
- **In the app.** `Icon` from `@opencode/ui/icon` draws a plugin's icon by the same name, so every part of the app that takes an icon name shows it. App code with artwork of its own registers it with `registerIcons` from `@opencode/ui/icons/registry`.
The goal plugin declares the icon of its composer pill:
The goal plugin declares the glyphs of its composer pill, one for each goal status. The active one moves:
<!-- source: src/goal/index.ts -->
```ts
import { Plugin } from "@opencode/plugin/gui"
import en from "./i18n/en"
import steer from "./icons/steer.svg?raw"
import active from "./icons/active.svg?raw"
import complete from "./icons/complete.svg?raw"
import paused from "./icons/paused.svg?raw"
export default Plugin.define({ icons: { steer }, i18n: { en } })
// The pill's glyph of each goal status. Each is framed to its 14px ring, the size of a pill's icon, so it draws at
// full size there.
export default Plugin.define({ icons: { active, paused, complete }, i18n: { en } })
```
Its pill then names that icon beside the app's own:
Its pill then names the glyph of the goal's status, and the host colors it by `tone`:
<!-- source: src/goal/renderer.tsx#status -->
```ts
// The pill of each status. An active goal shows the plugin's own icon; the others show the app's.
// The pill and the popover's status line of each goal status. The pill shows the plugin's own glyphs: the host
// colors a paused and a reached goal by `tone`, and the active glyph carries the accent color itself.
const status = {
active: { label: "title", icon: ctx.icons.steer, tone: undefined },
paused: { label: "paused", icon: "circle-exclamation", tone: "warning" },
complete: { label: "met", icon: "circle-check", tone: "success" },
active: { label: "active", status: "statusActive", icon: ctx.icons.active, tone: undefined },
paused: { label: "paused", status: "statusPaused", icon: ctx.icons.paused, tone: "warning" },
complete: { label: "reached", status: "statusFinished", icon: ctx.icons.complete, tone: "success" },
} as const
```
+43
View File
@@ -0,0 +1,43 @@
/* With the host popover's 4px inset, the content sits 8px from the top and 12px from the other edges. */
[data-component="goal-panel"] {
display: flex;
flex-direction: column;
gap: 8px;
padding: 4px 8px 8px;
}
:is([data-slot="goal-objective"], [data-slot="goal-reason"]) {
margin: 0;
font-size: 13px;
line-height: var(--line-height-base);
letter-spacing: -0.04px;
color: var(--v2-text-text-base);
white-space: pre-wrap;
}
[data-slot="goal-objective"] {
max-height: 160px;
overflow-y: auto;
}
/* The hairline runs the popover's full width, through its inset and the panel's padding. */
[data-slot="goal-divider"] {
flex: none;
margin-inline: -12px;
border-top: 0.5px solid var(--v2-border-border-base);
}
[data-slot="goal-status"] {
font-size: 12px;
line-height: 18px;
letter-spacing: 0.05px;
color: var(--v2-text-text-accent);
&[data-status="paused"] {
color: var(--v2-state-fg-warning);
}
&[data-status="complete"] {
color: var(--v2-state-fg-success);
}
}
+6 -2
View File
@@ -1,8 +1,12 @@
export default {
title: "Goal",
active: "Following goal",
paused: "Goal paused",
met: "Goal met",
reached: "Goal reached",
statusActive: "Active",
statusPaused: "Paused",
statusFinished: "Finished",
pause: "Pause",
resume: "Resume",
clear: "Clear",
dismiss: "Dismiss",
}
@@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="1 1 14 14" fill="none">
<g style="color: var(--v2-icon-icon-accent)">
<circle cx="8" cy="8" r="6.5" stroke="currentColor"/>
<circle cx="8" cy="8" r="2" fill="currentColor">
<animate attributeName="r" dur="2.4s" repeatCount="indefinite" calcMode="spline" values="2;2;5.6;5.6" keyTimes="0;0.16667;0.91667;1" keySplines="0 0 1 1;0.2 0.6 0.35 1;0 0 1 1"/>
<animate attributeName="opacity" dur="2.4s" repeatCount="indefinite" calcMode="spline" values="1;1;0;0" keyTimes="0;0.16667;0.91667;1" keySplines="0 0 1 1;0.3 0.4 0.5 1;0 0 1 1"/>
</circle>
<circle cx="8" cy="8" r="2" fill="currentColor">
<animate attributeName="r" dur="2.4s" repeatCount="indefinite" calcMode="spline" values="2;2;0;0;2;2" keyTimes="0;0.16666;0.16667;0.33333;0.75;1" keySplines="0 0 1 1;0 0 1 1;0 0 1 1;0.33 0 0.2 1;0 0 1 1"/>
<animate attributeName="opacity" dur="2.4s" repeatCount="indefinite" calcMode="spline" values="1;1;0;0;1;1" keyTimes="0;0.16666;0.16667;0.33333;0.75;1" keySplines="0 0 1 1;0 0 1 1;0 0 1 1;0.33 0 0.2 1;0 0 1 1"/>
</circle>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="1 1 14 14" fill="none">
<circle cx="8" cy="8" r="6.5" stroke="currentColor"/>
<path d="M5 8 7.5 11 11 5.5" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 261 B

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="1 1 14 14" fill="none">
<circle cx="8" cy="8" r="6.5" stroke="currentColor"/>
<circle cx="8" cy="8" r="4" fill="currentColor" opacity="0.5"/>
</svg>

After

Width:  |  Height:  |  Size: 225 B

@@ -1,4 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
<path d="M8 14C11.3137 14 14 11.3137 14 8C14 4.68634 11.3137 2 8 2C4.68626 2 2 4.68634 2 8C2 11.3137 4.68626 14 8 14Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8 3.86328V12.1391C10.2854 12.1391 12.1379 10.2863 12.1379 8.00121C12.1379 5.71608 10.2854 3.86328 8 3.86328Z" fill="currentColor"/>
</svg>

Before

Width:  |  Height:  |  Size: 439 B

+6 -2
View File
@@ -1,5 +1,9 @@
import { Plugin } from "@opencode/plugin/gui"
import en from "./i18n/en"
import steer from "./icons/steer.svg?raw"
import active from "./icons/active.svg?raw"
import complete from "./icons/complete.svg?raw"
import paused from "./icons/paused.svg?raw"
export default Plugin.define({ icons: { steer }, i18n: { en } })
// The pill's glyph of each goal status. Each is framed to its 14px ring, the size of a pill's icon, so it draws at
// full size there.
export default Plugin.define({ icons: { active, paused, complete }, i18n: { en } })
+72 -25
View File
@@ -1,8 +1,9 @@
import { createSignal, onCleanup, Show, untrack } from "solid-js"
import { ComposerPill, createKeyed, type ComposerPillProps, type Plugin } from "@opencode/plugin/gui"
import { createSignal, Match, onCleanup, Show, Switch, untrack } from "solid-js"
import { ComposerPill, createKeyed, Style, type ComposerPillProps, type Plugin } from "@opencode/plugin/gui"
import { Goal } from "@opencode/schema/goal"
import { Button } from "@opencode/ui/button"
import { showToast } from "@opencode/ui/toast"
import styles from "./goal.css?inline"
import type GoalDefinition from "./index"
import {
createGoalState,
@@ -17,16 +18,17 @@ import {
} from "./machine"
/**
* The session's `/goal` above its composer: the status as a pill, and a popover headed by the objective with the
* actions that apply. The server's goal plugin owns the goal and serves it over its RPC; a bare `/goal` shows the last
* reason.
* The session's `/goal` above its composer: the status as a pill with its own glyph, and a popover with the
* objective, the last reason and the actions that apply. The server's goal plugin owns the goal and serves it over
* its RPC; a bare `/goal` shows the last reason.
*/
const setup: Plugin.Setup<typeof GoalDefinition> = (ctx) => {
// The pill of each status. An active goal shows the plugin's own icon; the others show the app's.
// The pill and the popover's status line of each goal status. The pill shows the plugin's own glyphs: the host
// colors a paused and a reached goal by `tone`, and the active glyph carries the accent color itself.
const status = {
active: { label: "title", icon: ctx.icons.steer, tone: undefined },
paused: { label: "paused", icon: "circle-exclamation", tone: "warning" },
complete: { label: "met", icon: "circle-check", tone: "success" },
active: { label: "active", status: "statusActive", icon: ctx.icons.active, tone: undefined },
paused: { label: "paused", status: "statusPaused", icon: ctx.icons.paused, tone: "warning" },
complete: { label: "reached", status: "statusFinished", icon: ctx.icons.complete, tone: "success" },
} as const
const [goalState, setGoalState] = createSignal(createGoalState())
@@ -197,6 +199,8 @@ const setup: Plugin.Setup<typeof GoalDefinition> = (ctx) => {
action,
})
ctx.add(Style, styles)
ctx.add(ComposerPill, {
id: "goal",
show: (input) => {
@@ -206,7 +210,7 @@ const setup: Plugin.Setup<typeof GoalDefinition> = (ctx) => {
const view = status[current.status]
return { label: ctx.t(view.label), icon: view.icon, tone: view.tone, title: current.objective }
return { label: ctx.t(view.label), icon: view.icon, tone: view.tone }
},
menu: (input) => {
const busy = () => selectGoalBusy(goalState(), input.session.key)
@@ -217,21 +221,64 @@ const setup: Plugin.Setup<typeof GoalDefinition> = (ctx) => {
}
return (
<div class="flex justify-end gap-1 px-1 pt-1">
<Show when={goal(input)?.status === "active"}>
<Button size="small" variant="ghost" icon="stop" disabled={busy()} onClick={() => run("pause")}>
{ctx.t("pause")}
</Button>
</Show>
<Show when={goal(input)?.status === "paused"}>
<Button size="small" variant="ghost" icon="refresh" disabled={busy()} onClick={() => run("resume")}>
{ctx.t("resume")}
</Button>
</Show>
<Button size="small" variant="ghost" icon="trash" disabled={busy()} onClick={() => run("clear")}>
{ctx.t("clear")}
</Button>
</div>
<Show when={goal(input)}>
{(current) => (
<div data-component="goal-panel">
<p dir="auto" data-slot="goal-objective" data-scrollable>
{current().objective}
</p>
{/* Until the goal has a reason, the status is the pill's alone. */}
<Show when={current().reason}>
{(reason) => (
<>
<div data-slot="goal-divider" aria-hidden="true" />
<div class="flex flex-col">
<span data-slot="goal-status" data-status={current().status}>
{ctx.t(status[current().status].status)}
</span>
<p dir="auto" data-slot="goal-reason">
{reason()}
</p>
</div>
</>
)}
</Show>
<div class="flex flex-wrap gap-2 pt-1">
<Switch>
<Match when={current().status === "active"}>
<Button data-action="goal-pause" size="small" disabled={busy()} onClick={() => run("pause")}>
{ctx.t("pause")}
</Button>
</Match>
<Match when={current().status === "paused"}>
<Button data-action="goal-resume" size="small" disabled={busy()} onClick={() => run("resume")}>
{ctx.t("resume")}
</Button>
</Match>
</Switch>
<Show
when={current().status === "complete"}
fallback={
<Button
data-action="goal-clear"
size="small"
variant="danger"
disabled={busy()}
onClick={() => run("clear")}
>
{ctx.t("clear")}
</Button>
}
>
{/* A reached goal has nothing left to stop, so clearing it only dismisses the pill. */}
<Button data-action="goal-dismiss" size="small" disabled={busy()} onClick={() => run("clear")}>
{ctx.t("dismiss")}
</Button>
</Show>
</div>
</div>
)}
</Show>
)
},
})
+6 -5
View File
@@ -661,8 +661,8 @@ export interface ComposerPillView {
/** Colors the capsule's icon. */
readonly tone?: ComposerPillTone
/**
* Accessible name, and the heading of the menu or popover the pill opens, when it differs from `label`. The heading
* wraps to at most three lines, then truncates.
* Accessible name, and the heading of the menu of `rows`, when it differs from `label`. The heading wraps to at most
* three lines, then truncates. A pill's own popover (`menu`) has no heading; it takes this as its accessible name.
*/
readonly title?: string
/** The menu the pill opens. Omit it for a pill that runs `run` instead. Unused when the pill has a `menu`. */
@@ -690,9 +690,10 @@ export interface ComposerPill {
show(input: ComposerPillProps): ComposerPillView | undefined
/**
* Your content for the popover the pill opens, for a pill that needs more than `rows`, such as status text and
* buttons. The host owns the capsule and the popover around this content: its placement, focus, dismissal, and the
* heading (`title`, else `label`). When set, clicking the pill opens the popover, and the view's `rows` and `run` are
* unused. Renders each time the popover opens; its own reactivity updates it while open, also when another session is
* buttons. The host owns the capsule and the popover's frame: its width, a 4px inset, placement, focus and dismissal.
* Everything inside is yours, including any heading; the view's `title`, else `label`, names the popover for
* assistive technology. When set, clicking the pill opens the popover, and the view's `rows` and `run` are unused.
* Renders each time the popover opens; its own reactivity updates it while open, also when another session is
* routed. A render that throws renders nothing and records the error.
*
* @param input - The session, its screen, and `close`. Do not destructure.