{"_id":"@aslamplr/pi-ios-notify","_rev":"2-1031f37870a441fdc6ebe23410cd3cbb","name":"@aslamplr/pi-ios-notify","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@aslamplr/pi-ios-notify","version":"0.1.0","keywords":["pi-package","pi-extension","notifications","ios","bark"],"author":{"name":"aslamplr"},"license":"MIT","_id":"@aslamplr/pi-ios-notify@0.1.0","maintainers":[{"name":"aslamplr","email":"aslamplr@gmail.com"}],"homepage":"https://github.com/aslamplr/pi-ios-notify#readme","bugs":{"url":"https://github.com/aslamplr/pi-ios-notify/issues"},"pi":{"extensions":["./index.ts"]},"dist":{"shasum":"d50d135f22cb0dc27913ebb5c198da715c390848","tarball":"https://registry.npmjs.org/@aslamplr/pi-ios-notify/-/pi-ios-notify-0.1.0.tgz","fileCount":5,"integrity":"sha512-kbaHL59WJrpsNk+X5axjljWRIMULKUvuvN13ato10TdthTjtCppRp1wocl4N51UPiaqzp+0yRH2Q32bV/ZU+Jw==","signatures":[{"sig":"MEUCIE7FgCzpsmCrJrcVMMfWdvuXDL9WaOpgABKy1PAO/IuWAiEA6Aa2zfUnZ3uulZJTicflDjC+SfG6MyqgJle8vikRvOc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aslamplr%2fpi-ios-notify@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":29615},"main":"index.ts","type":"module","gitHead":"dc8176467c4d1e5294e72d3b232163e39ad22dbe","scripts":{"test":"vitest run","test:watch":"vitest"},"_npmUser":{"name":"aslamplr","email":"aslamplr@gmail.com"},"repository":{"url":"git+https://github.com/aslamplr/pi-ios-notify.git","type":"git"},"_npmVersion":"11.12.1","description":"Send iOS push notifications via Bark when pi completes agent turns","directories":{},"_nodeVersion":"24.15.0","_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0"},"peerDependencies":{"typebox":"*","@earendil-works/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-ios-notify_0.1.0_1779247497226_0.48462652963223585","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@aslamplr/pi-ios-notify","version":"0.1.1","description":"Send iOS push notifications via Bark when pi completes agent turns","keywords":["pi-package","pi-extension","notifications","ios","bark"],"license":"MIT","author":{"name":"aslamplr"},"type":"module","pi":{"extensions":["./index.ts"]},"main":"index.ts","repository":{"type":"git","url":"git+https://github.com/aslamplr/pi-ios-notify.git"},"scripts":{"test":"vitest run","test:watch":"vitest"},"peerDependencies":{"@earendil-works/pi-coding-agent":"*"},"devDependencies":{"vitest":"^3.0.0"},"gitHead":"7e8bd642289aed45aadce0b46326a1565d3503f8","_id":"@aslamplr/pi-ios-notify@0.1.1","bugs":{"url":"https://github.com/aslamplr/pi-ios-notify/issues"},"homepage":"https://github.com/aslamplr/pi-ios-notify#readme","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-6mpTDV3WmpwEcwcs9AiYidrxIqhRhweqMmnvPt0yzwnGMHDotxcwozZZyiux2u33JzbQ0lhPWVugbjq1xU/ybg==","shasum":"4a6d17d6d9e8bbef48fd88cf00e8882acc3f458e","tarball":"https://registry.npmjs.org/@aslamplr/pi-ios-notify/-/pi-ios-notify-0.1.1.tgz","fileCount":5,"unpackedSize":30707,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@aslamplr%2fpi-ios-notify@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA2OsZKUuutpCU2m3t75RnhK06oY6YsiO0liLpxI4qNHAiBJfFNPQjqD27iDCBxtnOmhhvEvw/YRTdM0QOX/6bmmgg=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:0e60293d-63a0-4a22-baad-bc4eda9be2f3"}},"directories":{},"maintainers":[{"name":"aslamplr","email":"aslamplr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-ios-notify_0.1.1_1781261035657_0.5550970154642785"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-20T03:24:57.026Z","modified":"2026-06-12T10:43:56.108Z","0.1.0":"2026-05-20T03:24:57.424Z","0.1.1":"2026-06-12T10:43:55.796Z"},"bugs":{"url":"https://github.com/aslamplr/pi-ios-notify/issues"},"author":{"name":"aslamplr"},"license":"MIT","homepage":"https://github.com/aslamplr/pi-ios-notify#readme","keywords":["pi-package","pi-extension","notifications","ios","bark"],"repository":{"type":"git","url":"git+https://github.com/aslamplr/pi-ios-notify.git"},"description":"Send iOS push notifications via Bark when pi completes agent turns","maintainers":[{"name":"aslamplr","email":"aslamplr@gmail.com"}],"readme":"# pi-ios-notify 📱\n\nSend iOS push notifications via [Bark](https://github.com/Finb/Bark) when pi completes agent turns. Get notified right on your iPhone when long-running tasks finish, errors occur, or after each individual turn — without watching the terminal.\n\n**Package:** `@aslamplr/pi-ios-notify`\n**Repository:** [github.com/aslamplr/pi-ios-notify](https://github.com/aslamplr/pi-ios-notify)\n\n[![CI](https://github.com/aslamplr/pi-ios-notify/actions/workflows/ci.yml/badge.svg)](https://github.com/aslamplr/pi-ios-notify/actions/workflows/ci.yml)\n\n## How it works\n\n```\npi (your Mac)\n  │\n  │ agent completes a turn → extension fires\n  │\n  ▼\npi-ios-notify extension\n  │\n  │ POST https://api.day.app/YOUR_KEY\n  │ { title: \"✅ pi Complete\", body: \"…\" }\n  │\n  ▼\nBark server → Apple Push Notification service → Your iPhone 📱\n```\n\n## Prerequisites\n\n1. **Bark iOS app** — [Free on the App Store](https://apps.apple.com/app/id1403753865)\n2. **A computer running pi** (macOS, Linux, or Windows)\n3. pi 0.50+ (uses native `fetch` and `ExtensionAPI`)\n\n## Installation\n\n### via npm\n\n```bash\npi install npm:@aslamplr/pi-ios-notify\n```\n\n### via git\n\n```bash\npi install git:github.com/aslamplr/pi-ios-notify\n```\n\n### Manual (local path)\n\n```bash\npi install /path/to/pi-ios-notify\n```\n\n### Quick test (no install)\n\n```bash\npi -e /path/to/pi-ios-notify\n```\n\n## Setup\n\n### 1. Get your Bark device key\n\n1. Install [Bark](https://apps.apple.com/app/id1403753865) on your iPhone\n2. Open the app — you'll see your device key URL, like:\n   ```\n   https://api.day.app/YOUR_DEVICE_KEY_HERE\n   ```\n3. Copy the `YOUR_DEVICE_KEY_HERE` part (the UUID string)\n\n### 2. Configure the extension\n\nInside pi, run:\n\n```\n/ios-notify setup\n```\n\nPaste your Bark device key when prompted.\n\n### 3. Test it\n\n```\n/ios-notify test\n```\n\nYou should receive a \"🔔 Test\" notification on your iPhone within a second or two.\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `/ios-notify setup` | Enter your Bark device key |\n| `/ios-notify test` | Send a test notification |\n| `/ios-notify status` | Show current configuration |\n| `/ios-notify events <type> <true\\|false>` | Enable/disable notification types (`agent-end`, `prompt-tools`, `turn-end`, `error`) |\n| `/ios-notify prompt-tools list` | List configured prompt tool names and labels |\n| `/ios-notify prompt-tools add <name> [label]` | Add a tool name to watch with optional label |\n| `/ios-notify prompt-tools remove <name>` | Remove a tool from the watch list |\n| `/ios-notify prompt-tools clear` | Remove all prompt tools |\n| `/ios-notify sound <name>` | Set notification sound |\n| `/ios-notify icon <url|pi|default>` | Set a custom notification icon |\n| `/ios-notify url <value>` | Set optional URL to open when notification is tapped (URL scheme, e.g. `ssh://user@host`) |\n| `/ios-notify debug <on\\|off>` | Enable/disable debug logging |\n| `/ios-notify hostname <true\\|false>` | Append hostname to notifications |\n\n### Notification events\n\n| Event | Default | Description |\n|-------|---------|-------------|\n| `agent-end` | ✅ on | Notify when agent finishes a response |\n| `prompt-tools` | ✅ on | Notify mid-turn when a configured tool calls for user input |\n| `turn-end` | ❌ off | Notify after each individual LLM turn (can be noisy!) |\n| `error` | ✅ on | Notify when a tool execution fails |\n\nToggle with:\n\n```\n/ios-notify events agent-end false\n/ios-notify events prompt-tools false\n/ios-notify events turn-end true\n/ios-notify events error false\n```\n\n### Prompt tools\n\nPrompt tools are tools registered by extensions that may ask for user input mid-turn (e.g. `ask_user` from pi-ask-user, `safe_shell_approve` from pi-safe-shell). When the LLM calls one of these tools, you get notified immediately.\n\nConfigure which tools to watch:\n\n```\n/ios-notify prompt-tools list\n/ios-notify prompt-tools add my_custom_tool \"My Label\"\n/ios-notify prompt-tools remove ask_user\n```\n\nThe label is shown as the notification title suffix. Default configured tools:\n\n| Tool | Label | Source |\n|------|-------|--------|\n| `ask_user` | Asking | pi-ask-user extension |\n| `ask-user` | Asking | pi-ask-user extension |\n| `safe_shell_approve` | Permission | pi-safe-shell extension |\n\n### Cross-extension notifications\n\nAny extension can send a push notification by emitting an event on pi's [shared event bus](https://pi.dev/docs/latest/extensions#pi-events):\n\n```typescript\npi.events.emit(\"pi-ios-notify:notify\", {\n  title: \"🔒 Approval needed\",\n  body: \"bash: rm -rf node_modules\",\n  source: \"safe-shell\", // optional\n});\n```\n\npi-ios-notify listens for `pi-ios-notify:notify` and forwards the `title` and `body` to Bark. The emitter controls the notification content entirely. Requires the `prompt-tools` event toggle to be enabled.\n\nSee the companion extension [@aslamplr/pi-safe-shell](https://github.com/aslamplr/pi-safe-shell) for a usage example — it emits `pi-ios-notify:notify` before blocking on user approval prompts.\n\n### Custom icon\n\n```\n/ios-notify icon https://example.com/my-icon.png\n```\n\nUse `default` to reset to Bark's default icon, or `pi` to use the pi logo:\n\n```\n/ios-notify icon pi\n/ios-notify icon default\n```\n\n### Notification URL\n\nSet a URL that opens when the notification is tapped. Supports any URL scheme:\n\n```\n/ios-notify url ssh://user@myserver          # opens Termius/Blink (SSH)\n/ios-notify url https://my-dashboard.com      # opens Safari\n/ios-notify url pi://settings                 # custom scheme\n/ios-notify url \"\"                            # clear (no-op on tap)\n```\n\n### Debug mode\n\nEnable debug logging to see why notifications are or aren't firing:\n\n```\n/ios-notify debug on\n```\n\nDebug output appears as informative notifications in pi's UI, each prefixed with 🔍. Each event handler logs its name, relevant config state, and throttle flags:\n\n```\n🔍 tool_call name=ask_user inPromptTools=true promptTools=true throttled=false\n🔍 send title=\"pi Asking\" body=\"ask_user\"\n🔍 agent_end agentEnd=true\n🔍 send title=\"pi ✅ Complete\" body=\"...\"\n```\n\nTurn off with:\n\n```\n/ios-notify debug off\n```\n\n### Notification sounds\n\nBark supports various iOS notification sounds. Change with:\n\n```\n/ios-notify sound birdsong\n```\n\nCommon sounds: `default`, `minuet`, `alarm`, `anticipate`, `birdsong`, `bloom`, `calypso`, `chime`, `descant`, `electronic`, `fanfare`, `horn`, `ladder`, `mazurka`, `nightingale`, `piano`, `rocket`, `sirius`, `strums`, `suspense`, `telegraph`, `tiptoes`, `tritone`, `tuberose`, `twinkle`.\n\n## Configuration file\n\nThe extension stores its config at `~/.pi/ios-notify.json`. You can edit it directly:\n\n```json\n{\n  \"barkKey\": \"YOUR_DEVICE_KEY\",\n  \"barkServer\": \"https://api.day.app\",\n  \"events\": {\n    \"agentEnd\": true,\n    \"promptTools\": true,\n    \"turnEnd\": false,\n    \"error\": true\n  },\n  \"promptTools\": {\n    \"ask_user\": \"Asking\",\n    \"ask-user\": \"Asking\",\n    \"safe_shell_approve\": \"Permission\"\n  },\n  \"sound\": \"default\",\n  \"title\": \"pi\",\n  \"icon\": \"\",\n  \"showHostname\": false,\n  \"url\": \"\"\n}\n```\n\nAdd more tools directly in the config:\n\n```json\n{\n  \"promptTools\": {\n    \"ask_user\": \"Asking\",\n    \"safe_shell_approve\": \"Permission\",\n    \"my_custom_tool\": \"Waiting\"\n  }\n}\n```\n\n### Custom Bark server\n\nIf you self-host Bark, set the server:\n\n```json\n{\n  \"barkServer\": \"https://bark.yourdomain.com\",\n  \"barkKey\": \"YOUR_KEY\"\n}\n```\n\n## What notifications look like\n\n| Event | Notification |\n|-------|-------------|\n| Agent completes response | ✅ **pi Complete** — `\"refactor the auth module to use JWT\" (3 turns)` |\n| Prompt tool called mid-turn | 💬 **pi Asking** — `ask_user` |\n| Prompt tool called mid-turn | 💬 **pi Permission** — `safe_shell_approve` |\n| Cross-extension event emit | 💬 **pi {emitter's title}** — `{emitter's body}` |\n| Each turn | 🔄 **pi Turn** — `Turn 3 finished` |\n| Tool error | ⚠️ **pi Error** — `Error in bash: command not found: foobar` (includes error detail) |\n\n## Privacy\n\n- Only the Bark device key and notification content are sent to the Bark server\n- Your code or conversation content is never transmitted — only the prompt summary you see\n- Bark stores notification content encrypted on their server\n- You can optionally set up [end-to-end encryption](https://github.com/Finb/Bark#encryption) in the Bark app\n\n## Project structure\n\n```\npi-ios-notify/\n├── index.ts        # Extension entry point (no compilation needed)\n├── utils.ts        # Pure utility functions\n├── utils.test.ts   # Vitest test suite for utilities\n├── defaults.json   # Default icons/images\n├── package.json    # Package manifest with pi.extensions entry\n└── README.md       # This file\n```\n\nStandard npm package layout — the `pi.extensions` field in `package.json` tells pi where to find entry points.\n\n## Development\n\n```bash\ngit clone <repo-url>\ncd pi-ios-notify\n# No npm install needed (pure TypeScript / Node built-ins only)\n```\n\nLoad for testing:\n\n```bash\npi -e /path/to/pi-ios-notify\n```\n\nReload changes:\n\n```\n/reload\n```\n\n## Tests\n\n```bash\nnpm test\n```\n\nRuns [vitest](https://vitest.dev/) on the extracted utility functions (`utils.test.ts`):\n\n- `formatPrompt` — truncation, edge cases\n- `pluralize` — singular, plural, auto-pluralize\n- `onOff` — boolean to on/off\n- `parseBool` — all truthy/falsy strings, edge cases\n\n## ⚖️ No Warranty\n\n**THIS SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND.** The authors make no representations that this extension will deliver notifications reliably or in a timely manner. You are responsible for testing notification delivery and configuring appropriate settings.\n\n---\n\n## License\n\nMIT\n\n## Credits\n\n- [Bark](https://github.com/Finb/Bark) — the wonderful free iOS push notification app\n- Inspired by [doublezz10/opencode_ios_notifications](https://github.com/doublezz10/opencode_ios_notifications), [Stephanvs/opencode-ntfy](https://github.com/Stephanvs/opencode-ntfy), and [blanboom/bark-notification-for-claude-codex-opencode](https://github.com/blanboom/bark-notification-for-claude-codex-opencode)\n","readmeFilename":"README.md"}