You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Plugin API: let a plugin screen open any workspace tab, and read where the user has been
#10421
I run many agents across several workspaces and want a full-page tab picker: one plugin screen (client.addScreen) that lists every open tab in every workspace, most recently visited first, and opens the one I pick. Agent chats, terminals, files, diffs and browser tabs all count. I switch between them the same way.
navigation.openWorkspace and navigation.openAgent open a workspace or an agent tab.
usePaseo().terminals.ref(ref).focus() opens a terminal tab.
For the rest, plugins read the page. paseo-switcher 1.2.4 is the closest published example. It parses location.pathname on a 300 ms timer to learn the current workspace, keeps its own visit order in localStorage, and switches workspace by clicking the sidebar row it finds by test ID.
Where Paseo gets in the way
1. A screen can open an existing tab only if it is an agent or a terminal.PluginScreenProps.navigation has openWorkspace, openAgent and, on desktop, openBrowser, which creates a new browser tab. Nothing opens a file, diff or browser tab that is already open, a provider subagent, or another plugin's panel. #9435 adds openTab(tab) and openSubagent(subagent), on PluginSidebarViewProps.navigation only. Its useWorkspaceTabs hook isn't limited to sidebar views, so after that PR a screen can list tabs it has no way to open.
2. Nothing tells a plugin where the user was.active exists only on sidebar views. On a screen the route is the screen itself, so a picker needs the place the user left and the places before it. The Command Center's recents are ordered by activity time, not by visits. #10173 records visits for Back and Forward, in memory and per window, with nothing exposed to plugins.
What a better workflow would look like
Two small additions. One navigates, one reads.
// Screens and panels get the two members #9435 gives sidebar views.interfacePluginNavigableHostProps{navigation?: {// ...existing membersopenTab?(tab: PluginWorkspaceTab): void;openSubagent?(subagent: PluginSubagent,options?: {parentTab?: PluginWorkspaceTab}): void;};}/** Places visited in this window, most recent first, each place once. */declarefunctionuseRecentVisits(options?: {limit?: number}): readonlyPluginVisit[];interfacePluginVisit{workspace: WorkspaceRef;/** `PluginWorkspaceTab.id` of the tab that was showing, or null. */tabId: string|null;}
On a screen, the first visit is the tab the user came from, so a picker needs no separate active. tabId joins against useWorkspaceTabs(workspace).tabs, and a visit whose tab has closed drops out of the join. In memory and per window is enough.
Not asking for: closing, moving or reordering tabs from a plugin, or visit history across devices.
Smaller things
A screen's state hooks read the screen's host only. A sidebar view reads every connected host. A picker wants the sidebar view's scope.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
What I'm trying to do
I run many agents across several workspaces and want a full-page tab picker: one plugin screen (
client.addScreen) that lists every open tab in every workspace, most recently visited first, and opens the one I pick. Agent chats, terminals, files, diffs and browser tabs all count. I switch between them the same way.How I do it today
A screen can do part of this:
useWorkspaces,useAgentsanduseTerminalswork on screens since Let plugin screens use the plugin state hooks #10049.navigation.openWorkspaceandnavigation.openAgentopen a workspace or an agent tab.usePaseo().terminals.ref(ref).focus()opens a terminal tab.For the rest, plugins read the page. paseo-switcher 1.2.4 is the closest published example. It parses
location.pathnameon a 300 ms timer to learn the current workspace, keeps its own visit order inlocalStorage, and switches workspace by clicking the sidebar row it finds by test ID.Where Paseo gets in the way
1. A screen can open an existing tab only if it is an agent or a terminal.
PluginScreenProps.navigationhasopenWorkspace,openAgentand, on desktop,openBrowser, which creates a new browser tab. Nothing opens a file, diff or browser tab that is already open, a provider subagent, or another plugin's panel. #9435 addsopenTab(tab)andopenSubagent(subagent), onPluginSidebarViewProps.navigationonly. ItsuseWorkspaceTabshook isn't limited to sidebar views, so after that PR a screen can list tabs it has no way to open.2. Nothing tells a plugin where the user was.
activeexists only on sidebar views. On a screen the route is the screen itself, so a picker needs the place the user left and the places before it. The Command Center's recents are ordered by activity time, not by visits. #10173 records visits for Back and Forward, in memory and per window, with nothing exposed to plugins.What a better workflow would look like
Two small additions. One navigates, one reads.
On a screen, the first visit is the tab the user came from, so a picker needs no separate
active.tabIdjoins againstuseWorkspaceTabs(workspace).tabs, and a visit whose tab has closed drops out of the join. In memory and per window is enough.Not asking for: closing, moving or reordering tabs from a plugin, or visit history across devices.
Smaller things
Related
Happy to test this, or to send the navigation part as a PR once #9435 settles.
All reactions