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