From ccb81eecf5f648150fbe39b07e9765151028152a Mon Sep 17 00:00:00 2001 From: "Thomas G. Lopes" Date: Wed, 4 Mar 2026 19:51:45 +0000 Subject: [PATCH] notify on certain tool calls --- pi/files/agent/extensions/pi-done-notify.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pi/files/agent/extensions/pi-done-notify.ts b/pi/files/agent/extensions/pi-done-notify.ts index 5dfc109..26ab8bd 100644 --- a/pi/files/agent/extensions/pi-done-notify.ts +++ b/pi/files/agent/extensions/pi-done-notify.ts @@ -74,12 +74,21 @@ function sendNotification(): void { notifyLocal(); } +const ACTION_NOTIFY_TOOLS = new Set(["question", "questionnaire"]); + export default function (pi: ExtensionAPI) { pi.on("agent_end", async (_event, ctx) => { if (!ctx.hasUI) return; sendNotification(); }); + // Notify when interactive tools are called so the user notices prompts immediately + pi.on("tool_call", async (event, ctx) => { + if (!ctx.hasUI) return; + if (!ACTION_NOTIFY_TOOLS.has(event.toolName)) return; + sendNotification(); + }); + // Simple test command pi.registerCommand("notify", { description: "Test notification",