fix(notifications): improve agent progress notifications and permission handling (#459)
* fix(notifications): dismiss cross-window permissions, retry countdown, subtask filter
This commit is contained in:
committed by
GitHub
parent
2e08501ea5
commit
62e5c3edfe
@@ -28,6 +28,7 @@ interface WorkingSummary {
|
||||
abortActive: boolean;
|
||||
lastCompletionId: string | null;
|
||||
isComplete: boolean;
|
||||
retryInfo: { attempt?: number; next?: number } | null;
|
||||
}
|
||||
|
||||
interface FormingSummary {
|
||||
@@ -70,6 +71,7 @@ const DEFAULT_WORKING: WorkingSummary = {
|
||||
abortActive: false,
|
||||
lastCompletionId: null,
|
||||
isComplete: false,
|
||||
retryInfo: null,
|
||||
};
|
||||
|
||||
const isAssistantMessage = (message: Message): message is AssistantMessageWithState => message.role === 'assistant';
|
||||
@@ -123,6 +125,18 @@ export function useAssistantStatus(): AssistantStatusSnapshot {
|
||||
|
||||
const { phase: activityPhase, isWorking: isPhaseWorking } = useCurrentSessionActivity();
|
||||
|
||||
const sessionRetryAttempt = useSessionStore((state) => {
|
||||
if (!currentSessionId || !state.sessionStatus) return undefined;
|
||||
const s = state.sessionStatus.get(currentSessionId);
|
||||
return s?.type === 'retry' ? s.attempt : undefined;
|
||||
});
|
||||
|
||||
const sessionRetryNext = useSessionStore((state) => {
|
||||
if (!currentSessionId || !state.sessionStatus) return undefined;
|
||||
const s = state.sessionStatus.get(currentSessionId);
|
||||
return s?.type === 'retry' ? s.next : undefined;
|
||||
});
|
||||
|
||||
const sessionMessages = React.useMemo<Array<{ info: Message; parts: Part[] }>>(() => {
|
||||
if (!currentSessionId) {
|
||||
return [];
|
||||
@@ -293,12 +307,14 @@ export function useAssistantStatus(): AssistantStatusSnapshot {
|
||||
isCooldown: false,
|
||||
statusText: null,
|
||||
canAbort: false,
|
||||
retryInfo: null,
|
||||
};
|
||||
}
|
||||
|
||||
const isWorking = isPhaseWorking;
|
||||
const isStreaming = activityPhase === 'busy';
|
||||
const isCooldown = false;
|
||||
const isRetry = activityPhase === 'retry';
|
||||
|
||||
let activity: AssistantActivity = 'idle';
|
||||
if (isWorking) {
|
||||
@@ -309,6 +325,10 @@ export function useAssistantStatus(): AssistantStatusSnapshot {
|
||||
}
|
||||
}
|
||||
|
||||
const retryInfo = isRetry
|
||||
? { attempt: sessionRetryAttempt, next: sessionRetryNext }
|
||||
: null;
|
||||
|
||||
return {
|
||||
activity,
|
||||
hasWorkingContext: isWorking,
|
||||
@@ -328,8 +348,9 @@ export function useAssistantStatus(): AssistantStatusSnapshot {
|
||||
abortActive: false,
|
||||
lastCompletionId: null,
|
||||
isComplete: false,
|
||||
retryInfo,
|
||||
};
|
||||
}, [activityPhase, isPhaseWorking, parsedStatus, abortState]);
|
||||
}, [activityPhase, isPhaseWorking, parsedStatus, abortState, sessionRetryAttempt, sessionRetryNext]);
|
||||
|
||||
const forming = React.useMemo<FormingSummary>(() => {
|
||||
|
||||
@@ -380,6 +401,7 @@ export function useAssistantStatus(): AssistantStatusSnapshot {
|
||||
statusText: 'waiting for permission',
|
||||
isWaitingForPermission: true,
|
||||
canAbort: false,
|
||||
retryInfo: null,
|
||||
};
|
||||
}, [currentSessionId, permissions, baseWorking]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user