Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(icons): add lucide library resolver, fix modal scroll context
trohitg108a81843fd0
diff --git a/client/src/ParameterPanel.tsx b/client/src/ParameterPanel.tsxindex 3096f756..1c3a3ca9 100644--- a/client/src/ParameterPanel.tsx+++ b/client/src/ParameterPanel.tsx@@ -207,6 +207,12 @@ const ParameterPanel: React.FC = () => {maxWidth="95vw"maxHeight="95vh"headerActions={headerActions}+ // ParameterPanelLayout already manages its own scroll regions+ // (params wrapper, console accordion). Opt out of the body's+ // auto-scroll so tall accordion content (Connected Skills,+ // Token Usage) scrolls inside the panel instead of being+ // clipped by a competing outer scroller.+ scrollableBody={false}>{/* Modular Three Panel Layout */}<ParameterPanelLayoutdiff --git a/client/src/assets/icons/index.test.ts b/client/src/assets/icons/index.test.tsnew file mode 100644index 00000000..8e401d11--- /dev/null+++ b/client/src/assets/icons/index.test.ts@@ -0,0 +1,74 @@+/**+ * Icon resolver tests.+ *+ * Locks in:+ * - lucide library refs resolve to a renderable React component+ * - lookup is case-insensitive (mirrors the lobehub behavior)+ * - unknown lucide names return null instead of an unrenderable value+ * - lobehub regression: `lobehub:Claude` still wires to the branded+ * library export+ * - asset:* / data: / http: / emoji passthrough still behaves+ */++import { describe, it, expect } from 'vitest';+import { resolveLibraryIcon, resolveIcon } from './index';++describe('resolveLibraryIcon', () => {+ it('resolves a lucide icon to a forwardRef React component', () => {+ const Icon = resolveLibraryIcon('lucide:Battery');+ expect(Icon).not.toBeNull();+ // Lucide icons are forwardRef'd: object with $$typeof.+ expect(typeof Icon).toBe('object');+ });++ it('is case-insensitive for lucide lookups', () => {+ const lower = resolveLibraryIcon('lucide:battery');+ const upper = resolveLibraryIcon('lucide:BATTERY');+ const mixed = resolveLibraryIcon('lucide:Battery');+ expect(lower).toBe(mixed);+ expect(upper).toBe(mixed);+ });++ it('returns null for unknown lucide names', () => {+ expect(resolveLibraryIcon('lucide:NonexistentIconXYZ')).toBeNull();+ });++ it('still resolves lobehub brand icons (regression)', () => {+ const Icon = resolveLibraryIcon('lobehub:Claude');+ expect(Icon).not.toBeNull();+ });++ it('returns null for unknown library prefixes', () => {+ expect(resolveLibraryIcon('madeup:Battery')).toBeNull();+ });++ it('returns null for non-prefixed strings (callers fall through to resolveIcon)', () => {+ expect(resolveLibraryIcon('π')).toBeNull();+ expect(resolveLibraryIcon('asset:python')).toBeNull();+ expect(resolveLibraryIcon('')).toBeNull();+ expect(resolveLibraryIcon(null)).toBeNull();+ });+});++describe('resolveIcon', () => {+ it('passes through data: / http: / absolute URLs', () => {+ expect(resolveIcon('data:image/svg+xml,<svg/>')).toBe('data:image/svg+xml,<svg/>');+ expect(resolveIcon('https://example.com/x.svg')).toBe('https://example.com/x.svg');+ expect(resolveIcon('/local.svg')).toBe('/local.svg');+ });++ it('passes through plain emoji / short text', () => {+ expect(resolveIcon('π')).toBe('π');+ });++ it('returns null for empty / null / library-prefixed strings', () => {+ expect(resolveIcon('')).toBeNull();+ expect(resolveIcon(null)).toBeNull();+ expect(resolveIcon('lucide:Battery')).toBeNull();+ expect(resolveIcon('lobehub:Claude')).toBeNull();+ });++ it('returns null for unknown asset keys (visible gap, not silent fallback)', () => {+ expect(resolveIcon('asset:nonexistent-icon-xyz')).toBeNull();+ });+});diff --git a/client/src/assets/icons/index.ts b/client/src/assets/icons/index.tsindex d8bd431c..0f5c9aec 100644--- a/client/src/assets/icons/index.ts+++ b/client/src/assets/icons/index.ts@@ -28,6 +28,7 @@import * as React from 'react';import * as Lobehub from '@lobehub/icons';+import * as Lucide from 'lucide-react';type RawSvg = string;@@ -104,6 +105,7 @@ const indexLibrary = (lib: Record<string, unknown>): Record<string, string> =>Object.fromEntries(Object.keys(lib).map((name) => [name.toLowerCase(), name]));const lobehubIndex = indexLibrary(Lobehub as Record<string, unknown>);+const lucideIndex = indexLibrary(Lucide as Record<string, unknown>);const ICON_LIBRARIES: Readonly<Record<string, LibraryResolver>> = {lobehub: (brand) => {@@ -112,6 +114,22 @@ const ICON_LIBRARIES: Readonly<Record<string, LibraryResolver>> = {const entry = (Lobehub as Record<string, any>)[exportName];return entry?.Color ?? entry?.Avatar ?? null;},+ // Lucide ships ~1,500 PascalCase forwardRef'd icon components. Same+ // prefix-dispatch contract as lobehub: backend plugins declare+ // `lucide:Battery` and every consumer already chains+ // resolveLibraryIcon -> resolveIcon, so they light up automatically.+ // Keeps generic UI symbols (battery, wifi, folder, search, ...)+ // declarative without per-icon SVG drops.+ lucide: (name) => {+ const exportName = lucideIndex[name.toLowerCase()];+ if (!exportName) return null;+ const entry = (Lucide as Record<string, any>)[exportName];+ // Lucide icons are forwardRef objects ({ $$typeof, render }); the+ // package also exports a `createLucideIcon` factory function that+ // is not directly renderable. Filter to renderable values only.+ if (entry && typeof entry === 'object' && '$$typeof' in entry) return entry;+ return null;+ },// Add `simpleicons` / other NPM icon packages here as needed:// simpleicons: (brand) => import('simple-icons').si[brand]?.svg ...};diff --git a/client/src/components/ui/Modal.tsx b/client/src/components/ui/Modal.tsxindex 6d33e97c..094f5fe6 100644--- a/client/src/components/ui/Modal.tsx+++ b/client/src/components/ui/Modal.tsx@@ -32,6 +32,18 @@ interface ModalProps {headerActions?: React.ReactNode;/** When true, modal height fits content up to maxHeight instead of fixed at maxHeight. */autoHeight?: boolean;+ /**+ * Body scroll behavior. Default `true` β the body renders an+ * `overflow-y-auto` wrapper for simple short content (alerts,+ * onboarding, pricing config). Set `false` for layouts that declare+ * their own internal scroll regions (parameter panel) so the body+ * uses `overflow-hidden flex-col` instead and there is a single+ * stable scroll context. Without this opt-out, tall accordion+ * content (e.g. Connected Skills under the AI agent panel) gets+ * clipped between the outer body scroller and the inner+ * `flex h-full min-h-0` chain.+ */+ scrollableBody?: boolean;/** Optional extra classes for the content panel. */className?: string;}@@ -45,6 +57,7 @@ const Modal: React.FC<ModalProps> = ({maxHeight = '80vh',headerActions,autoHeight = false,+ scrollableBody = true,className,}) => {const showHeader = Boolean(title || headerActions);@@ -86,7 +99,23 @@ const Modal: React.FC<ModalProps> = ({<DialogTitle className="sr-only">{title || 'Dialog'}</DialogTitle>)}<DialogDescription className="sr-only">{title || 'Modal dialog'}</DialogDescription>- <div className="h-full flex-1 overflow-y-auto">{children}</div>+ {/* Body. Default `scrollableBody` keeps the legacy+ `overflow-y-auto` wrapper for short-content callers+ (alerts, onboarding, pricing config). Layouts that declare+ their own internal scroll regions (parameter panel, etc.)+ opt out so the body uses `overflow-hidden flex-col` and+ the inner `flex h-full min-h-0` chain owns a single,+ stable scroll context β this is what lets tall accordion+ content (Connected Skills) scroll inside the parameter+ panel without getting clipped. */}+ <div+ className={cn(+ 'flex h-full min-h-0 flex-1 flex-col',+ scrollableBody ? 'overflow-y-auto' : 'overflow-hidden',+ )}+ >+ {children}+ </div></DialogPrimitive.Content></DialogPortal></Dialog>