Title: No Windows system notification when a session finishes or the agent needs user input
Describe the problem
When a pi-web session finishes, or when the agent is blocked waiting for user
input (extension dialogs such as confirm/select/input/editor, or a pending
prompt awaiting approval), no system notification is shown on Windows. The user
must keep watching the tab.
Steps to reproduce
- Run pi-web on Windows (Edge/Chrome), grant notification permission.
- Start a task, then switch to another window (e.g. VS Code) while keeping the
pi-web tab visible (not minimized, not backgrounded as a tab).
- When the session completes → no Windows toast appears.
For input prompts:
- Trigger an extension dialog (confirm/select/input) or a prompt that requires
approval.
- Switch to another window → only an in-page dialog + sound plays, no
Windows toast.
Root cause
components/AppShell.tsx handleAgentEnd returns early when
document.visibilityState === "visible". Being covered by another window
(blurred but visible tab) never fires the notification.
- There is no notification at all for pending user input: extension dialogs
(setExtensionDialog in hooks/useAgentSession.ts) and agent prompts
(isPromptRunning) are in-page only.
Expected behavior
- Fire a Windows toast (Web Notification via the existing
showCompletionNotification helper) whenever the window/tab is not focused
(!document.hasFocus()), not just when hidden.
- Fire a toast when the agent needs user input (extension dialog or pending
prompt), e.g. title "Pi needs your attention", clicking it focuses the
window and scrolls to the dialog.
- If permission is
denied, surface an in-app hint directing users to enable
notifications for the site (or prompt to install the PWA).
Suggested implementation
- Replace the visibility check with
document.hasFocus() in handleAgentEnd.
- Add an
onAttentionNeeded callback (mirroring onAgentEnd /
wrappedOnAgentEnd in components/ChatWindow.tsx) fired from
handleExtensionUiRequest (confirm/select/input/editor) and when
isPromptRunning transitions to true.
- Optionally, a server-side native toast route (e.g.
node-notifier or a
PowerShell WinRT toast) for a fully native, browser-independent popup.
Environment: pi-web 0.8.6, Windows 10/11, Edge/Chrome.
Title: No Windows system notification when a session finishes or the agent needs user input
Describe the problem
When a pi-web session finishes, or when the agent is blocked waiting for user
input (extension dialogs such as confirm/select/input/editor, or a pending
prompt awaiting approval), no system notification is shown on Windows. The user
must keep watching the tab.
Steps to reproduce
pi-web tab visible (not minimized, not backgrounded as a tab).
For input prompts:
approval.
Windows toast.
Root cause
components/AppShell.tsxhandleAgentEndreturns early whendocument.visibilityState === "visible". Being covered by another window(blurred but visible tab) never fires the notification.
(
setExtensionDialoginhooks/useAgentSession.ts) and agent prompts(
isPromptRunning) are in-page only.Expected behavior
showCompletionNotificationhelper) whenever the window/tab is not focused(
!document.hasFocus()), not just when hidden.prompt), e.g. title "Pi needs your attention", clicking it focuses the
window and scrolls to the dialog.
denied, surface an in-app hint directing users to enablenotifications for the site (or prompt to install the PWA).
Suggested implementation
document.hasFocus()inhandleAgentEnd.onAttentionNeededcallback (mirroringonAgentEnd/wrappedOnAgentEndincomponents/ChatWindow.tsx) fired fromhandleExtensionUiRequest(confirm/select/input/editor) and whenisPromptRunningtransitions to true.node-notifieror aPowerShell WinRT toast) for a fully native, browser-independent popup.
Environment: pi-web 0.8.6, Windows 10/11, Edge/Chrome.