Skip to content

feat(web): add profile switcher — ProfilePickerDialog, sidebar cards, and PTY reconnect - #33739

Closed
RobinAngele wants to merge 6 commits into
NousResearch:mainfrom
RobinAngele:feat/profile-switcher-frontend
Closed

feat(web): add profile switcher — ProfilePickerDialog, sidebar cards, and PTY reconnect#33739
RobinAngele wants to merge 6 commits into
NousResearch:mainfrom
RobinAngele:feat/profile-switcher-frontend

Conversation

@RobinAngele

@RobinAngele RobinAngele commented May 28, 2026

Copy link
Copy Markdown

Frontend companion to #33056 (backend — merge first).

Adds the full profile switcher UI: a modal ProfilePickerDialog, two profile cards in the chat sidebar (read-only active + clickable picker), config-gated feature flags, and channel-bump wiring so the PTY reconnects under the new profile without a page reload.

What's added

web/src/components/ProfilePickerDialog.tsx (+196 lines, new file)

Modal dialog portaled to document.body. Lists all profiles (sorted: default first, then alphabetical), highlights the active one with a checkmark, shows loading/error/empty states. Calls api.activateProfile(name) on selection, then signals the parent to reconnect the PTY. Keyboard-accessible (Esc to close, backdrop click).

web/src/lib/api.ts (+8 lines)

  • api.activateProfile(name) — POSTs to /api/profiles/{name}/activate via fetchJSON (auto session-token injection). Complements the existing api.getProfiles().

web/src/components/ChatSidebar.tsx (+60 / -2 lines)

  • active profile card — read-only, always visible, shows the current profile name with a Crown icon. Fetched from the public /api/active-profile endpoint on mount.
  • agent profile card — clickable, gated by chatByAgentProfile prop, opens the ProfilePickerDialog modal.
  • handleProfileActivated calls onProfileActivated prop (parent bumps channel key → PTY reconnects in-place). No page reload.

web/src/App.tsx (+21 lines)

  • Reads dashboard.chat_by_agent_profile from /api/config — defaults to true when absent.
  • channelBumpKey state + bumpChannel() callback — bumped on profile switch so the PTY reconnects under the new HERMES_HOME.

web/src/pages/ChatPage.tsx (+17 / -5 lines)

  • Accepts chatByAgentProfile, channelBumpKey, onProfileActivated props.
  • Wires channelBumpKey into the channel useMemo dependency array — when bumped, a new channel ID is generated, the old PTY WebSocket closes, and a new one opens.
  • Forwards chatByAgentProfile and onProfileActivated to both ChatSidebar instances.

Data flow

ProfilePickerDialog
→ api.activateProfile(name) // POST to backend, writes sticky file
→ onProfileActivated(name)
→ ChatSidebar.handleProfileActivated()
→ onProfileActivated() (prop)
→ App.bumpChannel() // channelBumpKey++
→ ChatPage channel memo re-computes
→ PTY WebSocket reconnects
→ _resolve_chat_argv() reads ~/.hermes/active_profile
→ HERMES_HOME = ~/.hermes/profiles/

Testing (after #33056 is deployed)

curl localhost:9119/api/active-profile # → {"name":"default"}
curl -X POST localhost:9119/api/profiles/acronyc/activate
cat ~/.hermes/active_profile # → acronyc

Open dashboard → sidebar shows active profile + clickable picker → PTY reconnects without page reload.

Dependencies

PR / Issue What Merge order
#33056 Backend: sticky file + activate endpoint + /api/active-profile ← merge first
#33739 (this PR) Frontend: full profile switcher UI 2nd

Related

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery javascript labels May 28, 2026
@RobinAngele
RobinAngele force-pushed the feat/profile-switcher-frontend branch from 798c8aa to 4f0138f Compare May 28, 2026 09:49
@RobinAngele RobinAngele changed the title feat(web): add active profile card to chat sidebar + profile API func… feat(web): add active profile card to chat sidebar with getActiveProfile/activateProfile API May 28, 2026
@RobinAngele
RobinAngele force-pushed the feat/profile-switcher-frontend branch from 4f0138f to 10f30c5 Compare May 28, 2026 12:59
@RobinAngele
RobinAngele force-pushed the feat/profile-switcher-frontend branch from 10f30c5 to 7d16aab Compare May 28, 2026 14:37
@RobinAngele RobinAngele changed the title feat(web): add active profile card to chat sidebar with getActiveProfile/activateProfile API feat(web): add profile switcher — ProfilePickerDialog, sidebar cards, and PTY reconnect May 28, 2026
@RobinAngele
RobinAngele force-pushed the feat/profile-switcher-frontend branch from 7d16aab to d7364a1 Compare May 28, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants