Termux Notify
Termux-native notifications for OpenCode — 6 attention sounds (default/question/permission/error/done/subagent_done) via termux-notification + termux-media-player, with cross-instance deduplication.
4
近 30 天 +1
577
近 7 天 13
43.6
生态多维模型
27 天前
2026-09-07
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-termux-notify@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-termux-notify@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-termux-notifyOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Termux notification plugin for OpenCode on Android. Routes OpenCode attention events to termux-notification and termux-media-player via the OpenCode V2 plugin API (@opencode-ai/plugin/v2/promise).
Features
- 6 notification kinds (default, question, permission, error, done, subagent_done) with distinct vibration and audio via
termux-media-player - Cross-instance deduplication via shared JSON file and stable notification IDs
- Spam prevention via event TTL (60s), per-session cooldown (5s), and global throttle (1s)
- Session-aware titles resolved from OpenCode session metadata
- Fully configurable: binaries, vibration, priority, cooldowns, kinds, and subagent handling
Requirements
- Android + Termux with
termux-api(pkg install termux-apiand install Termux:API app - Node >= 20, Opencode V2(V2 plugin API)
Install
opencode plugin add opencode-termux-notify
Add to opencode.jsonc:
// ~/.config/opencode/opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
"plugins": ["opencode-termux-notify"]
}
Local path (this repo):
// opencode.jsonc
{
"plugins": ["/data/data/com.termux/files/home/opencode-termux-notify"]
}
Usage
With options:
// opencode.jsonc
{
"plugins": [{
"package": "opencode-termux-notify",
"options": {
"kinds": ["question", "permission", "error", "done", "subagent_done"],
"notifySubagents": true,
"priority": "high"
}
}]
}
Restart OpenCode after editing config:
opencode service restart
Grant notification permission on Android 13+ under Settings > Apps > Termux > Notifications. Verify with:
termux-notification --title test --content test --priority high --vibrate "400,200,400" --sound --id test
Configuration
| Option | Type | Default | Description |
|---|---|---|---|
bin |
string |
/data/data/com.termux/files/usr/bin/termux-notification |
Notification binary |
mediaBin |
string |
/data/data/com.termux/files/usr/bin/termux-media-player |
Audio player binary |
sharedPath |
string |
os.tmpdir()/termux-notify-shared.json |
Deduplication file |
seenTTL |
number |
60000 |
Event ID TTL (ms) |
sessionCooldown |
number |
5000 |
Per-session debounce (ms) |
globalCooldown |
number |
1000 |
Global throttle (ms) |
priority |
string |
per-kind | Notification priority |
sound |
boolean |
true |
Enable sound |
playSound |
boolean |
true |
Play bundled mp3 |
vibrate |
boolean |
true |
Enable vibration |
requireTermux |
boolean |
true |
Warn if not in Termux |
kinds |
string[] |
all kinds | Enabled event kinds |
notifySubagents |
boolean |
true |
Notify for subagents (false = sound only) |
title_<kind> / content_<kind> |
string |
per-kind | Title/content override |
Development
npm install
npm run typecheck
npm run build
License
同类生态推荐
2 Todo
opencode2-todo
Restore the V2-removed todowrite tool and a TUI sidebar list for OpenCode sessions
Nexus
@serkanalgur/opencode-nexus
Adaptive Multi-Agent Orchestration with Cost Intelligence for OpenCode V2
Ralph Rlm
opencode-ralph-rlm
OpenCode plugin: Ralph outer loop + RLM inner loop. Iterative AI development with file-first discipline and sub-agent support.