The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
simplify(desktop): a finished card tool no longer drops its card in every window
alt-glitcheb7f9455b514
diff --git a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.ts b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.tsindex b3c4c93b51d..4815d498527 100644--- a/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.ts+++ b/apps/desktop/src/app/session/hooks/use-message-stream/gateway-event/tools.ts@@ -9,11 +9,10 @@ import { refreshBackgroundProcesses } from '@/store/composer-status'import { flashPetActivity, setPetActivity } from '@/store/pet'import { recordPreviewArtifact, reofferPreviewArtifact } from '@/store/preview-status'import { $sessionStates, storedSessionIdForRuntimeId } from '@/store/session-states'-import { dropSetupBeatForCall, setupBeatResult } from '@/store/setup-beat'+import { setupBeatResult } from '@/store/setup-beat'import { isTerminalSubagentCompletion, pruneDelegateFallbackSubagents, upsertSubagent } from '@/store/subagents'import { reportMcpToolResult } from '@/store/suggestion-providers/repair'import { invalidateSkillSuggestionIndex } from '@/store/suggestion-providers/skill'-import { dropThemePick } from '@/store/theme-pick'import { restoreSessionTodosFromSnapshot } from '@/store/todos'import { setSessionDraftingTool } from '@/store/tool-drafting'import { notifyWorkspaceChanged, toolChangedPath, toolMayMutateFiles } from '@/store/workspace-events'@@ -44,21 +43,12 @@ function recordToolPreview(ctx: GatewayEventContext, sessionId: string, cwd: str}}-// A card's tool finished, so the card is done in this window too: answered in another window, or its-// cancel was lost. Without this it would keep taking typed text.-const SETTLED_CARDS = new Map([- ['set_theme', dropThemePick],- ['setup_beat', dropSetupBeatForCall]-])--/** What a completed tool leaves behind outside its row: a preview target, a settled card, or a committed layout. */+/** What a completed tool leaves behind outside its row: a preview target or a committed layout. */function noteToolOutcome(ctx: GatewayEventContext, sessionId: string, cwd: string, pendingProduction: boolean): void {if (!ctx.deps.sessionInterrupted(sessionId)) {recordToolPreview(ctx, sessionId, cwd, pendingProduction)}- SETTLED_CARDS.get(ctx.payload?.name ?? '')?.(sessionId, ctx.payload?.tool_id)-if (!ctx.event.replayed && appliedLayout(ctx.payload?.name, ctx.payload?.result)) {leaveIntroOnLayout()}diff --git a/apps/desktop/src/store/setup-beat.test.ts b/apps/desktop/src/store/setup-beat.test.tsindex e27a7093b3e..dc7d852c25e 100644--- a/apps/desktop/src/store/setup-beat.test.ts+++ b/apps/desktop/src/store/setup-beat.test.ts@@ -6,7 +6,7 @@ import { setupBeatOutcome } from '@/components/assistant-ui/setup-beat/receipt'import { $onboardingSession } from './onboarding-session'import { answerParkedCard, parkedCardWaiting, sessionOnboardingCardWaiting } from './parked-card-answers'import { rememberServerRequest, resetServerRequestsForTests } from './server-requests'-import { $setupBeatRequests, answerSetupBeat, clearSetupBeat, dropSetupBeatForCall, parkSetupBeat } from './setup-beat'+import { $setupBeatRequests, answerSetupBeat, clearSetupBeat, parkSetupBeat } from './setup-beat'function parkNameCard(requestId: string, open = true) {const respond = vi.fn()@@ -68,16 +68,11 @@ describe('setup_beat card', () => {off()})- it('keeps a card whose answer could not be sent, and drops it once its call finishes elsewhere', () => {+ it('keeps a card whose answer could not be sent', () => {parkNameCard('srq-4', false)expect(answerSetupBeat('rt-1', { name: 'Sid' })).toBe(false)expect($setupBeatRequests.get()['rt-1']?.requestId).toBe('srq-4')-- dropSetupBeatForCall('rt-1', 'call-other')- expect($setupBeatRequests.get()['rt-1']).toBeDefined()- dropSetupBeatForCall('rt-1', 'call-srq-4')- expect($setupBeatRequests.get()['rt-1']).toBeUndefined()})it('collapses every way a card can close to a receipt, and draws nothing for a card-less call', () => {diff --git a/apps/desktop/src/store/setup-beat.ts b/apps/desktop/src/store/setup-beat.tsindex 35c6eec782c..582a28c7132 100644--- a/apps/desktop/src/store/setup-beat.ts+++ b/apps/desktop/src/store/setup-beat.ts@@ -98,15 +98,6 @@ export function dropSetupBeat(sessionId: string): void {}}-/** The setup_beat call `toolCallId` finished: its card is done here too, wherever it was answered. */-export function dropSetupBeatForCall(sessionId: string, toolCallId: string | undefined): void {- const request = $setupBeatRequests.get()[sessionId]-- if (request && toolCallId && request.toolCallId === toolCallId) {- clearSetupBeat(request.requestId, sessionId)- }-}-// The card clears only once the answer is sent, so a failed send leaves it on screen to answer again.function respond(sessionId: string,diff --git a/apps/desktop/src/store/theme-pick.ts b/apps/desktop/src/store/theme-pick.tsindex 33774ae08cc..8852fc138cd 100644--- a/apps/desktop/src/store/theme-pick.ts+++ b/apps/desktop/src/store/theme-pick.ts@@ -52,15 +52,6 @@ function answer(sessionId: string, result: ThemePickResult): boolean {return true}-/** The set_theme call finished: its picker is done here too, wherever it was answered. */-export function dropThemePick(sessionId: string): void {- const request = $themePicks.get()[sessionId]-- if (request) {- clearThemePick(request.requestId, sessionId)- }-}-/** Apply the user's pick and answer the session's card with it. False when no card waits or the value is unknown. */export function pickTheme(sessionId: string, values: AppearanceValues): boolean {const applied = applyAppearance(values)