From 1f642c6b6688d258c1a8ee4e7a4a0a0c477c798f Mon Sep 17 00:00:00 2001 From: Azreen Jamal Date: Tue, 10 Mar 2026 01:34:46 +0800 Subject: [PATCH] feat(nexus): OS notification + terminal bell when sub-agent finishes --- extensions/nexus.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/extensions/nexus.ts b/extensions/nexus.ts index ee4f33f..ff37067 100644 --- a/extensions/nexus.ts +++ b/extensions/nexus.ts @@ -514,6 +514,18 @@ export default function nexus(pi: ExtensionAPI) { }); } + function notifyOS(title: string, message: string) { + // macOS notification via osascript + try { + cpSpawn("osascript", [ + "-e", + `display notification "${message.replace(/"/g, '\\"')}" with title "${title.replace(/"/g, '\\"')}" sound name "Glass"`, + ], { stdio: "ignore", detached: true }).unref(); + } catch {} + // Also ring the terminal bell as fallback + process.stdout.write("\x07"); + } + function spawnAndDeliver(a: SubAgent, prompt: string, ctx: ExtensionContext, isCont: boolean) { spawnProcess(a, prompt, ctx, isCont).then(({ output, exitCode }) => { const status = exitCode === 0 ? "โœ“" : "โœ—"; @@ -523,6 +535,12 @@ export default function nexus(pi: ExtensionAPI) { ctx.ui.notify(`#${a.id} [${a.role}] ${status} ${elapsed}s`, exitCode === 0 ? "info" : "error"); + // ๐Ÿ”” OS notification so user is alerted even when away from terminal + notifyOS( + `Nexus #${a.id} [${a.role}] ${status}`, + `${elapsed}s ยท ${a.toolCount} tools ยท ${a.task.slice(0, 60)}`, + ); + pi.sendMessage({ customType: "nexus-result", content: `**Sub-agent #${a.id}** [${a.role}]${turn} โ€” ${status} ${elapsed}s | ${a.toolCount} tools | $${a.cost.toFixed(4)}\n\n${truncated}`,