Expand the bundled MCP statusline authoring guide (#64814)

## Why

An unsupported UI tag or property invalidates the entire statusline
response, so providers need a fallback for clients whose rendering
capabilities are unknown.

## What changed

- Document the available UI elements with examples for wrapping rows,
  spacing fields, preserving whitespace, and displaying status badges.
- Explain how to use `app.cli_version` to check support for features such
  as `spacer` and `maxLines`, and return a plain string for the entire
  footer when support is unknown or absent. Carry the `spacer` guidance
  into the generated TypeScript reference.
- Clarify how to diagnose provider discovery failures with F2 and check
  `tools/list` metadata when a provider is missing from the picker.

## Testing

Update the scenario snapshot that verifies an explicit statusline skill
mention loads the bundled guide.

GitOrigin-RevId: 9c6ea1d356146c2d666359732d6a065ed41d9fee
This commit is contained in:
Joe Savona
2026-11-30 21:44:01 +00:00
committed by copyberry
parent 02a15f1244
commit 1843a4df93
4 changed files with 40 additions and 6 deletions
@@ -43,13 +43,13 @@ Scenario: A user requests the bundled statusline skill by name.
description: Build and enable a custom MCP statusline for the Codex CLI. Use when someone wants a provider that displays information in the terminal footer.
---
<OMITTED 9 LINES; ~409 TOKENS; hash=9f5b7f7878d50218>
<OMITTED 39 LINES; ~1166 TOKENS; hash=eb08350f9af5ff46>
### Enable and verify
Install the provider through an installed plugin or register the stdio command on the connected app-serv...l` on the connected app server, then restart the TUI. [hash=e0f5170a5aeda287]
Exercise `tools/list` and `resources/read` with a representative snapshot. After adding the server, star... file, restart its stdio process to load the changes. [hash=4d64fb913d86fc64]
Exercise `tools/list` and `resources/read` with a representative snapshot. After adding the server, star... file, restart its stdio process to load the changes. [hash=303220aff844fc0c]
</skill>
08:configuration_update:reasoning={"effort":"low"}
@@ -5,16 +5,46 @@ description: Build and enable a custom MCP statusline for the Codex CLI. Use whe
Help the user choose what to show. Reuse an existing stdio MCP server when it already owns the data and is configured globally or supplied by an installed plugin. For a new provider, copy [the Python starter](assets/statusline.py) and edit `render`. The [TypeScript reference](references/statusline.d.ts) bundled with this skill describes the snapshot and UI tree. If those files are on a different machine from your workspace, write the provider in the workspace using the protocol below.
### Advertise and render the footer
### Advertise the footer
Advertise exactly one valid statusline entrypoint per tool in `tools/list`. Use the stable server and tool names for the saved selection. Set `_meta["openai/ui"].entrypoints` to include `{"type":"statusline","resourceUri":"ui://my-statusline/footer"}`. The tool's title is the label in the picker.
Codex requests the advertised URI with `resources/read`. Read the displayed thread's snapshot from `params._meta["com.openai/codex-statusline-state"]`. Return exactly one text resource at that URI, with MIME type `application/json` and a JSON-encoded UI tree. Optional account and usage fields may be absent. A string renders literal text and `null` clears the footer.
### Available UI elements
Use a `row` with an explicit whole-number `gap` to group items. Use named theme or status colors to follow the user's theme. Codex accepts up to 64 KiB of UI tree JSON, 16 KiB of UTF-8 leaf text, 256 non-null nodes, and a depth of 16 (root at 0). Each read has one second to finish. After a successful read, Codex waits one second before reading again. An error or timeout stops polling. Reselect the provider in `/statusline` to restart it.
`row`, `col`, and `box` require a `gap`, an integer from 0 through 2^53 − 1.
- `col`: Stack items vertically. Put each field in its own `text` or `row` element. A gap of zero puts the fields on consecutive lines, and a gap of one leaves a blank line between them. Adjacent bare strings render together.
- `row`: Group items horizontally. The gap is measured in terminal columns. Set `wrap: "wrap"` to allow items to flow onto another line, and use `justify` to position items on each line.
- `box`: Choose the axis at runtime with optional `direction`, which defaults to `col`. With `direction: "row"`, the box accepts row props and groups adjacent strings into one flex item.
- `spacer`: Put `{"type":"spacer"}` between fields in a row to push the following fields to the right. Spacers on each wrapped line share its spare width, and the row gap applies on both sides. In a content-height column, the spacer occupies a slot with the usual gaps.
- `text`: Group styled text. Set `preserveWhitespace: true` to keep indentation, repeated spaces and tabs across styled children. Set `maxLines` to an integer from 1 through 2^53 − 1 to limit the block after wrapping. Hidden lines end the visible block with an unlinked ellipsis. Clamping takes precedence over `preserveWhitespace` on the same element.
- `bold`: Render children in bold.
- `italic`: Render children in italics.
- `underline`: Underline children.
- `code`: Display commands and paths with the same children as `text`. Nest `bold` inside `code` to emphasize an argument. Code preserves spaces and line breaks across children, expands tabs at eight-column stops, and uses the terminal theme’s code colors.
- `link`: Link the children to an absolute HTTP(S) URL using `props.href`.
- `badge`: Display a short state label, for example `{"type":"badge","props":{"color":"success"},"children":["passing"]}`. A badge accepts a string, an icon, or one of each in either order. It collapses label whitespace and stays on one line. For a check before the label, use `[{"type":"icon","props":{"name":"check"}},"passing"]` as the children. Badge color defaults to `secondary` and can also be `info`, `success`, `warning`, or `danger`.
- `icon`: Render a static glyph named by `IconName` in the reference. Icons work inline in text and inherit the surrounding style.
- `list`: Use `{"type":"list","children":["build","test"]}` for bullets. Set `props.marker` to `"number"` for numbering from one or `"none"` for unmarked items. Each direct child is one item. Wrapped lines align with the item text.
- `list-item`: Group styled fragments into a single list item, for example `{"type":"list-item","children":["run ",{"type":"code","children":["tests"]}]}`.
- `string`: A bare JSON string renders as literal text.
### General behavior
Codex requests the advertised URI with `resources/read`. Read the displayed thread's snapshot from `params._meta["com.openai/codex-statusline-state"]`. Return exactly one text resource at that URI, with MIME type `application/json` and a JSON-encoded UI tree. Optional account and usage fields may be absent. A `null` tree clears the footer.
Check the rendering client’s `app.cli_version` before using newer features such as `spacer` or `maxLines`. If support is unknown or absent, return a literal string for the entire tree. An unsupported tag or property invalidates the whole response.
Use named theme or status colors to follow the user's theme. Codex accepts up to 64 KiB of UI tree JSON, 16 KiB of UTF-8 leaf text, 256 non-null nodes, and a depth of 16 (root at 0).
#### Refresh timing and errors
Each read has one second to finish. After a successful read, Codex waits one second before reading again.
An error or timeout stops polling. The footer directs you to `/statusline`. Reselect the provider there to restart polling.
### Enable and verify
Install the provider through an installed plugin or register the stdio command on the connected app-server host. For example, run `codex mcp add my-statusline -- python3 -u /absolute/path/to/statusline.py` there, using a path and interpreter the host can access. If the workspace is on a separate executor, give the user the provider file to copy to the host and the command to run there. Enable **Custom status line** in `/experimental` on the connected app server, then restart the TUI.
Exercise `tools/list` and `resources/read` with a representative snapshot. After adding the server, start a new conversation in its workspace to connect to it. Open `/statusline`, choose **Choose a status line provider**, and select the provider. Verify that changing threads changes the displayed inputs. F2 shows the failed attempt if the footer falls back. After editing the Python file, restart its stdio process to load the changes.
Exercise `tools/list` and `resources/read` with a representative snapshot. After adding the server, start a new conversation in its workspace to connect to it. Open `/statusline`, choose **Choose a status line provider**, and select the provider. Verify that changing threads changes the displayed inputs. If discovery fails, dismiss the provider picker before pressing F2 for inventory and server lookup warnings. If discovery completes but the provider is missing, check the entrypoint metadata in `tools/list`. After editing the Python file, restart its stdio process to load the changes.
@@ -150,6 +150,7 @@ export type ListElement = Extract<Element, { type: "list" }>;
export type ListItemElement = Extract<Element, { type: "list-item" }>;
export type BadgeElement = Extract<Element, { type: "badge" }>;
export type IconElement = Extract<Element, { type: "icon" }>;
/** If spacer support is unknown or absent for app.cli_version, return a literal string for the entire tree. */
export type SpacerElement = Extract<Element, { type: "spacer" }>;
export type CodeElement = Extract<Element, { type: "code" }>;
type BoxColumnProps = ColProps & { [K in Exclude<keyof RowProps, keyof ColProps>]?: never };
@@ -82,6 +82,9 @@ fn generate_reference(output: &Path) -> color_eyre::Result<String> {
"Spacer",
"Code",
] {
if name == "Spacer" {
generated.push_str("/** If spacer support is unknown or absent for app.cli_version, return a literal string for the entire tree. */\n");
}
let tag = if name == "ListItem" {
"list-item".to_owned()
} else {