The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): drop the session-teardown import that closed a store import cycle (review)
alt-glitch79e6a3b42d4d
diff --git a/apps/desktop/src/lib/chat-messages/index.ts b/apps/desktop/src/lib/chat-messages/index.tsindex 404956b6f01..73f646c1b07 100644--- a/apps/desktop/src/lib/chat-messages/index.ts+++ b/apps/desktop/src/lib/chat-messages/index.ts@@ -15,8 +15,7 @@ export {reasoningPart,reasoningTextFromDetails,renderMediaTags,- textPart,- turnHasReply+ textPart} from './parts'export type { UnspokenTurnSpeech } from './parts'export {diff --git a/apps/desktop/src/lib/chat-messages/parts.ts b/apps/desktop/src/lib/chat-messages/parts.tsindex c05f943735b..dd468f9b1fa 100644--- a/apps/desktop/src/lib/chat-messages/parts.ts+++ b/apps/desktop/src/lib/chat-messages/parts.ts@@ -317,27 +317,6 @@ export function chatMessageText(message: ChatMessage): string {return partsText(message.parts)}-/** Whether the newest turn has a visible assistant reply (text or an error) after its user message. */-export function turnHasReply(messages: ChatMessage[]): boolean {- for (let index = messages.length - 1; index >= 0; index -= 1) {- const message = messages[index]-- if (message.hidden) {- continue- }-- if (message.role === 'user') {- return false- }-- if (message.role === 'assistant' && (message.error || chatMessageText(message).trim())) {- return true- }- }-- return false-}-export interface UnspokenTurnSpeech {/** First unspoken assistant bubble — stable for the turn, the live speech session binds to it. */id: stringdiff --git a/apps/desktop/src/store/connection-request.ts b/apps/desktop/src/store/connection-request.tsindex 48f0621bbb7..b67b7ad9339 100644--- a/apps/desktop/src/store/connection-request.ts+++ b/apps/desktop/src/store/connection-request.ts@@ -131,7 +131,7 @@ export const $connectionRequests = atom<Record<string, ConnectionRequest>>({})/** Settled operations the session's current one replaced, oldest first. Their cards stay drawn on the* rows that opened them: every settled install card, and the last settled connect card when the current* operation is an install one. A later connect operation still replaces the connect card, so consecutive- * connect calls show one card. `dropSessionState` clears a session's entries when its runtime ends. */+ * connect calls show one card. */const $keptConnectionRequests = atom<Record<string, ConnectionRequest[]>>({})/** The key a tool row's args carry its operation id under, written when `connection.request` arrives.diff --git a/apps/desktop/src/store/session-states.ts b/apps/desktop/src/store/session-states.tsindex 290275b37a6..1c5b76d3525 100644--- a/apps/desktop/src/store/session-states.ts+++ b/apps/desktop/src/store/session-states.ts@@ -33,7 +33,7 @@ import {} from '@/components/pane-shell/tree/store'import { resolveRememberedActivePane, workspaceScopeKey } from '@/components/pane-shell/workspace-scope'import type { WorkspaceMode } from '@/contrib/types'-import { type ChatMessage, finalizeInterruptedMessages, sealOpenToolParts, turnHasReply } from '@/lib/chat-messages'+import { type ChatMessage, chatMessageText, finalizeInterruptedMessages, sealOpenToolParts } from '@/lib/chat-messages'import type { ErrorSurface } from '@/lib/error-surface'import { tileFocusStampOnFocusChange } from '@/lib/session-timer-since'import { stableArray } from '@/lib/stable-array'@@ -42,7 +42,6 @@ import type { SessionInfo } from '@/types/hermes'import { dropStatusDrawersForProfile, migrateStatusDrawersForProfile } from './composer-status-drawer'import { registryConnectionKind } from './connection-registry-state'-import { clearConnectionRequest } from './connection-request'import { recordDislike } from './desktop-metrics'import { dialedGatewayModeFor } from './gateway'import {@@ -571,6 +570,26 @@ function settleEndedLiveTurn(runtimeId: string) {const NO_REPLY_SURFACE: ErrorSurface = { code: 'no_reply', layer: 'runtime', retryable: true }const NO_REPLY_ERROR = 'Hermes ended this turn without a reply.'+function turnHasReply(messages: ChatMessage[]): boolean {+ for (let index = messages.length - 1; index >= 0; index -= 1) {+ const message = messages[index]++ if (message.hidden) {+ continue+ }++ if (message.role === 'user') {+ return false+ }++ if (message.role === 'assistant' && (message.error || chatMessageText(message).trim())) {+ return true+ }+ }++ return false+}+function withNoReplyNotice(messages: ChatMessage[]): ChatMessage[] {const last = messages.findLast(message => !message.hidden)@@ -1027,8 +1046,6 @@ export function dropSessionState(runtimeId: string) {clearWatchdog(runtimeId)clearEventSilence(runtimeId)clearSessionProviderWait(runtimeId)- // Connection cards (the open one and every settled install card) are keyed by the runtime id.- clearConnectionRequest(undefined, runtimeId)sessionScopeByRuntimeId.delete(runtimeId)sessionOwnerByRuntimeId.delete(runtimeId)// A runtime that never bound a stored id never will now (#73890).@@ -1066,7 +1083,6 @@ export function clearAllSessionStates() {settledExpiry.clear()unconfirmedReconnectSettles.clear()clearAllProviderWaits()- clearConnectionRequest()sessionScopeByRuntimeId.clear()sessionOwnerByRuntimeId.clear()forgetPendingRuntimeTabs()