Commit graph

43 commits

Author SHA1 Message Date
Andrew Beal
0d21c1e3e0 Implement local model support. 2026-07-04 12:16:08 +01:00
Andrew Beal
9cf8f1dbd7 refactor: move replaceCopy helper to Helpers module and add tag merge utilities
Move replaceCopy function from Copy enum to Helpers module to improve
separation of concerns. Add splitFrontmatter and mergeTagsIntoFrontmatter
utilities for YAML frontmatter manipulation. Remove unused Beautify prompt
and QuickActionsService. Add timeout support to Semaphore.wait(). Remove
unused Event.QuickActionsSettingsChanged. Update all imports across AI
classes, prompts, services, and tests.
2026-05-29 22:01:02 +01:00
Andrew Beal
5fc1cfba60 refactor: optimize settings change notifications and cleanup subscriptions
Remove unused dispose method and settings subscription from BaseAIClass. Update SettingsService to track which settings changed and notify subscribers with specific changed keys. Components now only react to relevant setting changes. Export RegisterAiProvider and call it when AI provider settings change to ensure provider is re-registered with new configuration.
2026-05-26 18:51:08 +01:00
Andrew Beal
3fec768488 refactor: improve subscription cleanup with token-based pattern
Replace object-based subscription tracking with token-based system to prevent memory leaks. Add dispose() method to BaseAIClass and ensure all components properly unsubscribe in onDestroy. Update SettingsService.subscribeToSettingsChanged to return subscription token instead of requiring subscriber object parameter.
2026-05-25 18:22:07 +01:00
Andrew Beal
aed4caf347 refactor: replace custom markdown pipeline with Obsidian's native MarkdownRenderer.
Fix reactive issue for web and chat mode display.

