notify on certain tool calls

This commit is contained in:
2026-03-04 19:51:45 +00:00
parent 28744eff78
commit ccb81eecf5
@@ -74,12 +74,21 @@ function sendNotification(): void {
notifyLocal(); notifyLocal();
} }
const ACTION_NOTIFY_TOOLS = new Set(["question", "questionnaire"]);
export default function (pi: ExtensionAPI) { export default function (pi: ExtensionAPI) {
pi.on("agent_end", async (_event, ctx) => { pi.on("agent_end", async (_event, ctx) => {
if (!ctx.hasUI) return; if (!ctx.hasUI) return;
sendNotification(); 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 // Simple test command
pi.registerCommand("notify", { pi.registerCommand("notify", {
description: "Test notification", description: "Test notification",