ui, model, cost and idle timeouts

- lcm: the sidebar widget and /status segment show the context, the number of
  compactions, messages and bytes of the last cut, and how many old tool
  outputs were trimmed. The counters are the compactor's own, not an estimate.
- cost: a provider-reported USD cost (usage.cost/cost_usd) is carried through
  sse/openai, the agent and the engine. /cost reports it with the cache share
  and splits judged from plain turns; the notes say that an upstream judge is
  not visible in the provider's usage. The status plugin and junction prefer
  the reported number over list-price arithmetic.
- curses: the running turn's seconds moved from the input line to the status
  bar. Notes and errors are transcript rows below the cause, never text in the
  input line or the status bar; a failed backend request is a status row and is
  retried by the agent. The steer prompt is only "steer> " and what was typed.
- model: /model probe works in the chat. The picker lists the configuration at
  once, then asks the endpoint the session is on what it serves and adds those
  models, so a router's whole menu is selectable. provider/model selectors now
  apply the right provider instead of becoming a model name. The choice is
  written to <session>.model and restored when that session is reopened; /new
  carries the current model into the new session.
- sidebar: plugin titles are bold and underlined (this curses has no italic
  attribute), with a rule between the plugin blocks.
- run/cli: a command timeout is an idle window. Every chunk on stdout or
  stderr resets it, and the process is asked with waitpid(WNOHANG) whether it
  is still there before the window is extended. A long build that keeps
  reporting progress is no longer killed for being long; a silent hang is.
- config: ';' separates settings on one line, so
  plugin lcm { keep = 6; tool_trim = 8192 } parses as two keys.
- tests: lcm widget/status counters, one-line config blocks, session model
  restore and /model probe, cli idle timeout with a talkative and a silent
  command, run output reset, and the UI status/retry rows.

make check: all tests passed.
This commit is contained in:
lotherk committed 2026-11-17 23:21:56 +00:00
1 parent dc9a1c62ec
commit af2001bfee
33 files changed
+1035 -184

No files matched your search

+7 -6
View File
@@ -451,7 +451,7 @@ session_dir = /home/lotherk/.splinter
```
transport = cli
cli_cmd = claude -p
cli_timeout = 1800
cli_timeout = 1800 # seconds of silence, not a wall clock
plugin = cli
theme = Xresources
```
@@ -513,11 +513,12 @@ and stand for `http://127.0.0.1:11434/v1` and
`OPENCODE_GO_API_KEY`).
`/model` offers the models the config names and switches the transport; the
choice is written to `<config>.d/90-model.conf` as
`default = PROVIDER[/MODEL]`, so the next start has it. The provider block
supplies kind, endpoint and key variable; the drop-in only names the choice.
Picking `main` deletes that file and the configuration speaks again.
`/model probe` asks each endpoint `/v1/models` and lists what it really serves;
choice is written to the session's sidecar (`<session>.model`) as a selector,
so reopening that session brings the model back without changing what a new
session starts on. The provider block supplies kind, endpoint and key variable;
the sidecar only names the choice. `/model probe` asks each endpoint
`/v1/models` and lists what it really serves; the picker in the curses chat
also asks the endpoint the session is on and adds those models to its list.
`/model <name>` takes another model from the current endpoint. With a plugin
`transport` nothing is written — that program picks the model.
+18 -1
View File
@@ -165,6 +165,21 @@ turn. No second model is called, so a run stays reproducible and costs nothing
extra. `plugin lcm { keep = 6; tool_trim = 8192 }` sets the verbatim tail and
the byte cap per old observation; `tool_trim = 0` turns the trim off.
What it did is visible while it runs - the counters are the compactor's own, not
a second estimate:
```
lcm: ctx 12.3k/32k
compacted 3 cut 41 msgs
last 60->22 msgs 180.2k->44.1k B
tools trimmed 7
```
The first line is the context the last request carried against the window; then
the number of compactions and how many messages they removed in total; how the
last cut looked in messages and bytes; and how many old tool outputs were
trimmed. `/status` gets one segment, `compact 3`, next to the other meters.
**cps** — continuous parallel compression. The expensive part (deciding what
would go) is computed on the widget's worker thread from an *index* of the
conversation — role, size, and 64 bytes of head per message, copied under a
@@ -201,7 +216,9 @@ SPLINTER_CLI_CMD="opencode run" ./splinter -p "hi" --plugin plugins/cli/cli.so
- `SPLINTER_CLI_CMD` — the program, default `claude -p`
- `SPLINTER_CLI_FULL=1` — send the whole transcript instead of the last user
message (for programs that keep no history of their own)
- `SPLINTER_CLI_TIMEOUT` — seconds, default 1800 (or `cli_timeout` in the config)
- `SPLINTER_CLI_TIMEOUT` — seconds of silence before the program is killed,
default 1800 (or `cli_timeout` in the config); output on stdout or stderr
resets the window, so a long answer that keeps printing is not cut off
- `SPLINTER_CLI_CMD` may include `{file}` (prompt file path) or `{prompt}` (shell-quoted prompt); without a placeholder the prompt is passed on stdin
The command comes from the operator's environment and runs through `/bin/sh -c`;
+6 -3
View File
@@ -161,9 +161,12 @@ curses front end, plugin commands and `commands/` programs included.
The list `/model` takes, for a picker: `"ev":"models"` with
`"items":[{"sel":"junction","label":"junction qwen3.6-35b","current":true},...]`.
`sel` is what goes after `/model `, `label` is what the picker shows, and
`current` marks the model the run is on. It is the configuration (providers,
then pools), not a network probe, so it answers at once; `/model <selector>`
through `input` does the switch.
`current` marks the model the run is on. Without an argument it is the
configuration (providers, then pools), so it answers at once. With
`{"cmd":"models","probe":"true"}` the endpoint this session is on is also asked
`/v1/models` and its models are appended, as `provider/model` selectors; that
is a network call and may take a few seconds. `/model <selector>` through
`input` does the switch and stores the choice in the session.
### `{"cmd":"ping"}` / `{"cmd":"quit"}`
+3 -2
View File
@@ -83,8 +83,9 @@ Stream.
(`test_gateway.sh`, `test_ui.sh`); `/connect` auch im TUI
- **Modelle wechseln und Provider anlegen**: `/model` liest die konfigurierten
Modelle (Haupt-Endpoint, Delegates, Exits), haengt den Transport um, merkt
die Wahl in `90-model.conf` und fragt per `/model probe` die Endpoints nach
`/v1/models`; das TUI kann dasselbe. `/connect` schreibt eine validierte
die Wahl in `<session>.model` und fragt per `/model probe` die Endpoints nach
`/v1/models`; das TUI zeigt im Picker auch die Modelle des Endpoints, auf dem
die Sitzung gerade laeuft. `/connect` schreibt eine validierte
`delegate`-Zeile in den Drop-in neben der benutzten Konfiguration, prueft sie
mit einem Test-Turn und registriert sie im laufenden Prozess
(`test_providers`, `test_gateway.sh`, `test_ui.sh`)