The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
perf(desktop): keep live deltas out of navigation context
ghgoodreau57864bb220d4
diff --git a/apps/desktop/ENGINEERING.md b/apps/desktop/ENGINEERING.mdindex 7974846ab8e..7d889128720 100644--- a/apps/desktop/ENGINEERING.md+++ b/apps/desktop/ENGINEERING.md@@ -148,6 +148,11 @@ button) reach the OS browser through one explicit bridge instead:Widening any of those three (partition key, trusted-click gate, scheme set)reopens the gesture-less forced-navigation class the advisory closed.+## Rendering work follows visibility and ownership++- Live transcript navigation reads the session store; the shared navigation+ context carries only the selected historical page, not every streamed delta.+## Nous free tier: state is pulled, never latched in the rendererThe free tier (a Nous identity with no account, `hermes_cli/anon_auth.py`) reaches the rendererdiff --git a/apps/desktop/src/app/chat/history-window.test.tsx b/apps/desktop/src/app/chat/history-window.test.tsxindex 2d9f58ea6b2..a665ed031d1 100644--- a/apps/desktop/src/app/chat/history-window.test.tsx+++ b/apps/desktop/src/app/chat/history-window.test.tsx@@ -81,6 +81,32 @@ function mount(storedId = 'stored') {}describe('bounded direct history runtime', () => {+ it('keeps navigation consumers stable while a live assistant reply advances', () => {+ const mounted = mount()++ const live: ChatMessage = {+ id: 'streaming',+ role: 'assistant',+ pending: true,+ parts: [{ type: 'text', text: 'Working' }]+ }++ const prefix = mounted.view.$messages.get()++ act(() => mounted.view.$messages.set([...prefix, live]))+ const navigation = mounted.window++ act(() =>+ mounted.view.$messages.set([...prefix, { ...live, parts: [{ type: 'text', text: 'Working on the next step' }] }])+ )++ expect(mounted.window).toBe(navigation)+ expect(mounted.runtime.thread.getState().messages.at(-1)?.content[0]).toMatchObject({+ type: 'text',+ text: 'Working on the next step'+ })+ })+it('reads one around page and selects it without replacing the live store', async () => {const api = vi.spyOn(window.hermesDesktop, 'api').mockResolvedValue(page(40))const mounted = mount()diff --git a/apps/desktop/src/app/chat/index.tsx b/apps/desktop/src/app/chat/index.tsxindex 89ac18e3541..15bce162933 100644--- a/apps/desktop/src/app/chat/index.tsx+++ b/apps/desktop/src/app/chat/index.tsx@@ -420,6 +420,7 @@ export function ChatRuntimeBoundary({const isHistorical = Boolean(history.page)const newerAvailable = history.page?.newerAvailable ?? falseconst { revealRow, returnToLatest } = history+ const historicalMessages = history.page?.messagesconst transcriptWindow = useMemo(() => ({@@ -427,11 +428,13 @@ export function ChatRuntimeBoundary({expandWindow,revealRow,returnToLatest,- currentMessages,+ // Live navigation reads the session store. Broadcasting the changing+ // live tail here invalidates the entire transcript's navigation context.+ currentMessages: historicalMessages ?? [],isHistorical,newerAvailable}),- [expandWindow, olderAvailable, revealRow, returnToLatest, currentMessages, isHistorical, newerAvailable]+ [expandWindow, olderAvailable, revealRow, returnToLatest, historicalMessages, isHistorical, newerAvailable])const runtime = useIncrementalExternalStoreRuntime<ThreadMessage>({diff --git a/apps/desktop/src/components/assistant-ui/thread/transcript-window.tsx b/apps/desktop/src/components/assistant-ui/thread/transcript-window.tsxindex f20329abb16..215d9a3980f 100644--- a/apps/desktop/src/components/assistant-ui/thread/transcript-window.tsx+++ b/apps/desktop/src/components/assistant-ui/thread/transcript-window.tsx@@ -11,7 +11,7 @@ export interface TranscriptWindowValue {returnToLatest?: () => voidisHistorical?: booleannewerAvailable?: boolean- /** Exactly the selected bounded source slice, not the full live store. */+ /** Selected historical page; live navigation reads the session store. */currentMessages?: readonly ChatMessage[]/** Pull a page, capturing the reader immediately before the prepend commits.* A remote page resolves false on failure; callers can retry without growing