Commit graph

34 commits

Author SHA1 Message Date
Arvin Xu
8240e8685d
🐛 fix(desktop): repo-type detection for submodule/worktree + chat & sidebar polish (#13978)
* 🐛 fix(desktop): detect repo type for submodule and worktree directories

Route detectRepoType through resolveGitDir so directories where `.git`
is a pointer file (submodules, worktrees) are correctly identified as
git/github repos instead of falling back to the plain folder icon.

Fixes LOBE-7373

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 🐛 fix(desktop): reprobe repo type for stale recent-dir entries

The recents picker rendered `entry.repoType` directly from localStorage,
so any submodule/worktree entry cached while `detectRepoType` still
returned `undefined` stayed stuck on the folder icon even after the
main-process fix. Wrap each row icon in a component that calls
`useRepoType`, which re-probes missing entries and backfills the cache.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 🐛 fix(chat-input): clear autocomplete hint on IME start to prevent freeze

Dispatch KEY_ESCAPE_COMMAND on compositionstart so the autocomplete
plugin removes PlaceholderInline/PlaceholderBlock nodes before the IME
begins composing. Composing next to those placeholder nodes caused the
editor to freeze during pinyin input with a visible hint.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ♻️ refactor(topic-sidebar): split project grouping into ByProjectMode

Extracts project-specific group rendering from ByTimeMode into its own ByProjectMode folder, with a shared GroupedAccordion container. Project groups get a folder-icon column aligned with the topic item layout and a "new topic in {directory}" action.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 🐛 fix(desktop): read config via commondir for linked worktrees

`resolveGitDir` returns `.git/worktrees/<name>/` for linked worktrees —
that dir has its own `HEAD` but no `config`, so `detectRepoType` still
returned `undefined` and worktrees missed the repo icon. Resolve the
`commondir` pointer first so `config` is read from the shared gitdir.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 23:56:39 +08:00
Arvin Xu
7d5889a7ed
feat(heterogeneous-agent): git-aware runtime config + topic rename modal + inspectors (#13951)
*  feat(cc-desktop): git-aware runtime config + topic rename modal + inspectors

Cluster of desktop UX improvements around the Claude Code integration:

- CC chat input runtime bar: branch switcher, git status, and a richer
  working-directory bar powered by a new SystemCtr git API
  (branch list / current status) and `useGitInfo` hook.
- Topic rename: switch to a dedicated RenameModal component; add an
  auto-rename action in the conversation header menu.
- ToolSearch inspector for the CC tool client.
- Shared DotsLoading indicator.
- Operation slice tidy-ups for CC flows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ♻️ refactor(types): rename heterogeneous provider type `claudecode` → `claude-code`

Align the type literal with the npm/CLI naming convention used elsewhere
(@lobechat/builtin-tool-claude-code, claude-code provider id) so the union
matches the rest of the codebase.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 💄 style(cc-desktop): polish TodoWrite labels, branch switcher refresh, and chat input affordances

- TodoWrite render + inspector: i18n the header label (Todos / Current step
  / All tasks completed), surface the active step inline as highlighted text,
  and switch the in-progress accent from primary to info for better contrast.
- BranchSwitcher: move the refresh button into the dropdown's section header,
  switch the search and create-branch inputs to the filled variant, and
  reuse DropdownMenuItem for the create-branch entry instead of a custom
  footer chip.
- GitStatus: drop the inline refresh affordance (now lives in the switcher),
  collapse trigger styles, and split the PR badge with its own separator.
- WorkingDirectory / WorkingDirectoryBar: tighten paddings and gaps so the
  runtime config row reads at a consistent height.
- InputEditor: skip inline placeholder completion when the cursor is not at
  end of paragraph — inserting a placeholder mid-text triggered nested
  editor updates that froze the input.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 🐛 fix(cc-desktop): probe repoType for working dirs not cached in recents

GitStatus was gated on the `repoType` stored in `recentDirs`, but legacy
string entries and agent-config-driven paths that never went through the
folder picker have no cached `repoType`. As a result, branch / PR status
silently disappeared for valid git repos until users re-selected the
folder.

Promote `detectRepoType` to a public IPC method and add a `useRepoType`
hook that uses the cached value as a fast path, otherwise probes the
filesystem via SWR and backfills the recents entry so subsequent reads
hit cache. Both runtime config bars (CC mode + heterogeneous chat input)
now resolve `repoType` through the hook.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 💄 style(shared-tool-ui): rework Bash/Grep/Glob inspector rows

- RunCommand: terminal-prompt icon + mono command text instead of underline highlight
- Grep: split pattern by `|` into mono tag chips
- Glob: single mono tag chip matching Grep
- Switch rows to baseline alignment so the smaller mono text lines up with the label

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* 🐛 fix(DotsLoading): allow optional color in styles params

The Required<StyleArgs> generic forced color to string, but it's only
defaulted at the CSS level via fallback to token.colorTextSecondary.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 18:40:39 +08:00
Innei
d2197f4c30
♻️ refactor(desktop): consolidate global shortcuts (LOBE-7181) (#13880)
* ♻️ refactor(desktop): consolidate global shortcuts and remove default showApp hotkey

- Add desktopGlobalShortcuts.ts as single source for Electron + renderer defaults
- Wire ShortcutManager and store to DEFAULT_ELECTRON_DESKTOP_SHORTCUTS
- Use DesktopHotkeyId for @shortcut; drop local shortcuts barrel
- Stop re-exporting DESKTOP_HOTKEYS_REGISTRATION from hotkeys

Fixes LOBE-7181

Made-with: Cursor

*  feat(desktop): introduce new stubs for business constants and types

- Added `@lobechat/business-const` and `@lobechat/types` packages to support workspace dependency resolution.
- Updated `package.json` and `pnpm-workspace.yaml` to include new stubs.
- Refactored imports in `index.ts` to utilize the new constants structure.
- Enhanced `desktopGlobalShortcuts.ts` with improved type definitions for hotkeys.

This change streamlines the management of constants and types across the desktop application.

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

* ♻️ refactor(hotkeys): consolidate desktop global shortcut definitions (LOBE-7181)

Made-with: Cursor

*  feat(session, user): replace direct type imports with constants

- Updated session.ts to use constants for session types instead of direct imports from @lobechat/types.
- Updated user.ts to use a constant for the default topic display mode, enhancing consistency and maintainability.

This change improves code clarity and reduces dependencies on external type definitions.

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

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-04-17 00:32:05 +08:00
Rdmclin2
2c397390b4
feat: layout sidebar impl (#13719)
* ♻️ Restructure sidebar layout: extract Lobe AI entry, move New Agent button

- Extract Lobe AI (InboxItem) from agent list to standalone top entry in sidebar body
- Move "New Agent" button from header to below Lobe AI entry
- Add "Create" to bottom menu items alongside Community and Resources
- Filter hidden items in BottomMenu component

Fixes LOBE-6938

https://claude.ai/code/session_01RtfXck3GUngoLAgP2yHArz

*  Add unified Recents section to home page

- New TRPC router `recent.getAll` aggregating topics, documents, files, and tasks
- New client service and SWR-based store integration for recents data
- Unified Recents component on home page with type-based icons
- Items sorted by updatedAt, limited to 10, mixed across all types

Fixes LOBE-6938

https://claude.ai/code/session_01RtfXck3GUngoLAgP2yHArz

*  Prefetch agent config on hover for faster page loads

- Add usePrefetchAgent hook using SWR mutate to warm cache
- Trigger prefetch on mouseEnter for sidebar agent items
- Reduces or eliminates loading screen when navigating to agent pages

Fixes LOBE-6938

https://claude.ai/code/session_01RtfXck3GUngoLAgP2yHArz

*  Redesign agent homepage with info, recent topics, and tasks

- New AgentHome feature replacing the old AgentWelcome component
- Agent info section: avatar, name, description, opening questions
- Recent Topics: horizontal scrollable cards for agent-specific topics
- Tasks section: list with status labels for agent-assigned tasks
- Preserve ToolAuthAlert for tool authorization flows

Fixes LOBE-6938

https://claude.ai/code/session_01RtfXck3GUngoLAgP2yHArz

* fix: common misstakes in layout

* chore: add fetch Recents cache

* chore: add back createagents

* chore: add back lobe ai

* feat: add display count

* feat: add create agent button

* feat: add sidebar section order

* chore: move divider

*  feat: show current page size in display items submenu

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: add sidebar display management with customize sidebar modal

- Add "Hide section" and "Customize sidebar" to Recents/Agents dropdown menus
- Create CustomizeSidebarModal with eye toggle for section visibility
- BottomMenu (Community/Resources) also manageable via modal
- Show customize sidebar button in footer when all sections hidden
- Add hiddenSidebarSections to store with localStorage persistence
- Rename "Display Items" to "Show" in dropdown menus
- Add 12px margin between accordion sections and bottom menu
- Add i18n keys for en-US and zh-CN

Fixes LOBE-6938

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 💄 style: use SlidersHorizontal icon for customize sidebar

Replace Settings2/PanelLeft icon with SlidersHorizontal to avoid
confusion with the settings gear icon.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 💄 style: refine sidebar customization UX

- Move Settings entry from Footer to BottomMenu alongside Community/Resources
- Add Settings to Customize sidebar modal with eye toggle
- Allow hiding all sections (remove disabled constraint)
- Move Customize sidebar button next to help button in Footer
- Merge Agent dropdown: group Create items with Category items
- Use SlidersHorizontal icon for Customize sidebar

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: add recents item actions and "more" drawer

- Add inline rename (same as Agent Topic) and delete to Recents items
- Topic/document/file support rename + delete, task supports delete only
- Add "more" button when items exceed pageSize, opens AllRecentsDrawer
- AllRecentsDrawer shows all cached recents from store (up to 50)
- Fetch max(pageSize, 50) items to support drawer without extra request

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: add create agent/group modal with ChatInput and examples

- Add CreateAgentModal using base-ui Modal with ChatInputProvider
- Show suggestion examples (agent/group mode) in 2-column grid
- Submit triggers sendAsAgent/sendAsGroup to auto-generate via Agent Builder
- "Create Blank" button for skipping the prompt
- Integrate modal into AgentModalProvider for shared state across sidebar
- Wire up AddButton, NewAgentButton, and dropdown menus to open modal

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: optimitic update rename

* chore: prefetch agent detail

* feat: add recent topic meta data

* feat: add recents search

*  perf: optimize recents API with single UNION query and prefetch

- Replace 3 separate DB queries with single UNION ALL query (RecentModel)
- Add optimistic updates for rename and delete actions
- Add hover prefetch for resources (usePrefetchResource)
- Add hover prefetch for agent config on topic/task items
- Change default pageSize to 5 for both Agents and Recents
- Unify delete confirmation messages per item type

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: adjust settings page

* chore: optimize side bar

* feat: recents support right click

* chore: add pin icon to Agents

* chore: add custom side bar modal

* chore: reserve rencent drawer status

* feat: add prefetch route

* feat: add LobeAI prefetch

* fix: document and task rename and delete operation lost

* fix: group route id

* fix: lint error

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-11 00:13:19 +08:00
Arvin Xu
a7e3d198df
🐛 fix(chat-input): memoize mentionOption/slashOption to prevent freeze on paste (#13551)
* 🐛 fix(chat-input): memoize mentionOption and slashOption to prevent page freeze on paste

Stabilize mentionOption and slashOption references with useMemo/useCallback to break the
infinite re-render loop that occurs when pasting text triggers autocomplete.

Fixes LOBE-6684

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix(chat-input): trim trailing newlines from autocomplete result to prevent empty lines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix(chat-input): skip autocomplete during IME composition to prevent interrupting Chinese input

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 20:09:17 +08:00
Innei
dbdbe16da9
♻️ refactor: move skills/tools to @ mention with direct context injection (#13419)
* ♻️ refactor: move skills/tools from slash menu to @ mention with direct context injection

Separates slash menu (/) and @ mention responsibilities:
- Slash menu: only commands (compact, newTopic)
- @ mention: agents, topics, skills, tools

Replaces fake activateSkill tool-call preload messages with direct
content injection via SelectedSkillInjector/SelectedToolInjector,
preventing models from mimicking activateSkill calls.

Fixes LOBE-6048

* ♻️ refactor: skip activateSkill when skill content already injected via selected_skill_context

Fixes LOBE-6048

* ♻️ refactor: align @-mention skills/tools with context injectors and preload

Made-with: Cursor

* 🐛 fix(chat): preserve editorData across queue and home input sends

* Update home send APIs and align related tests
2026-04-03 22:09:48 +08:00
Arvin Xu
251e12c7d1
feat(editor): implement AI input auto-completion (#13458)
*  feat: implement AI input auto-completion with ReactAutoCompletePlugin

Adds GitHub Copilot-style ghost text completion to the chat input,
powered by a configurable system agent (disabled by default).

Key changes:
- Add `inputCompletion` system agent config (type, default, selector, i18n)
- Create `chainInputCompletion` prompt chain (V2 few-shot, benchmarked)
- Mount `ReactAutoCompletePlugin` in InputEditor when enabled
- Wire `getMessages` through ChatInput store for conversation context
- Add settings UI in Service Model page with enable toggle

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  test: update systemAgent snapshot for inputCompletion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: restrict auto-complete context to visible user/assistant turns

Filter getMessages to use displayMessages (active visible thread)
instead of dbMessages (raw DB records including tool messages and
inactive branches). Also limit to last 10 user/assistant turns to
keep payload small and relevant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

*  feat: enable input completion by default

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ️ perf: use non-streaming for input completion requests

Autocomplete needs the full result before displaying ghost text,
so streaming adds unnecessary overhead. Setting stream: false
reduces latency by avoiding SSE chunking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* 🐛 fix: revert stream:false for input completion

fetchPresetTaskResult uses fetchSSE internally which cannot handle
non-streaming JSON responses, causing the editor to freeze after
receiving the completion result.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ️ perf: use non-streaming for input completion requests

Autocomplete waits for the full result before displaying ghost text.
fetchSSE handles non-streaming responses via its fallback path
(response.clone().text()), avoiding SSE chunking overhead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ️ perf: skip contextEngineering for input completion

Call getChatCompletion directly instead of fetchPresetTaskResult
to avoid triggering agentDocument.getDocuments on every autocomplete
request. Input completion only needs a simple LLM call with the
prompt chain, not the full context engineering pipeline.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ♻️ refactor: revert to fetchPresetTaskResult for input completion

Use the standard contextEngineering pipeline. The agentDocument
overhead will be addressed separately.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 02:00:18 +08:00
Innei
d8534c2966
🐛 fix(chat-input): preserve fullscreen editor state and send behavior (#13481)
* 🐛 fix(chat-input): preserve editor state and behavior in fullscreen

Keep chat input content and interaction consistent when toggling fullscreen by restoring editor JSON state, adjusting Enter/Cmd+Enter semantics, and rendering fullscreen input in the desktop layout container.

Made-with: Cursor

* 🐛 fix(chat-input): auto-collapse fullscreen after send

Automatically exit fullscreen after sending from chat input so users do not need a second manual collapse action, and clear saved editor snapshot to avoid stale restore.

Made-with: Cursor
2026-04-02 02:13:15 +08:00
Innei
80cb6c9d11
feat(chat-input): add category-based mention menu (#13109)
*  feat(chat-input): add category-based mention menu with keyboard navigation

Replace flat mention list with a structured category menu (Agents, Members, Topics).
Supports home/category/search views, Fuse.js fuzzy search, floating-ui positioning,
and full keyboard navigation.

* 🔧 chore: update @lobehub/editor to version 4.3.0 and refactor type definition in useMentionCategories

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

*  feat(MentionMenu): enhance icon rendering logic in MenuItem component

Updated the MenuItem component to improve how icons are rendered. Now, it checks if the icon is a valid React element or a function, ensuring better flexibility in icon usage. This change enhances the overall user experience in the mention menu.

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

* 🔧 chore: update @lobehub/editor to version 4.3.1 in package.json

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

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-03-19 21:48:10 +08:00
YuTengjing
4aadfd608b
🐛 fix: require valid action for referral backfill and add anti-abuse rule (#12958) 2026-03-14 01:48:07 +08:00
Coooolfan
8373135253
🐛 fix: prevent Enter key submission during IME composition in LoginStep (#12963)
* 🐛 fix: prevent Enter key submission during IME composition in LoginStep

* ♻️ refactor: extract useIMECompositionEvent hook for IME composition tracking

Made-with: Cursor

---------

Co-authored-by: Innei <tukon479@gmail.com>
2026-03-13 22:41:26 +08:00
Innei
4438b559e6
feat: add slash action tags, topic reference tool, and command bus system (#12860)
*  feat: add slash action tags in chat input

Made-with: Cursor

*  feat: enhance editor with new slash actions and localization updates

- Added new slash actions: change tone, condense, expand, polish, rewrite, summarize, and translate.
- Updated localization files for English and Chinese to include new action tags and slash commands.
- Removed deprecated useSlashItems component and integrated its functionality directly into InputEditor.

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

*  feat: add slash placement configuration to chat input components

- Introduced `slashPlacement` prop to `ChatInputProvider`, `StoreUpdater`, and `InputEditor` for customizable slash menu positioning.
- Updated initial state to include `slashPlacement` with default value 'top'.
- Adjusted `ChatInput` and `InputArea` components to utilize the new `slashPlacement` prop.

This enhancement allows for better control over the user interface in chat input interactions.

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

*  feat: implement command bus for slash action tags processing

Add command bus system to parse and execute slash commands (compact context,
new topic). Refactor action tag categories from ai/prompt to command/skill.
Add useEnabledSkills hook for dynamic skill registration.

* feat: compress command

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

* refactor: compress

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

* fix: skill inject

*  feat: slash action tags with context engine integration

Made-with: Cursor

*  feat: add topic reference builtin tool and server runtime

Made-with: Cursor

*  feat: add topic mention items and update ReferTopic integration

Made-with: Cursor

* 🐛 fix: preserve editorData through assistant-group edit flow and update RichTextMessage reactively

- EditState now forwards editorData from EditorModal to modifyMessageContent
- modifyMessageContent accepts and passes editorData to updateMessageContent
- RichTextMessage uses useEditor + effect to update document on content change instead of key-based remount
- Refactored RichTextMessage plugins to use shared createChatInputRichPlugins()

*  feat(context-engine): add metadata types and update processors/providers

Made-with: Cursor

*  feat(chat-input): add slash action tags and restore failed input state

* 🔧 chore: update package dependencies and enhance Vite configuration

- Changed @lobehub/ui dependency to a specific package URL.
- Added multiple SPA entry points and layout files to the Vite warmup configuration.
- Removed unused monorepo packages from sharedOptimizeDeps and added various dayjs locales for better localization support.

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

* 🔧 chore: update @lobehub/ui dependency to version 5.4.0 in package.json

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

* 🐛 fix: correct SkillsApiName.runSkill to activateSkill and update trimmed content assertions

* 🐛 fix: resolve type errors in context-engine tests and InputEditor slashPlacement

* 🐛 fix: update runSkill to activateSkill in conversationLifecycle test

* 🐛 fix: avoid regex backtracking in placeholder parser

*  feat(localization): add action tags and tooltips for slash commands across multiple languages

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

* 🐛 fix: preserve file attachments when /newTopic has no text content

* cleanup

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

---------

Signed-off-by: Innei <tukon479@gmail.com>
2026-03-13 22:17:36 +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
Arvin Xu
ee7ae5b1d2
🐛 fix: fix editor content missing when send error (#12205)
* fix editor issue

* add virtual block plugin

* snapshot case

* fix task Render issue
2026-02-09 01:25:25 +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
Arvin Xu
90ecaf6bc0
🐛 fix(input): revert #11755 to fix chat input unfocus (#11764)
Revert "🐛 fix(editor): prevent crash when toggling enableInputMarkdown setting (#11755)"

This reverts commit ea5eed8bcd.
2026-01-24 10:05:52 +08:00
Innei
ea5eed8bcd
🐛 fix(editor): prevent crash when toggling enableInputMarkdown setting (#11755)
Fix "Node TableNode has not been registered" error that occurred when
switching enableInputMarkdown from disabled to enabled.

Root cause: Lexical editor nodes must be registered at creation time.
When enableRichRender toggled, plugins tried to register nodes on an
existing editor instance, causing a crash.

Solution: Use key-based re-mounting with content preservation via ref.
- Outer component holds contentRef to persist content across re-mounts
- Inner component re-mounts when enableRichRender changes (via key)
- Content restored from ref on editor initialization
2026-01-24 00:11:53 +08:00
Innei
70daf1355d
🐛 fix: force plain text paste in ChatInput editor (#11414)
- 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
2026-01-11 17:01:59 +08:00
CanisMinor
5338170f4c
🐛 fix: fix edit rich render codeblock (#11303)
* fix: fix enableRichRender

* fix: fix enableRichRender
2026-01-07 13:45:14 +08:00
CanisMinor
eb86d3b11e
🐛 fix: fix editor modal when Markdown rendering off (#11251)
fix: fix editor modal
2026-01-05 18:04:50 +08:00
Shinji-Li
d102d47577
🐛 fix: slove input editor on pause emit (#11051)
fix: slove input editor on pause emit
2025-12-30 17:30:25 +08:00
canisminor1990
8d947ceefc feat: codemirror 2025-12-29 16:59:23 +08:00
Arvin Xu
bbf1c0bbe9
💄 style: improve lab style (#10040)
* update

* refactor lab

* Update package.json
2025-11-04 18:35:49 +08:00
Arvin Xu
af33543cba
💄 style: improve rich text link display (#9816)
* fix model runtime issue

* fix model runtime issue
2025-10-21 16:17:08 +08:00
lobehubbot
bc7aa88a8f 📝 docs(bot): Auto sync agents & plugin to readme 2025-10-16 14:28:33 +00:00
René Wang
03c28385e5
feat: support Group Chat, Mention, and Multi-Agent Orchestration with feature flag (#8976)
* feat: implement group chat functionality

* fix

* update

* revert pglite mock

* fix: Add missing test

* fix mention

* fix mention

* lint: Clear unused varibles

* fix: type check

* fix: Coverage

* build: Add missing test

* fix: add mention back

* fix: Add missing test

* fix: Add test for topic

* feat: Group chat fallback style

* fix: Revert unncessary files

* fix: circular deps

* feat: tool usage

* fix: Replace debug info

* feat: Update i18n

* opti: Better prompr

* fix claude

* feat: Filter model without function calling

* fix: DM reduction

* lint: Address build error

* fix: Test error

* feat: Store model info

* style: Clean up welcome messaeg

* feat: Use new welcome message

* fix: inbox not working

* fix: inbox not working

* fix: type error

* feat: Optimize prompt

* fix: Revert unintentional changes

* lint: Remove unused code

* fix: better test

* fix: Use debug

* refact: Move normalization postion

* opti: Better prompt

* opti: Better prompt

* opti: Better prompt

* lint: Clear console.log

* fix: Update test snap

* fix: test error

* fix: Unexpectly test fail

---------

Co-authored-by: arvinxx <arvinx@foxmail.com>
2025-10-16 22:16:40 +08:00
Arvin Xu
0a8c80dfd2
🐛 fix: fix duplicate tools id issue and fix link dialog issue (#9731)
* add

* baseline

*  test(store): add tests for discover store plugin and mcp slices

- Add comprehensive tests for discover/slices/plugin/action.ts (15 tests)
- Add comprehensive tests for discover/slices/mcp/action.ts (11 tests)
- Update test-coverage.md with new metrics and completed work
- Coverage: 74.24% overall (+26 tests, 2 new test files)
- Action files coverage: 29/40 tested (72.5%, +2 files)

Features tested:
- Plugin/MCP categories, detail, identifiers, and list fetching
- SWR key generation with locale and parameters
- SWR configuration verification
- Service integration with discoverService

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* 📝 docs(testing): add SWR hooks testing guide and subagent workflow

Testing Guide Updates:
- Add comprehensive SWR hooks testing section with examples
- Document key differences from regular action tests
- Add examples for testing SWR key generation and configuration
- Add examples for testing conditional fetching
- Update references to include SWR hook test examples

Test Coverage Guide Updates:
- Add detailed subagent workflow for parallel testing
- Document when and how to use subagents for testing
- Add complete workflow example using subagents
- Add benefits and best practices for subagent usage
- Clarify that subagents should NOT commit or update docs
- Add step-by-step guide for launching parallel subagents

Key improvements:
- Better documentation for testing SWR-based store actions
- Clear workflow for efficient parallel testing using subagents
- Single atomic commit strategy after all subagents complete
- Improved testing efficiency and organization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* ♻️ refactor(test): fix SWR mock strategy to properly test fetcher

Previously, tests were hardcoding return values instead of calling
the fetcher function. This bypassed the actual service call logic.

Changes:
- Fix useSWR mock to call fetcher and return its Promise
- Update assertions to await Promise results
- Update testing guide with correct mock pattern
- Add explanation of why this approach is correct

Before (incorrect):
```typescript
useSWRMock.mockImplementation(((key, fetcher) => {
  fetcher?.(); // Call but ignore result
  return { data: mockData }; // Hardcoded
}) as any);
expect(result.current.data).toEqual(mockData);
```

After (correct):
```typescript
useSWRMock.mockImplementation(((key, fetcher) => {
  const data = fetcher?.(); // Get Promise from fetcher
  return { data }; // Return Promise
}) as any);
const resolvedData = await result.current.data;
expect(resolvedData).toEqual(mockData);
```

Benefits:
-  Actually tests the fetcher function
-  Mirrors real SWR behavior (data is Promise)
-  Service calls are properly verified
-  Tests are more accurate and maintainable

Updated files:
- .cursor/rules/testing-guide/zustand-store-action-test.mdc
- src/store/discover/slices/plugin/action.test.ts
- src/store/discover/slices/mcp/action.test.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* 🐛 fix(test): correct SWR mock strategy to match project standards

- Remove useSWR mocking, use real SWR implementation instead
- Only mock service methods (fetchers) with vi.spyOn
- Use waitFor for async assertions
- Update testing guide with correct SWR pattern
- Add reference to src/store/chat/slices/message/action.test.ts

This fixes the incorrect mocking approach from previous commits.
All 13 tests pass with the corrected strategy.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

*  test(store): add comprehensive tests for high priority action files

- Add mcpStore action tests (41 tests, 624 LOC covered)
  - MCP plugin installation flow (normal, resume, dependencies, config)
  - Connection testing (HTTP and STDIO)
  - Plugin lifecycle management
  - Error handling and cancellation flows

- Add fileManager action tests (35 tests, 205 LOC covered)
  - File upload and processing workflows
  - Chunk embedding and parsing
  - File list management and refresh
  - SWR data fetching

Testing approach:
- Used parallel subagents for efficient development
- Followed zustand testing patterns from guide
- Proper test layering and per-test mocking
- All tests pass type-check and lint

Coverage improvement: 74.24% → ~76% (+76 tests, 2 files)
Action files: 29/40 → 31/40 tested (77.5%)

🏆 Milestone: All high priority files (>200 LOC) now have tests!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

*  test(store): complete 100% action file coverage with 160 new tests

Added comprehensive tests for all remaining 9 medium-priority action files:

Discovery Store (33 tests):
- assistant/action.ts: 10 tests (SWR hooks, categories, detail, identifiers, list)
- provider/action.ts: 11 tests (SWR hooks, detail with readme, identifiers, list with filters)
- model/action.ts: 12 tests (SWR hooks, categories, detail, identifiers, list with params)

Knowledge Base Store (29 tests):
- crud/action.ts: 19 tests (create, update, remove, refresh, loading states, SWR hooks)
- content/action.ts: 10 tests (add files, remove files, error handling)

File Store (36 tests):
- upload/action.ts: 18 tests (base64 upload, file upload with progress, type detection, KB integration)
- chunk/action.ts: 18 tests (drawer management, highlight, semantic search)

AI Infrastructure Store (23 tests):
- aiModel/action.ts: 23 tests (CRUD, batch operations, remote sync, toggle enabled, SWR hooks)

Chat Store (39 tests):
- thread/action.ts: 39 tests (CRUD, messaging, AI title generation, validation, loading states)

Testing approach:
- Used 9 parallel subagents for efficient development
- Followed zustand testing patterns from guide
- SWR hook testing for discovery slices
- Complex async flows with proper error handling
- File operations with progress callbacks
- Semantic search and RAG integration

Coverage improvement: ~76% → ~80% (+160 tests, 9 files)
Action files: 31/40 → 40/40 tested (100%)

🎉 MILESTONE: All 40 action files now have comprehensive test coverage!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix test

* fix test

* fix context-engine

* add tests

* remove

* remove tools bar

* pin bun version

* fix

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-15 22:38:53 +08:00
Arvin Xu
2518d7eabf
🐛 fix: fix input cannot send markdown (#9674)
* fix claude json output

* refactor to remove langchain in file-loaders

* support deepseek tools calling

* use peer

* use peer

* move files

* fix test

* add local-system placeholder

* fix markdown editing

* fix markdown editing

* refactor doc parse
2025-10-12 16:11:02 +08:00
Arvin Xu
9349ce2d2f
🐛 fix: disable rich text in markdown editor (#9637)
* clean

* update

* add labs

* fix

* improve

* update

* fix

* hide lab

* improve workflow
2025-10-11 15:59:56 +08:00
CanisMinor
5e814e017d
feat: ChatInput support resize (#9215)
*  feat: ChatInput support resize

* 💄 style: Update resizeMaxHeightOffset

* 💄 style: Update ChatInput and fix some issues

* 📝 docs: Fix i18n
2025-09-12 14:45:06 +08:00
CanisMinor
e3728750af
💄 style: Add hotkey tooltip to typobar actions (#9203)
* 💄 style: Add hotkey tooltip to typobar actions

* 💄 style: Udpate input style

* 💄 style: Add toggleExpandInputActionbar to GlobalStore
2025-09-10 21:15:57 +08:00
CanisMinor
8be822b0b7
🐛 fix: Fix editor key handling (#9189)
* 🐛 fix: Fix editor send key handling

* 🐛 fix: Fix editor key handle
2025-09-09 23:12:02 +08:00
CanisMinor
9e0621f873
feat: Add Math and TaskList to Editor (#9165)
*  feat: Add Math and TaskList to Editor

* 🔧 chore: Update editor version

* 🐛 fix: Fix code plugin
2025-09-08 19:35:32 +08:00
CanisMinor
38d9d98b97
feat: ChatInput support rich text and support parallel send (#8964)
*  feat: Add LobeEditor

* fix tests

* fix mobile

---------

Co-authored-by: arvinxx <arvinx@foxmail.com>
2025-09-06 09:51:52 +08:00