@agimon-ai/po-notification

Desktop notifications and an animated shell-tab title for Po sessions.

Packages

Package details

extension

Install @agimon-ai/po-notification from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@agimon-ai/po-notification
Package
@agimon-ai/po-notification
Version
0.0.0-alpha.232
Published
Dec 6, 2026
Downloads
32.9K/mo · 7,122/wk
Author
agiflow-ai
License
MIT
Types
extension
Size
417.5 KB
Dependencies
4 dependencies · 1 peer

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@agimon-ai/po-notification

Native push delivery, notification text helpers, and shell-tab title utilities for Po sessions.

This package supplies the native push sender and /notify command. Hosts own routing through the shared po/notification service and live session entries.

What it does

Surface Behavior
Shell tab title π - <session or first prompt> - <repository>, with a braille spinner while the agent works
Notification API caller-authored notices through the shared po/notification Cordis service
Mid-run server-derived native push for each dialog during a run, parent sessions only
Attention native push for notices marked attention: true (a pending approval), every session including child sessions
At rest server-derived native push once a parent run has finished by po-autostop's test; requires host execution state, skipped for sandbox sessions

The package exports shell-title controllers and a system-notification helper (cmux notify, then osascript on macOS), but does not install a terminal router or shell-title lifecycle itself. The /notify command calls the active headless client's notification API, which appends a versioned po-notification session entry for live clients. Only entries marked attention: true also reach native push.

Service usage

Callers should discover the optional service through Cordis and request delivery without depending on a particular host:

import { PO_NOTIFICATION_SERVICE, readPoNotificationService } from '@agimon-ai/po-core/notification';

ctx.inject([PO_NOTIFICATION_SERVICE], (notificationContext) => {
  void readPoNotificationService(notificationContext)?.request({
    body: 'Deployment needs approval',
    level: 'warning',
  });
});

body is required. title, subtitle, level and attention are optional, and level accepts info, warning, or error. Entry normalization defaults title and subtitle to empty strings and level to info. Set attention: true only when the person must act (po-approval uses it for a new pending request): that notice is also pushed to paired devices. A host must provide the optional service. This package does not wrap Pi's ui.notify API.

Idle check

Enable notifications.idleCheck to let one model call tell finished work from a session waiting for you. The check runs only after the session has stayed idle for 3 minutes (180 seconds by default) with no new message, approval or question, and only when at least 10 conversation messages (tool results excluded) arrived since the last check. The usual "Po finished" notice is not delayed by the wait. To enable cards, also set notifications.idleCard; it is separate from the check. After background work stops, an attended top-level session with durable User Feedback can turn the agent's open questions into a card on Home and Activity. You still get one "Po needs your input" notice. If a card cannot be created, or the session is unattended or in autonomous Voice, only the notice is sent. Child sessions and Goal mode skip this check.

Answering the card sends your answer back to the agent. An unanswered card is withdrawn when the agent starts another turn, such as when you reply in chat. It expires after 24 hours; expiry is not approval.

In Help mode, the main agent can inspect and update these settings through the notificationSettings code-mode namespace (documented by codemode-how-to-notification-settings):

  • notificationSettings.read() returns the active host and workspace settings (including alerts, idleCheck, and idleCard).
  • notificationSettings.set({ scope, idleCheck?, idleCard?, alerts? }) updates one key per call on host or workspace scope (pass null to clear an override), requiring person approval.

Browser delivery

po-web shows full notification text only for entries received by a currently open page. Every connected page receives live notification entries for every attached session, not only the focused session. Permission is requested only from an explicit settings action.

Browser Web Push is not supported. Closed-app delivery uses the paired native iOS or Android app, with explicit notification permission and native push enrollment. The server subscribes to live hub events across all sessions, even with no client sockets connected. It pushes entries marked attention: true, and derives "Input needed" (Po needs your input) and "Run finished" (Po finished) notices without adding transcript entries. Other entries stay in-app. Push does not read history and has no durable outbox or replay. Enrollment is persisted on the trusted device record; revocation, token rotation and remote disable are rechecked before queued work is dispatched.

Native push server credentials

Configure the needed provider credentials in the server's launch environment, using absolute paths:

export PO_APNS_KEY_FILE="$HOME/.po-secrets/AuthKey.p8"
export PO_APNS_KEY_ID="ABCDEFGHIJ"
export PO_APNS_TEAM_ID="KLMNOPQRST"
export PO_FCM_SERVICE_ACCOUNT_FILE="$HOME/.po-secrets/firebase-service-account.json"

