a2a: URL text parts and push-config CRUD; .local/lib untangled
A text/plain url part is fetched from loopback or a host in SPLINTER_A2A_URL_ALLOW (1 MiB, no redirects); binary and other media types stay refused. The four push-config methods create/get/list/delete in-memory configs per task. ~/.local/lib is a real directory now: libsplinter.so plus a node_modules symlink to ../npm/node_modules. The npm tree is not leftover -- it is the mcp-local-memory MCP server and the Python user dirs -- so npm root -g, the module and the installed splinter are verified working; nothing was deleted. Full make check green.
This commit is contained in:
1 parent
544399a3bf
commit
624fcf3d48
9 files changed
+394
-53
No files matched your search
@@ -32,25 +32,23 @@ nicht abgerufen. Push an Webhooks und Multiturn ueber `contextId` stehen.
|
||||
|
||||
Der Client registriert `a2a_get_task` und `a2a_cancel_task` (read/destructive)
|
||||
fuer ein lokales Modell, das ihn als Werkzeugquelle nutzt; der Server liefert
|
||||
`GetTask` als Task-Objekt (nicht als `{"task":...}`).
|
||||
`GetTask` als Task-Objekt (nicht als `{"task":...}`). Push-Configs lassen sich
|
||||
per CRUD verwalten; text/plain-URL-Teile werden von Loopback oder
|
||||
`SPLINTER_A2A_URL_ALLOW` geholt (1 MiB, keine Redirects).
|
||||
|
||||
Offen: die Fortsetzung eines unterbrochenen Tasks (`INPUT_REQUIRED`) und die
|
||||
Push-Config-CRUD-Methoden. URL- und binaere Teile bleiben bewusst abgelehnt.
|
||||
Offen: die Fortsetzung eines unterbrochenen Tasks (`INPUT_REQUIRED`). Binaere
|
||||
Teile bleiben bewusst abgelehnt.
|
||||
|
||||
Naechster Schritt: ein pausierbarer Turn fuer INPUT_REQUIRED.
|
||||
|
||||
### 2. `~/.local/lib` enthaelt Fremdlast
|
||||
|
||||
`~/.local/lib` ist ein Symlink auf `~/.local/npm`. Dort liegen `node_modules`,
|
||||
`package.json` und `package-lock.json` aus einem frueheren Projekt (Maerz 2026) —
|
||||
und seit `make install PREFIX=$HOME/.local` auch `libsplinter.so`. Nur die
|
||||
npm-Dateien sind Fremdlast; das Verzeichnis ist inzwischen auch das
|
||||
Installationsziel.
|
||||
|
||||
Naechster Schritt: entscheiden, ob die npm-Reste weg duerfen. Kein Code.
|
||||
|
||||
## Erledigt
|
||||
|
||||
- **`~/.local/lib` entwirrt**: `~/.local/lib` ist jetzt ein echtes Verzeichnis
|
||||
mit `libsplinter.so` und einem `node_modules`-Symlink auf
|
||||
`../npm/node_modules`. Der npm-Baum ist keine Fremdlast: er enthaelt
|
||||
`mcp-local-memory` (der MCP, auf den `~/.local/bin/mcp-local-memory` zeigt)
|
||||
und die Python-User-Verzeichnisse. `npm root -g`, das Modul und
|
||||
`~/.local/bin/splinter --version` sind geprueft; nichts geloescht.
|
||||
- **Kids-Zustimmung ueber echtes Telegram**: Am 2026-11-10 wurde Anfrage
|
||||
`548769685` an `@hbx_splinter_bot` geschickt; die Antwort `ok 548769685` kam
|
||||
im Chat, das Gateway loeste sie auf, der `write` lief und schrieb
|
||||
@@ -81,10 +79,12 @@ 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`, text/plain-`raw`- und
|
||||
String-`data`-Teile, Webhook-Push, `a2a_get_task`/`a2a_cancel_task` als
|
||||
Client-Werkzeuge und die Agent Card mit Bearer-Token; die Karte meldet
|
||||
`streaming:true` und `pushNotifications:true`. `tests/test_a2a.sh` prueft Task, Message, Token, Fehler,
|
||||
`GetTask`, `ListTasks`, Multiturn ueber `contextId`, text/plain-`raw`-,
|
||||
URL- und String-`data`-Teile, Webhook-Push samt Push-Config-CRUD,
|
||||
`a2a_get_task`/`a2a_cancel_task` als Client-Werkzeuge und die Agent Card mit
|
||||
Bearer-Token; die Karte meldet `streaming:true` und
|
||||
`pushNotifications:true`. `GetTask` liefert das Task-Objekt, nicht
|
||||
`{"task":...}`. `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
|
||||
|
||||
+8
-4
@@ -344,11 +344,15 @@ configuration posts the completed task to that webhook (payload: one
|
||||
`StreamResponse` with `task`). Loopback is allowed by default; any other host
|
||||
needs `SPLINTER_A2A_PUSH_ALLOW` (comma separated, `*` for all), which keeps a
|
||||
client from turning the server into an SSRF probe. The config token travels as
|
||||
`X-A2A-Notification-Token`, the authentication as `Authorization`. The
|
||||
standalone push-config CRUD methods are not served.
|
||||
`X-A2A-Notification-Token`, the authentication as `Authorization`. The four
|
||||
push-config methods (`CreateTaskPushNotificationConfig`, `Get...`, `List...`,
|
||||
`Delete...`) manage the same configs in memory.
|
||||
|
||||
A text/plain `url` part is fetched from loopback or a host in
|
||||
`SPLINTER_A2A_URL_ALLOW` (same syntax, 1 MiB cap, no redirects); a binary or
|
||||
other media type is refused.
|
||||
|
||||
Refused with a JSON-RPC error, not half-answered: `CancelTask`,
|
||||
`SubscribeToTask`, URL/binary parts, push-config CRUD, plus continuation of an
|
||||
interrupted task. Beyond loopback
|
||||
`SubscribeToTask`, binary parts and continuation of an interrupted task. Beyond loopback
|
||||
`SPLINTER_A2A_SERVER_TOKEN` is required and checked as
|
||||
`Authorization: Bearer ...`; there is no TLS.
|
||||
+317
-19
@@ -264,12 +264,15 @@ json_id(const char *payload, char *out, size_t cap)
|
||||
}
|
||||
}
|
||||
|
||||
static int url_host_allowed(const char *url);
|
||||
static int fetch_url_text(const char *url, struct sp_buf *out);
|
||||
|
||||
/*
|
||||
* 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.
|
||||
* A part can be text, a string in data, a text/plain raw part (base64), or a
|
||||
* text/plain url from an allowlisted host. A structured object is not guessed
|
||||
* at; a URL to anywhere else is 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)
|
||||
@@ -328,6 +331,34 @@ collect_text(const mcp_json *parts, struct sp_buf *out)
|
||||
got = 1;
|
||||
continue;
|
||||
}
|
||||
{
|
||||
const char *url = mcp_arg_string(p, "url");
|
||||
|
||||
if (url != NULL && *url != '\0') {
|
||||
struct sp_buf fetched;
|
||||
|
||||
mt = mcp_arg_string(p, "mediaType");
|
||||
if (mt != NULL && *mt != '\0' &&
|
||||
strncmp(mt, "text/", 5) != 0)
|
||||
return 1;
|
||||
if (!url_host_allowed(url))
|
||||
return 1;
|
||||
if (sp_buf_init(&fetched) != 0)
|
||||
return -1;
|
||||
if (fetch_url_text(url, &fetched) != 0 ||
|
||||
fetched.len == 0) {
|
||||
sp_buf_free(&fetched);
|
||||
return 1;
|
||||
}
|
||||
if (append_text(out, fetched.p) != 0) {
|
||||
sp_buf_free(&fetched);
|
||||
return -1;
|
||||
}
|
||||
sp_buf_free(&fetched);
|
||||
got = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return got ? 0 : 1;
|
||||
@@ -456,10 +487,10 @@ task_json(struct sp_buf *b, const struct a2a_task *t)
|
||||
* and the token/credentials may not smuggle a header line.
|
||||
*/
|
||||
static int
|
||||
push_host_allowed(const char *url)
|
||||
host_allowed(const char *url, const char *envname)
|
||||
{
|
||||
const char *p, *host, *end;
|
||||
const char *allow = getenv("SPLINTER_A2A_PUSH_ALLOW");
|
||||
const char *allow = getenv(envname);
|
||||
char h[256], copy[512], *tok, *save;
|
||||
size_t n;
|
||||
|
||||
@@ -500,6 +531,76 @@ push_host_allowed(const char *url)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
push_host_allowed(const char *url)
|
||||
{
|
||||
return host_allowed(url, "SPLINTER_A2A_PUSH_ALLOW");
|
||||
}
|
||||
|
||||
static int
|
||||
url_host_allowed(const char *url)
|
||||
{
|
||||
return host_allowed(url, "SPLINTER_A2A_URL_ALLOW");
|
||||
}
|
||||
|
||||
/* text/plain from an allowlisted URL, capped at 1 MiB; no redirects */
|
||||
static int
|
||||
fetch_url_text(const char *url, struct sp_buf *out)
|
||||
{
|
||||
const char *args[8];
|
||||
struct sp_buf raw, err;
|
||||
pid_t pid = -1;
|
||||
char chunk[4096], *nl;
|
||||
size_t got;
|
||||
int fd, status = 0;
|
||||
long http;
|
||||
|
||||
args[0] = "-sS";
|
||||
args[1] = "-m";
|
||||
args[2] = "15";
|
||||
args[3] = "-w";
|
||||
args[4] = "\n%{http_code}";
|
||||
args[5] = NULL;
|
||||
if (sp_buf_init(&raw) != 0 || sp_buf_init(&err) != 0)
|
||||
return -1;
|
||||
fd = sp_curl_start(args, url, NULL, 1, &pid, &err);
|
||||
if (fd < 0)
|
||||
goto fail;
|
||||
while ((got = read(fd, chunk, sizeof(chunk))) > 0) {
|
||||
if (raw.len + got > (1u << 20)) {
|
||||
close(fd);
|
||||
(void)kill(pid, SIGKILL);
|
||||
(void)waitpid(pid, NULL, 0);
|
||||
goto fail;
|
||||
}
|
||||
if (sp_buf_add(&raw, chunk, got) != 0) {
|
||||
close(fd);
|
||||
(void)kill(pid, SIGKILL);
|
||||
(void)waitpid(pid, NULL, 0);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) ||
|
||||
WEXITSTATUS(status) != 0)
|
||||
goto fail;
|
||||
if (raw.len < 2 || (nl = strrchr(raw.p, '\n')) == NULL)
|
||||
goto fail;
|
||||
http = strtol(nl + 1, NULL, 10);
|
||||
*nl = '\0';
|
||||
if (http < 200 || http > 299)
|
||||
goto fail;
|
||||
sp_buf_puts(out, raw.p);
|
||||
sp_buf_free(&raw);
|
||||
sp_buf_free(&err);
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
sp_buf_free(&raw);
|
||||
sp_buf_free(&err);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
has_crlf(const char *s)
|
||||
{
|
||||
@@ -508,16 +609,12 @@ has_crlf(const char *s)
|
||||
|
||||
/* 0 no push requested, 1 configured, -1 invalid, -2 host not allowed */
|
||||
static int
|
||||
push_parse(const mcp_json *params, struct a2a_push *p, struct sp_buf *err)
|
||||
push_from_config(const mcp_json *pn, struct a2a_push *p, struct sp_buf *err)
|
||||
{
|
||||
const mcp_json *conf, *pn, *auth;
|
||||
const mcp_json *auth;
|
||||
const char *url, *token, *scheme, *cred;
|
||||
|
||||
memset(p, 0, sizeof(*p));
|
||||
conf = mcp_arg(params, "configuration");
|
||||
pn = conf != NULL ? mcp_arg(conf, "taskPushNotificationConfig") : NULL;
|
||||
if (pn == NULL)
|
||||
return 0;
|
||||
url = mcp_arg_string(pn, "url");
|
||||
if (url == NULL || *url == '\0') {
|
||||
sp_buf_puts(err, "push config has no url");
|
||||
@@ -551,6 +648,81 @@ push_parse(const mcp_json *params, struct a2a_push *p, struct sp_buf *err)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
push_parse(const mcp_json *params, struct a2a_push *p, struct sp_buf *err)
|
||||
{
|
||||
const mcp_json *conf, *pn;
|
||||
|
||||
memset(p, 0, sizeof(*p));
|
||||
conf = mcp_arg(params, "configuration");
|
||||
pn = conf != NULL ? mcp_arg(conf, "taskPushNotificationConfig") : NULL;
|
||||
if (pn == NULL)
|
||||
return 0;
|
||||
return push_from_config(pn, p, err);
|
||||
}
|
||||
|
||||
struct a2a_pcfg {
|
||||
int used;
|
||||
char id[64];
|
||||
char task_id[64];
|
||||
struct a2a_push p;
|
||||
};
|
||||
|
||||
static struct a2a_pcfg g_pcfg[32];
|
||||
static unsigned g_pcfg_seq;
|
||||
|
||||
static struct a2a_pcfg *
|
||||
pcfg_store(const char *task_id, const struct a2a_push *p)
|
||||
{
|
||||
struct a2a_pcfg *c = &g_pcfg[g_pcfg_seq % 32];
|
||||
|
||||
g_pcfg_seq++;
|
||||
memset(c, 0, sizeof(*c));
|
||||
c->p = *p;
|
||||
c->p.set = 1;
|
||||
snprintf(c->id, sizeof(c->id), "cfg-%d-%u", (int)getpid(), g_pcfg_seq);
|
||||
snprintf(c->task_id, sizeof(c->task_id), "%s", task_id);
|
||||
c->used = 1;
|
||||
return c;
|
||||
}
|
||||
|
||||
static struct a2a_pcfg *
|
||||
pcfg_find(const char *task_id, const char *id)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
if (g_pcfg[i].used && strcmp(g_pcfg[i].task_id, task_id) == 0 &&
|
||||
(id == NULL || strcmp(g_pcfg[i].id, id) == 0))
|
||||
return &g_pcfg[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
pcfg_json(struct sp_buf *b, const struct a2a_pcfg *c)
|
||||
{
|
||||
sp_buf_puts(b, "{\"id\":\"");
|
||||
sp_json_escape(b, c->id);
|
||||
sp_buf_puts(b, "\",\"taskId\":\"");
|
||||
sp_json_escape(b, c->task_id);
|
||||
sp_buf_puts(b, "\",\"url\":\"");
|
||||
sp_json_escape(b, c->p.url);
|
||||
sp_buf_puts(b, "\"");
|
||||
if (c->p.token[0] != '\0') {
|
||||
sp_buf_puts(b, ",\"token\":\"");
|
||||
sp_json_escape(b, c->p.token);
|
||||
sp_buf_puts(b, "\"");
|
||||
}
|
||||
if (c->p.scheme[0] != '\0') {
|
||||
sp_buf_puts(b, ",\"authentication\":{\"scheme\":\"");
|
||||
sp_json_escape(b, c->p.scheme);
|
||||
sp_buf_puts(b, "\",\"credentials\":\"");
|
||||
sp_json_escape(b, c->p.cred);
|
||||
sp_buf_puts(b, "\"}");
|
||||
}
|
||||
sp_buf_puts(b, "}");
|
||||
}
|
||||
|
||||
/* best effort after the response: a push must not make the client's turn fail */
|
||||
static void
|
||||
push_task(const struct a2a_push *p, const struct a2a_task *t)
|
||||
@@ -1061,12 +1233,136 @@ send_out:
|
||||
} else if (strcmp(method, "SubscribeToTask") == 0) {
|
||||
rpc_error(fd, id, -32004, "subscription is not served; use "
|
||||
"SendStreamingMessage");
|
||||
} else if (strcmp(method, "CreateTaskPushNotificationConfig") == 0 ||
|
||||
strcmp(method, "GetTaskPushNotificationConfig") == 0 ||
|
||||
strcmp(method, "ListTaskPushNotificationConfigs") == 0 ||
|
||||
strcmp(method, "DeleteTaskPushNotificationConfig") == 0) {
|
||||
rpc_error(fd, id, -32004, "push config CRUD is not served; "
|
||||
"send taskPushNotificationConfig in SendMessage");
|
||||
} else if (strcmp(method, "CreateTaskPushNotificationConfig") == 0) {
|
||||
const char *tid = mcp_arg_string(params, "taskId");
|
||||
struct a2a_push p;
|
||||
struct sp_buf perr, out;
|
||||
struct a2a_pcfg *c;
|
||||
|
||||
if (tid == NULL || *tid == '\0') {
|
||||
rpc_error(fd, id, -32602, "taskId is required");
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
if (task_find(tid) == NULL) {
|
||||
rpc_error(fd, id, -32001, "task not found");
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
memset(&perr, 0, sizeof(perr));
|
||||
if (sp_buf_init(&perr) != 0) {
|
||||
rpc_error(fd, id, -32603, "out of memory");
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
rc = push_from_config(params, &p, &perr);
|
||||
if (rc < 0) {
|
||||
rpc_error(fd, id, rc == -2 ? -32003 : -32602, perr.p);
|
||||
sp_buf_free(&perr);
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
c = pcfg_store(tid, &p);
|
||||
if (c == NULL) {
|
||||
rpc_error(fd, id, -32603, "out of memory");
|
||||
sp_buf_free(&perr);
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
memset(&out, 0, sizeof(out));
|
||||
if (sp_buf_init(&out) != 0) {
|
||||
rpc_error(fd, id, -32603, "out of memory");
|
||||
} else {
|
||||
pcfg_json(&out, c);
|
||||
rpc_result(fd, id, out.p != NULL ? out.p : "{}");
|
||||
sp_buf_free(&out);
|
||||
}
|
||||
sp_buf_free(&perr);
|
||||
} else if (strcmp(method, "GetTaskPushNotificationConfig") == 0) {
|
||||
const char *tid = mcp_arg_string(params, "taskId");
|
||||
const char *cid = mcp_arg_string(params,
|
||||
"pushNotificationConfigId");
|
||||
struct a2a_pcfg *c;
|
||||
struct sp_buf out;
|
||||
|
||||
if (cid == NULL)
|
||||
cid = mcp_arg_string(params, "configId");
|
||||
if (cid == NULL)
|
||||
cid = mcp_arg_string(params, "id");
|
||||
if (tid == NULL || *tid == '\0' || cid == NULL || *cid == '\0') {
|
||||
rpc_error(fd, id, -32602, "taskId and config id are "
|
||||
"required");
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
c = pcfg_find(tid, cid);
|
||||
if (c == NULL) {
|
||||
rpc_error(fd, id, -32001, "push config not found");
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
memset(&out, 0, sizeof(out));
|
||||
if (sp_buf_init(&out) != 0) {
|
||||
rpc_error(fd, id, -32603, "out of memory");
|
||||
} else {
|
||||
pcfg_json(&out, c);
|
||||
rpc_result(fd, id, out.p != NULL ? out.p : "{}");
|
||||
sp_buf_free(&out);
|
||||
}
|
||||
} else if (strcmp(method, "ListTaskPushNotificationConfigs") == 0) {
|
||||
const char *tid = mcp_arg_string(params, "taskId");
|
||||
struct sp_buf out;
|
||||
size_t i;
|
||||
int n = 0;
|
||||
|
||||
if (tid == NULL || *tid == '\0') {
|
||||
rpc_error(fd, id, -32602, "taskId is required");
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
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, "{\"configs\":[");
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (!g_pcfg[i].used ||
|
||||
strcmp(g_pcfg[i].task_id, tid) != 0)
|
||||
continue;
|
||||
if (n++ > 0)
|
||||
sp_buf_puts(&out, ",");
|
||||
pcfg_json(&out, &g_pcfg[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, "DeleteTaskPushNotificationConfig") == 0) {
|
||||
const char *tid = mcp_arg_string(params, "taskId");
|
||||
const char *cid = mcp_arg_string(params,
|
||||
"pushNotificationConfigId");
|
||||
struct a2a_pcfg *c;
|
||||
|
||||
if (cid == NULL)
|
||||
cid = mcp_arg_string(params, "configId");
|
||||
if (cid == NULL)
|
||||
cid = mcp_arg_string(params, "id");
|
||||
if (tid == NULL || *tid == '\0' || cid == NULL || *cid == '\0') {
|
||||
rpc_error(fd, id, -32602, "taskId and config id are "
|
||||
"required");
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
c = pcfg_find(tid, cid);
|
||||
if (c == NULL) {
|
||||
rpc_error(fd, id, -32001, "push config not found");
|
||||
mcp_json_free(v);
|
||||
return;
|
||||
}
|
||||
c->used = 0;
|
||||
rpc_result(fd, id, "{}");
|
||||
} else {
|
||||
rpc_error(fd, id, -32601, "method not found");
|
||||
}
|
||||
@@ -1227,6 +1523,8 @@ sp_a2a_serve(struct sp_agent *ag, const char *ip, int port, struct sp_buf *err)
|
||||
sp_conv_free(&g_ctx[i].conv);
|
||||
g_ctx[i].used = 0;
|
||||
}
|
||||
for (i = 0; i < 32; i++)
|
||||
g_pcfg[i].used = 0;
|
||||
}
|
||||
fprintf(stderr, "splinter: A2A server stopped\n");
|
||||
return 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>24993</b> lines of C99/POSIX ·
|
||||
<p class="meta"><b>25291</b> lines of C99/POSIX ·
|
||||
<b>25</b> tools · <b>32</b> test programs ·
|
||||
<b>16</b> plugins · <b>42</b> palettes · BSD-3-Clause</p>
|
||||
|
||||
@@ -212,7 +212,8 @@ splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<code>/.well-known/agent-card.json</code>. A <code>contextId</code> is a
|
||||
conversation; without one the server makes one and returns it. A
|
||||
<code>taskPushNotificationConfig</code> posts the completed task to a webhook
|
||||
(loopback or <code>SPLINTER_A2A_PUSH_ALLOW</code>). Beyond loopback the bearer
|
||||
(loopback or <code>SPLINTER_A2A_PUSH_ALLOW</code>); push configs can be managed
|
||||
with CRUD and text/plain URLs are fetched from allowed hosts. Beyond loopback the bearer
|
||||
token is required.</p>
|
||||
|
||||
<h2>Kid mode</h2>
|
||||
|
||||
+4
-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>24993</b> Zeilen C99/POSIX ·
|
||||
<p class="meta"><b>25291</b> Zeilen C99/POSIX ·
|
||||
<b>25</b> Werkzeuge · <b>32</b> Test-Programme ·
|
||||
<b>16</b> Plugins · <b>42</b> Farbschemata · BSD-3-Clause</p>
|
||||
|
||||
@@ -213,7 +213,9 @@ splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<code>/.well-known/agent-card.json</code>. Ein <code>contextId</code> ist eine
|
||||
Konversation; ohne eines legt der Server eins an und gibt es zurueck. Eine
|
||||
<code>taskPushNotificationConfig</code> schickt den fertigen Task an einen
|
||||
Webhook (Loopback oder <code>SPLINTER_A2A_PUSH_ALLOW</code>). Jenseits von
|
||||
Webhook (Loopback oder <code>SPLINTER_A2A_PUSH_ALLOW</code>); Push-Configs
|
||||
lassen sich per CRUD verwalten, text/plain-URLs werden von erlaubten Hosts
|
||||
geholt. Jenseits von
|
||||
Loopback ist der Bearer-Token Pflicht.</p>
|
||||
|
||||
<h2>Kindermodus</h2>
|
||||
|
||||
@@ -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>24993</b> linhas C99/POSIX ·
|
||||
<p class="meta"><b>25291</b> linhas C99/POSIX ·
|
||||
<b>25</b> ferramentas · <b>32</b> programas de teste ·
|
||||
<b>16</b> plugins · <b>42</b> paletas · BSD-3-Clause</p>
|
||||
|
||||
@@ -161,7 +161,8 @@ splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<code>/.well-known/agent-card.json</code>. Um <code>contextId</code> e uma conversa;
|
||||
sem ele o servidor cria um e devolve. Uma <code>taskPushNotificationConfig</code>
|
||||
envia a tarefa concluida para um webhook (loopback ou
|
||||
<code>SPLINTER_A2A_PUSH_ALLOW</code>). Fora do loopback o token Bearer e obrigatorio.</p>
|
||||
<code>SPLINTER_A2A_PUSH_ALLOW</code>); configs de push podem ser gerenciadas por
|
||||
CRUD e URLs text/plain sao buscadas de hosts permitidos. Fora do loopback o token Bearer e obrigatorio.</p>
|
||||
|
||||
<hr>
|
||||
<p id="foot">splinter - C99/POSIX, BSD-3-Clause. Manual: <code>man ./docs/splinter.1</code> · ABI de plugins: <code>docs/PLUGINS.md</code></p>
|
||||
|
||||
@@ -7,6 +7,16 @@ class H(http.server.BaseHTTPRequestHandler):
|
||||
def log_message(self, *a):
|
||||
pass
|
||||
|
||||
def do_GET(self):
|
||||
b = b"hallo aus datei\n"
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/plain")
|
||||
self.send_header("Content-Length", str(len(b)))
|
||||
self.end_headers()
|
||||
self.wfile.write(b)
|
||||
with open(sys.argv[2], "a") as f:
|
||||
f.write("get %s\n" % self.path)
|
||||
|
||||
def do_POST(self):
|
||||
n = int(self.headers.get("Content-Length", 0))
|
||||
body = self.rfile.read(n).decode("utf-8", "replace")
|
||||
|
||||
@@ -21,7 +21,7 @@ cleanup() {
|
||||
}
|
||||
trap cleanup EXIT
|
||||
mkdir -p "$D/home"
|
||||
printf 'answer hallo von splinter\nanswer hallo von splinter\nanswer hallo von splinter\nanswer hallo von splinter\nanswer hallo von splinter\nanswer hallo von splinter\n' > "$D/model.txt"
|
||||
printf 'answer hallo von splinter\nanswer hallo von splinter\nanswer hallo von splinter\nanswer hallo von splinter\nanswer hallo von splinter\nanswer hallo von splinter\nanswer hallo von splinter\n' > "$D/model.txt"
|
||||
|
||||
fails=0
|
||||
check() { if "$@"; then :; else echo "FAIL $*"; fails=$((fails + 1)); fi; }
|
||||
@@ -93,9 +93,23 @@ check test $? -eq 0
|
||||
resp6=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"6\",\"method\":\"CancelTask\",\"params\":{\"id\":\"$id\"}}")
|
||||
echo "$resp6" | grep -q '"code":-32002'
|
||||
check test $? -eq 0
|
||||
# the standalone push-config CRUD is not served: UnsupportedOperation (-32004)
|
||||
resp9=$(post "$P" '{"jsonrpc":"2.0","id":"9","method":"CreateTaskPushNotificationConfig","params":{}}')
|
||||
echo "$resp9" | grep -q '"code":-32004'
|
||||
# push-config CRUD: create, get, list, delete, then get again
|
||||
resp9=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"9\",\"method\":\"CreateTaskPushNotificationConfig\",\"params\":{\"taskId\":\"$id\",\"url\":\"http://127.0.0.1:$P3/hook2\",\"token\":\"t2\",\"authentication\":{\"scheme\":\"Bearer\",\"credentials\":\"c2\"}}}")
|
||||
echo "$resp9" | grep -q '"id":"cfg-'
|
||||
check test $? -eq 0
|
||||
cid=$(printf '%s' "$resp9" | python3 -c 'import json,sys; print(json.load(sys.stdin)["result"]["id"])')
|
||||
check test -n "$cid"
|
||||
resp9=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"9\",\"method\":\"GetTaskPushNotificationConfig\",\"params\":{\"taskId\":\"$id\",\"pushNotificationConfigId\":\"$cid\"}}")
|
||||
echo "$resp9" | grep -q 'hook2'
|
||||
check test $? -eq 0
|
||||
resp9=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"9\",\"method\":\"ListTaskPushNotificationConfigs\",\"params\":{\"taskId\":\"$id\"}}")
|
||||
echo "$resp9" | grep -q '"totalSize":1'
|
||||
check test $? -eq 0
|
||||
resp9=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"9\",\"method\":\"DeleteTaskPushNotificationConfig\",\"params\":{\"taskId\":\"$id\",\"pushNotificationConfigId\":\"$cid\"}}")
|
||||
echo "$resp9" | grep -q '"result":{}'
|
||||
check test $? -eq 0
|
||||
resp9=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"9\",\"method\":\"GetTaskPushNotificationConfig\",\"params\":{\"taskId\":\"$id\",\"pushNotificationConfigId\":\"$cid\"}}")
|
||||
echo "$resp9" | grep -q '"code":-32001'
|
||||
check test $? -eq 0
|
||||
|
||||
# ListTasks: the stored task, and an empty list for another context
|
||||
@@ -119,6 +133,13 @@ resp11=$(post "$P" '{"jsonrpc":"2.0","id":"11","method":"SendMessage","params":{
|
||||
echo "$resp11" | grep -q '"code":-32005'
|
||||
check test $? -eq 0
|
||||
|
||||
# a text/plain URL on loopback is fetched; the file server sees the GET
|
||||
resp14=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"14\",\"method\":\"SendMessage\",\"params\":{\"message\":{\"messageId\":\"m\",\"role\":\"ROLE_USER\",\"parts\":[{\"url\":\"http://127.0.0.1:$P3/file.txt\",\"mediaType\":\"text/plain\"}]}}}")
|
||||
echo "$resp14" | grep -q 'TASK_STATE_COMPLETED'
|
||||
check test $? -eq 0
|
||||
grep -q 'get /file.txt' "$D/hook.log"
|
||||
check test $? -eq 0
|
||||
|
||||
# a push config posts the completed task to the loopback webhook
|
||||
resp12=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"12\",\"method\":\"SendMessage\",\"params\":{\"message\":{\"messageId\":\"m\",\"role\":\"ROLE_USER\",\"parts\":[{\"text\":\"push\"}]},\"configuration\":{\"taskPushNotificationConfig\":{\"url\":\"http://127.0.0.1:$P3/hook\",\"token\":\"t1\",\"authentication\":{\"scheme\":\"Bearer\",\"credentials\":\"secret\"}}}}}")
|
||||
echo "$resp12" | grep -q 'TASK_STATE_COMPLETED'
|
||||
|
||||
+7
-3
@@ -459,7 +459,9 @@ splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<code>/.well-known/agent-card.json</code>. Ein <code>contextId</code> ist eine
|
||||
Konversation; ohne eines legt der Server eins an und gibt es zurueck. Eine
|
||||
<code>taskPushNotificationConfig</code> schickt den fertigen Task an einen
|
||||
Webhook (Loopback oder <code>SPLINTER_A2A_PUSH_ALLOW</code>). Jenseits von
|
||||
Webhook (Loopback oder <code>SPLINTER_A2A_PUSH_ALLOW</code>); Push-Configs
|
||||
lassen sich per CRUD verwalten, text/plain-URLs werden von erlaubten Hosts
|
||||
geholt. Jenseits von
|
||||
Loopback ist der Bearer-Token Pflicht.</p>""",
|
||||
]
|
||||
|
||||
@@ -508,7 +510,8 @@ splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<code>/.well-known/agent-card.json</code>. A <code>contextId</code> is a
|
||||
conversation; without one the server makes one and returns it. A
|
||||
<code>taskPushNotificationConfig</code> posts the completed task to a webhook
|
||||
(loopback or <code>SPLINTER_A2A_PUSH_ALLOW</code>). Beyond loopback the bearer
|
||||
(loopback or <code>SPLINTER_A2A_PUSH_ALLOW</code>); push configs can be managed
|
||||
with CRUD and text/plain URLs are fetched from allowed hosts. Beyond loopback the bearer
|
||||
token is required.</p>""",
|
||||
]
|
||||
|
||||
@@ -603,7 +606,8 @@ splinter: A2A server on 127.0.0.1:8099 (token required)</pre>
|
||||
<code>/.well-known/agent-card.json</code>. Um <code>contextId</code> e uma conversa;
|
||||
sem ele o servidor cria um e devolve. Uma <code>taskPushNotificationConfig</code>
|
||||
envia a tarefa concluida para um webhook (loopback ou
|
||||
<code>SPLINTER_A2A_PUSH_ALLOW</code>). Fora do loopback o token Bearer e obrigatorio.</p>""",
|
||||
<code>SPLINTER_A2A_PUSH_ALLOW</code>); configs de push podem ser gerenciadas por
|
||||
CRUD e URLs text/plain sao buscadas de hosts permitidos. Fora do loopback o token Bearer e obrigatorio.</p>""",
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user