* Migrate from sharedState to new chat message system
- Replaced SharedState with a new ChatManager and ChatUIState architecture to streamline message processing and UI integration.
- Updated message imports to utilize the new types from "@/types/message".
- Introduced unique message IDs for better tracking and management.
- Enhanced the Chat component to support pending messages and improved message deletion logic.
- Removed deprecated shared state references and cleaned up related code for clarity and maintainability.
Enhance message management architecture and context processing
- Introduced a new MessageRepository for single source of truth in message storage, eliminating dual-array synchronization.
- Updated ChatManager to coordinate message operations and context processing, ensuring fresh context during edits.
- Refactored ChatUIState for clean UI state management, delegating business logic to ChatManager.
- Added comprehensive testing for message handling and context processing to prevent bugs and ensure reliability.
- Removed legacy SharedState references and improved overall architecture for clarity and maintainability.
Update claude.md
Remove conditional project tag from chat content rendering in Chat component
Ensure project chat isolation
- Introduced a method to retrieve the current project ID in ProjectManager.
- Enhanced ChatManager to manage multiple project-specific message repositories, allowing for dynamic switching based on the current project.
- Implemented logic to load existing messages from the ProjectManager's cache when creating new message repositories.
- Updated message handling methods in ChatManager to utilize the current project's message repository, ensuring context consistency across project switches.
* Fix message isolation between projects and non-project
- Introduced ChatManager and ChatUIState to streamline message processing and UI updates.
- Removed legacy message caching from ProjectManager, delegating message persistence to ChatManager.
- Updated CopilotView and Chat components to utilize the new architecture, enhancing message loading and project switching.
- Cleaned up deprecated code related to pending messages and shared state for improved maintainability.
* Implement a new chat persistence module
- Introduced ChatPersistenceManager to handle saving and loading chat history in markdown format, ensuring project-aware file naming.
- Updated ChatManager to utilize the new persistence functionality, streamlining message loading and saving processes.
- Refactored ChatUIState to support asynchronous loading and saving of messages, improving UI responsiveness.
- Added comprehensive tests for ChatPersistenceManager to ensure reliability in chat content formatting and parsing.
- Updated architecture documentation to reflect the new message management structure and flow.
* Update message management architecture doc
- Removed detailed architecture diagrams from CLAUDE.md and linked to MESSAGE_ARCHITECTURE.md for clarity.
- Updated MESSAGE_ARCHITECTURE.md to include project isolation features, enhancing the message management system.
- Improved documentation on message flow and project-specific repositories, ensuring seamless context switching.
- Streamlined the explanation of core classes and their interactions within the new architecture.
* Fix test
* Use llm message for commands to ensure context access
* Update docs
* Auto add frontmatter when adding or renaming custom prompt files
* Make custom command enable slash and right click command by default
* Make add command button open the command edit dialog
* More improvements
* Fix test
* Fix cursor reported errors
* Add 'create new custom command' command back
* Fix rename race condition
* Fix more cursor errors
* Fix race conditions
- Added `isAllowedFileForContext` utility function to check if a file is of allowed types (markdown, PDF, or canvas).
- Updated `ChatInput` to use this function for setting the current active note.
- Refactored `BaseNoteModal` to utilize the new utility for filtering files and managing the active note state.
* feat(chat): Implement autosave for chat after messages and responses
Adds autosave functionality to the chat component, saving the chat after every user message and AI response if the autosave setting is enabled. Updates the autosave chat setting description for clarity.
* fix(chat): Use sharedState for visible messages in Chat
Updated the Chat component to filter visible messages using sharedState.getMessages() instead of chatHistory, ensuring the latest messages are used. Also removed a redundant notice when updating an existing note.
* fix(chat): Make autosave non-blocking
The handleSaveAsNote function is now called without await in autosaveChat blocks.
---------
Co-authored-by: Logan Yang <logancyang@gmail.com>
Pressing Escape while editing a message now cancels the edit and restores the original message. Also removed onBlur save behavior to prevent accidental saves when focus is lost.
- Added unit tests for slash command detection and replacement logic.
- Enhanced ChatInput component to show a modal for slash commands and replace the slash with the corresponding command content.
- Updated showCustomPromptModal to handle cursor position and current input value for better user experience.
- Updated GEMINI_PRO and GEMINI_FLASH constants to their stable versions.
- Added new OpenRouter models: OPENROUTER_GEMINI_2_5_FLASH, OPENROUTER_GEMINI_2_5_PRO, and OPENROUTER_GEMINI_2_5_FLASH_LITE.
- Enhanced ChatModelManager with default headers for API requests.
- Updated `brace-expansion` to versions 2.0.2 and 1.1.12 in package-lock.json.
- Refactored `AddProjectModal` to improve context labeling and descriptions.
- Enhanced `ContextManageModal` with tooltips and improved file context handling.
- Cleaned up imports and organized component structure in `context-manage-modal.tsx`.
- Fixed duplicate description rendering in `form-field.tsx`.
- Prevent suggestions for incomplete Obsidian wiki links.
- Allow native note completion to manage links in progress.
- Introduce checks for complete words with no significant completions to avoid unnecessary suggestions.
* feat: Add abort stream functionality to chat component and event handling
- Introduced ABORT_STREAM event in constants.
- Implemented event listener in Chat component to handle abort stream events.
- Updated CopilotPlugin to dispatch abort event before clearing chat history.
* Enhance chat with message restructuring for abort signal
* Remove .claude/settings.local.json from tracking
* Enhance abort handling in chain runners
- Added a manual test checklist section to CLAUDE.md for better QA processes.
- Improved abort handling in chain runners to ensure proper message management and logging.
- Updated the Chat component to retain the partial AI message during abort scenarios.
* Add todos for deprecated chain-related functionality and improve logging
- Marked several chain-related files and functions as deprecated due to the transition to direct chat model calls.
- Added TODO comments to indicate the need for future removal after verifying no dependencies remain.
- Enhanced logging by replacing console.error and console.warn with logError and logWarn for better error handling in chain runners.