#!/usr/bin/env bash
# note-agent-event.sh  -  SubagentStop and PostToolUseFailure hook.
#
# Appends one compact row per subagent stop or failed tool call to the repo's
# session notes, after the secret scan. The logic is in note-agent-event.mjs;
# this wrapper exists because every hook the pipeline registers is a
# `bash "$HOME/.<host>/scripts/<name>"` command.
#
# Exits 0 on every path: bookkeeping never fails a session.

set -u

HERE="$(cd "$(dirname "$0")" 2>/dev/null && pwd || true)"
CORE="$HERE/note-agent-event.mjs"
[ -f "$CORE" ] || exit 0
command -v node >/dev/null 2>&1 || exit 0

node "$CORE" >/dev/null 2>&1 || true
exit 0
