@xwss/agentbell 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +969 -0
- package/RELEASE.md +31 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +106 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/doctor.d.ts +4 -0
- package/dist/commands/doctor.js +159 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.js +92 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/initHooks.d.ts +9 -0
- package/dist/commands/initHooks.js +455 -0
- package/dist/commands/initHooks.js.map +1 -0
- package/dist/commands/project.d.ts +14 -0
- package/dist/commands/project.js +62 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/send.d.ts +5 -0
- package/dist/commands/send.js +70 -0
- package/dist/commands/send.js.map +1 -0
- package/dist/commands/setup.d.ts +13 -0
- package/dist/commands/setup.js +270 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/test.d.ts +9 -0
- package/dist/commands/test.js +40 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/verify.d.ts +78 -0
- package/dist/commands/verify.js +725 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/config.d.ts +123 -0
- package/dist/config.js +72 -0
- package/dist/config.js.map +1 -0
- package/dist/hooks/claudeCode.d.ts +5 -0
- package/dist/hooks/claudeCode.js +88 -0
- package/dist/hooks/claudeCode.js.map +1 -0
- package/dist/hooks/codex.d.ts +4 -0
- package/dist/hooks/codex.js +74 -0
- package/dist/hooks/codex.js.map +1 -0
- package/dist/hooks/vscodeAgent.d.ts +3 -0
- package/dist/hooks/vscodeAgent.js +45 -0
- package/dist/hooks/vscodeAgent.js.map +1 -0
- package/dist/notify/index.d.ts +3 -0
- package/dist/notify/index.js +8 -0
- package/dist/notify/index.js.map +1 -0
- package/dist/notify/local.d.ts +2 -0
- package/dist/notify/local.js +34 -0
- package/dist/notify/local.js.map +1 -0
- package/dist/notify/ntfy.d.ts +10 -0
- package/dist/notify/ntfy.js +57 -0
- package/dist/notify/ntfy.js.map +1 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/context.d.ts +92 -0
- package/dist/utils/context.js +198 -0
- package/dist/utils/context.js.map +1 -0
- package/dist/utils/logger.d.ts +5 -0
- package/dist/utils/logger.js +12 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/mask.d.ts +1 -0
- package/dist/utils/mask.js +10 -0
- package/dist/utils/mask.js.map +1 -0
- package/dist/utils/paths.d.ts +16 -0
- package/dist/utils/paths.js +93 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.js +21 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/topic.d.ts +2 -0
- package/dist/utils/topic.js +20 -0
- package/dist/utils/topic.js.map +1 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,969 @@
|
|
|
1
|
+
# AgentBell
|
|
2
|
+
|
|
3
|
+
AgentBell: get notified when your AI coding agent finishes.
|
|
4
|
+
|
|
5
|
+
AgentBell 閺勵垯绔存稉顏囨硶楠炲啿褰?CLI 瀹搞儱鍙块敍宀€鏁ゆ禍搴℃躬 Claude Code閵嗕竼odex閵嗕箓S Code Copilot Agent 缁?AI coding agent 鐎瑰本鍨氭禒璇插閵嗕礁浠犲銏g箥鐞涘被鈧胶鐡戝鍛扮翻閸忋儲鍨ㄩ棁鈧憰浣规綀闂勬劖妞傞敍宀冨殰閸斻劌鎮滈幍瀣簚閸欐垿鈧焦褰侀柋鎺嬧偓?
|
|
6
|
+
缁楊兛绔撮悧鍫滅喘閸忓牊鏁幐?ntfy閵嗗倸褰傞柅浣侯伂閸欘亪娓剁憰浣藉厴鐠佸潡妫舵径鏍秹楠炶泛褰傞崙?HTTP 鐠囬攱鐪伴敍宀勨偓鍌氭値閺堫剙婀撮悽浣冨壋閵嗕浇绻欑粙?SSH閵嗕箘SL閵嗕笍ev Container閵嗕浇绻欓幒褏鏁搁懘鎴犵搼閸︾儤娅欓妴?
|
|
7
|
+
## Why Not Bluetooth
|
|
8
|
+
|
|
9
|
+
AgentBell 娑撳秴浠涢拑婵堝閻╃绻涢幍瀣箚閵嗗倽鎽戦悧娆戞纯鏉╃偤娓剁憰浣割槱閻炲棝鍘ょ€靛箍鈧胶閮寸紒鐔告綀闂勬劑鈧礁宸堕崯鍡楀礂鐠侇喓鈧礁鎮楅崣棰佺箽濞茶鎷扮捄銊ラ挬閸欐澘妯婂鍌︾礉閸欘垶娼幀褍绶㈤梾鍙ョ箽鐠囦降鈧?
|
|
10
|
+
閹恒劏宕橀柧鎹愮熅閺勵垽绱?
|
|
11
|
+
1. AI coding hook 閸︺劌鐤勯梽鍛扮箥鐞?agent 閻ㄥ嫭婧€閸c劋绗傞幍褑顢戦妴?2. AgentBell 闁俺绻?HTTP 閹跺﹪鈧氨鐓¢崣鎴濆煂 ntfy閵?3. 鐎瑰宕滈幍瀣簚閺€璺哄煂 ntfy 闁氨鐓¢妴?4. 缁崵绮洪崪灞惧閻?App 鐠愮喕鐭楅幎濠団偓姘辩叀鏉烆剙褰傞崚鐗堝閻滎垬鈧?
|
|
12
|
+
鏉╂瑦鐗辨潻婊呪柤閺堝搫娅掗崣顏囶洣閸欘垯浜掔拋鍧楁6 ntfy server閿涘苯姘ㄩ懗鑺ュ絹闁辨帊缍橀惃鍕閺堟亽鈧?
|
|
13
|
+
## Android Setup
|
|
14
|
+
|
|
15
|
+
1. 鐎瑰顥?ntfy Android閵?2. 鐠併垽妲勬稉鈧稉顏堟閺堟亽鈧椒绗夐崣顖滃閻?topic閵?3. 閸忎浇顔?ntfy 閻ㄥ嫰鈧氨鐓¢弶鍐閵?4. 閸忔娊妫?ntfy 閻ㄥ嫮鏁稿Ч鐘辩喘閸栨牠妾洪崚韬测偓?5. 閸︺劍澧滈悳?App 娑擃厼鍘戠拋姝屾祮閸?ntfy 閻ㄥ嫰鈧氨鐓¢妴?
|
|
16
|
+
婵″倹鐏夋担璺ㄦ暏 `https://ntfy.sh` 閸忣剙鍙¢張宥呭閿涘矁顕幎?topic 瑜版挷缍?bearer secret閵嗗倻鐓¢柆?topic 閻ㄥ嫪姹夐柅姘埗鐏忚精鍏橀崥鎴n嚉 topic 閸欐垶绉烽幁顖涘灗鐠併垽妲勫☉鍫熶紖閿涘本澧嶆禒銉ょ瑝鐟曚椒濞囬悽銊ヮ潣閸氬秲鈧線銆嶉惄顔兼倳閵嗕線鍋栫粻渚库偓浣稿彆閸欑鎮曟潻娆戣閸欘垳瀵?topic閵?
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install AgentBell from npm:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g @xwss/agentbell
|
|
23
|
+
agentbell setup
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Although the npm package is scoped as `@xwss/agentbell`, the installed CLI command is still `agentbell`.
|
|
27
|
+
|
|
28
|
+
For beta builds:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -g @xwss/agentbell@beta
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
AgentBell requires Node.js 20 or newer.
|
|
35
|
+
|
|
36
|
+
## Development Install
|
|
37
|
+
|
|
38
|
+
For local development:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone <your-agentbell-repo-url>
|
|
42
|
+
cd AgentBell
|
|
43
|
+
npm install
|
|
44
|
+
npm run build
|
|
45
|
+
node dist/cli.js setup
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Local Package Test
|
|
49
|
+
|
|
50
|
+
Before publishing, test the npm package locally:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm run build
|
|
54
|
+
npm pack
|
|
55
|
+
npm install -g ./xwss-agentbell-0.1.0.tgz
|
|
56
|
+
agentbell --help
|
|
57
|
+
agentbell setup --dry-run --yes --targets none --no-test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Uninstall
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm uninstall -g @xwss/agentbell
|
|
64
|
+
```
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm install -g @xwss/agentbell
|
|
69
|
+
agentbell setup
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
閺堫剙婀村鈧崣鎴g箥鐞涘矉绱?
|
|
73
|
+
```bash
|
|
74
|
+
npm install
|
|
75
|
+
npm run build
|
|
76
|
+
npm test
|
|
77
|
+
npm run dev -- test
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Setup Wizard
|
|
81
|
+
|
|
82
|
+
`agentbell setup` is the recommended first command on a new machine. It is a guided setup flow that:
|
|
83
|
+
|
|
84
|
+
- generates a random ntfy topic
|
|
85
|
+
- writes `~/.agentbell/config.json`
|
|
86
|
+
- asks for a machine display name
|
|
87
|
+
- guides Android ntfy subscription
|
|
88
|
+
- sends a setup test notification
|
|
89
|
+
- installs selected AI coding hooks
|
|
90
|
+
|
|
91
|
+
Examples:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
agentbell setup
|
|
95
|
+
agentbell setup --yes --targets none --no-test
|
|
96
|
+
agentbell setup --targets codex,claude-code
|
|
97
|
+
agentbell setup --dry-run
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Useful options:
|
|
101
|
+
|
|
102
|
+
- `--config <path>` writes a specific config file.
|
|
103
|
+
- `--topic <topic>` uses a specific ntfy topic.
|
|
104
|
+
- `--machine-name <name>` sets the display name used in notifications.
|
|
105
|
+
- `--server <url>` sets the ntfy server.
|
|
106
|
+
- `--targets <targets>` accepts `all`, `none`, or comma-separated `codex,claude-code,vscode-agent`.
|
|
107
|
+
- `--yes` uses defaults for prompts.
|
|
108
|
+
- `--no-test` skips the phone test notification.
|
|
109
|
+
- `--dry-run` previews setup without writing files, sending notifications, or installing hooks.
|
|
110
|
+
|
|
111
|
+
## Topic and Machine Name
|
|
112
|
+
|
|
113
|
+
The ntfy topic is a secret transport address, not a display name. Anyone who knows the topic can usually publish to it, so use a long random topic and do not commit it to a public repository.
|
|
114
|
+
|
|
115
|
+
The machine display name is safe human context for notifications, for example `宸ヤ綔绔?鍙穈, `MacBook Pro`, or `GPU-Server-01`.
|
|
116
|
+
|
|
117
|
+
A good default model is one user-owned random topic shared across your machines, with each machine using a different display name. Example notification:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
宸ヤ綔绔?鍙?路 Codex task finished
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Manual Setup
|
|
124
|
+
|
|
125
|
+
Advanced users can still use the lower-level commands directly:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
agentbell init
|
|
129
|
+
agentbell test
|
|
130
|
+
agentbell init-hooks --target codex
|
|
131
|
+
agentbell init-hooks --target claude-code
|
|
132
|
+
agentbell init-hooks --target vscode-agent
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Use manual setup when you want to provide your own topic, skip the guided Android flow, or install hooks one tool at a time.
|
|
136
|
+
## Commands
|
|
137
|
+
|
|
138
|
+
### `agentbell send`
|
|
139
|
+
|
|
140
|
+
閻劋绨悮?hook 鐠嬪啰鏁ら敍灞藉絺闁椒绔村▎锟犫偓姘辩叀閵?
|
|
141
|
+
```bash
|
|
142
|
+
agentbell send --tool codex --event stop --title "Codex 鐎瑰本鍨氭禍? --message "鏉╂粎鈻奸張鍝勬珤娑撳﹦娈?Codex 瀹歌尙绮ㄩ弶鐔告拱鏉烆喕鎹㈤崝?
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
鐢摜鏁ら崣鍌涙殶閿?
|
|
146
|
+
- `--tool`: `claude-code`閵嗕梗codex`閵嗕梗vscode-agent`閵嗕梗custom`
|
|
147
|
+
- `--event`: `stop`閵嗕梗notification`閵嗕梗error`閵嗕梗permission`閵嗕梗custom`
|
|
148
|
+
- `--title`: 闁氨鐓¢弽鍥暯閿涘苯褰查柅?- `--message`: 闁氨鐓¢崘鍛啇閿涘苯褰查柅?- `--priority`: ntfy priority閿涘苯褰查柅?- `--tags`: ntfy tags閿涘矂鈧褰块崚鍡涙閿涘苯褰查柅?- `--config`: 閹稿洤鐣鹃柊宥囩枂閺傚洣娆㈢捄顖氱窞閿涘苯褰查柅?
|
|
149
|
+
婵″倹鐏夋稉宥勭炊 `title` 閹?`message`閿涘瓑gentBell 娴兼俺鍤滈崝銊ф晸閹存劙绮拋銈呭敶鐎圭櫢绱濋獮鑸电壌閹诡噣鍘ょ純顔煎瘶閸?`tool`閵嗕梗event`閵嗕梗hostname`閵嗕梗cwd`閵嗕梗timestamp`閵?
|
|
150
|
+
### `agentbell test`
|
|
151
|
+
|
|
152
|
+
閸欐垿鈧焦绁寸拠鏇⑩偓姘辩叀閿?
|
|
153
|
+
```bash
|
|
154
|
+
agentbell test
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
閺嶅洭顣介敍姝欰gentBell 濞村鐦痐
|
|
158
|
+
|
|
159
|
+
閸愬懎顔愰敍姝氭俊鍌涚亯娴g姷婀呴崚棰佺啊鏉╂瑦娼柅姘辩叀閿涘矁顕╅弰?AgentBell 瀹歌尙绮¢柊宥囩枂閹存劕濮涢妴淇?
|
|
160
|
+
### `agentbell verify`
|
|
161
|
+
|
|
162
|
+
Checks whether AgentBell is still installed correctly: config, provider settings, hook files, wrapper files, recent wrapper logs, stale paths, and optional manual notification / wrapper execution.
|
|
163
|
+
|
|
164
|
+
Common uses:
|
|
165
|
+
|
|
166
|
+
- A task finished but no phone notification arrived.
|
|
167
|
+
- You moved the project directory.
|
|
168
|
+
- You renamed or moved the project and suspect stale old-project paths.
|
|
169
|
+
- You deleted or regenerated wrapper files.
|
|
170
|
+
- You reinstalled Node.js.
|
|
171
|
+
- You updated Codex, Claude Code, or VS Code.
|
|
172
|
+
- Hooks were trusted but still do not send notifications.
|
|
173
|
+
|
|
174
|
+
Examples:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
agentbell verify
|
|
178
|
+
agentbell verify --target codex
|
|
179
|
+
agentbell verify --target vscode-agent --run-wrapper
|
|
180
|
+
agentbell verify --send-test
|
|
181
|
+
agentbell verify --json > agentbell-verify.json
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Options:
|
|
185
|
+
|
|
186
|
+
- `--target <target>` checks `codex`, `claude-code`, `vscode-agent`, or `all`.
|
|
187
|
+
- `--send-test` sends an `AgentBell verify test` phone notification.
|
|
188
|
+
- `--run-wrapper` manually runs the selected wrapper command to verify it can call AgentBell.
|
|
189
|
+
- `--dry-run` only inspects files and config; it does not send notifications or run wrappers.
|
|
190
|
+
- `--json` prints a structured report with masked topic values.
|
|
191
|
+
Log parsing note:
|
|
192
|
+
|
|
193
|
+
`verify` evaluates the latest hook run block, not every historical line in the log. Old failures are ignored once a newer successful wrapper run is recorded.
|
|
194
|
+
|
|
195
|
+
中文说明:`verify` 只根据最近一次 hook/wrapper 运行判断当前状态。历史日志里的旧项目路径 / `MODULE_NOT_FOUND` 不会在最新运行成功后继续导致 `error`。
|
|
196
|
+
If verify reports stale old-project paths or a missing `dist/cli.js`, refresh hooks with:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
node dist\cli.js init-hooks --target all
|
|
200
|
+
```
|
|
201
|
+
### `agentbell doctor`
|
|
202
|
+
|
|
203
|
+
鏉堟挸鍤悳顖氼暔鐠囧﹥鏌囨穱鈩冧紖閿涘矂鈧倸鎮庢径宥呭煑缂佹瑥鍩嗘禍鐑樺笓閺屻儻绱?
|
|
204
|
+
```bash
|
|
205
|
+
agentbell doctor
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
閸栧懎鎯堥柊宥囩枂閸欘垵顕伴幀褋鈧垢rovider閵嗕苟tfy server閵嗕辜opic 閺勵垰鎯佺€涙ê婀妴浣搁挬閸欒埇鈧弓ostname閵嗕菇sername閵嗕恭wd閵嗕腐ode 閻楀牊婀伴妴涓哃I 鐠嬪啰鏁ょ捄顖氱窞閸滃本甯归懡?hook 閸涙垝鎶ら妴?
|
|
209
|
+
### `agentbell init`
|
|
210
|
+
|
|
211
|
+
娴溿倓绨板蹇曟晸閹存劙鍘ょ純顕嗙窗
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
agentbell init
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
姒涙顓婚崘娆忓弳閿?
|
|
218
|
+
```text
|
|
219
|
+
~/.agentbell/config.json
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
闁板秶鐤嗙粈杞扮伐閿?
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"provider": "ntfy",
|
|
226
|
+
"ntfy": {
|
|
227
|
+
"server": "https://ntfy.sh",
|
|
228
|
+
"topic": "your-long-random-topic",
|
|
229
|
+
"priority": "high",
|
|
230
|
+
"tags": ["computer"]
|
|
231
|
+
},
|
|
232
|
+
"localNotification": {
|
|
233
|
+
"enabled": true
|
|
234
|
+
},
|
|
235
|
+
"includeContext": {
|
|
236
|
+
"hostname": true,
|
|
237
|
+
"cwd": true,
|
|
238
|
+
"timestamp": true
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
閸?macOS/Linux 娑撳绱濋柊宥囩枂閺傚洣娆㈡导姘晼闁插繗顔曠純顔昏礋 `600` 閺夊啴妾洪妴淇塱ndows 娑撳﹣绱扮捄瀹犵箖 POSIX 閺夊啴妾虹拋鍓х枂閵?
|
|
244
|
+
### `agentbell init-hooks`
|
|
245
|
+
|
|
246
|
+
閻㈢喐鍨?hook 闁板秶鐤嗗Ο鈩冩緲閿?
|
|
247
|
+
```bash
|
|
248
|
+
agentbell init-hooks --target claude-code
|
|
249
|
+
agentbell init-hooks --target codex
|
|
250
|
+
agentbell init-hooks --target vscode-agent
|
|
251
|
+
agentbell init-hooks --target all
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
AgentBell 娑撳秳绱扮划妤佹瘹鐟曞棛娲婂鍙夋箒闁板秶鐤嗛妴鍌氬嚒閺?JSON 閺傚洣娆㈡导姘帥婢跺洣鍞ゆ稉?`.bak-閺冨爼妫块幋鐮㈤敍宀€鍔ч崥搴℃晼闁插繐浠?JSON merge閵嗗倸顩ч弸婊冨嚒閺堝鏋冩禒鏈电瑝閺勵垰鎮庡▔?JSON閿涘奔绱伴悽鐔稿灇 snippet 閺傚洣娆㈤獮鑸靛絹缁€杞版眽瀹搞儱鎮庨獮韬测偓?
|
|
255
|
+
Preview hook changes without writing files:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
agentbell init-hooks --target codex --dry-run
|
|
259
|
+
agentbell init-hooks --target all --dry-run
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Dry-run prints the target config paths, whether existing config was detected, what a real run would merge, and the hook snippet that would be generated. It does not write files and does not create backups.
|
|
263
|
+
|
|
264
|
+
## Claude Code Example
|
|
265
|
+
|
|
266
|
+
閻╊喗鐖i弬鍥︽閿?
|
|
267
|
+
```text
|
|
268
|
+
~/.claude/settings.json
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
閻╊喗鐖i弫鍫熺亯閿?
|
|
272
|
+
```json
|
|
273
|
+
{
|
|
274
|
+
"hooks": {
|
|
275
|
+
"Stop": [
|
|
276
|
+
{
|
|
277
|
+
"matcher": "",
|
|
278
|
+
"hooks": [
|
|
279
|
+
{
|
|
280
|
+
"type": "command",
|
|
281
|
+
"command": "agentbell send --tool claude-code --event stop"
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
],
|
|
286
|
+
"Notification": [
|
|
287
|
+
{
|
|
288
|
+
"matcher": "",
|
|
289
|
+
"hooks": [
|
|
290
|
+
{
|
|
291
|
+
"type": "command",
|
|
292
|
+
"command": "agentbell send --tool claude-code --event notification"
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Codex Example
|
|
302
|
+
|
|
303
|
+
閻╊喗鐖i弬鍥︽閿?
|
|
304
|
+
```text
|
|
305
|
+
~/.codex/hooks.json
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
閻╊喗鐖i弫鍫熺亯閿?
|
|
309
|
+
```json
|
|
310
|
+
{
|
|
311
|
+
"hooks": {
|
|
312
|
+
"stop": [
|
|
313
|
+
{
|
|
314
|
+
"command": "agentbell send --tool codex --event stop"
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
AgentBell 鏉╂ü绱伴悽鐔稿灇閿?
|
|
322
|
+
```text
|
|
323
|
+
~/.agentbell/snippets/codex-hooks.json
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Codex hook 闁板秶鐤嗛弽鐓庣础閸欘垵鍏橀梾蹇曞閺堫剙褰夐崠鏍モ偓鍌濆娴g姷娈?Codex 閻楀牊婀版担璺ㄦ暏娑撳秴鎮?schema閿涘矁顕幎?snippet 娑擃厾娈戦崨鎴掓姢鏉╀胶些閸掓媽顕氶悧鍫熸拱鐟曚焦鐪伴惃鍕秴缂冾喓鈧?
|
|
327
|
+
### Codex Windows Wrapper
|
|
328
|
+
|
|
329
|
+
On Windows, AgentBell writes a `.cmd` wrapper and points Codex to that wrapper instead of embedding a long `node.exe ... cli.js ...` command directly in `hooks.json`.
|
|
330
|
+
|
|
331
|
+
Target files:
|
|
332
|
+
|
|
333
|
+
```text
|
|
334
|
+
~/.codex/hooks.json
|
|
335
|
+
~/.agentbell/hooks/codex-stop.cmd
|
|
336
|
+
~/.agentbell/snippets/codex-hooks.json
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Verified Windows hook shape:
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"hooks": {
|
|
344
|
+
"Stop": [
|
|
345
|
+
{
|
|
346
|
+
"hooks": [
|
|
347
|
+
{
|
|
348
|
+
"type": "command",
|
|
349
|
+
"commandWindows": "cmd /d /s /c \"C:\\Users\\<user>\\.agentbell\\hooks\\codex-stop.cmd\"",
|
|
350
|
+
"command": "cmd /d /s /c \"C:\\Users\\<user>\\.agentbell\\hooks\\codex-stop.cmd\"",
|
|
351
|
+
"timeout": 30,
|
|
352
|
+
"statusMessage": "Sending AgentBell notification"
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
The wrapper logs to:
|
|
362
|
+
|
|
363
|
+
```text
|
|
364
|
+
~/.agentbell/codex-hook-fired.log
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
If the log contains `Notification sent.` but your phone does not receive anything, troubleshoot ntfy, Android notification permissions, and battery optimization. If the log file does not exist, Codex did not execute the hook or the hook was not trusted.
|
|
368
|
+
|
|
369
|
+
## VS Code Agent Example
|
|
370
|
+
|
|
371
|
+
閻╊喗鐖i弬鍥︽閺勵垰浼愭担婊冨隘缁狙囧帳缂冾噯绱?
|
|
372
|
+
```text
|
|
373
|
+
.github/hooks/agentbell.json
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
閻╊喗鐖i弫鍫熺亯閿?
|
|
377
|
+
```json
|
|
378
|
+
{
|
|
379
|
+
"name": "agentbell",
|
|
380
|
+
"description": "Notify Android via AgentBell when VS Code Agent / Copilot Agent stops.",
|
|
381
|
+
"hooks": {
|
|
382
|
+
"stop": [
|
|
383
|
+
{
|
|
384
|
+
"command": "agentbell send --tool vscode-agent --event stop"
|
|
385
|
+
}
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
閸楀厖濞囪ぐ鎾冲閻╊喖缍嶆稉宥嗘Ц git 妞ゅ湱娲伴敍瀛塯entBell 娑旂喎鍘戠拋鍝ユ晸閹存劘绻栨稉?workspace hook 閺傚洣娆㈤敍灞借嫙娴兼碍褰佺粈杞扮稑绾喛顓荤€圭偤妾銉ュ徔閺勵垰鎯佺拠璇插絿鐎瑰啨鈧?
|
|
392
|
+
## Real Hook Verification
|
|
393
|
+
|
|
394
|
+
Hook schemas can change across AI coding tools. AgentBell keeps the templates small and visible so you can verify them with the tool version you actually run.
|
|
395
|
+
|
|
396
|
+
### Codex
|
|
397
|
+
|
|
398
|
+
Preview the Codex hook first:
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
agentbell init-hooks --target codex --dry-run
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Then write the hook:
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
agentbell init-hooks --target codex
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Run a minimal Codex task, for example asking it to inspect a tiny file or answer a short codebase question. When the task stops, you should receive an ntfy notification from `agentbell send --tool codex --event stop`.
|
|
411
|
+
|
|
412
|
+
If no notification arrives, run:
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
agentbell doctor
|
|
416
|
+
agentbell doctor --json
|
|
417
|
+
agentbell test
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
Check that the config path exists, the ntfy server is reachable, and the command shown in the dry-run output is valid in the same shell/environment where Codex runs.
|
|
421
|
+
|
|
422
|
+
### Claude Code
|
|
423
|
+
|
|
424
|
+
Preview or write Claude Code hooks:
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
agentbell init-hooks --target claude-code --dry-run
|
|
428
|
+
agentbell init-hooks --target claude-code
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
To verify the Stop hook, run a small Claude Code task and let it finish normally. You should receive a notification for `--tool claude-code --event stop`.
|
|
432
|
+
|
|
433
|
+
To verify the Notification hook, trigger a Claude Code state that asks for user attention, such as waiting for input or a permission-related notification. You should receive a notification for `--tool claude-code --event notification`.
|
|
434
|
+
|
|
435
|
+
Use the event name to distinguish states:
|
|
436
|
+
|
|
437
|
+
- `stop`: the agent finished the current task or turn.
|
|
438
|
+
- `notification`: the agent is asking for attention, often because it is waiting for input or needs user action.
|
|
439
|
+
|
|
440
|
+
If the Stop hook works but Notification does not, inspect the installed Claude Code version and its hook documentation. The event name or schema may have changed.
|
|
441
|
+
|
|
442
|
+
## Claude Code Verification
|
|
443
|
+
|
|
444
|
+
AgentBell prepares Claude Code hooks with this shape:
|
|
445
|
+
|
|
446
|
+
```text
|
|
447
|
+
hooks.Stop[].hooks[]
|
|
448
|
+
hooks.Notification[].hooks[]
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Each handler uses `type: "command"` and calls `agentbell send`. On Windows, Claude Code runs hook commands through Git Bash / shell, so AgentBell writes project-local `.sh` wrappers instead of `.cmd` wrappers:
|
|
452
|
+
|
|
453
|
+
```text
|
|
454
|
+
<projectRoot>\.agentbell-hooks\claude-stop.sh
|
|
455
|
+
<projectRoot>\.agentbell-hooks\claude-notification.sh
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
Both wrappers log to:
|
|
459
|
+
|
|
460
|
+
```text
|
|
461
|
+
<projectRoot>\.agentbell-hooks\claude-hook-fired.log
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
The generated Claude Code commands look like:
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
bash G:/learning/AgentBell/.agentbell-hooks/claude-stop.sh
|
|
468
|
+
bash G:/learning/AgentBell/.agentbell-hooks/claude-notification.sh
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
Wrapper timestamps use an ASCII-safe UTC format, `date -u +"%Y-%m-%dT%H:%M:%SZ"`, to avoid mojibake on Windows systems with non-English locale output.
|
|
472
|
+
|
|
473
|
+
Preview the files:
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
agentbell init-hooks --target claude-code --dry-run
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
Write the hooks:
|
|
480
|
+
|
|
481
|
+
```bash
|
|
482
|
+
agentbell init-hooks --target claude-code
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
After changing Claude Code hooks, trust or allow the hook if Claude Code prompts you. To verify `Stop`, run a tiny Claude Code task and let it finish. To verify `Notification`, trigger a state where Claude Code waits for user attention, such as input or permission. If no phone notification arrives, check `<projectRoot>\.agentbell-hooks\claude-hook-fired.log` first. If the log file does not exist, Claude Code did not execute or trust the hook. If the log contains `Notification sent.`, troubleshoot ntfy and Android notification delivery.
|
|
486
|
+
|
|
487
|
+
### VS Code Agent / Copilot Agent
|
|
488
|
+
|
|
489
|
+
VS Code Agent / Copilot Agent support is treated as a workspace hook. AgentBell writes:
|
|
490
|
+
|
|
491
|
+
```text
|
|
492
|
+
.github/hooks/agentbell.json
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
Preview or write it from the workspace root:
|
|
496
|
+
|
|
497
|
+
```bash
|
|
498
|
+
agentbell init-hooks --target vscode-agent --dry-run
|
|
499
|
+
agentbell init-hooks --target vscode-agent
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
This capability may vary by VS Code and Copilot Agent version. After writing the file, reload VS Code, run a small workspace agent task, and confirm whether the hook command is executed. If it is not triggered, manually compare `.github/hooks/agentbell.json` with the hook format expected by your VS Code version, then move the command into the supported location.
|
|
503
|
+
|
|
504
|
+
Use `agentbell doctor` inside the same workspace terminal to confirm the CLI path, Node version, current working directory, and config file location.
|
|
505
|
+
|
|
506
|
+
## Verified: Codex VS Code Extension on Windows
|
|
507
|
+
|
|
508
|
+
The VS Code Codex extension has been manually verified on Windows with AgentBell:
|
|
509
|
+
|
|
510
|
+
- `UserPromptSubmit` and `Stop` hooks can be triggered by the extension.
|
|
511
|
+
- `Stop` hook successfully calls AgentBell through the generated `.cmd` wrapper.
|
|
512
|
+
- The full path works: Codex Stop hook -> `.cmd` wrapper -> AgentBell -> ntfy -> Android phone notification.
|
|
513
|
+
- The successful wrapper log is written to `~/.agentbell/codex-hook-fired.log`.
|
|
514
|
+
|
|
515
|
+
After changing hooks, Codex may require you to trust the updated hook again. If you use WSL, configure AgentBell separately inside WSL because Windows, WSL, Remote SSH, and Dev Containers have different home directories, Node paths, and hook execution environments.
|
|
516
|
+
|
|
517
|
+
## Local Desktop Notifications
|
|
518
|
+
|
|
519
|
+
闂勩倓绨?ntfy 閹靛婧€閹恒劑鈧緤绱滱gentBell 閸欘垯浜掔悰銉ュ帠閺堫剙婀村宀勬桨闁氨鐓¢敍?
|
|
520
|
+
- macOS: `osascript display notification`
|
|
521
|
+
- Linux: 娴兼ê鍘?`notify-send`閿涘奔绗夌€涙ê婀崚娆掔儲鏉?- Windows: MVP 闂冭埖顔岀捄瀹犵箖閸欘垶娼幀褌绗夌搾宕囨畱閺堫剙婀?toast閿涘苯鑻熺紒娆忓毉閹绘劗銇?
|
|
522
|
+
閺堫剙婀撮柅姘辩叀婢惰精瑙︽稉宥勭窗瑜板崬鎼?ntfy 閹靛婧€閹恒劑鈧降鈧?
|
|
523
|
+
## Remote SSH / WSL / Dev Container
|
|
524
|
+
|
|
525
|
+
Hook 鎼存棁顕氶崷銊ョ杽闂勫懓绻嶇悰?AI coding agent 閻ㄥ嫭婧€閸c劋绗傞幍褑顢戦妴鍌涚槷婵″偊绱?
|
|
526
|
+
- Remote SSH: hook 閸︺劏绻欑粙?Linux 娑撶粯婧€閹笛嗩攽閵?- WSL: hook 閸?WSL 閻滎垰顣ㄩ幍褑顢戦妴?- Dev Container: hook 閸?container 閸愬懏澧界悰灞烩偓?- 鏉╂粍甯堕悽浣冨壋: hook 閸︺劏顫︽潻婊勫付閻絻鍓抽幍褑顢戦妴?
|
|
527
|
+
閸ョ姵顒濇担鐘绘付鐟曚礁婀柇锝勯嚋閻滎垰顣ㄩ柌灞界暔鐟?Node.js 20+閵嗕礁鐣ㄧ憗?AgentBell閵嗕浇绻嶇悰?`agentbell init`閿涘苯鑻熺涵顔荤箽鐠囥儳骞嗘晶鍐厴鐠佸潡妫?ntfy server閵?
|
|
528
|
+
## Troubleshooting
|
|
529
|
+
|
|
530
|
+
### 閹靛婧€閺€鏈电瑝閸掍即鈧氨鐓?
|
|
531
|
+
閸忓牐绻嶇悰宀嬬窗
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
agentbell doctor
|
|
535
|
+
agentbell test
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
濡偓閺屻儲澧滈張鐑樻Ц閸氾箒顓归梼鍛啊閸氬奔绔存稉?topic閵嗕苟tfy 閺勵垰鎯侀張澶愨偓姘辩叀閺夊啴妾洪妴浣规Ц閸氾箑鍙ч梻顓濈啊閻㈠灚鐫滄导妯哄閵嗕辜opic 閺勵垰鎯佺搾鍐差檮闂呭繑婧€娑撴梹鐥呴張澶庣翻闁挎瑣鈧?
|
|
539
|
+
### 鏉╂粎鈻奸張鍝勬珤閺冪姵纭剁拋鍧楁6 ntfy.sh
|
|
540
|
+
|
|
541
|
+
鏉╂劘顢?`agentbell doctor` 閺屻儳婀?`ntfy server access`閵嗗倸顩ч弸婊冨彆閸欏摜缍夌紒婊勫灗閺堝秴濮熼崳銊х秹缂佹粓妾洪崚鎯邦問闂?`ntfy.sh`閿涘苯褰叉禒銉ㄥ殰瀵?ntfy server閿涘瞼鍔ч崥搴℃躬 `~/.agentbell/config.json` 娑擃厺鎱ㄩ弨?`ntfy.server`閵?
|
|
542
|
+
### hook 濞屄ば曢崣?
|
|
543
|
+
绾喛顓?hook 闁板秶鐤嗛弬鍥︽閸︺劌顕惔鏂夸紣閸忓嘲鐤勯梽鍛邦嚢閸欐牜娈戞担宥囩枂閵嗗倷鎱ㄩ弨?hook 閸氬函绱濋柌宥呮儙閹?reload 鐎电懓绨?AI coding 瀹搞儱鍙块妴鍌氬帥閻劋绔存稉顏勭发鐏忓繒娈?agent 娴犺濮熸宀冪槈 stop hook閵?
|
|
544
|
+
婵″倹鐏?Windows 娑?Codex hook 濞屸剝婀佺憴锕€褰傞柅姘辩叀閿涘矁顕Λ鈧弻?`~/.agentbell/codex-hook-fired.log`閵?
|
|
545
|
+
### Windows 鐠侯垰绶為梻顕€顣?
|
|
546
|
+
婵″倹鐏夐崗銊ョ湰 `agentbell` 閸涙垝鎶ら崷?hook 閻滎垰顣ㄩ柌灞肩瑝閸欘垵顫嗛敍灞藉讲娴犮儰濞囬悽?`agentbell doctor` 鏉堟挸鍤惃?`cli invocation for hooks`閵嗗倸婀張顒€婀村鈧崣鎴炴閿涘苯鐣犻崣顖濆厴閺?`node path/to/dist/cli.js`閵?
|
|
547
|
+
### WSL / Remote SSH 娑?hook 鐎圭偤妾潻鎰攽娴e秶鐤嗛梻顕€顣?
|
|
548
|
+
鐠囧嘲婀?agent 鐎圭偤妾潻鎰攽閻滎垰顣ㄩ柌灞惧⒔鐞?`agentbell doctor`閵嗕繅indows 娑撶粯婧€閵嗕箘SL閵嗕浇绻欑粙瀣╁瘜閺堟亽鈧笍ev Container 閺勵垯绗夐崥宀€骞嗘晶鍐跨礉閸氬嫯鍤滈張澶夌瑝閸氬瞼娈?home閵嗕赋ATH閵嗕腐ode 閸滃矂鍘ょ純顔芥瀮娴犺翰鈧?
|
|
549
|
+
### Cannot find module old project dist cli.js
|
|
550
|
+
|
|
551
|
+
If a wrapper log contains an error like:
|
|
552
|
+
|
|
553
|
+
```text
|
|
554
|
+
Cannot find module '...\old-project\dist\cli.js'
|
|
555
|
+
MODULE_NOT_FOUND
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
then the hook and wrapper did execute, but the active wrapper still points to an old project path. This can happen after renaming or moving the project directory.
|
|
559
|
+
|
|
560
|
+
Fix:
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
node dist\cli.js init-hooks --target all
|
|
564
|
+
agentbell verify --dry-run
|
|
565
|
+
```
|
|
566
|
+
### setup test failed
|
|
567
|
+
|
|
568
|
+
If `agentbell setup` sends a test notification but the phone does not receive it:
|
|
569
|
+
|
|
570
|
+
- Check that the topic in ntfy Android exactly matches the AgentBell topic.
|
|
571
|
+
- Check the ntfy server URL.
|
|
572
|
+
- Open the ntfy app once to refresh the subscription.
|
|
573
|
+
- Allow notification permission.
|
|
574
|
+
- Allow background running / disable battery optimization.
|
|
575
|
+
- Run `agentbell doctor` and inspect warnings.
|
|
576
|
+
|
|
577
|
+
If you skipped hook installation during setup, rerun `agentbell setup` or use `agentbell init-hooks --target all` after phone delivery works.
|
|
578
|
+
|
|
579
|
+
It is safe to rerun setup. Existing hook files are backed up by the hook installer before merge/write where supported.
|
|
580
|
+
### Cannot convert argument to a ByteString
|
|
581
|
+
|
|
582
|
+
This can happen when a Node.js `fetch` header contains Chinese text, emoji, or other non-ASCII characters. ntfy supports UTF-8 header values through RFC 2047 encoded-word syntax, so AgentBell automatically encodes ntfy headers such as `Title` and `Tags`.
|
|
583
|
+
|
|
584
|
+
The notification body is not header data and remains a normal UTF-8 message.
|
|
585
|
+
|
|
586
|
+
If you still see this error, upgrade AgentBell and rebuild it. As a temporary workaround, use an English-only `--title` and ASCII-only `--tags`.
|
|
587
|
+
|
|
588
|
+
## Development
|
|
589
|
+
|
|
590
|
+
```bash
|
|
591
|
+
npm install
|
|
592
|
+
npm run build
|
|
593
|
+
npm test
|
|
594
|
+
npm run dev -- test
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
濞村鐦导?mock `fetch`閿涘奔绗夋导姘辨埂閻ㄥ嫬鎮?`ntfy.sh` 閸欐垼顕Ч鍌樷偓鍌氬涧閺堝鏁ら幋閿嬫▔瀵繗绻嶇悰?`agentbell test` 閹?`agentbell send` 閺冭埖澧犳导姘絺闁胶婀$€圭偤鈧氨鐓¢妴?
|
|
598
|
+
## Compatibility / Verified Matrix
|
|
599
|
+
|
|
600
|
+
| Tool | Surface | OS | Hook event | Wrapper strategy | Status | Log path |
|
|
601
|
+
|---|---|---|---|---|---|---|
|
|
602
|
+
| Codex | VS Code extension | Windows | Stop | user `.cmd` wrapper | Verified | `~/.agentbell/codex-hook-fired.log` |
|
|
603
|
+
| Claude Code | CLI / VS Code terminal mode | Windows | Stop | project `.sh` wrapper | Verified | `<projectRoot>/.agentbell-hooks/claude-hook-fired.log` |
|
|
604
|
+
| Claude Code | CLI / VS Code terminal mode | Windows | Notification | project `.sh` wrapper | Prepared / Partially verified | `<projectRoot>/.agentbell-hooks/claude-hook-fired.log` |
|
|
605
|
+
| VS Code Copilot Agent | VS Code Agent mode | Windows | Stop | project `.cmd` wrapper | Verified | `<projectRoot>/.agentbell-hooks/copilot-hook-fired.log` |
|
|
606
|
+
| Remote SSH / WSL / Dev Container | Various | Various | TBD | TBD | Not verified | TBD |
|
|
607
|
+
|
|
608
|
+
Verified means the full chain reached Android notification on the author's Windows machine. Claude Code Notification is prepared but should not be treated as fully verified until a real Notification event is tested. VS Code Agent hooks are still a Preview capability, so re-verify after VS Code or Copilot updates.
|
|
609
|
+
|
|
610
|
+
## Verified: Codex VS Code Extension on Windows
|
|
611
|
+
|
|
612
|
+
Verified path:
|
|
613
|
+
|
|
614
|
+
```text
|
|
615
|
+
Codex Stop hook -> ~/.agentbell/hooks/codex-stop.cmd -> AgentBell -> ntfy -> Android
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
Install or refresh the hook:
|
|
619
|
+
|
|
620
|
+
```bash
|
|
621
|
+
node dist\cli.js init-hooks --target codex
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
Then restart or reload VS Code / Codex, trust the hook if prompted, run a small Codex task, and inspect:
|
|
625
|
+
|
|
626
|
+
```text
|
|
627
|
+
~/.agentbell/codex-hook-fired.log
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
Log interpretation:
|
|
631
|
+
|
|
632
|
+
- `Notification sent.` plus exit code `0`: AgentBell successfully sent the ntfy request.
|
|
633
|
+
- No log file: Codex did not execute the hook or the hook was not trusted.
|
|
634
|
+
- Log exists but phone did not receive notification: troubleshoot ntfy, Android background permissions, and notification permissions.
|
|
635
|
+
|
|
636
|
+
Why `.cmd` wrapper on Windows:
|
|
637
|
+
|
|
638
|
+
- Directly embedding a complex `"node.exe" "cli.js" send ...` command in `~/.codex/hooks.json` is fragile on Windows because quoting, spaces, and path escaping can vary by host.
|
|
639
|
+
- The generated `.cmd` wrapper gives Codex a short stable command and gives AgentBell a log file for troubleshooting.
|
|
640
|
+
- Codex uses the `hooks.Stop[].hooks[]` schema and the Windows-specific `commandWindows` field.
|
|
641
|
+
- After changing hooks, Codex may ask you to trust the updated hook again.
|
|
642
|
+
|
|
643
|
+
## Verified: Claude Code on Windows
|
|
644
|
+
|
|
645
|
+
Claude Code CLI must be available:
|
|
646
|
+
|
|
647
|
+
```bash
|
|
648
|
+
claude --version
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
Hooks should be visible with:
|
|
652
|
+
|
|
653
|
+
```bash
|
|
654
|
+
claude /hooks
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
If `/hooks` cannot find `claude`, the Claude Code CLI is not installed or `PATH` is not configured in the terminal environment.
|
|
658
|
+
|
|
659
|
+
Claude Code on Windows executes hook commands through Git Bash / shell. AgentBell therefore generates project-local `.sh` wrappers, not user-home `.cmd` wrappers.
|
|
660
|
+
|
|
661
|
+
Verified path:
|
|
662
|
+
|
|
663
|
+
```text
|
|
664
|
+
Claude Code Stop hook -> <projectRoot>/.agentbell-hooks/claude-stop.sh -> AgentBell -> ntfy -> Android
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
How to verify:
|
|
668
|
+
|
|
669
|
+
```bash
|
|
670
|
+
node dist\cli.js init-hooks --target claude-code
|
|
671
|
+
claude /hooks
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
Confirm `Stop` and `Notification` are present, trust or allow hooks if prompted, then run a tiny Claude Code prompt:
|
|
675
|
+
|
|
676
|
+
```text
|
|
677
|
+
璇峰洖澶嶄竴鍙?hello锛屼笉瑕佷慨鏀规枃浠躲€?```
|
|
678
|
+
|
|
679
|
+
Inspect:
|
|
680
|
+
|
|
681
|
+
```text
|
|
682
|
+
<projectRoot>/.agentbell-hooks/claude-hook-fired.log
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
Old logs may contain mojibake from locale-specific Windows date output. The current wrapper uses ISO-style UTC timestamps such as `2026-05-23T13:28:27Z`; after clearing old logs, new entries should be ASCII-safe.
|
|
686
|
+
|
|
687
|
+
The Claude Code Notification hook is prepared / partially verified. Do not treat it as fully verified until you have triggered and confirmed a real Notification event on your machine.
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
### Claude verify run-wrapper on Windows
|
|
691
|
+
|
|
692
|
+
`agentbell verify --target claude-code --run-wrapper` runs the Claude `.sh` wrapper with a resolved Git Bash executable. On Windows it uses this order:
|
|
693
|
+
|
|
694
|
+
1. `AGENTBELL_BASH_PATH`, if set and the file exists.
|
|
695
|
+
2. `bash` found on `PATH`.
|
|
696
|
+
3. Common Git for Windows paths such as `C:\Program Files\Git\bin\bash.exe`.
|
|
697
|
+
|
|
698
|
+
Example:
|
|
699
|
+
|
|
700
|
+
```bat
|
|
701
|
+
set AGENTBELL_BASH_PATH=D:\software\git\bin\bash.exe
|
|
702
|
+
agentbell verify --target claude-code --run-wrapper
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
The verify report prints the resolved bash path:
|
|
706
|
+
|
|
707
|
+
```text
|
|
708
|
+
[Claude Code]
|
|
709
|
+
bash: D:\software\git\bin\bash.exe
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
If manual bash execution succeeds but verify fails, run:
|
|
713
|
+
|
|
714
|
+
```bash
|
|
715
|
+
agentbell verify --target claude-code --run-wrapper --json
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
Compare `bashPath`, `runWrapper`, and the latest log block status. A successful latest Claude block should include `Notification sent.` and `AgentBell exit code 0`.
|
|
719
|
+
|
|
720
|
+
## Verified: VS Code Copilot Agent on Windows
|
|
721
|
+
|
|
722
|
+
VS Code Agent hooks are still Preview, but the Windows Stop path below has been verified with Copilot Agent mode.
|
|
723
|
+
|
|
724
|
+
Verified path:
|
|
725
|
+
|
|
726
|
+
```text
|
|
727
|
+
VS Code Copilot Agent Stop hook -> <projectRoot>/.agentbell-hooks/copilot-stop.cmd -> AgentBell -> ntfy -> Android
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
Generated files:
|
|
731
|
+
|
|
732
|
+
- Hook file: `.github/hooks/agentbell.json`
|
|
733
|
+
- Wrapper: `<projectRoot>/.agentbell-hooks/copilot-stop.cmd`
|
|
734
|
+
- Log: `<projectRoot>/.agentbell-hooks/copilot-hook-fired.log`
|
|
735
|
+
|
|
736
|
+
How to verify:
|
|
737
|
+
|
|
738
|
+
```bash
|
|
739
|
+
node dist\cli.js init-hooks --target vscode-agent
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
Reload VS Code, use Copilot Chat in Agent mode to run a small task, then inspect the log file above and confirm the phone notification. The generated Windows hook command uses:
|
|
743
|
+
|
|
744
|
+
```text
|
|
745
|
+
cmd /d /s /c "<projectRoot>\.agentbell-hooks\copilot-stop.cmd"
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
Do not use single quotes around the wrapper path. If Windows says the wrapper path is not recognized as an internal/external command, executable program, or batch file, the hook probably used single quotes or did not pass the wrapper path through `cmd /d /s /c` with double quotes.
|
|
749
|
+
|
|
750
|
+
For hook-level debugging, open `View -> Output -> GitHub Copilot Chat Hooks`.
|
|
751
|
+
|
|
752
|
+
## Android ntfy Reliability Notes
|
|
753
|
+
|
|
754
|
+
If notifications arrive only after opening the ntfy app, the usual cause is Android background restriction rather than AgentBell.
|
|
755
|
+
|
|
756
|
+
Recommended Android settings:
|
|
757
|
+
|
|
758
|
+
- Allow notifications.
|
|
759
|
+
- Allow lock-screen notifications.
|
|
760
|
+
- Allow background running.
|
|
761
|
+
- Disable battery optimization for ntfy.
|
|
762
|
+
- Allow auto-start.
|
|
763
|
+
- Allow background network access.
|
|
764
|
+
- In the watch/band companion app, allow forwarding ntfy notifications.
|
|
765
|
+
|
|
766
|
+
The F-Droid build of ntfy may rely more heavily on a background connection. If the phone has Google services, the Play Store build may be more reliable for push delivery.
|
|
767
|
+
|
|
768
|
+
Treat the ntfy topic as a secret. Do not use an easy-to-guess topic and never commit it to a public repository. Use a long random topic such as `your-long-random-topic`; when showing diagnostics publicly, mask it like `agen...q4z1`.
|
|
769
|
+
|
|
770
|
+
## Known Windows Notes
|
|
771
|
+
|
|
772
|
+
- Windows local desktop notification is intentionally skipped in this MVP. ntfy phone push is unaffected.
|
|
773
|
+
- Codex has been verified with a user-home `.cmd` wrapper.
|
|
774
|
+
- Claude Code has been verified with a project-local `.sh` wrapper.
|
|
775
|
+
- VS Code Copilot Agent has been verified with a project-local `.cmd` wrapper.
|
|
776
|
+
- Windows non-ASCII usernames, Git Bash path conversion, `cmd` quoting, and hook host behavior can all affect execution, so do not casually change wrapper strategy between tools.
|
|
777
|
+
- Git dubious ownership does not affect AgentBell notifications, but it can block `git status`, `git diff`, or commits. Users should decide whether to configure `safe.directory`.
|
|
778
|
+
- WSL, Remote SSH, Dev Containers, and Windows host shells have different home directories, Node paths, environment variables, and network behavior. Configure and verify AgentBell in the environment where the agent hook actually runs.
|
|
779
|
+
|
|
780
|
+
## Next: Verify and Rich Context
|
|
781
|
+
|
|
782
|
+
Now that `agentbell setup` exists, the next product step is a dedicated `agentbell verify` command for repeatable end-to-end checks after setup.
|
|
783
|
+
|
|
784
|
+
Planned improvements:
|
|
785
|
+
|
|
786
|
+
1. Verify config readability.
|
|
787
|
+
2. Verify ntfy delivery.
|
|
788
|
+
3. Verify installed hook files and wrapper paths.
|
|
789
|
+
4. Print tool-specific next steps for Codex, Claude Code, and VS Code Copilot Agent.
|
|
790
|
+
5. Expand notification templates with project and task context.
|
|
791
|
+
|
|
792
|
+
Example topic values in docs should stay generic, such as `your-long-random-topic` or `agen...q4z1`.
|
|
793
|
+
|
|
794
|
+
## Future: Rich Notification Context
|
|
795
|
+
|
|
796
|
+
Future AgentBell notifications can include richer context so the phone notification tells you which machine and task finished.
|
|
797
|
+
|
|
798
|
+
Possible fields:
|
|
799
|
+
|
|
800
|
+
- machine display name
|
|
801
|
+
- hostname
|
|
802
|
+
- tool
|
|
803
|
+
- event
|
|
804
|
+
- project name
|
|
805
|
+
- cwd
|
|
806
|
+
- git branch
|
|
807
|
+
- task name
|
|
808
|
+
- timestamp
|
|
809
|
+
|
|
810
|
+
Example:
|
|
811
|
+
|
|
812
|
+
```text
|
|
813
|
+
宸ヤ綔绔?鍙?路 Codex 瀹¤浠诲姟缁撴潫
|
|
814
|
+
椤圭洰锛欰gentBell
|
|
815
|
+
璺緞锛欸:\learning\AgentBell
|
|
816
|
+
鍒嗘敮锛歮ain
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
## Rich Notification Context
|
|
824
|
+
|
|
825
|
+
AgentBell now builds richer default notification content when `--title` or `--message` is not provided. The default context can include:
|
|
826
|
+
|
|
827
|
+
- machine display name
|
|
828
|
+
- hostname
|
|
829
|
+
- tool display name
|
|
830
|
+
- raw tool id
|
|
831
|
+
- event and event label
|
|
832
|
+
- task name
|
|
833
|
+
- project name
|
|
834
|
+
- cwd
|
|
835
|
+
- git branch
|
|
836
|
+
- local timestamp
|
|
837
|
+
- ISO timestamp
|
|
838
|
+
|
|
839
|
+
Example notification:
|
|
840
|
+
|
|
841
|
+
```text
|
|
842
|
+
宸ヤ綔绔?鍙?路 Codex 瀹¤浠诲姟缁撴潫
|
|
843
|
+
|
|
844
|
+
椤圭洰锛欰gentBell
|
|
845
|
+
璺緞锛欸:\learning\AgentBell
|
|
846
|
+
鍒嗘敮锛歮ain
|
|
847
|
+
浜嬩欢锛歴top
|
|
848
|
+
鏃堕棿锛?026-05-23 22:45
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
Useful `send` options:
|
|
852
|
+
|
|
853
|
+
```bash
|
|
854
|
+
agentbell send --tool codex --event stop --task "瀹¤浠诲姟"
|
|
855
|
+
agentbell send --tool claude-code --event stop --project AgentBell --task "README 鏇存柊"
|
|
856
|
+
agentbell send --tool vscode-agent --event stop --cwd G:\learning\AgentBell --branch main
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
Explicit `--title` and `--message` still win. Use them when a hook wrapper needs an exact fixed message.
|
|
860
|
+
|
|
861
|
+
## Machine Display Name
|
|
862
|
+
|
|
863
|
+
The ntfy topic is a secret transport address, not a human-readable machine name. Do not use your topic as a display name and do not commit it to a public repository.
|
|
864
|
+
|
|
865
|
+
Use `profile.name` in `~/.agentbell/config.json` for friendly notification context:
|
|
866
|
+
|
|
867
|
+
```json
|
|
868
|
+
{
|
|
869
|
+
"profile": {
|
|
870
|
+
"name": "宸ヤ綔绔?鍙?
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
A practical setup is one long random topic per user, shared across your own machines, with a different `profile.name` on each machine.
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
### Hooks use rich context by default
|
|
879
|
+
|
|
880
|
+
Generated Stop wrappers now let `agentbell send` build the notification from rich context. They do not hard-code simple `--title` / `--message` values by default.
|
|
881
|
+
|
|
882
|
+
To customize hook notifications, create `.agentbell.json` in the project:
|
|
883
|
+
|
|
884
|
+
```json
|
|
885
|
+
{
|
|
886
|
+
"projectName": "AgentBell",
|
|
887
|
+
"defaultTaskName": "瀹¤浠诲姟"
|
|
888
|
+
}
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
Then regenerate hooks:
|
|
892
|
+
|
|
893
|
+
```bash
|
|
894
|
+
agentbell init-hooks --target all
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
Project-local wrappers such as Claude Code and VS Code Copilot Agent pass `--cwd <projectRoot>` so AgentBell can read `.agentbell.json`, `package.json`, and git branch context. Codex uses a user-level wrapper and normally relies on the hook runtime cwd.
|
|
898
|
+
|
|
899
|
+
Example hook notification:
|
|
900
|
+
|
|
901
|
+
```text
|
|
902
|
+
宸ヤ綔绔?鍙?路 Codex 瀹¤浠诲姟缁撴潫
|
|
903
|
+
椤圭洰锛欰gentBell
|
|
904
|
+
璺緞锛欸:\learning\AgentBell
|
|
905
|
+
鍒嗘敮锛歮ain
|
|
906
|
+
浜嬩欢锛歴top
|
|
907
|
+
鏃堕棿锛?026-05-23 22:45
|
|
908
|
+
```
|
|
909
|
+
## Project Config
|
|
910
|
+
|
|
911
|
+
AgentBell can also read optional project-level config from `.agentbell.json` in the current working directory.
|
|
912
|
+
|
|
913
|
+
```json
|
|
914
|
+
{
|
|
915
|
+
"projectName": "AgentBell",
|
|
916
|
+
"defaultTaskName": "瀹¤浠诲姟"
|
|
917
|
+
}
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
Create it with:
|
|
921
|
+
|
|
922
|
+
```bash
|
|
923
|
+
agentbell project init --name AgentBell --task "瀹¤浠诲姟"
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
If `.agentbell.json` already exists, `agentbell project init` will not overwrite it unless you pass `--force`. With `--force`, AgentBell writes a `.bak-<timestamp>` backup first.
|
|
927
|
+
|
|
928
|
+
Project name priority:
|
|
929
|
+
|
|
930
|
+
1. `agentbell send --project <name>`
|
|
931
|
+
2. `.agentbell.json` `projectName`
|
|
932
|
+
3. `package.json` `name`
|
|
933
|
+
4. current directory name
|
|
934
|
+
|
|
935
|
+
Task name priority:
|
|
936
|
+
|
|
937
|
+
1. `agentbell send --task <name>`
|
|
938
|
+
2. `.agentbell.json` `defaultTaskName`
|
|
939
|
+
3. `浠诲姟`
|
|
940
|
+
|
|
941
|
+
Project-level notification templates can override global templates:
|
|
942
|
+
|
|
943
|
+
```json
|
|
944
|
+
{
|
|
945
|
+
"projectName": "AgentBell",
|
|
946
|
+
"defaultTaskName": "瀹¤浠诲姟",
|
|
947
|
+
"notification": {
|
|
948
|
+
"titleTemplate": "{{machine}} 路 {{tool}} {{task}}{{eventLabelSuffix}}",
|
|
949
|
+
"messageTemplate": "椤圭洰锛歿{project}}\n璺緞锛歿{cwd}}\n鍒嗘敮锛歿{branch}}\n浜嬩欢锛歿{event}}\n鏃堕棿锛歿{timestamp}}"
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
Supported template variables include `machine`, `hostname`, `tool`, `toolRaw`, `event`, `eventLabel`, `task`, `project`, `cwd`, `branch`, `timestamp`, `isoTimestamp`, and `duration`.
|
|
955
|
+
|
|
956
|
+
## Setup Project Context
|
|
957
|
+
|
|
958
|
+
`agentbell setup` remains safe by default and does not create `.agentbell.json` in `--yes` mode unless requested.
|
|
959
|
+
|
|
960
|
+
To create project context during setup:
|
|
961
|
+
|
|
962
|
+
```bash
|
|
963
|
+
agentbell setup --init-project --project-name AgentBell
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
In interactive setup, AgentBell can ask whether to create `.agentbell.json` for the current project. Choosing no leaves the project untouched.
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|