Rewrites StreamingMarkdownService to use Obsidian's built-in MarkdownRenderer
instead of the unified/remark/rehype/KaTeX stack, eliminating ~700 lines of
custom markdown processing, CSS, and streaming state management. Internal link
handling now relies on Obsidian's native .internal-link class and data-href
attributes. The streaming split-point algorithm (freeze completed blocks, re-render
the live tail) is preserved.
2026-05-25 16:25:22 +01:00
Andrew Beal
8823e3cf23 refactor: convert ChatMode enum to string literals and improve state management
- Change ChatMode enum values from numeric (0,1,2) to string literals ("read_only", "edit", "planning")
- Move chat mode state management from ChatWindow to SettingsService with persistence
- Add chat mode awareness to system prompts and tool validation
- Replace Map with WeakMap for settings subscribers to prevent memory leaks
- Add type-safe event handlers to EventService
- Update esbuild and TypeScript targets from ES2018/ES2020 to ES2022
- Add requiresEditModeEnabled() validation to prevent tool hallucination in read-only mode
- Update all test fixtures to include chatMode in mock settings
2026-05-05 20:54:34 +01:00
Andrew Beal
9ca4f6f4f8 feat: add mobile drawer auto-hide when keyboard is active
Implement optional drawer element hiding on mobile devices when the chat input is focused, providing more screen space for the on-screen keyboard. Elements smoothly animate away on focus and restore on blur. Includes new setting in Advanced Settings section and updates Anthropic SDK to 0.91.1.
2026-04-25 21:13:59 +01:00
Andrew Beal
1402456660 refactor: simplify event handlers and adjust grid layout spacing
Simplify onClick handlers by removing unnecessary arrow functions and add extra auto row to grid template for improved layout flexibility
2026-04-23 17:12:06 +01:00
Andrew Beal
e542134b9f feat: implement file attachment button functionality
Add handleAttachments function to create file input dialog and process
selected files through inputService. Wire up attachment button click
handler and update aria-label to use Copy.ButtonAttachFiles enum value.
2026-04-19 21:01:24 +01:00
Andrew Beal
82e58b52e7 refactor: replace edit/planning mode toggles with unified chat mode selector
Replace separate editModeActive and planningModeActive boolean flags with a single ChatMode enum (ReadOnly, Edit, Planning). Add ChatModeSelector component for mode switching. Update all components to use chatMode instead of individual flags. Refactor MainAgent and ChatService to accept ChatMode parameter. Remove edit-mode styling variants throughout UI components. Update system prompt to document user reference system. Consolidate input button styling with shared input-button-highlight class.
2026-04-19 20:39:04 +01:00
Andrew Beal
ac1dcf7f83 feat: add toggleable web search with UI control and provider-specific implementations
Implement web search toggle functionality across all AI providers (Claude, Gemini, Mistral, OpenAI) with conditional tool inclusion based on settings. Add globe button to chat input for toggling web search on/off. Change formatBinaryFiles visibility from public to protected in BaseAIClass and IAIClass interface. Extract tool configuration into private getTools() methods for each provider. Update tests to verify web search toggle behavior and formatBinaryFiles access level changes.
2026-04-10 10:47:23 +01:00
Andrew Beal
5f63f7c744 feat: add stacked layout for chat input when content wraps
Add dynamic layout switching that moves input buttons below the text
area when content height exceeds initial height. Includes height
tracking, state management via checkStacked(), and CSS grid updates
for stacked mode on desktop only.
2026-03-22 20:07:26 +00:00
Andrew Beal
167f67c3a6 refactor: rename userInstructionActive to userInstructionAreaActive
Separate UI state (userInstructionAreaActive) from content state
(userInstructionActive). Add dynamic check for non-empty user instruction
to update button highlight indicator based on actual content.
2026-03-01 12:37:18 +00:00
Andrew Beal
15fc41b35e Standardize border-radius CSS vars and improve modal spacing (post obsidian mobile UI change)
Replace legacy radius vars (--modal-radius, --button-radius, --input-radius) with standardized tokens (--radius-l, --radius-m). Add margins to modals and top bar divider for better spacing. Fix mobile diff view bottom margin to avoid Obsidian controls overlap.
2026-01-29 14:22:44 +00:00
Andrew Beal
0fb17e7b3a feat: add planning model selection and rate limit countdown UI
Introduce separate planning model setting to allow using different models for planning vs execution. Add visual countdown display when rate limits are hit, with improved retry delay parsing across providers (Claude, OpenAI, Gemini). Refactor settings tab into Views directory and enhance mobile layout for input controls.
2026-01-05 21:49:51 +00:00
Andrew Beal
e22cd8698a refactor: implement planning mode with user questions and cross-provider function call improvements
- Add planning mode toggle and AskUserQuestion function for interactive planning
- Fix Gemini cross-provider function call detection using toolId presence
- Update OpenAI naming service to handle new response format
- Improve system prompts by removing complexity gate, streamlining to action-first principle
- Add InputDisplay component and question mode to ChatInput
- Refactor execution plan error messages to show all incomplete steps
- Update tests to reflect cross-provider function call format changes
2026-01-04 18:52:44 +00:00
Andrew Beal
275f548914 refactor: streamline planning UX and strengthen complexity gate
Restructure system prompt to enforce mandatory complexity evaluation before action. Replace verbose multi-step planning framework with concise gate-based decision model. Add UI for execution plan visibility. Improve planning/execution separation by blocking execution tools during planning phase. Remove cancellation indicator component. Fix conversation deletion bug preventing saves after delete. Strengthen type safety for AIFunction names. Simplify function summary format for planning agent. Update test mocks for new callback signatures.
2026-01-03 11:15:32 +00:00
Andrew Beal
8efbfef63e feat: add active file context to chat requests
- Include user's current active file path in chat requests
- Move conversation save after attachments are added
- Extract formattedRequest in suggest handler
- Add WorkSpaceService.getActiveFile() method
- Remove premature chatArea layout update
- Update unit tests
2025-12-23 13:39:52 +00:00
Andrew Beal
ea9cd211fc refactor: extract MIME type mappings and improve attachment handling
- Move MimeTypeToFileTypes and FileTypeToMimeType mappings to dedicated FileTypeMimeTypeMapping enum file
- Add empty content validation for file attachments
- Add PDF support for Gemini
- Display attachment references in user messages with file info
- Fix OpenAI unsupported mime type message formatting
- Improve URI list handling in InputService to include text/plain
- Update chat area padding and styling for better attachment display
- Prevent drag selection on chat padding element
- Update test assertions for new unsupported mime type message format
2025-12-23 12:04:29 +00:00
Andrew Beal
13cdd0a162 feat: add support for file attachments via drag and drop and paste.
refactor: standardize file type and MIME type handling across AI providers

