fix code review

This commit is contained in:
gejifeng
2026-02-11 07:53:19 +00:00
committed by Peter Steinberger
parent e73d881c50
commit 0472dd68f0
4 changed files with 30 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ export {
markAuthProfileGood,
setAuthProfileOrder,
upsertAuthProfile,
upsertAuthProfileWithLock,
} from "./auth-profiles/profiles.js";
export {
repairOAuthProfileIdMismatch,

View File

@@ -66,6 +66,20 @@ export function upsertAuthProfile(params: {
saveAuthProfileStore(store, params.agentDir);
}
export async function upsertAuthProfileWithLock(params: {
profileId: string;
credential: AuthProfileCredential;
agentDir?: string;
}): Promise<AuthProfileStore | null> {
return await updateAuthProfileStoreWithLock({
agentDir: params.agentDir,
updater: (store) => {
store.profiles[params.profileId] = params.credential;
return true;
},
});
}
export function listProfilesForProvider(store: AuthProfileStore, provider: string): string[] {
const providerKey = normalizeProviderId(provider);
return Object.entries(store.profiles)