Files
splinter/tests/test_delegate_cli.sh
T
lotherk 7d84b43585 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.
2026-11-10 06:31:52 +00:00

44 lines
1.5 KiB
Bash
Executable File

#!/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