/** * The agent and model row at the bottom of the prompt box: * * 󰚩 BUILD Sonnet 4.5 Anthropic medium * ^^^^^^^^^^^ * a filled pill in the mode colour (brand primary for build, brand plan colour for plan) with the * mode's icon, then the model, the provider, and the thinking level in chassis's own colour for it. * * Pure functions over a theme, so the row can be tested without an editor. With a Nerd Font the pill * caps are the Powerline round caps and the mode has an icon; without one the caps are half blocks * and the pill is just the label (icons.ts). */ import type { Theme } from "@earendil-works/pi-coding-agent"; import { backgroundAnsi, type Color, foregroundAnsi, truncateToWidth } from "@earendil-works/pi-tui"; import { icon, withIcon } from "./icons.ts"; import { brandColor, isLight, paint, readableOn, surfaceColor, toColor } from "./palette.ts"; export type Mode = "build" | "plan"; /** The mode's icon in the current set: a robot for build and an eye for plan, or none. */ export const modeIcon = (mode: Mode): string => icon(mode === "plan" ? "modePlan" : "modeBuild"); /** The mode's colour as a parsed colour: the brand plan colour for plan, the primary for build. */ export const modeColorValue = (mode: Mode) => brandColor(mode === "plan" ? "plan" : "primary"); /** The pill's text: the dark panel shade on a dark theme, near-black on a light one, so it reads on the mode colour either way. */ const pillInk = (theme: Theme): Color => (isLight(theme) ? toColor("#121212") : surfaceColor(theme, "panel")); /** A filled pill with round caps: "