Artifact e0f80c4de4c307aaaec6d9b2379c2ce7fe9e5c8058b33fae7af85793867cca0d:
- File
src/tui/tui.h
— part of check-in
[c8bc1bfa6d]
at
2026-11-23 11:40:21
on branch ux-models
— Model choice says why and recovers from a refused key
With no saved default, pic starts on a provider whose key worked and passes over one that was refused, out of credit or limited; OpenRouter, Moonshot and DeepSeek start on inexpensive general models. The first screen (and stderr for ask and -p) names the model and why; with no key it says how to get one. The picker shows prices and key marks, lists keyless models once typed, ranks exact and prefix matches first, says what it saved and when the thinking level changes. After a refused key, Alt+P picks another model and the message returns to the editor for it. pic sessions shows each conversation's model and marks failed ones; pic models --json carries key; pic --version; pic help start opens with the user path. (user: dmestas, size: 1935) [annotate] [blame] [check-ins using] [more...]
/* pic's terminal UI (app.c): plain pic in a terminal. Each request runs as a * child `pic --json ask` process and is known only through its JSON events; * the journal stays the record, so a UI fault cannot touch a run. */ #ifndef PIC_TUI_H #define PIC_TUI_H #include <stddef.h> typedef struct { const char *self; /* this executable, for the child processes */ const char *db; /* journal path */ const char *workspace; const char *model; /* provider/model */ const char *default_model; /* the saved default (or pic's own), marked in the picker */ int exec_seconds; long context_window; /* -1: the model's */ const char *resume; /* NULL: a new conversation; "latest" or an id */ const char *new_id; /* --session-id naming no conversation yet: the first request creates it under this id */ int pick; /* -r: open the conversation picker at start */ const char *tui_mode; /* --tui-mode: "fullscreen" or "regular"; NULL: the tuiMode setting */ const char *theme; /* --theme: a theme name or "light/dark", for this run; NULL: the theme setting */ /* Options every child request takes too, as Pi applies them to the whole session. */ const char *system_replace; /* --system-prompt; NULL: none */ const char *const *system_append; /* --append-system-prompt arguments */ size_t system_nappend; const char *tools, *exclude_tools; /* --tools, --exclude-tools; NULL: none */ int no_tools, no_builtin_tools; /* --no-tools, --no-builtin-tools */ const char *key; /* --key: the label the model's provider uses this run; NULL: none */ const char *model_note; /* under the banner: why this model, or that there is no key; NULL: none */ } pic_tui_options; /* Runs until the person quits; 0, or 1 when the terminal could not be used. */ int pic_tui_main(const pic_tui_options *o); #endif