feat: add provider availability detection and normalize legacy "default" model IDs

This commit is contained in:
Mohamed Boudra
2026-02-12 18:04:21 +07:00
parent 8bdd083512
commit 117bbfe2f4
13 changed files with 487 additions and 43 deletions
+36
View File
@@ -1286,6 +1286,10 @@ export class Session {
await this.handleListProviderModelsRequest(msg);
break;
case "list_available_providers_request":
await this.handleListAvailableProvidersRequest(msg);
break;
case "speech_models_list_request":
await this.handleSpeechModelsListRequest(msg);
break;
@@ -2594,6 +2598,38 @@ export class Session {
}
}
private async handleListAvailableProvidersRequest(
msg: Extract<SessionInboundMessage, { type: "list_available_providers_request" }>
): Promise<void> {
const fetchedAt = new Date().toISOString();
try {
const providers = await this.agentManager.listProviderAvailability();
this.emit({
type: "list_available_providers_response",
payload: {
providers,
error: null,
fetchedAt,
requestId: msg.requestId,
},
});
} catch (error) {
this.sessionLogger.error(
{ err: error },
"Failed to list provider availability"
);
this.emit({
type: "list_available_providers_response",
payload: {
providers: [],
error: (error as Error)?.message ?? String(error),
fetchedAt,
requestId: msg.requestId,
},
});
}
}
private async handleSpeechModelsListRequest(
msg: Extract<SessionInboundMessage, { type: "speech_models_list_request" }>
): Promise<void> {