diff --git a/NOTICE b/NOTICE index 63ccbf7..1015e64 100644 --- a/NOTICE +++ b/NOTICE @@ -8,7 +8,8 @@ projects, each retaining its original license: extensions/notify.ts Derived from mitsuhiko/agent-stuff (Apache-2.0): https://github.com/mitsuhiko/agent-stuff/blob/main/extensions/notify.ts - Modified: simplified to OSC 777 notifications only. + Modified: simplified to OSC 777 notifications only; notify on agent_settled + rather than agent_end. extensions/goal.ts Derived from mitsuhiko/agent-stuff (Apache-2.0): diff --git a/extensions/notify.ts b/extensions/notify.ts index 10151e1..6e629bc 100644 --- a/extensions/notify.ts +++ b/extensions/notify.ts @@ -4,6 +4,10 @@ * Sends a native terminal notification via OSC 777 when Pi is done and * waiting for input. Works in Ghostty, iTerm2, WezTerm, and rxvt-unicode. * + * Pi's own OSC 7501 program status (1.1.0+) reports state to terminals that + * support that protocol; Ghostty does not, so this stays the only thing that + * raises a notification here. + * * Derived from [mitsuhiko/agent-stuff * `extensions/notify.ts`](https://github.com/mitsuhiko/agent-stuff/blob/main/extensions/notify.ts) * (Apache-2.0) — simplified to OSC 777 only; also mirrored in pi's examples. @@ -12,7 +16,10 @@ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent"; export default function (pi: ExtensionAPI) { - pi.on("agent_end", async () => { + // `agent_end` fires after each low-level run, so it can notify while Pi is + // still retrying, compacting, or working through queued follow-ups. + // `agent_settled` is the final, notification-only boundary. + pi.on("agent_settled", async () => { process.stdout.write("\x1b]777;notify;Pi;Ready for input\x07"); }); }