Introduce centralized MimeType enum and bidirectional mappings between file types and MIME types. Update Claude, Gemini, and OpenAI implementations to use consistent MIME type validation. Add file attachment support via drag-and-drop and paste in chat input. Expand supported file type detection to include programming languages, config files, and documentation formats.
2025-12-22 20:02:02 +00:00
Andrew Beal
c59bfeb06c fix: prevent auto-focus on mobile when opening diff viewer
Refactored focusInput to accept onMobile parameter to conditionally focus input based on platform, preventing annoying automatic keyboard popup on mobile devices when diff viewer opens/closes.
2025-12-13 10:40:20 +00:00
Andrew Beal
ad46a0fa7f fix: use cursor position for search query extraction instead of full text 2025-12-11 17:11:41 +00:00
Andrew Beal
a86d784888 refactor: remove unused backspace handling and element detection logic
Remove custom backspace key handler in ChatInput and unused getElementBeforeCursor method in InputService. Clean up unused imports and associated test cases.
2025-12-11 12:41:14 +00:00
Andrew Beal
9b67c45a78 - Improve mobile keyboard focus ux in diff view events
- Improve readFile error message for non-existent files
2025-12-07 13:43:09 +00:00
Andrew Beal
6f5f72952c fix: improve submit button state handling in diff mode
Update submit button icon and behavior to correctly reflect state when diff
is open. Button now shows appropriate icon based on input content and
triggers correct action (stop vs suggestion) in diff mode.
2025-12-05 23:34:52 +00:00
Andrew Beal
c69351404b Add ability for users to provide suggestions during diff review through new DiffControls component. Integrate suggestion workflow into chat input, allowing users to approve/reject changes or provide feedback without interrupting the review process.
Improve component lifecycle management by converting DiffService and StatusBarService to extend Component class, ensuring proper cleanup and event handling. Add automatic service cleanup in DependencyService during deregistration.

