phase 6: peers verified end-to-end

- PeerAdd/PeerRemove/PeerList/PeerSubmit all functional
- Agent-to-agent prompt delivery confirmed via D-Bus
- Added test-peers.sh for verification
This commit is contained in:
Levi Neely 2026-07-05 23:31:48 +02:00
parent e052424d62
commit aec392baf9
1 changed files with 56 additions and 0 deletions

56
test-peers.sh Executable file
View File

@ -0,0 +1,56 @@
#!/bin/sh
# Test peer-to-peer agent communication
# Run while the daemon is running: make run
set -e
SERVICE="org.ollie.SessionManager"
OBJ="/org/ollie/SessionManager"
IFACE="org.ollie.SessionManager"
echo "=== Create session A ==="
A=$(dbus-send --session --dest=$SERVICE --type=method_call --print-reply \
$OBJ $IFACE.CreateSession string:"$HOME" string:"" string:"" string:"default" | grep 'string "' | head -1 | sed 's/.*string "//;s/"//')
echo "A: $A"
echo "=== Create session B ==="
B=$(dbus-send --session --dest=$SERVICE --type=method_call --print-reply \
$OBJ $IFACE.CreateSession string:"$HOME" string:"" string:"" string:"default" | grep 'string "' | head -1 | sed 's/.*string "//;s/"//')
echo "B: $B"
echo ""
echo "=== PeerAdd: A registers B ==="
dbus-send --session --dest=$SERVICE --type=method_call --print-reply \
$OBJ $IFACE.PeerAdd string:"$A" string:"$B"
echo ""
echo "=== PeerList ==="
dbus-send --session --dest=$SERVICE --type=method_call --print-reply \
$OBJ $IFACE.PeerList string:"$A"
echo ""
echo "=== PeerSubmit: A sends to B ==="
dbus-send --session --dest=$SERVICE --type=method_call --print-reply \
$OBJ $IFACE.PeerSubmit string:"$A" string:"$B" \
string:"Reply with exactly: PEER_OK"
echo ""
echo "=== Waiting 8s for B to respond... ==="
sleep 8
echo ""
echo "=== B's chat ==="
dbus-send --session --dest=$SERVICE --type=method_call --print-reply \
$OBJ $IFACE.GetChat string:"$B" int64:0
echo ""
echo "=== PeerRemove ==="
dbus-send --session --dest=$SERVICE --type=method_call --print-reply \
$OBJ $IFACE.PeerRemove string:"$A" string:"$B"
echo ""
echo "=== Cleanup ==="
dbus-send --session --dest=$SERVICE --type=method_call --print-reply \
$OBJ $IFACE.KillSession string:"$A" > /dev/null
dbus-send --session --dest=$SERVICE --type=method_call --print-reply \
$OBJ $IFACE.KillSession string:"$B" > /dev/null
echo "=== DONE ==="