Skip to content

Move agent host picker to sessions sidebar (web desktop)#313619

Merged
osortega merged 6 commits into
mainfrom
agents/where-do-we-render-the-dropdown-host-picker-a60a15f4
May 1, 2026
Merged

Move agent host picker to sessions sidebar (web desktop)#313619
osortega merged 6 commits into
mainfrom
agents/where-do-we-render-the-dropdown-host-picker-a60a15f4

Conversation

@osortega
Copy link
Copy Markdown
Contributor

@osortega osortega commented May 1, 2026

What

Surface the agent host picker in a new Agent Host toolbar at the bottom of
the sessions sidebar instead of the titlebar's left layout. The new widget is
modeled on AICustomizationShortcutsWidget but is always expanded — no
collapse chevron, no storage key.

Scope

Build / layout Today After
Web desktop (vscode.dev/agents) Pill in Menus.TitleBarLeftLayout New sidebar toolbar
Web phone Pill in Menus.MobileTitleBarCenter Unchanged
Electron desktop No host picker (gated by IsWebContext) Unchanged
Auxiliary window No host picker Unchanged

The new sidebar entry's when clause is IsWebContext && !IsAuxiliaryWindowContext && !IsPhoneLayoutContext, and the widget mount in SessionsView.createControls() is gated on isWeb && !isPhoneLayout(layoutService) so electron and phone layouts never render an empty toolbar shell.

Visual alignment

HostFilterActionViewItem gains a HostFilterAppearance = 'titlebar' | 'sidebar' constructor parameter. The 'sidebar' variant renders the same Monaco Button + .sidebar-action-button shell as CustomizationLinkViewItem, so the host row looks identical in rhythm to the customizations rows above:

[ $(remote)  Host Name (flex:1)  $(chevron-down) ]   [ connect/disconnect ]
  • Picker button: leading remote icon + flex:1 host-name span + trailing chevron, populated manually (not via Button.label) so the chevron docks cleanly to the trailing edge.
  • Connect button: independent 26×26 sibling control. When there are no hosts, this slot becomes a refresh button that triggers rediscover() — same shape as the disconnect button on a real host.
  • Titlebar pill and mobile sheet variants are unchanged.

Files

  • Sidebar toolbar (new)
    • src/vs/sessions/contrib/sessions/browser/agentHostShortcutsWidget.ts
    • src/vs/sessions/contrib/sessions/browser/media/agentHostToolbar.css
    • src/vs/sessions/contrib/sessions/test/browser/agentHostShortcutsWidget.test.ts
  • Menu / mount wiring
    • src/vs/sessions/browser/menus.ts — adds Menus.SidebarAgentHost
    • src/vs/sessions/contrib/sessions/browser/views/sessionsView.ts — mounts the widget below the customizations widget on web desktop only
  • Picker view item
    • src/vs/sessions/contrib/remoteAgentHost/browser/hostFilterActionViewItem.ts — new HostFilterAppearance parameter and 'sidebar' rendering path
    • src/vs/sessions/contrib/remoteAgentHost/browser/mobileHostFilterActionViewItem.ts — explicit 'titlebar' super arg
    • src/vs/sessions/contrib/remoteAgentHost/browser/media/hostFilter.css — sidebar layout + rediscover state styling
    • src/vs/sessions/contrib/remoteAgentHost/browser/hostFilter.contribution.ts — re-targets the desktop registration from TitleBarLeftLayoutSidebarAgentHost

Testing

  • Added unit test asserting the new toolbar renders without a collapse affordance.
  • Manually verified on web (sidebar layout) — picker works, chevron docks right, connect / re-discover indicator behaves as expected.

On web desktop (vscode.dev/agents), surface the agent host picker in a
new toolbar at the bottom of the sessions sidebar instead of the
titlebar's left layout. The new widget is modeled on
AICustomizationShortcutsWidget but is always expanded -- no collapse
chevron, no storage key.

Scope:
- Web desktop:  picker moves to the sidebar (new SidebarAgentHost menu).
- Web phone:    unchanged -- still rendered in MobileTitlebarPart.
- Electron:     unchanged -- no host picker, never had one.

Visual alignment:
HostFilterActionViewItem gains a HostFilterAppearance ('titlebar' |
'sidebar') parameter so it can render the same Monaco Button +
.sidebar-action-button shell used by CustomizationLinkViewItem. The
sidebar appearance lays out the picker button as
[remote-icon] [host-name (flex:1)] [chevron-down], with the connect /
disconnect / re-discover indicator as an independent 26x26 sibling
control to the right. When there are no hosts the right slot becomes a
refresh button that triggers rediscover().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 1, 2026 00:33
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

