196 Commits

Author SHA1 Message Date
Innei
1276a87b0f feat(trpc): add response metadata and auth header handling (#11816)
*  feat(trpc): add response metadata and auth header handling

Add createResponseMeta utility to centralize tRPC response metadata handling.
Set X-Auth-Required header for UNAUTHORIZED errors to distinguish real auth failures
from other 401 errors. Update all tRPC routes to use the new utility.

* ♻️ refactor(desktop-bridge): extract auth constants to shared package

Move AUTH_REQUIRED_HEADER and TRPC_ERROR_CODE_UNAUTHORIZED to
@lobechat/desktop-bridge for consistent usage across server and desktop.
2026-01-25 20:39:51 +08:00
YuTengjing
395595a2c8 feat: remove Clerk authentication code (#11711) 2026-01-23 14:41:22 +08:00
Innei
0cf27230ea feat: add server version check for desktop app (#11710)
*  feat: add server version check for desktop app

- Add /api/version endpoint consumption in globalService
- Add serverVersion and isServerVersionOutdated states to global store
- Add useCheckServerVersion hook to detect outdated server
- Show ServerVersionOutdatedAlert when server version is incompatible
- Display server version tag in settings when different from client
- Support version diff threshold (5 versions) for compatibility check

* 🔧 chore: only show server version alert for self-hosted instances

Check storageMode from electron store - only show alert when
using 'selfHost' mode, not 'cloud' mode.

* 🔧 chore: remove deprecated 'local' storage mode option

* 🐛 fix: only treat 404 as outdated server, throw on other errors

Previously any non-OK response was treated as "server doesn't support
the API", causing transient failures (500s, network issues) to
incorrectly show the outdated alert. Now only 404 returns null to
indicate a missing API, while other errors throw to allow SWR retry.

*  feat: add server version check and update alerts

- Implemented server version check functionality to notify users when their client version requires a newer server version.
- Added localized messages for server version outdated alerts in English and Chinese.
- Enhanced the global state management to track server version and its status.
- Updated UI components to display server version information and warnings appropriately.
- Introduced a new alert component to inform users about the need to upgrade their server for optimal performance.

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-22 23:20:07 +08:00
Innei
5664b84ba8 🔧 feat(desktop): add legacy local database detection and migration guidance (#11682)
* 🔧 feat(desktop): add legacy local database detection and migration guidance

- Add hasLegacyLocalDb method to SystemController for detecting legacy DB
- Update LoginStep to show migration link for users with legacy DB
- Add i18n translations for legacy database migration feature
- Improve common settings data sync configuration

* 🔧 test: mock getAppPath in electron for improved testing

- Add mock implementation of getAppPath in SystemCtr and macOS test files
- Update LoginStep to use urlJoin for constructing migration guide URL

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-21 22:28:34 +08:00
Innei
13e95b98c2 🐛 fix(desktop): gracefully handle missing update manifest 404 errors (#11625)
- Add isMissingUpdateManifestError helper to detect manifest 404 errors
- Treat missing manifest as "no update available" during gap period
- Fix sidebar header margin for desktop layout
2026-01-20 23:41:34 +08:00
Innei
c9d9dff635 ♻️ refactor(ModelSwitchPanel): migrate from Popover to DropdownMenu with virtual scrolling (#11663)
* ♻️ refactor(ModelSwitchPanel): migrate from Popover to DropdownMenu with virtual scrolling

- Replace Popover with DropdownMenu atom components from @lobehub/ui
- Add react-virtuoso for proper virtual scrolling implementation
- Auto-close submenu when scrolling to prevent position offset issues
- Rename misleading "Virtual*" naming to "List*" for clarity

LOBE-3844

* 🔨 chore: clean up unnecessary comments in ModelSwitchPanel

* 🔨 chore(router): remove unused loader property from route configuration

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-20 23:07:56 +08:00
Innei
47fd5e6875 🔨 chore: clean up unnecessary comments (#11659)
* 🔨 chore: clean up unnecessary comments

Remove 358 lines of unnecessary comments across 33 files:
- Remove commented-out code blocks and unused implementations
- Remove redundant single-line comments that repeat code logic
- Remove empty comments and placeholder comments
- Remove commented-out import/export statements

This improves code readability and reduces visual clutter without affecting functionality.

* 🔨 chore: clean up additional unnecessary comments

Remove 28 more lines of unnecessary comments:
- Remove commented-out PostgresViewer menu item in DevPanel
- Remove commented-out OAuth fallback endpoints in SSO helpers
- Remove commented-out copy menu item in page dropdown
- Remove commented-out debugger script in root layout
- Remove commented-out Tooltip component in ModelItem

This further improves code cleanliness and maintainability.

* 🔨 chore: clean up additional unnecessary comments (round 3)

Removed commented-out code and empty comment blocks:
- GlobalProvider: removed commented FaviconTestPanel
- TaskDetailPanel: removed commented Instruction Header section
- ImportDetail: removed commented duplicate data handling UI
- Header: removed commented MarketSourceSwitch
- router: removed empty if block with placeholder comments

* 🔨 chore: clean up commented-out code (round 4)

Removed unnecessary commented code:
- parseModels: removed commented deploymentName fallback
- I18nManager: removed commented window notification code
- conversationLifecycle: removed commented file addition note

* 🔨 chore: clean up commented-out tests (round 5)

Removed commented-out test blocks:
- session.test.ts: removed commented getAgentConfigById describe block (29 lines)
- app.test.ts: removed commented OPENAI_FUNCTION_REGIONS test (5 lines)
2026-01-20 21:26:07 +08:00
Innei
5c645f09fd 🐛 fix: simplify updater config logic (#11636)
* 🐛 fix: simplify updater config logic

- Remove isDev check from UpdaterManager initialization
- Remove unused enableRenderHotUpdate field
- Simplify updater behavior to respect enableAppUpdate config

* chore: cleanup

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-20 20:16:33 +08:00
Innei
6ed280e0cc feat: improve desktop onboarding window management and footer actions (#11619)
*  feat: improve desktop onboarding window management and footer actions

- Add APP_WINDOW_MIN_SIZE constant for consistent window constraints
- Extract reusable OnboardingFooterActions component for step navigation
- Implement setWindowMinimumSize API in electron system service
- Apply dedicated minimum size (1200x900) during onboarding flow
- Restore app-level defaults (860x500) when onboarding completes
- Add windowMinimumSize parameter support in BrowserManager

Resolves: LOBE-3643, LOBE-3225, LOBE-2588

* chore: update .gitignore to include pnpm-lock.yaml and remove pnpm-lock.yaml file

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-19 21:27:30 +08:00
Innei
1018679cc8 feat: Add desktop OIDC authentication and onboarding improvements (#11569) 2026-01-19 20:14:54 +08:00
Innei
4e5a516865 🐛 fix(desktop): add auth required modal and improve error handling (#11574)
* 🐛 fix(desktop): add auth required modal and improve error handling

- Add AuthRequiredModal component to handle authentication expiration
- Improve backend proxy protocol error handling for auth errors
- Add updater manager authentication header support
- Add i18n strings for auth error messages

* 🔧 fix(desktop): update UpdaterManager to leave channel unset for GitHub prerelease matching

- Modify UpdaterManager to leave the channel unset, allowing GitHub to use version tags for prerelease matching.
- Update logging to reflect the new behavior when the channel is unset or kept as is.

Signed-off-by: Innei <tukon479@gmail.com>

* 🔧 fix(desktop): clarify UpdaterManager behavior for GitHub provider

- Update comments and logging in UpdaterManager to clarify that the channel is left unset for beta/nightly, allowing GitHub to use version tags for prerelease matching.
- Ensure logging accurately reflects the new behavior when the channel is unset.

Signed-off-by: Innei <tukon479@gmail.com>

*  feat(desktop): add desktop build channel script and update documentation

- Introduced a new script for building desktop applications for specific release channels (stable, beta, nightly).
- Updated package.json to include a new npm command for the build channel.
- Enhanced README documentation to guide users on simulating CI channel builds and retaining changes.

Signed-off-by: Innei <tukon479@gmail.com>

* 🔧 fix(desktop): streamline NODE_ENV usage in logger and config

- Removed redundant process.env.NODE_ENV definition from electron.vite.config.ts.
- Simplified logger implementation by directly using process.env.NODE_ENV for environment checks.
- Improved readability and maintainability of logging behavior based on the environment.

Signed-off-by: Innei <tukon479@gmail.com>

* 🔧 fix(desktop): enhance logging configuration to support debug mode

- Updated logger configuration to allow for debug level logging when DEBUG environment variable is set.
- Simplified the logic for console logging levels based on the environment, improving clarity and maintainability.

Signed-off-by: Innei <tukon479@gmail.com>

* 🔧 fix(desktop): enhance version generation and logging in UpdaterManager

- Updated version generation logic in manual-build-desktop.yml to handle channel suffixes more effectively.
- Added inferredChannel logging in UpdaterManager to improve clarity on the current update channel being used.

Signed-off-by: Innei <tukon479@gmail.com>

* 🔧 fix(desktop): update localization files and set default entry locale to English

- Changed default entry locale from Chinese (zh-CN) to English (en) in .i18nrc.js.
- Added full disk access messages in multiple languages (Arabic, Bulgarian, German, Spanish, French, Italian, Japanese, Korean, Dutch, Polish, Portuguese, Russian, Turkish, Vietnamese, Traditional Chinese).
- Enhanced menu localization with new settings and permissions options across various languages.

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-18 18:55:18 +08:00
LobeHub Bot
d33d374a11 🌐 chore: translate non-English comments to English in database & desktop modules (#11578)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-18 12:02:52 +08:00
Innei
9383c6be44 🐛 fix(desktop): ensure allowPrerelease is set correctly for updater (#11566)
* 🐛 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>
2026-01-17 16:59:51 +08:00
Innei
2253d46ee0 ♻️ refactor: migrate Next.js navigation APIs to React Router for SPA (#11394)
This implements Phase 3 of LOBE-2850, establishing a dual routing architecture
for the Next.js to Vite React Router SPA migration.

## Changes

### New wrapper modules
- `src/libs/next/` - Next.js wrappers for auth pages (Link, Image, navigation, dynamic)
- `src/libs/router/` - React Router wrappers for SPA routes (Link, navigation hooks)

### Link component updates
- External links (`http://`, `https://`) → native `<a>` tags
- SPA internal routes → React Router `<Link>`
- Auth pages → Next.js `<Link>` (preserved)
- Global `src/components/Link.tsx` → smart component for ConfigProvider

### Navigation hook updates
- SPA routes use `@/libs/router/navigation` (useRouter, usePathname, useSearchParams)
- Auth pages use `@/libs/next/navigation`
- GlobalProvider uses `window.location` (outside Router context)

### Architecture
```
GlobalProvider (no Router context)
└── AppTheme + ConfigProvider
    ├── Auth pages (Next.js routing)
    └── SPA Router (BrowserRouter)
        └── SPA pages (React Router)
```

Resolves LOBE-2850
2026-01-16 00:28:15 +08:00
Innei
b9341c3183 🐛 fix(mcp): fix installation check hanging issue in desktop app (#11524)
*  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>
2026-01-15 23:30:05 +08:00
Innei
959c210e86 feat(desktop): add local update testing scripts and stable channel API version check (#11474)
* 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>
2026-01-15 17:26:19 +08:00
Innei
e7739e5c64 ♻️ refactor(desktop): unify TITLE_BAR_HEIGHT constant to desktop-bridge (#11496)
* ♻️ 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>
2026-01-14 22:05:28 +08:00
Innei
08f6ee3d83 feat(electron): add custom titlebar for Electron windows (#11438)
- 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
2026-01-12 17:37:50 +08:00
René Wang
b9f9d6158e fix: final patch for resource (#11398)
* refacotr: Clean up explorer entry

* fix: Cannot add page to a library

* fix: Cannot open newly created page

* fix: Page title

* fix: Page title

* fix: Recent pages jump

* fix: Column width

* fix: Column width

* style: Add visual guide

* lint: Break down files

* fix: Visual guide not disappear

* style: File name turncate

* fix: Remove chunking button for page

* fix: Upload style missing

* fix: Folder state lagging

* fix: Folder state lagging

* fix: File didn't shown up

* fix: Type error

* fix: Lint error

* fix: Lint error
2026-01-12 15:07:29 +08:00
Innei
67a81141df 🐛 fix: Fix Windows desktop build error with macOS native module (#11417)
*  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
2026-01-11 17:13:11 +08:00
Arvin Xu
cbeb01399f 🐛 fix: handle will-prevent-unload event to allow app quit (#11406)
fix: handle will-prevent-unload event to allow app quit
2026-01-11 16:18:56 +08:00
Innei
07dc919496 🔧 chore(desktop): exclude node_modules from electron-builder packaging (#11397)
* 🔧 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>
2026-01-10 23:15:42 +08:00
Innei
2d5868f759 feat(desktop): improve macOS permission requests and Full Disk Access detection (#11380)
*  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
2026-01-10 01:06:49 +08:00
Innei
3623e585e2 🎨 style(desktop): update macOS beta icon assets (#11368)
Co-authored-by: Claude <noreply@anthropic.com>
2026-01-09 14:54:33 +08:00
Innei
57e725cbb3 🐛 fix(desktop): prevent duplicate CORS headers in response (#11350)
* 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>
2026-01-08 22:14:40 +08:00
Innei
0d1eedf7a7 🐛 fix(desktop): update macOS beta icon size for macOS 26 (#11348)
Update the desktop beta icons to fix sizing issue on macOS 26 where the icon appeared smaller than expected.

Fixes LOBE-2873
2026-01-08 20:40:26 +08:00
Innei
db270d5aba feat(desktop): implement history navigation stack (#11341)
*  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>
2026-01-08 19:37:51 +08:00
Innei
49ec5edffb 🐛 fix: resolve desktop upload CORS issue (#11255)
* 🐛 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>
2026-01-05 22:37:43 +08:00
Innei
56fe3d33bc 🐛 fix: restore getBounds mock in Browser test beforeEach (#11254)
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.
2026-01-05 20:25:32 +08:00
Innei
e0b555e92a 🐛 fix: restore window position safely
🐛 fix: restore window position safely
2026-01-05 15:49:13 +08:00
Innei
3a30d9aed1 refactor: migrate theme management to next-themes (#11112)
* refactor: migrate theme management to `next-themes` and remove theme from route variants and global store.

Signed-off-by: Innei <tukon479@gmail.com>

* refactor: Unify theme mode to 'system' instead of 'auto' and streamline Electron theme synchronization.

Signed-off-by: Innei <tukon479@gmail.com>

* refactor: Remove LOBE_THEME_APPEARANCE constant and simplify desktop theme source assignment.

Signed-off-by: Innei <tukon479@gmail.com>

* chore: Update antd-style dependency from npm alias to specific alpha version.

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update pnpm lockfile

Signed-off-by: Innei <tukon479@gmail.com>

* feat: Default theme to system and update Next.js RSC payload path example.

Signed-off-by: Innei <tukon479@gmail.com>

* feat: add `dev:static` script for static renderer development

Signed-off-by: Innei <tukon479@gmail.com>

* refactor: replace useThemeMode with custom useIsDark hook for theme detection and add ClientOnly component

Signed-off-by: Innei <tukon479@gmail.com>

* refactor: Remove `extractStaticStyle` import and cache prop from `StyleRegistry`.

Signed-off-by: Innei <tukon479@gmail.com>

* chore: Remove debug console log for current appearance.

Signed-off-by: Innei <tukon479@gmail.com>

* fix: Migrate legacy 'auto' theme mode to 'system' and refine theme background CSS selectors.

Signed-off-by: Innei <tukon479@gmail.com>

* feat: Add window dragging to desktop onboarding layout and update antd-style dependency.

* refactor: Refine global background styling to target body elements, remove token-based background, and clean up debugging script.

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-01-05 13:23:43 +08:00
Innei
0205cf73bd refactor: Extract renderer URL and protocol management into dedicated manager (#11208)
* 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>
2026-01-05 00:59:35 +08:00
Innei
f8be760115 fix(desktop): sidebar background based on systemTheme (#11143)
Signed-off-by: Innei <tukon479@gmail.com>
2026-01-04 12:38:42 +08:00
Arvin Xu
d8deaddedd feat: add work path for local system (#11128)
*  feat: support to show working dir

* fix style

* update docs

* update topic

* refactor to use chat config

* inject working Directory

* update i18n

* fix tests
2026-01-03 16:22:22 +08:00
Innei
f9d991b26c Merge branch 'next' into dev 2025-12-31 14:58:42 +08:00
Innei
4faa65c6af feat(model): improve model list UI and add disabled models management (#11036)
*  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>
2025-12-30 16:49:12 +08:00
Innei
9db8da82f6 feat: enhance macOS desktop permissions and onboarding (#11016)
* 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
2025-12-30 16:06:44 +08:00
Innei
34a6312668 feat: enhance desktop onboarding with sign out and localization (#11033)
*  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
2025-12-29 21:03:08 +08:00
huangkairan
812ed7db15 fix: updater not work on Windows (#11027) 2025-12-29 16:55:51 +08:00
Innei
770c87256b 🐛 fix: locale resolve bug with ESM module loading (#11018)
* 🐛 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.
2025-12-29 13:19:51 +08:00
Innei
b3520a2205 🐛 fix: Fix desktop test cases and refactor translations (#10955)
* 🐛 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
2025-12-25 12:29:28 +08:00
Innei
1a4f4564f0 feat(desktop): macOS About menu should navigate to Settings About tab (#10942)
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>
2025-12-24 20:49:57 +08:00
Innei
dc870c7635 ♻️ refactor: rename browser identifier from 'chat' to 'app' (#10940)
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>
2025-12-24 20:43:11 +08:00
Innei
e5f3a58056 ♻️ refactor: flatten i18n keys and extract hardcoded strings in desktop (#10939)
- 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>
2025-12-24 20:29:19 +08:00
Innei
d692a37e28 ♻️ refactor: i18n formatting optimization (#10929)
* ♻️ 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>
2025-12-24 17:54:42 +08:00
CanisMinor
024aeb2e4e 💄 style: Update i18n microcopy (#10905)
* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n

* chore: update i18n translations and placeholders across multiple components

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update i18n translations for consistency in terminology across chat, onboarding, and settings components

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update i18n translations to replace 'assistant' with 'agent' and ensure consistency across all components

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update model descriptions in locales for clarity and accuracy

Signed-off-by: Innei <tukon479@gmail.com>

* feat: extract hard code string

Signed-off-by: Innei <tukon479@gmail.com>

* feat: enhance Chinese localization with new proxy and sync settings, update dialog messages for version checks and OAuth authorization

Signed-off-by: Innei <tukon479@gmail.com>

* chore: flatten

* chore: standardize localization keys by flattening nested structures across multiple languages

Signed-off-by: Innei <tukon479@gmail.com>

* chore: refine i18n documentation by consolidating key naming conventions and workflow guidelines for translation management

Signed-off-by: Innei <tukon479@gmail.com>

* chore: update i18n

* feat: add chat title localization for improved user experience in Chinese

Signed-off-by: Innei <tukon479@gmail.com>

---------

Signed-off-by: Innei <tukon479@gmail.com>
Co-authored-by: Innei <tukon479@gmail.com>
2025-12-24 12:55:12 +08:00
Innei
e51225baa8 test: fix desktop test case (#10894)
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>
2025-12-24 12:54:46 +08:00
Innei
c29c02bb23 🐛 fix(desktop): prevent window resize when onboarding (#10887)
 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>
2025-12-24 12:54:45 +08:00
Innei
10e048c9c5 feat: refactor desktop implement with brand new 2.0 2025-12-24 12:54:35 +08:00
YuTengjing
458cbf4d5c 🔨 chore: track user last active time (#10733) 2025-12-11 17:14:25 +08:00