feat(notification): add cmux as notification provider

Add cmux as the highest-priority notification provider on macOS.
cmux delivers notifications via native UNUserNotificationCenter,
properly attributed to the cmux app instead of Script Editor.

Notification priority: cmux > terminal-notifier > osascript

Tests cover the full fallback chain:
- cmux available: uses cmux, skips others
- cmux fails: falls back to terminal-notifier
- cmux + terminal-notifier fail: falls back to osascript
- cmux not available: skips to terminal-notifier

Fixes #3628
This commit is contained in:
mrosnerr
2026-04-28 08:35:43 -04:00
parent fbaeb032c0
commit 763ff7e824
3 changed files with 90 additions and 1 deletions
+12 -1
View File
@@ -1,6 +1,7 @@
import type { PluginInput } from "@opencode-ai/plugin"
import { platform } from "os"
import {
getCmuxPath,
getOsascriptPath,
getNotifySendPath,
getPowershellPath,
@@ -40,7 +41,17 @@ export async function sendSessionNotification(
): Promise<void> {
switch (platform) {
case "darwin": {
// Try terminal-notifier first - deterministic click-to-focus
// Try cmux first - native UNUserNotificationCenter, properly attributed
const cmuxPath = await getCmuxPath()
if (cmuxPath) {
try {
await ctx.$`${cmuxPath} notify --title ${title} --body ${message}`.quiet()
break
} catch {
}
}
// Try terminal-notifier - deterministic click-to-focus
const terminalNotifierPath = await getTerminalNotifierPath()
if (terminalNotifierPath) {
const bundleId = process.env.__CFBundleIdentifier