fix(cliproxy): address code review feedback (attempt 1/5)

- Add composite fields to UpdateVariant type (default_tier, tiers)
- Handle forceAuth (--auth) for composite multi-provider variants
This commit is contained in:
Tam Nhu Tran
2026-02-12 08:15:27 +07:00
parent e0ae5f20ff
commit 854b198b64
2 changed files with 29 additions and 0 deletions
+22
View File
@@ -492,6 +492,28 @@ export async function execClaudeWithCLIProxy(
// Multi-provider auth check for composite variants
if (compositeProviders.length > 0) {
// Handle forceAuth for composite providers
if (forceAuth) {
const { triggerOAuth } = await import('../auth-handler');
for (const p of compositeProviders) {
const authSuccess = await triggerOAuth(p, {
verbose,
add: addAccount,
...(forceHeadless ? { headless: true } : {}),
...(setNickname ? { nickname: setNickname } : {}),
...(noIncognito ? { noIncognito: true } : {}),
...(pasteCallback ? { pasteCallback: true } : {}),
...(portForward ? { portForward: true } : {}),
});
if (!authSuccess) {
const pConfig = getProviderConfig(p as CLIProxyProvider);
throw new Error(`Authentication failed for ${pConfig.displayName}`);
}
}
process.exit(0);
}
// Check for unauthenticated providers
const unauthenticatedProviders: string[] = [];
for (const p of compositeProviders) {
if (!isAuthenticated(p)) {
+7
View File
@@ -81,6 +81,13 @@ export interface UpdateVariant {
provider?: CLIProxyProvider;
model?: string;
account?: string;
type?: 'composite';
default_tier?: 'opus' | 'sonnet' | 'haiku';
tiers?: {
opus: { provider: string; model: string; account?: string; thinking?: string };
sonnet: { provider: string; model: string; account?: string; thinking?: string };
haiku: { provider: string; model: string; account?: string; thinking?: string };
};
}
/** OAuth account info for multi-account support */