@jack-yang/opencode-bark-notifyFocus-aware Bark push notifications for OpenCode — get detailed agent messages on your phone when you step away
0
418
近 7 天 6
35.3
生态多维模型
21 天前
2026-07-29
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@jack-yang/opencode-bark-notify@1.0.2"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@jack-yang/opencode-bark-notify@1.0.2"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @jack-yang/opencode-bark-notifyopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Focus-aware Bark push notifications for OpenCode.
Get detailed agent messages on your iPhone when you step away from your computer. When you're at the terminal, notifications are suppressed — no spam.
Features
- Focus-aware — Suppresses notifications when your terminal is the frontmost app
- Detailed content — Sends the agent's actual last message, not just "task completed"
- Category badges — iOS subtitle shows what happened: ✅ Responded / 🔐 Wait for Permission / ❓ Input Needed
- Session-aware — Includes the session title in every notification
- Zero dependencies — Pure TypeScript, runs on Bun
Prerequisites
- Bark app installed on iOS
- Your Bark device key (found in the Bark app homepage, e.g.
BrHXXCACzphzrB63kNJMFF)
Install
Option 1: With config (recommended)
Add to your ~/.config/opencode/opencode.json:
{
"plugin": [
["@jack-yang/opencode-bark-notify", {
"barkKey": "YOUR_BARK_DEVICE_KEY"
}]
]
}
Option 2: With env var
Add to your ~/.zshrc:
export BARK_KEY="YOUR_BARK_DEVICE_KEY"
Then in opencode.json:
{
"plugin": ["@jack-yang/opencode-bark-notify"]
}
Restart OpenCode.
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
barkKey |
string | (env: BARK_KEY) |
Bark device key (required) |
barkUrl |
string | https://api.day.app |
Bark server URL (for self-hosted) |
level |
string | timeSensitive |
iOS notification level |
group |
string | opencode |
iOS notification group |
terminals |
string[] | ["Ghostty", "Terminal", "iTerm2", ...] |
Terminal app names for focus detection |
Example with all options
{
"plugin": [
["@jack-yang/opencode-bark-notify", {
"barkKey": "YOUR_KEY",
"barkUrl": "https://your-bark-server.com",
"level": "active",
"group": "my-agent",
"terminals": ["Ghostty", "WezTerm"]
}]
]
}
How focus detection works
On macOS, the plugin uses osascript to check if a terminal app is the frontmost application. If it is, notifications are suppressed — you're already looking at the terminal. If you've switched to another app or stepped away, notifications fire.
On non-macOS, focus detection is disabled (notifications always fire).
Notification types
| Event | Badge | Body |
|---|---|---|
| Session complete | ✅ Responded | Agent's last message (up to 500 chars) |
| Permission request | 🔐 Wait for Permission | Permission type + patterns |
| Question | ❓ Input Needed | The question text |
Pairing with desktop notifications
This plugin complements @mohak34/opencode-notifier (desktop notifications). Use both together:
- Desktop (osascript/sound/bell) → when at computer but in another app
- Bark (iPhone push) → when away from computer entirely
Both independently check focus, so there's no conflict.
License
MIT