feat(box): expand agent tool capabilities with files, web, and service ops

This commit is contained in:
operator
2026-10-05 03:51:43 +00:00
parent 581bbfe3b4
commit 2132d15cb4
4 changed files with 379 additions and 1 deletions
+59
View File
@@ -290,6 +290,60 @@ case "$cmd" in
;;
esac
;;
files)
sub="${1:-read}"
shift || true
case "$sub" in
read)
path="${1:?usage: box files read <path> [lines=100]}"
lines="${2:-100}"
args=$(python3 -c "import json, sys; print(json.dumps({'path': sys.argv[1], 'lines': int(sys.argv[2])}))" "$path" "$lines")
call_exec "files.read" "$args"
;;
write)
path="${1:?usage: box files write <path> <content>}"
content="${2:?usage: box files write <path> <content>}"
args=$(python3 -c "import json, sys; print(json.dumps({'path': sys.argv[1], 'content': sys.argv[2]}))" "$path" "$content")
call_exec "files.write" "$args"
;;
*)
echo "Usage: box files read|write ..."
;;
esac
;;
web)
sub="${1:-fetch}"
shift || true
case "$sub" in
fetch)
url="${1:?usage: box web fetch <url>}"
args=$(python3 -c "import json, sys; print(json.dumps({'url': sys.argv[1]}))" "$url")
call_exec "web.fetch" "$args"
;;
*)
echo "Usage: box web fetch <url>"
;;
esac
;;
service)
sub="${1:-status}"
shift || true
case "$sub" in
status)
unit="${1:?usage: box service status <unit>}"
args=$(python3 -c "import json, sys; print(json.dumps({'unit': sys.argv[1]}))" "$unit")
call_exec "service.status" "$args"
;;
restart)
unit="${1:?usage: box service restart <unit>}"
args=$(python3 -c "import json, sys; print(json.dumps({'unit': sys.argv[1]}))" "$unit")
call_exec "service.restart" "$args"
;;
*)
echo "Usage: box service status|restart <unit>"
;;
esac
;;
health)
call_exec "health.check" "{}"
;;
@@ -318,6 +372,11 @@ Usage:
box vars list
box vars get <name>
box vars set <name> <value>
box files read <path> [lines=100]
box files write <path> <content>
box web fetch <url>
box service status <unit>
box service restart <unit>
box health
box ping
box ops