Skip to content

feat(ui): customizable between-turn statusline#238

Merged
emal-avala merged 1 commit intomainfrom
feat/ui-statusline-template
Apr 24, 2026
Merged

feat(ui): customizable between-turn statusline#238
emal-avala merged 1 commit intomainfrom
feat/ui-statusline-template

Conversation

@emal-avala
Copy link
Copy Markdown
Member

Summary

Adds ui.statusline so operators can reshape (or suppress) the divider the REPL draws before each prompt after the first turn.

Config surface

[ui.statusline]
enabled  = true                                # default
template = "{model} · turn {turn} · ${cost}"   # optional override

Placeholders:

Token Value
{model} Current API model
{turn} Completed turns this session
{tokens} Cumulative token count
{cost} Session cost in USD (4-digit precision)
{cwd} Working directory
{session_id} Active session id
  • Unknown placeholders pass through verbatim — lets templates reference names this runtime doesn't recognize yet without silently dropping text.
  • {{ / }} produce literal braces.
  • Unterminated {… is preserved verbatim so the operator can spot the typo.
  • enabled = false suppresses the divider entirely — useful for scripted sessions where the divider adds noise to captured output.

Defaults preserved

With no config or enabled = true, template = None the existing model · turn N · T tokens · $0.0000 line is unchanged byte-for-byte.

Tests (10 new)

Schema (3): default round-trip, TOML parse, disabled flag round-trip.

Template rendering (7):

  • All six built-in placeholders substitute
  • {{ / }} escape to literal braces
  • Unknown placeholder passed through (forwards-compat)
  • Unterminated { preserved
  • Cost uses 4-digit precision
  • No-placeholder string unchanged
  • Stray } preserved

Full schema suite: 107 pass, 0 fail. Clippy clean under -D warnings. CLI crate builds cleanly with the repl.rs wiring.

Test plan

  • cargo test -p agent-code-lib --lib config::schema
  • cargo build -p agent-code
  • cargo clippy --workspace --tests --no-deps -- -D warnings
  • cargo fmt --all --check

Adds `ui.statusline` so operators can reshape the divider the REPL
draws before each prompt (after the first turn), or suppress it
entirely.

Config surface:

    [ui.statusline]
    enabled  = true                             # default
    template = "{model} · turn {turn} · ${cost}" # optional override

Placeholders: `{model}`, `{turn}`, `{tokens}`, `{cost}`, `{cwd}`,
`{session_id}`. Unknown placeholders pass through verbatim so a
template using a name this runtime doesn't recognize (future-compat)
degrades gracefully to visible text instead of silently dropping
the token. Literal braces escape via `{{` / `}}`.

Default behavior is unchanged: `enabled = true`, `template = None`
renders the existing `model · turn · tokens · cost` line.

`enabled = false` suppresses the divider altogether — useful for
scripted sessions where the divider adds noise to captured output.

Tests:
- Defaults round-trip from TOML
- All built-in placeholders expand
- `{{` / `}}` produce literal braces
- Unknown placeholder passed through (forwards-compat)
- Unterminated `{` preserved verbatim (no swallowing)
- Cost formatting matches built-in 4-digit precision
- No-placeholder string unchanged
- Stray `}` preserved

10 new schema tests, full suite 107 pass. Clippy clean.
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@emal-avala emal-avala merged commit bbcf0b0 into main Apr 24, 2026
14 checks passed
@emal-avala emal-avala deleted the feat/ui-statusline-template branch April 24, 2026 04:34
@emal-avala emal-avala mentioned this pull request Apr 24, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant