The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(bots): type the compression-tip tile probe off the SDK host
Brooklyn Nicholson3ace90ae4b8d
diff --git a/apps/desktop/src/plugins/hermes-bots/canonical-chat-stale-tiles.test.ts b/apps/desktop/src/plugins/hermes-bots/canonical-chat-stale-tiles.test.tsindex 929de74349f..704c9df08df 100644--- a/apps/desktop/src/plugins/hermes-bots/canonical-chat-stale-tiles.test.ts+++ b/apps/desktop/src/plugins/hermes-bots/canonical-chat-stale-tiles.test.ts@@ -42,6 +42,7 @@ vi.mock('./shared', () => ({ getPluginCtx: () => null }))async function loadModule() {vi.resetModules()+return import('./canonical-chat')}@@ -54,6 +55,7 @@ beforeEach(() => {if (method === 'session.list') {return { sessions: [{ id: 'root-1', resolved_id: 'tip-9', root_title: 'Bot Chat', title: 'Bot Chat' }] }}+return {}})})diff --git a/apps/desktop/src/plugins/hermes-bots/canonical-chat.ts b/apps/desktop/src/plugins/hermes-bots/canonical-chat.tsindex e0faeb1a286..ffb11653e95 100644--- a/apps/desktop/src/plugins/hermes-bots/canonical-chat.ts+++ b/apps/desktop/src/plugins/hermes-bots/canonical-chat.ts@@ -147,34 +147,23 @@ async function openStoredBotChat(// previous time this bot was open — which left the pane showing old messages// until an app restart (hermes-agent#93604). A resume is cheap and// idempotent, so on this explicit user navigation we always request one.- // Discard a stale canonical-titled tile before opening the tip: compression- // rotates the tip while tiles stay keyed by segment, and hidden Bot Chats- // never enter the sidebar listing the lineage guard reads, so without this- // probe the old-segment tile survives beside the tip (hermes-agent#120810).- // Same owner-scoped probe the roster click runs; side tabs keep any other- // title. ponytail: probe-only reconcile here, full lineage walk if hidden- // lineages ever rejoin the listing.+ //+ // Compression rotates the tip while tiles stay keyed by segment, and hidden+ // Bot Chats never reach the sidebar listing the lineage guard reads, so the+ // old-segment tile is discarded here or it survives beside the tip+ // (hermes-agent#120810). Same owner-scoped probe the roster click runs.+ const canonicalIds = [...new Set([summary?.id, storedId].filter(Boolean).map(String))]+try {- // SAFETY: plugin SDK host gains optional hooks per shell version; the- // single-as narrows only for feature detection, never to bypass types.- const focusHook = (- host as { focusOpenWorkspaceSession?: (- ownerKey: string,- probe: (tile: { storedSessionId: string; workspaceTabTitle?: string }) => boolean,- onlyIds: readonly string[]- ) => null | string }- ).focusOpenWorkspaceSession- if (typeof focusHook === 'function') {- const canonicalIds = [...new Set([String(summary?.id ?? ''), String(storedId ?? '')].filter(Boolean))]- const isStaleTile = (tile: { storedSessionId: string; workspaceTabTitle?: string }) =>- typeof tile.workspaceTabTitle === 'string' &&- tile.workspaceTabTitle === CANONICAL_CHAT_TITLE &&- !canonicalIds.includes(String(tile.storedSessionId))- focusHook(ownerKey, isStaleTile, canonicalIds)- }+ host.focusOpenWorkspaceSession?.(+ ownerKey,+ tile => tile.workspaceTabTitle === CANONICAL_CHAT_TITLE && !canonicalIds.includes(String(tile.storedSessionId)),+ canonicalIds+ )} catch {- /* older shells without the focus hook — the tip open below still lands */+ // Older shells: the tip open below still lands.}+await host.openSession(storedId, {...(route? {