Restrict the directory to the server user (chmod 700) and credential files to owner read/write (chmod 600). Never commit, paste into logs, or distribute these files with the app. The server must inherit these variables. GUI or service launches may not read shell configuration; configure their launch environment explicitly. Restart the server after changing credentials or variables: files and key material are validated once at startup. Missing or invalid credentials disable only that provider, with a redacted diagnostic. No provider credentials are read from a session's environment.

For Apple, provision the company ai.po.app App ID with Push Notifications, sign the native app with the matching entitlement and provisioning profile, and create an APNs signing key in the Apple Developer team. The server topic is fixed to ai.po.app. The native build-only variable PO_NATIVE_APNS_ENVIRONMENT selects development or production to match the signed entitlement; it is not a server credential. A production APNs build also requires PO_NATIVE_IDENTITY_ISSUER to name the HTTPS issuer origin. Push delivery is not verified live. At runtime the native app reads the provisioning profile through expo-application, falling back to production for App Store/TestFlight installs without a profile, and registers its token with that environment for server routing. iOS push enrollment refuses a different application ID, including the previous ai.agimon.po development app. Rebuild and pair the company iOS app with its matching profile; old iOS installs are a separate app identity.

For Firebase, register Android package ai.agimon.po, enable the FCM HTTP v1 API, and grant a service account permission to send FCM messages. The server reads client_email, private_key, and project_id from its service-account JSON, not from a separate project environment variable. The native build-only PO_NATIVE_ANDROID_GOOGLE_SERVICES_FILE points to the matching Android google-services.json. This client configuration is not the server service-account private key. Rebuild and reinstall the app when changing native build configuration.

Provider rejections produce redacted Native push <provider>: <outcome> <status> <reason> notices; status and allowlisted APNs reason are included when available, never tokens, text, or keys.

Privacy: native push carries the full notification title, subtitle and body, subject to provider payload limits. Apple or Google and the device lock screen can receive that text, including sensitive agent output. This is not generic-copy-only delivery. Do not enable it for content you cannot share with those providers or display on the lock screen.

Delivery is bounded, best effort, and timeout-limited, not guaranteed. FCM uses TTL 0 and APNs uses expiration 0, so providers are asked not to retain notifications for offline delivery. This is an offline-retention ceiling, not a guarantee that every background or terminated app receives a notice. Excess pending work is dropped. Invalid endpoints are conditionally cleared without deleting a rotated token. Verify delivery on signed Apple/Firebase builds with configured credentials and paired devices; source tests alone do not establish real-device delivery.

Forgetting a paired host is local and works offline: the phone clears its keys and cached host data immediately. If remote revocation cannot finish, it retains only revoke-only metadata and retries later, not credentials for reconnecting. Revocation cannot recall notifications already submitted to Apple or Google.

The shell title

The title is animated from a worker thread, so a busy agent turn never stalls the spinner. The worker is unreferenced, so a pending frame cannot hold the process open. If worker threads are unavailable, or the worker fails or exits, the last command replays on the main thread.

Titles are only written to an attached terminal: rpc sessions and headless ones get none, so escape sequences never end up in machine-read output.

Quiet by design

  • Server-derived pushes are silent for child sessions. Attention notices (pending approvals) push from every session, because the work is blocked until the person answers.
  • Dialogs notify only during a run, once per dialog id. A new run resets deduplication.
  • A finished push waits for the same completion test po-autostop applies before closing a session: a 5 second cooldown after the run settles, then no holding background work (running commands, subagents, delegated tasks, codemode jobs), then the host reports idle with no pending follow-up messages. Holding work is rechecked every cooldown; running commands stop holding 5 minutes after they are first seen. A new run, removal or unsubscribe cancels the wait.
  • Missing execution-state readers or background-work state, including sandbox mirrors, skip completion pushes and log one redacted notice per session. Dialog pushes still work.

Installation

Po depends on this package and activates it as fixed host core, so a Po install already has it. It is not selectable from .po/presets.yaml.

The server loader uses /extensions/server, built from src/extensions. The root export contains reusable notification helpers and types. The session command delegates to the host client; this package has no Pi entry, notification wrapper, or automatically installed shell-title controller.

License

MIT. See LICENSE.