d0a3c484ef7de51d8afdb47c177fcdaad92e1a9d
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f6211362cb |
sessions: /sessions is a picker over sources, foreign sessions included
`/sessions` printed a list of ids; the operator then typed the id into
/open. The list was the wrong shape for a thing you pick from, and the
foreign stores (claude, hermes, opencode) were not in it at all - their
sessions were only reachable through the model's import tool.
Now it is a picker in two steps: the sources first (`splinter` and every
foreign store that has something), then the rows of the chosen one. A
foreign row's id is "claude:<id>", which sp_engine_switch() already reads
as an import - so picking it loads and continues that session, exactly
like `/open claude:<id>` typed by hand.
The picker got one shared implementation while it was open: pick_run()
with a value/label list, a configurable title and two hint lines. /model
and /sessions draw the same way now instead of two copies that could
diverge on Esc, resize and the filter. One window is held across both
steps, so a quick double Esc leaves; with a window per step the second Esc
landed in a window that was already gone and the picker stayed open.
Over the socket the same two steps exist: `{"cmd":"sources"}` and
`{"cmd":"sessions","source":"NAME"}`.
Tested: make check, all suites green (test_engine, test_protocol,
test_ui against a real tmux pane, 229 i18n keys in three catalogues).
|
||
|
|
f19fbf6ac1 |
cli: splinter -c --claude continues the newest claude session of this folder
The operator's claude ran into its limit mid-work; the session was too full to continue there. The foreign plugin could already read and import it, but only through a tool call inside a turn - there was no way in from the command line. --claude, --opencode, --hermes and --from=NAME make the newest session that tool ran in this directory the session of the run: it is imported before the history is loaded, so the first turn already carries it. -c no longer fails in a folder that has no splinter session yet; it falls back to "no session" and lets the import decide. An empty placeholder session is removed again, whether the import worked or not. Repeating the call continues the same session instead of importing a second time: sp_session_foreign() reads the foreign= marker back, so the work done in splinter is kept. A second foreign_import into the same session replaces the history rather than appending it twice (path_join built "id/.jsonl", so the replace branch never fired). Test: tests/test_foreignopen.c builds a claude fixture under its own HOME and covers import, idempotency, replace-not-append, the empty placeholder and a folder with no foreign session. make check exit 0, check_asan.sh clean. |
||
|
|
4cbd57d829 |
tree: lcm keeps the task, and the in-flight work it sits in
Everything that was uncommitted in the shared tree, in one commit because the changes are interleaved across the same files (lcm, engine, frontend, locales). lcm: a continuation prompt is not the task. After /resume the newest user message is "Continue with the task ...", and pinning it kept the keystroke while the question it continues was cut away -- measured: a resumed session woke up with the prompt, one tool call and its error, and no task at all. The pin now skips the harness's own continuation prompts, so the real question is pinned again. test_compactor drives it: with the skip disabled the task is lost (red), with it the task comes back after the summary (green). engine: /self-check and the exact tool-argument parse are in a1794fb; this commit carries the tests for them (a failed tool observation must appear in the self-check prompt; mcp_parse_exact rejects two objects in one string) and the i18n keys the new code uses: cmd.script.*, main.no_profile, tg.busy, tg.interview.running, ui.agent_busy in all three catalogues. The rest is the in-flight work from the shared session: engine/frontend, plugins, telegram/a2a, and their tests. make check: all tests passed; check_i18n ok, 204 keys in 3 catalogues. |
||
|
|
7f8493c949 |
ui: multiline prompt, shift+enter, mouse; cache plugin; judge headers
Prompt box
- The input wraps at the window width and grows from one to five rows;
beyond five it keeps the line with the cursor visible and scrolls inside.
The conversation and sidebar shrink instead of the prompt being cut.
- Shift+Enter inserts a newline. It accepts the CSI-u and xterm modifyOtherKeys
sequences and Alt+Enter; modifyOtherKeys is enabled at start and disabled on
exit/signal. Enter still sends.
- History entries are folded to one line so the line-based history file stays
readable.
- Mouse wheel scrolls the transcript (3 rows) in the prompt and during a turn.
Cache plugin
- New plugins/cache/cache.so: sidebar block and /cache command with the
provider prompt-cache hit rate (last and session), cumulative cached tokens,
and the junction cache from X-Junction-Cache plus its /status cache object
(entries, hits, misses, bytes, ttl, joined).
- sp_meter/agent/engine now carry cached_total; the UI fills it.
- plugin cache { } added to the user config.
Junction judge schedule
- The transport parses X-Junction-Judge-Next/-In/-Next-Step/Every/Target/
Model/Cache from every chat response and publishes the last one on the host.
- The junction widget and /junction show "judge next in N ... via ... cache
..." when the provider sends it; no stale schedule after a plain model.
- X-Junction-Cache is parsed even when no judge headers are present.
Self plugin
- Human labels and units: memory, threads, open files, children, bytes read/
written; "children" instead of "kids".
Errors
- An in-stream error event now reads "provider error: ..." instead of "sse:",
because it is the provider/router talking, not the stream parser.
make check: all tests passed.
|
||
|
|
af2001bfee |
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.
|
||
|
|
1e15c91e4e |
interview: the model talks to the user, USER.txt rides in the prompt
The six-question form is gone. `splinter --interview` now opens the chat with an interview system prompt: get to know the person, one question at a time, then write a compact summary and end with INTERVIEW_COMPLETE. - the marker is captured in the engine's turn thread and in the synchronous -p path: the summary before it is written to ~/.splinter/USER.txt (0600), the marker is stripped from the answer and the conversation, and a "interview saved to USER.txt" note goes into the transcript. An installation from before USER.txt keeps working: profile/<user>.md is the fallback until the first new interview. - the USER.txt text is appended to the system prompt of every later session (plain "What you know about the user" block), including after /new and an agent switch (it rides in base_prompt). - --interview is a chat mode with the interview prompt and no agent profiles; it needs a provider like any chat. - Telegram: /interview swaps the system prompt, starts the conversation and restores the normal prompt once the summary is captured. The initial turn and every later reply are checked, so a model that summarizes immediately also works. - test_interview.sh now proves capture, marker-free USER.txt and the summary in the next request; test_gateway drives /interview and the fake model answers with the marker when the interview prompt is in the request. - docs (README, PLUGINS) describe the new flow. make check: all tests passed. |
||
|
|
0f46c22a58 |
model picker, steer feedback, tolerant SSE with retries, junction headers
- /model in the curses chat opens a picker: Up/Down, typing filters by
provider/model, Enter takes the selector, Esc cancels. The list comes from
the backend (sp_engine_models -> sp_provider_choices), not from a text
scrape; the socket has a `models` command, so --attach gets the same picker,
and the switch is still the ordinary "/model <selector>" input.
- steering: Enter during a turn now says so twice - a "steering queued: ..."
row in the transcript and "Ns steering queued (n) steer>" in the input line
until the step boundary picks it up; a rejected steer is an error entry.
- input lag: typing during a turn is echoed immediately (the input line is
redrawn per key, not at the next 100 ms frame), and the history is only
repainted when its generation changed, so a streaming turn no longer
repaints the whole transcript on every clock tick.
- sidebar: the first line of every widget is bold, like its heading, so a
plugin block has a title instead of a wall of small print.
- junction plugin: keeps every response header from /mcp, the status route and
/v1/models; the widget shows the X-Junction-* routing stats, /junction lists
all headers per source. It reads the status aliases (/status, /v1/status,
/queue, /v1/queue) and remembers the one that answered, parses queue,
endpoint p95/exhausted counts, and counts the models (/v1/models, probed on
its own slower interval because it goes upstream).
- SSE: blank lines no longer abort a pretty-printed object, a truncated tail
is dropped instead of failing the turn ("incomplete data line" is gone), and
a [DONE] with a fragment clears it.
- retries: a request that fails before anything streamed (connection, missing
status, 5xx) is tried three more times, 5 s apart; 4xx is not retried, and
after the first chunk the error is reported instead of printing the answer
twice. Ctrl-C ends a wait at once; SPLINTER_RETRY_WAIT_MS overrides the wait.
- tests: test_sse (split object across events, truncated tail), test_agent
(four 500s = four requests; two 500s then an answer), test_engine and
test_protocol (models list), test_junction (headers, aliases, models),
test_ui (/model picker), test_focus (status keys).
make check: all tests passed.
|
||
|
|
1726bc1967 |
ui: a status bar above the prompt, a scroll fix, a steer space
The screen had no room for the numbers that say how a turn is doing, and two older behaviours still hurt: scrolling to the top made PgDn jump back to the top, and a catalogue's steer mark without its trailing space glued the typed text to ">". - draw_statusbar() in curses.c: one row above the prompt with ctx used/max + [|||| ] gauge, cache share and tok/s. The history and sidebar lose one row; the prompt stays the bottom row. The bar is drawn on every idle tick, during a turn and in --attach. - ctx: optional field on a provider (and in core) in tokens; the engine reports it in struct sp_engine_state. SPLINTER_CTX_MAX still overrides it. - cache: sp_reply gained tokens_cached. OpenAI reads prompt_tokens_details.cached_tokens / prompt_cache_hit_tokens, Anthropic reads cache_read_input_tokens and counts cache reads+writes in the prompt total. sp_agent_stats keeps the last request's prompt and cache share; the engine keeps the turn's output tokens for a real tok/s. - scroll: grow scroll by the growth of maxscroll, not by the distance from the first visible line. At the top that distance was 0, so every frame re-added the whole scrollback and PgDn could not leave the top. - steer mark: append the missing space if a catalogue omits it. - protocol state carries ctx_used/ctx_max/cached/turn_tokens_out, so the attached UI shows the same bar. - tests: cache parsing in test_sse/test_openai/test_anthropic, ctx parsing in test_confblock, and test_ui checks the bar, the cache share and the PgUp-to-top/PgDn-down path. make check: all tests passed. |
||
|
|
a01bfe9df1 |
sessions switch locally, gateway keeps caller settings and mixed calls
- sp_engine_switch(): close the old engine and open the chosen session from the same options; if the new one fails, reopen the session the engine was on. The protocol's open and the in-process /open both use it. The curses screen clears the pane and replays the new history, so /open no longer says it needs --attach. - gateway: temperature, top_p and max_tokens (max_completion_tokens) are forwarded to the provider instead of dropped; request bodies may be Transfer-Encoding: chunked; a mixed reply runs the gw_ calls, returns the caller's calls in tool_calls and puts the local observations in content (also in the SSE delta), so the caller can echo them back. - reconnect: when the remembered session is gone, the screen says which one and stays on the session the server has instead of silently swapping the transcript. - ring: the exits' transports are disposed on plugin shutdown. - /status goes through the catalogues like the rest of the UI (the English labels and their alignment are unchanged, so existing parsers still work). - the man page passes mandoc -Tlint and covers the gateway and /open. Tests: test_ui.sh covers local /sessions and /open (new, back, history), test_protocol.sh the shared switch, test_reconnect.sh a vanished session, test_gateway_openai.sh forwarded parameters, a chunked body and the mixed reply in JSON and SSE. make check green. |
||
|
|
a9f175c25b |
backend/frontend: an engine every front end can talk to
The harness was two halves that could not see each other: main.c built the
agent, ui.c ran it -- with the curses thread model, the approval condition
variable, the slash commands and the provider switching inside the drawing
code. A second front end had to copy all of it.
Now:
src/backend/ engine.c owns the session, the turn thread, the event queue
and every command; agent, transports, tools, session, config,
providers, plugins and the protocol servers move here.
src/frontend/ curses.c draws and reads keys through ui_backend.h;
ui_local.c is the engine in this process, ui_remote.c is a
served engine behind a socket. protocol.c serves the engine
as JSON lines (protocol 2: history, approvals, steering);
client.c is splinterctl, the reference client.
splinter --serve / --attach: the same screen runs as a client of a served
engine, so the socket carries everything the front end needs. docs/PROTOCOL.md
and docs/FRONTENDS.md describe the contract; docs/proto-example.py is a
60-line client. tests/test_engine, test_protocol and test_attach cover the
event order, the socket and the attach mode.
Review fixes in the same tree: dynamic line buffers (9 KB prompts and 8 KB
events were truncated), a turn event no longer ends the busy window (steer
leftovers), the screen finalises every turn, /new keeps the profile, reopens
the log and gets unique ids, the profile is remembered in <session>.agent so
--resume comes back in it, agent statistics are a locked snapshot (no data
race), !shell keeps 64 KiB with a marker, the socket probes for a live server,
compares its inode and sets CLOEXEC/SNDTIMEO, exit 2 means configuration,
BSD peer checks use getpeereid, and the i18n checker scans the new
subdirectories again.
Includes the parallel session's SSE fix: the parser reports what a line
produced, so a tool name no longer lands in the answer ("readread").
|