From 226fff34616146377e7150c46964f4753901f646 Mon Sep 17 00:00:00 2001 From: Konrad Lother Date: Fri, 20 Nov 2026 16:45:36 +0000 Subject: [PATCH] interview: the model opens the conversation; light is the default --interview opened the chat and then waited: the system prompt told the model to interview the operator, but nobody sent a turn. The UI now sends the same kickoff the Telegram daemon sends, and with piped input --interview runs that one turn instead of waiting for a profile. The default theme is the flat light one, and the language is English unless a config or SPLINTER_LOCALE says otherwise - the desktop's LANG no longer decides what the tool speaks. --- share/locale/de.msg | 1 + share/locale/en.msg | 1 + share/locale/pt_BR.msg | 1 + src/backend/config.c | 2 +- src/backend/i18n.c | 12 +++++------- src/backend/theme.h | 2 +- src/frontend/curses.c | 16 +++++++++++++++- src/frontend/ui.h | 9 ++++++++- src/main.c | 23 +++++++++++++++++++---- tests/test_agents_ui.sh | 5 +++-- tests/test_config.c | 2 +- tests/test_theme.c | 4 ++-- 12 files changed, 58 insertions(+), 20 deletions(-) diff --git a/share/locale/de.msg b/share/locale/de.msg index e76b9ba..b345ae4 100644 --- a/share/locale/de.msg +++ b/share/locale/de.msg @@ -257,6 +257,7 @@ status.swarm_value = %s (Id %d) interview.system = Du bist splinter und arbeitest zum ersten Mal mit dieser Person. Interview sie, um sie kennenzulernen: woran sie arbeitet, welche Werkzeuge und Sprachen sie nutzt, wie sie angesprochen werden will, was sie nie will und welche Projekte zaehlen. Stelle eine Frage auf einmal, hoere zu und gehe nach, wo es wichtig ist. Frage nicht nach Codedetails, die du im Repository lesen kannst. Wenn du genug hast, schreibe eine kompakte Zusammenfassung der Person und ihrer Arbeitsweise (ein paar Absaetze oder Punkte) und beende deine Antwort mit der einen Zeile INTERVIEW_COMPLETE. Diese Zusammenfassung wird in ~/.splinter/USER.txt gespeichert und am Anfang jeder spaeteren Sitzung gelesen. interview.saved = Interview in USER.txt gespeichert tg.interview.begin = Interview gestartet. Beantworte die Fragen des Modells; /new beendet das Interview. +interview.kickoff = Beginne das Interview mit deiner ersten Frage. # Kommandos in commands/, fehlendes Profil, die beiden Besetzt-Hinweise cmd.script.empty = Das Kommando /%s hat nichts ausgegeben. diff --git a/share/locale/en.msg b/share/locale/en.msg index 22d6f96..f320e80 100644 --- a/share/locale/en.msg +++ b/share/locale/en.msg @@ -256,6 +256,7 @@ status.swarm_value = %s (id %d) interview.system = You are splinter, about to work with this person for the first time. Interview them to get to know them: what they work on, the tools and languages they reach for, how they want to be spoken to, what they never want, and which projects matter. Ask one question at a time, listen, and go deeper where it matters. Do not ask about code details you can read from the repository. When you have enough, write a compact summary of the person and how they want to work (a few paragraphs or bullets), then end your answer with the single line INTERVIEW_COMPLETE. That summary is saved to ~/.splinter/USER.txt and read at the start of every later session. interview.saved = interview saved to USER.txt tg.interview.begin = Interview started. Answer the model's questions; /new leaves the interview. +interview.kickoff = Begin the interview with your first question. # commands/ programs, a missing profile, and the two busy notices cmd.script.empty = The command /%s printed nothing. diff --git a/share/locale/pt_BR.msg b/share/locale/pt_BR.msg index 0700f84..09c7d41 100644 --- a/share/locale/pt_BR.msg +++ b/share/locale/pt_BR.msg @@ -260,6 +260,7 @@ status.swarm_value = %s (id %d) interview.system = Voce e o splinter e vai trabalhar com esta pessoa pela primeira vez. Entreviste-a para conhece-la: no que trabalha, quais ferramentas e linguagens usa, como quer ser tratada, o que nunca quer e quais projetos importam. Faca uma pergunta por vez, escute e aprofunde onde importa. Nao pergunte detalhes de codigo que voce pode ler no repositorio. Quando tiver o suficiente, escreva um resumo compacto da pessoa e de como ela quer trabalhar (alguns paragrafos ou pontos) e termine sua resposta com a linha unica INTERVIEW_COMPLETE. Esse resumo e salvo em ~/.splinter/USER.txt e lido no inicio de cada sessao posterior. interview.saved = entrevista salva em USER.txt tg.interview.begin = Entrevista iniciada. Responda as perguntas do modelo; /new encerra a entrevista. +interview.kickoff = Comece a entrevista com sua primeira pergunta. # comandos em commands/, perfil ausente, os dois avisos de ocupado cmd.script.empty = O comando /%s nao imprimiu nada. diff --git a/src/backend/config.c b/src/backend/config.c index befb9a0..a55ed5f 100644 --- a/src/backend/config.c +++ b/src/backend/config.c @@ -910,7 +910,7 @@ sp_config_write_example(const char *path, struct sp_buf *err) "\n" "core {\n" " default = local # a provider or pool below; -m overrides\n" - " theme = Xresources # or a CDE palette, --list-themes\n" + " theme = light # Xresources or a CDE palette, --list-themes\n" " autonomous = false # true: run mutating tools without asking\n" " #locale = de\n" " steps = 150 # tool rounds per turn\n" diff --git a/src/backend/i18n.c b/src/backend/i18n.c index 6d92605..fc89226 100644 --- a/src/backend/i18n.c +++ b/src/backend/i18n.c @@ -57,7 +57,11 @@ trim(char *s) return s; } -/* Detect the language from the environment, ignoring the regional part. */ +/* + * The language is English unless a config or SPLINTER_LOCALE says otherwise. + * The desktop's LANG is deliberately not consulted: this tool's author works + * in a German locale and wants one predictable language in the terminal. + */ static void detect_language(const char *override_lang) { @@ -65,12 +69,6 @@ detect_language(const char *override_lang) if (cand == NULL || *cand == '\0') cand = getenv("SPLINTER_LOCALE"); - if (cand == NULL || *cand == '\0') - cand = getenv("LC_ALL"); - if (cand == NULL || *cand == '\0') - cand = getenv("LC_MESSAGES"); - if (cand == NULL || *cand == '\0') - cand = getenv("LANG"); memset(lang, 0, sizeof(lang)); if (cand == NULL || *cand == '\0') { diff --git a/src/backend/theme.h b/src/backend/theme.h index 1fc4fe2..21ebf69 100644 --- a/src/backend/theme.h +++ b/src/backend/theme.h @@ -55,7 +55,7 @@ struct sp_theme { short idx_think, idx_tool, idx_notice, idx_error; }; -#define SP_THEME_DEFAULT "Xresources" +#define SP_THEME_DEFAULT "light" #define SP_THEME_XRESOURCES "Xresources" /* * Two flat themes, because a palette can be beautiful and still leave the diff --git a/src/frontend/curses.c b/src/frontend/curses.c index 06b3363..9580333 100644 --- a/src/frontend/curses.c +++ b/src/frontend/curses.c @@ -3800,7 +3800,8 @@ tmux_title(void) } int -sp_ui_run(const struct ui_backend *be, const char *theme_name) +sp_ui_run(const struct ui_backend *be, const char *theme_name, + const char *initial) { struct ui_state s; char input[1024], queued[1024] = ""; @@ -3810,6 +3811,19 @@ sp_ui_run(const struct ui_backend *be, const char *theme_name) be->close(be->ctx); return 1; } + /* + * The interview opens with the model's first question. The system prompt + * told the model to interview the operator, but nobody sent a turn, so + * the screen sat ready and silent. This is the same kickoff the Telegram + * daemon sends. + */ + if (initial != NULL && *initial != '\0') { + hist_push(&s, be->local(be->ctx) ? SESS_DIR(be) : NULL, initial); + s.scroll = 0; + add_entry(&s, "you", initial); + redraw(&s, be); + (void)ui_turn(&s, initial); + } for (;;) { struct sp_buf reply; int kind; diff --git a/src/frontend/ui.h b/src/frontend/ui.h index de961f1..8e09918 100644 --- a/src/frontend/ui.h +++ b/src/frontend/ui.h @@ -13,7 +13,14 @@ * the difference. This file only draws and reads keys. * Returns 0 on a clean quit. */ -int sp_ui_run(const struct ui_backend *be, const char *theme_name); +/* + * Run the full-screen chat. 'initial' is an optional first user turn (the + * interview's opening question): it is shown and started before the prompt + * waits for the operator, so the model speaks first instead of the screen + * sitting there waiting for a message nobody knows to send. + */ +int sp_ui_run(const struct ui_backend *be, const char *theme_name, + const char *initial); /* * UTF-8 -> ASCII for the screen. The vendored curses writes Latin-1 bytes for diff --git a/src/main.c b/src/main.c index 00ae536..1718048 100644 --- a/src/main.c +++ b/src/main.c @@ -77,7 +77,7 @@ usage(FILE *f) " --attach run the curses UI as a client of --serve\n" " --socket PATH socket for --serve/--attach (default\n" " ~/.splinter/splinter.sock)\n" - " --theme NAME UI theme: Xresources (default) or a CDE\n" + " --theme NAME UI theme: light (default), Xresources or a CDE\n" " palette, e.g. Default, Delphinium, MakroSlate\n" " --list-themes print the palette names and exit\n" " --resume load the session's history into the conversation\n" @@ -1267,6 +1267,17 @@ main(int argc, char **argv) if ((rc = parse_args(argc, argv, &o, &cfg)) >= 0) return rc; + /* + * The interview is a conversation, not a one-line question. In a terminal + * it opens the chat UI and sends the first turn itself (see below); with + * piped input it runs that one turn and prints the answer. + */ + if (o.interview && o.prompt == NULL) { + if (isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)) + o.chat = 1; + else + o.prompt = "Begin the interview with your first question."; + } if (o.list_themes) { const char **names; size_t count, k; @@ -1379,7 +1390,7 @@ main(int argc, char **argv) sp_buf_free(&err); return 3; } - rc = sp_ui_run(be, o.theme); + rc = sp_ui_run(be, o.theme, NULL); sp_buf_free(&err); return rc; } @@ -1589,12 +1600,16 @@ main(int argc, char **argv) } else if (o.daemon) rc = run_daemon(eng, daemon_base, &err); else if (o.chat) { - if (!sp_profile_exists(sp_config_state_dir(&conf))) + if (!o.interview && !sp_profile_exists(sp_config_state_dir(&conf))) fprintf(stderr, sp_td("main.no_profile", "splinter: no profile for '%s' - " "`splinter --interview` creates one\n"), sp_user_name()); - rc = sp_ui_run(sp_ui_backend_engine(&eng, &eo), o.theme); + rc = sp_ui_run(sp_ui_backend_engine(&eng, &eo), o.theme, + o.interview + ? sp_td("interview.kickoff", + "Begin the interview with your first question.") + : NULL); } else if (o.prompt != NULL && (o.prompt[0] == '/' || o.prompt[0] == '!')) rc = run_slash_prompt(eng, o.prompt); diff --git a/tests/test_agents_ui.sh b/tests/test_agents_ui.sh index d03ef7e..8e03a2f 100644 --- a/tests/test_agents_ui.sh +++ b/tests/test_agents_ui.sh @@ -79,7 +79,8 @@ tmux send-keys -t $S -l 'nochmal' tmux send-keys -t $S Enter check "build asks for consent" shows 'y/n\|allow\|approve\|Allow\|Approve' -# the language follows LANG (de_DE -> de), and no catalogue key shows through. +# The language is English unless a config or SPLINTER_LOCALE says otherwise; +# the desktop's LANG must not change it behind the operator's back. # A fresh session name: reusing one right after kill-session races, and a lost # keystroke looked like a rendering bug. tmux kill-session -t $S 2>/dev/null @@ -88,7 +89,7 @@ tmux new-session -d -s $S -x 120 -y 30 -c "$D/proj" \ "env -u SPLINTER_LOCALE LANG=de_DE.UTF-8 HOME=$D/home SPLINTER_USAGE_DIR=$D/u \ SPLINTER_COOLDOWN_DIR=$D/c $PWD/splinter --no-config \ --endpoint http://127.0.0.1:$P/v1/chat/completions --model m --chat 2>/dev/null" -check "German UI from LANG=de_DE" shows 'bereit' +check "English UI despite LANG=de_DE" shows 'ready' # an asterisk in code is an asterisk; real emphasis loses its markers tmux send-keys -t $S -l 'pointers bitte' tmux send-keys -t $S Enter diff --git a/tests/test_config.c b/tests/test_config.c index 27ab261..9058efa 100644 --- a/tests/test_config.c +++ b/tests/test_config.c @@ -141,7 +141,7 @@ main(void) sp_config_init(&c); sp_buf_clear(&err); CHECK(sp_config_load(&c, path, &err) == 0); - CHECK(strcmp(c.theme, "Xresources") == 0); /* the default theme */ + CHECK(strcmp(c.theme, "light") == 0); /* the default theme */ CHECK(c.steps == 150); CHECK(c.autonomous == 0); diff --git a/tests/test_theme.c b/tests/test_theme.c index 1acad8f..2b74fc0 100644 --- a/tests/test_theme.c +++ b/tests/test_theme.c @@ -42,10 +42,10 @@ main(void) CHECK(strcmp(names[count - 2], "dark") == 0); CHECK(strcmp(names[count - 1], "light") == 0); - /* the default is the X resource theme, and NULL means the default */ + /* the default is the flat light theme, and NULL means the default */ CHECK(sp_theme_load(NULL, &t, &err) == 0); CHECK(strcmp(t.name, SP_THEME_DEFAULT) == 0); - CHECK(strcmp(t.name, "Xresources") == 0); + CHECK(strcmp(t.name, "light") == 0); /* a CDE palette paints with its colour sets: set 5 is the window */ CHECK(sp_theme_load("Default", &t, &err) == 0);