80 Commits
Author SHA1 Message Date
lotherk 74df75d438 no approval gate: splinter runs what the operator's registry offers
Konrad, 24.11.: "v1 geht durch ohne irgendwas. ich will auch keine approvals
generell. ich will nur das der user mit ask nach sachen gefragt werden kann."

Removed the whole approval apparatus, not just the prompt:

- agent.c: the decision point (sp_host_gate/approve callbacks), the
  pause/resume path (has_pending, pending_from, sp_agent_resume), ack_approval,
  ask_operator and the ack stdin thread are gone. A tool runs; its exit status
  is the observation. sp_tool_policy (allow/deny per profile) stays - that is
  the operator's own configuration, not a question to the operator.
- engine.c: SP_EV_APPROVAL, sp_engine_approve, the approve_pending condition
  variable and the `approval`/`approve` protocol commands are gone.
- openai_server.c: the v1 endpoint runs gw_* tools without a gate; the
  autonomous flag is no longer part of sp_gateway_opts.
- a2aserver.c: INPUT_REQUIRED and the resume-by-taskId path are gone; CancelTask
  stays. An A2A caller has no operator sitting in front of a prompt.
- mcpserver.c: --autonomous no longer gates mutating tools; the flag and the
  config key are accepted for compatibility and documented as changing
  nothing.
- telegram.c: tg_approve and the approval callback are gone; ask is the only
  dialog, and /cancel inside it still ends the turn.
- front ends: protocol.c, curses.c, ui_local.c, ui_remote.c, client.c lose the
  approval event and the waiting flag.
- ack.c stays: it is a plugin API (plugins/kids asks its parent through it),
  not splinter's own gate. --ack is documented as such.

Tests: test_pause.c guarded the pause and now guards the opposite (a mutate and
a destructive tool run, nothing is asked). test_a2a_input.sh, test_protocol.sh,
test_ui.sh, test_agents_ui.sh, test_gateway.sh, test_gateway_openai.sh,
test_agent.c and test_mcpsession.sh were rewritten the same way;
splinter_approve must now be absent from the MCP tool list. Every rewritten
test was run red against the old behaviour where that was possible.

make check: all tests passed (428 s)
make check-asan: all 47 test binaries clean
make check-tsan: all 47 test binaries free of data races
2026-11-24 11:46:10 +00:00
lotherkandClaude Sonnet 5.5 4af38ef91b recap: /recap <text> anchors the operator's note into the conversation every N turns
A system message before the newest user message, on the next request and
then every N turns (default 5; plugin recap { every }, SPLINTER_RECAP_EVERY,
/recap every N). Stored per session in <id>.recap, back on resume.
make check passes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 09:49:09 +00:00
lotherk 4f7255548d time: an unrepresentable time is "?", not an uninitialised struct tm
Four places formatted a time with strftime(localtime_r(&tt, &tm)) and
threw the NULL away. When localtime_r cannot represent the value - a
cooldown file can hold anything - tm is untouched and strftime formats
whatever the stack held: the operator read a limit that lifts at
"219250468--1414812756--1414812757", and a NULL deref in the die-hard case.

agent.c, engine.c, session.c and plugins/cli now check the return and fall
back to "?", the answer the foreign plugin already gives for a time it does
not know.

Found by review; the strftime call site is the same shape in all four.
2026-11-23 10:23:29 +00:00
lotherk 80f055711d races: five data races fixed, make check-tsan to keep them fixed
Found with ThreadSanitizer over the whole suite, not by reading:

- ack: sp_ack_dir() returned one static buffer. The waiter and the
  answerer (the gateway is both) sprintf'd into each other's path, so an
  approval request could be looked for in the wrong place. One buffer per
  thread now; test_ack asserts the two threads get different addresses.
- mcp: `stopping` was a plain volatile int with no happens-before, so a
  server thread could read 0 after shutdown killed its child and keep
  using buffers that teardown frees. Acquire/release accessors.
- foreign: fr.ready was set before the paths it guards were filled, so a
  second thread returned early and read empty paths; the flag and the host
  handle are now an atomic pair (publish) plus a mutex (the init itself).
- embed: catch_up() read c->path, c->offset and c->id outside the lock. A
  session switch mid-index published the old file's byte offset into the
  new session's index - everything below that offset was never searched
  again. A generation counter makes that run drop its batch, and the
  search path takes its snapshot under the same lock.

Proof, both directions:
- make check-tsan: 45/45 test binaries free of races (new target; the
  tree is rebuilt under TSan and back, like check-asan).
- test_embed's new gated test (a server that holds the batch until the
  session has been switched): without the generation check short.emb ends
  with 4 records, 1 of them leaked from the other session; with it, 1
  and 0. The test is deterministic, so it fails on a plain build too.
- test_ack: reverting to `static char root[]` fails
  "the two threads do not share one buffer".
- make check: all tests passed; make check-asan: 45/45 clean.
2026-11-23 08:30:29 +00:00
lotherk 30e202eca0 foreign: /foreign search keeps a quote in the text
The command built its JSON request with the operator's words as a plain
%s inside a string, so /foreign search he said "hi" there ended the
value early and was answered with "'query' is required" - the whole
phrase lost. The text (and the source/id pair) goes through
sp_json_escape now.

  before: /foreign search he said "hi" there -> error: 'query' is required
  after:  the same command reaches the stores and answers
  tests/test_foreign: red with the old line (2 failures), green with the fix
  make check: all tests passed, rc=0
2026-11-22 23:57:00 +00:00
lotherk f5d63f6199 sessions: the foreign picker counts and dates what it lists
Three bugs in the /sessions picker, all of them found by review and all of
them visible on the screen:

- sp_engine_sources() hard-set every foreign source's count to 0, so the
  picker offered "claude (0)" while 82 rows were behind it. The count now
  comes from the same listing the picker shows.
- sp_foreign_sessions() hard-set each row's date to 0, so every foreign
  session drew as 1970-01-01. The plugin prints "%Y-%m-%d %H:%M" and the
  row's first column is parsed into epoch seconds.
- The foreign plugin's list tool queried with its configured default
  (limit = 25) no matter what the caller asked for, so asking for 100 rows
  returned 25 and a store with 290 sessions looked like one with 25. The
  caller's limit now reaches the SQL.

Proof: tests/test_foreignopen.c asserts count == 1 and mtime > 1600000000
against a fixture store; reverting either fix makes both checks fail. Live
over the socket, before: [('splinter', 100), ('claude', 0), ('opencode', 0)]
with mtime 0 on every row; after: [('splinter', 100), ('claude', 82),
('opencode', 100)] with mtime 1795387200. sqlite3 counts 290 opencode
sessions and 82 claude files, so the numbers agree with the stores.

