





















@@ -438,6 +438,12 @@ if (missing.length > 0) {
438438NODE
439439}
440440441+session_jsonl_path() {
442+local profile="$1"
443+local session_id="$2"
444+echo "$HOME/.openclaw-${profile}/agents/main/sessions/${session_id}.jsonl"
445+}
446+441447run_profile() {
442448local profile="$1"
443449local port="$2"
@@ -535,8 +541,8 @@ run_profile() {
535541 HOSTNAME_TXT="$workspace/hostname.txt"
536542 IMAGE_PNG="$workspace/proof.png"
537543 IMAGE_TXT="$workspace/image.txt"
538-SESSION_ID="e2e-tools-${profile}"
539- SESSION_JSONL="$HOME/.openclaw-${profile}/agents/main/sessions/${SESSION_ID}.jsonl"
544+SESSION_ID_PREFIX="e2e-tools-${profile}"
545+ SESSION_JSONL=""
540546541547 PROOF_VALUE="$(node -e 'console.log(require("node:crypto").randomBytes(16).toString("hex"))')"
542548echo -n "$PROOF_VALUE" >"$PROOF_TXT"
@@ -578,7 +584,9 @@ run_profile() {
578584579585echo "==> Agent turns ($profile)"
580586581- run_agent_turn "$profile" "$SESSION_ID" \
587+ TURN1_SESSION_ID="${SESSION_ID_PREFIX}-read-proof"
588+ SESSION_JSONL="$(session_jsonl_path "$profile" "$TURN1_SESSION_ID")"
589+ run_agent_turn "$profile" "$TURN1_SESSION_ID" \
582590"Use the read tool (not exec) to read ${PROOF_TXT}. Reply with the exact contents only (no extra whitespace)." \
583591"$TURN1_JSON"
584592 assert_agent_json_has_text "$TURN1_JSON"
@@ -592,7 +600,9 @@ run_profile() {
592600593601local prompt2
594602 prompt2=$'Use the write tool (not exec) to write exactly this string into '"${PROOF_COPY}"$':\n'"${reply1}"$'\nReply with exactly: WROTE'
595- run_agent_turn "$profile" "$SESSION_ID" "$prompt2" "$TURN2_JSON"
603+ TURN2_SESSION_ID="${SESSION_ID_PREFIX}-write-copy"
604+ SESSION_JSONL="$(session_jsonl_path "$profile" "$TURN2_SESSION_ID")"
605+ run_agent_turn "$profile" "$TURN2_SESSION_ID" "$prompt2" "$TURN2_JSON"
596606 assert_agent_json_has_text "$TURN2_JSON"
597607 assert_agent_json_ok "$TURN2_JSON" "$agent_model_provider"
598608local copy_value
@@ -601,7 +611,9 @@ run_profile() {
601611echo "ERROR: copy.txt did not match proof.txt ($profile)" >&2
602612exit 1
603613fi
604- run_agent_turn "$profile" "$SESSION_ID" \
614+ TURN2B_SESSION_ID="${SESSION_ID_PREFIX}-read-copy"
615+ SESSION_JSONL="$(session_jsonl_path "$profile" "$TURN2B_SESSION_ID")"
616+ run_agent_turn "$profile" "$TURN2B_SESSION_ID" \
605617"Use the read tool (not exec) to read ${PROOF_COPY}. Reply with the exact contents only (no extra whitespace)." \
606618"$TURN2B_JSON"
607619 assert_agent_json_has_text "$TURN2B_JSON"
@@ -613,7 +625,9 @@ run_profile() {
613625exit 1
614626fi
615627616- run_agent_turn "$profile" "$SESSION_ID" \
628+ TURN3_SESSION_ID="${SESSION_ID_PREFIX}-exec-hostname"
629+ SESSION_JSONL="$(session_jsonl_path "$profile" "$TURN3_SESSION_ID")"
630+ run_agent_turn "$profile" "$TURN3_SESSION_ID" \
617631"Use the exec tool to run this command: hostname. Reply with the exact stdout only (trim trailing newline)." \
618632"$TURN3_JSON"
619633 assert_agent_json_has_text "$TURN3_JSON"
@@ -626,15 +640,19 @@ run_profile() {
626640fi
627641local prompt3b
628642 prompt3b=$'Use the write tool to write exactly this string into '"${HOSTNAME_TXT}"$':\n'"${reply3}"$'\nReply with exactly: WROTE'
629- run_agent_turn "$profile" "$SESSION_ID" "$prompt3b" "$TURN3B_JSON"
643+ TURN3B_SESSION_ID="${SESSION_ID_PREFIX}-write-hostname"
644+ SESSION_JSONL="$(session_jsonl_path "$profile" "$TURN3B_SESSION_ID")"
645+ run_agent_turn "$profile" "$TURN3B_SESSION_ID" "$prompt3b" "$TURN3B_JSON"
630646 assert_agent_json_has_text "$TURN3B_JSON"
631647 assert_agent_json_ok "$TURN3B_JSON" "$agent_model_provider"
632648if [[ "$(cat "$HOSTNAME_TXT" 2>/dev/null | tr -d '\r\n' || true)" != "$EXPECTED_HOSTNAME" ]]; then
633649echo "ERROR: hostname.txt did not match hostname output ($profile)" >&2
634650exit 1
635651fi
636652637- run_agent_turn "$profile" "$SESSION_ID" \
653+ TURN4_SESSION_ID="${SESSION_ID_PREFIX}-image-write"
654+ SESSION_JSONL="$(session_jsonl_path "$profile" "$TURN4_SESSION_ID")"
655+ run_agent_turn "$profile" "$TURN4_SESSION_ID" \
638656"Use the image tool on ${IMAGE_PNG}. Determine which color is on the left half and which is on the right half. Then use the write tool to write exactly: LEFT=RED RIGHT=GREEN into ${IMAGE_TXT}. Reply with exactly: LEFT=RED RIGHT=GREEN" \
639657"$TURN4_JSON"
640658 assert_agent_json_has_text "$TURN4_JSON"
@@ -653,12 +671,12 @@ run_profile() {
653671echo "==> Verify tool usage via session transcript ($profile)"
654672# Give the gateway a moment to flush transcripts.
655673 sleep 1
656-if [[ ! -f "$SESSION_JSONL" ]]; then
657- echo "ERROR: missing session transcript ($profile): $SESSION_JSONL" >&2
658- ls -la "$HOME/.openclaw-${profile}/agents/main/sessions" >&2 || true
659- exit 1
660-fi
661- assert_session_used_tools "$SESSION_JSONL" read write exec image
674+assert_session_used_tools "$(session_jsonl_path "$profile" "$TURN1_SESSION_ID")" read
675+assert_session_used_tools "$(session_jsonl_path "$profile" "$TURN2_SESSION_ID")" write
676+assert_session_used_tools "$(session_jsonl_path "$profile" "$TURN2B_SESSION_ID")" read
677+assert_session_used_tools "$(session_jsonl_path "$profile" "$TURN3_SESSION_ID")" exec
678+assert_session_used_tools "$(session_jsonl_path "$profile" "$TURN3B_SESSION_ID")" write
679+ assert_session_used_tools "$(session_jsonl_path "$profile" "$TURN4_SESSION_ID")" image write
662680663681 cleanup_profile
664682trap - EXIT
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。