feat(opus-cyber-profile-manager): WEVIA chat intent to control 8 chrome cyber-profiles on-demand (status/start/stop/start-all/stop-all) - autoheal cron disabled since wave precedent - zero respawn loop | intent opus_cyber_profile_manager LIVE | NR 153/153
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
This commit is contained in:
92
ops/opus-intents/opus-cyber-profile.sh
Executable file
92
ops/opus-intents/opus-cyber-profile.sh
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/bin/bash
|
||||
# WEVIA Cyber Profile Manager - on-demand chrome profile control
|
||||
# Usage:
|
||||
# opus-cyber-profile.sh status → list all 8 profiles + CDP ports + running state
|
||||
# opus-cyber-profile.sh start <slug> → launch one profile
|
||||
# opus-cyber-profile.sh stop <slug> → kill one profile
|
||||
# opus-cyber-profile.sh stop-all → kill all cyber-profiles (keep playwright tests alive)
|
||||
# opus-cyber-profile.sh start-all → launch all (with load guard)
|
||||
# Doctrine: zéro auto, chaque action explicite via NL chat
|
||||
|
||||
ACTION="${1:-status}"
|
||||
SLUG="${2:-}"
|
||||
|
||||
declare -A PROFILES=(
|
||||
[openai]=9222
|
||||
[anthropic]=9223
|
||||
[google]=9224
|
||||
[deepseek]=9225
|
||||
[mistral]=9226
|
||||
[poe]=9227
|
||||
[perplexity]=9228
|
||||
[hf]=9229
|
||||
)
|
||||
|
||||
case "$ACTION" in
|
||||
status)
|
||||
echo "=== CYBER PROFILES STATUS ==="
|
||||
LOAD=$(uptime | awk -F'load average:' '{print $2}' | awk -F, '{print $1}' | tr -d ' ')
|
||||
echo "load1: $LOAD"
|
||||
echo
|
||||
for slug in "${!PROFILES[@]}"; do
|
||||
port="${PROFILES[$slug]}"
|
||||
RUNNING=$(pgrep -f "user-data-dir=/var/lib/wevia-cyber-profiles/$slug" | wc -l)
|
||||
CDP_OK=$(curl -sS -m 2 "http://127.0.0.1:${port}/json/version" 2>/dev/null | grep -c "Browser")
|
||||
if [ "$CDP_OK" -gt 0 ]; then
|
||||
STAT="UP"
|
||||
elif [ "$RUNNING" -gt 0 ]; then
|
||||
STAT="STARTING"
|
||||
else
|
||||
STAT="DOWN"
|
||||
fi
|
||||
printf " %-12s port=%d procs=%d cdp=%s %s\n" "$slug" "$port" "$RUNNING" "$CDP_OK" "$STAT"
|
||||
done
|
||||
;;
|
||||
start)
|
||||
[ -z "$SLUG" ] && { echo "usage: start <slug>"; exit 1; }
|
||||
[ -z "${PROFILES[$SLUG]}" ] && { echo "unknown slug: $SLUG. valid: ${!PROFILES[*]}"; exit 1; }
|
||||
# Load guard
|
||||
LOAD=$(uptime | awk -F'load average:' '{print $2}' | awk -F, '{print $1}' | tr -d ' ' | cut -d. -f1)
|
||||
if [ "$LOAD" -gt 30 ]; then
|
||||
echo "SKIPPED: load=${LOAD} > 30 (threshold)"
|
||||
exit 0
|
||||
fi
|
||||
echo "Launching profile $SLUG (port ${PROFILES[$SLUG]})..."
|
||||
sudo bash /opt/wevia-brain/scripts/chrome-profile-launch.sh "$SLUG" 2>&1 | tail -3
|
||||
;;
|
||||
stop)
|
||||
[ -z "$SLUG" ] && { echo "usage: stop <slug>"; exit 1; }
|
||||
[ -z "${PROFILES[$SLUG]}" ] && { echo "unknown slug: $SLUG"; exit 1; }
|
||||
BEFORE=$(pgrep -f "user-data-dir=/var/lib/wevia-cyber-profiles/$SLUG" | wc -l)
|
||||
sudo pkill -9 -f "user-data-dir=/var/lib/wevia-cyber-profiles/$SLUG" 2>&1
|
||||
sleep 2
|
||||
AFTER=$(pgrep -f "user-data-dir=/var/lib/wevia-cyber-profiles/$SLUG" | wc -l)
|
||||
echo "Stopped $SLUG: ${BEFORE} → ${AFTER} processes"
|
||||
;;
|
||||
stop-all)
|
||||
echo "=== STOP ALL cyber-profiles (playwright tests preserved) ==="
|
||||
BEFORE=$(pgrep -f "user-data-dir=/var/lib/wevia-cyber-profiles" | wc -l)
|
||||
sudo pkill -9 -f "user-data-dir=/var/lib/wevia-cyber-profiles" 2>&1
|
||||
sleep 3
|
||||
AFTER=$(pgrep -f "user-data-dir=/var/lib/wevia-cyber-profiles" | wc -l)
|
||||
echo "cyber-profiles: ${BEFORE} → ${AFTER}"
|
||||
;;
|
||||
start-all)
|
||||
echo "=== START ALL (with load guard) ==="
|
||||
LOAD=$(uptime | awk -F'load average:' '{print $2}' | awk -F, '{print $1}' | tr -d ' ' | cut -d. -f1)
|
||||
if [ "$LOAD" -gt 20 ]; then
|
||||
echo "SKIPPED: load=${LOAD} > 20"
|
||||
exit 0
|
||||
fi
|
||||
for slug in openai anthropic google deepseek mistral poe perplexity hf; do
|
||||
echo "--- $slug ---"
|
||||
sudo bash /opt/wevia-brain/scripts/chrome-profile-launch.sh "$slug" 2>&1 | tail -1
|
||||
sleep 2
|
||||
done
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 {status|start <slug>|stop <slug>|stop-all|start-all}"
|
||||
echo "slugs: ${!PROFILES[*]}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user