Guide models to read-only inspection: prompt rules, pipes and find in the read-only gate, approval stats

This commit is contained in:
hermes committed 2026-10-06 13:14:09 +00:00
1 parent 8345d0f504
commit 37dfbc3102
7 files changed
+70 -11

No files matched your search

+2 -2
View File
@@ -52,13 +52,13 @@ kill $srv; rm -f hello.txt
# 3) extension blocks the bash call (cat) and registers its tool
start 3
printf '[[extensions]]\ncommand = ["python3", "%s/examples/ext_guard.py", "sort hello"]\n' "$root" >> "$tmp/home/.hx/config.toml"
printf '[[extensions]]\ncommand = ["python3", "%s/examples/ext_guard.py", "sed -n p hello"]\n' "$root" >> "$tmp/home/.hx/config.toml"
"$root/target/debug/hx" -p "go" --mode json > "$tmp/ext" 2> "$tmp/err" || fail "ext run" "$tmp/err"
python3 - "$tmp/ext" <<'PY' || fail "ext block" "$tmp/ext"
import json, sys
ev = [json.loads(l) for l in open(sys.argv[1])]
log = json.dumps(ev)
assert "blocked: ext_guard: `sort hello` is not allowed" in log, "no block"
assert "blocked: ext_guard: `sed -n p hello` is not allowed" in log, "no block"
bash = [e for e in ev if e["type"] == "tool_result" and e["name"] == "bash"]
assert len(bash) == 1 and bash[0]["is_error"] and bash[0]["content"].startswith("blocked:"), bash
PY