






























@@ -367,14 +367,35 @@ export async function resolveProviderAuths(params: {
367367env: params.env ?? process.env,
368368agentDir: params.agentDir,
369369};
370-const hasAuthProfileStoreSource = hasAnyAuthProfileStoreSource(params.agentDir);
371370const authProfileSourceState: UsageAuthState = {
372371 ...stateBase,
373372allowAuthProfileStore: true,
374373};
374+const hasAuthProfileStoreSource = params.skipPluginAuthWithoutCredentialSource
375+ ? hasAnyAuthProfileStoreSource(params.agentDir)
376+ : false;
375377const auths: ProviderAuth[] = [];
376378377379for (const provider of params.providers) {
380+if (!params.skipPluginAuthWithoutCredentialSource) {
381+const pluginAuth = await resolveProviderUsageAuthViaPlugin({
382+state: authProfileSourceState,
383+ provider,
384+});
385+if (pluginAuth) {
386+auths.push(pluginAuth);
387+continue;
388+}
389+const fallbackAuth = await resolveProviderUsageAuthFallback({
390+state: authProfileSourceState,
391+ provider,
392+});
393+if (fallbackAuth) {
394+auths.push(fallbackAuth);
395+}
396+continue;
397+}
398+378399const directCredentialState = { ...stateBase, allowAuthProfileStore: false };
379400const credentialProviderIds = resolveUsageCredentialProviderIds({
380401state: directCredentialState,
@@ -392,7 +413,6 @@ export async function resolveProviderAuths(params: {
392413providerIds: credentialProviderIds,
393414});
394415const allowAuthProfileStore =
395-!params.skipPluginAuthWithoutCredentialSource ||
396416hasDirectCredentialSource ||
397417(hasAuthProfileStoreSource &&
398418hasAuthProfileCredentialSource({
@@ -409,7 +429,7 @@ export async function resolveProviderAuths(params: {
409429const hasPluginCredentialSource =
410430hasDirectCredentialSource || allowAuthProfileStore || hasLegacyPiAgentCredentialSource;
411431412-if (!params.skipPluginAuthWithoutCredentialSource || hasPluginCredentialSource) {
432+if (hasPluginCredentialSource) {
413433const pluginAuth = await resolveProviderUsageAuthViaPlugin({
414434 state,
415435 provider,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。