@mohak34/opencode-notifier 0.1.26 → 0.1.27-beta.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/README.md CHANGED
@@ -142,6 +142,30 @@ Or use true/false for both:
142
142
  }
143
143
  ```
144
144
 
145
+ ### Event Filtering
146
+
147
+ Filter which events trigger notifications entirely. Useful when you only want notifications for specific events (e.g., only when OpenCode needs your input):
148
+
149
+ ```json
150
+ {
151
+ "enabledEvents": ["permission", "question"]
152
+ }
153
+ ```
154
+
155
+ - If `enabledEvents` is not specified or empty, all events are enabled (backward compatible)
156
+ - Valid values: `"permission"`, `"complete"`, `"subagent_complete"`, `"error"`, `"question"`, `"interrupted"`
157
+ - Events not in the list will not trigger sounds, notifications, or custom commands
158
+
159
+ Example: Only notify for permission requests and errors:
160
+
161
+ ```json
162
+ {
163
+ "sound": true,
164
+ "notification": true,
165
+ "enabledEvents": ["permission", "error"]
166
+ }
167
+ ```
168
+
145
169
  ### Messages
146
170
 
147
171
  Customize the notification text:
package/dist/index.js CHANGED
@@ -3891,6 +3891,12 @@ function isEventSoundEnabled(config, event) {
3891
3891
  function isEventNotificationEnabled(config, event) {
3892
3892
  return config.events[event].notification;
3893
3893
  }
3894
+ function isEventEnabled(config, event) {
3895
+ if (!config.enabledEvents || config.enabledEvents.length === 0) {
3896
+ return true;
3897
+ }
3898
+ return config.enabledEvents.includes(event);
3899
+ }
3894
3900
  function getMessage(config, event) {
3895
3901
  return config.messages[event];
3896
3902
  }
@@ -4160,6 +4166,9 @@ function getNotificationTitle(config, projectName) {
4160
4166
  return "OpenCode";
4161
4167
  }
4162
4168
  async function handleEvent(config, eventType, projectName, elapsedSeconds, sessionTitle) {
4169
+ if (!isEventEnabled(config, eventType)) {
4170
+ return;
4171
+ }
4163
4172
  const promises = [];
4164
4173
  const rawMessage = getMessage(config, eventType);
4165
4174
  const message = interpolateMessage(rawMessage, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohak34/opencode-notifier",
3
- "version": "0.1.26",
3
+ "version": "0.1.27-beta.0",
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",