fix(memory): correct operator precedence in listEmbeddingProviders hasKey check (TS18047)

The previous expression was parsed as (A && B && C) || D, allowing D to evaluate
with creds possibly null. Wrap (apiKey || accessToken) in parens so creds-narrowing
covers the whole disjunction.
This commit is contained in:
diegosouzapw
2026-05-28 10:06:47 -03:00
parent f78ede0324
commit edaa05783d

View File

@@ -256,8 +256,8 @@ export async function listEmbeddingProviders(): Promise<EmbeddingProviderListing
hasKey = !!(
creds &&
!("allRateLimited" in creds && creds.allRateLimited) &&
("apiKey" in creds ? !!creds.apiKey : false) ||
("accessToken" in creds ? !!creds.accessToken : false)
(("apiKey" in creds ? !!creds.apiKey : false) ||
("accessToken" in creds ? !!creds.accessToken : false))
);
} catch {
hasKey = false;