Commit graph

787 commits

Author SHA1 Message Date
Zero Liu
2c25e1ba9d Fix Claude Code response content ordering
Preserve the temporal order of text and tool calls in Claude Code mode.
Previously, all text was concatenated together and shown before all tool
cards, losing the interleaving of the original response stream.

Now uses an ordered contentSegments array to track content in arrival
order, ensuring text after tool calls displays below the tool cards.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 15:37:55 -08:00
Zero Liu
3b0651b0bc Fix image context 2026-01-10 15:23:39 -08:00
Zero Liu
0783194534 Pass context to claude code 2026-01-10 15:02:27 -08:00
Zero Liu
842b3be156 Add claude code support 2026-01-10 02:19:43 -08:00
Logan Yang
ccbe039a86
Fix search v3 ranking (#2101)
* Replace FlexSearch with MiniSearch for improved search functionality and scoring

* Enhance QueryExpander and README for improved recall and ranking clarity

- Update QueryExpander to clearly separate salient and expanded terms for recall and ranking.
- Modify README to reflect changes in the search system's architecture and clarify the distinction between recall and ranking processes.
- Adjust FullTextEngine comments to emphasize BM25's native multi-term scoring capabilities.

* Implement weighted query expansion in FullTextEngine with 90/10 scoring for salient and expanded terms
2026-01-09 22:30:30 -08:00
Logan Yang
13523c9fc1
3.1.4 (#2074) 2025-12-15 22:00:08 -08:00
Logan Yang
ddbfc5621d
Bring back toggle for inline citation (#2073) 2025-12-15 21:48:09 -08:00
Logan Yang
214627c64c
Fix background tool handling to prevent orphaned spinners in agent conversation (#2072) 2025-12-15 21:28:20 -08:00
Logan Yang
60b380117d
Clean up dead code and update readme for privacy disclosure (#2071) 2025-12-15 20:50:46 -08:00
Logan Yang
959ddf4fae
Enhance error handling in BaseChainRunner with detailed user guidance and authentication checks (#2070) 2025-12-15 20:04:39 -08:00
Wenzheng Jiang
2d453d318d
Add path to variable_note format and reorder elements (#2049)
Added <path> tag to variable_note XML format for {activeNote} and other variable types. Reordered format so path comes before title heading to match note_context structure. Updated all test expectations to reflect the new format.

This change ensures the LLM receives file path information when processing variable notes, enabling better context understanding and file reference capabilities. The consistent format with note_context also improves maintainability.
2025-12-15 19:16:49 -08:00
Zero Liu
3f6f241142
Improve relevant note search algorithm (#2052) 2025-12-15 19:16:00 -08:00
Logan Yang
1d668d3367
Deprecate IntentAnalyzer (#2069)
* Deprecate IntentAnalyzer and replace with model-based tool planning in CopilotPlusChainRunner
* Refine planning prompt to enforce XML-only responses and remove note extraction logic
2025-12-15 19:15:44 -08:00
Logan Yang
71bf510acb
Improve new user onboarding by removing notice on missing api key (#2063) 2025-12-11 13:44:21 -08:00
Logan Yang
e05e3fafef
Revert "Improve onboarding by removing the popups for no api key and moving it to chat response (#2015)" (#2038)
This reverts commit 8b32f6f919.
2025-11-21 08:10:08 -08:00
Logan Yang
88feebf486
3.1.3 (#2025) 2025-11-11 17:07:35 -08:00
Logan Yang
6b48e1cac7
Do not show thinking if reasoning is not checked (#2024)
* Do not show thinking if reasoning is not checked

* Fix test
2025-11-11 16:35:21 -08:00
Logan Yang
fec98a7107
Enable agent by default (#2023)
* Enable agent by default

* Update gemini model adapter to fight hallucination
2025-11-11 13:49:26 -08:00
Logan Yang
ff278c4d3e
Add auto selection to context setting (#2018)
* Add setting for auto text selection inclusion and add back manual command

* Group chat save settings

* Update constants
2025-11-09 19:56:07 -08:00
Logan Yang
72f34463c2
Implement auto context inclusion on text selection (#2017)
* Implement auto context inclusion on text selection

* Add text selection badge to posted user message
2025-11-09 15:41:53 -08:00
Logan Yang
bfa14bf1a8
Fix thinking model verification (#2016) 2025-11-09 13:17:08 -08:00
Logan Yang
8b32f6f919
Improve onboarding by removing the popups for no api key and moving it to chat response (#2015) 2025-11-09 00:35:40 -08:00
Logan Yang
0eab7c9656
Update log file (#2014) 2025-11-08 23:02:55 -08:00
Logan Yang
155bd42a78
Fix bedrock model image support (#2012) 2025-11-08 18:49:35 -08:00
Logan Yang
b1a1c539b3
Update bedrock model support (#2011) 2025-11-08 17:22:36 -08:00
Zero Liu
820947cac8
Multiple UX improvement (#2010)
* Close typeahead menu if start with space

* fix dnd with dot filename

* Add model select max height
2025-11-07 12:03:39 -08:00
Wenzheng Jiang
c6608f3a40
Enhance writeToFile tool with confirmation option (#2002)
- Added an optional `confirmation` parameter to the `writeToFile` tool, allowing users to skip the preview UI and apply changes directly to the file.
- Updated the tool's schema to include the new parameter, with a default value of true for confirmation.
- Enhanced the handler logic to manage file writing based on the user's confirmation choice, improving flexibility in file operations.
2025-11-07 12:02:27 -08:00
Logan Yang
5303a6aa9f
Add anthropic version required field for bedrock (#2008) 2025-11-05 14:47:05 -08:00
Viktor Vedmich
c44131b926
feat: Add AWS Bedrock cross-region inference profile guidance (#2007)
Improves AWS Bedrock support by adding user guidance for cross-region
inference profiles, addressing issue #2006.

Changes:
- ModelAddDialog: Add helper text and example for Bedrock inference profiles
- ModelEditDialog: Update region field description with shorter text
- CLAUDE.md: Add AWS Bedrock usage documentation with examples

Users are now guided to use cross-region inference profile IDs
(global., us., eu., apac. prefixes) instead of regional model IDs,
which significantly improves reliability and availability.

Fixes: logancyang/obsidian-copilot#2006

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-05 14:41:24 -08:00
Zero Liu
8c1a77178e
Fix template note processing (#2001) 2025-11-04 12:23:08 -08:00
Logan Yang
ba4eba5dcf
3.1.2 (#1998) 2025-10-31 18:35:23 -07:00
Logan Yang
1cd87d75f3
Fix guidance (#1997)
* refactor: Simplify local search guidance handling in AutonomousAgentChainRunner and CopilotPlusChainRunner

- Removed the `appendInlineCitationReminder` function and adjusted the logic in `AutonomousAgentChainRunner` to directly manage local search guidance.
- Updated `CopilotPlusChainRunner` to retain and utilize the most recent local search guidance, ensuring it is positioned correctly adjacent to user queries.
- Modified `buildLocalSearchInnerContent` to accept introductory text instead of guidance, enhancing clarity in the payload structure.
- Removed related tests for the deprecated `appendInlineCitationReminder` function, streamlining the codebase.

* refactor: Enhance localSearch payload structure and guidance handling

- Made localSearch payload self-contained by embedding RAG instructions, documents, and citation guidance directly within the `<localSearch>` block.
- Updated AutonomousAgentChainRunner and CopilotPlusChainRunner to ensure each localSearch call carries its own guidance block, improving citation accuracy in multi-search scenarios.
- Introduced a new utility function to insert guidance before the user query label, ensuring clarity in the payload structure.
- Adjusted related tests to validate the new guidance handling logic.

* docs: Add deprecation guide for IntentAnalyzer and Broca

- Created a comprehensive document outlining the responsibilities of the `IntentAnalyzer` and Broca API within the Copilot Plus intent analysis flow.
- Detailed the current functionalities, known consumers, migration constraints, and a phased migration plan to ensure feature parity and smooth transition.
- Highlighted risks and mitigation strategies associated with the deprecation process, along with open questions for further consideration.

* fix: Prevent infinite rolling animation in ToolCallBanner when result is present

Add defensive check that stops animation when tool result exists, even if isExecuting flag wasn't updated. This fixes race conditions where marker updates fail or are delayed during streaming.

🤖 Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Happy <yesreply@happy.engineering>
2025-10-31 18:25:41 -07:00
Logan Yang
16c42fcf2f
feat: Add function to escape tasks code blocks in ChatSingleMessage component (#1996)
- Introduced `escapeTasksCodeBlocks` to convert ```tasks to ```text, preventing execution in AI responses and ensuring static display of task queries.
- Updated processing logic to utilize the new function, enhancing content safety and display consistency.
2025-10-31 14:02:21 -07:00
Logan Yang
afb41c9179
Support embedded note (#1995)
* Update bug report template to enhance clarity and requirements

- Changed the required checklist item from a screenshot to a log file generated via the "Copilot: Create Log File" command.
- Made the screenshot of the note and Copilot chat pane optional.
- Clarified the statement regarding bug report requirements for better understanding.

* feat: Implement embedded note processing in ContextProcessor

- Added support for processing embedded notes within markdown content, allowing for structured `<embedded_note>` blocks.
- Introduced new methods for building and formatting embedded note blocks, including error handling for missing notes.
- Enhanced logging to replace console statements with appropriate logging functions for better error tracking.
- Updated the `buildMarkdownContextContent` method to streamline content processing for markdown files.
- Added a new constant `EMBEDDED_NOTE_TAG` to manage embedded note structures.
2025-10-31 13:45:11 -07:00
Logan Yang
4a1debb441
Enhance ChatPersistenceManager to properly escape modelKey in YAML frontmatter (#1994)
- Introduced a new utility function `escapeYamlString` to handle escaping of special characters in modelKey values, ensuring valid YAML formatting.
- Updated the `modelKey` assignment in the generated note content to use the new escaping function.
- Added comprehensive tests to verify correct escaping for various special characters, including quotes, backslashes, and pipes, ensuring data integrity during save-load operations.
2025-10-31 12:08:42 -07:00
Logan Yang
bf7d84b021
Fix HyDE model (#1992)
* feat: Implement model validation and resolution for temperature overrides in ChatModelManager

- Added a new private method `isModelConfigValid` to validate model configurations against API key and entitlement requirements.
- Introduced `resolveModelForTemperatureOverride` to determine the active chat model, ensuring fallback to valid models while respecting user entitlements.
- Updated `getChatModelWithTemperature` to utilize the new model resolution logic for temperature overrides.
- Enhanced error handling for cases where no valid model is found.

* refactor: Remove deprecated chat models from BUILTIN_CHAT_MODELS constant

* feat: Add GROK_4_FAST model to BUILTIN_CHAT_MODELS constant

- Introduced a new chat model, GROK_4_FAST, with capabilities for vision and enabled status, enhancing the available options for users.
2025-10-31 10:33:11 -07:00
Logan Yang
c4027fa7a4
Update Corpus-in-Context and web search tool guide (#1988)
* Make inline citation permanent and add image guide for local search

- Removed the `enableInlineCitations` setting from the configuration and related components to simplify citation management.
- Updated citation functions to operate without the setting, ensuring consistent behavior across the codebase.
- Adjusted tests and documentation to reflect the removal of inline citation handling logic.
- Enhanced the `renderCiCMessage` and `processInlineCitations` functions for improved clarity and functionality.

* fix: Update web search tool description for clarity

- Revised the description of the `webSearch` tool to specify that it searches the internet for information only when explicitly requested by the user.
- Enhanced the instructions for using the `webSearch` tool to clarify when it should be utilized, ensuring users understand the intent required for web searches.
- Reintroduced the `createGetTagListTool` import to maintain functionality in the `builtinTools` module.

* fix: Enhance response handling in AgentPrompt integration tests

- Updated the response processing logic in the AgentPrompt integration tests to ensure that `fullResponse` is always a string, accommodating multimodal and array content.
- Implemented a function to extract text parts from arrays and handle various content types, improving the robustness of the tests.

* Remove websearch related prompt from modelAdapter

* fix: Update time query instructions in builtinTools

- Added detailed instructions for handling time queries, including the conversion of city or timezone names to UTC offsets.
- Clarified when to use the timezoneOffset parameter and emphasized the need for user clarification if the offset cannot be determined.
2025-10-31 10:06:18 -07:00
Yizong ZHOU
46d8aba8b2
Reduce images size in half in README without losing quality (#1966) 2025-10-30 16:58:32 -07:00
Logan Yang
bf9d2eca7c
fix: Add delay before emitting chat visibility to ensure React component readiness (#1987)
- Introduced a small delay using setTimeout to ensure the React component is fully ready to receive focus events when the chat window is opened. This change addresses potential timing issues with the focus event handling.
2025-10-30 16:02:10 -07:00
Logan Yang
81c15eae21
fix: Focus to chat input on opening chat window command (#1986)
- Introduced a wrapper function `handleFocusRegistration` to properly set the focus function state, avoiding issues with React's updater function interpretation.
- Updated the `FocusPlugin` to utilize the new focus registration method for better clarity and functionality.
2025-10-30 13:43:31 -07:00
QiyuanChen
856ca91b29
feat: Add SiliconFlow support for chat and embedding models (#1979) 2025-10-29 23:02:12 -07:00
Logan Yang
42b078075c
refactor: Simplify log file initialization and clear log on new chat (#1982)
- Updated `ensureInitialized` method in `LogFileManager` to start with an empty buffer, removing unnecessary file reading logic.
- Integrated log clearing functionality in `handleNewChat` to ensure a fresh start for each chat session.
2025-10-29 18:48:45 -07:00
Emt-lin
f62cb918da
feat: Add configurable send shortcut for chat messages. (#1968)
* feat: Add configurable send shortcut for chat messages.

* fix: Exclude opposite platform modifier in CMD_ENTER shortcut validation.

* refactor: Limit send shortcuts to ENTER and SHIFT_ENTER only.
2025-10-28 19:30:07 -07:00
Logan Yang
1a6f9c842b
Fix thinking block duplication text for openrouter thinking models (#1977)
* Fix thinking block duplication text for openrouter thinking models

* Update claude method name for thinking streamer
2025-10-28 19:16:48 -07:00
Logan Yang
e7d7d7f7f9
Update ChatPersistenceManager to enforce filename byte limit and handle ENAMETOOLONG errors (#1976)
- Changed the safe filename byte limit from 200 to 100 bytes to ensure compliance with filesystem constraints.
- Implemented fallback logic for filenames when encountering ENAMETOOLONG errors, allowing for minimal filenames with project prefixes.
- Added tests to verify the new fallback behavior and ensure proper handling of filenames with Cyrillic and mixed Unicode text.
- Enhanced error handling to update existing files when conflicts arise during save operations.
2025-10-28 18:12:53 -07:00
Logan Yang
d3a576beee
Enhance DBOperations with integrity check yielding (#1975)
- Introduced `INTEGRITY_CHECK_YIELD_INTERVAL` to improve the performance of the integrity check process by yielding control to the event loop at specified intervals, preventing UI freezing during long-running checks.
- Refactored the loop for checking file embeddings to utilize an index-based approach, allowing for periodic yielding.
- Added a new private method `yieldToEventLoop` to handle yielding control, ensuring a responsive user interface during operations that may take significant time.
- Updated documentation to include a description of the new yielding mechanism for better clarity on its purpose and functionality.
2025-10-28 17:35:48 -07:00
Logan Yang
ed884298ba
Integrate ProjectChainRunner and ChatManager with new layered context (#1973)
* Integrate ProjectChainRunner and ChatManager with new layered context

- Introduced `ProjectChainRunner` to automatically include project context in L1 via `ChatManager.getSystemPromptForMessage()`, simplifying the class structure by inheriting behavior from `CopilotPlusChainRunner`.
- Updated `ChatManager` to build system prompts that append project context when in project mode, ensuring seamless integration without special-case logic.
- Implemented null guards for project context to prevent erroneous output when context is unavailable.
- Refactored documentation to reflect changes in context handling and the new project chain runner functionality.

* Enhance ChatManager tests with project context mocks

- Added mocks for project context retrieval and system prompt settings in `ChatManager.test.ts` to facilitate testing without relying on actual project data.
- Improved test coverage for context-related functionalities by simulating project context and system prompt retrieval, ensuring robust testing of the ChatManager's behavior in various scenarios.
2025-10-28 17:08:37 -07:00
Logan Yang
05beb941eb
Context revamp (#1971)
* Implement context engine for a layered context

* Wire in new context library to LLM chain

- Updated the context engine to maintain a cumulative library of all context items (L2) without deduplication, enhancing cache stability.
- Introduced smart referencing in the user message (L3) to reference existing items in L2 by ID and include full content for new items.
- Improved the LayerToMessagesConverter to format and handle layered context envelopes for better debugging and clarity.
- Fixed critical bugs related to context deduplication that previously broke cache stability.
- Enhanced tests to validate the new context handling and ensure proper functionality across various scenarios.

* Enhance VaultQAChainRunner with tag extraction and inline citation detection

- Integrated tag extraction from user queries to improve context-aware retrieval.
- Implemented `hasInlineCitations` function to detect inline citation markers in responses.
- Updated message construction logic to utilize envelope-based context, enhancing the quality of AI interactions.
- Added comprehensive tests for the new inline citation detection functionality, ensuring robustness and accuracy.
- Improved logging for better debugging and traceability of the message processing flow.

Refactor VaultQAChainRunner to enhance context handling and citation instructions

- Integrated LayerToMessagesConverter for improved message construction, ensuring smart referencing and context preservation.
- Updated logging to reflect the use of the new converter in envelope-based context construction.
- Revised comments for clarity on context preparation and citation instructions.
- Minor adjustment in citation utility to improve regex handling for citation updates.

* Complete migration to envelope-based context in CopilotPlus and LLM chain runners

- Removed all legacy fallback paths, ensuring that context envelopes are now mandatory for operations in CopilotPlusChainRunner and LLMChainRunner.
- Enhanced image extraction to only pull from the active note, preventing unintended leaks from attached context notes.
- Fixed critical issues with context-in-context (CiC) formatting and added early envelope guards in VaultQAChainRunner to prevent silent failures.
- Updated message construction logic to utilize LayerToMessagesConverter for improved smart referencing and context preservation.
- Comprehensive tests added to validate the new envelope-based context handling and ensure robustness across all chain runners.

* Integrate Plus chain with context envelope

* Enhance AutonomousAgentChainRunner with envelope-based context integration

- Introduced `LayerToMessagesConverter` for improved message construction, ensuring system and user messages are derived from the context envelope.
- Implemented envelope validation to ensure context is available before processing.
- Updated message preparation logic to maintain consistency with the envelope-first architecture, preserving tool execution and multimodal support.
- Added comprehensive logging for envelope-based context construction to aid debugging.
- Documented changes in the context engineering documentation to reflect the new integration and design points.

* Support loading saved chat context to L2 context library

* Fix ChatPersistenceManager tests for context handling
2025-10-27 23:28:36 -07:00
Zero Liu
2480a0e42a
Support drag-n-drop files from file navbar (#1964)
* Support drag-n-drop from navbar

* Improve drop overlay

* Support multiple file

* Add canvas support

* Click badge to open file
2025-10-27 23:09:43 -07:00
Wenzheng Jiang
db97a8ace3
Prompt Improvement: Use getFileTree to explore ambiguous notes and folders (#1962)
* Prompt Improvement: Use getFileTree to explore ambiguous notes and folders.

* MInor

* fix: Clarify instructions for using getFileTree in note retrieval process
2025-10-26 13:46:34 -07:00