# @omardev_11/pi-stop-notify

Notifies you when the [`pi`](https://pi.dev) agent stops — whether it finished a task or is awaiting your input.

Emits three things on `agent_end`:

- **Native macOS notification** via `osascript` (Notification Center banner — on by default)
- **macOS sound** via `afplay` (default: `Glass.aiff`)
- **Terminal OSC notification** (OSC 777 / OSC 99 / Windows toast — same protocol pi's built-in `notify.ts` example uses)

The notification title is prefixed with the **basename of the session's working directory** (e.g. running in `~/Developer/MyApp` produces *"MyApp finished"* or *"MyApp has a question"*). Override with `PI_STOP_NOTIFY_NAME`.

Heuristic: if the agent's last message ends with `?`, the title becomes **"<name> has a question"**, otherwise **"<name> finished"**.

## Install

```bash
pi install npm:@omardev_11/pi-stop-notify
```

For local development:

```bash
pi install file:/Users/omarmaceaospina/Developer/pi-packages/pi-stop-notify
```

## Configuration

All optional, via env vars:

| Variable | Default | Description |
| --- | --- | --- |
| `PI_STOP_NOTIFY_SOUND` | `/System/Library/Sounds/Glass.aiff` | Path to sound file. Set to `off` to disable. |
| `PI_STOP_NOTIFY_NATIVE` | on | Set to `0` to disable the native macOS notification popup. |
| `PI_STOP_NOTIFY_OSC` | unset | Set to `off` to disable terminal OSC notifications. |
| `PI_STOP_NOTIFY_NAME` | basename of cwd | Explicit name prefix for the notification title. |

## License

MIT