Refine error handling in AI function responses to return error messages instead of Error objects for better serialization. Update user rejection messaging to provide clearer guidance to AI about stopping actions.
2025-11-27 12:39:08 +00:00
Andrew Beal
b3871fad10 fix: reset selected result when search results are cleared
Moves search state reset to only occur when an option is selected and clears the selected result when the results list becomes empty, preventing stale selection state.
2025-11-15 11:35:23 +00:00
Andrew Beal
d743d07d8f fix: improve focus handling in search results and user instruction selection
- Add optional MouseEvent parameter to acceptance handlers
- Prevent default behavior and restore input focus after selection
- Pass focusInput callback to UserInstruction component
- Update default search icon to file-question-mark
- Remove unused plugin import from UserInstruction
2025-11-13 21:15:38 +00:00
Andrew Beal
10472bf30a fix: improve search trigger detection on mobile keyboards
Switch from keydown to beforeinput event for detecting search trigger characters, which works reliably across desktop and mobile virtual keyboards. Allow Shift+Enter to create newlines on mobile devices.
2025-11-12 22:05:12 +00:00
Andrew Beal
ada7f358ef fix: blur input on mobile after submit, focus on desktop 2025-11-12 00:06:54 +00:00
Andrew Beal
643129517a refactor: convert TypeScript namespaces to standalone functions
Migrate AIProvider and SearchTrigger from namespace pattern to exported functions. Simplify OpenAITokenService async implementation, remove unused imports, fix enum aliases, and update placeholder text.
2025-11-10 12:59:48 +00:00
Andrew Beal
4dcce63bce fix: improve mobile UI layout and interaction handling
- Add mobile-specific height constraints for input buttons
- Fix message alignment to left for better readability
- Change click to mousedown for better mobile responsiveness
- Adjust top bar grid columns for mobile layout
- Update view type identifier to 'ai-agent-main-view'
- Standardize quote style to double quotes across config files
2025-11-04 22:51:22 +00:00
Andrew Beal
74560ae685 refactor: centralize API key management with SettingsService
Move API key storage from single key to per-provider keys. Extract
settings logic from plugin to new SettingsService, updating all AI
classes and components to use centralized service. Add visual
indicators for active user instructions in UI.
2025-11-03 17:14:32 +00:00
Andrew Beal
e7516e796e feat: add user instruction selector with dropdown UI
- Add dropdown interface for selecting custom user instructions
- Include "No custom instructions" option to clear selection
- Highlight currently active instruction with accent border
- Auto-save selected instruction to plugin settings
- Close dropdown on click outside or focus loss
- Add keyboard navigation with arrow keys and enter
- Scroll selected instruction into view automatically
- Reset search state when chat input loses focus
2025-11-02 23:19:11 +00:00
Andrew Beal
c0178dc364 feat: add multi-term search and user instruction UI with file path setting
Refactor SearchVaultFiles to accept array of search terms, add user instruction panel in chat input with toggle button, move user instruction path to settings (from hardcoded), improve search result interaction with mouse/keyboard support, fix async exists() method in VaultService, and create example instructions file on first launch
2025-11-02 20:16:06 +00:00
Andrew Beal
2b5f977478 fix: improve search trigger cursor positioning and UX
- Add tooltips to search trigger elements for better visibility
- Fix cursor detection logic for contenteditable="false" elements
- Make user messages render as HTML to support rich content
- Add default cursor style to search triggers
- Remove debug console.log statement
- Clean up unused import in SearchTrigger
2025-11-01 02:01:17 +00:00
Andrew Beal
ba8db87ffd refactor: use promptContent for user messages across AI providers
Standardize message extraction logic to use promptContent field for user roles and content field for assistant roles. Update all AI provider implementations (Claude, OpenAI, Gemini) and corresponding tests. Remove trailing space insertion in ChatInput and clean up minor formatting issues.
2025-10-31 18:32:40 +00:00
Andrew Beal
a3d0b55100 refactor: improve backspace handling for non-editable elements
Replace getNodeAtCursorPosition with getElementBeforeCursor for more robust element detection before cursor. Add cursor position validation after deletions to prevent cursor from ending up inside contenteditable="false" elements. Remove unused helper methods and reorganize code structure.
2025-10-31 18:03:00 +00:00
Andrew Beal
5d3cde18c7 feat: implement rich text input with search trigger system
Add contenteditable chat input supporting inline search triggers for tags, files, and folders. Implement custom backspace/paste/drop handlers, trigger-to-text conversion for API requests, and improved cursor position management. Fix vault exclusion logic to properly cache non-excluded files.
2025-10-31 15:03:40 +00:00
Andrew Beal
63bcfdeae9 fix: remove min query length requirement and improve search UI styling
- Remove 3-character minimum search query requirement
- Add dynamic padding to search results container
- Style search results with icons, grid layout, and hover states
- Fix missing semicolons in ChatInput event handlers
- Implement auto-scroll for selected search result
- Initialize vault cache after metadata resolution
- Update tests to reflect removed query length validation
2025-10-29 21:33:45 +00:00
Andrew Beal
34d28587b4 Convert input helpers into service. 2025-10-29 19:46:20 +00:00
Andrew Beal
679a94d173 feature: implement fuzzysearch service
refactor: rename type interfaces to use I prefix convention

Standardize naming by adding I prefix to all interface types across the codebase (StreamChunk → IStreamChunk, SearchMatch → ISearchMatch, etc.). Also rename conversationStore.ts to ConversationStore.ts for consistency.
2025-10-29 19:35:19 +00:00
Andrew Beal
86241a819d refactor: extract input controls into ChatInput component
Move input field, submit button, and edit mode toggle from ChatWindow into a new ChatInput component to improve separation of concerns and code maintainability.
2025-10-26 09:15:11 +00:00