Initial commit: OpenClaw ops workspace

This commit is contained in:
2026-03-28 00:15:47 +00:00
commit f1aeaeefb5
42 changed files with 4297 additions and 0 deletions

View File

@@ -0,0 +1,97 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'EOF'
Usage:
clear-session-model-pins.sh --agent <agent-id> [--channel <channel-id>] [--sessions-file <path>]
Examples:
clear-session-model-pins.sh --agent home
clear-session-model-pins.sh --agent home --channel 1470162839284224184
Notes:
- Removes per-session "model" keys so agent defaults apply again.
- By default targets: /home/node/.openclaw/agents/<agent>/sessions/sessions.json
EOF
}
AGENT_ID=""
CHANNEL_ID=""
SESSIONS_FILE=""
while [[ $# -gt 0 ]]; do
case "$1" in
--agent)
AGENT_ID="${2:-}"
shift 2
;;
--channel)
CHANNEL_ID="${2:-}"
shift 2
;;
--sessions-file)
SESSIONS_FILE="${2:-}"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done
if [[ -z "$AGENT_ID" ]]; then
echo "--agent is required" >&2
usage >&2
exit 1
fi
if [[ -z "$SESSIONS_FILE" ]]; then
SESSIONS_FILE="/home/node/.openclaw/agents/${AGENT_ID}/sessions/sessions.json"
fi
if [[ ! -f "$SESSIONS_FILE" ]]; then
echo "sessions file not found: $SESSIONS_FILE" >&2
exit 1
fi
python3 - <<PY
import json
from pathlib import Path
path = Path(${SESSIONS_FILE@Q})
channel = ${CHANNEL_ID@Q}
with path.open() as f:
data = json.load(f)
removed = 0
scanned = 0
for key, value in data.items():
if not isinstance(value, dict):
continue
scanned += 1
if channel:
if f"channel:{channel}" not in key:
continue
if "model" in value:
del value["model"]
removed += 1
with path.open("w") as f:
json.dump(data, f, indent=2)
f.write("\n")
print(f"scanned={scanned}")
print(f"removed_model_pins={removed}")
print(f"sessions_file={path}")
PY