The A2A transport implements send_stream now: SSE events are read as StreamResponse (task, message, statusUpdate, artifactUpdate), artifact and message text goes to the screen as it arrives, intermediate status notes are ignored, and a completed status message is the answer only when no artifact or direct message text came. Failed/canceled/rejected and input/auth-required states fail the turn instead of becoming an answer. One-shot mode already streamed whenever a transport offered it, so the plain send path was unreachable from the CLI. --no-stream asks for it. test_a2a.sh covers both SendMessage and SendStreamingMessage; the new test_a2a_ui.sh drives the UI streaming path through tmux. README, PLUGINS.md, the man page and the site follow.
84 lines
2.3 KiB
Bash
Executable File
84 lines
2.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# splinter -- the A2A streaming transport, driven through the curses UI.
|
|
#
|
|
# The UI is the only path that turns streaming on (src/ui.c sets cfg.stream),
|
|
# so this is where SendStreamingMessage is exercised: artifact chunks arrive
|
|
# live, the final status note is not appended to them, and a stream whose only
|
|
# answer is the final status message still produces text.
|
|
set -u
|
|
cd "$(dirname "$0")/.." || exit 1
|
|
if ! command -v tmux >/dev/null 2>&1; then
|
|
echo "test_a2a_ui: skipped (no tmux)"
|
|
exit 0
|
|
fi
|
|
D=$(mktemp -d "${TMPDIR:-/var/tmp}/splinter-a2a-ui-XXXXXX") || exit 1
|
|
unset TMUX TMUX_PANE
|
|
export TMUX_TMPDIR="$D"
|
|
S=splinter-a2a-ui-$$
|
|
P=$((20000 + ($$ % 20000)))
|
|
F=
|
|
fails=0
|
|
cleanup() {
|
|
tmux kill-server 2>/dev/null
|
|
[ -n "$F" ] && kill "$F" 2>/dev/null
|
|
rm -rf "$D"
|
|
}
|
|
trap cleanup EXIT
|
|
check() { if "$@"; then :; else echo "FAIL $*"; fails=$((fails + 1)); fi; }
|
|
shows() {
|
|
for i in $(seq 1 30); do
|
|
tmux capture-pane -t $S -p | grep -q -- "$1" && return 0
|
|
sleep 0.5
|
|
done
|
|
return 1
|
|
}
|
|
done_turn() {
|
|
for i in $(seq 1 40); do
|
|
tmux capture-pane -t $S -p | grep -q 'working' || return 0
|
|
sleep 0.5
|
|
done
|
|
return 1
|
|
}
|
|
typed() { tmux send-keys -t $S -l "$1"; }
|
|
key() { tmux send-keys -t $S "$@"; }
|
|
|
|
mkdir -p "$D/home"
|
|
python3 -I tests/fake_a2a.py "$P" "$D/req.log" &
|
|
F=$!
|
|
for i in $(seq 1 50); do
|
|
curl -s -o /dev/null "http://127.0.0.1:$P/x" && break
|
|
sleep 0.2
|
|
done
|
|
tmux new-session -d -s $S -x 110 -y 30 \
|
|
"HOME=$D/home SPLINTER_LOCALE=en \
|
|
SPLINTER_A2A_URL=http://127.0.0.1:$P/rpc \
|
|
./splinter --no-config --plugin plugins/a2a/a2a.so \
|
|
--transport a2a --chat 2>/dev/null; echo \$? > $D/rc"
|
|
shows 'Enter sends'
|
|
|
|
# artifact chunks stream; the completed status note is not appended
|
|
typed 'stream bitte'; key Enter
|
|
check shows 'teil eins teil zwei'
|
|
check done_turn
|
|
if tmux capture-pane -t $S -p | grep -q -- 'fertig'; then
|
|
echo "FAIL the final status note leaked into the answer"
|
|
fails=$((fails + 1))
|
|
fi
|
|
|
|
# no artifact: the final status message is the answer
|
|
typed 'streamstatus'; key Enter
|
|
check shows 'nur status'
|
|
check done_turn
|
|
|
|
# the wire method, not the blocking one
|
|
grep -q '"method":"SendStreamingMessage"' "$D/req.log"
|
|
check test $? -eq 0
|
|
|
|
# quit cleanly
|
|
key C-u C-d
|
|
for i in $(seq 1 20); do [ -s "$D/rc" ] && break; sleep 0.5; done
|
|
check test "$(cat "$D/rc" 2>/dev/null)" = 0
|
|
|
|
if [ "$fails" -eq 0 ]; then echo "test_a2a_ui: ok"; exit 0; fi
|
|
exit 1
|