diff --git a/packages/app/component-tests/plugin-host.spec.ts b/packages/app/component-tests/plugin-host.spec.ts
index 8b3d8712b29..5dc395284ea 100644
--- a/packages/app/component-tests/plugin-host.spec.ts
+++ b/packages/app/component-tests/plugin-host.spec.ts
@@ -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")
diff --git a/packages/app/src/session/composer/activity-chips.css b/packages/app/src/session/composer/activity-chips.css
index 7fb5a2f705a..a6e1f4e9b23 100644
--- a/packages/app/src/session/composer/activity-chips.css
+++ b/packages/app/src/session/composer/activity-chips.css
@@ -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;
}
diff --git a/packages/app/src/session/composer/activity-chips.tsx b/packages/app/src/session/composer/activity-chips.tsx
index b59a4438dc0..26e648ffcf6 100644
--- a/packages/app/src/session/composer/activity-chips.tsx
+++ b/packages/app/src/session/composer/activity-chips.tsx
@@ -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 }}
>
-
+
+
+
{language.activitySummaryRich(counts(), (text) => (
diff --git a/packages/app/src/session/composer/composer-lane.css b/packages/app/src/session/composer/composer-lane.css
index 64dfc1463c9..b2390fd37fb 100644
--- a/packages/app/src/session/composer/composer-lane.css
+++ b/packages/app/src/session/composer/composer-lane.css
@@ -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);
diff --git a/packages/app/src/session/composer/plugin-pills.tsx b/packages/app/src/session/composer/plugin-pills.tsx
index 86f71ce023a..a23d2f7626f 100644
--- a/packages/app/src/session/composer/plugin-pills.tsx
+++ b/packages/app/src/session/composer/plugin-pills.tsx
@@ -113,11 +113,6 @@ function PluginPill(props: { pill: ComposerPill; input: ComposerPillProps; align
data-composer-pill-panel
class="w-80 p-1"
>
-
-
- {current().title ?? current().label}
-
-
{/* 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 (
{(name) => (
-
+
+
+
)}
)
diff --git a/packages/app/src/session/composer/todo-pill.css b/packages/app/src/session/composer/todo-pill.css
index 3b17a05e586..ef879ee0bc2 100644
--- a/packages/app/src/session/composer/todo-pill.css
+++ b/packages/app/src/session/composer/todo-pill.css
@@ -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);
diff --git a/packages/app/src/session/composer/todo-pill.tsx b/packages/app/src/session/composer/todo-pill.tsx
index 63eaafce2be..fca1ba39ade 100644
--- a/packages/app/src/session/composer/todo-pill.tsx
+++ b/packages/app/src/session/composer/todo-pill.tsx
@@ -44,7 +44,9 @@ export function SessionTodoPill(props: { todos: readonly Todo[]; defaultOpen?: b
{(todo) => (
<>
-
+
+
+
{todo().content}
diff --git a/packages/gui-plugins/README.md b/packages/gui-plugins/README.md
index 1fb39aa95d9..7ceb42ded24 100644
--- a/packages/gui-plugins/README.md
+++ b/packages/gui-plugins/README.md
@@ -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:
```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`:
```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
```
diff --git a/packages/gui-plugins/src/goal/goal.css b/packages/gui-plugins/src/goal/goal.css
new file mode 100644
index 00000000000..544dcb37f22
--- /dev/null
+++ b/packages/gui-plugins/src/goal/goal.css
@@ -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);
+ }
+}
diff --git a/packages/gui-plugins/src/goal/i18n/en.ts b/packages/gui-plugins/src/goal/i18n/en.ts
index 98344bb6b09..d1e14403f08 100644
--- a/packages/gui-plugins/src/goal/i18n/en.ts
+++ b/packages/gui-plugins/src/goal/i18n/en.ts
@@ -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",
}
diff --git a/packages/gui-plugins/src/goal/icons/active.svg b/packages/gui-plugins/src/goal/icons/active.svg
new file mode 100644
index 00000000000..146bad01eaa
--- /dev/null
+++ b/packages/gui-plugins/src/goal/icons/active.svg
@@ -0,0 +1,13 @@
+
diff --git a/packages/gui-plugins/src/goal/icons/complete.svg b/packages/gui-plugins/src/goal/icons/complete.svg
new file mode 100644
index 00000000000..937c9124980
--- /dev/null
+++ b/packages/gui-plugins/src/goal/icons/complete.svg
@@ -0,0 +1,4 @@
+
diff --git a/packages/gui-plugins/src/goal/icons/paused.svg b/packages/gui-plugins/src/goal/icons/paused.svg
new file mode 100644
index 00000000000..4b1bf25487b
--- /dev/null
+++ b/packages/gui-plugins/src/goal/icons/paused.svg
@@ -0,0 +1,4 @@
+
diff --git a/packages/gui-plugins/src/goal/icons/steer.svg b/packages/gui-plugins/src/goal/icons/steer.svg
deleted file mode 100644
index 38de49fe8c0..00000000000
--- a/packages/gui-plugins/src/goal/icons/steer.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
diff --git a/packages/gui-plugins/src/goal/index.ts b/packages/gui-plugins/src/goal/index.ts
index 29f35a5d3e4..cc6964f2959 100644
--- a/packages/gui-plugins/src/goal/index.ts
+++ b/packages/gui-plugins/src/goal/index.ts
@@ -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 } })
diff --git a/packages/gui-plugins/src/goal/renderer.tsx b/packages/gui-plugins/src/goal/renderer.tsx
index d0969f14e88..799704a5205 100644
--- a/packages/gui-plugins/src/goal/renderer.tsx
+++ b/packages/gui-plugins/src/goal/renderer.tsx
@@ -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 = (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 = (ctx) => {
action,
})
+ ctx.add(Style, styles)
+
ctx.add(ComposerPill, {
id: "goal",
show: (input) => {
@@ -206,7 +210,7 @@ const setup: Plugin.Setup = (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 = (ctx) => {
}
return (
-
-
-
-
-
-
-
-
-
+
+ {(current) => (
+
+
+ {current().objective}
+
+ {/* Until the goal has a reason, the status is the pill's alone. */}
+
+ {(reason) => (
+ <>
+
+
+
+ {ctx.t(status[current().status].status)}
+
+
+ {reason()}
+
+
+ >
+ )}
+
+
+
+
+
+
+
+
+
+
+ run("clear")}
+ >
+ {ctx.t("clear")}
+
+ }
+ >
+ {/* A reached goal has nothing left to stop, so clearing it only dismisses the pill. */}
+
+
+
+
+ )}
+
)
},
})
diff --git a/packages/plugin/src/gui/registries.ts b/packages/plugin/src/gui/registries.ts
index a6fe6179a39..322a79f2d5c 100644
--- a/packages/plugin/src/gui/registries.ts
+++ b/packages/plugin/src/gui/registries.ts
@@ -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.