# Unified hook notifier - forwards all hook events to agent-ui server # Usage: powershell -NoProfile -File hooks/notify.ps1 [agent] # If agent is specified, passes ?agent= so the backend knows the source. # If omitted, the backend auto-detects from session_id/transcript_path. # Reads AGENT_UI_PTY_SESSION env var (injected by PTY spawn) to identify the terminal. param([string]$agent = "") $b = [Console]::In.ReadToEnd() $url = 'http://localhost:4101/api/claude-hook' $sep = '?' if ($agent) { $url += "${sep}agent=$agent"; $sep = '&' } $pty = $env:AGENT_UI_PTY_SESSION if ($pty) { $url += "${sep}pty_session=$pty" } try { Invoke-RestMethod -Uri $url -Method POST -Body $b -ContentType 'application/json' -TimeoutSec 3 | Out-Null } catch {}