main
7
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f7120882fa |
sessions: a resumed session is the whole transcript, not a chat log
A session file was written as if it were a chat: role and text, nothing
else. Reading it back kept "user" and "assistant" and dropped everything
else - and nearly every line of an agent transcript is an observation.
Measured on three real sessions: 21 of 1507 messages came back, 8 of 1356,
3 of 317. --resume then sent 1% of the conversation and the model had no
idea what it was continuing.
Three writers had to change with the loader:
- A turn that asked for tools wrote no line at all (agent.c only wrote
when ncalls == 0). It now goes out with its tool_calls, and each result
with the name of its tool and its call id; a provider rejects a tool
message without them.
- {"role":"user","text":""} came from the steer path and showed the model
a blank human turn it answered. sp_session_append_rec writes nothing
when text and calls are both empty.
- A record from the old format has no name and no call id. It is paired
with the next unanswered call of its pending assistant turn, or given a
synthetic one (recovered-N). Dropping it is what emptied every resume;
keeping it unpaired is what a provider answers with 400.
The same pass gives the core its own compactor (compact.c): a thread digest
- one line per dropped message, OPERATOR: 800 chars, assistant: 300, tool
result 160 - so the model keeps the story, not a count. lcm stays a plugin
that runs after it; sp_core_compactor() is the fallback only when no plugin
registered one, because running both eats the conversation before lcm sees
work to do.
Two bugs fell out of the same area:
- The plugin host was only built when a plugin was configured, so a
plugin-less run had no compactor at all: over max_bytes the turn was
refused instead of compacted (90 KB session, budget 8000, "nothing
sent").
- lcm walked *forward* past tool results at the tail boundary, which
silently shrank the tail: a turn with two results kept four messages
where keep_tail says six. Walking back to the assistant that carries
the call keeps six and no orphan.
And the .meta sidecar is shared now: the core rewrote it with only the keys
it knew, so anything a plugin put there was gone on the next open. It
carries unknown lines through (extra[8][160]), which is what lets a plugin
mark a session in the core's own file.
Tests: tests/test_corecompact.c (10 checks, no plugin), the resume cases in
tests/test_session.c, and the tail-size check in tests/test_compactor.c.
Each was seen red on the old code before it was green on the new.
|
||
|
|
36a66ab4f0 |
self monitor, MCP session tools, junction serving endpoint
- plugins/self: what the session costs the machine - RSS, CPU, threads, fds and io of the process itself from /proc/self/*, and the same (count, RSS, CPU) for every process whose parent chain reaches it: run calls, MCP children, delegates. Widget, /self and the session_usage tool; interval in the plugin block (default 2 s). - MCP server: the session tools. splinter_sessions, splinter_state, splinter_models, splinter_agents, splinter_history, splinter_say, splinter_open, splinter_model, splinter_agent, splinter_steer, splinter_cancel, splinter_approve. Say starts a real turn and returns the answer; a turn parked on an approval returns the question instead of failing. Mutating tools obey --autonomous. `--daemon --mcp-server-listen` runs the MCP server on a thread beside the Telegram daemon. - the MCP server asks the engine for its registry on every call (a session switch replaces it) and copies the tool name out of the parsed JSON before freeing it (the first version compared a dangling pointer and answered every session call with empty text). - junction: "serving <endpoint>" - streaming answers carry no X-Junction-Endpoint, so the plugin compares the route targets' ok counters from /status between samples and names the one that grew, with its last_ms. The header is still used when present (non-streaming). The X-Junction-Endpoint of the plugin's own /v1/models probe remains a probe fact in /junction only. - transport: X-Junction-Endpoint is parsed from the response headers in both the streaming and the non-streaming path and published through sp_host_served_by(); sp_reply carries served_by. - the curl rate guard (--speed-limit/--speed-time) is gone: it cut slow router streams with "Less than 1 bytes/sec" even while keepalives arrived. The overall -m timeout stays. - focus: the sidebar shows "recap N, every M turns", and an applied recap writes "recap applied (turn N, every M turns)" into the transcript (host status messages are now drained during a turn; protocol clients get them as entry events too). The initial goal announcement says so as well. - tests: test_self, test_mcpsession.sh (real socket), test_focus status messages, test_junction serving placeholder. make check: all tests passed. |
||
|
|
614988aa68 |
junction plugin, light/dark themes, goal completion
- plugins/junction: evaluates the X-Junction-Mcp header and /status; the sidebar widget, the "junction" status segment, junction_status and /junction show uptime, MCP-server health, queue and request counts. The url/header come from the plugin block, the mcp junction server or SPLINTER_JUNCTION_URL/TOKEN; the key is never printed. - theme: two flat themes. light is a white page with black text, dark the same inverted; chat, sidebar and input share the page, the status line is the one separate surface. Each CDE palette keeps its own rules. - curses: the sidebar uses the theme's own text on its own background (white/black) instead of white on a darkened surface; the one column between chat and sidebar is painted, so a white theme has no black seam. - focus: the goal goes into the first prompt (config, resume, planner), and every goal-carrying text asks the model to end with GOAL_COMPLETE. The marker is read from the conversation and the session log and recorded as goal_state=succeeded in the session meta; /goal and the sidebar say [done], reminders stop, a new goal opens a new one. - tests: test_junction (fake server, header identity, no colon in widget continuation lines, no key in the output), test_focus (announcement, completion in the compactor and from the tick, persisted state), test_theme (flat themes, list order). make check: all tests passed. |
||
|
|
bff47eede8 |
ui: palette roles, a working unlimited usage count, /goal as the recap
Three things the screen and the goal were getting wrong. Colours. The theme had one accent for the user and grey for everything else. theme.h now carries agent, think, tool and notice colours. A CDE palette maps them to sets 7 (answer), 3 (reasoning), 6 (tool) and 8 (status); Xresources uses colour10/11/14/13 on dark and 2/3/6/5 on light. Role colours keep their hue and are pushed from the surface only when they would disappear; each role has a slightly different minimum, so even a monochrome palette yields distinguishable steps. The 256-colour mapping now takes the nearest cube/ramp entry instead of rounding each channel down, which turned a dark orange into grey 240. Usage. sp_usage_get() only counted requests inside a declared window. A provider without limit= therefore always read "0 calls" in the sidebar, although every call was in its log. Calls are now counted when no window is declared; test_usage covers it. Goal. /goal <text> set a variable and answered "goal set" without starting a turn. The engine now starts the recap prompt: the model writes a short recap, the focus plugin remembers that answer and injects it every seventh turn (SPLINTER_FOCUS_EVERY still overrides). /recap is gone as a command; its old behaviour is what /goal does now. A palette and a wiki page are not enough to make that visible: the prompt, the confirmation entry and the sidebar goal all show up in the chat. Tests: palette role separation and indexed roles in test_theme, four unlimited calls in test_usage, recap capture/injection and the missing /recap in test_focus, and a settle delay so the UI tests type after ui_read_line() owns the keyboard. make check: all tests passed. |
||
|
|
554b4c97b8 |
splinter: tool calls with arguments, newline-aware rows, complete i18n
Four things, three of them reported by the operator.
1. Rows are counted from the real line structure. The old arithmetic
(strlen/cols) assumed one long line; a model's reasoning is full of '\n', so
the true height was far larger than the estimate and the text painted over
the answer below it - 'it just goes anywhere on the screen'. text_rows() and
row_offset() split on newlines first, then wrap. entry_lines() now measures
the string that is actually drawn ('role: text'), which also fixes the last
character of an entry being cut off (a truncated code fence).
2. Tool calls are visible: the agent's tool_begin hook fires before each call,
the UI drains the list under its lock and writes 'werkzeug: run
{"command":"echo a"}' into the transcript; the one at the top of the live
area shows the call while it runs. The reasoning entry is inserted before
those lines, so the transcript reads du, denkt, werkzeug, modell.
3. The chat pane has a black background, and the status line sits between the
pane and the prompt, the way Hermes shows it.
4. i18n is complete: every remaining literal in ui.c, main.c and the plugins
goes through the catalogue, including widget texts and format strings.
sp_td() carries a compiled-in English default, so a missing catalogue can
never drop a printf placeholder. tools/check_i18n.py runs in make check and
fails when a key used in the code is missing from any catalogue, or when a
catalogue key is used nowhere.
Seventeen test binaries green.
|
||
|
|
8fa3e9d7bb |
splinter: /goal as a command, and widgets that are actually alive
The goal is not configuration: it belongs to the conversation in front of you. So it moved out of the config file and became a command. - commands are an ABI now: sp_host_add_command / sp_host_command, so the UI never needs to know a plugin by name. A leading '/' is never sent to the model; an unknown command lists what exists. - works in both modes: '/goal <text>' in the TUI and 'splinter -p "/goal ..."' (exit 0 on success, 2 on an unknown command). - focus registers /goal (set, show when empty of arguments) and /recap (force a reminder into the next turn, regardless of the five-turn cadence). Fixed while testing it: the UI only repainted on a keypress, so a plugin widget that ticks was frozen on screen - the clock showed the time from when the window opened. The input read now times out after 500 ms and that timeout repaints the sidebar and status line: clock, focus and cps are alive while you do nothing. Fifteen test binaries green; test_focus covers the command path too: set, show, force a recap outside the cadence, refuse an unknown command. |
||
|
|
5453b0a85a |
splinter: focus plugin - the goal every five turns
Long conversations drift, and a model ten turns in is deep in a detail while the reason the session exists has scrolled away. focus puts it back: on every fifth turn it inserts one system message with the goal and asks whether the last step was closer to it. Details that matter and are tested: - one reminder per turn at most, even if compaction runs twice; - inserted BEFORE the newest user message, so the model reads goal then request and answers the request instead of treating the goal as a reply; - nothing at all without a goal: no goal, no noise; - the goal comes from the operator (config key goal -> SPLINTER_FOCUS_GOAL), never from the model, and is truncated with a marker rather than eating the budget it is meant to protect. The host now counts turns (sp_host_turn) so a plugin can schedule against them; that is what makes 'every five' mean five user turns and not five requests. Sidebar shows the goal and the reminder count. Fourteen test binaries green, test_focus drives the counter directly: turn 1 silent, turn 2 one reminder in the right position, a second compaction in the same turn adds none, turn 3 silent, turn 4 the second reminder. |