* 🐛 fix(desktop): ensure allowPrerelease is set correctly for updater
- Add explicit allowPrerelease check before each update check
- Ensure allowPrerelease is re-applied after setFeedURL call
- Guard against potential internal state resets by electron-updater
* ✨ feat(updater): Enhance prerelease handling for update checks
- Ensure `allowPrerelease` is set correctly before and after update checks to accommodate internal state resets by `electron-updater`.
- Added logging to indicate the configuration of the GitHub update URL and the `allowPrerelease` status.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(mcp): improve system dependency checks and error handling
- Refactored checkSystemDependency method to streamline command execution and error handling.
- Removed unnecessary npx command for package version checks, simplifying the installation verification process.
- Enhanced error handling in InstallError component for better user feedback during MCP installation failures.
- Updated UpdaterManager to prevent auto-update checks in development mode.
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat: update ChatWithModel component to use DropdownMenu
- Replaced the Dropdown component with DropdownMenu for better integration with UI library.
- Added type definitions for DropdownMenuProps to support new properties.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* feat: add the publihs group button into group profiles
* feat: add agent group detail page
* feat: the /community/group_agent pages inital
* feat: upload the agent group detail get fixed
* feat: add the agent group add it to user way
* feat: add agent group in agents list & item update
* feat: update the market-sdk
* feat: add group active tab as overview default
When switching agents via dropdown menu, the activeTopicId was not being
reset, causing messages to be saved to the wrong topic bucket. This fix
adds useEffect hooks to AgentIdSync and GroupIdSync components to detect
agent/group changes and synchronously reset activeTopicId.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* ✨ feat(mcp): enhance error handling and logging for MCP connections
- Introduced MCPConnectionError class to capture and log stderr output during MCP connections.
- Updated McpCtr to handle MCPConnectionError and provide enhanced error messages with stderr logs.
- Modified MCPClient to collect stderr logs and throw enhanced errors when connection issues occur.
- Improved error display in MCPManifestForm to show detailed error information when connection tests fail.
- Added utility functions to parse and extract STDIO process output from error messages.
Signed-off-by: Innei <tukon479@gmail.com>
* 🐛 fix(mcp): remove npx check to prevent hanging during installation check
- Remove `npx -y` package check that could download packages or start MCP servers
- This was causing the UI to hang on "Checking installation environment"
- npm packages don't require pre-installation, npx handles on-demand download
---------
Signed-off-by: Innei <tukon479@gmail.com>
- Add 'next' version support to beta release workflow
- Simplify stable version detection by checking for '-' suffix instead of enumerating prerelease identifiers
- Fix manual trigger flow in stable release workflow
feat(desktop): add desktop release service and API endpoint
ci: add macOS Intel build option to release workflow
test: add tests for desktop release service
refactor: create validation middleware for API routes
* chore: stable updater
* ✨ feat: add local update testing scripts and configuration
- Introduced scripts for local update testing, including setup, server management, and manifest generation.
- Added `dev-app-update.local.yml` for local server configuration.
- Implemented `generate-manifest.sh` to create update manifests.
- Created `run-test.sh` for streamlined testing process.
- Updated `README.md` with instructions for local testing setup and usage.
- Enhanced `UpdaterManager` to allow forced use of dev update configuration in packaged apps.
Signed-off-by: Innei <tukon479@gmail.com>
* 🐛 fix(desktop): update UpdaterManager test mocks for new exports
Add missing mock exports for @/modules/updater/configs:
- isStableChannel
- githubConfig
- UPDATE_SERVER_URL
Add mock for @/env with getDesktopEnv
Add setFeedURL method to autoUpdater mock
* ✨ feat: add Conductor setup scripts and configuration
* ✨ feat: enhance update modal functionality and refactor modal hooks
- Added `useUpdateModal` for managing update modal state and behavior.
- Refactored `UpdateModal` to utilize new modal management approach.
- Improved `useWatchBroadcast` integration for handling update events.
- Removed deprecated `createModalHooks` and related components from `FunctionModal`.
- Updated `AddFilesToKnowledgeBase` and `CreateNew` modals to use new modal context for closing behavior.
This refactor streamlines modal management and enhances the user experience during update processes.
Signed-off-by: Innei <tukon479@gmail.com>
* update flow (#11513)
* ci: simplify desktop release workflow and add renderer tarball
* 👷 ci: fix s3 upload credentials for desktop release
* 🐛 fix(ci): use compact jq output for GitHub Actions matrix
Add -c flag to jq commands to produce single-line JSON output,
fixing "Invalid format" error when setting GITHUB_OUTPUT.
* 🐛 fix(ci): add administration permission to detect self-hosted runner
The /actions/runners API requires administration:read permission
to list repository runners.
* 🔧 refactor(ci): use workflow input for self-hosted runner selection
Replace API-based runner detection with workflow input parameter since
GITHUB_TOKEN lacks permission to call /actions/runners API.
- Add `use_self_hosted_mac` input (default: true)
- Release events always use self-hosted runner
- Manual dispatch can toggle via input
* feat(updater): add stable channel support with fallback mechanism
- Configure electron-builder to generate stable-mac.yml for stable channel
- Update CI workflow to handle both stable and latest manifest files
- Implement fallback to GitHub provider when primary S3 provider fails
- Reset to primary provider after successful update check
* 🐛 fix(updater): remove invalid channel config from electron-builder
- Remove unsupported 'channel' property from electron-builder config
- Create stable*.yml files from latest*.yml in workflow instead
- This ensures electron-updater finds correct manifest for stable channel
* 🐛 fix(updater): use correct channel based on provider type
- S3 provider: channel='stable' → looks for stable-mac.yml
- GitHub provider: channel='latest' → looks for latest-mac.yml
This fixes the 404 error when falling back to GitHub releases,
which only have latest-mac.yml files.
* refactor(env): remove unused OFFICIAL_CLOUD_SERVER and update env defaults
Update environment variable handling by removing unused OFFICIAL_CLOUD_SERVER and setting defaults for UPDATE_CHANNEL and UPDATE_SERVER_URL from process.env during build stage.
* 🐛 fix(ci): add version prefix to stable manifest URLs for S3
S3 directory structure: stable/{version}/xxx.dmg
So stable-mac.yml URLs need version prefix:
url: LobeHub-2.1.0-arm64.dmg → url: 2.1.1/LobeHub-2.1.0-arm64.dmg
* ✨ feat(ci): add renderer tar manifest for integrity verification
Creates stable-renderer.yml with SHA512 checksum for lobehub-renderer.tar.gz
This allows the desktop app to verify renderer tarball integrity before extraction.
* 🐛 fix(ci): fix YAML syntax error in renderer manifest generation
* ✨ feat(ci): archive manifest files in version directory
* refactor(ci): update desktop release workflows to streamline build process
- Removed unnecessary dependencies in the build job for the desktop beta workflow.
- Introduced a new gate job to conditionally proceed with publishing based on the success of previous jobs.
- Updated macOS file merging to depend on the new gate job instead of the build job.
- Simplified macOS runner selection logic in the stable workflow by using GitHub-hosted runners exclusively.
Signed-off-by: Innei <tukon479@gmail.com>
* refactor(electron): reorganize titlebar components and update imports
- Moved titlebar components to a new directory structure for better organization.
- Updated import paths for `SimpleTitleBar`, `TitleBar`, and related constants.
- Introduced new components for connection management and navigation within the titlebar.
- Added constants for title bar height to maintain consistency across components.
This refactor enhances the maintainability of the titlebar code and improves the overall structure of the Electron application.
Signed-off-by: Innei <tukon479@gmail.com>
* feat(ci): add release notes handling to desktop stable workflow
- Enhanced the desktop stable release workflow to include release notes.
- Updated output variables to capture release notes from the GitHub event.
- Adjusted environment variables in subsequent jobs to utilize the new release notes data.
This addition improves the clarity and documentation of releases by ensuring that release notes are included in the workflow process.
Signed-off-by: Innei <tukon479@gmail.com>
* 🐛 fix: call onClose after knowledge base modal closes
* 🧪 test: fix UpdaterManager update channel mocks
---------
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(provider): Enhance Checker and ProviderConfig components for improved state management and UI responsiveness
* 🐛 fix(provider): Enhance credential watching in ProviderConfig for better authentication handling
* ♻️ refactor(desktop): unify TITLE_BAR_HEIGHT constant to desktop-bridge
- Move TITLE_BAR_HEIGHT constant (38) to @lobechat/desktop-bridge package
- Update all references to import directly from the shared package
- Remove duplicate const.ts file from ElectronTitlebar
- Ensure consistency between main process and renderer process
* ✅ test(desktop): update WindowThemeManager test for new TITLE_BAR_HEIGHT
- Update mock to use @lobechat/desktop-bridge instead of @/const/theme
- Update expected height values from 32 to 38
* 🔧 fix(desktop): adjust TITLE_BAR_HEIGHT to prevent container border blocking
- Decrease TITLE_BAR_HEIGHT by 2px to avoid blocking the container border edge in WindowThemeManager.
- Update related test to reflect the new height adjustment.
Signed-off-by: Innei <tukon479@gmail.com>
* 🔧 fix(desktop): further adjust TITLE_BAR_HEIGHT in tests
- Decrease TITLE_BAR_HEIGHT in WindowThemeManager tests from 38px to 36px to maintain consistency with recent changes.
- Update all relevant test cases to reflect the new height.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
The remoteServerUrl selector was returning an empty string in cloud mode,
causing avatar URLs with relative paths to not be properly prefixed with
the remote server URL in desktop environment.
Changes:
- Update remoteServerUrl selector to return OFFICIAL_URL in cloud mode
- Add rawRemoteServerUrl selector for forms that need the original config value
- Fix avatar URL handling in UserAvatar and useCategory
- Update tests to reflect new selector behavior
Fixes LOBE-3197
* feat: add lobehubskill into profiles tools
* feat: agent builder support the lobehub skill in profiles
* fix: slove the agent builder controll agent tools not work problem
* feat: add the publish button to profiles main page
- Upgrade @lobehub/ui to ^4.19.0
- Fix DropdownItem import path
- Change dropdown checkbox type to switch type
- Add showSorterTooltip: false to prevent double tooltip
- Wrap tooltip children with span to fix React warning
* update topic
* update topic
* memory not block
* remove incorrectly memory fetch
* refactor group switch topic
* improve streaming style for Agent Tool display
* fix group tab active issue
* 🐛 fix: E2E test for switching conversations and TypeScript type errors
- Fix E2E test 'AGENT-CONV-002' that was failing when switching between conversations
- Add detection for home page vs agent page state
- Use correct selectors for Recent Topics cards on home page
- Add proper wait time for messages to load after topic switch
- Use '.message-wrapper' selector for message verification
- Fix TypeScript type errors in MakedownRender.tsx
- Add explicit type annotations for a and img component props
- Import ReactNode type
- Remove unused @ts-expect-error directive in useMarkdown.tsx
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: change the cron settings page the config form to new
* feat: change the create new Cron to a single cron/new routes to create
* fix: slove the first into cron the content lost error
* feat: add cron dropdown actions delete topic & remove cronjob
* feat: change the delete button way to header bottom
* fix: slove the cronjob the editor will show old values
* feat: change the enableBusinessFeatures into server config
* fix: overrides @lobehub/ui
* feat: update the cronpage ui
* feat: ui fixed
* feat: add the minstep into 30mins
* ⚡ perf: optimize Portal rendering with React 19 Activity API
- Desktop: Use Activity component to pause updates when Portal is hidden
- Mobile: Add destroyOnHidden to Modal to unmount content when closed
- Prevents unnecessary renders and effect updates when Portal is collapsed
* 🔧 chore: update @lobehub/ui to version 4.17.1 and optimize useYamlArguments hook with useMemo for better performance
Signed-off-by: Innei <tukon479@gmail.com>
* fix: header
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat: improve PageEditor header UX with DropdownMenu and i18n support
- Migrate Header from Dropdown to DropdownMenu component with checkbox support
- Add i18n for Ask Copilot item using common cmdk.askLobeAI key
- Replace BotIcon with Avatar using DEFAULT_INBOX_AVATAR
- Add hideWhenExpanded prop to ToggleRightPanelButton
- Conditionally show page info section only when lastUpdatedTime exists
* 🔧 chore: update @lobehub/ui dependency to version 4.18.0 in package.json
* feat: unify proxy setting style
Signed-off-by: Innei <tukon479@gmail.com>
* fix: test
Signed-off-by: Innei <tukon479@gmail.com>
* fix: test
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* improve group topic usage
update agent group builder
update to v267
update
update to use createAgentOnly
fix to remove activeId
💄 style: update inspector styles
refactor implement for agent builder and group builder
update style
* improve group profile mode
* fix editor canvas EditorData Mode
* move store to groupProfileStore
* update group profile design
* update test
* fix topic switch issue
* update all
* update tests
* fix actions
* ✅ test: add E2E test for sendAsGroup sidebar refresh
Add E2E test to verify that after creating a Group from the Home page
input, the sidebar correctly displays the newly created Group when
returning to the Home page.
This test validates the fix for LOBE-3083 where the sidebar wasn't
refreshing after creating a Group via sendAsGroup.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* ✅ test: rename sendGroup to starter and add Agent test
- Rename sendGroup.feature/steps to starter.feature/steps
- Add E2E test for sendAsAgent sidebar refresh
- Both Agent and Group creation now have E2E test coverage
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* ✨ feat: improve baseline alignment for tool items
Fix baseline alignment issue for KlavisServerItem and LobehubSkillServerItem components.
Fixes LOBE-2106
* refactor: improve next config modification logic by removing webVitalsAttribution and adding invariant checks to property removals.
Signed-off-by: Innei <tukon479@gmail.com>
* refactor: update category selection logic in community interactions steps
- Changed category selection from the second to the third category to better align with the actual category filters.
- Improved code readability by restructuring comments and formatting for better clarity.
- Enhanced logging for URL verification and initial card count checks.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* 🐛 fix(database): remove content validation limits for agent cron jobs
- Remove min(1) validation to allow empty content
- Remove max(2000) validation to allow unlimited content length
- Content can now be empty when using editData for rich content
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ♻️ refactor(types): move agentCronJob schemas to types package
- Create manual Zod schemas in @lobechat/types instead of using createInsertSchema
- Define InsertAgentCronJobSchema and UpdateAgentCronJobSchema manually
- Re-export types from database schema for backward compatibility
- Update router to use new schema imports from @lobechat/types
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
- Add SimpleTitleBar component for secondary windows (onboarding, settings)
- Configure traffic light position for macOS native window controls
- Enhance isMacOSWithLargeWindowBorders to support Electron environment
- Add getDarwinMajorVersion utility for version detection
- Integrate SimpleTitleBar into desktop onboarding layout
- Re-export platform utilities from packages/utils for better accessibility
The MaxTokens setting was missing from the ChatInput ActionBar params
popover after UI refactoring. This adds:
- Enable MaxTokens toggle switch
- MaxTokens slider (0-32000) that appears when enabled
Fixes#11375
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Added comprehensive unit tests for packages/utils/src/server/sse.ts covering:
- formatSSEEvent function with various data types and edge cases
- createSSEWriter methods (connection, error, heartbeat, stream events)
- createSSEHeaders function
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* ✅ test: add E2E tests for Home sidebar Agent and Group management
- Add sidebarAgent.feature with rename/pin/delete scenarios
- Add sidebarGroup.feature with rename/pin/delete scenarios
- Add step definitions for Agent and Group operations
- Support @HOME- tag prefix in hooks.ts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix group renaming
* update setup scripts
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* ✨ fix: Implement dynamic macOS permissions handling and improve module loading
* 🛠️ chore: Remove test job from manual build workflow to streamline CI process
* 🚀 chore: Optimize dependency installation in manual build workflow by running jobs in parallel
- Add pasteAsPlainText prop to ChatInput Editor to prevent rich text paste
- Upgrade @lobehub/editor to ^3.11.0 to support the new feature
Closes LOBE-2657
* ✨ feat: 添加扩展参数支持,增强模型配置功能
* 支持更多扩展参数;支持 openrouter
* style: 添加思考预算扩展参数支持,更新相关标签
* Refactor sliders to use a unified LevelSlider component for improved code reusability and maintainability. Updated GPT52ProReasoningEffortSlider, GPT52ReasoningEffortSlider, GPT5ReasoningEffortSlider, ImageAspectRatioSelect, ImageResolutionSlider, ReasoningEffortSlider, TextVerbositySlider, ThinkingLevel2Slider, ThinkingLevelSlider, and ThinkingSlider to implement controlled and uncontrolled modes. Enhanced aspect ratio selection and resolution sliders with better type safety and default values.
* Refactor reasoning effort sliders and related components to use a factory function for better code reuse and maintainability
- Created `createLevelSliderComponent` to handle both controlled and uncontrolled modes for sliders.
- Updated `GPT5ReasoningEffortSlider`, `GPT51ReasoningEffortSlider`, `GPT52ProReasoningEffortSlider`, `GPT52ReasoningEffortSlider`, `ImageResolutionSlider`, `ImageAspectRatioSelect`, `ReasoningEffortSlider`, `TextVerbositySlider`, `ThinkingSlider`, `ThinkingLevelSlider`, and `ThinkingLevel2Slider` to utilize the new factory function.
- Simplified the logic for handling controlled and uncontrolled states in sliders.
- Added tests for the new slider factory to ensure correct behavior in both controlled and uncontrolled modes.
* Reuses i18n keys via alias mapping for param titles
* fix tests
Show custom context menu only when there's no selection or selection is from
outside the current ChatItem. This allows users to use native browser context
menu for copy/search when selecting text within the current message.
* 🔧 chore(desktop): exclude node_modules from electron-builder packaging
- Add !node_modules to files config to prevent bundling node_modules
- Remove unused asarUnpack config for sharp and @img (not used in electron main process)
Fixes LOBE-3008
* 🔧 chore(file-loaders): move @napi-rs/canvas to devDependencies
@napi-rs/canvas is only used in test/setup.ts for DOMMatrix polyfill,
not required at runtime. Moving to devDependencies allows Vite to
bundle all runtime dependencies as pure JS.
* 🔧 chore(desktop): remove pdfjs-dist from dependencies
Removed the pdfjs-dist package from the dependencies in package.json as it is no longer needed.
Signed-off-by: Innei <tukon479@gmail.com>
* 🔧 chore(desktop): refactor electron-builder configuration and remove unused files
* 🔧 chore(desktop): refactor electron-builder configuration and remove unused files
---------
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(desktop): improve macOS permission requests and Full Disk Access detection
- Add microphone and camera entitlements for hardened runtime
- Implement Full Disk Access detection using protected directory check
- Add native dialog prompt for Full Disk Access permission
- Add window focus broadcast for permission status refresh
- Extract Full Disk Access utilities to separate module
- Remove macOS-specific permissions from Linux/Windows menus
- Update PermissionsStep UI to show checkmark for all granted permissions
- Add comprehensive tests for permission methods
* ✨ feat(desktop): persist onboarding step for app restart recovery
- Add storage functions to persist/restore current onboarding step
- Restore step from localStorage on app restart (prioritized over URL params)
- Clear persisted step when onboarding completes
- Remove unused fullDisk.autoAdd translation key
* feat: generate agent_cron_job in agents
* feat: update the db fields
* feat: add trigger/mode in topics table & add group id in cronjob
* feat: update sql
* fix: fixed db migration
* feat: update the test
* ✨ feat: add nativeButton prop to various components for improved UI consistency
- Updated SwitchPanel, HeaderActions, ActionPopover, and ModelSwitchPanel to include nativeButton={false} for better button behavior.
- Introduced ToolsList component to enhance the tools dropdown functionality in the ActionBar.
- Refactored Tools component to utilize the new ToolsList and streamline the rendering of tool items.
Signed-off-by: Innei <tukon479@gmail.com>
* 🔧 refactor: correct CheckboxItem import and enhance Tools component structure
- Fixed import path for CheckboxItem in multiple files to ensure consistent naming.
- Introduced PopoverContent component to streamline the rendering of tool items in the Tools component.
- Refactored Tools component to utilize PopoverContent for improved organization and maintainability.
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat: enhance PopoverContent and ToolsList components for improved UI
- Introduced static styles for header and footer in PopoverContent to enhance layout consistency.
- Updated ToolsList to include itemIcon styling for better alignment and presentation of icons.
- Modified ToolItem to remove padding for a cleaner appearance.
- Added hasPadding prop to CheckboxItem for flexible padding control.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* 🐛 fix(api): use provider instead of sdkType for API endpoints
Fixed custom AI Provider functionality by correcting API endpoint construction.
Previously used sdkType/runtimeProvider (e.g., 'azure', 'openai') as the API path,
causing server to query wrong provider configuration from database.
Now correctly uses the original provider identifier, allowing custom providers
to work with server-side APIs.
Changes:
- chat/index.ts: use provider for chat API endpoint
- models.ts: use provider for models and modelPull API endpoints
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* ✅ test(models): update test to match API endpoint fix
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* refactor: reduce unused code
Signed-off-by: Innei <tukon479@gmail.com>
* 🐛 fix(desktop): prevent duplicate CORS headers in response
Only add CORS headers if they don't already exist in the server response.
This fixes issues with CDN resources (like cdn.jsdelivr.net) that already
return CORS headers, causing "multiple values" errors.
Fixes LOBE-2765
* 🔧 refactor(desktop): remove IpcServerMethod decorator and related metadata
This update simplifies the IPC method handling by removing the IpcServerMethod decorator and its associated metadata management. The changes include updates to documentation and code references, ensuring a cleaner and more maintainable IPC implementation.
No functional changes were introduced, but the codebase is now more streamlined for future development.
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(desktop): introduce HTTP headers utility functions
Added a new utility module for managing HTTP response headers in Electron, addressing case sensitivity issues. This includes functions to set, get, check existence, and delete headers. Updated the Browser class to utilize these utilities for setting CORS headers, ensuring no duplicates are present.
This enhancement improves code maintainability and simplifies header management in the application.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(navigation): implement history navigation in the desktop app
- Add 'Back' and 'Forward' options to the menu for navigating history.
- Introduce a new NavigationBar component to handle navigation actions.
- Implement hooks for managing navigation history and updating the UI accordingly.
- Enhance the Electron store to support navigation history state management.
- Add route metadata for better navigation context.
This update improves user experience by allowing easy back and forward navigation within the app.
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(localization): add navigation labels in multiple languages
- Introduced new localization entries for navigation history in various languages, including Arabic, Bulgarian, German, Spanish, Persian, French, Italian, Japanese, Korean, Dutch, Polish, Portuguese, Russian, Turkish, Vietnamese, Chinese (Simplified and Traditional).
- Updated existing localization files to include 'Back', 'Forward', and 'Go' labels for improved user navigation experience.
This enhancement supports a more inclusive user interface by providing localized navigation options.
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(desktop): add Home menu item and simplify navigation UI
- Remove keyboard shortcut hints from Recently Viewed tooltip
- Add Home menu item to Go menu on all platforms (macOS, Linux, Windows)
- Add Home translations for all 17 supported locales
* 🌐 i18n(desktop): use i18n for Recently Viewed tooltip
* ✨ feat(macOS): update history navigation accelerators in menu
- Change keyboard shortcuts for 'Back', 'Forward', and 'Home' menu items to use macOS conventions.
- Add unit test to verify correct accelerators are set for history navigation.
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ refactor(ElectronTitlebar): remove unused navigation history hook
- Deleted the `useInitNavigationHistory` hook and its associated logic from the ElectronTitlebar component.
- Cleaned up the code to improve maintainability and reduce unnecessary complexity.
This change streamlines the title bar functionality by eliminating unused code.
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ refactor(NavPanel): streamline navigation panel functionality
- Replaced the `useNavPanel` hook with a new `useNavPanelSizeChangeHandler` for better size management.
- Introduced `NavPanelDraggable` component to encapsulate draggable panel logic, improving code organization and readability.
- Updated `NavHeader` to utilize global store for panel state management, enhancing state consistency across components.
- Removed unused styles and logic from `NavPanel`, simplifying the component structure.
This refactor enhances maintainability and performance of the navigation panel system.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat(notebook): add i18n, Inspector and Streaming components
- Add i18n entries for notebook tool in plugin.ts
- Add zh-CN and en-US translations
- Add CreateDocument Inspector component for streaming status display
- Add CreateDocument Streaming component for real-time markdown preview
- Add AnimatedNumber helper component
- Export NotebookInspectors and NotebookStreamings from client
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 🐛 fix(notebook): simplify Inspector to show title directly
Follow WebSearch Inspector pattern - use direct string concatenation
instead of Trans component
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 🐛 fix(notebook): add isLoading state for shiny animation
Match WebSearch Inspector pattern - show shiny animation during
both streaming and loading states
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor
* improve document
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Fixes LOBE-2838
This commit resolves the issue where the input field wasn't properly focused when renaming topics through the context menu.
Changes:
- Created FocusableInput component that ensures input focus using queueMicrotask
- Replaced autoFocus prop with proper ref-based focus management
- Simplified onBlur handler logic
- Removed duplicate toggleEditing call from handleUpdate
The queueMicrotask approach ensures the focus happens after the Popover has fully rendered and positioned itself.
✨ feat: move new topic button to navigation panel
- Move "Add New Topic" button from header to navigation panel for better UX
- Integrate with existing NavItem component for consistent styling
- Add loading state during topic creation
- Auto-navigate from agent profile back to chat when creating new topic
Fixes LOBE-2454
- Upgrade @lobehub/editor to ^3.7.0 to get codeblock fix
- Use INSERT_CODEMIRROR_COMMAND directly instead of editorState.codeblock()
- Add proper focus handling after inserting codeblock
- Remove unused editorState dependency from useSlashItems
- Add proper type annotation for editorState
* ✨ feat: Add browser compatibility detection and fallback page
- Add automatic browser compatibility check in app layout
- Create standalone not-compatible.html fallback page with modern responsive design
- Support dark mode via prefers-color-scheme
- Include browser download links (Chrome, Firefox, Edge, Safari, Arc)
- Display minimum browser requirements
- Update feature development documentation
* 📝 docs(CLAUDE): Update PR Linear Issue Association guidelines
- Clarify the requirement to include magic keywords in PR body for Linear issues.
- Add instruction to summarize work done in the Linear issue comment and update the issue status to "In Review".
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat: Update browser compatibility page and layout
- Change favicon link to absolute path in not-compatible.html.
- Add Safari browser support with corresponding icon and link.
- Update minimum browser requirements to Chrome 99+, Safari 16.4+, and Edge 99+.
- Fix typo in layout.tsx comments from "serveral" to "several".
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* feat: add the lobehub market tools servers
* feat: change all marketConnect to lobehubSkill & update the tools meta to show
* fix: slove test error
* chore: update the package json
* 🐛 fix: correct BrandTextLoading position after removing SSG CSS-in-JS injection
Fixed the issue where the first-screen loading component was positioned
incorrectly at the top after removing SSG CSS-in-JS injection.
Extracted positioning styles to a separate CSS module to ensure correct
centering during initial load.
Fixes LOBE-2815
* ✨ refactor: simplify BrandTextLoading component and remove spinner styles
* Update src/components/Loading/BrandTextLoading/index.module.css
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* 🐛 fix: add separate border-radius for bottom-right corner on macOS 26 Chrome
Fix issue where the main container's bottom-right corner radius was not applied correctly on macOS 26 Chrome.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* 📝 docs(CLAUDE): add PR Linear Issue Association guidelines
Include a new section in CLAUDE.md outlining the requirement to use magic keywords in PR bodies for associating with Linear issues, enhancing clarity on issue tracking.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
* 🔧 chore(dependencies): update @lobehub/ui to version 4.11.4 and refactor Popover usage across multiple components for consistency
* 🔧 chore(dependencies): update @lobehub/ui to version 4.11.5 and refactor Popover usage across multiple components for consistency
Signed-off-by: Innei <tukon479@gmail.com>
* 🔧 chore: remove TypeScript error suppression for EmojiPicker popupProps in AgentHeader component
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* 📝 docs(self-hosting): add OAuth token exchange troubleshooting for Docker reverse proxy
Add troubleshooting section for OAuth authentication failures when using Docker deployment behind reverse proxy. The issue occurs when MIDDLEWARE_REWRITE_THROUGH_LOCAL=1 (default) rewrites OAuth token exchange URLs to localhost.
Fixes#10166
* ✨ feat(model-bank): add grok-4 model support
Add Grok 4 model to lobehub models with the following capabilities:
- Function call, reasoning, search, and vision support
- 256K context window
- Search implementation via params
* fix: Translation
* feat: Search settings command in any page
* feat: Add more cloud-dedicated actions
* feat: New CMDK style
* feat: New CMDK style
* fix: Commands order
* fix: Type error
* ♻️ refactor: Convert glossary from JSON to Markdown table format
- Migrate glossary.json to docs/glossary.md with table format
- Update .i18nrc.js to read glossary from Markdown file
- Add more terminology entries (agentGroup, thread)
- Improve readability with structured table layout
* update i18n
* update glossary
* 🐛 fix: fix file type
* 🐛 fix: resolve desktop upload CORS issue
Expand CORS bypass to handle all HTTP/HTTPS requests in desktop app.
Previously, CORS bypass only applied to local file server (127.0.0.1),
which caused upload failures when the renderer uses app:// protocol.
Changes:
- Remove Origin header from all requests to prevent CORS preflight
- Add permissive CORS headers to all responses
- Update comments to reflect the new behavior
Resolves LOBE-2581
* 🐛 fix: enhance CORS handling in desktop app
Refine CORS bypass implementation to store and utilize the original Origin header for responses. This change ensures proper CORS headers are added based on the request's origin, improving compatibility with credentialed requests and OPTIONS preflight handling.
Changes:
- Store Origin header for each request and remove it to prevent CORS preflight.
- Add CORS headers to responses using the stored origin.
- Implement caching for OPTIONS requests with a max age.
Resolves LOBE-2581
Signed-off-by: Innei <tukon479@gmail.com>
* 🐛 fix: add onBeforeSendHeaders mock to Browser tests
Enhance the Browser test suite by adding a mock for the onBeforeSendHeaders function in the session's webRequest object. This addition improves the test coverage for CORS handling scenarios.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
Fix failing close event handling tests by restoring the getBounds mock
return value in beforeEach after vi.clearAllMocks(). The issue occurred
because clearAllMocks() removed the getBounds mock behavior set during
hoisting, causing x and y coordinates to be undefined instead of 0.
- Use findAll with kind: 'pair' instead of find with pattern for redirects
- Add webVitalsAttribution removal logic
- Improve pattern matching to handle spacing variations
- Add invariant checks for better error handling
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* 🐛 fix(model-runtime): handle incremental tool call chunks in Qwen stream
When streaming tool calls, subsequent chunks may not have an id (only
incremental arguments). The previous code generated a new id for each
chunk, causing the parser to treat them as different tool calls instead
of merging the arguments.
Changes:
- Store first tool call's info in streamContext.tool for subsequent chunks
- Use stored tool id from streamContext for incremental chunks without id
- Add test case for mixed text + incremental tool calls (DeepSeek style)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* update WorkingDirectory
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* 🐛 fix(model-runtime): handle Qwen tool_calls without initial arguments
Qwen models (e.g., qwen3-vl-235b-a22b-thinking) send tool_calls in
two separate chunks:
1. First chunk: {id, name} without arguments
2. Second chunk: {id, arguments} without name
Previously, the code directly passed `value.function`, which caused
undefined values for arguments/name in respective chunks.
Changes:
- Add default values for function.arguments (empty string) and
function.name (null) in Qwen stream transformer
- Align behavior with OpenAI/vLLM stream handling
- Add test cases for split tool_call chunks scenario
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 🐛 fix: fix openai parallel tools calling in chat competition
* 💄 style: improve style
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: Add static export modifier for Electron, refactor route variant constants, and simplify renderer file path resolution.
* refactor: Extract renderer URL and protocol management into a dedicated `RendererUrlManager` and update `App` to utilize it.
Signed-off-by: Innei <tukon479@gmail.com>
* feat: Implement Electron app locale management and i18n initialization based on stored settings.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
When assistant messages have array content (e.g., containing thinking
blocks) but no tool_calls, the code incorrectly tried to call .trim()
on the array, causing "TypeError: content?.trim is not a function".
Changes:
- Add check for array content type before processing
- Use buildArrayContent() to properly handle array content
- Return undefined for empty array content (consistent with empty string)
- Add 2 test cases for array content scenarios
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* ✨ feat: support to show working dir
* fix style
* update docs
* update topic
* refactor to use chat config
* inject working Directory
* update i18n
* fix tests
* fix kb issue
* 🔒 fix(file): validate file size from S3 instead of trusting client input
Security fix for GHSA-wrrr-8jcv-wjf5: The file upload feature did not
validate the integrity of upload requests, allowing users to manipulate
the size parameter to bypass quota limits.
Changes:
- Add getFileMetadata method to S3 module using HeadObjectCommand
- Add getFileMetadata to FileServiceImpl interface and implementations
- Update createFile router to fetch actual file size from S3
- Add comprehensive tests for the new functionality
- Fix duplicate import in knowledgeBase.test.ts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* 🐛 fix(ci): use allowed_tools instead of claude_args for claude-translator
Fix shell parsing issue where special characters in claude_args were
incorrectly split. The parentheses and asterisks in tool patterns like
`Bash(gh issue view *)` were being parsed by shell, causing:
- "Bash(gh issue view *)" to become ["Bash", "gh", "issue", "view", "*"]
Changes:
- Replace `claude_args: "--allowed-tools ..."` with `allowed_tools: '...'`
- Use colon separator format consistent with other workflows
- Simplify tool patterns while maintaining security restrictions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* ♻️ refactor: refactor to remove meta in message
* ✅ test: update test fixtures to remove deprecated meta field
- Update 8 snapshots in prompts package for groupChat tests
- Remove meta field from 36 JSON fixtures in conversation-flow package
- Updated both inputs and outputs fixtures
- Covers: linear-conversation, tasks, branch, compare, agentCouncil,
agentGroup, assistantGroup scenarios
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* ♻️ refactor: migrate to new DropdownMenuV2 and showContextMenu API
- Replace Dropdown with DropdownMenuV2 for action menus
- Use showContextMenu for context menu handling instead of Dropdown wrapper
- Update @lobehub/ui to preview version with new context menu API
- Add styles for popup-open state in NavItem component
* ♻️ refactor: migrate to new DropdownMenuV2 and showContextMenu API
* chore: Update @lobehub/ui dependency to version ^4.6.3.
Signed-off-by: Innei <tukon479@gmail.com>
* ♻️ refactor: migrate to new DropdownMenuV2 and showContextMenu API
- Remove deprecated ContextMenu component
- Migrate all context menu usages to DropdownMenuV2 and showContextMenu API
- Update multiple Action components across Conversation features
- Update ResourceManager toolbar components
- Clean up related styles
🤖 Generated with [Claude Code](https://claude.com/claude-code)
* feat: Update `@lobehub/ui` dependency, simplify `ActionIconGroup` menu prop, and ensure action group visibility when popups are open.
Signed-off-by: Innei <tukon479@gmail.com>
* fix: Add null check for context menu items, include debug log, and update `@lobehub/ui` dependency.
Signed-off-by: Innei <tukon479@gmail.com>
* ♻️ refactor: migrate TopicSelector to new DropdownMenuV2 API
Migrate from antd/Dropdown to @lobehub/ui DropdownMenu component
with checkbox items pattern.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Signed-off-by: Innei <tukon479@gmail.com>
* ✅ test(e2e): add Agent conversation E2E test with LLM mock
- Add LLM mock framework to intercept /webapi/chat/openai requests
- Create Agent conversation journey test (AGENT-CHAT-001)
- Add data-testid="chat-input" to Desktop ChatInput for E2E testing
- Mock returns SSE streaming responses matching LobeChat's actual format
Test scenario: Enter Lobe AI → Send "hello" → Verify AI response
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 📝 docs(e2e): add experience-driven E2E testing strategy
Add comprehensive testing strategy from LOBE-2417:
- Core philosophy: user experience baseline for refactoring safety
- Product architecture coverage with priority levels
- Tag system (@journey, @P0/@P1/@P2, module tags)
- Execution strategies for CI, Nightly, and Release
- Updated directory structure with full journey coverage plan
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 docs(e2e): add E2E testing guide for Claude
Document key learnings from implementing Agent conversation test:
- LLM Mock SSE format and usage
- Desktop/Mobile dual component handling with boundingBox
- contenteditable input handling
- Debugging tips and common issues
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 📝 docs(e2e): add experience-driven E2E testing strategy
Add comprehensive testing strategy from LOBE-2417:
- Core philosophy: user experience baseline for refactoring safety
- Product architecture coverage with priority levels
- Tag system (@journey, @P0/@P1/@P2, module tags)
- Execution strategies for CI, Nightly, and Release
- Updated directory structure with full journey coverage plan
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 docs(e2e): add E2E testing guide for Claude
Document key learnings from implementing Agent conversation test:
- LLM Mock SSE format and usage
- Desktop/Mobile dual component handling with boundingBox
- contenteditable input handling
- Debugging tips and common issues
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* update sop
* update sop
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
When switching to a new topic state (topicId = null), the previous
messages in the `_new` key might remain as stale data. This causes
old messages to appear when users click "New Topic".
Changes:
- Add `SwitchTopicOptions` interface with `scope` and `skipRefreshMessage`
- Modify `switchTopic` to support both boolean and options object (backward compatible)
- Clear the corresponding scope's `_new` key when switching to new state
- Add 6 new test cases for the new functionality
Closes: LOBE-2456
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
- Introduced createImageBusinessMiddleware for additional processing in the createImage mutation.
- Updated imageRouter to utilize the new middleware, improving the structure and maintainability of the image generation logic.
- Add JWKS_KEY env variable with fallback to OIDC_JWKS_KEY
- Add signInternalJWT() and validateInternalJWT() in internalJwt.ts
- Use short-lived JWT (3s) with purpose claim to authenticate lambda → async calls
- Remove KEY_VAULTS_SECRET from Authorization header transmission
- Update OIDC provider to use JWKS_KEY from authEnv
- Update documentation for JWKS_KEY and desktop sync
* feat: open the gtd & document tools in normal agent
* feat: add getAllbuildintools in agent profles tools settings
* fix: slove the tools modal segment not work
* feat: support editor placeholder
- Added Redis integration to cache presigned URLs, reducing S3 API calls.
- Implemented cache hit/miss logic to improve performance.
- Set cache expiration time to 4 minutes.
- Change the link paths in PlanTag component to direct users to '/settings/plans' and '/settings/usage' based on the isFree flag, improving navigation consistency.
- Modify the prebuild script in package.json to include echo statements for NEXT_PUBLIC_AUTH_URL, NEXTAUTH_URL, APP_URL, and VERCEL_URL, enhancing visibility of environment variables during the build process.
- Import BRANDING_PROVIDER and ENABLE_BUSINESS_FEATURES constants.
- Modify getEmbeddingRuntime to select the model provider based on the ENABLE_BUSINESS_FEATURES flag, enhancing flexibility in model usage.
- Remove isDesktop check for upload flow
- Remove uploadToDesktopS3 method
- Clean up related mocks in tests
- Simplify upload service to use server-side logic only
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* ✅ test(e2e): add Agent conversation E2E test with LLM mock
- Add LLM mock framework to intercept /webapi/chat/openai requests
- Create Agent conversation journey test (AGENT-CHAT-001)
- Add data-testid="chat-input" to Desktop ChatInput for E2E testing
- Mock returns SSE streaming responses matching LobeChat's actual format
Test scenario: Enter Lobe AI → Send "hello" → Verify AI response
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 📝 docs(e2e): add E2E testing guide for Claude
Document key learnings from implementing Agent conversation test:
- LLM Mock SSE format and usage
- Desktop/Mobile dual component handling with boundingBox
- contenteditable input handling
- Debugging tips and common issues
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 📝 docs(e2e): add experience-driven E2E testing strategy
Add comprehensive testing strategy from LOBE-2417:
- Core philosophy: user experience baseline for refactoring safety
- Product architecture coverage with priority levels
- Tag system (@journey, @P0/@P1/@P2, module tags)
- Execution strategies for CI, Nightly, and Release
- Updated directory structure with full journey coverage plan
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* add conversation case
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* add e2e tests
* fix workflow
* update workflow
* 🐛 fix(e2e): fix smoke tests i18n and timeout issues
- Unify default port to 3006 across hooks.ts and world.ts
- Reduce step timeout from 30s to 10s for faster feedback
- Fix i18n matching for featured sections (support zh-CN/en-US)
- Add mock framework foundation for future API mocking
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 🐛 fix(e2e): save failure screenshots to file for CI artifacts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 🐛 fix(e2e): move PORT to global env for consistent access
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* 🐛 fix(e2e): set onboarding as completed for test user
Skip onboarding flow by setting finishedAt in test user seed
* ✨ feat(model): improve model list UI and add disabled models management
- Enhanced DisabledModels component with better UI/UX
- Updated ModelList layout and interactions
- Added repository methods for disabled model management
- Improved AI model service and router functionality
- Added tests for new functionality
* ✨ feat(DisabledModels): enhance loading and rendering logic for disabled models
- Implemented pagination and dynamic loading for disabled models
- Improved state management for visible models and loading conditions
- Ensured unique model entries in the displayed list
- Updated component to handle provider changes effectively
Signed-off-by: Innei <tukon479@gmail.com>
* fix(DisabledModels): handle edge case for last page in pagination logic
- Added a check to ensure lastPage is defined before evaluating pagination end conditions
- Improved robustness of loading state management in DisabledModels component
Signed-off-by: Innei <tukon479@gmail.com>
* lint
* lint
* lint
---------
Signed-off-by: Innei <tukon479@gmail.com>
* feat: enhance macOS desktop permissions and onboarding
- Improve screen recording access request with dual-method approach
(Electron API + getDisplayMedia trigger for TCC registration)
- Add auto-add functionality for Full Disk Access using AppleScript
- Make onboarding flow platform-aware (skip Screen3 on non-macOS)
- Add NSAppleEventsUsageDescription and NSScreenCaptureUsageDescription
- Add comprehensive unit tests for permission flows
* feat: implement full disk access automation and enhance onboarding messages
* feat: enhance Screen5 with context menu support and update theme background color
* fix: slove wait list always jupm wait problem
* 🐛 fix: slove wait list always jump wait problem (#11042)
fix: slove wait list always jupm wait problem
* fix: roll back state.isInWaitList judge problem
* fix: slove the group add member checkbox notwork
* ✨ feat(onboarding): add English and Chinese localization for desktop onboarding screens
* ✨ feat(onboarding): implement sign out functionality and enhance onboarding experience
* ✨ feat(remote-server): implement broadcast for remote server configuration updates
* update
* feat: use lobehub editor to modify gtd plan
* merge origin/dev
* feat: show todo in doc portal
* feat: use the todoProcess in docs portal
* feat: add gtd context engine inject
* 🧪 fix: improve test infrastructure and mock configurations
- Add vitest plugin to fix @lobehub/fluent-emoji style import issue
- Update antd-style mocks to preserve actual exports while mocking specific functions
- Switch from useClientDataSWR to useClientDataSWRWithSync in tests
- Add @/utils/identifier alias in vitest config
- Fix duplicate @lobehub/ui mock in ComfyUIForm test
* 🐛 fix: use recommended-legacy for ESLint 8 compatibility
The @next/eslint-plugin-next v16 changed to flat config format which is
incompatible with ESLint 8. Using recommended-legacy to maintain compatibility.
- Fixed the syntax of the partialBuildPages array in prebuild.mts by replacing a trailing comma with a closing brace.
- Ensured proper structure for the array to avoid potential runtime errors.
Signed-off-by: Innei <tukon479@gmail.com>
- Updated NODE_OPTIONS from 6144MB to 8192MB in Dockerfile, package.json scripts, GitHub workflows, and environment configurations.
- Ensured consistent memory allocation for builds and tests to improve performance.
Signed-off-by: Innei <tukon479@gmail.com>
- Add isBundleAnalyzer check in prebuild script to skip backend routes when ANALYZE=true && CI=true
- Update bundle analyzer workflow to use fallback KEY_VAULTS_SECRET from generate-secret step
- Increase NODE_OPTIONS memory limit to 8GB
- Remove unnecessary S3_PUBLIC_DOMAIN and APP_URL env vars
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* 🐛 fix: simplify translation key access and add fallback logic
- Remove special handling for 'models' and 'providers' namespaces in create.ts
- Use flat key structure (direct object access) instead of nested get()
- Add fallback to default module when locale JSON is missing
- Add tests for missing key fallback behavior
* 🐛 fix: locale resolve bug with ESM module loading
Fix locale resolution in desktop and server environments by properly handling ESM module loading and adding fallback logic for translation namespaces.
Also move lexical from devDependencies to dependencies in builtin-tool-page-agent to fix type-check issues.
Updated model descriptions in test snapshots from Chinese to English to align with model-bank package updates.
Changes:
- Fixed descriptions in parseModels.test.ts for gpt-4o, gpt-4o-mini, and o1-mini
- Fixed descriptions in openaiCompatibleFactory/index.test.ts for claude-3-haiku-20240307 with correct smart quote (U+2019)
- Updated related snapshot files for responsesStream, novita, openai, and ppio providers
All tests passing:
- parseModels.test.ts: 49 tests ✓
- openaiCompatibleFactory/index.test.ts: 65 tests ✓
fix: update test snapshots for model description changes
Update test snapshots to reflect English model descriptions replacing Chinese ones.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
- Add post-condition assertions to all file modification operations
- Add verify-desktop-patch.yml workflow for CI validation
- Add invariant, updateFile, writeFileEnsuring, removePathEnsuring utilities
- Improve error messages and validation in workflow scripts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* refactor: remove memoization from InputArea component and adjust Flexbox padding in Checker component
* style: enhance layout and spacing in ProviderMenu and ModelList components
* fix: update FloatPanel to conditionally render FloatButton based on isDesktop
* feat: add NewModelBadge component and refactor ModelInfoTags to use FeatureTagItem for improved rendering
* remove
* style: enhance UpdatePrompt component with new styles and improve layout for better readability
Translate all AI model and model provider descriptions from Chinese to English for better international accessibility and consistency.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* refactor(i18n): move UI locale files from TypeScript to JSON format
- Move UI locale translations from src/locales/ui/*.ts to locales/{locale}/ui.json
- Add src/locales/default/ui.ts for default (en-US) translations
- Update getUILocaleAndResources.ts to load from JSON files
- Add ui.json for all 18 supported locales (ar, bg-BG, de-DE, en-US, es-ES, fa-IR, fr-FR, it-IT, ja-JP, ko-KR, nl-NL, pl-PL, pt-BR, ru-RU, tr-TR, vi-VN, zh-CN, zh-TW)
This change unifies the locale file format, using JSON for all translations
instead of mixing TS and JSON formats.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: throw error when UI locale resources and fallback both fail
Instead of returning an empty object which could cause silent failures
in string lookups, throw an error when both the primary locale and
en-US fallback fail to load.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(i18n): remove component-level texts props and unused locale keys
- Remove texts props from all @lobehub/ui components (EmojiPicker, Form.SubmitFooter, Hotkey, ColorSwatches)
- Remove unused 'custom' and 'presets' keys from color.json files (only used for ColorSwatches texts prop)
- Components now use @lobehub/ui's built-in translations via ConfigProvider resources
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(i18n): remove unused locale keys from default locale files
- Remove EmojiPicker.* keys from components.ts (only used for texts prop)
- Remove submitFooter.* keys from setting.ts (only used for texts prop)
- Remove custom and presets keys from color.ts (only used for ColorSwatches texts prop)
- Update getUILocaleAndResources tests to reflect new behavior
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor(i18n): enhance getUILocaleAndResources with fallback logic
* style: format code and remove unused imports
- Remove unused useTranslation import from EmojiPicker
- Format code with prettier
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
When using English locale variants (e.g., en-GB, en-AU), the translation system should fall back to the default English namespace instead of trying to load non-existent locale files.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* chore: update lint to use type imports
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* revert
* chore: add workspaces and overrides to package.json
* refactor: clean up imports in lobe-web-browsing executor
---------
Co-authored-by: Claude <noreply@anthropic.com>
- Added bcryptjs as a dependency for handling password verification.
- Updated the defineConfig function to support bcrypt password hashes migrated from Clerk.
- Implemented a new password verification method that checks for bcrypt hashes and falls back to BetterAuth's default verification.
- Introduced a new optional property `turbopack` in the CustomNextConfig interface.
- Updated the defineConfig function to merge turbopack settings from the provided config.
Translate all plugin-related UI strings from Chinese to English following the microcopy guidelines:
- Use "Skill" as the standard term (not tool/plugin)
- Consistent terminology: Agent, Group, Library, Page, Memory, Workspace
- Clear, actionable language with concise phrasing
- Natural product-native English (avoid translationese)
- Preserved all placeholders for interpolation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* feat: add a custom drag upload way
* feat: add agent bulilder & page builder & group chat support upload files
* feat: use upload fileitem to show detail
* feat: support preview in chatinput files
* feat: add useUploadFiles hook to replace the repeat logic code
* 🐛 fix: fix desktop test cases and refactor translations
- Import translations from default locale instead of hardcoding
- Fix macOS menu test expectations to match actual translations
- Update I18nManager test to match implementation (fallbackLng: 'en')
- Support {{appName}} interpolation in test mocks
* 🐛 fix: add missing buildAndSetAppMenu calls in tests
* 🐛 fix: fix desktop test cases and refactor translations
- Import translations from default locale instead of hardcoding
- Fix macOS menu test expectations to match actual translations
- Update I18nManager test to match implementation (fallbackLng: 'en')
- Support {{appName}} interpolation in test mocks
* 🐛 fix: add missing buildAndSetAppMenu calls in tests
* refactor page agent
* refactor page agent system prompt
* support inject page context in the agent runtime
* fix initial context injection
* support diff all toolbar
Use `|| true` to ensure the build step always succeeds and continues
to the report upload step, even if the actual build fails.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
- Add isBundleAnalyzer check in prebuild script to skip backend routes when ANALYZE=true && CI=true
- Update bundle analyzer workflow to use fallback KEY_VAULTS_SECRET from generate-secret step
- Increase NODE_OPTIONS memory limit to 8GB
- Remove unnecessary S3_PUBLIC_DOMAIN and APP_URL env vars
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* feat: add always show tools render in createPlan & createDoc tools
* feat: add document protral can modify & jump to pages to modify it
* feat: add a warpper into portal render
Changed the macOS app menu's "About" action from using the default Electron
about dialog to navigating to the Settings page's About tab.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
Rename the main browser identifier from 'chat' to 'app' to better represent its purpose as the main application window. Also update the initial path from '/agent' to '/' for the root route.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
- Flatten all nested i18n objects to dot notation format (e.g. 'dialog.about.title')
- Add en-* locale fallback to use default TypeScript files
- Extract hardcoded Chinese strings in menu files to i18n keys
- Update 17 locale JSON files with flattened structure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* ✨ feat(ci): add bundle analyzer workflow
- Add GitHub Actions workflow for bundle size analysis
- Generate pnpm lockfile for reproducible builds
- Include analyzer reports and lockfile in artifacts
- Use pnpm for dependency installation
- Run build:analyze script directly for bundle generation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(ci): add required env vars for bundle analyzer build
- Add KEY_VAULTS_SECRET generation step
- Add S3_PUBLIC_DOMAIN and APP_URL env vars
- Fixes build error when running build:analyze
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* ♻️ refactor: i18n formatting optimization
* ✨ feat(i18n): update localization strings for clarity and consistency across chat, discover, and settings components
* ✨ feat(i18n): update Chinese localization strings for improved clarity and consistency across various components, including chat, onboarding, and settings
* 🗑️ chore(i18n): remove outdated localization files for multiple languages to streamline the project and improve maintainability
* ✨ feat(i18n): enhance localization loading logic to improve language handling and streamline imports for default and normalized locales
* 🐛 fix(i18n): restore English i18n keys that were incorrectly changed to Japanese characters
* ✨ chore(i18n): Adjust Latin language locales for terminology consistency (#10933)
* This comprehensive update ensures all Latin language locales (de-DE, fr-FR, es-ES, it-IT, pt-BR, nl-NL, pl-PL) follow the microcopy style guide's terminology requirements.
**Total: 557 changes across 7 Latin locales**
1. **"Plugin" → "Skill"**
- Fixed terminology inconsistency across all Latin languages
- UI elements now consistently use "Skill" instead of localized equivalents
- Includes both singular and plural forms: `plugin/Skill`, `plugins/Skills`
2. **"LobeChat" → "LobeHub"**
- Updated brand name references to current branding
3. **"Agent" Terminology Consistency**
- French: Fixed inconsistent "Assistant" → "Agent" usage in UI elements
- Ensured consistent terminology across all languages
- **de-DE (German)**: 267 changes
- **fr-FR (French)**: 94 changes (including 7 Agent→Assistant fixes)
- **es-ES (Spanish)**: 39 changes
- **it-IT (Italian)**: 59 changes (including 18 plugin→skill fixes)
- **pt-BR (Portuguese)**: 58 changes
- **nl-NL (Dutch)**: 62 changes
- **pl-PL (Polish)**: 28 changes
- All 37 locale JSON files for each language (259 total files)
- Includes: auth.json, chat.json, common.json, discover.json, plugin.json, setting.json, etc.
1. **Fixed Terminology**: Following microcopy guide's fixed terminology rules
2. **Brand Consistency**: Changed all brand references to "LobeHub"
3. **Natural Localization**: Maintained natural language patterns while ensuring consistency
4. **User Experience**: Improved consistency across all Latin language interfaces
Two utility scripts for future locale maintenance:
- `scripts/adjust-latin-locales.py` - For common.json specific adjustments
- `scripts/adjust-latin-locales-full.py` - For comprehensive adjustments across all files
- All changes maintain backward compatibility
- No breaking changes to functionality
- JSON files validated and remain syntactically correct
- Changes reviewed against English base for consistency
---------
Co-authored-by: canisminor1990 <i@canisminor.cc>
* ✨ feat(i18n): update welcome and group activity localization strings for improved clarity and consistency
* ✨ chore(i18n): add ESLint directives to welcome localization file for improved code quality
* 🐛 fix(i18n): add missing footer translation keys for discover page
* ✨ feat(i18n): restore footer translation keys for discover page
---------
Co-authored-by: canisminor1990 <i@canisminor.cc>
* lint: Remove unused console.log
* lint: Clean up console.log
* lint: Clean up console.log
* lint: Clean up console.log
* fix: Page creaetion
* feat: Add more CMDK commands
* feat: Create team in the CMDK
* feat: Context aware commands
* feat: Ask AI menu
* feat: SHow agent list in CMDK
* feat: Lobe AI
* feat: Adjust text
* feat: Add email entry
✨ perf: integrate TooltipGroup component across various UI components
- Added TooltipGroup to enhance tooltip management in Header, ProviderList, ModelList, UserAgentCard, and LikeButton components.
- Updated imports to include TooltipGroup in relevant files for consistent tooltip behavior.
- Refactored existing tooltip implementations to utilize TooltipGroup for better organization and performance.
Signed-off-by: Innei <tukon479@gmail.com>
* ✨ feat: update DesktopHome layout and routing
* Upgraded @lobehub/ui to version 3.4.2.
* Enhanced DesktopHome layout with conditional rendering of PageTitle based on route.
* Refactored home layout to manage visibility and activation state.
* Updated desktop router configuration to streamline home page handling.
Signed-off-by: Innei <tukon479@gmail.com>
* refactor: simplify layout visibility handling in home component
* Removed pointerEvents and visibility styles based on route condition.
* Streamlined layout rendering logic for improved performance.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
test(logger): enhance logger tests with mocked environment variables
* Added mock for getDesktopEnv to simulate various NODE_ENV and DEBUG_VERBOSE states.
* Updated logger tests to utilize the mocked environment for consistent behavior across different log levels.
* Ensured that logger methods correctly handle production and development environments.
Signed-off-by: Innei <tukon479@gmail.com>
chore: update package dependencies and import paths
* Updated @lobehub/ui from version 3.4.2 to 3.4.4 in package.json.
* Adjusted import paths for components from '@lobehub/ui/es/' to include '.mjs' extension where necessary.
* Refactored imports for motion library to use 'motion/react-m' instead of 'motion/react'.
* Cleaned up import statements in various components for consistency.
Signed-off-by: Innei <tukon479@gmail.com>
✨ feat: add window resizing and sizing functionality
* Implemented IPC methods for setting window size and resizability.
* Updated Browser and BrowserManager classes to handle new window settings.
* Integrated window settings in DesktopOnboarding component.
* Added new types for window size and resizability in electron-client-ipc.
Signed-off-by: Innei <tukon479@gmail.com>
* feat: add localstorage cache in swr provider
* feat: add use fetch topic into cache
* feat: add homepage recents api cache
* feat: add group chat initial cache
* docs: update the hint
* refactor: client ipc
* refactor: server ipc
refactor: update IPC method names for consistency
Signed-off-by: Innei <tukon479@gmail.com>
fix: cast IPC return type to DesktopIpcServices for type safety
Signed-off-by: Innei <tukon479@gmail.com>
chore: add new workspace for desktop application in package.json
Signed-off-by: Innei <tukon479@gmail.com>
fix: export FileMetadata interface for improved accessibility
Signed-off-by: Innei <tukon479@gmail.com>
refactor: unify IPC mocking across test files for consistency
Signed-off-by: Innei <tukon479@gmail.com>
feat: enhance type-safe IPC flow with context propagation and service registry
- Introduced `getIpcContext()` and `runWithIpcContext()` for improved context management in IPC handlers.
- Updated `BrowserWindowsCtr` methods to utilize the new context handling.
- Added `McpInstallCtr` to the IPC constructors registry.
- Enhanced README with details on the new type-safe IPC features.
Signed-off-by: Innei <tukon479@gmail.com>
refactor: enhance IPC method registration for improved type safety
- Updated `registerMethod` in `IpcHandler` and `IpcService` to accept variable argument types, enhancing flexibility in method signatures.
- Simplified the `ExtractMethodSignature` type to support multiple arguments.
Signed-off-by: Innei <tukon479@gmail.com>
chore: add global type definitions and refactor import statements
- Introduced a new global type definition file to support Vite client imports.
- Refactored import statements in `App.ts` and `App.test.ts` to remove unnecessary type casting for `import.meta.glob`, improving code clarity.
Signed-off-by: Innei <tukon479@gmail.com>
* refactor: make groupName in BrowserWindowsCtr readonly for better encapsulation
Signed-off-by: Innei <tukon479@gmail.com>
* refactor: update IPC method registration and usage for improved type safety and consistency
- Replaced `@ipcClientEvent` with `@IpcMethod()` in various controllers to standardize IPC method definitions.
- Enhanced the usage of `ensureElectronIpc()` for type-safe IPC calls in service layers.
- Updated `BrowserWindowsCtr` and `NotificationCtr` to utilize the new IPC method structure, improving encapsulation and clarity.
- Refactored service methods to eliminate manual string concatenation for IPC event names, ensuring better maintainability.
Signed-off-by: Innei <tukon479@gmail.com>
---------
Signed-off-by: Innei <tukon479@gmail.com>
* 💄 style: implement smooth scroll to top functionality in Nav and Title components
* fix: update link handling in Title component for improved navigation
* fix: enhance pagination scrolling behavior for mobile responsiveness
* feat: support klavis mcp connector
* feat: update klavis item & klavis call tools
* feat: update the noraml klavis mcp (no need oauth)
* fix: rollback test
* fix: fixed test ci
* feat: update the klavis select model & locals settings
* fix: change the klavis id to klavis types
* fix: delete the klavis into getGlobalConfig
* fix: delete useless migrations
* fix: improve the code
* feat: update test & update the klavis const var
* fix: change it to const
* feat: use swr to replace useEffect
* ♻️ refactor: unify retry logic to async-retry
- Refactor MCPService.listTools() to use async-retry with exponential backoff
- Refactor asyncifyPolling() to use async-retry internally while maintaining the same API
- Add async-retry as dependency to root package and model-runtime package
🔗 Related: LOBE-1370
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ✅ test: update MCPService.listTools tests for async-retry
- Update test expectation: throw original error when retries exceeded
- Remove skipCache parameter test (now handled internally by async-retry)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* 🐛 fix(desktop): add token refresh retry mechanism
- Add `async-retry` library for exponential backoff retry
- Implement retry logic in RemoteServerConfigCtr.refreshAccessToken()
- Retries up to 3 times with exponential backoff (1s, 2s, 4s)
- Distinguishes between retryable (network) and non-retryable (invalid_grant) errors
- Update AuthCtr to only clear tokens for non-retryable errors
- Transient errors now preserve tokens for retry on next cycle
- Add isNonRetryableError() helper method
This fixes the issue where temporary network problems would cause
users to be logged out and require re-authorization.
Closes LOBE-1368
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* update
* 🐛 fix: treat deterministic failures as non-retryable errors
Add deterministic failures to non-retryable error list:
- 'No refresh token available' - refresh token missing from storage
- 'Remote server is not active or configured' - config invalid/disabled
- 'Missing tokens in refresh response' - server returned incomplete response
These permanent failures now trigger immediate token clearing and
authorizationRequired broadcast instead of infinite retry loop.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* 📝 docs: clarify issue status workflow - use "In Review" after PR creation
- Change workflow to set status to "In Review" when PR is created
- "Done" status should only be set after PR is merged
- Add note about Linear-GitHub integration for auto status update
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* 🐛 fix: add grace period for consumed RefreshToken
When rotateRefreshToken is enabled, the old refresh token is consumed
when a new one is issued. If the client fails to receive/save the new
token (network issues, crashes), the login state is lost.
This adds a 3-minute grace period allowing consumed refresh tokens to
be reused, giving clients a chance to retry the refresh operation.
Changes:
- Add REFRESH_TOKEN_GRACE_PERIOD_SECONDS constant (180s)
- Modify find() to allow RefreshToken reuse within grace period
- Add unit tests for grace period behavior
Closes LOBE-1369
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* 📝 style: translate adapter test descriptions to English
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* feat: add market into userSettings & save the oidc token into db
* feat: support market mcp endpoint to use in web
* feat: add market signIn before use cloudEndpoint mcp
* fix: update mcp call fc
* fix: update test.ts
* feat: delete client type cloud ts
* feat: add auth market modal
* fix: close some antd message
* feat: update docs & remove the message loading in oidc
* ✅ test(desktop): improve test coverage for multiple modules
Add comprehensive unit tests for desktop app modules to improve overall test coverage from 29% toward 60%+:
- Preload Scripts: routeInterceptor, invoke, streamer, electronApi (49 tests)
- Menu System: macOS, windows, linux, BaseMenuPlatform (108 tests)
- Core UI (Tray): Tray, TrayManager, MenuManager (78 tests)
- Services: fileSearchSrv (21 tests)
- Utilities: file-system, logger (25 tests)
Total: 281 new test cases covering critical desktop functionality.
Closes LOBE-1215, LOBE-1216, LOBE-1217, LOBE-1218, LOBE-1219
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* 🐛 fix(desktop): update test assertion to support co-located test files
The integration test for file search was failing because it expected all
test files to be in __tests__ directories, but some test files are now
co-located with their source files (e.g., src/preload/*.test.ts).
Updated the assertion to accept both patterns.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* 📦 chore(desktop): add happy-dom to devDependencies
The routeInterceptor.test.ts uses @vitest-environment happy-dom for
browser API testing. Added happy-dom to desktop package devDependencies
to ensure CI can find the package.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* 🐛 fix(conversation-flow): support optimistic update for activeBranchIndex
- Allow activeBranchIndex === children.length for optimistic updates
- Return undefined when branch is being created (not yet exists)
- Update FlatListBuilder to handle undefined activeBranchId gracefully
- Update ContextTreeBuilder to use children.length for optimistic index
- Add tests for optimistic update scenarios
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ✅ test(conversation-flow): add tests for getActiveBranchIdFromMetadata optimistic update
- Add test case for activeBranchIndex === childIds.length (optimistic update)
- Add test case for activeBranchIndex > childIds.length (invalid, fallback)
- Achieves 100% coverage for BranchResolver.ts
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ✅ test(conversation-flow): add optimistic update tests for ContextTreeBuilder and FlatListBuilder
- ContextTreeBuilder: test activeBranchIndex = children.length sets correct index
- FlatListBuilder: test user message with optimistic update skips branch processing
- Improves test coverage from 97.26% to 98.04%
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* update
* ✅ test(database): add ThreadModel unit tests
Add comprehensive unit tests for ThreadModel covering:
- create: thread creation with various parameters
- query: fetch all threads for user
- queryByTopicId: fetch threads by topic
- findById: retrieve thread by id
- update: update thread properties
- delete: delete single thread
- deleteAll: delete all user threads
- User isolation tests for security
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ✅ test(database): add EmbeddingModel unit tests
Add comprehensive unit tests for EmbeddingModel covering:
- create: create new embedding for a chunk
- bulkCreate: batch create embeddings with conflict handling
- delete: delete embedding by id
- query: fetch all user embeddings
- findById: retrieve embedding by id
- countUsage: count total embeddings for user
- User isolation tests for security
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ✅ test(database): add OAuthHandoffModel unit tests
Add comprehensive unit tests for OAuthHandoffModel covering:
- create: create OAuth handoff with conflict handling
- fetchAndConsume: fetch and delete credentials with TTL check
- cleanupExpired: delete expired records (>5 min old)
- exists: check credential existence without consuming
- Expiration validation for 5-minute TTL
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ✅ test(database): add UserModel unit tests
Add comprehensive unit tests for UserModel covering:
- getUserRegistrationDuration: calculate user registration duration
- getUserState: get user state with settings and decryption
- getUserSSOProviders: get linked SSO providers
- getUserSettings: retrieve user settings
- updateUser: update user properties
- deleteSetting: delete user settings
- updateSetting: create/update user settings (upsert)
- updatePreference: merge and update user preferences
- updateGuide: update user guide preferences
Static methods:
- makeSureUserExist: ensure user exists
- createUser: create new user with duplicate check
- deleteUser: delete user by id
- findById: find user by id
- findByEmail: find user by email
- getUserApiKeys: get decrypted API keys
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ✅ test(database): add missing DocumentModel tests
Add tests for uncovered DocumentModel methods:
- create: create new document
- delete: delete document by id with user isolation
- deleteAll: delete all user documents
- query: query all documents with ordering
- findById: find document by id with user isolation
- update: update document with user isolation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* ✅ test(database): add user isolation tests for AgentModel
Add user isolation security tests to ensure users cannot access or modify
other users' knowledge base and file associations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* 🐛 fix(database): fix flaky document ordering test
Add 50ms delay before update to ensure timestamp difference for ordering test.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
* 🐛 fix: add CORS bypass for pricing fetch in browser and update provider icon mapping
* 🐛 fix: refactor pricing response handling to avoid duplicated logic in fetchPricing
* fix nanobanana
* add types
* 完成 fetch sse 和 google ai 侧转换
* thinking
* ui for part render
* support image in thinking
* fix issue
* support convert content part
* support nano banana pro image generation
* fix tests
* fix tests
* ✨ feat: refactor TopicItem to use Link for navigation and improve URL handling
* 🐛 fix: remove enabled property from Gemini 3 Pro model definition
* ✨ feat: add link to session chat in pinned agent list
* fix(operation): isolate loading state to current active topic
- Modified isMainWindowAgentRuntimeRunning to only check operations in current active topic
- Prevents loading state from other topics affecting the send button
- Added comprehensive test case to verify topic isolation
- Fixes issue where switching topics would still show loading state from previous topic
* test: fix isMainWindowAgentRuntimeRunning tests to set active context
- Added activeId and activeTopicId setup in test cases
- Ensured operation context matches active context for proper filtering
- Fixed tests to align with new getCurrentContextOperations-based implementation
* fix: change activeTopicId from null to undefined in tests
- Fixed TypeScript type error where null is not assignable to string | undefined
- Changed all activeTopicId: null to activeTopicId: undefined
* fix: check if operation's message is in current displayed messages
- Changed from using getCurrentContextOperations to checking message presence
- Prevents loading state from showing when switching back to default topic
- Operation's context topicId is captured at creation time and doesn't update
- Now checks if operation's message is in activeDisplayMessages instead
* refactor
* refactor to fix
* try to fix stylelint ci issue
* fix tests
* fix tests
* fix(settings): hide ai image config item in settings category
* fix(settings): Add `showAiImage` to the useMemo dependency array
So the menu re-renders when that flag changes.
* lint: Clean breakpoints
* build: Add CI to check
* build: Add `next` branch
* build: Remove markdown files
* fix: CI hang out
* fix: Show warning on GitHub
* feat: Send comment
* fix: CI error
* fix: show file list
* update
* update
* update
* update
* 🐛 fix(test): update test mocks to use ChatList instead of Conversation
- Update AssistantMessageExtra test mocks from @/features/Conversation/components/Extras/* to @/features/ChatList/components/Extras/*
- Update ComfyUIForm test mock from @/features/Conversation/Error/style to @/features/ChatList/Error/style
Fixes module resolution errors after Conversation -> ChatList refactor
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Add comprehensive unit tests for the core parsing phases:
- indexing.ts: Phase 1 helper map building
- structuring.ts: Phase 2 tree construction
Tests cover:
- messageMap, childrenMap, threadMap, messageGroupMap building
- Tree building with branches, threads, and edge cases
- Performance testing for large datasets
- Integration scenarios
32 new test cases added, all passing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
the migration sql file name is randomly generated, we need to optimize the file name to make it more readable and meaningful. For example, `0046_meaningless_file_name.sql` -> `0046_user_add_avatar_column.sql`
## Step3: Defensive Programming - Use Idempotent Clauses
Always use defensive clauses to make migrations idempotent:
@@ -22,4 +43,4 @@ DROP TABLE "old_table";
CREATE INDEX "users_email_idx" ON "users" ("email");
```
**Important**: After modifying migration SQL (e.g., adding `IF NOT EXISTS` clauses), run `bun run db:generate-client` to update the hash in `packages/database/src/core/migrations.json`.
**Important**: After modifying migration SQL (e.g., adding `IF NOT EXISTS` clauses), run `bun run db:generate:client` to update the hash in `packages/database/src/core/migrations.json`.
This document outlines the conventions and best practices for defining PostgreSQL Drizzle ORM schemas within the lobe-chat project.
## Configuration
- Drizzle configuration is managed in [drizzle.config.ts](mdc:drizzle.config.ts)
- Drizzle configuration is managed in `drizzle.config.ts`
- Schema files are located in the src/database/schemas/ directory
- Migration files are output to `src/database/migrations/`
- The project uses `postgresql` dialect with `strict: true`
## Helper Functions
Commonly used column definitions, especially for timestamps, are centralized in [src/database/schemas/_helpers.ts](mdc:src/database/schemas/_helpers.ts):
Commonly used column definitions, especially for timestamps, are centralized in `src/database/schemas/_helpers.ts`:
- `timestamptz(name: string)`: Creates a timestamp column with timezone
- `createdAt()`, `updatedAt()`, `accessedAt()`: Helper functions for standard timestamp columns
- `timestamps`: An object `{ createdAt, updatedAt, accessedAt }` for easy inclusion in table definitions
@@ -29,6 +31,7 @@ Commonly used column definitions, especially for timestamps, are centralized in
## Column Definitions
### Primary Keys (PKs)
- Typically `text('id')` (or `varchar('id')` for some OIDC tables)
- Often use `.$defaultFn(() => idGenerator('table_name'))` for automatic ID generation with meaningful prefixes
- **ID Prefix Purpose**: Makes it easy for users and developers to distinguish different entity types at a glance
@@ -36,24 +39,29 @@ Commonly used column definitions, especially for timestamps, are centralized in
- Composite PKs are defined using `primaryKey({ columns: [t.colA, t.colB] })`
### Foreign Keys (FKs)
- Defined using `.references(() => otherTable.id, { onDelete: 'cascade' | 'set null' | 'no action' })`
- FK columns are usually named `related_table_singular_name_id` (e.g., `user_id` references `users.id`)
- Most tables include a `user_id` column referencing `users.id` with `onDelete: 'cascade'`
### Timestamps
- Consistently use the `...timestamps` spread from [_helpers.ts](mdc:src/database/schemas/_helpers.ts) for `created_at`, `updated_at`, and `accessed_at` columns
- Consistently use the `...timestamps` spread from `_helpers.ts` for `created_at`, `updated_at`, and `accessed_at` columns
### Default Values
- `.$defaultFn(() => expression)` for dynamic defaults (e.g., `idGenerator()`, `randomSlug()`)
- `.default(staticValue)` for static defaults (e.g., `boolean('enabled').default(true)`)
### Indexes
- Defined in the table's second argument: `pgTable('name', {...columns}, (t) => ({ indexName: indexType().on(...) }))`
- Use `uniqueIndex()` for unique constraints and `index()` for non-unique indexes
- Naming pattern: `table_name_column(s)_idx` or `table_name_column(s)_unique`
- Many tables feature a `clientId: text('client_id')` column, often part of a composite unique index with `user_id`
### Data Types
- Common types: `text`, `varchar`, `jsonb`, `boolean`, `integer`, `uuid`, `pgTable`
- For `jsonb` fields, specify the TypeScript type using `.$type<MyType>()` for better type safety
@@ -66,12 +74,12 @@ Commonly used column definitions, especially for timestamps, are centralized in
## Relations
- Table relationships are defined centrally in [src/database/schemas/relations.ts](mdc:src/database/schemas/relations.ts) using the `relations()` utility from `drizzle-orm`
- Table relationships are defined centrally in `src/database/schemas/relations.ts` using the `relations()` utility from `drizzle-orm`
## Code Style & Structure
- **File Organization**: Each main database entity typically has its own schema file (e.g., [user.ts](mdc:src/database/schemas/user.ts), [agent.ts](mdc:src/database/schemas/agent.ts))
- All schemas are re-exported from [src/database/schemas/index.ts](mdc:src/database/schemas/index.ts)
- **File Organization**: Each main database entity typically has its own schema file (e.g., `user.ts`, `agent.ts`)
- All schemas are re-exported from `src/database/schemas/index.ts`
- **ESLint**: Files often start with `/* eslint-disable sort-keys-fix/sort-keys-fix */`
- **Comments**: Use JSDoc-style comments to explain the purpose of tables and complex columns, fields that are self-explanatory do not require jsdoc explanations, such as id, user_id, etc.
@@ -97,9 +105,7 @@ export const agents = pgTable(
...timestamps,
},
// return array instead of object, the object style is deprecated
**Current usage**: Only used to identify default agents/sessions (legacy pattern)
**Future refactor**: Will likely be replaced with `isDefault: boolean()` field
**Note**: Avoid using slugs for new features - prefer explicit boolean flags for status tracking
**Current usage**: Only used to identify default agents/sessions (legacy pattern) **Future refactor**: Will likely be replaced with `isDefault: boolean()` field **Note**: Avoid using slugs for new features - prefer explicit boolean flags for status tracking
By following these guidelines, maintain consistency, type safety, and maintainability across database schema definitions.
description: Explain how group chat works in LobeHub (Multi-agent orchestratoin)
globs:
alwaysApply: false
---
This rule explains how group chat (multi-agent orchestration) works. Not confused with session group, which is a organization method to manage session.
## Key points
- A supervisor will devide who and how will speak next
- Each agent will speak just like in single chat (if was asked to speak)
**Avoid key conflicts:** Don't use both a leaf key and its parent path
Development mode:
```typescript
// ❌ Conflict: clientDB.solve exists as both leaf and parent
'clientDB.solve': '自助解决',
'clientDB.solve.backup.title': '数据备份',
Generally, you don't need to help me run the automatic translation tool as it takes a long time. I'll run it myself when needed. However, to see immediate results, you still need to translate `locales/zh-CN/namespace.json` first, no need to translate other languages.
Production mode:
```bash
# Generate translations for all languages
npm run i18n
// ✅ Solution: Use different suffixes
'clientDB.solve.action': '自助解决',
'clientDB.solve.backup.title': '数据备份',
```
## Usage in Components
## Workflow
### Basic Usage
1. Add keys to `src/locales/default/{namespace}.ts`
2. Export new namespace in `src/locales/default/index.ts`
3. For dev preview: manually translate `locales/zh-CN/{namespace}.json` and `locales/en-US/{namespace}.json`
4. Run `pnpm i18n` to generate all languages (CI handles this automatically)
## Usage
```tsx
import { useTranslation } from 'react-i18next';
const MyComponent = () => {
const { t } = useTranslation('common');
return (
<div>
<h1>{t('newFeature.title')}</h1>
<p>{t('newFeature.description')}</p>
<button>{t('newFeature.button')}</button>
</div>
);
};
```
### Usage with Parameters
```tsx
const { t } = useTranslation('common');
<p>{t('welcome.message', { name: 'John' })}</p>;
// Corresponding language file:
// welcome: { message: 'Welcome {{name}}!' }
```
### Multiple Namespaces
```tsx
// Basic
t('newFeature.title')
// With parameters
t('alert.cloud.desc', { credit: '1000' })
// Multiple namespaces
const { t } = useTranslation(['common', 'chat']);
<button>{t('common:save')}</button>
<span>{t('chat:typing')}</span>
t('common:save')
```
## Type Safety
## Available Namespaces
The project uses TypeScript to implement type-safe translations, with types automatically generated from src/locales/resources.ts:
1. **Retrieve issue details** before starting work using `mcp__linear-server__get_issue`
2. **Check for sub-issues**: If the issue has sub-issues, retrieve and review ALL sub-issues using `mcp__linear-server__list_issues` with `parentId` filter before starting work
3. **Update issue status** when completing tasks using `mcp__linear-server__update_issue`
4. **MUST add completion comment** using `mcp__linear-server__create_comment`
## Creating Issues
When creating new Linear issues using `mcp__linear-server__create_issue`, **MUST add the `claude code` label** to indicate the issue was created by Claude Code.
## Completion Comment (REQUIRED)
**Every time you complete an issue, you MUST add a comment summarizing the work done.** This is critical for:
- Team visibility and knowledge sharing
- Code review context
- Future reference and debugging
## PR Linear Issue Association (REQUIRED)
**When creating PRs for Linear issues, MUST include magic keywords in PR body:** `Fixes LOBE-123`, `Closes LOBE-123`, or `Resolves LOBE-123`, and summarize the work done in the linear issue comment and update the issue status to "In Review".
## IMPORTANT: Per-Issue Completion Rule
**When working on multiple issues (e.g., parent issue with sub-issues), you MUST update status and add comment for EACH issue IMMEDIATELY after completing it.** Do NOT wait until all issues are done to update them in batch.
**Workflow for EACH individual issue:**
1. Complete the implementation for this specific issue
2. Run type check: `bun run type-check`
3. Run related tests if applicable
4. Create PR if needed
5. **IMMEDIATELY** update issue status to **"In Review"** (NOT "Done"): `mcp__linear-server__update_issue`
**Note:** Issue status should be set to **"In Review"** when PR is created. The status will be updated to **"Done"** only after the PR is merged (usually handled by Linear-GitHub integration or manually).
**❌ Wrong approach:**
- Complete Issue A → Complete Issue B → Complete Issue C → Update all statuses → Add all comments
- Mark issue as "Done" immediately after creating PR
**✅ Correct approach:**
- Complete Issue A → Create PR → Update A status to "In Review" → Add A comment → Complete Issue B → ...
You are **LobeHub’s English UI Copy & Microcopy Specialist**.
LobeHub is an assistant workspace: users can create **Agents** and **Agent Teams** so people↔agents and agent↔agent can collaborate to improve productivity in work and life. Brand vibe: youthful, friendly, modern on the surface; professional, reliable, productivity- and controllability-first underneath. Overall style reference: Notion / Figma / Apple / Discord / OpenAI / Gemini — clear, restrained, trustworthy, human but not cheesy.
Product slogan: **Where Agents Collaborate**. Your copy must continuously reinforce that LobeHub is not about “generation”, but about a **collaborative agent system**: shareable context, traceable outcomes, replayable runs, evolvable setup, and **human-in-the-loop**.
---
## 1) Fixed Terminology (must follow)
Use **exactly** these English terms across the product. Do not mix synonyms for the same concept.
- 空间: **Workspace**
- 助理: **Agent**
- 群组: **Group**
- 上下文: **Context**
- 记忆: **Memory**
- 连接器: **Integration**
- 技能/tool/plugin: **Skill**
- 助理档案: **Agent Profile**
- 话题: **Topic**
- 文稿: **Page**
- 社区: **Community**
- 资源: **Resource**
- 库: **Library**
- MCP: **MCP**
- 模型服务商: **Provider**
Terminology rule: one concept = one term site-wide. Never alternate with “bot/assistant/AI agent/team/workspace” variations.
---
## 2) Your Responsibilities
- Improve, rewrite, or create from scratch any **English UI copy**: titles, buttons, form labels/help text, placeholders, onboarding, empty states, toasts, modals, errors, permission prompts, settings, creation/run flows, collaboration and Agent Team pages, etc.
- Copy must work for both:
- general users (immediately understandable)
- power users (not childish)
- It must fit both playful and serious contexts.
- Avoid overclaiming AI capabilities; add human warmth at the right moments.
---
## 3) The Three Brand Principles (bake into structure & wording)
- **Create**: create an Agent in one sentence; clear next step from idea → usable.
- **Collaborate**: multi-agent collaboration; align info and outputs; share Context (controlled, manageable).
- **Evolve**: Agents can remember preferences **only with user consent**; become more helpful over time; emphasize explainability, settings, and replay.
2. **Layered messaging (single version for everyone)**:
- Main line: simple and actionable
- Optional second line: more precise / technical / boundary-setting (subtitle, helper text, tooltip, collapsible)
- Do not produce “Pro vs Lite” variants; one main + optional detail
3. **Use terms sparingly but correctly**: prefer plain words (“connect”, “run”, “context”) unless a technical term is necessary. When it is, add a plain-English explanation.
4. **Consistency**: keep verbs consistent across similar actions (Create / Connect / Run / Pause / Retry / View details / Clear Memory).
5. **Actionable**: every message tells the user what to do next. Avoid generic “OK/Cancel”; use specific actions.
Goal: reduce anxiety and restore control without being sentimental. Default ratio: **80% information, 20% warmth**. Key moments (first-time create, empty state, long waits, failures/retries, rollback/data-loss risk, collaboration conflicts): may go **70/30**.
Hard cap: any on-screen message may include **at most half a sentence to one sentence** of warmth, and it must be followed by a clear next step.
Required order:
1. Acknowledge the situation (no judgment)
2. Restore control (human-in-the-loop: pause/replay/edit/undo/clear Memory/view Context)
- Retry / View details / Go to Settings / Contact support / Copy logs
Never blame the user. Don’t show only an error code; put codes in “Details” if needed. For data/security/billing: be neutral, thorough, and respectful—warmth comes from clarity, not emotion.
---
## 7) Your Special Task: CN i18n → EN (localized, length-aware)
You translate **raw Chinese i18n strings into English** for LobeHub.
Requirements:
- Prefer **localized**, product-native English over literal translation.
- Do **not** chase perfect one-to-one consistency if a more natural UI phrase reads better.
- Keep the **character length difference small**; try to make the English string **roughly the same visual length** as the Chinese source (avoid overly long expansions).
- Preserve meaning, tone, and actionability; keep verbs consistent with LobeHub’s UI patterns.
- If space is tight (buttons, tabs, toasts), prioritize: **verb + object**, drop optional words first.
- If the Chinese includes placeholders/variables, preserve them exactly (e.g., `{name}`, `{{count}}`, `%s`) and keep word order sensible.
- Keep capitalization consistent with UI norms (buttons/title case only when appropriate).
Output format when translating:
- Provide **English only**, unless asked otherwise.
- If multiple options are useful, give **one best option** + **one shorter fallback** (only when length constraints are likely).
---
You always optimize for: **clarity, control, collaboration, replayability, and human-in-the-loop**—in a modern, restrained, trustworthy English voice.
- Use selectors to access zustand store data instead of accessing the store directly
## Lobe UI Components
- If unsure how to use `@lobehub/ui` components or what props they accept, search for existing usage in this project instead of guessing. Most components extend antd components with additional props
- For specific usage, search online. For example, for ActionIcon visit <https://ui.lobehub.com/components/action-icon>
- Read `node_modules/@lobehub/ui/es/index.mjs` to see all available components and their props
- General
- ActionIcon
- ActionIconGroup
- Block
- Button
- Icon
- Data Display
- Accordion
- Avatar
- Collapse
- Empty
- FileTypeIcon
- FluentEmoji
- GroupAvatar
- GuideCard
- Highlighter
- Hotkey
- Image
- List
- Markdown
- MaterialFileTypeIcon
- Mermaid
- Segmented
- Skeleton
- Snippet
- SortableList
- Tag
- Tooltip
- Video
- Data Entry
- AutoComplete
- CodeEditor
- ColorSwatches
- CopyButton
- DatePicker
- DownloadButton
- EditableText
- EmojiPicker
- Form
- FormModal
- HotkeyInput
- ImageSelect
- Input
- SearchBar
- Select
- SliderWithInput
- ThemeSwitch
- Feedback
- Alert
- Drawer
- Modal
- Layout
- Center
- DraggablePanel
- Flexbox
- Footer
- Grid
- Header
- Layout
- MaskShadow
- ScrollShadow
- Navigation
- Burger
- DraggableSideNav
- Dropdown
- Menu
- SideNav
- Tabs
- Toc
- Theme
- ConfigProvider
- FontLoader
- ThemeProvider
- Typography
- Text
## Routing Architecture
This project uses a **hybrid routing architecture**: Next.js App Router for static pages + React Router DOM for the main SPA.
- **Purpose**: Testing Electron main process controllers, IPC handlers, and desktop-specific logic
## Test Commands
**Performance Warning**: The project contains 3000+ test cases. A full run takes approximately 10 minutes. Always use file filtering or test name filtering.
### Recommended Command Format
```bash
# 运行所有客户端/服务端测试
bunx vitest run --silent='passed-only' # 客户端测试
cd packages/database && TEST_SERVER_DB=1 bunx vitest run --silent='passed-only' # 服务端测试
# Run all client/server tests
bunx vitest run --silent='passed-only' # Client tests
cd packages/database && TEST_SERVER_DB=1 bunx vitest run --silent='passed-only' # Server tests
# 运行特定测试文件 (支持模糊匹配)
# Run specific test file (supports fuzzy matching)
bunx vitest run --silent='passed-only' user.test.ts
# 运行特定测试用例名称 (使用 -t 参数)
# Run specific test case by name (using -t flag)
bunx vitest run --silent='passed-only' -t "test case name"
# 组合使用文件和测试名称过滤
# Combine file and test name filtering
bunx vitest run --silent='passed-only' filename.test.ts -t "specific test"
// Only create sub-groups when there are multiple related sub-scenarios
it('should show placeholder for missing name', () => {});
it('should hide email section when email is undefined', () => {});
});
});
```
**组织决策流程**:
**Organization Decision Flow**:
1. 是否存在逻辑相关的现有 `describe` 块? → 如果有,添加到其中
2. 是否有多个(3个以上)相关的测试用例? → 如果有,可以考虑创建新的子 `describe`
3. 是否是独立的、无关联的功能模块? → 如果是,才考虑创建新的顶级 `describe`
1. Is there a logically related existing `describe` block? → If yes, add to it
2. Are there multiple (3+) related test cases? → If yes, consider creating a new sub-`describe`
3. Is it an independent, unrelated feature module? → Only then consider creating a new top-level `describe`
### 测试修复流程
### Test Fixing Workflow
1. **复现问题**: 定位并运行失败的测试,确认能在本地复现
2. **分析原因**: 阅读测试代码、错误日志和相关文件的 Git 修改历史
3. **建立假设**: 判断问题出在测试逻辑、实现代码还是环境配置
4. **修复验证**: 根据假设进行修复,重新运行测试确认通过
5. **扩大验证**: 运行当前文件内所有测试,确保没有引入新问题
6. **撰写总结**: 说明错误原因和修复方法
1. **Reproduce the Issue**: Locate and run the failing test; confirm it can be reproduced locally
2. **Analyze the Cause**: Read test code, error logs, and Git history of related files
3. **Form a Hypothesis**: Determine if the problem is in test logic, implementation code, or environment configuration
4. **Fix and Verify**: Apply the fix based on your hypothesis; rerun the test to confirm it passes
5. **Expand Verification**: Run all tests in the current file to ensure no new issues were introduced
6. **Write a Summary**: Document the error cause and fix method
### 修复完成后的总结
### Post-Fix Summary
测试修复完成后,应该提供简要说明,包括:
After completing a test fix, provide a brief explanation including:
1. **错误原因分析**: 说明测试失败的根本原因
- 测试逻辑错误
- 实现代码bug
- 环境配置问题
- 依赖变更导致的问题
1. **Root Cause Analysis**: Explain the fundamental reason for the test failure
- Test logic error
- Implementation bug
- Environment configuration issue
- Dependency change
2. **修复方法说明**: 简述采用的修复方式
- 修改了哪些文件
- 采用了什么解决方案
- 为什么选择这种修复方式
2. **Fix Description**: Briefly describe the fix approach
- Which files were modified
- What solution was applied
- Why this fix approach was chosen
**示例格式**:
**Example Format**:
```markdown
## 测试修复总结
## Test Fix Summary
**错误原因**: 测试中的 mock 数据格式与实际 API 返回格式不匹配,导致断言失败。
**Root Cause**: The mock data format in the test didn't match the actual API response format, causing assertion failures.
**修复方法**: 更新了测试文件中的 mock 数据结构,使其与最新的 API 响应格式保持一致。具体修改了 `user.test.ts` 中的 `mockUserData` 对象结构。
**Fix**: Updated the mock data structure in the test file to match the latest API response format. Specifically modified the `mockUserData` object structure in `user.test.ts`.
```
## 测试编写最佳实践
## Test Writing Best Practices
### Mock 数据策略:追求"低成本的真实性"
### Mock Data Strategy: Aim for "Low-Cost Authenticity"
**核心原则**: 测试数据应默认追求真实性,只有在引入"高昂的测试成本"时才进行简化。
**Core Principle**: Test data should default to authenticity; only simplify when it introduces "high testing costs."
#### 什么是"高昂的测试成本"?
#### What Are "High Testing Costs"?
"高成本"指的是测试中引入了外部依赖,使测试变慢、不稳定或复杂:
"High cost" refers to introducing external dependencies in tests that make them slow, unstable, or complex:
- **文件 I/O 操作**:读写硬盘文件
- **网络请求**:HTTP 调用、数据库连接
- **系统调用**:获取系统时间、环境变量等
- **File I/O Operations**: Reading/writing disk files
- **DO NOT mock useSWR** - let it use the real implementation
- Only mock the **service methods** (fetchers)
- Use `waitFor` from `@testing-library/react` to wait for async operations
@@ -559,21 +556,19 @@ it('should not fetch when required parameter is missing', () => {
7. **Type assertions**: Use `as any` for test mock data where type definitions are strict
**Why this matters**:
- The fetcher (service method) is what we're testing - it must be called
- Hardcoding the return value bypasses the actual fetcher logic
- SWR returns Promises in real usage, tests should mirror this behavior
## Benefits of This Approach
✅ **Clear test layers** - Each test only spies on direct dependencies
✅ **Correct mocks** - Mocks match actual implementation
✅ **Better maintainability** - Changes to implementation require fewer test updates
✅ **Improved coverage** - Structured approach ensures all branches are tested
✅ **Reduced coupling** - Tests are independent and can run in any order
✅ **Clear test layers** - Each test only spies on direct dependencies ✅ **Correct mocks** - Mocks match actual implementation ✅ **Better maintainability** - Changes to implementation require fewer test updates ✅ **Improved coverage** - Structured approach ensures all branches are tested ✅ **Reduced coupling** - Tests are independent and can run in any order
# the format is `plugin-identifier:key1=value1;key2=value2`, multiple settings fields are separated by semicolons `;`, multiple plugin settings are separated by commas `,`.
// FIXME: Linting error in src/app/[variants]/(main)/chat/features/Migration/DBReader.ts, the fundamental solution should be upgrading typescript-eslint
This document serves as a comprehensive guide for all team members when developing LobeChat.
## Project Description
You are developing an open-source, modern-design AI Agent Workspace: LobeHub(previous LobeChat).
## Tech Stack
Built with modern technologies:
- **Frontend**: Next.js 15, React 19, TypeScript
- **Frontend**: Next.js 16, React 19, TypeScript
- **UI Components**: Ant Design, @lobehub/ui, antd-style
- **State Management**: Zustand, SWR
- **Database**: PostgreSQL, PGLite, Drizzle ORM
- **Testing**: Vitest, Testing Library
- **Package Manager**: pnpm (monorepo structure)
- **Build Tools**: Next.js (Turbopack in dev, Webpack in prod)
## Directory Structure
@@ -23,11 +26,13 @@ The project follows a well-organized monorepo structure:
-`src/` - Main source code
-`docs/` - Documentation
-`.cursor/rules/` - Development rules and guidelines
- PR titles starting with `✨ feat/` or `🐛 fix` will trigger the release workflow upon merge. Only use these prefixes for significant user-facing feature changes or bug fixes
## Development Workflow
### Git Workflow
- The current release branch is `next` instead of `main` until v2.0.0 is officially released
- Use rebase for git pull
- Git commit messages should prefix with gitmoji
- Git branch name format: `username/feat/feature-name`
@@ -38,7 +43,6 @@ The project follows a well-organized monorepo structure:
- Use `pnpm` as the primary package manager
- Use `bun` to run npm scripts
- Use `bunx` to run executable npm packages
- Navigate to specific packages using `cd packages/<package-name>`
### Code Style Guidelines
@@ -70,6 +74,10 @@ The project follows a well-organized monorepo structure:
- **Dev**: Translate `locales/zh-CN/namespace.json` locale file only for preview
- DON'T run `pnpm i18n`, let CI auto handle it
## Linear Issue Management
Follow [Linear rules in CLAUDE.md](CLAUDE.md#linear-issue-management-ignore-if-not-installed-linear-mcp) when working with Linear issues.
## Project Rules Index
All following rules are saved under `.cursor/rules/` directory:
@@ -80,10 +88,10 @@ All following rules are saved under `.cursor/rules/` directory:
### Frontend
-`react-component.mdc`– React component style guide and conventions
-`react.mdc`– React component style guide and conventions
-`i18n.mdc`– Internationalization guide using react-i18next
-`typescript.mdc`– TypeScript code style guide
-`packages/react-layout-kit.mdc`– Usage guide for react-layout-kit
-`packages/react-layout-kit.mdc`– Usage guide for Flexbox and Center components from @lobehub/ui
- git branch name format example: tj/feat/feature-name
- git branch name format template: <type>/<feature-name>
- use .github/PULL_REQUEST_TEMPLATE.md to generate pull request description
- PR titles starting with `✨ feat/` or `🐛 fix` will trigger the release workflow upon merge. Only use these prefixes for significant user-facing feature changes or bug fixes
### Package Management
@@ -33,7 +34,7 @@ see @.cursor/rules/typescript.mdc
### Testing
- **Required Rule**: read `@.cursor/rules/testing-guide/testing-guide.mdc` before writing tests
- **Required Rule**: read `.cursor/rules/testing-guide/testing-guide.mdc` before writing tests
- **Command**:
- web: `bunx vitest run --silent='passed-only' '[file-path-pattern]'`
@@ -43,6 +44,8 @@ see @.cursor/rules/typescript.mdc
- wrap the file path in single quotes to avoid shell expansion
- Never run `bun run test` etc to run tests, this will run all tests and cost about 10mins
- If trying to fix the same test twice, but still failed, stop and ask for help.
- **Prefer `vi.spyOn` over `vi.mock`**: When mocking modules or functions, prefer using `vi.spyOn` to mock specific functions rather than `vi.mock` to mock entire modules. This approach is more targeted, easier to maintain, and allows for better control over mock behavior in individual tests.
- **Tests must pass type check**: After writing or modifying tests, run `bun run type-check` to ensure there are no type errors. Tests should pass both runtime execution and TypeScript type checking.
### Typecheck
@@ -54,6 +57,10 @@ see @.cursor/rules/typescript.mdc
- **Dev**: Translate `locales/zh-CN/namespace.json` and `locales/en-US/namespace.json` locales file only for dev preview
- DON'T run `pnpm i18n`, let CI auto handle it
## Linear Issue Management(ignore if not installed linear mcp)
Read @.cursor/rules/linear.mdc when working with Linear issues.
## Rules Index
Some useful project rules are listed in @.cursor/rules/rules-index.mdc
This document serves as a shared guideline for all team members when using Gemini CLI in this repository.
## Tech Stack
read @.cursor/rules/project-introduce.mdc
## Directory Structure
read @.cursor/rules/project-structure.mdc
## Development
### Git Workflow
- use rebase for git pull
- git commit message should prefix with gitmoji
- git branch name format template: <type>/<feature-name>
- use .github/PULL_REQUEST_TEMPLATE.md to generate pull request description
- PR titles starting with `✨ feat/` or `🐛 fix` will trigger the release workflow upon merge. Only use these prefixes for significant user-facing feature changes or bug fixes
### Package Management
This repository adopts a monorepo structure.
- Use `pnpm` as the primary package manager for dependency management
- Use `bun` to run npm scripts
- Use `bunx` to run executable npm packages
### TypeScript Code Style Guide
see @.cursor/rules/typescript.mdc
### Testing
- **Required Rule**: read `.cursor/rules/testing-guide/testing-guide.mdc` before writing tests
- **Command**:
- web: `bunx vitest run --silent='passed-only' '[file-path-pattern]'`
- wrap the file path in single quotes to avoid shell expansion
- Never run `bun run test` etc to run tests, this will run all tests and cost about 10mins
- If trying to fix the same test twice, but still failed, stop and ask for help.
### Typecheck
- use `bun run type-check` to check type errors.
### i18n
- **Keys**: Add to `src/locales/default/namespace.ts`
- **Dev**: Translate `locales/zh-CN/namespace.json` and `locales/en-US/namespace.json` locales file only for dev preview
- DON'T run `pnpm i18n`, let CI auto handle it
## 🚨 Quality Checks
**MANDATORY**: After completing code changes, always run `mcp__vscode-mcp__get_diagnostics` on the modified files to identify any errors introduced by your changes and fix them.
## Rules Index
Some useful project rules are listed in @.cursor/rules/rules-index.mdc
| [SEO](https://lobechat.com/discover/plugin/SEO)<br/><sup>By **orrenprunckun** on **2025-11-14**</sup> | Enter any URL and keyword and get an On-Page SEO analysis & insights!<br/>`seo` |
| [Shopping tools](https://lobechat.com/discover/plugin/ShoppingTools)<br/><sup>By **shoppingtools** on **2025-10-27**</sup> | Search for products on eBay & AliExpress, find eBay events & coupons. Get prompt examples.<br/>`shopping``e-bay``ali-express``coupons` |
| [PortfolioMeta](https://lobechat.com/discover/plugin/StockData)<br/><sup>By **portfoliometa** on **2025-09-27**</sup> | Analyze stocks and get comprehensive real-time investment data and analytics.<br/>`stock` |
| [Web](https://lobechat.com/discover/plugin/web)<br/><sup>By **Proghit** on **2025-01-24**</sup> | Smart web search that reads and analyzes pages to deliver comprehensive answers from Google results.<br/>`web``search` |
| [Shopping tools](https://lobechat.com/discover/plugin/ShoppingTools)<br/><sup>By **shoppingtools** on **2026-01-12**</sup> | Search for products on eBay & AliExpress, find eBay events & coupons. Get prompt examples.<br/>`shopping``e-bay``ali-express``coupons` |
| [SEO Assistant](https://lobechat.com/discover/plugin/seo_assistant)<br/><sup>By **webfx** on **2026-01-12**</sup> | The SEO Assistant can generate search engine keyword information in order to aid the creation of content.<br/>`seo``keyword` |
| [Video Captions](https://lobechat.com/discover/plugin/VideoCaptions)<br/><sup>By **maila** on **2025-12-13**</sup> | Convert Youtube links into transcribed text, enable asking questions, create chapters, and summarize its content.<br/>`video-to-text``youtube` |
| [WeatherGPT](https://lobechat.com/discover/plugin/WeatherGPT)<br/><sup>By **steven-tey** on **2025-12-13**</sup> | Get current weather information for a specific location.<br/>`weather` |
> 📊 Total plugins: [<kbd>**42**</kbd>](https://lobechat.com/discover/plugins)
> 📊 Total plugins: [<kbd>**40**</kbd>](https://lobechat.com/discover/plugins)
<!-- PLUGIN LIST -->
@@ -387,8 +387,8 @@ Our marketplace is not just a showcase platform but also a collaborative space.
| [Turtle Soup Host](https://lobechat.com/discover/assistant/lateral-thinking-puzzle)<br/><sup>By **[CSY2022](https://github.com/CSY2022)** on **2025-06-19**</sup> | A turtle soup host needs to provide the scenario, the complete story (truth of the event), and the key point (the condition for guessing correctly).<br/>`turtle-soup``reasoning``interaction``puzzle``role-playing` |
| [Academic Writing Assistant](https://lobechat.com/discover/assistant/academic-writing-assistant)<br/><sup>By **[swarfte](https://github.com/swarfte)** on **2025-06-17**</sup> | Expert in academic research paper writing and formal documentation<br/>`academic-writing``research``formal-style` |
| [Minecraft Senior Developer](https://lobechat.com/discover/assistant/java-development)<br/><sup>By **[iamyuuk](https://github.com/iamyuuk)** on **2025-06-17**</sup> | Expert in advanced Java development and Minecraft mod and server plugin development<br/>`development``programming``minecraft``java` |
> 📊 Total agents: [<kbd>**505**</kbd> ](https://lobechat.com/discover/assistants)
@@ -820,7 +820,7 @@ This project is [LobeHub Community License](./LICENSE) licensed.
| [SEO 助手](https://lobechat.com/discover/plugin/seo_assistant)<br/><sup>By **webfx** on **2026-01-12**</sup> | SEO 助手可以生成搜索引擎关键词信息,以帮助创建内容。<br/>`seo``关键词` |
| [视频字幕](https://lobechat.com/discover/plugin/VideoCaptions)<br/><sup>By **maila** on **2025-12-13**</sup> | 将 Youtube 链接转换为转录文本,使其能够提问,创建章节,并总结其内容。<br/>`视频转文字``you-tube` |
| [天气 GPT](https://lobechat.com/discover/plugin/WeatherGPT)<br/><sup>By **steven-tey** on **2025-12-13**</sup> | 获取特定位置的当前天气信息。<br/>`天气` |
> 📊 Total plugins: [<kbd>**42**</kbd>](https://lobechat.com/discover/plugins)
> 📊 Total plugins: [<kbd>**40**</kbd>](https://lobechat.com/discover/plugins)
- **Automatic Event Mapping** - Events registered during controller loading
- **Service Locator** - Type-safe service and controller retrieval
##### 🧠 Type-Safe IPC Flow
- **Async Context Propagation** - `src/main/utils/ipc/base.ts` captures the `IpcContext` with `AsyncLocalStorage`, so controller logic can call `getIpcContext()` anywhere inside an IPC handler without explicitly threading arguments.
- **Service Constructors Registry** - `src/main/controllers/registry.ts` exports `controllerIpcConstructors` and `DesktopIpcServices`, enabling automatic typing of renderer IPC proxies.
- **Renderer Proxy Helper** - `src/utils/electron/ipc.ts` exposes `ensureElectronIpc()` which lazily builds a proxy on top of `window.electronAPI.invoke`, giving React/Next.js code a type-safe API surface without exposing raw proxies in preload.
- **Shared Typings Package** - `apps/desktop/src/main/exports.d.ts` augments `@lobechat/electron-client-ipc` so every package can consume `DesktopIpcServices` without importing desktop business code directly.
#### 🪟 Window Management
- **Theme-Aware Windows** - Automatic adaptation to system dark/light mode
@@ -235,6 +242,7 @@ The `App.ts` class orchestrates the entire application lifecycle through key pha
#### 🎮 Controller Pattern
- **Typed IPC Decorators** - Controllers extend `ControllerModule` and expose renderer methods via `@IpcMethod`
- **IPC Event Handling** - Processes events from renderer with decorator-based registration
- **Lifecycle Hooks** - `beforeAppReady` and `afterAppReady` for initialization phases
- **Type-Safe Communication** - Strong typing for all IPC events and responses
@@ -256,6 +264,19 @@ The `App.ts` class orchestrates the entire application lifecycle through key pha
- **Context Awareness** - Events include sender context for window-specific operations
- **Error Propagation** - Centralized error handling with proper status codes
##### 🧩 Renderer IPC Helper
Renderer code uses a lightweight proxy generated at runtime to keep IPC calls type-safe without exposing raw Electron objects through `contextBridge`. Use the helper exported from `src/utils/electron/ipc.ts` to access the main-process services:
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.