Drive agentic chat init from the route, not a mode prop

What does this MR do and why?

Removes the mode prop from the agentic chat state manager and derives initialization from the route instead. The router previously passed mode (values 'active' or 'new') to decide how the component initialized, but this duplicated the intent already carried by the route that vue-router uses to mount the show vs. new-chat views.

A new initializeView() method now reads the route directly: on the new-chat route it starts a fresh chat; otherwise (the show route) it hydrates the stored workflow, falling back to a new chat if there is no stored workflow. A $route.name watcher handles the one in-place transition where the same component instance switches routes without remounting: clicking "new chat" while viewing a thread. Other route changes are ignored, because the show route is reached either on mount (coming from the history view) or via onNewChat's own redirect, neither of which needs re-initialization here.

The router (ai_panel_router.js) no longer passes mode to the agentic show and new routes.

This removes a redundant source of truth: before, the view was driven by both the route (which component mounts) and the mode prop (how it initializes), and mount correctness depended on keeping the two in sync. It implements the route-driven-initialization follow-up suggested in review on !248969 (merged).

Scope and follow-up

This is a focused refactor. Stream adoption in connectToStream is unchanged: when a stream is already connected on mount, it is still adopted before initialization. Making stream adoption a fully separate, additive concern so that view initialization is always route-driven and unconditional is intentionally left for a further follow-up.

How to test

Frontend unit tests in duo_agentic_chat_state_manager_spec.js are updated: the former "mode watcher" suite is replaced with a "route watcher" suite (an in-place switch to the new-chat route starts a new chat; switching to a route the component does not own does not re-initialize), plus a mount-on-new-chat-route case. All state manager, router, and ai_panel specs pass locally.

Stacking note

This MR is stacked on and targets the branch of !248969 (merged). It should be retargeted to master after that MR merges.

Merge request reports

Loading
Loading