mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-07-10 16:35:43 +08:00
fix(chat): notify for background permission requests
Permission audio was guarded by the visible session check. Tool approvals in background sessions were therefore silent. Keep banner state session-scoped while playing the existing sound globally.
This commit is contained in:
@@ -270,6 +270,10 @@ export function useChatRealtimeHandlers({
|
|||||||
|
|
||||||
case 'permission_request': {
|
case 'permission_request': {
|
||||||
if (!msg.requestId) break;
|
if (!msg.requestId) break;
|
||||||
|
if (isActionablePermissionRequest({ toolName: msg.toolName })) {
|
||||||
|
void playNotificationSound();
|
||||||
|
}
|
||||||
|
|
||||||
if (sid === activeViewSessionId) {
|
if (sid === activeViewSessionId) {
|
||||||
const previousPendingPermissionRequests = pendingPermissionRequestsRef.current;
|
const previousPendingPermissionRequests = pendingPermissionRequestsRef.current;
|
||||||
if (!previousPendingPermissionRequests.some((request) => request.requestId === msg.requestId)) {
|
if (!previousPendingPermissionRequests.some((request) => request.requestId === msg.requestId)) {
|
||||||
@@ -284,13 +288,6 @@ export function useChatRealtimeHandlers({
|
|||||||
|
|
||||||
pendingPermissionRequestsRef.current = nextPendingPermissionRequests;
|
pendingPermissionRequestsRef.current = nextPendingPermissionRequests;
|
||||||
setPendingPermissionRequests(nextPendingPermissionRequests);
|
setPendingPermissionRequests(nextPendingPermissionRequests);
|
||||||
|
|
||||||
if (
|
|
||||||
isActionablePermissionRequest({ toolName: msg.toolName })
|
|
||||||
&& !hasActionablePermissionRequests(previousPendingPermissionRequests)
|
|
||||||
) {
|
|
||||||
void playNotificationSound();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sid) {
|
if (sid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user