Skip to content

[CmdPal] Add host-driven navigation (GoToPageAsync on IExtensionHost2) - #49442

Draft
michaeljolley wants to merge 2 commits into
dev/mjolley/cmdpal-auth-brokerfrom
dev/mjolley/dev-mjolley-cmdpal-auth-nav
Draft

[CmdPal] Add host-driven navigation (GoToPageAsync on IExtensionHost2)#49442
michaeljolley wants to merge 2 commits into
dev/mjolley/cmdpal-auth-brokerfrom
dev/mjolley/dev-mjolley-cmdpal-auth-nav

Conversation

@michaeljolley

Copy link
Copy Markdown
Contributor

Summary

Phase 3 of the built-in Command Palette auth feature: host-driven navigation. An extension can ask Command Palette to navigate to one of its own pages (typically right after a successful sign-in) via a new GoToPageAsync member on the existing IExtensionHost2 interface. There is no IExtensionHost3; the whole feature ships as one atomic stack, so the method lives on the same IExtensionHost2 that carries RequestAuthorizationAsync.

Changes

  • SDK IDL: add Windows.Foundation.IAsyncAction GoToPageAsync(ICommand page, NavigationMode navigationMode) to IExtensionHost2 (contract v1, no version bump; NavigationMode enum already existed).
  • Host (AppExtensionHost.GoToPageAsync): reuse the existing navigation pipeline. Send a PerformCommandMessage with ShowWindowIfPage = true (which foregrounds the window and navigates when the command is a page), preceded by GoHomeMessage / GoBackMessage for the GoHome / GoBack modes. A null page is a graceful no-op.
  • Toolkit (ExtensionHost): add GoToPageAsync(ICommand page, NavigationMode navigationMode = NavigationMode.Push) and SupportsNavigation => Host is IExtensionHost2, mirroring the existing RequestAuthorizationAsync / SupportsAuthorization helper (NotSupportedException on legacy host, ArgumentNullException on null; AOT/trim safe).
  • Tests: Toolkit fake-host tests (capability true/false, NotSupportedException, ArgumentNullException, arg forwarding) plus host ViewModels tests asserting the correct messages are sent for Push / GoHome / GoBack and that a null page sends nothing.

Validation

  • Build: build.ps1 -Path src\modules\cmdpal -Platform x64 -Configuration Debug exit code 0.
  • All CmdPal *.UnitTests run with zero failures (WindowWalker is an empty placeholder project with no tests).

Stacked on dev/mjolley/cmdpal-auth-broker (Phase 2). Draft.

Phase 3 of the built-in Command Palette auth feature. Lets an extension ask
the host to navigate Command Palette to one of the extension's own pages,
typically right after a successful sign-in.

- SDK IDL: add GoToPageAsync(ICommand page, NavigationMode navigationMode) to
  IExtensionHost2 (contract v1, no version bump).
- Host: implement AppExtensionHost.GoToPageAsync by reusing the existing nav
  pipeline via PerformCommandMessage with ShowWindowIfPage, preceded by
  GoHome/GoBack messages for those modes. Null page is a graceful no-op.
- Toolkit: add ExtensionHost.GoToPageAsync and SupportsNavigation, mirroring
  the RequestAuthorizationAsync / SupportsAuthorization helper.
- Tests: Toolkit fake-host tests (capability, NotSupported, ArgumentNull, arg
  forwarding) and host ViewModels tests asserting the right messages are sent.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 2ee31cb3-848f-43ba-ac48-f4e4485baa33
@github-actions github-actions Bot added the Product-Command Palette Refers to the Command Palette utility label Jul 21, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2ee31cb3-848f-43ba-ac48-f4e4485baa33

@zadjii-msft zadjii-msft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hard disagree with giving the ability for 3p apps to change the visibility and navigation state of cmdpal without being driven by user interaction.

Sure, it can be used for good, but if this exists, it'll immediately be abused by apps. They could freely just summon the cmdpal window whenever they want. They can navigate to their extension whenever, even if the user isn't doing something. The opportunity for abuse is far too ripe

@michaeljolley michaeljolley self-assigned this Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.102 Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants