- --openai-listen: an OpenAI-compatible /v1/chat/completions and /v1/models.
The model gets splinter's local tools as gw_* (executed here) and the
caller's tools under their own names (returned as tool_calls to run there).
Local calls loop inside one request; a mixed reply runs the local calls and
asks again. --autonomous gates mutation; beyond loopback a bearer token is
required; stream:true answers with SSE.
- --serve keeps several sessions: sessions/open over the protocol and
/sessions, /open in the attach screen. The server owns the engines, closes
the old one before opening the next (plugins keep globals) and sends
state/history after every switch. Session ids are unique per process, so two
engines in the same second no longer share a file.
- --attach reconnects: when the server goes away the screen keeps running,
retries every second, asks for its session by id and restores the
transcript; a missing session falls back to the server's current one.
- transports own their context now: provider switches and close dispose it
(a switch used to leak one per change). The idle screen repaints entries it
drains, so a reconnect note is not invisible.
- docs/GATEWAY.md; PROTOCOL, FRONTENDS, README and the manual page describe
the three; tests cover the gateway tools, sessions/open and a server
restart under --attach.
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").
- 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>
The diagnostic path for a delegate that fails: the observation carries
the child's exit status, its own error text and the job line, with no
model turn and no transport. On 2026-11-10
'--delegate claude0 -p "sage nur: beta"' answers beta, so the old
exit 2 is not reproducible; TODO moves it to done and keeps the command
as the way to check again.
The A2A server also uses the spec's codes for what it refuses now:
CancelTask -32002 (TaskNotCancelable), push configuration -32003,
SubscribeToTask -32004.
test_delegate_cli.sh covers the run, an unknown id and a missing task;
test_a2a_server.sh covers the cancel and push errors. README, man page,
TODO and the site follow.
src/a2aserver.c is a minimal HTTP/1.1 + JSON-RPC endpoint:
--a2a-server-listen and --a2a-listen-port. SendMessage runs one turn in
its own conversation (system prompt plus the caller's text) and returns a
completed Task; GetTask returns it from the in-memory store;
GET /.well-known/agent-card.json serves a card with the JSONRPC interface.
Beyond loopback SPLINTER_A2A_SERVER_TOKEN is required and checked as an
Authorization: Bearer header. One request at a time, one connection at a
time, no TLS.
Streaming, CancelTask/SubscribeToTask, file/structured parts, push
notifications and continuation of an interrupted task are refused with a
JSON-RPC error instead of half-answered.
test_a2a_server.sh covers the card, SendMessage, GetTask, the streaming
refusal and the token. README, PLUGINS.md, the man page and the site
follow.
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.
env=NAME=VALUE on a delegate line (repeatable) is set in the child right
before exec and beats what the parent exported, so two delegates can run
the same cli with two accounts. Remotely it goes in front as
`env 'NAME=VALUE'`, quoted like the rest. cli_env = NAME=VALUE does the
same for the main cli transport. A bad name is an error with the line.
Also in this commit, the work in progress from the tree: swarm and
provider state, the provider/scheduler/planner/tmux plugins, the ui test,
whose tmux session name is now per run so parallel runs do not collide.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebuilt from scratch after the previous attempt left no code behind: what
exists here is what compiles and what the tests prove, and nothing else is
claimed.
What is in it:
- a turn loop that refuses an over-budget request before sending it, reports
unknown tools instead of guessing, and honours authorization classes
(read runs, mutate/destructive ask unless --autonomous);
- a registry that is authoritative - the model names a tool, the registry
decides whether it exists;
- an append-only JSONL session (O_APPEND, fsync per record), where a crash can
only truncate the tail and the tail is skipped, not repaired;
- two transports: a deterministic mock (queue of replies, last request kept)
and HTTP via curl(1) with the request body in a temp file;
- two builtins that exist to prove the classes: echo (read) and run
(destructive, reports its exit status as an observation).
Five test binaries, no external framework, no network: mock driver covers the
answer path, a tool round, an unknown tool, a denial, autonomy, a failing tool,
the step limit, the byte budget (asserting that nothing was sent) and a
non-2xx reply.
The wire format is splinter's own line protocol (user/observe out,
answer/tool in); provider adapters translate. That is why the loop is testable
without a model, and why no vendor JSON is parsed in the core.