From 30dccb14fe03eacad2c42cb90c932492ab958e35 Mon Sep 17 00:00:00 2001 From: Tam Nhu Tran Date: Tue, 24 Feb 2026 18:23:14 +0700 Subject: [PATCH] fix(ui): move agy power-user mode to proxy settings - move Antigravity power-user toggle from Settings > Auth to Settings > Proxy - keep Add Account messaging consistent with the new location - retain issue #509 risk framing for AGY flows --- .../components/account/add-account-dialog.tsx | 2 +- .../pages/settings/sections/auth-section.tsx | 124 ++---------------- .../pages/settings/sections/proxy/index.tsx | 106 ++++++++++++++- 3 files changed, 113 insertions(+), 119 deletions(-) diff --git a/ui/src/components/account/add-account-dialog.tsx b/ui/src/components/account/add-account-dialog.tsx index 6dd6dba7..3d064d04 100644 --- a/ui/src/components/account/add-account-dialog.tsx +++ b/ui/src/components/account/add-account-dialog.tsx @@ -340,7 +340,7 @@ export function AddAccountDialog({ Power user mode enabled - AGY responsibility checklist is skipped from Settings {'>'} Auth. You accept full + AGY responsibility checklist is skipped from Settings {'>'} Proxy. You accept full responsibility for OAuth/account risk. )} diff --git a/ui/src/pages/settings/sections/auth-section.tsx b/ui/src/pages/settings/sections/auth-section.tsx index fec3c31b..bfbbb59a 100644 --- a/ui/src/pages/settings/sections/auth-section.tsx +++ b/ui/src/pages/settings/sections/auth-section.tsx @@ -3,12 +3,11 @@ * Settings section for CLIProxy auth tokens (API key and management secret) */ -import { useEffect, useState, useCallback, useRef } from 'react'; +import { useEffect, useState, useCallback } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Alert, AlertDescription } from '@/components/ui/alert'; import { ScrollArea } from '@/components/ui/scroll-area'; -import { Switch } from '@/components/ui/switch'; import { RefreshCw, CheckCircle2, @@ -21,7 +20,6 @@ import { Check, KeyRound, ShieldCheck, - ShieldAlert, Save, } from 'lucide-react'; import { useRawConfig } from '../hooks'; @@ -53,10 +51,6 @@ export default function AuthSection() { const [editedSecret, setEditedSecret] = useState(null); const [copiedApiKey, setCopiedApiKey] = useState(false); const [copiedSecret, setCopiedSecret] = useState(false); - const [agyAckBypass, setAgyAckBypass] = useState(false); - const [agyAckBypassLoading, setAgyAckBypassLoading] = useState(true); - const [agyAckBypassSaving, setAgyAckBypassSaving] = useState(false); - const agyAckBypassSavingRef = useRef(false); // Fetch tokens const fetchTokens = useCallback(async () => { @@ -77,28 +71,11 @@ export default function AuthSection() { } }, []); - const fetchAgyAckBypass = useCallback(async () => { - try { - setAgyAckBypassLoading(true); - const response = await fetch('/api/settings/auth/antigravity-risk'); - if (!response.ok) { - throw new Error('Failed to load Antigravity power user settings'); - } - const data = (await response.json()) as { antigravityAckBypass?: boolean }; - setAgyAckBypass(data.antigravityAckBypass === true); - } catch (err) { - setError(err instanceof Error ? err.message : 'Unknown error'); - } finally { - setAgyAckBypassLoading(false); - } - }, []); - // Load on mount useEffect(() => { fetchTokens(); - fetchAgyAckBypass(); fetchRawConfig(); - }, [fetchTokens, fetchAgyAckBypass, fetchRawConfig]); + }, [fetchTokens, fetchRawConfig]); // Clear success after timeout useEffect(() => { @@ -118,8 +95,6 @@ export default function AuthSection() { // Save all changes const saveChanges = async () => { - if (agyAckBypassSaving) return; - const hasApiKeyChange = editedApiKey !== null && editedApiKey !== tokens?.apiKey.value; const hasSecretChange = editedSecret !== null && editedSecret !== tokens?.managementSecret.value; @@ -159,8 +134,6 @@ export default function AuthSection() { // Regenerate management secret const regenerateSecret = async () => { - if (agyAckBypassSaving) return; - try { setSaving(true); setError(null); @@ -185,8 +158,6 @@ export default function AuthSection() { // Reset to defaults const resetToDefaults = async () => { - if (agyAckBypassSaving) return; - try { setSaving(true); setError(null); @@ -226,50 +197,11 @@ export default function AuthSection() { setTimeout(() => setCopiedSecret(false), 2000); }; - const saveAgyAckBypass = async (nextValue: boolean) => { - if (agyAckBypassSavingRef.current || agyAckBypassSaving || saving) return; - - if (nextValue) { - const confirmed = window.confirm( - 'Enable AGY power user mode?\n\nThis skips AGY safety prompts. You accept the OAuth risk.' - ); - if (!confirmed) return; - } - - try { - agyAckBypassSavingRef.current = true; - setAgyAckBypassSaving(true); - setError(null); - - const response = await fetch('/api/settings/auth/antigravity-risk', { - method: 'PUT', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ antigravityAckBypass: nextValue }), - }); - - if (!response.ok) { - const data = (await response.json()) as { error?: string }; - throw new Error(data.error || 'Failed to update Antigravity power user mode'); - } - - setAgyAckBypass(nextValue); - setSuccess( - nextValue ? 'Antigravity power user mode enabled.' : 'Antigravity power user mode disabled.' - ); - await fetchRawConfig(); - } catch (err) { - setError(err instanceof Error ? err.message : 'Unknown error'); - } finally { - agyAckBypassSavingRef.current = false; - setAgyAckBypassSaving(false); - } - }; - const refreshAll = async () => { - if (loading || saving || agyAckBypassSaving) return; + if (loading || saving) return; setError(null); setSuccess(null); - await Promise.all([fetchTokens(), fetchAgyAckBypass(), fetchRawConfig()]); + await Promise.all([fetchTokens(), fetchRawConfig()]); }; if (loading || !tokens) { @@ -344,7 +276,7 @@ export default function AuthSection() { value={displayApiKey} onChange={(e) => setEditedApiKey(e.target.value)} placeholder="API key" - disabled={saving || agyAckBypassSaving} + disabled={saving} className="pr-20 font-mono text-sm" />
@@ -395,7 +327,7 @@ export default function AuthSection() { value={displaySecret} onChange={(e) => setEditedSecret(e.target.value)} placeholder="Management secret" - disabled={saving || agyAckBypassSaving} + disabled={saving} className="pr-20 font-mono text-sm" />
@@ -426,7 +358,7 @@ export default function AuthSection() { variant="outline" size="sm" onClick={regenerateSecret} - disabled={saving || agyAckBypassSaving} + disabled={saving} title="Generate new secure secret" > @@ -434,48 +366,12 @@ export default function AuthSection() {
- {/* Actions */} -
-
-
-
- -

Antigravity Power User Mode

-
-

- Skip AGY responsibility checklists in Add Account and `ccs agy` flows. -

-
- -
-

- Use only if you fully understand the OAuth suspension/ban risk pattern (#509). CCS - cannot assume responsibility for account loss. -

- - Toggle AGY power user mode - -
-
+ {/* Safety */} +
+

+ + Safety +

+
+
+
+

Antigravity Power User Mode

+

+ Skip AGY responsibility checklist in Add Account and `ccs agy` flows. +

+
+ +
+

+ Use only if you fully understand the OAuth suspension/ban risk pattern (#509). CCS + cannot assume responsibility for account loss. +

+ + Toggle AGY power user mode + +
+
+ {/* Remote Settings - Show when remote mode is enabled */} {isRemoteMode && ( { fetchConfig(); + fetchAgyAckBypass(); fetchRawConfig(); fetchBackend(); checkPlusOnlyVariants(); }} - disabled={loading || saving} + disabled={loading || saving || agyAckBypassSaving} className="w-full" >