@mohak34/opencode-notifier 0.1.28 → 0.1.29-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.
Files changed (2) hide show
  1. package/dist/index.js +18 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3760,7 +3760,8 @@ var DEFAULT_CONFIG = {
3760
3760
  subagent_complete: { sound: false, notification: false },
3761
3761
  error: { ...DEFAULT_EVENT_CONFIG },
3762
3762
  question: { ...DEFAULT_EVENT_CONFIG },
3763
- interrupted: { ...DEFAULT_EVENT_CONFIG }
3763
+ interrupted: { ...DEFAULT_EVENT_CONFIG },
3764
+ user_cancelled: { sound: false, notification: false }
3764
3765
  },
3765
3766
  messages: {
3766
3767
  permission: "Session needs permission: {sessionTitle}",
@@ -3768,7 +3769,8 @@ var DEFAULT_CONFIG = {
3768
3769
  subagent_complete: "Subagent task completed: {sessionTitle}",
3769
3770
  error: "Session encountered an error: {sessionTitle}",
3770
3771
  question: "Session has a question: {sessionTitle}",
3771
- interrupted: "Session was interrupted: {sessionTitle}"
3772
+ interrupted: "Session was interrupted: {sessionTitle}",
3773
+ user_cancelled: "Session was cancelled by user: {sessionTitle}"
3772
3774
  },
3773
3775
  sounds: {
3774
3776
  permission: null,
@@ -3776,7 +3778,8 @@ var DEFAULT_CONFIG = {
3776
3778
  subagent_complete: null,
3777
3779
  error: null,
3778
3780
  question: null,
3779
- interrupted: null
3781
+ interrupted: null,
3782
+ user_cancelled: null
3780
3783
  },
3781
3784
  volumes: {
3782
3785
  permission: 1,
@@ -3784,7 +3787,8 @@ var DEFAULT_CONFIG = {
3784
3787
  subagent_complete: 1,
3785
3788
  error: 1,
3786
3789
  question: 1,
3787
- interrupted: 1
3790
+ interrupted: 1,
3791
+ user_cancelled: 1
3788
3792
  }
3789
3793
  };
3790
3794
  function getConfigPath() {
@@ -3860,7 +3864,8 @@ function loadConfig() {
3860
3864
  subagent_complete: parseEventConfig(userConfig.events?.subagent_complete ?? userConfig.subagent_complete, { sound: false, notification: false }),
3861
3865
  error: parseEventConfig(userConfig.events?.error ?? userConfig.error, defaultWithGlobal),
3862
3866
  question: parseEventConfig(userConfig.events?.question ?? userConfig.question, defaultWithGlobal),
3863
- interrupted: parseEventConfig(userConfig.events?.interrupted ?? userConfig.interrupted, defaultWithGlobal)
3867
+ interrupted: parseEventConfig(userConfig.events?.interrupted ?? userConfig.interrupted, defaultWithGlobal),
3868
+ user_cancelled: parseEventConfig(userConfig.events?.user_cancelled ?? userConfig.user_cancelled, { sound: false, notification: false })
3864
3869
  },
3865
3870
  messages: {
3866
3871
  permission: userConfig.messages?.permission ?? DEFAULT_CONFIG.messages.permission,
@@ -3868,7 +3873,8 @@ function loadConfig() {
3868
3873
  subagent_complete: userConfig.messages?.subagent_complete ?? DEFAULT_CONFIG.messages.subagent_complete,
3869
3874
  error: userConfig.messages?.error ?? DEFAULT_CONFIG.messages.error,
3870
3875
  question: userConfig.messages?.question ?? DEFAULT_CONFIG.messages.question,
3871
- interrupted: userConfig.messages?.interrupted ?? DEFAULT_CONFIG.messages.interrupted
3876
+ interrupted: userConfig.messages?.interrupted ?? DEFAULT_CONFIG.messages.interrupted,
3877
+ user_cancelled: userConfig.messages?.user_cancelled ?? DEFAULT_CONFIG.messages.user_cancelled
3872
3878
  },
3873
3879
  sounds: {
3874
3880
  permission: userConfig.sounds?.permission ?? DEFAULT_CONFIG.sounds.permission,
@@ -3876,7 +3882,8 @@ function loadConfig() {
3876
3882
  subagent_complete: userConfig.sounds?.subagent_complete ?? DEFAULT_CONFIG.sounds.subagent_complete,
3877
3883
  error: userConfig.sounds?.error ?? DEFAULT_CONFIG.sounds.error,
3878
3884
  question: userConfig.sounds?.question ?? DEFAULT_CONFIG.sounds.question,
3879
- interrupted: userConfig.sounds?.interrupted ?? DEFAULT_CONFIG.sounds.interrupted
3885
+ interrupted: userConfig.sounds?.interrupted ?? DEFAULT_CONFIG.sounds.interrupted,
3886
+ user_cancelled: userConfig.sounds?.user_cancelled ?? DEFAULT_CONFIG.sounds.user_cancelled
3880
3887
  },
3881
3888
  volumes: {
3882
3889
  permission: parseVolume(userConfig.volumes?.permission, DEFAULT_CONFIG.volumes.permission),
@@ -3884,7 +3891,8 @@ function loadConfig() {
3884
3891
  subagent_complete: parseVolume(userConfig.volumes?.subagent_complete, DEFAULT_CONFIG.volumes.subagent_complete),
3885
3892
  error: parseVolume(userConfig.volumes?.error, DEFAULT_CONFIG.volumes.error),
3886
3893
  question: parseVolume(userConfig.volumes?.question, DEFAULT_CONFIG.volumes.question),
3887
- interrupted: parseVolume(userConfig.volumes?.interrupted, DEFAULT_CONFIG.volumes.interrupted)
3894
+ interrupted: parseVolume(userConfig.volumes?.interrupted, DEFAULT_CONFIG.volumes.interrupted),
3895
+ user_cancelled: parseVolume(userConfig.volumes?.user_cancelled, DEFAULT_CONFIG.volumes.user_cancelled)
3888
3896
  }
3889
3897
  };
3890
3898
  } catch {
@@ -4402,12 +4410,13 @@ var NotifierPlugin = async ({ client, directory }) => {
4402
4410
  if (event.type === "session.error") {
4403
4411
  const sessionID = getSessionIDFromEvent(event);
4404
4412
  markSessionError(sessionID);
4413
+ const eventType = event.properties.error?.name === "MessageAbortedError" ? "user_cancelled" : "error";
4405
4414
  let sessionTitle = null;
4406
4415
  if (sessionID && config.showSessionTitle) {
4407
4416
  const info = await getSessionInfo(client, sessionID);
4408
4417
  sessionTitle = info.title;
4409
4418
  }
4410
- await handleEventWithElapsedTime(client, config, "error", projectName, event, undefined, sessionTitle);
4419
+ await handleEventWithElapsedTime(client, config, eventType, projectName, event, undefined, sessionTitle);
4411
4420
  }
4412
4421
  },
4413
4422
  "permission.ask": async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohak34/opencode-notifier",
3
- "version": "0.1.28",
3
+ "version": "0.1.29-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",