feat(windows): route chat/stepper content to their own windows, fix status badge position

- ChatPanel now fills its own window instead of being absolutely
  positioned over the avatar; its interactive regions (messages,
  input bar, objective card) opt out of the window's drag region so
  they stay clickable/selectable while the rest of the panel can be
  used to move the window.
- New StepperView: the #stepper window's root component, relays
  "session-status-changed" from the main process into its own
  Zustand store instance (new setStatus action) since this window has
  no direct access to the chat window's state.
- App.tsx no longer renders ChatPanel/PipelineStepper at all (they
  live in separate windows now) or resizes itself - it only toggles
  the chat window via IPC and keeps a local optimistic flag for the
  context menu's checkmark, resynced if the window is closed
  externally.
- Fixed AvatarStatusIndicator's position: .avatar-status-anchor used
  to be computed from the in-window chat panel's height
  (bottom: calc(2% + 64vh + ...)), which misplaced it once that panel
  stopped living in this window. It now mirrors .thinking's simple
  fixed anchor above the avatar's head.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
william
2026-10-31 23:04:10 +01:00
co-authored by Claude Sonnet 5
parent 4da3254d0a
commit c1440f83c0
10 changed files with 215 additions and 116 deletions
@@ -5,11 +5,13 @@ const create = vi.fn()
const get = vi.fn()
const sendObjectiveMessage = vi.fn()
const confirmObjective = vi.fn()
const notifySessionEnded = vi.fn()
beforeEach(() => {
vi.clearAllMocks()
;(window as unknown as { api: Record<string, unknown> }).api = {
sessions: { create, get, sendObjectiveMessage, confirmObjective }
sessions: { create, get, sendObjectiveMessage, confirmObjective },
notifySessionEnded
}
useSessionStore.getState().restart()
})
@@ -101,15 +103,22 @@ describe('useSessionStore', () => {
expect(useSessionStore.getState().error).toBe('Aucune session en cours')
})
it('should reset all state on restart', async () => {
it('should reset all state on restart and notify the main process', async () => {
create.mockResolvedValueOnce({ id: 1, status: 'objective_discovery' })
sendObjectiveMessage.mockResolvedValueOnce({ reply: 'ok', ready: false })
await useSessionStore.getState().sendMessage('message')
notifySessionEnded.mockClear()
useSessionStore.getState().restart()
expect(notifySessionEnded).toHaveBeenCalledOnce()
const state = useSessionStore.getState()
expect(state.sessionId).toBeNull()
expect(state.messages).toEqual([])
})
it('should set the status directly (used by the stepper window to sync with the main process)', () => {
useSessionStore.getState().setStatus('objective_validated')
expect(useSessionStore.getState().status).toBe('objective_validated')
})
})