a2a: ListTasks on the server
The server can list the stored tasks now, optionally filtered by contextId, with the pagination fields the spec requires. The test checks the stored task and an empty list for another context. Docs and the site name the method.
This commit is contained in:
1 parent
76883bfa3a
commit
9389793402
10 files changed
+64
-19
No files matched your search
@@ -131,7 +131,8 @@ SPLINTER_A2A_SERVER_TOKEN=... \
|
||||
./splinter --a2a-server-listen 127.0.0.1 --a2a-listen-port 8099
|
||||
```
|
||||
|
||||
Another agent can send `SendMessage` to `POST /a2a` and poll `GetTask`; the
|
||||
Another agent can send `SendMessage` to `POST /a2a` and read `GetTask` or
|
||||
`ListTasks`; the
|
||||
agent card is served at `/.well-known/agent-card.json`. `SendStreamingMessage`
|
||||
streams the answer as SSE artifact updates, then a completed status. Each
|
||||
request runs one turn in its own conversation. File parts, push notifications,
|
||||
|
||||
@@ -48,7 +48,7 @@ Context bleibt. `SPLINTER_A2A_CARD` findet den Endpunkt ueber die Agent Card.
|
||||
|
||||
Der Server ist gebaut: `src/a2aserver.c`, `POST /a2a` mit `SendMessage` (ein
|
||||
Turn in eigener Konversation, completed Task), `SendStreamingMessage` (SSE,
|
||||
`artifactUpdate`-Chunks, dann completed `statusUpdate`) und `GetTask`,
|
||||
`artifactUpdate`-Chunks, dann completed `statusUpdate`) `GetTask`, `ListTasks`,
|
||||
`GET /.well-known/agent-card.json`, Bearer-Token ueber
|
||||
`SPLINTER_A2A_SERVER_TOKEN` jenseits von Loopback.
|
||||
|
||||
@@ -96,7 +96,7 @@ 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` und die Agent Card mit Bearer-Token. `tests/test_a2a.sh` prueft Task, Message, Token, Fehler,
|
||||
`GetTask`, `ListTasks` und die Agent Card mit Bearer-Token. `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).
|
||||
|
||||
+4
-3
@@ -297,8 +297,9 @@ The endpoint can be configured directly (`SPLINTER_A2A_URL`) or discovered:
|
||||
`JSONRPC` entry from `supportedInterfaces` (or the older single `url` field).
|
||||
The discovered URL is kept for the session.
|
||||
|
||||
Not implemented yet, and named so nobody assumes otherwise: file/structured-data
|
||||
parts, push notifications, `GetTask`/`CancelTask`, and the server direction.
|
||||
Not implemented yet on the client side, and named so nobody assumes otherwise:
|
||||
file/structured-data parts, push notifications, and `GetTask`/`CancelTask`
|
||||
(the client sends and streams; it does not poll or cancel).
|
||||
`tests/fake_a2a.py` and `tests/test_a2a.sh` pin the blocking wire shape, both
|
||||
result forms, the bearer token, a JSON-RPC error, streaming and discovery;
|
||||
`tests/test_a2a_ui.sh` drives the streaming path through tmux.
|
||||
@@ -316,7 +317,7 @@ needs the agent and its authorization model, not only a transport.
|
||||
`SendStreamingMessage` runs the same turn and writes SSE `artifactUpdate` events
|
||||
as the transport produces text (a non-streaming transport sends its whole answer
|
||||
as one artifact), followed by a completed `statusUpdate`; `GetTask` returns a
|
||||
stored task; `GET /.well-known/agent-card.json` serves a card with the `JSONRPC`
|
||||
stored task and `ListTasks` lists them (optionally by `contextId`); `GET /.well-known/agent-card.json` serves a card with the `JSONRPC`
|
||||
interface. One request at a time, one connection at a time.
|
||||
|
||||
Refused with a JSON-RPC error, not half-answered: `CancelTask`,
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ Stand: 2026-11-09. Die geprüfte, ausführliche Liste mit Belegen steht in
|
||||
|
||||
1. **A2A: was noch fehlt** — Client (`SendMessage`, `SendStreamingMessage` in
|
||||
der UI, Agent-Card-Discovery) und Server (`SendMessage`, SSE-Streaming,
|
||||
`GetTask`, Agent Card) stehen, alles mit Text. Offen sind Datei- und
|
||||
`GetTask`, `ListTasks`, Agent Card) stehen, alles mit Text. Offen sind Datei- und
|
||||
strukturierte Teile, Push-Notifications, `CancelTask`/`SubscribeToTask` und
|
||||
die Fortsetzung eines unterbrochenen Tasks. `swarm` ist nur lokale IPC im
|
||||
selben Verzeichnis, kein A2A.
|
||||
|
||||
+38
-3
@@ -305,9 +305,9 @@ task_store(const char *context, const struct sp_buf *answer)
|
||||
}
|
||||
|
||||
static void
|
||||
task_json(struct sp_buf *b, const struct a2a_task *t)
|
||||
task_obj(struct sp_buf *b, const struct a2a_task *t)
|
||||
{
|
||||
sp_buf_puts(b, "{\"task\":{\"id\":\"");
|
||||
sp_buf_puts(b, "{\"id\":\"");
|
||||
sp_buf_puts(b, t->id);
|
||||
sp_buf_printf(b, "\",\"contextId\":\"%s\",\"status\":{\"state\":"
|
||||
"\"TASK_STATE_COMPLETED\",\"message\":{\"messageId\":\"msg-%s\","
|
||||
@@ -318,7 +318,15 @@ task_json(struct sp_buf *b, const struct a2a_task *t)
|
||||
sp_buf_puts(b, t->id);
|
||||
sp_buf_puts(b, "\",\"parts\":[{\"text\":\"");
|
||||
sp_json_escape(b, t->answer.p);
|
||||
sp_buf_puts(b, "\"}]}]}}");
|
||||
sp_buf_puts(b, "\"}]}]}");
|
||||
}
|
||||
|
||||
static void
|
||||
task_json(struct sp_buf *b, const struct a2a_task *t)
|
||||
{
|
||||
sp_buf_puts(b, "{\"task\":");
|
||||
task_obj(b, t);
|
||||
sp_buf_puts(b, "}");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -645,6 +653,33 @@ send_out:
|
||||
task_json(&out, t);
|
||||
rpc_result(fd, id, out.p != NULL ? out.p : "{}");
|
||||
sp_buf_free(&out);
|
||||
} else if (strcmp(method, "ListTasks") == 0) {
|
||||
const char *want = mcp_arg_string(params, "contextId");
|
||||
struct sp_buf out;
|
||||
size_t i;
|
||||
int n = 0;
|
||||
|
||||
memset(&out, 0, sizeof(out));
|
||||
if (sp_buf_init(&out) != 0) {
|
||||
rpc_error(fd, id, -32603, "out of memory");
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
sp_buf_puts(&out, "{\"tasks\":[");
|
||||
for (i = 0; i < A2A_TASKS; i++) {
|
||||
if (!g_tasks[i].used)
|
||||
continue;
|
||||
if (want != NULL && *want != '\0' &&
|
||||
strcmp(g_tasks[i].context, want) != 0)
|
||||
continue;
|
||||
if (n++ > 0)
|
||||
sp_buf_puts(&out, ",");
|
||||
task_obj(&out, &g_tasks[i]);
|
||||
}
|
||||
sp_buf_printf(&out, "],\"nextPageToken\":\"\",\"pageSize\":%d,"
|
||||
"\"totalSize\":%d}", n, n);
|
||||
rpc_result(fd, id, out.p != NULL ? out.p : "{}");
|
||||
sp_buf_free(&out);
|
||||
} else if (strcmp(method, "SendStreamingMessage") == 0) {
|
||||
handle_stream(fd, ag, id, params);
|
||||
} else if (strcmp(method, "CancelTask") == 0 ||
|
||||
|
||||
@@ -53,7 +53,7 @@ hr { border: 0; border-top: 1px solid #1d2126; margin: 3em 0 1.5em 0; }
|
||||
<h1>splinter<span>_</span></h1>
|
||||
<p class="lead">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.</p>
|
||||
|
||||
<p class="meta"><b>23655</b> lines of C99/POSIX ·
|
||||
<p class="meta"><b>23690</b> lines of C99/POSIX ·
|
||||
<b>23</b> tools · <b>31</b> test programs ·
|
||||
<b>16</b> plugins · <b>42</b> palettes · BSD-3-Clause</p>
|
||||
|
||||
@@ -207,7 +207,7 @@ itself:</p>
|
||||
<pre><span class="u">$</span> SPLINTER_A2A_SERVER_TOKEN=... splinter --a2a-server-listen 127.0.0.1 --a2a-listen-port 8099
|
||||
splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<p><code>POST /a2a</code> takes <code>SendMessage</code>, <code>SendStreamingMessage</code>
|
||||
(SSE) and <code>GetTask</code> as JSON-RPC; the agent card lives at
|
||||
(SSE), <code>GetTask</code> and <code>ListTasks</code> as JSON-RPC; the agent card lives at
|
||||
<code>/.well-known/agent-card.json</code>. One turn per request, its own
|
||||
conversation. Beyond loopback the bearer token is required.</p>
|
||||
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ hr { border: 0; border-top: 1px solid #1d2126; margin: 3em 0 1.5em 0; }
|
||||
<h1>splinter<span>_</span></h1>
|
||||
<p class="lead">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.</p>
|
||||
|
||||
<p class="meta"><b>23655</b> Zeilen C99/POSIX ·
|
||||
<p class="meta"><b>23690</b> Zeilen C99/POSIX ·
|
||||
<b>23</b> Werkzeuge · <b>31</b> Test-Programme ·
|
||||
<b>16</b> Plugins · <b>42</b> Farbschemata · BSD-3-Clause</p>
|
||||
|
||||
@@ -208,7 +208,7 @@ sich selbst hin:</p>
|
||||
<pre><span class="u">$</span> SPLINTER_A2A_SERVER_TOKEN=... splinter --a2a-server-listen 127.0.0.1 --a2a-listen-port 8099
|
||||
splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<p><code>POST /a2a</code> nimmt <code>SendMessage</code>, <code>SendStreamingMessage</code>
|
||||
(SSE) und <code>GetTask</code> als JSON-RPC; die Agent Card liegt unter
|
||||
(SSE), <code>GetTask</code> und <code>ListTasks</code> als JSON-RPC; die Agent Card liegt unter
|
||||
<code>/.well-known/agent-card.json</code>. Ein Turn pro Anfrage, eigene
|
||||
Konversation. Jenseits von Loopback ist der Bearer-Token Pflicht.</p>
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ hr { border: 0; border-top: 1px solid #1d2126; margin: 3em 0 1.5em 0; }
|
||||
<h1>splinter<span>_</span></h1>
|
||||
<p class="lead">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.</p>
|
||||
|
||||
<p class="meta"><b>23655</b> linhas C99/POSIX ·
|
||||
<p class="meta"><b>23690</b> linhas C99/POSIX ·
|
||||
<b>23</b> ferramentas · <b>31</b> programas de teste ·
|
||||
<b>16</b> plugins · <b>42</b> paletas · BSD-3-Clause</p>
|
||||
|
||||
@@ -155,7 +155,7 @@ si mesmo:</p>
|
||||
<pre><span class="u">$</span> SPLINTER_A2A_SERVER_TOKEN=... splinter --a2a-server-listen 127.0.0.1 --a2a-listen-port 8099
|
||||
splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<p><code>POST /a2a</code> aceita <code>SendMessage</code>, <code>SendStreamingMessage</code>
|
||||
(SSE) e <code>GetTask</code> em JSON-RPC; o agent card fica em
|
||||
(SSE), <code>GetTask</code> e <code>ListTasks</code> em JSON-RPC; o agent card fica em
|
||||
<code>/.well-known/agent-card.json</code>. Um turno por requisicao, conversa
|
||||
propria. Fora do loopback o token Bearer e obrigatorio.</p>
|
||||
|
||||
|
||||
@@ -79,6 +79,14 @@ resp6=$(post "$P" '{"jsonrpc":"2.0","id":"6","method":"CancelTask","params":{}}'
|
||||
echo "$resp6" | grep -q '"code":-32601'
|
||||
check test $? -eq 0
|
||||
|
||||
# ListTasks: the stored task, and an empty list for another context
|
||||
resp7=$(post "$P" '{"jsonrpc":"2.0","id":"7","method":"ListTasks","params":{}}')
|
||||
echo "$resp7" | grep -q "$id"
|
||||
check test $? -eq 0
|
||||
resp8=$(post "$P" '{"jsonrpc":"2.0","id":"8","method":"ListTasks","params":{"contextId":"other"}}')
|
||||
echo "$resp8" | grep -q '"tasks":\[\]'
|
||||
check test $? -eq 0
|
||||
|
||||
# a task that does not exist is a JSON-RPC error, not an empty answer
|
||||
resp4=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"4\",\"method\":\"GetTask\",\"params\":{\"id\":\"nope\"}}")
|
||||
echo "$resp4" | grep -q '"code":-32001'
|
||||
|
||||
+3
-3
@@ -455,7 +455,7 @@ sich selbst hin:</p>
|
||||
<pre><span class="u">$</span> SPLINTER_A2A_SERVER_TOKEN=... splinter --a2a-server-listen 127.0.0.1 --a2a-listen-port 8099
|
||||
splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<p><code>POST /a2a</code> nimmt <code>SendMessage</code>, <code>SendStreamingMessage</code>
|
||||
(SSE) und <code>GetTask</code> als JSON-RPC; die Agent Card liegt unter
|
||||
(SSE), <code>GetTask</code> und <code>ListTasks</code> als JSON-RPC; die Agent Card liegt unter
|
||||
<code>/.well-known/agent-card.json</code>. Ein Turn pro Anfrage, eigene
|
||||
Konversation. Jenseits von Loopback ist der Bearer-Token Pflicht.</p>""",
|
||||
]
|
||||
@@ -501,7 +501,7 @@ itself:</p>
|
||||
<pre><span class="u">$</span> SPLINTER_A2A_SERVER_TOKEN=... splinter --a2a-server-listen 127.0.0.1 --a2a-listen-port 8099
|
||||
splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<p><code>POST /a2a</code> takes <code>SendMessage</code>, <code>SendStreamingMessage</code>
|
||||
(SSE) and <code>GetTask</code> as JSON-RPC; the agent card lives at
|
||||
(SSE), <code>GetTask</code> and <code>ListTasks</code> as JSON-RPC; the agent card lives at
|
||||
<code>/.well-known/agent-card.json</code>. One turn per request, its own
|
||||
conversation. Beyond loopback the bearer token is required.</p>""",
|
||||
]
|
||||
@@ -591,7 +591,7 @@ si mesmo:</p>
|
||||
<pre><span class="u">$</span> SPLINTER_A2A_SERVER_TOKEN=... splinter --a2a-server-listen 127.0.0.1 --a2a-listen-port 8099
|
||||
splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<p><code>POST /a2a</code> aceita <code>SendMessage</code>, <code>SendStreamingMessage</code>
|
||||
(SSE) e <code>GetTask</code> em JSON-RPC; o agent card fica em
|
||||
(SSE), <code>GetTask</code> e <code>ListTasks</code> em JSON-RPC; o agent card fica em
|
||||
<code>/.well-known/agent-card.json</code>. Um turno por requisicao, conversa
|
||||
propria. Fora do loopback o token Bearer e obrigatorio.</p>""",
|
||||
]
|
||||
|
||||
Reference in new issue
Block a user