( featureFlags: WebClientFeatureFlags | undefined, )
| 58 | } |
| 59 | |
| 60 | export function getFirstAvailablePath( |
| 61 | featureFlags: WebClientFeatureFlags | undefined, |
| 62 | ): string | null { |
| 63 | // ``/settings/agents`` (the Agent Profile library — the "Agent" page) always |
| 64 | // wins: it is where the agent is defined (OpenHands / ACP, via the active |
| 65 | // profile) and is always available regardless of feature flags. Landing here |
| 66 | // keeps routing simple — every user lands where the agent is chosen, and |
| 67 | // the LLM page is one nav-click away. |
| 68 | const fallbackOrder = [ |
| 69 | { path: "/settings/agents", hidden: false }, |
| 70 | { path: "/settings/llm", hidden: !!featureFlags?.hide_llm_settings }, |
| 71 | { path: "/settings", hidden: !!featureFlags?.hide_llm_settings }, |
| 72 | { path: "/settings/app", hidden: false }, |
| 73 | { path: "/settings/secrets", hidden: false }, |
| 74 | ]; |
| 75 | |
| 76 | const firstAvailable = fallbackOrder.find((item) => !item.hidden); |
| 77 | return firstAvailable?.path ?? null; |
| 78 | } |
no outgoing calls
no test coverage detected