#!/usr/bin/env python3 """Plugin exemple (issue #75) : notifie le démarrage / l'arrêt d'un agent. Contrat : l'événement JSON arrive sur stdin, la réponse JSON part sur stdout. Installation : copier notify.py + notify.yaml dans /plugins/ puis relancer am. Test : am plugins --test notify """ import json import sys def main() -> int: ev = json.load(sys.stdin) agent = ev.get("agent") or "inconnu" event = ev.get("event", "?") pid = ev.get("pid") detail = f" (pid {pid})" if pid else "" print(json.dumps({"ok": True, "message": f"{event} de {agent}{detail}"})) return 0 if __name__ == "__main__": sys.exit(main())