Skip to content

feat(agor-ui): eject session from sidebar onto board canvas - #1713

Open
rusackas wants to merge 1 commit into
mainfrom
eject-session-to-board
Open

rusackas wants to merge 1 commit into
mainfrom
eject-session-to-board

Conversation

@rusackas

Copy link
Copy Markdown
Member

Summary

Requested by Evan (Agor admin). Implements the "session eject" feature: a button in the SessionPanel drawer header that pops an open session out onto the board canvas as a live, interactive node.

  • Eject button (↗) in the SessionPanel header moves the session from the sidebar drawer onto the board canvas as a full-size interactive card
  • Ejected card shows the identical session UI (transcript + prompt input + model footer) — SessionPanel is reused with isEjected={true}, not forked
  • Re-dock button moves the card back to the sidebar; Close button dismisses the canvas node without re-docking (next click opens in the sidebar as usual)
  • Multiple sessions can be ejected simultaneously; each has its own live realtime subscription, draft persistence, and prompt input
  • Position persists across page refresh via localStorage, scoped per user+board (agor:ejected:<userId>:<boardId>)
  • Ejected nodes integrate with the existing ReactFlow canvas: draggable via the title-bar handle, wheel-scroll protected inside the body, visible in the minimap

Architecture decisions

Client-side persistence (localStorage) for v1 — no DB migration, no backend changes, ships immediately. Each user's ejected positions are stored locally and survive page refreshes. Multi-device sync or admin-visible ejected state would require a board_objects column or separate table; that can be layered on later when the demand is clear.

Reuse SessionPanel, don't fork it — added two props (onEject?: () => void, isEjected?: boolean) that toggle drag-handle CSS and button layout. The underlying SessionPanelContent, PromptInput, and SessionFooter are completely shared.

No double-mount — effectiveSelectedSessionId excludes ejected session IDs so the sidebar never opens for an already-ejected session; handleSessionClick has a ref-based early-return guard for the same reason.

Third sync effect for ejected nodes — matches the pattern of the existing board-objects and comment sync effects, preserving ejected nodes through WebSocket churn. handleNodeDragStop detects ejectedSessionNode type and persists to localStorage instead of board-objects.

Changed files

File Change
apps/agor-ui/src/hooks/useEjectedSessions.ts New hook — localStorage-backed positions, functional updater form
apps/agor-ui/src/components/SessionCanvas/canvas/EjectedSessionNode.tsx New ReactFlow node component wrapping SessionPanel
apps/agor-ui/src/components/SessionPanel/SessionPanel.tsx onEject + isEjected props; drag-handle/nodrag CSS; wheel guard
apps/agor-ui/src/components/SessionCanvas/SessionCanvas.tsx ejectedSessionNode type, third sync effect, drag-stop early return, minimap color
apps/agor-ui/src/components/App/App.tsx Hook wiring, eject/redock/close handlers, onEject → SessionPanel, props → SessionCanvas

Follow-ups / punted

  • Server-side persistence — multi-device sync; store positions in board_objects with a new ejected_session_id FK
  • Resize handle — ejected nodes are fixed 600×700; could allow per-session resize
  • Keyboard shortcut — E to eject/re-dock the active session
  • Scroll-into-view when re-docking (canvas recenter to the session's branch card)

Test plan

  • Open a session in the sidebar drawer → click ↗ "Pop out to board" → session disappears from drawer, appears as a node on the canvas at viewport center
  • Drag the ejected node → position is saved to localStorage → refresh page → node is in the same position
  • Eject a second session simultaneously → both nodes are live with independent prompts
  • Click "Re-dock" on an ejected node → node disappears, session re-opens in the sidebar drawer
  • Click "Close" on an ejected node → node disappears, next click on that session opens it in the drawer
  • Click on a branch card session that is currently ejected → nothing happens (no duplicate in sidebar)
  • Navigate to /s/<id>/ URL for an ejected session → sidebar stays closed, ejected node stays on canvas
  • Scroll conversation inside ejected node → canvas does NOT zoom
  • Eject session, switch boards, switch back → ejected node is gone (localStorage is per-board)

🤖 Generated with Claude Code

@mistercrunch

Copy link
Copy Markdown
Member

Screenshots for UX features please!

A button in the session panel header pops an open session out of the sidebar
drawer onto the board canvas as a live, interactive node. The node reuses
SessionPanel (`isEjected`) so transcript, prompt input and footer behave the
same as in the sidebar. Re-dock moves it back to the drawer, Close dismisses
the node, and several sessions can be ejected at once. Positions persist per
user and board in localStorage (`useEjectedSessions`).

Ported onto the current shell: the ejected node reads its MCP server ids via
`useSessionMcpServerIds`, the drawer keeps the mobile full-screen layout, and
the canvas keeps its zone-grid layout pass. The `ejectedSessions` default is a
module-level constant so omitting the prop cannot re-run the node sync effect
forever.

Co-Authored-By: Evan Rusackas <evan@preset.io>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@rusackas
rusackas force-pushed the eject-session-to-board branch from 596817a to 0436ab4 Compare November 25, 2026 05:07
@preset-machine

preset-machine commented Nov 25, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants