( agentUiDistDir: string, filePath: string, fallbackToIndex: boolean )
| 52 | } |
| 53 | |
| 54 | export async function pickAgentUiFile( |
| 55 | agentUiDistDir: string, |
| 56 | filePath: string, |
| 57 | fallbackToIndex: boolean |
| 58 | ): Promise<string | null> { |
| 59 | if (isAgentUiPath(agentUiDistDir, filePath) && (await fileExists(filePath))) { |
| 60 | return filePath |
| 61 | } |
| 62 | |
| 63 | if (!fallbackToIndex) { |
| 64 | return null |
| 65 | } |
| 66 | |
| 67 | const indexPath = path.join(agentUiDistDir, `index.html`) |
| 68 | if (!(await fileExists(indexPath))) { |
| 69 | return null |
| 70 | } |
| 71 | return indexPath |
| 72 | } |
| 73 | |
| 74 | export function isAgentUiPath( |
| 75 | agentUiDistDir: string, |
no test coverage detected