splinter: the cli transport answers again, and .so files leave the index

One-shot mode always installed a stream callback and then, on success, printed
only a newline - correct for the openai transport, which had already streamed the
text, and wrong for every transport that cannot stream. With --transport cli the
answer vanished: 'splinter -p ... --transport cli' printed an empty line and exit
0, so a claude or opencode backend looked like a model that had nothing to say.
The callback is now installed only when the transport publishes send_stream.

  SPLINTER_CLI_CMD=hostname splinter -p 'sag hallo' --transport cli --plugin ...
  kitt

Also: libsplinter.so and plugins/*.so were tracked, so every build produced a
dirty tree (and a conflict on any pull). They are ignored and removed from the
index; the binaries are rebuilt by make.
This commit is contained in:
Konrad committed 2026-11-08 14:53:45 +00:00
1 parent 41662a7293
commit 02fcb3c3ba
11 files changed
+16 -3

No files matched your search

+5
View File
@@ -5,3 +5,8 @@ tests/test_tool
tests/test_session
tests/test_transport
tests/test_agent
# build artefacts: a .so in git is a .so that conflicts on every build
*.so
plugins/*/*.so
tests/test_*
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11 -3
View File
@@ -787,12 +787,20 @@ main(int argc, char **argv)
return 0;
}
cfg.stream = stdout_stream;
/*
* Only claim streaming when the transport can stream. With a transport that
* cannot (the cli plugin, an MCP-backed one), setting the callback made the
* agent take the non-streaming path while main still assumed the text had
* already been printed - the answer vanished and only a newline came out.
*/
cfg.stream = ag.tr.send_stream != NULL ? stdout_stream : NULL;
cfg.stream_ctx = NULL;
rc = sp_agent_run(&ag, prompt, &answer, &err);
if (rc == 0) {
/* streamed output already reached the terminal; just end the line */
printf("\n");
if (cfg.stream == NULL)
printf("%s\n", answer.p != NULL ? answer.p : "");
else
printf("\n"); /* the stream already printed it */
} else {
fprintf(stderr, "splinter: %s\n", err.p ? err.p : "turn failed");
}