@mohak34/opencode-notifier 0.2.3-beta.0 → 0.2.4-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
@@ -54,7 +54,7 @@ In `opencode-notifier.json` config:
54
54
  "customIconPath": "C:\\Users\\jhon\\Documents\\opencode-logo-dark.png",
55
55
  ```
56
56
 
57
- - If notifications are not showing up, check out: (missing WSL notification)[https://github.com/mikaelbr/node-notifier?tab=readme-ov-file#windows-and-wsl2]
57
+ - If notifications are not showing up, check out: [missing WSL notification](https://github.com/mikaelbr/node-notifier?tab=readme-ov-file#windows-and-wsl2)
58
58
 
59
59
  ## Config file
60
60
 
@@ -160,9 +160,11 @@ Create `~/.config/opencode/opencode-notifier.json` with the defaults:
160
160
  - `showProjectName` - Show folder name in notification title (default: true)
161
161
  - `showSessionTitle` - Include the session title in notification messages via `{sessionTitle}` placeholder (default: false)
162
162
  - `showIcon` - Show OpenCode icon, Windows/Linux only (default: true)
163
+ - `customIconPath` - Path to a custom icon for notifications. Useful on WSL where Windows paths are needed (default: null)
163
164
  - `suppressWhenFocused` - Skip notifications and sounds when the terminal is the active window (default: true). See [Focus detection](#focus-detection) for platform details
164
165
  - `enableOnDesktop` - Run the plugin on Desktop and Web clients (default: false). When false, the plugin only runs on CLI. Set to true if you want notifications/sounds/commands on Desktop/Web — useful if you want custom commands (Telegram, webhooks) but don't care about built-in notifications
165
166
  - `notificationSystem` - macOS only: `"osascript"`, `"node-notifier"`, or `"ghostty"` (default: "osascript"). Use `"ghostty"` if you're running Ghostty terminal for native OSC 9 notifications
167
+ - `minDuration` - Suppress `complete` and `subagent_complete` notifications when session finishes faster than this many seconds (default: 0). See [Minimum duration threshold](#minimum-duration-threshold)
166
168
  - `linux.grouping` - Linux only: replace notifications in-place instead of stacking (default: false). Requires `notify-send` 0.8+
167
169
 
168
170
  ### Events
@@ -453,14 +455,21 @@ If Opencode does not update the plugin or there is an issue with the cache versi
453
455
 
454
456
  ```bash
455
457
  # Linux/macOS
458
+ rm -rf ~/.cache/opencode/packages/@mohak34/opencode-notifier@beta
456
459
  rm -rf ~/.cache/opencode/node_modules/@mohak34/opencode-notifier
457
460
 
458
461
  # Windows
462
+ Remove-Item -Recurse -Force "$env:USERPROFILE\.cache\opencode\packages\@mohak34\opencode-notifier@beta"
459
463
  Remove-Item -Recurse -Force "$env:USERPROFILE\.cache\opencode\node_modules\@mohak34\opencode-notifier"
460
464
  ```
461
465
 
462
466
  Then restart OpenCode.
463
467
 
468
+ Verify installation:
469
+ ```bash
470
+ cat ~/.cache/opencode/packages/@mohak34/opencode-notifier@beta/node_modules/@mohak34/opencode-notifier/package.json | grep version
471
+ ```
472
+
464
473
  ## Troubleshooting
465
474
 
466
475
  **macOS: Not seeing notifications?**
@@ -559,10 +568,19 @@ This is a known Bun issue on Windows. Disable native notifications and use Power
559
568
 
560
569
  **Plugin not loading?**
561
570
 
562
- - Check your opencode.json syntax
571
+ - Check your `opencode.json` or `config.json` syntax
563
572
  - Clear the cache (see Updating section)
564
573
  - Restart OpenCode
565
574
 
575
+ **Plugin installed but no notifications/sounds?**
576
+
577
+ - Check `suppressWhenFocused`: when `true` (default), notifications are skipped while OpenCode terminal is focused. Set to `false` to always notify.
578
+ - Check `enableOnDesktop`: defaults to `false`, so the plugin won't run on Desktop/Web clients. Set to `true` if you need it there.
579
+ - Verify the package is actually cached:
580
+ ```bash
581
+ cat ~/.cache/opencode/packages/@mohak34/opencode-notifier@beta/node_modules/@mohak34/opencode-notifier/package.json | grep version
582
+ ```
583
+
566
584
  ## Changelog
567
585
 
568
586
  See [CHANGELOG.md](CHANGELOG.md)
package/dist/index.js CHANGED
@@ -977,7 +977,7 @@ function isTmuxPaneFocused(tmuxPane, probeResult) {
977
977
  if (!probeResult)
978
978
  return false;
979
979
  const [sessionAttached, windowActive, paneActive] = probeResult.split(" ");
980
- return sessionAttached === "1" && windowActive === "1" && paneActive === "1";
980
+ return Number(sessionAttached) > 0 && windowActive === "1" && paneActive === "1";
981
981
  }
982
982
  function isLinuxTerminalFocused(params) {
983
983
  const { cachedWindowId: cachedWindowId2, currentWindowId, wezTermPaneActive, tmuxPaneActive } = params;
@@ -1709,8 +1709,10 @@ function scheduleSessionIdle(client, config, projectName, event, sessionID) {
1709
1709
  }
1710
1710
  async function handleEventWithElapsedTime(client, config, eventType, projectName, event, elapsedReferenceNowMs, preloadedSessionTitle) {
1711
1711
  const sessionID = getSessionIDFromEvent(event);
1712
- const minDuration = config.command?.minDuration;
1713
- const shouldLookupElapsed = !!config.command?.enabled && typeof config.command?.path === "string" && config.command.path.length > 0 && typeof minDuration === "number" && Number.isFinite(minDuration) && minDuration > 0;
1712
+ const commandMinDuration = config.command?.minDuration;
1713
+ const shouldLookupElapsedForCommand = !!config.command?.enabled && typeof config.command?.path === "string" && config.command.path.length > 0 && typeof commandMinDuration === "number" && Number.isFinite(commandMinDuration) && commandMinDuration > 0;
1714
+ const shouldLookupElapsedForNotification = typeof config.minDuration === "number" && Number.isFinite(config.minDuration) && config.minDuration > 0;
1715
+ const shouldLookupElapsed = shouldLookupElapsedForCommand || shouldLookupElapsedForNotification;
1714
1716
  let elapsedSeconds = null;
1715
1717
  if (shouldLookupElapsed) {
1716
1718
  if (sessionID) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohak34/opencode-notifier",
3
- "version": "0.2.3-beta.0",
3
+ "version": "0.2.4-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",