fix(FN-1895): improve companies.sh import error handling and add retry behavior
- Surface companies.sh API errors to frontend instead of returning empty list - Add 30s timeout to GitHub archive download to prevent hanging - Prevent infinite retry loop in browse catalog useEffect - Update retry handler to call fetch directly for better control - Fix TypeScript error with Response type in timeout code - Add comprehensive tests for error handling and retry behavior
This commit is contained in:
@@ -2707,6 +2707,12 @@ export interface CompanyEntry {
|
||||
installs?: number;
|
||||
}
|
||||
|
||||
/** Response from companies.sh catalog API */
|
||||
export interface CompaniesCatalogResponse {
|
||||
companies: CompanyEntry[];
|
||||
error?: string;
|
||||
}
|
||||
|
||||
/** Result of importing agents from an Agent Companies source */
|
||||
export interface AgentImportResult {
|
||||
companyName?: string;
|
||||
@@ -2721,9 +2727,10 @@ export interface AgentImportResult {
|
||||
|
||||
/**
|
||||
* Fetch companies from companies.sh catalog.
|
||||
* Returns both companies and optional error message for proper error surfacing.
|
||||
*/
|
||||
export function fetchCompanies(): Promise<CompanyEntry[]> {
|
||||
return api<{ companies: CompanyEntry[] }>("/agents/companies").then((res) => res.companies);
|
||||
export function fetchCompanies(): Promise<CompaniesCatalogResponse> {
|
||||
return api<CompaniesCatalogResponse>("/agents/companies");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user