diff --git a/Makefile b/Makefile
index ee98178..628d569 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ CURSES_A = $(CURSES_DIR)/libcurses/libcurses.a \
LIB = libsplinter.so
LIBOBJ = src/buf.o src/tool.o src/session.o src/conv.o src/transport.o \
src/json.o src/sse.o src/openai.o src/transport_openai.o src/builtin.o \
- src/agent.o src/theme.o src/palettes.o src/decomp.o src/i18n.o src/delegate.o src/telegram.o src/log.o src/cmdscript.o src/folder.o src/interview.o src/ack.o src/mcpserver.o src/skills.o src/memory.o src/prompt.o src/config.o src/plugin.o src/curl.o src/swarm.o src/provstate.o src/md.o src/a2aserver.o
+ src/agent.o src/theme.o src/palettes.o src/decomp.o src/i18n.o src/delegate.o src/telegram.o src/log.o src/cmdscript.o src/folder.o src/interview.o src/ack.o src/mcpserver.o src/skills.o src/memory.o src/prompt.o src/config.o src/plugin.o src/curl.o src/swarm.o src/provstate.o src/md.o src/b64.o src/a2aserver.o
BIN = splinter
BINOBJ = src/main.o src/ui.o
PLUGIN = plugins/clock/clock.so plugins/lcm/lcm.so plugins/cps/cps.so \
@@ -37,7 +37,7 @@ PLUGIN = plugins/clock/clock.so plugins/lcm/lcm.so plugins/cps/cps.so \
plugins/tmux/tmux.so
TESTS = tests/test_buf tests/test_tool tests/test_session tests/test_conv \
tests/test_transport tests/test_agent tests/test_openai \
- tests/test_theme tests/test_plugin tests/test_memory tests/test_skills tests/test_telegram tests/test_delegate tests/test_builtin tests/test_ascii tests/test_ack tests/test_i18n tests/test_config tests/test_focus tests/test_sse tests/test_cli tests/test_compactor tests/test_secrets tests/test_mcpclient tests/test_kids tests/test_lifecycle tests/test_md tests/test_swarm tests/test_provstate tests/test_planner tests/test_jobs
+ tests/test_theme tests/test_plugin tests/test_memory tests/test_skills tests/test_telegram tests/test_delegate tests/test_builtin tests/test_ascii tests/test_ack tests/test_i18n tests/test_config tests/test_focus tests/test_sse tests/test_cli tests/test_compactor tests/test_secrets tests/test_mcpclient tests/test_kids tests/test_lifecycle tests/test_md tests/test_b64 tests/test_swarm tests/test_provstate tests/test_planner tests/test_jobs
RPATH = -Wl,-rpath,'$$ORIGIN'
PLUGIN_RPATH = -Wl,-rpath,'$$ORIGIN/../..'
@@ -107,7 +107,7 @@ plugins/cps/cps.so: plugins/cps/cps.c $(LIB)
# the day somebody adds an #include, every object depends on the headers that
# make up the interface: a change there rebuilds everything that could see it.
HDRS = include/splinter.h include/splinter_plugin.h src/config.h src/ack.h \
- src/curl.h src/log.h src/i18n.h src/md.h src/a2aserver.h
+ src/curl.h src/log.h src/i18n.h src/md.h src/b64.h src/a2aserver.h
$(LIBOBJ) $(BINOBJ): $(HDRS)
$(PLUGIN): $(HDRS)
@@ -142,6 +142,7 @@ src/config.o: src/config.h include/splinter.h
src/plugin.o: include/splinter.h include/splinter_plugin.h
src/ui.o: src/ui.h src/theme.h src/decomp.h src/i18n.h include/splinter.h include/splinter_plugin.h src/md.h
src/md.o: src/md.h include/splinter.h
+src/b64.o: src/b64.h include/splinter.h
src/a2aserver.o: src/a2aserver.h include/splinter.h vendor/libmcp/mcp.h
src/main.o: include/splinter.h src/config.h src/i18n.h include/splinter_plugin.h src/ui.h src/theme.h src/a2aserver.h
@@ -182,6 +183,8 @@ tests/test_ascii: tests/test_ascii.c $(LIB) $(BINOBJ)
$(TEST_RPATH) $(CURSES_A) $(LIBS)
tests/test_md: tests/test_md.c $(LIB)
$(CC) $(CFLAGS) -o $@ tests/test_md.c -L. -lsplinter $(TEST_RPATH) $(LIBS)
+tests/test_b64: tests/test_b64.c $(LIB)
+ $(CC) $(CFLAGS) -o $@ tests/test_b64.c -L. -lsplinter $(TEST_RPATH) $(LIBS)
tests/test_swarm: tests/test_swarm.c $(LIB)
$(CC) $(CFLAGS) -o $@ tests/test_swarm.c -L. -lsplinter $(TEST_RPATH) $(LIBS)
tests/test_provstate: tests/test_provstate.c $(LIB)
diff --git a/README.md b/README.md
index 844a67b..a7258ae 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ the screen, a sidebar on one quarter, plugins that can put tools and widgets
into both.
make # libsplinter.so, the binary, the plugins
- make check # every test binary (31), no network, no model
+ make check # every test binary (32), no network, no model
splinter # starts the chat from ~/.config/splinter/config
diff --git a/TODO.md b/TODO.md
index e9efa65..f4134d6 100644
--- a/TODO.md
+++ b/TODO.md
@@ -25,8 +25,10 @@ Turn in der Konversation des `contextId`), `SendStreamingMessage` (SSE,
`PushNotificationNotSupported` (-32003), `SubscribeToTask`
`UnsupportedOperation` (-32004).
-Offen: Datei- und strukturierte Teile, echte Push-Notifications und die
-Fortsetzung eines unterbrochenen Tasks (`INPUT_REQUIRED`).
+Text, text/plain `raw` (base64) und String-`data`-Teile werden gelesen; ein
+`url`- oder binaerer Teil wird mit `ContentTypeNotSupported` (-32005) abgelehnt,
+nicht abgerufen. Offen: echte Push-Notifications und die Fortsetzung eines
+unterbrochenen Tasks (`INPUT_REQUIRED`).
Naechster Schritt: Datei-Teile.
@@ -72,8 +74,9 @@ Naechster Schritt: entscheiden, ob die npm-Reste weg duerfen. Kein Code.
(JSON-RPC 2.0, Text, blockierend), in der UI `SendStreamingMessage` (SSE,
Artefakt-Text live) und findet den Endpunkt ueber `SPLINTER_A2A_CARD`;
`src/a2aserver.c` serviert `SendMessage`, `SendStreamingMessage` (SSE),
- `GetTask`, `ListTasks`, Multiturn ueber `contextId` und die Agent Card mit
- Bearer-Token. `tests/test_a2a.sh` prueft Task, Message, Token, Fehler,
+ `GetTask`, `ListTasks`, Multiturn ueber `contextId`, text/plain-`raw`- und
+ String-`data`-Teile und die Agent Card mit Bearer-Token; die Karte meldet
+ `streaming:true`. `tests/test_a2a.sh` prueft Task, Message, Token, Fehler,
Streaming und Discovery, `tests/test_a2a_ui.sh` den Streaming-Pfad,
`tests/test_a2a_server.sh` den Server und den Client gegen den Server
(Discovery, blockierend und streamend), `tests/test_a2a_context.sh` die
diff --git a/docs/PLUGINS.md b/docs/PLUGINS.md
index d13237e..9c2eef8 100644
--- a/docs/PLUGINS.md
+++ b/docs/PLUGINS.md
@@ -292,8 +292,10 @@ selected like any other:
splinter --plugin plugins/a2a/a2a.so --transport a2a -p "..."
It sends `SendMessage` as JSON-RPC 2.0 with one text part, blocking, and reads
-either a direct `Message` or a `Task` in `TASK_STATE_COMPLETED`; text parts from
-the status message and the artifacts are joined. `SPLINTER_A2A_FULL=1` sends the
+either a direct `Message` or a `Task` in `TASK_STATE_COMPLETED`; text parts,
+text/plain `raw` parts (base64) and string `data` parts from the status message
+and the artifacts are joined. A `url` or binary part is ignored on the client
+and refused on the server with `ContentTypeNotSupported` (-32005). `SPLINTER_A2A_FULL=1` sends the
whole transcript instead of the last user turn, and `SPLINTER_A2A_TIMEOUT` sets
the curl timeout (default 300 seconds). The task id and context id are remembered
for the session, so the next turn stays in the same A2A context; a terminal task
diff --git a/plugins/a2a/a2a.c b/plugins/a2a/a2a.c
index 5070913..acbb3e5 100644
--- a/plugins/a2a/a2a.c
+++ b/plugins/a2a/a2a.c
@@ -42,6 +42,7 @@
#include "splinter_plugin.h"
#include "curl.h"
#include "mcp.h"
+#include "b64.h"
struct a2a_cfg {
char url[512];
@@ -124,7 +125,19 @@ build_request(struct a2a_cfg *c, const char *method, const char *text,
return 0;
}
-/* text parts -> out, joined by newlines; 0 when at least one was found */
+static int
+append_piece(struct sp_buf *out, const char *s)
+{
+ if (out->len > 0 && sp_buf_puts(out, "\n") != 0)
+ return -1;
+ return sp_buf_puts(out, s);
+}
+
+/*
+ * Text, a string in data, or a text/plain raw part. A binary or url part is
+ * ignored: the transport has nowhere to put a file, and an answer made only of
+ * one becomes "empty answer" rather than a made-up string.
+ */
static int
collect_parts(const mcp_json *parts, struct sp_buf *out)
{
@@ -137,14 +150,42 @@ collect_parts(const mcp_json *parts, struct sp_buf *out)
for (i = 0; i < n; i++) {
const mcp_json *p = mcp_array_at(parts, i);
const char *t = mcp_arg_string(p, "text");
+ const char *d, *raw, *mt;
- if (t == NULL || *t == '\0')
+ if (t != NULL && *t != '\0') {
+ if (append_piece(out, t) != 0)
+ return 0;
+ found = 1;
continue;
- if (out->len > 0 && sp_buf_puts(out, "\n") != 0)
- return 0;
- if (sp_buf_puts(out, t) != 0)
- return 0;
- found = 1;
+ }
+ d = mcp_arg_string(p, "data");
+ if (d != NULL && *d != '\0') {
+ if (append_piece(out, d) != 0)
+ return 0;
+ found = 1;
+ continue;
+ }
+ raw = mcp_arg_string(p, "raw");
+ if (raw == NULL || *raw == '\0')
+ continue;
+ mt = mcp_arg_string(p, "mediaType");
+ if (mt != NULL && *mt != '\0' && strncmp(mt, "text/", 5) != 0)
+ continue;
+ {
+ struct sp_buf dec;
+
+ if (sp_buf_init(&dec) != 0)
+ return 0;
+ if (sp_b64_decode(raw, strlen(raw), &dec) == 0 &&
+ dec.len > 0) {
+ if (append_piece(out, dec.p) != 0) {
+ sp_buf_free(&dec);
+ return 0;
+ }
+ found = 1;
+ }
+ sp_buf_free(&dec);
+ }
}
return found;
}
diff --git a/src/a2aserver.c b/src/a2aserver.c
index 62a7636..f0a450b 100644
--- a/src/a2aserver.c
+++ b/src/a2aserver.c
@@ -44,6 +44,7 @@
#include "splinter.h"
#include "mcp.h"
+#include "b64.h"
#include "a2aserver.h"
#define A2A_TASKS 32
@@ -253,25 +254,73 @@ json_id(const char *payload, char *out, size_t cap)
}
}
+/*
+ * A part can be text, a string in data, or a text/plain raw part (base64). A
+ * url is not fetched (that would be an SSRF hole in an agent server), and a
+ * structured object is not guessed at; both are refused with
+ * ContentTypeNotSupported. Returns 0 when text was collected, 1 when the
+ * content cannot be used, -1 on allocation failure.
+ */
+static int
+append_text(struct sp_buf *out, const char *s)
+{
+ if (out->len > 0 && sp_buf_puts(out, "\n") != 0)
+ return -1;
+ return sp_buf_puts(out, s);
+}
+
static int
collect_text(const mcp_json *parts, struct sp_buf *out)
{
size_t i, n;
+ int got = 0;
if (parts == NULL || parts->t != MCP_ARR)
- return 0;
+ return 1;
n = mcp_array_len(parts);
for (i = 0; i < n; i++) {
- const char *t = mcp_arg_string(mcp_array_at(parts, i), "text");
+ const mcp_json *p = mcp_array_at(parts, i);
+ const char *t = mcp_arg_string(p, "text");
+ const char *d, *raw, *mt;
- if (t == NULL || *t == '\0')
+ if (t != NULL && *t != '\0') {
+ if (append_text(out, t) != 0)
+ return -1;
+ got = 1;
continue;
- if (out->len > 0 && sp_buf_puts(out, "\n") != 0)
- return 0;
- if (sp_buf_puts(out, t) != 0)
- return 0;
+ }
+ d = mcp_arg_string(p, "data");
+ if (d != NULL && *d != '\0') {
+ if (append_text(out, d) != 0)
+ return -1;
+ got = 1;
+ continue;
+ }
+ raw = mcp_arg_string(p, "raw");
+ if (raw != NULL && *raw != '\0') {
+ struct sp_buf dec;
+
+ mt = mcp_arg_string(p, "mediaType");
+ if (mt != NULL && *mt != '\0' &&
+ strncmp(mt, "text/", 5) != 0)
+ return 1;
+ if (sp_buf_init(&dec) != 0)
+ return -1;
+ if (sp_b64_decode(raw, strlen(raw), &dec) != 0) {
+ sp_buf_free(&dec);
+ return 1;
+ }
+ if (dec.len > 0 && append_text(out, dec.p) != 0) {
+ sp_buf_free(&dec);
+ return -1;
+ }
+ sp_buf_free(&dec);
+ got = 1;
+ continue;
+ }
+ return 1;
}
- return out->len > 0;
+ return got ? 0 : 1;
}
static struct a2a_task *
@@ -578,8 +627,10 @@ handle_stream(int fd, struct sp_agent *ag, const char *id,
sse_start(fd);
message = mcp_arg(params, "message");
parts = message != NULL ? mcp_arg(message, "parts") : NULL;
- if (!collect_text(parts, &text)) {
- sse_error(&o, -32602, "message has no text parts");
+ rc = collect_text(parts, &text);
+ if (rc != 0) {
+ sse_error(&o, rc == 1 ? -32005 : -32603,
+ rc == 1 ? "unsupported content type" : "out of memory");
goto out;
}
ctx = mcp_arg_string(message, "contextId");
@@ -664,8 +715,11 @@ handle_rpc(int fd, struct sp_agent *ag, const char *payload)
}
message = mcp_arg(params, "message");
parts = message != NULL ? mcp_arg(message, "parts") : NULL;
- if (!collect_text(parts, &text)) {
- rpc_error(fd, id, -32602, "message has no text parts");
+ rc = collect_text(parts, &text);
+ if (rc != 0) {
+ rpc_error(fd, id, rc == 1 ? -32005 : -32603,
+ rc == 1 ? "unsupported content type" :
+ "out of memory");
goto send_out;
}
ctx = mcp_arg_string(message, "contextId");
@@ -836,7 +890,7 @@ serve_conn(int fd, struct sp_agent *ag, const char *token)
"\"supportedInterfaces\":[{\"url\":\"http://%s/a2a\","
"\"protocolBinding\":\"JSONRPC\","
"\"protocolVersion\":\"1.0\"}],"
- "\"capabilities\":{\"streaming\":false},"
+ "\"capabilities\":{\"streaming\":true,\"pushNotifications\":false},"
"\"defaultInputModes\":[\"text/plain\"],"
"\"defaultOutputModes\":[\"text/plain\"],"
"\"skills\":[]}", SP_VERSION, hostbuf);
diff --git a/src/b64.c b/src/b64.c
new file mode 100644
index 0000000..11ec3f5
--- /dev/null
+++ b/src/b64.c
@@ -0,0 +1,70 @@
+/*
+ * splinter -- base64 for A2A raw parts.
+ *
+ * Copyright (c) 2026 Konrad Lother
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Small on purpose: A2A's raw part is base64, and the harness only needs to
+ * turn a text/plain part back into text. Whitespace is ignored, padding is
+ * optional, and a character outside the alphabet is an error rather than a
+ * silently different byte.
+ */
+#include An agent harness you own: chat in the terminal, tools with authorization classes, plugins, any model that speaks OpenAI — built by us so we can change it, instead of getting used to how somebody else's client behaves. POSIX make, C99, Ein Agent-Harness, das dir gehoert: Chat im Terminal, Werkzeuge mit Autorisierungsklassen, Plugins, jedes Modell das OpenAI spricht — von uns gebaut, damit wir es umbauen koennen, statt uns an das Verhalten eines fremden Clients zu gewoehnen. POSIX make, C99, Um harness de agente que e seu: chat no terminal, ferramentas com classes de autorizacao, plugins, qualquer modelo que fale OpenAI - escrito por nos para poder mudar-lo, em vez de nos acostumar com o comportamento de um cliente alheio.splinter_
What it is
@@ -152,7 +152,7 @@ plugin = plugins/reminder/reminder.so
Building
$ git clone ssh://host/home/git/splinter.git
$ cd splinter && make small, nothing but libc and curses
-$ make check 31 test programs, plus the i18n checker
+$ make check 32 test programs, plus the i18n checker
$ ./splinter chat, the config is read
$ ./splinter --daemon Telegram gateway
-Wall -Wextra -Werror. NetBSD curses is vendored, so the binary does not depend on a distribution's mood.splinter_
Was es ist
@@ -152,7 +152,7 @@ plugin = plugins/reminder/reminder.so
Bauen
$ git clone ssh://host/home/git/splinter.git
$ cd splinter && make klein, nichts ausser libc und curses
-$ make check 31 Test-Programme, plus i18n-Pruefer
+$ make check 32 Test-Programme, plus i18n-Pruefer
$ ./splinter Chat, Konfiguration wird gelesen
$ ./splinter --daemon Telegram-Gateway
-Wall -Wextra -Werror. Die NetBSD-curses liegt im Baum, damit das Binary nicht von der Laune einer Distribution abhaengt.splinter_
O que e
@@ -117,7 +117,7 @@ botoes Sim/Nao.
make
-make check # 31 binarios de teste, i18n, site
+make check # 32 binarios de teste, i18n, site
Sem dependencias alem de libc e pthread; ncurses vem do vendor.