aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/pi-live.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/pi-live.sh b/tests/pi-live.sh
index c2d2db7..5839aa5 100755
--- a/tests/pi-live.sh
+++ b/tests/pi-live.sh
@@ -63,6 +63,8 @@ export default function (pi) {
pi.registerCommand("block", { description: "test: emit blocked", handler: async () => { pi.events.emit("blocked", { active: true, label: "test block" }); } });
pi.registerCommand("unblock", { description: "test: clear blocked", handler: async () => { pi.events.emit("blocked", { active: false }); } });
pi.registerCommand("ask", { description: "test: a confirm dialog", handler: async (_args, ctx) => { await ctx.ui.confirm("Test dialog", "Proceed?"); } });
+ // A rename from another extension, the way PiRC renames from the phone.
+ pi.registerCommand("remote-rename", { description: "test: another extension renames", handler: async (args) => { pi.setSessionName(args.trim()); } });
// A dialog during a run, the way an extension asks before it goes on.
let askDuring = false;
pi.on("input", (event) => { askDuring = /ask during the run/.test(event.text); });
@@ -324,10 +326,10 @@ t new-window -d -t main: -n auto -c "$D/work3"
t send-keys -t main:auto "pi $NO_MCP" Enter
expect "naming: an agent of its own" "st auto" idle 150
an() { t show -pv -t main:auto @agent_name 2>/dev/null; }
-said() { grep -c "\"role\":\"$1\"" "$(t show -pv -t main:auto @agent_session)" 2>/dev/null; }
-say() { # message count: send it, wait for its reply
- type_line auto "$1"
- expect "reply $2" "said assistant" "$2" 80
+said() { grep -c "\"role\":\"$1\"" "$(t show -pv -t "main:${2:-auto}" @agent_session)" 2>/dev/null; }
+say() { # message count [window]: send it, wait for its reply
+ type_line "${3:-auto}" "$1"
+ expect "reply $2" "said assistant ${3:-auto}" "$2" 80
}
expect "before any message: no name" an ""
say m1 1
@@ -355,6 +357,12 @@ OLD=$(ls -t "$D"/agent/sessions/*work3*/*.jsonl | head -1)
t new-window -d -t main: -n old -c "$D/work3"
t send-keys -t main:old "pi --session '$OLD' $NO_MCP" Enter
expect "resumed: named from its history" "t show -pv -t main:old @agent_name 2>/dev/null" "About an old one" 150
+# Renamed by another extension (PiRC, from the phone): yours.
+type_line old "/remote-rename From the phone"
+expect "another extension renames it" "t show -pv -t main:old @agent_name 2>/dev/null" "From the phone" 50
+for i in 2 3 4 5 6 7 8 9; do say "o$i" $i old; done
+sleep 2
+expect "and that name is kept past 8 more" "t show -pv -t main:old @agent_name 2>/dev/null" "From the phone"
t kill-window -t main:old
echo "2. screen detection (pi without the extension)"