Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(credentials): device-flow code display + lobehub mono-brand icon fix
trohitgca5b4d487471
diff --git a/client/src/assets/icons/index.ts b/client/src/assets/icons/index.tsindex 53008998..1977c53f 100644--- a/client/src/assets/icons/index.ts+++ b/client/src/assets/icons/index.ts@@ -49,6 +49,7 @@ import Mistral from '@lobehub/icons/es/Mistral';import Ollama from '@lobehub/icons/es/Ollama';import LmStudio from '@lobehub/icons/es/LmStudio';import Vercel from '@lobehub/icons/es/Vercel';+import Github from '@lobehub/icons/es/Github';type RawSvg = string;@@ -154,12 +155,21 @@ const LOBEHUB_BRANDS: Readonly<Record<string, any>> = {ollama: Ollama,lmstudio: LmStudio,vercel: Vercel,+ github: Github,};const ICON_LIBRARIES: Readonly<Record<string, LibraryResolver>> = {lobehub: (brand) => {const entry = LOBEHUB_BRANDS[brand.toLowerCase()];- return entry?.Color ?? entry?.Avatar ?? null;+ // `.Color` = multi-color brand artwork (openai, claude, gemini, …).+ // Mono-only brands (Github, Vercel) don't export it — their compound+ // default IS the Mono glyph component (`fill="currentColor"`), which+ // scales with NodeIcon's `h-full w-full` and tints with the site's+ // color cascade, staying visible on every theme. The `.Avatar`+ // variant is deliberately NOT used: it renders a fixed-size tile+ // with a hardcoded brand background (black for GitHub) that neither+ // scales with the wrapper nor adapts to dark surfaces.+ return entry?.Color ?? entry ?? null;},// Lucide ships ~1,500 PascalCase forwardRef'd icon components. Same// prefix-dispatch contract as lobehub: backend plugins declarediff --git a/client/src/components/credentials/panels/OAuthPanel.tsx b/client/src/components/credentials/panels/OAuthPanel.tsxindex db0cae02..7ba2a38b 100644--- a/client/src/components/credentials/panels/OAuthPanel.tsx+++ b/client/src/components/credentials/panels/OAuthPanel.tsx@@ -25,6 +25,7 @@ const OAuthPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co<OAuthConnectconfig={config} form={panel.form} connected={connected}stored={panel.stored} loading={panel.loading} error={panel.error}+ verificationCode={panel.verificationCode}icon={<NodeIcon icon={config.iconRef} className="h-6 w-6 text-2xl" />}onSaveCredentials={() => {const missing = config.fields?.find(f => f.required && !panel.form.getFieldValue(f.key)?.trim());diff --git a/client/src/components/credentials/primitives/OAuthConnect.tsx b/client/src/components/credentials/primitives/OAuthConnect.tsxindex 34fc147e..b0fdb08c 100644--- a/client/src/components/credentials/primitives/OAuthConnect.tsx+++ b/client/src/components/credentials/primitives/OAuthConnect.tsx@@ -25,6 +25,9 @@ interface Props {stored: boolean;loading: string | null;error: string | null;+ /** Device-flow one-time code from the login response (RFC 8628) —+ * shown while the user completes auth in the opened browser tab. */+ verificationCode?: string | null;icon: React.ReactNode;onSaveCredentials: () => void;onLogin: () => void;@@ -35,7 +38,7 @@ interface Props {}const OAuthConnect: React.FC<Props> = ({- config, form, connected, stored, loading, error, icon,+ config, form, connected, stored, loading, error, verificationCode, icon,onSaveCredentials, onLogin, onLogout, onRefresh, extraSection,}) => {// Some providers (e.g. Stripe) delegate auth entirely to an external@@ -99,9 +102,19 @@ const OAuthConnect: React.FC<Props> = ({? config.account_label? `Connected as ${config.account_label}.`: `Your ${config.name} account is connected.`- : (stored || !hasRequiredFields)- ? 'Click Login to authorize.'- : 'Enter your credentials above to get started.'}+ : verificationCode+ ? (+ <div className="flex flex-col items-center gap-2 py-1 text-center">+ <span>Enter this one-time code in the browser tab that just opened:</span>+ <code className="select-all font-mono text-3xl font-bold tracking-[0.25em] text-accent">+ {verificationCode}+ </code>+ <span className="text-xs">Click the code to select it, then approve the request to finish connecting.</span>+ </div>+ )+ : (stored || !hasRequiredFields)+ ? 'Click Login to authorize.'+ : 'Enter your credentials above to get started.'}</div></div>diff --git a/client/src/components/credentials/useCredentialPanel.ts b/client/src/components/credentials/useCredentialPanel.tsindex 63b3ffdd..c074e181 100644--- a/client/src/components/credentials/useCredentialPanel.ts+++ b/client/src/components/credentials/useCredentialPanel.ts@@ -33,6 +33,10 @@ export function useCredentialPanel(config: ProviderConfig, visible: boolean) {const [loading, setLoading] = useState<string | null>(null);const [error, setError] = useState<string | null>(null);const [stored, setStored] = useState(false);+ // Device-flow one-time code from the login response (RFC 8628 —+ // GitHub et al. require the user to TYPE it on the verification+ // page, so the panel must display it).+ const [verificationCode, setVerificationCode] = useState<string | null>(null);// Reset transient UI state when the user switches providers so a// "Bot Token required" error from Telegram doesn't bleed into the@@ -42,6 +46,7 @@ export function useCredentialPanel(config: ProviderConfig, visible: boolean) {setError(null);setLoading(null);setStored(false);+ setVerificationCode(null);}, [config.id]);const {@@ -199,16 +204,21 @@ export function useCredentialPanel(config: ProviderConfig, visible: boolean) {}),oauthLogin: () => execute('login', async () => {const res = await sendRequest(config.ws!.login, {});+ setVerificationCode(res.success ? (res.verification_code ?? null) : null);if (res.success && res.url) window.open(res.url, '_blank');return res;}),- oauthLogout: () => execute('logout', () => sendRequest(config.ws!.logout, {})),+ oauthLogout: () => execute('logout', async () => {+ setVerificationCode(null);+ return sendRequest(config.ws!.logout, {});+ }),oauthRefresh: () => execute('refresh', () => sendRequest(config.ws!.status, {})),sendWs: (type: string, data?: Record<string, any>) => execute(type, () => sendRequest(type, data ?? {})),};return {form, values, loading, error, stored, setStored, setError,+ verificationCode,execute, actions, isConnected,getProviderDefaults, saveProviderDefaults,getProviderUsageSummary, getAPIUsageSummary,