#!/bin/bash
SHARE_DIR="/vol1/1000/agents-share/tasks"
NOTIFY_FILE="/tmp/last_agent_notify.txt"
newest=$(find "$SHARE_DIR/done" -type f -name "*.md" -newer "$NOTIFY_FILE" 2>/dev/null | head -1)
if [ -n "$newest" ]; then
  echo "=== 任务完成通知 ==="
  basename "$newest"
fi
newest2=$(find "$SHARE_DIR/help" -type f -name "*.md" -newer "$NOTIFY_FILE" 2>/dev/null | head -1)
if [ -n "$newest2" ]; then
  echo "=== 帮助请求 ==="
  basename "$newest2"
fi
touch "$NOTIFY_FILE"