No screenshot changes.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves the agent host picker from the sessions titlebar (web desktop) into a new “Agent Host” toolbar at the bottom of the sessions sidebar, while keeping phone and Electron behavior unchanged.

Changes:

  • Added a new sidebar-mounted AgentHostShortcutsWidget that renders Menus.SidebarAgentHost via MenuWorkbenchToolBar.
  • Introduced a HostFilterAppearance option to render the host picker either as the existing titlebar pill or as a full-width sidebar row (plus updated contribution wiring).
  • Added unit coverage for the new always-expanded toolbar widget rendering.
Show a summary per file
File Description
src/vs/sessions/contrib/sessions/browser/views/sessionsView.ts Mounts the new sidebar agent host toolbar on web desktop.
src/vs/sessions/contrib/sessions/browser/agentHostShortcutsWidget.ts New widget hosting a menu-driven toolbar for the sidebar “Agent Host” section.
src/vs/sessions/contrib/sessions/browser/media/agentHostToolbar.css Styles the new bottom-of-sidebar toolbar layout.
src/vs/sessions/contrib/sessions/test/browser/agentHostShortcutsWidget.test.ts New test asserting the toolbar renders always-expanded (no collapse affordance).
src/vs/sessions/browser/menus.ts Adds Menus.SidebarAgentHost menu ID.
src/vs/sessions/contrib/remoteAgentHost/browser/hostFilter.contribution.ts Re-targets registration to the new sidebar menu on web desktop and wires sidebar appearance.
src/vs/sessions/contrib/remoteAgentHost/browser/hostFilterActionViewItem.ts Adds HostFilterAppearance and implements sidebar rendering path + rediscover UI.
src/vs/sessions/contrib/remoteAgentHost/browser/mobileHostFilterActionViewItem.ts Updates super call to explicitly use the titlebar appearance.
src/vs/sessions/contrib/remoteAgentHost/browser/media/hostFilter.css Adds sidebar-specific layout rules and rediscover styling.

Copilot's findings

  • Files reviewed: 9/9 changed files
  • Comments generated: 6

Comment thread src/vs/sessions/contrib/remoteAgentHost/browser/hostFilterActionViewItem.ts Outdated
Comment thread src/vs/sessions/contrib/remoteAgentHost/browser/hostFilterActionViewItem.ts Outdated
Comment thread src/vs/sessions/contrib/remoteAgentHost/browser/hostFilterActionViewItem.ts Outdated
Comment thread src/vs/sessions/contrib/remoteAgentHost/browser/hostFilterActionViewItem.ts Outdated
Comment thread src/vs/sessions/contrib/sessions/browser/views/sessionsView.ts Outdated
Comment thread src/vs/sessions/contrib/sessions/test/browser/agentHostShortcutsWidget.test.ts Outdated
osortega and others added 4 commits May 1, 2026 11:04
…onViewItem.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…tsWidget.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Drop the icon-by-state enumeration from the HostFilterActionViewItem
  class JSDoc.
- Sidebar picker no longer no-ops with 0 hosts: pass the click event
  through to `_showMenu`, which already routes to `rediscover()` when
  no hosts are known. Same affordance as the dedicated refresh slot.
- Widen `_showMenu(e)` to accept `Event`; this avoids fabricating a
  synthetic `MouseEvent('click')` that would anchor the context menu
  at (0,0) on touch/gesture activations. `dom.isMouseEvent(e)` keeps
  the runtime check.
- Gate the `AgentHostShortcutsWidget` mount on
  `IsSessionsWindowContext && !IsAuxiliaryWindowContext && !IsPhoneLayoutContext`
  instead of `isWeb && !isPhoneLayout(...)`. Prevents an empty toolbar
  shell in auxiliary windows and aligns the runtime gate with the
  agents-window context the menu items target.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hold stable references to the leading host icon and trailing chevron
as `_sidebarLeadingIcon` / `_sidebarTrailingIcon` fields, created
once in `_renderSidebar()`. `_renderSidebarButtonAffordances` now
attaches/detaches the chevron via `appendChild` / `remove` on the
stored reference instead of `querySelector(':scope > ...)`, fixing
the `no-restricted-syntax` ESLint warnings reported by CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@osortega osortega marked this pull request as ready for review May 1, 2026 18:57
@osortega osortega merged commit d3e91ab into main May 1, 2026
26 checks passed
@osortega osortega deleted the agents/where-do-we-render-the-dropdown-host-picker-a60a15f4 branch May 1, 2026 21:07
@vs-code-engineering vs-code-engineering Bot added this to the 1.119.0 milestone May 1, 2026
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