* 🐛 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>
* ✨ 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>
* ♻️ 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>
* ♻️ 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>
* 🐛 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>
* ♻️ 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
* ✨ 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>
* 🐛 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
* ✨ 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>
* 🐛 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>
* ✨ 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>
* 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>
* 🔧 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
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
- 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
* 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>