cli: --delegate ID runs one named delegate without a model
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.
This commit is contained in:
1 parent
ef3c4d0b37
commit
7d84b43585
12 files changed
+193
-68
No files matched your search
@@ -217,6 +217,7 @@ check: $(LIB) $(BIN) $(PLUGIN) $(TESTS)
|
||||
@set -e; python3 tools/check_i18n.py; python3 tools/gen_www.py --check; \
|
||||
export LD_LIBRARY_PATH=.; \
|
||||
for t in $(TESTS); do echo "== $$t"; ./$$t; done; \
|
||||
echo "== tests/test_delegate_cli.sh"; sh tests/test_delegate_cli.sh; \
|
||||
echo "== tests/test_gateway.sh"; sh tests/test_gateway.sh; \
|
||||
echo "== tests/test_a2a.sh"; sh tests/test_a2a.sh; \
|
||||
echo "== tests/test_a2a_ui.sh"; sh tests/test_a2a_ui.sh; \
|
||||
|
||||
@@ -233,6 +233,14 @@ nothing crosses the jump except the task.
|
||||
Proven: a delegate with host=172.25.206.16 ran on olivia and answered from a
|
||||
provider reachable only over the wireguard link.
|
||||
|
||||
A failing delegate can be run without a model, which is how the child's own
|
||||
error text and exit status are inspected:
|
||||
|
||||
./splinter --delegate claude0 -p "sage nur: beta"
|
||||
|
||||
The observation carries the delegate line, the child's exit status and the task
|
||||
or job state; no model turn, no transport.
|
||||
|
||||
## A fleet in one directory
|
||||
|
||||
`src/swarm.c` is the local variant. The first splinter started in a directory
|
||||
|
||||
@@ -1,32 +1,11 @@
|
||||
# Offene Punkte
|
||||
|
||||
Stand: 2026-11-09, nach der Arbeit an der Liste. Jeder Punkt nennt den Beleg
|
||||
und den naechsten Schritt. Erledigtes steht unten, damit die Liste nicht wieder
|
||||
behauptet, etwas sei offen.
|
||||
Stand: 2026-11-10. Jeder Punkt nennt den Beleg und den naechsten Schritt.
|
||||
Erledigtes steht unten, damit die Liste nicht wieder behauptet, etwas sei offen.
|
||||
|
||||
## Offen
|
||||
|
||||
### 1. `claude`-Delegate endet mit Exit 2 — unerklaert
|
||||
|
||||
Der Fehler traegt inzwischen die letzten 400 Bytes des Kindes
|
||||
(`src/delegate.c:511-524`), und ein Limit bencht den Delegate, der naechste
|
||||
uebernimmt (`tests/test_delegate.c`, claude0 -> claude1). Die Ursache von Exit 2
|
||||
ist aber nie diagnostiziert worden; der belegte Fall ist Exit 1 ("weekly
|
||||
limit"). `env=NAME=VALUE` pro Delegate (`75d8bee`) ist ein moeglicher Weg, kein
|
||||
Beweis.
|
||||
|
||||
Naechster Schritt: Kind mit `SPLINTER_DUMP_REQUEST` und ungefiltertem stderr
|
||||
laufen lassen, Exit-Code der CLI von dem von splinter trennen. Braucht die echte
|
||||
CLI und ein Konto.
|
||||
|
||||
Stand 2026-11-09 23:20: beide konfigurierten `claude`-Delegates sind am Limit.
|
||||
`claude0` ist bis 2026-11-10 03:00 gebenched (Cooldown-Datei), `claude1`
|
||||
antwortet mit "5-hour limit, resets 11:30pm". Der Pfad verhaelt sich richtig:
|
||||
Exit 1 mit dem Text des Kindes, `claude0` in die Cooldown-Datei, `claude1` als
|
||||
`waiting_poll`-Job mit Retry. Exit 2 liess sich damit nicht reproduzieren; die
|
||||
Ursache bleibt offen, bis wieder Kontingent da ist.
|
||||
|
||||
### 2. Kids-Zustimmung ist gegen einen Stub geprueft, nicht gegen Telegram
|
||||
### 1. Kids-Zustimmung ist gegen einen Stub geprueft, nicht gegen Telegram
|
||||
|
||||
`sp_ack_*` (19 Checks in `tests/test_ack.c`), `tg-ask` und der Resolver im
|
||||
Gateway sind gebaut; die Kette endet bei einem Menschen. Die Tests sprechen
|
||||
@@ -36,7 +15,7 @@ Naechster Schritt: `SPLINTER_ACK_CHANNELS=$HOME/.splinter/bin/tg-ask`,
|
||||
`SPLINTER_ACK_CHAT=8300935`, eine Aenderung anstossen, `ok <id>` im Chat
|
||||
schicken. Braucht Token und Chat.
|
||||
|
||||
### 3. A2A: Client und Server stehen, der Rest fehlt
|
||||
### 2. A2A: Client und Server stehen, der Rest fehlt
|
||||
|
||||
Der Client ist gebaut: `plugins/a2a/a2a.c` sendet `SendMessage` als JSON-RPC 2.0
|
||||
mit einem Text-Teil, blockierend, und liest eine direkte `Message` oder eine
|
||||
@@ -47,18 +26,20 @@ Context-Id bleiben fuer die Sitzung; ein terminaler Task verliert seine Id, der
|
||||
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`) `GetTask`, `ListTasks`, Multiturn ueber `contextId`,
|
||||
Turn in der Konversation des `contextId`), `SendStreamingMessage` (SSE,
|
||||
`artifactUpdate`-Chunks, dann completed `statusUpdate`), `GetTask`,
|
||||
`ListTasks`, Multiturn ueber `contextId` und
|
||||
`GET /.well-known/agent-card.json`, Bearer-Token ueber
|
||||
`SPLINTER_A2A_SERVER_TOKEN` jenseits von Loopback.
|
||||
`SPLINTER_A2A_SERVER_TOKEN` jenseits von Loopback. `CancelTask` antwortet
|
||||
`TaskNotCancelable` (-32002), Push-Konfigurationen `PushNotificationNotSupported`
|
||||
(-32003), `SubscribeToTask` `UnsupportedOperation` (-32004).
|
||||
|
||||
Offen: Datei- und strukturierte Teile, Push-Notifications,
|
||||
`CancelTask`/`SubscribeToTask` und die Fortsetzung eines unterbrochenen Tasks
|
||||
(`INPUT_REQUIRED`).
|
||||
Offen: Datei- und strukturierte Teile, echte Push-Notifications und die
|
||||
Fortsetzung eines unterbrochenen Tasks (`INPUT_REQUIRED`).
|
||||
|
||||
Naechster Schritt: Datei-Teile.
|
||||
|
||||
### 4. `~/.local/lib` enthaelt Fremdlast
|
||||
### 3. `~/.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) —
|
||||
@@ -68,31 +49,18 @@ Installationsziel.
|
||||
|
||||
Naechster Schritt: entscheiden, ob die npm-Reste weg duerfen. Kein Code.
|
||||
|
||||
## Erledigt (2026-11-09)
|
||||
## Erledigt
|
||||
|
||||
- **Markdown-Tabellen**: `src/md.c` erkennt Kopf + Trenner, rechnet die Breite
|
||||
je Spalte und gibt ausgerichteten Text aus; Text davor/danach bleibt.
|
||||
`tests/test_md.c` (Kopf, Trenner, ungleich lange Zeilen, UTF-8, zwei Bloecke)
|
||||
und ein Fall in `tests/test_ui.sh`, der die Spalten auf dem Schirm prueft.
|
||||
- **Website zaehlt**: `tools/gen_www.py` liest Zeilen, Werkzeuge, Tests, Plugins
|
||||
und Paletten aus dem Baum. Die meta-Zeile nennt jetzt 31 Test-Programme,
|
||||
23 Werkzeuge und 15 Plugins; die alte Binärgroesse ist durch die
|
||||
Werkzeugzahl ersetzt, weil sie mit jedem Build altert.
|
||||
- **Delegate im Task-Panel**: `tests/test_delegate.c` uebergibt einen Host mit
|
||||
geladenem `tasks`-Plugin, laesst einen Delegate laufen und prueft
|
||||
`delegate:panel exit 0` im Widget sowie `tasks_running == 0`.
|
||||
- **8k-Kontext gemessen**: `tests/test_compactor.c` faehrt den echten Turn-Loop
|
||||
mit `lcm` bei 8192 und 32768 Bytes Budget und zaehlt die Kompressionen. Der
|
||||
alte Vorschlag `SPLINTER_CTX_MAX=8192` war falsch: das speist nur die Anzeige
|
||||
(`src/ui.c:1045`), komprimiert wird nach `max_bytes` (`src/agent.c:327`).
|
||||
- **Doku-Drift**: `docs/PLUGINS.md` hat Abschnitte fuer planner, provider,
|
||||
scheduler und tmux; `README.md` nennt `swarm` und die aktuelle Testzahl;
|
||||
`docs/ROADMAP.md` fuehrt Remote/Jumphost und die 8k-Messung als erledigt.
|
||||
- **Neue Tests**: `test_swarm` (master/slave, route, busy, standalone),
|
||||
`test_provstate` (429/503, getrennte Keys, Dateimodus, Fingerprint),
|
||||
`test_planner` (add/list/update, `/tasks`, Datei, Widget) und `test_jobs`
|
||||
(submit/jobs/result, force-Retry, faelliger Job im Scheduler-Tick,
|
||||
Scheduler-Widget).
|
||||
- **Delegate-Diagnose**: `--delegate ID -p TEXT` fuehrt einen benannten Delegate
|
||||
ohne Modell und ohne Transport aus und druckt die Beobachtung (Exit-Status des
|
||||
Kindes, dessen Fehlertext, Job-Zeile). Am 2026-11-10 liefert
|
||||
`--delegate claude0 -p "sage nur: beta"` die Antwort `beta`; der alte Exit 2
|
||||
ist damit nicht reproduzierbar. `tests/test_delegate_cli.sh` prueft den Pfad,
|
||||
den unbekannten Namen und die fehlende Aufgabe.
|
||||
- **Planner-Race**: Der Widget-Tick rief alle fuenf Sekunden `load_tasks()` und
|
||||
setzte das Array unter einem laufenden Tool zurueck; `test_planner` fiel etwa
|
||||
in jedem sechsten Lauf. Ein rekursiver Mutex deckt jetzt Tools, `/tasks` und
|
||||
den Tick. 20 Laeufe in Folge gruen (`ef3c4d0`).
|
||||
- **A2A-Client und -Server**: `plugins/a2a/a2a.c` sendet `SendMessage`
|
||||
(JSON-RPC 2.0, Text, blockierend), in der UI `SendStreamingMessage` (SSE,
|
||||
Artefakt-Text live) und findet den Endpunkt ueber `SPLINTER_A2A_CARD`;
|
||||
@@ -103,6 +71,29 @@ Naechster Schritt: entscheiden, ob die npm-Reste weg duerfen. Kein Code.
|
||||
`tests/test_a2a_server.sh` den Server und den Client gegen den Server
|
||||
(Discovery, blockierend und streamend), `tests/test_a2a_context.sh` die
|
||||
Konversation ueber `contextId`.
|
||||
- **Markdown-Tabellen**: `src/md.c` erkennt Kopf + Trenner, rechnet die Breite
|
||||
je Spalte und gibt ausgerichteten Text aus; Text davor/danach bleibt.
|
||||
`tests/test_md.c` (Kopf, Trenner, ungleich lange Zeilen, UTF-8, zwei Bloecke)
|
||||
und ein Fall in `tests/test_ui.sh`, der die Spalten auf dem Schirm prueft.
|
||||
- **Website zaehlt**: `tools/gen_www.py` liest Zeilen, Werkzeuge, Tests, Plugins
|
||||
und Paletten aus dem Baum. Die meta-Zeile nennt jetzt 31 Test-Programme,
|
||||
23 Werkzeuge und 16 Plugins; die alte Binärgroesse ist durch die
|
||||
Werkzeugzahl ersetzt, weil sie mit jedem Build altert.
|
||||
- **Delegate im Task-Panel**: `tests/test_delegate.c` uebergibt einen Host mit
|
||||
geladenem `tasks`-Plugin, laesst einen Delegate laufen und prueft
|
||||
`delegate:panel exit 0` im Widget sowie `tasks_running == 0`.
|
||||
- **8k-Kontext gemessen**: `tests/test_compactor.c` faehrt den echten Turn-Loop
|
||||
mit `lcm` bei 8192 und 32768 Bytes Budget und zaehlt die Kompressionen. Der
|
||||
alte Vorschlag `SPLINTER_CTX_MAX=8192` war falsch: das speist nur die Anzeige
|
||||
(`src/ui.c:1045`), komprimiert wird nach `max_bytes` (`src/agent.c:327`).
|
||||
- **Doku-Drift**: `docs/PLUGINS.md` hat Abschnitte fuer planner, provider,
|
||||
scheduler, tmux und a2a; `README.md` nennt `swarm` und die aktuelle Testzahl;
|
||||
`docs/ROADMAP.md` fuehrt Remote/Jumphost und die 8k-Messung als erledigt.
|
||||
- **Neue Tests**: `test_swarm` (master/slave, route, busy, standalone),
|
||||
`test_provstate` (429/503, getrennte Keys, Dateimodus, Fingerprint),
|
||||
`test_planner` (add/list/update, `/tasks`, Datei, Widget) und `test_jobs`
|
||||
(submit/jobs/result, force-Retry, faelliger Job im Scheduler-Tick,
|
||||
Scheduler-Widget).
|
||||
- **Fehler dabei gefunden und behoben**: `delegate_retry` las `id` und `force`
|
||||
in denselben Puffer; `json_str` haengt an, also wurde aus `job-1` mit
|
||||
`force=1` die Id `job-11` (`src/delegate.c`, `tool_delegate_retry`).
|
||||
|
||||
+2
-2
@@ -11,8 +11,8 @@ Stand: 2026-11-09. Die geprüfte, ausführliche Liste mit Belegen steht in
|
||||
Tasks. `swarm` ist nur lokale IPC im
|
||||
selben Verzeichnis, kein A2A.
|
||||
|
||||
2. **Echte Gegenstellen** — die Kids-Zustimmung gegen einen echten Telegram-Bot
|
||||
(nicht `fake_telegram.py`), und die Ursache von `claude` Exit 2.
|
||||
2. **Echte Gegenstelle** — die Kids-Zustimmung gegen einen echten Telegram-Bot
|
||||
(nicht `fake_telegram.py`).
|
||||
|
||||
## Erledigt
|
||||
|
||||
|
||||
@@ -50,6 +50,12 @@ Transport: POST the line protocol to
|
||||
.Ar URL
|
||||
using
|
||||
.Xr curl 1 .
|
||||
.It Fl -delegate Ar ID
|
||||
Run that configured delegate with
|
||||
.Fl p Ar TEXT ,
|
||||
print its observation and exit.
|
||||
No model and no transport are involved; this is the diagnostic path for a
|
||||
delegate that fails.
|
||||
.It Fl -script Ar FILE
|
||||
Transport: replay one reply per line from
|
||||
.Ar FILE .
|
||||
|
||||
+17
-3
@@ -756,9 +756,23 @@ send_out:
|
||||
sp_buf_free(&out);
|
||||
} else if (strcmp(method, "SendStreamingMessage") == 0) {
|
||||
handle_stream(fd, ag, id, params);
|
||||
} else if (strcmp(method, "CancelTask") == 0 ||
|
||||
strcmp(method, "SubscribeToTask") == 0) {
|
||||
rpc_error(fd, id, -32601, "not served here");
|
||||
} else if (strcmp(method, "CancelTask") == 0) {
|
||||
const char *tid = mcp_arg_string(params, "id");
|
||||
|
||||
if (tid == NULL || *tid == '\0')
|
||||
rpc_error(fd, id, -32602, "id is required");
|
||||
else if (task_find(tid) == NULL)
|
||||
rpc_error(fd, id, -32001, "task not found");
|
||||
else
|
||||
rpc_error(fd, id, -32002, "task is already completed");
|
||||
} 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, -32003, "push notifications are not served");
|
||||
} else {
|
||||
rpc_error(fd, id, -32601, "method not found");
|
||||
}
|
||||
|
||||
+59
-1
@@ -55,6 +55,8 @@ usage(FILE *f)
|
||||
" --list-themes print the palette names and exit\n"
|
||||
" --resume load the session's history into the conversation\n"
|
||||
" --choose TEXT print which delegate fits TEXT, then exit\n"
|
||||
" --delegate ID run that delegate with -p TEXT, print its "
|
||||
"observation, exit\n"
|
||||
" --daemon answer on Telegram until SIGINT\n"
|
||||
" --no-stdin ignore data on standard input\n"
|
||||
" -c, --continue continue the last session started in this "
|
||||
@@ -202,6 +204,7 @@ struct opts {
|
||||
const char *prompt, *endpoint, *script, *model, *key_env;
|
||||
const char *sessdir, *sessid, *theme, *transport, *config_path;
|
||||
const char *choose, *mcp_ip;
|
||||
const char *delegate;
|
||||
const char *plugins[16];
|
||||
size_t nplugins;
|
||||
int init_config, no_config, list_themes, chat, resume;
|
||||
@@ -285,6 +288,13 @@ parse_args(int argc, char **argv, struct opts *o, struct sp_agent_config *cfg)
|
||||
return 2;
|
||||
}
|
||||
o->choose = argv[++i];
|
||||
} else if (!strcmp(a, "--delegate")) {
|
||||
if (i + 1 >= argc) {
|
||||
fprintf(stderr, "splinter: --delegate needs an "
|
||||
"id\n");
|
||||
return 2;
|
||||
}
|
||||
o->delegate = argv[++i];
|
||||
} else if (!strcmp(a, "--daemon"))
|
||||
o->daemon = 1;
|
||||
else if (!strcmp(a, "--ack") && i + 2 < argc) {
|
||||
@@ -552,6 +562,45 @@ run_choose(const struct sp_config *conf, const char *text)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* --delegate ID -p TEXT: run one named delegate without a model and print the
|
||||
* observation. This is the diagnostic path for a delegate that fails: the
|
||||
* transport's own message, the child's exit status and the task/job lines are
|
||||
* all in that observation.
|
||||
*/
|
||||
static int
|
||||
run_delegate_cli(const struct sp_registry *reg, const char *id,
|
||||
const char *task)
|
||||
{
|
||||
const struct sp_tool *t = sp_registry_find(reg, "delegate");
|
||||
struct sp_buf out, args;
|
||||
int rc = 0;
|
||||
|
||||
if (t == NULL) {
|
||||
fprintf(stderr, "splinter: the delegate tool is not "
|
||||
"registered\n");
|
||||
return 3;
|
||||
}
|
||||
if (sp_buf_init(&out) != 0 || sp_buf_init(&args) != 0)
|
||||
return 3;
|
||||
if (sp_buf_puts(&args, "{\"task\":\"") != 0 ||
|
||||
sp_json_escape(&args, task) != 0 ||
|
||||
sp_buf_puts(&args, "\",\"delegate\":\"") != 0 ||
|
||||
sp_json_escape(&args, id) != 0 ||
|
||||
sp_buf_puts(&args, "\"}") != 0) {
|
||||
sp_buf_free(&out);
|
||||
sp_buf_free(&args);
|
||||
return 3;
|
||||
}
|
||||
if (t->run(args.p, &out, t->ctx) != 0)
|
||||
rc = 1;
|
||||
if (out.p != NULL && out.len > 0)
|
||||
printf("%s\n", out.p);
|
||||
sp_buf_free(&out);
|
||||
sp_buf_free(&args);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* exactly one transport, and a reason to run at all; 0 or the exit status */
|
||||
static int
|
||||
check_usage(const struct opts *o)
|
||||
@@ -562,11 +611,15 @@ check_usage(const struct opts *o)
|
||||
return 2;
|
||||
}
|
||||
if (o->transport == NULL && o->endpoint == NULL && o->script == NULL &&
|
||||
o->mcp_ip == NULL) {
|
||||
o->mcp_ip == NULL && o->delegate == NULL) {
|
||||
fprintf(stderr, "splinter: no transport (--endpoint, --script or "
|
||||
"--transport)\n");
|
||||
return 2;
|
||||
}
|
||||
if (o->delegate != NULL && o->prompt == NULL) {
|
||||
fprintf(stderr, "splinter: --delegate needs -p TEXT\n");
|
||||
return 2;
|
||||
}
|
||||
if (o->prompt == NULL && !o->chat && !o->daemon && o->mcp_ip == NULL &&
|
||||
o->a2a_ip == NULL) {
|
||||
fprintf(stderr, "splinter: -p/--prompt is required unless you pass "
|
||||
@@ -993,6 +1046,10 @@ main(int argc, char **argv)
|
||||
"delegate\n");
|
||||
return 3;
|
||||
}
|
||||
if (o.delegate != NULL) {
|
||||
rc = run_delegate_cli(®, o.delegate, o.prompt);
|
||||
goto cleanup;
|
||||
}
|
||||
if ((rc = pick_transport(&o, &ag, host, ®, &mock, &have_mock,
|
||||
&err)) != 0)
|
||||
return rc;
|
||||
@@ -1036,6 +1093,7 @@ main(int argc, char **argv)
|
||||
else
|
||||
rc = run_prompt(&ag, &cfg, o.prompt, o.no_stream, &err);
|
||||
|
||||
cleanup:
|
||||
if (have_mock)
|
||||
sp_mock_free(&mock);
|
||||
sp_host_free(host);
|
||||
|
||||
@@ -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>23845</b> lines of C99/POSIX ·
|
||||
<p class="meta"><b>23917</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>
|
||||
|
||||
|
||||
+1
-1
@@ -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>23845</b> Zeilen C99/POSIX ·
|
||||
<p class="meta"><b>23917</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>
|
||||
|
||||
|
||||
@@ -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>23845</b> linhas C99/POSIX ·
|
||||
<p class="meta"><b>23917</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>
|
||||
|
||||
|
||||
@@ -74,9 +74,13 @@ check test $? -eq 0
|
||||
echo "$resp3" | grep -q 'TASK_STATE_COMPLETED'
|
||||
check test $? -eq 0
|
||||
|
||||
# CancelTask is still refused, not half-answered
|
||||
resp6=$(post "$P" '{"jsonrpc":"2.0","id":"6","method":"CancelTask","params":{}}')
|
||||
echo "$resp6" | grep -q '"code":-32601'
|
||||
# a completed task cannot be canceled: the spec's TaskNotCancelable (-32002)
|
||||
resp6=$(post "$P" "{\"jsonrpc\":\"2.0\",\"id\":\"6\",\"method\":\"CancelTask\",\"params\":{\"id\":\"$id\"}}")
|
||||
echo "$resp6" | grep -q '"code":-32002'
|
||||
check test $? -eq 0
|
||||
# push notifications are not served: PushNotificationNotSupported (-32003)
|
||||
resp9=$(post "$P" '{"jsonrpc":"2.0","id":"9","method":"CreateTaskPushNotificationConfig","params":{}}')
|
||||
echo "$resp9" | grep -q '"code":-32003'
|
||||
check test $? -eq 0
|
||||
|
||||
# ListTasks: the stored task, and an empty list for another context
|
||||
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
# splinter -- one named delegate, no model: the diagnostic path.
|
||||
#
|
||||
# This is how a failing delegate is inspected: the observation carries the
|
||||
# child's exit status, its own error text and the job line. The fake ssh is
|
||||
# the far side, so no network and no account is involved.
|
||||
set -u
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
D=$(mktemp -d "${TMPDIR:-/var/tmp}/splinter-delcli-XXXXXX") || exit 1
|
||||
cleanup() { rm -rf "$D"; }
|
||||
trap cleanup EXIT
|
||||
fails=0
|
||||
check() { if "$@"; then :; else echo "FAIL $*"; fails=$((fails + 1)); fi; }
|
||||
mkdir -p "$D/home"
|
||||
|
||||
printf '#!/bin/sh\necho "antwort von der cli"\n' > "$D/ssh"
|
||||
chmod +x "$D/ssh"
|
||||
cat > "$D/conf" <<'EOF'
|
||||
delegate = fake | ein fake | host=fakehost | endpoint=http://example/v1 | model=m | tags=x
|
||||
EOF
|
||||
|
||||
out=$(PATH="$D:$PATH" HOME="$D/home" ./splinter --config "$D/conf" \
|
||||
--delegate fake -p "hallo" 2>&1)
|
||||
echo "$out" | grep -q -F '[delegate fake'
|
||||
check test $? -eq 0
|
||||
echo "$out" | grep -q 'antwort von der cli'
|
||||
check test $? -eq 0
|
||||
|
||||
# the tool reports an unknown delegate instead of guessing
|
||||
out=$(PATH="$D:$PATH" HOME="$D/home" ./splinter --config "$D/conf" \
|
||||
--delegate nosuch -p "hallo" 2>&1)
|
||||
echo "$out" | grep -q 'no delegate matches'
|
||||
check test $? -eq 0
|
||||
|
||||
# the task is required
|
||||
PATH="$D:$PATH" HOME="$D/home" ./splinter --config "$D/conf" \
|
||||
--delegate fake >/dev/null 2>"$D/err"
|
||||
check test $? -eq 2
|
||||
grep -q 'needs -p TEXT' "$D/err"
|
||||
check test $? -eq 0
|
||||
|
||||
if [ "$fails" -eq 0 ]; then echo "test_delegate_cli: ok"; exit 0; fi
|
||||
exit 1
|
||||
Reference in new issue
Block a user