feat(cli,plugins): auto-open a page in the browser on creation (SUPER-2282)
What
"Basically a free notification bc sometimes i'll be doing something in chrome and an agent will open the page as a tab, lets me know when pages are ready" — superset pages publish now opens the page it just created, with no separate command and no skill instruction the agent has to remember to run.
Where it lands follows Settings -> Links -> Pages: a split, a new tab, or the system browser. Only version 1 opens, so the comment-fix republish loop never reopens anything.
How
The CLI opens a desktop deep link:
superset://v2-workspace/<workspaceId>?pageId=<id>&pageSlug=<slug>&focusRequestId=<uuid>
the same shape as the documented ?terminalId= and ?chatSessionId= links. The workspace route consumes those params in useConsumePageOpenLink, keyed on focusRequestId the way useConsumeSubagentLink is, gated on the PAGES flag and isLayoutReady.
This replaces an earlier version of this PR that broadcast a page:open-requested event over the host-service event bus. Two things the deep link does that the broadcast could not:
- One publish, one copy. Main hands a deep link to a single window (
getFocusedOrLastWindow). The broadcast reached every event-bus client on the workspace, so two windows open with theexternalpreference meant two browser tabs per publish. - Lands when the desktop is showing something else. The broadcast consumer only mounted inside
V2WorkspaceContentfor oneworkspaceId; anything else dropped the request. A deep link navigates there first.
It also deletes the transport the broadcast needed: pageWatch.requestOpen, the page:open-requested message and its EventBus broadcaster, the workspace-client payload type, and the useWorkspaceEvent overload.
Notes
- An open is attempted, never confirmed.
openUrlresolves as soon as the launcher spawns, so nothing here can tell you a window actually appeared. What it can rule out in advance is the case where the launcher provably reaches nobody:canReachDesktop()skips the open underIS_SANDBOX,SSH_CONNECTIONorSSH_TTYand says so inopenNote, because a cloud sandbox shipsxdg-utilsand setsDISPLAY—xdg-openthere exits 0 having painted a page on a display no one is looking at. Written up indocs/cloud-sandbox-mismatches.md. - Consumed deep links clear their own params. Router history is persisted with its search params and restored at boot, so a link left in the URL fires again on every relaunch and on every Back onto that entry. Each consume hook drops what it owns through a
consumeSearchcallback right after it acts. The subagent, automation-run and open-url hooks had the same latent bug and are fixed here too. - An already-open pane for that page is focused rather than duplicated (
openPagePaneInStore->focusOrOpenPane). - A first publish now raises the desktop window, which the broadcast did not. That is the "it's ready" signal, but it is a behavior change worth knowing about. It raises the window even under the
externalpreference, where the page then opens in the browser anyway — left for a follow-up. - A first publish with no workspace (possible since #7573) has no workspace to deep-link into and stays silent.
lib/open-url.tsis the cross-platformopen/cmd start/xdg-openspawn already used byworkspaces open, extracted so publish andauth loginreuse it along with the sandbox/SSH check. A failure to launch is a softopenNoteon the result, mirroring how a failed comment-watch registration degrades — not a failed publish.- No
--no-open: publish is silent unless it is creating a page, and an agent that must not open one can pass--page. - No plugin release needed. This branch no longer touches
plugins/. The skill paragraph promising an automatic browser open never shipped in a release, and main removed it independently, so rebasing dropped the change entirely.
Testing
Rebased onto 02c4d5c08 (after #7573, #7570 and #7602, which all touch publish) and squashed; publishResult.test.ts reconciled across the two sides.
bun run typecheck --filter=@superset/cli --filter=@superset/desktop— passbun testinpackages/cli— 265 pass, 0 failbun testinapps/desktop— 3947 pass, 2 fail; both arejest.advanceTimersByTime is not a functioninterminal-ws-transport.test.tsand fail identically on the unmodified treebun run lint— clean
Not reproduced end-to-end: the relaunch/Back replay fix is reasoned from the history-persistence code, not driven through the running app.
Closes SUPER-2282.