pi-anotify0.1.0
pi extension: push notifications to all your devices (iOS/Mac/PC/Android) when your agent finishes tasks, via Anotify.
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-anotify
pi 扩展:Agent 任务完成/失败时,自动推送通知到你的所有设备(iOS / Mac / PC / Android)。
后端是 Anotify——「Agent 完成即通知」平台。本包只做发送端:任务事件 → POST /v1/notify,不感知接收端。
安装
pi install npm:pi-anotify
配置(一次性)
授权本机上报凭证(默认接入官方服务 https://anotify.openaaas.org,自部署可传自己的地址):
# 找到包内 common/login.sh(首次安装后)
sh ~/.pi/agent/npm/pi-anotify/common/login.sh
# 自部署:sh .../login.sh https://你的anotify域名
浏览器扫码批准后,凭证写入 ~/.config/anotify/credentials.json(0600),完成。
事件 → 通知
| pi 事件 | 通知时机 |
|---|---|
message_end(用户发完消息) |
开始干活(默认关) |
agent_settled |
任务完成(标题=最后一条 assistant 文本摘要) |
tool_execution_end(失败) |
失败上报(30s 节流防刷屏) |
pi settings.json 配置(可选,anotify.* 命名空间)
| 配置 | 默认 | 说明 |
|---|---|---|
notifyOnStart |
false | 每轮开始发 working 通知 |
notifyOnEnd |
true | agent_settled 发完成通知 |
notifyOnError |
true | 工具失败发 error 通知 |
notifyOnSubagent |
false | 子 agent 完成也通知 |
errorCooldownMs |
30000 | 失败上报节流(ms) |
deviceTags |
"" | 路由标签(逗号分隔) |
环境变量兜底:ANOTIFY_NOTIFY_ON_START / ANOTIFY_SCRIPT_PATH / ANOTIFY_DEVICE_TAGS 等。
上报实现
上报走包内 common/notify.sh(POSIX sh + curl,零依赖)。安全约束:正文与 API Key 不进 argv(正文可达几十 KB 会撞 OS 参数上限,且 ps 可见);正文走 stdin,Key 走 0600 的 curl 配置文件。失败提示单行截断,不泄露正文。
License
MIT