make check: 21 suites, 0 failures. check_i18n: 229 keys in 3 catalogues.
2026-11-22 22:52:51 +00:00
lotherk 1781cdd478 session: session_search and session_list also read claude, opencode and hermes
The session plugin scanned only splinter's own sessions, so "what did we say
about X in this folder" was answered as if no other tool had ever run here.
Both tools now delegate to the foreign plugin's tools through the registry
instead of reading the three stores a second time, and stay usable without it
(fallback to splinter's own sessions).

foreign_search also promises a cwd in its schema and then threw it away
((void)only), so a search always ran over every folder. The filter is applied
for all three sources now.

Two silent losses in the opencode search: substr(data,1,20000) cut the JSON
mid-object, so 2973 messages (up to 15 MB) never parsed and were dropped, and
assistant messages carry their text in data.content[], not data.text, so
73706 of them were skipped even when short. The text is extracted in SQL now
and the whole row is read. Hermes cut its match at 400 bytes in the same way.

Test: tests/test_sessiontools.c writes a claude session into its own working
directory and expects the hit through session_search and session_list; both
fall without the delegation. tests/test_foreign.c covers a long opencode
message, an assistant message via content[], the hermes cut and the cwd
filter; every check was counter-checked against the old code. make check exit
0, check_asan.sh 45/45 clean.
2026-11-22 13:20:45 +00:00
lotherk a48a2deec5 foreign: an imported tool call is a JSON array, not a run of objects
The importer collected tool calls by concatenating the objects it found, so a
source that recorded two calls handed the model "{} {}" where the API expects
"[{}, {}]". One call per assistant message is the common case and hid it.

The calls are now kept as the array they were read as, and their results are
kept with the same call ids, so the call/result pairing a provider insists on
survives the import.
2026-11-22 10:26:06 +00:00
lotherk fa16bfd0a9 foreign: adopt a claude, hermes or opencode session as a splinter session
Another harness's conversation is not a session until splinter can resume
it. plugins/foreign reads the three stores that already exist on the
machine - ~/.claude/projects/<slug>/<id>.jsonl, <root>/state.db (and
profiles/*/state.db) and opencode.db's session_v2/session_message - and
offers four tools plus /foreign:

  list, search TEXT, read SOURCE ID, import SOURCE ID

The stores are read with sqlite3 -readonly: an import copies, it never
moves. Reasoning blocks are dropped on the way in, because a provider does
not accept another model's thinking as evidence. Tool calls arrive with
their results in place, which is what makes the imported session worth
resuming instead of retyping.

import writes a real splinter session: the conversation as a replayable
jsonl, and a .meta with the source's title, its start time and *its*
working directory. So /open continues it in the chat,
--session-id <id> --resume in a shell, and -c finds it in the directory the
conversation actually ran in. The marker foreign=<source>:<id> survives
every later reopen, which needed the core's .meta sidecar to carry keys it
does not own.

Building this found nine bugs, each one seen red before it was green:

  - four use-after-frees: mcp_arg_string returns a pointer *into* the parse
    tree, read after mcp_json_free. That garbage in `only`/`src` was why a
    list of three stores answered "no sessions" and named AÃ_Â¥U.
  - sql_json took "no rows" for a failure (NULL), so every empty answer
    looked like a broken database.
  - args_split never terminated its buffers: /foreign list became
    "unknown subcommand 'list('".
  - path_join(dir, id, ".meta") built dir/id/.meta, so the sidecar landed
    in a subdirectory.
  - claude_slug_dir had the sign inverted and returned -1 for every
    non-empty cwd, so the project directory was never found.
  - sp_session_open overwrote cwd with getcwd() on *every* open, though the
    comment beside it promised the opposite: imports claimed the directory
    they were imported from and -c then picked the wrong session.
  - hermes_text ran strncmp(p, "\x00json:", 6) on an empty content, a
    one-byte allocation - heap-buffer-overflow, found by ASAN. The marker is
    stripped in SQL anyway.
  - hermes_calls never freed the root node on the object path (5456 bytes
    over 42 allocations).
  - list_any reported strerror(errno) with errno never set: a real file with
    the wrong schema read as "No such file or directory". The SQL reason is
    passed through now.

Checked end to end against the stores on this machine: claude 64 sessions,
opencode 25, hermes 0 (both hermes databases here are empty, count(*) = 0).
A real opencode session of 150 messages reads back with its tool output; one
of 75 imports with the right cwd and title, --resume sends its history, and
-c from the source directory opens it.

tests/sh/port.sh comes along: the shell tests guessed a port with
20000 + $$ % 30000 and on 2026-11-21 landed on one dtsession held. The fake
died, curl got an answer from dtsession, and twenty checks blamed the
gateway. They ask the kernel for a free port now.
2026-11-21 21:26:43 +00:00
lotherk 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.
2026-11-21 21:25:51 +00:00
lotherk 47d45bfd15 session: search only sessions that ran in this working directory
"What did we do last?" in a folder searched every session ever and wandered
off in another direction: the plugin walked the whole session directory while
only the prompt note was folder-scoped. Both tools now read the cwd from the
session's meta sidecar (sp_session_cwd, the same record the folder note uses)
and skip sessions from other folders -- and sessions that have no cwd record.

test_sessiontools creates a session in a second folder with the same needle:
with the filter disabled it shows up (red), with it the search and the list
stay in the folder, and even session=<id from elsewhere> answers "no message".

make check: all tests passed. make check-asan: all 41 test binaries clean.
2026-11-19 07:57:03 +00:00
lotherk 11d119be04 session: a plugin that reads earlier sessions, and a prompt that points at them
session_search walks the logs of earlier sessions in this folder newest first
(query, limit, days, session) and answers with date, session id, title and a
snippet around the match; session_list shows the sessions themselves. The
running session is left out -- that is context, and lcm's recall covers what
compaction dropped -- unless a call names it with session=.

The system prompt now carries two things. When the working directory has
earlier sessions, a paragraph says how many, the newest, and that
session_search/session_list read them, so the model looks before asking the
user something that was already answered. And the default prompt tells it to
use the mcp_* tools for tasks, memory, skills and knowledge bases actively, not
only when asked.

test_sessiontools drives both tools (hit, no hit, limit, days, explicit id,
list with the current session marked); test_engine checks the prompt paragraph
and the default text. make check: all tests passed.
make check-asan: all 41 test binaries clean.

The user's ~/.splinter/splinter.conf gained "plugin session { }" (backup:
splinter.conf.bak-session).
2026-11-19 07:40:49 +00:00
lotherk 0372981725 lcm: recall reads whole lines, and the catalogue loses 18 dead keys
One session line is one JSON object, and an observation can be tens of KiB.
recall read with an 8 KiB fgets, so a match in the middle came back without its
context and a long hit was printed in full. getline now reads the line whole; a
hit shows 1200 bytes of head and 400 of tail with the cut size, and the whole
answer stops at 12 KB. test_compactor drives it: with the cap raised it fails on
both the marker and the bound, with the cap it passes.

The i18n checker listed 18 keys nothing uses (the interview/plan/model
leftovers). They are gone from all three catalogues; catalogs.c is regenerated
from them by the build.

check_i18n: ok. make check: all tests passed. make check-asan: all 39 clean.
2026-11-19 06:34:38 +00:00
lotherk c11a6c7989 mcp: join the server threads and give the tools an owner
The MCP plugin's reconnect thread was detached: shutdown killed the child and
returned, so the thread could still be reading into its line buffer (up to
16 MiB) and could call sp_host_add_tool() into a host that was being freed -- a
use-after-free waiting to happen, and the reason three leaks were suppressed in
tests/asan.supp (read_line, register_tools, connect_server).

Each server now keeps its pthread_t, init creates it joinable, and shutdown
waits (bounded, 5 s) for every thread to return before joining it and freeing
its state. teardown() frees the line buffer for the HTTP transport too (it was
freed only for stdio) and closes the stdio pipes even when the child was
already reaped.

The registered tools leaked for a second reason: sp_registry_add copies the
struct, not the strings, and sp_registry_free freed only the arrays -- the
prefixed name, the description, the printed schema and the toolref of every MCP
tool were lost with the registry. struct sp_tool gets a dispose hook; the
registry calls it for each tool, and the MCP plugin frees what it allocated (the
default schema is strdup'd now, so ownership is uniform). Builtins and the
gateway's tools leave it NULL; every positional initializer got the new field.

tests/asan.supp is empty. make check-asan: all 39 test binaries clean.
make check: all tests passed.
2026-11-19 00:05:05 +00:00
lotherk 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.
2026-11-18 23:03:09 +00:00
lotherk 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.
2026-11-18 14:17:36 +00:00
lotherk 80154055f1 lcm: do not grow the conversation when the cut adds as much as it removes
/resume compacted N messages to N+1 every time. With keep_tail 6 and a short
history, the cut removed one message, then added the summary and the pinned
question: net +1. The context never shrank and the next /resume repeated it.

A message rewrite now happens only when it removes more messages than it adds
(drop > 1 + pinned). If the cut is that small, the old tool-output trim is kept
and the message list is left alone. test_compactor covers the 8-message case
(no change, no [lcm] row) and the 10-message case (10 -> 9).

make check: all tests passed.
2026-11-18 12:47:30 +00:00
lotherk 056b8c4277 steer mode runs commands; provider names; mcp servers in the sidebar
/model and the other slash commands are not messages to the model. In steer
mode a line starting with '/' or '!' now goes to the engine instead of
steer():

- /model opens the picker at once. A selector chosen while a turn runs is
  remembered and applied between requests (tool_end) or at the end of the
  turn, because replacing the transport under a live curl frees the context
  the request is reading. The note says the switch follows the request.
- /status, /cost, /usage, /sessions and ! answer immediately.
- /new, /reset, /compact, /agent, /connect say "not while a turn runs" and
  are not sent to the model; /open says the same.
- only a command that produces a prompt (e.g. /continue) is handed to steer().
The protocol input command allows slash commands while busy (plain text still
gets "a turn is running"), so --attach behaves the same.

The picker showed a phantom "main" provider with -m provider/model: the
selected endpoint was copied into the config as main. It is only main when no
configured provider owns it, so the row is now "junction  qwen3.6-35b-judged".
The stale ~/.splinter/splinter.conf.d/90-model.conf from the old global /model
was moved aside; it was the other source of that "main" row.

The mcp widget names every server and its state - "junction  connected",
"files  disconnected" - instead of counting tools.

make check: all tests passed.
2026-11-18 07:57:12 +00:00
lotherk 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.
2026-11-17 23:21:56 +00:00
lotherk dc9a1c62ec lcm: never drop the newest user message
A long tool loop pushed the question out of the six-message tail; the model then
wrote 'The compaction dropped the user's actual question' and recovered it with
recall (session 1794952419). The newest user message is now pinned and put back
right after the summary, so the task survives any compaction. test_compactor
covers it.
2026-11-17 22:23:05 +00:00
lotherk 82bda09ed1 lcm: cut old tool outputs before dropping messages
Tool observations are the bulk of a long conversation. Before lcm drops any
message it now cuts every old tool output to a head and a tail with a marker
quoting its first line; the middle stays in the session log, where the recall
tool finds it. Only when that is still over budget are messages dropped, so a
conversation often keeps all its turns and only loses the middle of old
outputs.

- plugin lcm { keep = 6; tool_trim = 8192 } sets the verbatim tail and the cap
  per old observation (0 turns the trim off).
- the compacted summary says when tool output was cut too.
- test_compactor: a 20 KB old observation is trimmed, nothing is dropped, and
  the marker points at recall.
- docs/CONFIG and docs/PLUGINS updated; the user config uses 6/8192.

make check: all tests passed.
2026-11-17 21:44:45 +00:00
lotherk 63b6742447 retry reasoning-only streams, /compact, token threshold and target
- a stream that carried only reasoning and then ended without an answer used to
  abort with no retry: guarded_stream counted every chunk as "already
  produced". Only answer text and tool calls block a retry now; the thinking
  may repeat, a lost turn may not. test_agent has a stream that thinks, fails
  once and answers on the second attempt.
- /compact [tokens]: runs the compactors now (default: compact_target, else
  8000 tokens) and reports messages and bytes before/after.
- compact_threshold / compact_target in core (tokens): once the last request
  was larger than the threshold, the next request is compacted to the target
  before it is sent. 0 disables either.
- lcm gains a read tool `recall`: case-blind search in the session log for
  what compaction dropped from the prompt.
- user config: compact_threshold = 32000, compact_target = 12000.
- README/CONFIG document the command, the two keys and the cache trade-off.

make check: all tests passed.
2026-11-17 21:34:57 +00:00
lotherk 8aee12e9d4 drop tmux/planner/sysinfo, tasks becomes processes, no capitalised calls
- plugins/tmux, plugins/planner and plugins/sysinfo are gone (plugin list,
  Makefile rules, tests, docs). The config no longer loads them; the stale
  .so files were removed from the install tree.
- plugins/tasks is plugins/processes: plugin name "processes", widget
  "processes", tools process_start/process_list/process_result/process_kill.
  The sidebar now lists only running work: a finished task keeps its output
  in process_result but stops taking a row forever.
- the dead planner link in the delegate (link_plan_quota -> command "tasks")
  is removed with the planner.
- tool call rows are no longer capitalised: "run  ls -l", "read  src/x.c" as
  the model sent them, not "Run "/"Read ".
- tests updated (delegate panel expects no finished row, engine/UI expect the
  lowercase call row, secrets/delegate use the processes plugin and tools).
- the user's config gets a Delegate/Scheduler section: the three providers
  carry review/plan/docs tags and keep max_parallel=2; plugin scheduler stays
  loaded so waiting jobs are retried.

make check: all tests passed.
2026-11-17 21:06:55 +00:00
lotherk 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.
2026-11-17 19:13:59 +00:00
lotherk 55ca5c71f8 junction widget: the model's route, nothing else
Two reasons the sidebar was useless: it named the route of the *configured*
provider model, not of the model the run was switched to (/model
deepseek-v4.1-flash kept showing qwen3.6-35b's kontron/kompute route), and it
repeated server counters (MCP servers, queue, requests, probe headers) that
have nothing to do with the conversation.

- sp_host_model()/sp_host_set_model(): the engine publishes the model it is
  actually on; the engine sets it at plugin load, after /model and on every
  state read. The junction plugin prefers it over the config.
- the widget is now only the model, the route from the matching rule (one
  target per row, "!" when that target's probe fails) and "N/M up":
  deepseek-v4.1-flash / route opencode-go0 / opencode-go1 / ... / 4/4 up.
  Uptime, MCP servers, queue, requests, endpoint p95 and every response
  header stay in /junction.
- widget text may use up to 8 rows (a four-target route plus model and
  health is seven).
- test_junction: the widget must be exactly "m\nroute a\nb!\n1/2 up" and
  must not repeat mcp/models/probe stats.

make check: all tests passed.
2026-11-17 18:28:00 +00:00
lotherk 7e8fe5b825 retries are visible in the prompt line
The session showed the last error as "retry 1/3 in 5000ms: openai: stream
ended with no answer" with nothing on screen: the turn looked hung for the
five seconds, then either answered or failed. The retry itself was fine; the
operator could not see it.

- sp_agent_config gains note()/note_ctx: a status line for the operator, ""
  clears it. The engine turns it into SP_EV_NOTE, so curses shows it in the
  steer line and protocol clients get the note event.
- agent_request() emits "retrying in N s: <reason>" before sleeping and clears
  it when the attempt answers or the retries are exhausted.
- i18n ui.retry_note in en/de/pt_BR; README says the wait is visible.
- test_agent: the note callback must have seen "retrying in" on the recovery
  case.

make check: all tests passed.
2026-11-17 18:14:31 +00:00
lotherk b0c1da65a2 junction: the session's route, not the probe's endpoint
The widget printed "endpoint=opencode-go" because that is the
X-Junction-Endpoint header of the plugin's own /v1/models probe, which
junction routes there by a path rule. It says nothing about where the
conversation goes, and the operator's qwen3.6-35b is routed to kontron and
kompute0..2 - so the line was wrong, not just imprecise.

- read the active model from the config (sp_usage_active -> provider model)
  and match /status' rules against it: exact model > glob > catch-all, rules
  with a path are another route. The result is the route line:
  "route kontron! kompute0 kompute1 kompute2" ("!" = that target's own health
  probe is not ok).
- /junction shows model, route and "route health: N/M up, down: ..."; the
  /v1/models header block is marked as the probe's route, not the session's.
- the header stats label the probe values (probe-ms=, probe-cache=) and no
  longer print the endpoint header as if it were the route.
- side_text(): wrap one line at a time and let a continuation use up to three
  rows; passing a multi-line string to one mvwaddnstr() double-counted rows
  and cut "route ... kompute1 kompute2" in half.
- test_junction: fake /status gains rules and per-endpoint probe_ok; the test
  sets the run's model ("m") and expects "route a b!", "probe-ms=12",
  "route health: 1/2 up, down: b" and no "endpoint=" in the stats.

make check: all tests passed.
2026-11-17 12:31:58 +00:00
lotherk 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.
2026-11-17 11:46:11 +00:00
lotherk 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.
2026-11-17 10:10:47 +00:00
lotherk be3d0ee415 ui: slash commands run off the screen thread, sysinfo one row per metric
A command that talks to the network (/connect, /model probe, a plugin
command, a commands/ program) ran on the UI thread: the prompt froze until
it returned. ui_command_run() now runs be->input on its own thread while
the screen keeps reading keys. One next line can be queued and is processed
when the command ends; Ctrl-C clears the edit, Ctrl-D quits. The worker
never touches curses, and the backend is not polled while it runs.

Widget text may now have continuation lines without "name:": they are
rendered under the widget above. sysinfo uses that for one metric per row
instead of wrapping "RAM ... CPU ..." into the same paragraph. A blank row
stays between widgets, not between their rows.

The Ctrl-C UI test looks for the active steer prompt; "working" is replaced
by it on the first 100 ms tick.

make check: all tests passed.
2026-11-16 18:42:27 +00:00
lotherk 67b4d5d070 goal in the session, /continue, a white sidebar, sysinfo
The goal lived only in the focus plugin's memory: a resume lost it and
there was no way to start the next turn from it. It is now stored in the
session's .meta (one line, 1000 bytes) and read back when the plugin sees a
new session id, so /open and a resumed process find their own goal again.
/continue reads the same sidecar and starts a turn with "Continue working
toward this goal: ...". /goal still sets it and starts the recap turn.

The sidebar was a patchwork of pairs and widgets could inherit the wrong
background. It now uses one PAIR_SIDE (white on a darkened theme
background) for every heading, label, usage row and widget; the window
gets that pair as its background, so no line paints its own surface.

New plugins/sysinfo: a widget thread samples /proc/meminfo, /proc/stat and
statvfs("/"), and publishes RAM, CPU, swap and disk with five-cell
[|||| ] gauges every two seconds. It is added to the shipped plugin list
and to the user's config.

agent.c keeps the last prompt/cache counters when a tool-call step reports
no usage. A zero there used to reset the ctx gauge in the status bar after
every tool call.

Tests: session goal survives reopen, /continue returns the prompt,
make check: all tests passed.
2026-11-16 18:30:42 +00:00
lotherk 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.
2026-11-16 17:48:22 +00:00
lotherk 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.
2026-11-16 10:18:41 +00:00
lotherkandClaude Opus 5.5 32a214aee3 ui: the sidebar is back, and it says where splinter runs
Removing it went too far: the conversation area should be plain appended
text, but the sidebar carries what no line of the transcript should repeat -
agent, provider and model, what is left of the allowance, the plugin widget
lines, the session and now the directory the tools act in ("~" for $HOME,
wrapped at the slashes). A narrow terminal drops it and gives the width to
the conversation.

No status bar: the running time and the tool lead the prompt, and /usage,
/status and /widgets print the same numbers on demand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:00:49 +00:00
lotherkandClaude Opus 5.5 a77641b699 ui: one text field that only grows; themes are Xresources or a CDE palette
The chat is now the whole screen and the input line the row below it: no
sidebar, no status bar. Entries are append only -- a growing answer stays in
its entry while it is the last one and continues in a new entry once a tool
line follows, so nothing that was on screen ever moves. The prompt carries
the agent name ("build> "), /widgets shows what plugins published, and
/status still prints the status segments.

The default theme is Xresources: *foreground, *background and *color0..15
from xrdb -query (or ~/.Xresources), falling back to the terminal's own
colour indices. Every CDE palette is a theme by its own name, painted the
way the desktop paints it (set 5 windows, set 4 text areas, set 6 dialogs,
set 1 active frame, set 2 inactive frame) with CDE's black-or-white rule.
"Default" is therefore the CDE Default palette again, which is what the
config asked for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 20:59:13 +00:00
lotherkandClaude Opus 5.5 bddba6423b anthropic 400 on repeated user turns, exit in under a second, /quit
- anthropic: two messages of the same role in a row (a failed turn asked
  again) put the second one's blocks after the closed message object; the
  API answered 400 "messages.1.role: Field required". The message now stays
  open until the role changes.
- exit took 20+ s: the mcp plugin's HTTP round trip to a server that is down
  had curl -m 60 and nothing killed it; shutdown now kills the curl in
  flight, and connects time out after 5 s. Widget threads slept a whole
  interval before seeing the stop flag; they sleep in 100 ms steps.
- /quit (/exit, /q) leaves the chat.
- the prompt mark has its space again: the catalogue trims trailing blanks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 20:31:51 +00:00
lotherkandClaude Opus 5.5 2c58dcfd2a cli providers take a model: provider prefix, {model}, -m occli/MODEL
A kind = cli provider now has a default model and a prefix
(provider = opencode), so -m occli/deepseek-v4.1-flash-free runs
"opencode run --model opencode/deepseek-v4.1-flash-free". {model} in cmd
marks where the model goes, otherwise --model is appended; a model that
already has a '/' is used as it is. sp_cli_command() builds the command for
-m, delegates and the cli plugin's pool fallback. Model names are limited to
letters, digits and ._:/@+- since the command goes through /bin/sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 20:08:16 +00:00
lotherkandClaude Opus 5.5 05c8d936e7 anthropic transport, provider usage APIs, endpoints as /v1 base
- kind = anthropic: the Messages API over curl, OAuth tokens (sk-ant-oat)
  as Bearer with the oauth beta, tool_use/tool_result blocks.
- --doctor spends no tokens: it asks /models and the provider's own usage
  route (ollama /api/balance, opencode go /v1/usage) instead of a tiny turn;
  cli providers are only checked for the program. /usage shows the same
  provider figures, cached for a minute.
- endpoint names the API base (https://host/v1); sp_endpoint_url() builds
  chat/completions (default), messages, models and usage from it. A full
  route is still accepted and cut back to the base.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 19:35:41 +00:00
lotherk 62a041a61b mcp: servers from the config, HTTP transport
The MCP client could only start one program and talk to it on a pipe; a server
behind an endpoint (junction at http://host:8090/mcp) had no way in. Now the
config names the servers and the plugin speaks whichever transport each one
offers:

- new `mcp NAME { url | cmd | header | enabled }` block (and the flat
  `mcp = NAME | url=...` form), parsed into struct sp_mcpserver; an entry
  without a url and without a cmd is refused with its line number
- streamable HTTP in plugins/mcp/mcp.c: one POST per JSON-RPC message, answered
  with one JSON object or an SSE stream of `data:` lines - both are read,
  Mcp-Session-Id is kept and echoed back, and the Authorization header travels
  through curl's stdin config so the token never appears in ps
- several servers register side by side; tools are mcp_<tool> for one server
  and mcp_<server>_<tool> for more, so two servers that both offer `search` do
  not overwrite each other. A server that fails its handshake is reported and
  skipped, the rest still load. SPLINTER_MCP_CMD stays as the one stdio server
- tests: the config and block parsers, and a socket server in test_mcpclient
  that refuses the tool list without the configured header and answers the call
  as an event stream
- README and docs/CONFIG.md describe both transports and where the token lives
2026-11-12 12:05:35 +00:00
lotherkandClaude Sonnet 5.5 2e7a88c462 usable: opencode-go session header, embedded catalogs, locale fixes, calmer UI, --doctor
- openai transport sends x-opencode-session (opencode-go refused every request
  without it) and a splinter user agent
- the message catalogues are compiled in: an installed binary no longer shows
  raw keys (ui.ready ...); LANG=de_DE now selects German (lang was emptied by an
  overlapping snprintf), pt_BR is matched
- sidebar rewritten (agent, provider/model, usage, goal/plan, last turn);
  idle widgets say nothing; status line shows only what matters
- tool calls shown readable instead of JSON with \u escapes
- providers without their key variable are skipped by pools and refused by -m
  with a clear message; --doctor checks every provider

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 03:22:49 +00:00
lotherkandClaude Sonnet 5.5 478e2ec663 planner, tmux: rewrite with real JSON, validation and tests
planner: v0.2, state in plan_task_*.json via libmcp, atomic replace, refused states.
tmux: v0.3, in-process capture-pane diff, no watcher helper, tmux_ask/read/capture.
tests: test_tmux added, test_delegate_cli no longer hangs without a tty.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 17:13:20 +00:00
lotherk 9c205dcd21 a2a: the client can send a file, and already saves what it receives
a2a_send posts SendMessage with a text part and, when a path is given, a file
part: base64 bytes, a name (the path's last component) and a media type
guessed from the name, at most 8 MiB -- the same cap the server enforces on
the way in. The answer is text; a file the other side sends back is saved by
collect_parts and named by path, which the tool returns.

sp_b64_encode is the missing direction of the base64 helper, with vectors of
its own in test_b64: empty input, one and two trailing bytes, a NUL.

test_a2a: a real PNG is attached, the request carries name, mimeType and the
base64 bytes, and the other side names it in the answer; a missing path is an
error, not a silent empty message.
2026-11-11 10:25:49 +00:00
lotherk a6d54d120b a2a: a2a_subscribe reads a remote task's events
The client half had GetTask and CancelTask; a subscription is the one that
shows what a task is doing. The tool posts SubscribeToTask and reads the SSE
stream into one observation: each statusUpdate's state and message, each
artifactUpdate's text, and a whole task if the server sends it that way, in
the order the events arrived. A plain JSON-RPC answer -- usually the
TaskNotFound error -- is read too, so a refused subscription says -32001
instead of 'no events'.

The fake agent answers SubscribeToTask with a status update plus an artifact;
test_a2a drives the tool through the script transport and checks the happy
path and the unknown id.
2026-11-11 09:18:26 +00:00
lotherk cc9747b1a7 model choice sticks, endpoints are probed, connect is tested, A2A takes files
/model writes its choice to <config>.d/90-model.conf, so the next start uses
it; picking main deletes the file and the configuration speaks again. With a
plugin transport nothing is written, because that program picks the model.
/model probe asks every endpoint /v1/models and offers what it really serves
as buttons; the callback carries an index, because a GGUF path does not fit
in Telegram's 64 bytes. The TUI gets the same command: the list, or
/model <id|name>, with the same persistence.

/connect runs one tiny turn against the provider it just saved (30 s) and
says whether endpoint, model and key answer. The message with the buttons
goes out before the wait starts, so the save is visible immediately.

A2A no longer refuses binary parts: file{bytes} and raw with a non-text media
type are written to the session's inbox (0600, 8 MiB cap) and the prompt says
[file <name> at <path> (mime, n bytes)], so a text model can hand the file to
a tool. The client saves what a remote agent sends the same way
(SPLINTER_A2A_INBOX). SubscribeToTask stays refused: the task store has no
live events, and a one-shot replay would pretend to be a subscription.

Markdown gains <https://...> autolinks and images (as links, since Telegram
has no inline image without sendPhoto).
2026-11-10 19:33:38 +00:00
lotherk 544399a3bf a2a: GetTask/CancelTask as client tools, and a spec-shaped GetTask
The plugin registers a2a_get_task (read) and a2a_cancel_task
(destructive) for a local model that uses A2A as a tool source; both
share the endpoint or card and return the raw task/error JSON.

The server's GetTask result was wrapped as {"task": ...}; the spec's
result is the Task itself. Fixed, and the test checks the shape.

The website's tool-count regex missed digits, so a2a_get_task and
a2a_cancel_task were not counted; [a-z0-9_]+ now reports 25.

test_a2a drives both tools through the mock transport and checks the
session observations. Full make check green.
2026-11-10 08:28:12 +00:00
lotherk a85b1c4615 a2a: text/plain raw and string data parts
The server accepts text, a string in data, and a text/plain raw part
(base64) via the new sp_b64_decode; a url part (not fetched) or a binary
part is refused with ContentTypeNotSupported (-32005). The client reads
text, string data and text/plain raw, ignoring parts it cannot render.
The agent card now says streaming:true and pushNotifications:false.

test_b64 covers the decoder; test_a2a reads raw/data from the fake
agent; test_a2a_server accepts a raw part and refuses a url. test_ui
waits for the turn label to disappear after Ctrl-C before typing again.

Full make check green.
2026-11-10 08:16:50 +00:00
lotherk ef3c4d0b37 planner: one lock around the task list
The widget tick calls load_tasks() every five seconds; a tool updating a
task at the same moment had its array reset under it, which made
test_planner fail intermittently (about one run in six). A recursive
mutex now covers the three tools, the /tasks command and the tick; the
reload and the save happen under the same lock.

Found by running test_planner repeatedly after a full check failed once;
20 consecutive runs pass now.
2026-11-10 06:12:39 +00:00
lotherk d95ac721be a2a: discover the endpoint from an agent card
SPLINTER_A2A_CARD names the card; the first send picks the JSONRPC entry
from supportedInterfaces, falls back to the older single url field, and
keeps the discovered URL for the session. SPLINTER_A2A_URL still wins
when both are set. The card fetch uses the same secret handling as a
send: the bearer token goes through curl's stdin.

The fake agent serves both card shapes, and test_a2a.sh covers discovery
with and without supportedInterfaces.
2026-11-09 23:34:59 +00:00
lotherk 93e955a4c7 a2a: stream the answer, and a --no-stream path
The A2A transport implements send_stream now: SSE events are read as
StreamResponse (task, message, statusUpdate, artifactUpdate), artifact and
message text goes to the screen as it arrives, intermediate status notes
are ignored, and a completed status message is the answer only when no
artifact or direct message text came. Failed/canceled/rejected and
input/auth-required states fail the turn instead of becoming an answer.

One-shot mode already streamed whenever a transport offered it, so the
plain send path was unreachable from the CLI. --no-stream asks for it.
test_a2a.sh covers both SendMessage and SendStreamingMessage; the new
test_a2a_ui.sh drives the UI streaming path through tmux.

README, PLUGINS.md, the man page and the site follow.
2026-11-09 23:32:49 +00:00
lotherk 999787f3bf a2a: a client transport for another agent
plugins/a2a sends one SendMessage over JSON-RPC 2.0 with a text part and
reads either a direct Message or a Task in TASK_STATE_COMPLETED (status
message plus artifact text). Task and context ids are kept for the session;
a terminal task loses its id but keeps the context. Bearer token, timeout
and SPLINTER_A2A_FULL are supported.

Text only. Streaming, file/structured parts, push notifications,
GetTask/CancelTask and agent-card discovery are named as not built, so
nobody assumes otherwise.

tests/fake_a2a.py and tests/test_a2a.sh pin the wire shape, both result
forms, the bearer token and a JSON-RPC error. The site now counts the new
plugin (16) and names the transport; README, PLUGINS.md and ROADMAP follow.

TODO also records the live claude check: both configured accounts are at
their limit, exit 1 with the child's text, claude0 benched and claude1
queued; exit 2 remains unreproduced.
2026-11-09 23:21:18 +00:00