diff options
| author | haoyuren <13851610112@163.com> | 2026-03-29 16:36:23 -0500 |
|---|---|---|
| committer | haoyuren <13851610112@163.com> | 2026-03-29 16:36:23 -0500 |
| commit | 8a7d80d995ebd88cb9d7ab0d86a068dd0d732926 (patch) | |
| tree | f7eea37bb4ad377f5f38da89db292f1bed35d28f | |
| parent | 42f390b677f38cfd0fc30bb8d1a3278b5a072db4 (diff) | |
| -rwxr-xr-x | poll_and_notify.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/poll_and_notify.sh b/poll_and_notify.sh index 7849b58..b32a273 100755 --- a/poll_and_notify.sh +++ b/poll_and_notify.sh @@ -16,6 +16,11 @@ while IFS=$'\t' read -r SESSION PROJECT_DIR; do [ -z "$SESSION" ] && continue tmux has-session -t "$SESSION" 2>/dev/null || continue + # 发心跳(每次 poll 都发,不依赖 Claude 活跃) + curl -sf -X POST -H "Authorization: Bearer $API_SECRET" -H "Content-Type: application/json" \ + -d "{\"session\": \"$SESSION\", \"host\": \"$(hostname)\"}" \ + "$BROKER_URL/heartbeat" >/dev/null 2>&1 || true + COUNT=$(curl -sf -H "Authorization: Bearer $API_SECRET" \ "$BROKER_URL/tasks/pending?target=$SESSION" 2>/dev/null \ | python3 -c "import sys,json; print(len(json.load(sys.stdin).get('tasks',[])))" 2>/dev/null \ |
