214 Commits

Author SHA1 Message Date
Innei
aaa7b6d153 feat(desktop): implement subscription pages embedding with webview (#12114)
*  feat(desktop): implement subscription pages embedding with webview

- Add SubscriptionIframeWrapper component for embedding subscription pages in Electron webview
- Replace compile-time ENABLE_BUSINESS_FEATURES with runtime serverConfigSelectors
- Add useIsCloudActive hook to detect cloud sync status
- Add setupSubscriptionWebviewSession service for webview session management

Resolves LOBE-4589

*  feat: enhance SubscriptionIframeWrapper for improved configuration

- Updated iframe URL to use OFFICIAL_URL for better maintainability.
- Integrated server configuration to conditionally enable business features.
- Cleaned up code by removing commented-out lines and unnecessary eslint suppressions.

This update improves the flexibility and readability of the SubscriptionIframeWrapper component.

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

*  feat: enhance link interception in SubscriptionIframeWrapper

- Updated the script to intercept both link clicks and window.open calls for better URL handling.
- Added functionality to resolve relative URLs to absolute before logging.

This improvement enhances the tracking of external link interactions within the iframe.

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

* 🔧 chore: clean up useIsCloudActive hook

- Removed unnecessary eslint suppressions related to react-hooks rules.
- Improved code readability by eliminating commented-out lines.

This update enhances the clarity and maintainability of the useIsCloudActive hook.

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

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-02-11 13:05:10 +08:00
Innei
fcdaf9d814 🔧 chore: update eslint v2 configuration and suppressions (#12133)
* v2 init

* chore: update eslint suppressions and package dependencies

- Removed several eslint suppressions related to array sorting and reversing from eslint-suppressions.json to clean up the configuration.
- Updated @lobehub/lint package version from 2.0.0-beta.6 to 2.0.0-beta.7 in package.json for improvements and bug fixes.
- Made minor formatting adjustments in vitest.config.mts and various SKILL.md files for better readability and consistency.

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

* fix: clean up import statements and formatting

- Removed unnecessary whitespace in replaceComponentImports.ts for improved readability.
- Standardized import statements in contextEngineering.ts and createAgentExecutors.ts by adding missing spaces for consistency.

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

* chore: update eslint suppressions and clean up code formatting

* 🐛 fix: use vi.hoisted for mock variable initialization

Fix TDZ error in persona service test by using vi.hoisted() to ensure
mock variables are available when vi.mock factory runs.

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-02-11 13:04:48 +08:00
Innei
b010ab9da8 ♻️ refactor(fileSearch): File/Content Search by Platform (#12074)
* ♻️ refactor(fileSearch): consolidate determineContentType to base class and use os.homedir()

- Move determineContentType method to FileSearchImpl base class with merged type mappings
- Replace process.env.HOME with os.homedir() in macOS and Linux implementations
- Replace process.env.USERPROFILE with os.homedir() in Windows implementation
- Remove duplicate implementation from three platform-specific classes

* refactor: content search service

* chore: add engine text

* fix: show engine

* test: add unit tests for contentSearch and fileSearch modules

- Add base.test.ts and index.test.ts for contentSearch module
- Add base.test.ts and index.test.ts for fileSearch module
- Test buildGrepArgs, determineContentType, escapeGlobPattern, etc.
- Test factory functions for platform-specific implementations

* 🐛 fix(contentSearch): use correct ripgrep glob patterns for nested path exclusion

Change `!node_modules` and `!.git` to `!**/node_modules/**` and `!**/.git/**`
to properly exclude nested directories as per ripgrep documentation.

* fix: types
2026-02-11 12:58:46 +08:00
Innei
6f24e6b900 feat(desktop): add proactive token refresh on app startup and activation
- Refresh token on every app launch (with 5-minute debounce to prevent rapid restarts)
- Trigger refresh on Mac app activation (Dock click) with same debounce
- Track lastRefreshAt timestamp in encrypted token storage
- Add isRemoteServerConfigured() helper method to avoid code duplication
- Fix cloud mode check that incorrectly required remoteServerUrl
- Add comprehensive tests for all refresh scenarios
2026-02-11 12:58:45 +08:00
Innei
899cf85e94 feat: rebrand stable app icon
Signed-off-by: Innei <tukon479@gmail.com>
2026-02-11 12:58:44 +08:00
Innei
b8fdcc3070 feat(desktop): enhance desktop menu and navigation system
- Add DesktopFileMenuBridge component for native menu integration
- Update navigation events in electron-client-ipc
- Modify menu implementations across all platforms (Linux, macOS, Windows)
- Add hotkey settings for desktop features
- Update layout and menu creation hooks for desktop navigation
2026-02-11 12:58:42 +08:00
Innei
8188e2d9f0 ♻️ refactor: restructure electron build workflow with i18n codemod
- Remove desktop-build-electron.yml workflow
- Add verify-electron-codemod.yml workflow for i18n transformation
- Add i18nDynamicToStatic modifier for dynamic to static i18n conversion
- Update build workflows to use new i18n modifier approach
- Update README and package.json configurations
2026-02-11 12:58:42 +08:00
Arvin Xu
16b1904088 👷 build: add agent skills database schema (#12197)
* add skills db

* improve shell

* fix tests

* fix build

* fix tests
2026-02-08 19:53:27 +08:00
LobeHub Bot
e18b7a92c7 🌐 chore: translate non-English comments to English in desktop menus (#12056)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-04 13:21:24 +08:00
Arvin Xu
5e203b868c 💄 style: improve local-system tool implement (#12022)
* improve local system ability

* fix build

* improve tools title render

* fix tools

* update

* try to fix lint

* update

* refactor the LocalFileCtr.ts result

* refactor the exector result
2026-02-01 12:13:27 +08:00
LobeHub Bot
67c4bafd3f 🌐 chore: translate non-English comments to English in desktop controllers (#11978) 2026-01-31 00:49:38 +08:00
YuTengjing
e6cb6cb592 🐛 fix: rename docker image and update docs for v2 (#11911) 2026-01-27 22:14:58 +08:00
LobeHub Bot
dce106b8be 🌐 chore: translate non-English comments to English in desktop core modules (#11873)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-27 12:57:09 +08:00
Innei
e3c80d53ce feat(electron): enhance native module handling and improve desktop features (#11867)
* 🔧 refactor: streamline theme handling and title bar overlay

*  feat(titlebar): integrate theme update handling in SimpleTitleBar component

* 🔧 chore: move `node-mac-permissions` to optionalDependencies and add TypeScript module declaration

*  feat(electron): implement connection drawer state management and enhance auth modal functionality

* 🐛 fix(ci): fix Windows PowerShell Start-Job working directory issue

Start-Job runs in a separate process with default user directory,
causing npm install-isolated to fail. Fixed by setting correct
working directory in each job using $using:workingDir.

* 🐛 fix(ci): use Start-Process instead of Start-Job for Windows parallel install

Start-Job runs in isolated PowerShell process without inheriting PATH,
causing pnpm/npm commands to fail. Start-Process inherits environment
and provides proper exit code handling.

* 🐛 fix(ci): use desktop-build-setup action for Windows build

Use the same composite action as other desktop workflows instead of
custom PowerShell parallel install which has environment issues.

*  feat(menu): enhance context menu with additional options for image and link handling

* 🔧 fix(auth-modal): prevent modal from opening during desktop onboarding

*  feat(electron): enhance native module handling and improve localization resource loading

resolves LOBE-4370

- Added `copyNativeModulesToSource` function to resolve pnpm symlinks for native modules before packaging.
- Introduced `getNativeModulesFilesConfig` to explicitly include native modules in the build process.
- Updated `electron-builder` configuration to utilize the new functions for better native module management.
- Enhanced localization resource loading by splitting JSON files by namespace.

* 🐛 fix(lint): use slice instead of substring

* 🐛 fix(desktop): include global.d.ts in tsconfig for node-mac-permissions types

* 🐛 fix(desktop): add ts-ignore for optional node-mac-permissions module

* fix: update ui
2026-01-27 01:30:08 +08:00
Innei
ec854d7d55 feat(desktop): add manual update check entry in About page (#11854)
*  feat(desktop): add manual update check entry in About page

Add a 'Check for Updates' button to the About page that appears only on desktop and when no new version is available. This allows users to manually trigger update checks without relying on the automatic check schedule.

- Add checkForUpdates i18n key and translations (en-US, zh-CN)
- Modify UpdaterCtr to pass manual: true flag
- Add check update button to Version component
- Button hidden when new version is detected

* Update Version.tsx

* 💄 style: format onClick handler

* fix: correct onClick handler syntax in Version component
2026-01-26 20:14:14 +08:00
Innei
8896c06b7f feat(desktop): add system save dialog for markdown export (#11852)
- Add ShowSaveDialogParams/Result types to electron-client-ipc
- Implement handleShowSaveDialog in LocalFileCtr using Electron dialog API
- Add showSaveDialog method to localFileService
- Create desktopExportService for Desktop-specific export logic
- Use system file picker instead of hardcoded downloads path
- Show toast with actions (open file / show in folder) after export
- Add i18n keys for export dialog and actions
2026-01-26 17:44:20 +08:00
Innei
c3fd2dc785 🐛 fix(desktop): prevent duplicate IPC handler registration from dynamic imports (#11827)
* 🐛 fix(desktop): prevent duplicate IPC handler registration from dynamic imports

Fix an issue where dynamic imports in file-loaders package would cause
the debug package to be bundled into index.js, leading to side-effect
pollution and duplicate electron-log IPC handler registration.

- Add manualChunks config to isolate debug package into separate chunk
- Add @napi-rs/canvas to native modules for proper externalization

*  feat(desktop): enhance afterPack hook and add native module copying
2026-01-26 02:10:35 +08:00
Arvin Xu
3b41009a68 🐛 fix: fix add message and improve local system tool (#11815)
* fix add message

* fix grep content issue

* fix command tool

* improve loading
2026-01-25 22:54:38 +08:00
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