<?xml version="1.0" encoding="UTF-8"?>
<!-- Agent Inbox Listener LaunchAgent (template) — the real-time IMAP IDLE daemon.
     Replace __LISTENER_SH__ with the absolute path to agent-listener.sh in your checkout
     (e.g. /Users/<you>/<vault>/Agent/scripts/daily-digest/agent-listener.sh), then:
       sed "s#__LISTENER_SH__#$ABS_PATH#" com.alexandria.agent-listener.plist > \
         ~/Library/LaunchAgents/com.alexandria.agent-listener.plist
       launchctl load ~/Library/LaunchAgents/com.alexandria.agent-listener.plist
     Only useful with an inbox module installed (principal-inbox / team-digests /
     federation) and INBOX_LISTENER_ENABLE=1 in the env; otherwise the daemon exits
     cleanly and the hourly sweep poll is the backstop. -->
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
  <key>Label</key><string>com.alexandria.agent-listener</string>
  <key>ProgramArguments</key><array><string>/bin/sh</string><string>__LISTENER_SH__</string></array>
  <key>RunAtLoad</key><true/>
  <!-- Restart on crash/kill/reboot, but NOT on a clean exit (disabled / imapclient missing),
       so a config-off state doesn't respawn-loop. ThrottleInterval floors respawns at 30s. -->
  <key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>
  <key>ThrottleInterval</key><integer>30</integer>
  <key>StandardOutPath</key><string>__LOGDIR__/agent-listener.log</string>
  <key>StandardErrorPath</key><string>__LOGDIR__/agent-listener.log</string>
</dict></plist>
