@mohak34/opencode-notifier 0.1.2 → 0.1.4
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/dist/index.js +1 -20
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -3826,11 +3826,7 @@ function getSoundPath(config, event) {
|
|
|
3826
3826
|
// src/notify.ts
|
|
3827
3827
|
var import_node_notifier = __toESM(require_node_notifier(), 1);
|
|
3828
3828
|
var NOTIFICATION_TITLE = "OpenCode";
|
|
3829
|
-
function debug(msg) {
|
|
3830
|
-
console.error(`[opencode-notifier] ${msg}`);
|
|
3831
|
-
}
|
|
3832
3829
|
async function sendNotification(message, timeout) {
|
|
3833
|
-
debug(`Sending notification: "${message}" (timeout: ${timeout}s)`);
|
|
3834
3830
|
return new Promise((resolve) => {
|
|
3835
3831
|
import_node_notifier.default.notify({
|
|
3836
3832
|
title: NOTIFICATION_TITLE,
|
|
@@ -3838,12 +3834,7 @@ async function sendNotification(message, timeout) {
|
|
|
3838
3834
|
sound: false,
|
|
3839
3835
|
timeout,
|
|
3840
3836
|
icon: undefined
|
|
3841
|
-
}, (
|
|
3842
|
-
if (err) {
|
|
3843
|
-
debug(`Notification error: ${err}`);
|
|
3844
|
-
} else {
|
|
3845
|
-
debug(`Notification sent. Response: ${response}, Metadata: ${JSON.stringify(metadata)}`);
|
|
3846
|
-
}
|
|
3837
|
+
}, () => {
|
|
3847
3838
|
resolve();
|
|
3848
3839
|
});
|
|
3849
3840
|
});
|
|
@@ -3934,32 +3925,22 @@ async function playSound(event, customPath) {
|
|
|
3934
3925
|
}
|
|
3935
3926
|
|
|
3936
3927
|
// src/index.ts
|
|
3937
|
-
function debug2(msg) {
|
|
3938
|
-
console.error(`[opencode-notifier] ${msg}`);
|
|
3939
|
-
}
|
|
3940
3928
|
async function handleEvent(config, eventType) {
|
|
3941
|
-
debug2(`Handling event: ${eventType}`);
|
|
3942
|
-
debug2(`Config for ${eventType}: sound=${isEventSoundEnabled(config, eventType)}, notification=${isEventNotificationEnabled(config, eventType)}`);
|
|
3943
3929
|
const promises = [];
|
|
3944
3930
|
if (isEventNotificationEnabled(config, eventType)) {
|
|
3945
3931
|
const message = getMessage(config, eventType);
|
|
3946
|
-
debug2(`Queueing notification: "${message}"`);
|
|
3947
3932
|
promises.push(sendNotification(message, config.timeout));
|
|
3948
3933
|
}
|
|
3949
3934
|
if (isEventSoundEnabled(config, eventType)) {
|
|
3950
3935
|
const customSoundPath = getSoundPath(config, eventType);
|
|
3951
|
-
debug2(`Queueing sound: ${customSoundPath || "default"}`);
|
|
3952
3936
|
promises.push(playSound(eventType, customSoundPath));
|
|
3953
3937
|
}
|
|
3954
3938
|
await Promise.allSettled(promises);
|
|
3955
|
-
debug2(`Event ${eventType} handled`);
|
|
3956
3939
|
}
|
|
3957
3940
|
var NotifierPlugin = async () => {
|
|
3958
3941
|
const config = loadConfig();
|
|
3959
|
-
debug2(`Plugin loaded. Config: ${JSON.stringify(config)}`);
|
|
3960
3942
|
return {
|
|
3961
3943
|
event: async ({ event }) => {
|
|
3962
|
-
debug2(`Received event: ${event.type}`);
|
|
3963
3944
|
if (event.type === "permission.updated") {
|
|
3964
3945
|
await handleEvent(config, "permission");
|
|
3965
3946
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mohak34/opencode-notifier",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"alerts"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@mohak34/opencode-notifier": "^0.1.2",
|
|
35
36
|
"node-notifier": "^10.0.1"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|