@mohak34/opencode-notifier 0.1.11 → 0.1.12
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/README.md +15 -8
- package/dist/index.js +18 -7
- package/package.json +1 -1
- package/sounds/question.wav +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# opencode-notifier
|
|
2
2
|
|
|
3
|
-
OpenCode plugin that plays sounds and sends system notifications when permission is needed, generation completes, or
|
|
3
|
+
OpenCode plugin that plays sounds and sends system notifications when permission is needed, generation completes, errors occur, or the question tool is invoked. Works on macOS, Linux, and Windows.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -94,17 +94,20 @@ To customize the plugin, create `~/.config/opencode/opencode-notifier.json`:
|
|
|
94
94
|
"events": {
|
|
95
95
|
"permission": { "sound": true, "notification": true },
|
|
96
96
|
"complete": { "sound": true, "notification": true },
|
|
97
|
-
"error": { "sound": true, "notification": true }
|
|
97
|
+
"error": { "sound": true, "notification": true },
|
|
98
|
+
"question": { "sound": true, "notification": true }
|
|
98
99
|
},
|
|
99
100
|
"messages": {
|
|
100
101
|
"permission": "OpenCode needs permission",
|
|
101
102
|
"complete": "OpenCode has finished",
|
|
102
|
-
"error": "OpenCode encountered an error"
|
|
103
|
+
"error": "OpenCode encountered an error",
|
|
104
|
+
"question": "OpenCode has a question"
|
|
103
105
|
},
|
|
104
106
|
"sounds": {
|
|
105
107
|
"permission": "/path/to/custom/sound.wav",
|
|
106
108
|
"complete": "/path/to/custom/sound.wav",
|
|
107
|
-
"error": "/path/to/custom/sound.wav"
|
|
109
|
+
"error": "/path/to/custom/sound.wav",
|
|
110
|
+
"question": "/path/to/custom/sound.wav"
|
|
108
111
|
}
|
|
109
112
|
}
|
|
110
113
|
```
|
|
@@ -126,7 +129,8 @@ Control sound and notification separately for each event:
|
|
|
126
129
|
"events": {
|
|
127
130
|
"permission": { "sound": true, "notification": true },
|
|
128
131
|
"complete": { "sound": false, "notification": true },
|
|
129
|
-
"error": { "sound": true, "notification": false }
|
|
132
|
+
"error": { "sound": true, "notification": false },
|
|
133
|
+
"question": { "sound": true, "notification": true }
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
136
|
```
|
|
@@ -138,7 +142,8 @@ Or use a boolean to toggle both:
|
|
|
138
142
|
"events": {
|
|
139
143
|
"permission": true,
|
|
140
144
|
"complete": false,
|
|
141
|
-
"error": true
|
|
145
|
+
"error": true,
|
|
146
|
+
"question": true
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
```
|
|
@@ -152,7 +157,8 @@ Customize notification text:
|
|
|
152
157
|
"messages": {
|
|
153
158
|
"permission": "Action required",
|
|
154
159
|
"complete": "Done!",
|
|
155
|
-
"error": "Something went wrong"
|
|
160
|
+
"error": "Something went wrong",
|
|
161
|
+
"question": "Input needed"
|
|
156
162
|
}
|
|
157
163
|
}
|
|
158
164
|
```
|
|
@@ -166,7 +172,8 @@ Use your own sound files:
|
|
|
166
172
|
"sounds": {
|
|
167
173
|
"permission": "/home/user/sounds/alert.wav",
|
|
168
174
|
"complete": "/home/user/sounds/done.wav",
|
|
169
|
-
"error": "/home/user/sounds/error.wav"
|
|
175
|
+
"error": "/home/user/sounds/error.wav",
|
|
176
|
+
"question": "/home/user/sounds/question.wav"
|
|
170
177
|
}
|
|
171
178
|
}
|
|
172
179
|
```
|
package/dist/index.js
CHANGED
|
@@ -3741,17 +3741,20 @@ var DEFAULT_CONFIG = {
|
|
|
3741
3741
|
events: {
|
|
3742
3742
|
permission: { ...DEFAULT_EVENT_CONFIG },
|
|
3743
3743
|
complete: { ...DEFAULT_EVENT_CONFIG },
|
|
3744
|
-
error: { ...DEFAULT_EVENT_CONFIG }
|
|
3744
|
+
error: { ...DEFAULT_EVENT_CONFIG },
|
|
3745
|
+
question: { ...DEFAULT_EVENT_CONFIG }
|
|
3745
3746
|
},
|
|
3746
3747
|
messages: {
|
|
3747
3748
|
permission: "OpenCode needs permission",
|
|
3748
3749
|
complete: "OpenCode has finished",
|
|
3749
|
-
error: "OpenCode encountered an error"
|
|
3750
|
+
error: "OpenCode encountered an error",
|
|
3751
|
+
question: "OpenCode has a question"
|
|
3750
3752
|
},
|
|
3751
3753
|
sounds: {
|
|
3752
3754
|
permission: null,
|
|
3753
3755
|
complete: null,
|
|
3754
|
-
error: null
|
|
3756
|
+
error: null,
|
|
3757
|
+
question: null
|
|
3755
3758
|
}
|
|
3756
3759
|
};
|
|
3757
3760
|
function getConfigPath() {
|
|
@@ -3793,17 +3796,20 @@ function loadConfig() {
|
|
|
3793
3796
|
events: {
|
|
3794
3797
|
permission: parseEventConfig(userConfig.events?.permission ?? userConfig.permission, defaultWithGlobal),
|
|
3795
3798
|
complete: parseEventConfig(userConfig.events?.complete ?? userConfig.complete, defaultWithGlobal),
|
|
3796
|
-
error: parseEventConfig(userConfig.events?.error ?? userConfig.error, defaultWithGlobal)
|
|
3799
|
+
error: parseEventConfig(userConfig.events?.error ?? userConfig.error, defaultWithGlobal),
|
|
3800
|
+
question: parseEventConfig(userConfig.events?.question, defaultWithGlobal)
|
|
3797
3801
|
},
|
|
3798
3802
|
messages: {
|
|
3799
3803
|
permission: userConfig.messages?.permission ?? DEFAULT_CONFIG.messages.permission,
|
|
3800
3804
|
complete: userConfig.messages?.complete ?? DEFAULT_CONFIG.messages.complete,
|
|
3801
|
-
error: userConfig.messages?.error ?? DEFAULT_CONFIG.messages.error
|
|
3805
|
+
error: userConfig.messages?.error ?? DEFAULT_CONFIG.messages.error,
|
|
3806
|
+
question: userConfig.messages?.question ?? DEFAULT_CONFIG.messages.question
|
|
3802
3807
|
},
|
|
3803
3808
|
sounds: {
|
|
3804
3809
|
permission: userConfig.sounds?.permission ?? DEFAULT_CONFIG.sounds.permission,
|
|
3805
3810
|
complete: userConfig.sounds?.complete ?? DEFAULT_CONFIG.sounds.complete,
|
|
3806
|
-
error: userConfig.sounds?.error ?? DEFAULT_CONFIG.sounds.error
|
|
3811
|
+
error: userConfig.sounds?.error ?? DEFAULT_CONFIG.sounds.error,
|
|
3812
|
+
question: userConfig.sounds?.question ?? DEFAULT_CONFIG.sounds.question
|
|
3807
3813
|
}
|
|
3808
3814
|
};
|
|
3809
3815
|
} catch {
|
|
@@ -3983,7 +3989,7 @@ async function handleEvent(config, eventType) {
|
|
|
3983
3989
|
}
|
|
3984
3990
|
await Promise.allSettled(promises);
|
|
3985
3991
|
}
|
|
3986
|
-
var NotifierPlugin = async () => {
|
|
3992
|
+
var NotifierPlugin = async ({ project, client, $, directory, worktree }) => {
|
|
3987
3993
|
const config = loadConfig();
|
|
3988
3994
|
return {
|
|
3989
3995
|
event: async ({ event }) => {
|
|
@@ -4002,6 +4008,11 @@ var NotifierPlugin = async () => {
|
|
|
4002
4008
|
},
|
|
4003
4009
|
"permission.ask": async () => {
|
|
4004
4010
|
await handleEvent(config, "permission");
|
|
4011
|
+
},
|
|
4012
|
+
"tool.execute.before": async (input, output) => {
|
|
4013
|
+
if (input.tool === "question") {
|
|
4014
|
+
await handleEvent(config, "question");
|
|
4015
|
+
}
|
|
4005
4016
|
}
|
|
4006
4017
|
};
|
|
4007
4018
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohak34/opencode-notifier",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "OpenCode plugin that sends system notifications and plays sounds when permission is needed, generation completes, or errors occur",
|
|
5
5
|
"author": "mohak34",
|
|
6
6
|
"license": "MIT",
|
|
Binary file
|