The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fmt(js): `npm run fix` on merge (#90248)
hermes-seaeye[bot]657550716f37
diff --git a/apps/desktop/src/app/session/hooks/preview-open.test.tsx b/apps/desktop/src/app/session/hooks/preview-open.test.tsxindex d71cf2e676b..4f5b72986ef 100644--- a/apps/desktop/src/app/session/hooks/preview-open.test.tsx+++ b/apps/desktop/src/app/session/hooks/preview-open.test.tsx@@ -81,130 +81,129 @@ describe('preview routing', () => {})describe('open_preview', () => {+ // The rail used to hold a session-keyed singleton alongside its tabs, written+ // under one session-id rule and reconciled under another. A live session with+ // no stored id yet resolved to '' on the write side, so the target was set and+ // then immediately reconciled back to null — the pane flashed and vanished.+ it('opens a tab for a session that has no stored id yet', async () => {+ $selectedStoredSessionId.set(null)+ render(<Harness />)- // The rail used to hold a session-keyed singleton alongside its tabs, written- // under one session-id rule and reconciled under another. A live session with- // no stored id yet resolved to '' on the write side, so the target was set and- // then immediately reconciled back to null — the pane flashed and vanished.- it('opens a tab for a session that has no stored id yet', async () => {- $selectedStoredSessionId.set(null)- render(<Harness />)+ await emitPreviewOpen()- await emitPreviewOpen()+ await waitFor(() => expect($previewTarget.get()?.path).toBe('/tmp/artifact-test.html'))+ expect($previewTabs.get()).toHaveLength(1)+ })- await waitFor(() => expect($previewTarget.get()?.path).toBe('/tmp/artifact-test.html'))- expect($previewTabs.get()).toHaveLength(1)- })+ it('keeps the tab when the stored session id arrives afterwards', async () => {+ $selectedStoredSessionId.set(null)+ render(<Harness />)- it('keeps the tab when the stored session id arrives afterwards', async () => {- $selectedStoredSessionId.set(null)- render(<Harness />)+ await emitPreviewOpen()+ await waitFor(() => expect($previewTarget.get()?.path).toBe('/tmp/artifact-test.html'))- await emitPreviewOpen()- await waitFor(() => expect($previewTarget.get()?.path).toBe('/tmp/artifact-test.html'))+ await act(async () => {+ $selectedStoredSessionId.set('stored-1')+ })- await act(async () => {- $selectedStoredSessionId.set('stored-1')+ expect($previewTarget.get()?.path).toBe('/tmp/artifact-test.html')})- expect($previewTarget.get()?.path).toBe('/tmp/artifact-test.html')- })+ it('ignores an open from a session that is not the one on screen', async () => {+ render(<Harness />)- it('ignores an open from a session that is not the one on screen', async () => {- render(<Harness />)+ await act(async () => {+ handleEvent({+ payload: { url: '/tmp/other.html' },+ session_id: 'some-other-session',+ type: 'preview.open'+ } as unknown as RpcEvent)+ })- await act(async () => {- handleEvent({- payload: { url: '/tmp/other.html' },- session_id: 'some-other-session',- type: 'preview.open'- } as unknown as RpcEvent)+ expect($previewTabs.get()).toHaveLength(0)})- expect($previewTabs.get()).toHaveLength(0)- })+ // The turn that calls open_preview is often a TILE's session while focus+ // sits on main (the user asked, then clicked elsewhere). On-screen is the+ // bar — gating on focus made an explicit "open reddit" silently vanish.+ it('honors an open from an open tile session even when main holds focus', async () => {+ const { $sessionTiles } = await import('@/store/session-states')+ const tiles = $sessionTiles.get()- // The turn that calls open_preview is often a TILE's session while focus- // sits on main (the user asked, then clicked elsewhere). On-screen is the- // bar — gating on focus made an explicit "open reddit" silently vanish.- it('honors an open from an open tile session even when main holds focus', async () => {- const { $sessionTiles } = await import('@/store/session-states')- const tiles = $sessionTiles.get()+ $sessionTiles.set([{ dir: 'right', runtimeId: 'tile-runtime', storedSessionId: 'stored-tile' }])+ render(<Harness />)- $sessionTiles.set([{ dir: 'right', runtimeId: 'tile-runtime', storedSessionId: 'stored-tile' }])- render(<Harness />)+ try {+ await emitPreviewOpen('/tmp/from-tile.html', 'tile-runtime')- try {- await emitPreviewOpen('/tmp/from-tile.html', 'tile-runtime')+ await waitFor(() => expect($previewTarget.get()?.path).toBe('/tmp/from-tile.html'))+ } finally {+ $sessionTiles.set(tiles)+ }+ })- await waitFor(() => expect($previewTarget.get()?.path).toBe('/tmp/from-tile.html'))- } finally {- $sessionTiles.set(tiles)- }- })+ it('opens a second target as its own tab rather than replacing the first', async () => {+ render(<Harness />)- it('opens a second target as its own tab rather than replacing the first', async () => {- render(<Harness />)+ await emitPreviewOpen('/tmp/one.html')+ await waitFor(() => expect($previewTabs.get()).toHaveLength(1))- await emitPreviewOpen('/tmp/one.html')- await waitFor(() => expect($previewTabs.get()).toHaveLength(1))+ await emitPreviewOpen('/tmp/two.html')+ await waitFor(() => expect($previewTabs.get()).toHaveLength(2))- await emitPreviewOpen('/tmp/two.html')- await waitFor(() => expect($previewTabs.get()).toHaveLength(2))+ expect($previewTarget.get()?.path).toBe('/tmp/two.html')+ })- expect($previewTarget.get()?.path).toBe('/tmp/two.html')- })+ it('re-fronts the existing tab when the same target opens twice', async () => {+ render(<Harness />)- it('re-fronts the existing tab when the same target opens twice', async () => {- render(<Harness />)+ await emitPreviewOpen('/tmp/one.html')+ await emitPreviewOpen('/tmp/one.html')- await emitPreviewOpen('/tmp/one.html')- await emitPreviewOpen('/tmp/one.html')+ await waitFor(() => expect($previewTabs.get()).toHaveLength(1))+ })- await waitFor(() => expect($previewTabs.get()).toHaveLength(1))- })+ it('renders a tool-opened html file rather than showing its source', async () => {+ render(<Harness />)- it('renders a tool-opened html file rather than showing its source', async () => {- render(<Harness />)+ await emitPreviewOpen()- await emitPreviewOpen()+ await waitFor(() => expect($previewTarget.get()?.renderMode).toBe('preview'))+ })- await waitFor(() => expect($previewTarget.get()?.renderMode).toBe('preview'))- })+ // Offer, don't hijack: only an explicit open_preview call opens the rail.+ it('does not infer a preview from assistant prose', async () => {+ render(<Harness />)- // Offer, don't hijack: only an explicit open_preview call opens the rail.- it('does not infer a preview from assistant prose', async () => {- render(<Harness />)+ await act(async () => {+ $messages.set([+ assistantMessage('a1', 'Preview: http://localhost:5173/'),+ assistantMessage('a2', 'Open /work/demo.html')+ ])+ })- await act(async () => {- $messages.set([- assistantMessage('a1', 'Preview: http://localhost:5173/'),- assistantMessage('a2', 'Open /work/demo.html')- ])+ expect($previewTabs.get()).toHaveLength(0)+ expect(window.hermesDesktop.normalizePreviewTarget).not.toHaveBeenCalled()})- expect($previewTabs.get()).toHaveLength(0)- expect(window.hermesDesktop.normalizePreviewTarget).not.toHaveBeenCalled()- })+ it('does not open a preview off the back of a tool result', async () => {+ render(<Harness />)- it('does not open a preview off the back of a tool result', async () => {- render(<Harness />)-- await act(async () => {- handleEvent({- payload: { inline_diff: 'a/preview-demo.html -> b/preview-demo.html\n' },- session_id: RUNTIME_SESSION_ID,- type: 'tool.complete'- } as unknown as RpcEvent)- handleEvent({- payload: { path: './dist/index.html' },- session_id: RUNTIME_SESSION_ID,- type: 'tool.complete'- } as unknown as RpcEvent)- })+ await act(async () => {+ handleEvent({+ payload: { inline_diff: 'a/preview-demo.html -> b/preview-demo.html\n' },+ session_id: RUNTIME_SESSION_ID,+ type: 'tool.complete'+ } as unknown as RpcEvent)+ handleEvent({+ payload: { path: './dist/index.html' },+ session_id: RUNTIME_SESSION_ID,+ type: 'tool.complete'+ } as unknown as RpcEvent)+ })- expect($previewTabs.get()).toHaveLength(0)- })+ expect($previewTabs.get()).toHaveLength(0)+ })})describe('close_preview', () => {diff --git a/apps/desktop/src/app/session/hooks/use-preview-routing.ts b/apps/desktop/src/app/session/hooks/use-preview-routing.tsindex 41cebe7cdb0..e8d3728c31d 100644--- a/apps/desktop/src/app/session/hooks/use-preview-routing.ts+++ b/apps/desktop/src/app/session/hooks/use-preview-routing.ts@@ -121,6 +121,7 @@ export function usePreviewRouting({ baseHandleGatewayEvent, currentCwd, requestGif (!target) {closeRightRail()+return}