Commit graph

102 commits

Author SHA1 Message Date
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
18372ce01b refactor: improve error handling with structured API errors and retry logic
Replace console.error calls with Exception.log, implement typed API errors with automatic retry for transient failures (rate limits, server errors), add error state tracking to conversation content, and enhance system prompt with action-first operating principle, update unit tests
2025-11-19 20:30:53 +00:00
Andrew Beal
167a2b13a5 refactor: standardize error handling with Exception helper and improve return types
Add Exception helper class for consistent error handling and logging. Replace throw statements and console.error calls with Exception methods. Update service methods to return Error | T instead of mixed success/failure objects. Improve type safety in Claude.extractContents with explicit return type.

Add WikiLinks helper to VaultCacheService for managing wiki link references.

Update unit tests.
2025-11-17 19:02:15 +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
a217e84643 Rename plugin to Vaultkeeper AI 2025-11-10 08:03:27 +00:00
Andrew Beal
ff111c69e6 Rename from AI Agent to Vault AI 2025-11-09 23:09:08 +00:00
Andrew Beal
c9942e9ffa feat: add comprehensive help modal with guide and troubleshooting content
- Add detailed plugin guide covering modes, references, and instructions
- Add troubleshooting section with API key and rate limit solutions
- Add privacy documentation explaining data storage and exclusions
- Make "User Instructions" text clickable to open help modal
- Support opening help modal to specific topic via initialTopic prop
- Add internal link handling to navigate from help modal to vault files
- Update About section with GitHub link and contribution info
2025-11-09 19:59:41 +00:00
Andrew Beal
0812e91c37 fix: prevent empty messages and assistant-to-assistant structure
- Filter out messages with empty content in Claude, Gemini, and OpenAI
- Insert hidden "Continue" message when last message is from assistant
- Remove function call JSON from assistant message content
- Hide empty messages in ChatArea UI
- Add GitHub link and about content to help modal
- Add comprehensive tests for message handling edge cases
2025-11-09 13:57:47 +00:00
Andrew Beal
4c2630b7f5 feat: add help modal button to top bar and update license to MIT
- Add HelpModal integration to TopBar with circle-help icon
- Update LICENSE from 0BSD to MIT License
- Refactor modal constructors to use dependency injection
- Format code style (quotes, indentation) in TopBar and ConversationHistoryModal
2025-11-07 00:28:22 +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
a0afcdd0d0 Replace Node.js path module with path-browserify for browser compatibility 2025-11-04 19:12:30 +00:00
Andrew Beal
eb3bb46278 fix: adjust spacing in chat components and bump version to 0.0.5
Standardize margin-bottom in AI thought container to 0.25rem and add top margin to streaming indicator for consistent spacing.
2025-11-04 18:56:28 +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
62ce3522df Adjust botom margin on chat thought container. 2025-11-01 11:52:35 +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
Andrew Beal
071514f02a Remove auto-resize functionality and simplify input field layout
- Remove autoResize() function and calls
- Set input field height to 100% instead of dynamic resizing
- Adjust input padding from var(--size-2-1) to var(--size-2-2)
- Remove explicit height: 100% from edit-mode and submit buttons
2025-10-26 01:36:02 +01:00
Andrew Beal
cf9d65232f Replace textarea with contenteditable div for input field
Refactor input field from HTMLTextAreaElement to contenteditable div to enable better text formatting support. Update event handlers, styling, and auto-resize logic accordingly.
2025-10-26 01:16:51 +01:00
Andrew Beal
d9e47357ae refactor: make scroll behavior configurable in ChatArea
Add behavior parameter to scrollChatArea to allow explicit control over
scroll animation (smooth vs instant) based on context. Use instant scroll
when loading conversations, smooth for user-initiated actions, and none
for completion states.
2025-10-24 18:16:38 +01:00
Andrew Beal
23721246bd refactor: improve path sanitization and remove unused chat area code
- Remove unused conversationKey and incomplete message sorting logic
- Add stack limit protection to conversation naming loop
- Enhance UTF-8 truncation to preserve character boundaries
- Add empty segment fallback and improve documentation
- Fix VaultService.exists to respect access restrictions
2025-10-24 17:25:32 +01:00
Andrew Beal
4a42b1f84c Fix function call parsing and conversation loading issues
- Extract functionCall/functionResponse objects properly in Gemini
- Reset chat area state when loading conversations
- Add SanitiserService for path validation
- Prevent duplicate conversation names
- Improve chat scrolling and padding logic
- Clear streaming state on submission complete
2025-10-24 17:25:19 +01:00
Andrew Beal
9f36dac64c Fix: messages with function call and content were not being displayed.
refactor: remove unused apiError429UserInfo property and simplify error handling

Remove apiError429UserInfo from IAIClass interface and all implementations (Claude, Gemini, OpenAI). Simplify StreamingService error handling by removing custom 429 error messages. Clean up ChatService formatting and ChatArea display logic.
2025-10-21 19:51:06 +01:00
Andrew Beal
afdfa3021b Refactor conversation content handling and improve error messages
- Split content and functionCall into separate fields in ConversationContent
- Extract content parsing logic into dedicated methods for Claude and Gemini
- Add API error 429 handling with provider-specific user information
- Improve error messages in naming services to include response text
- Increase max_tokens for main requests and naming services
- Optimize ChatService to reduce unnecessary saves and array recreations
- Remove message key binding in ChatArea to improve performance
- Adjust chat window max-width to fixed pixel value
2025-10-20 08:30:08 +01:00
Andrew Beal
eac7ac13fb Add Claude API provider support with streaming and tool integration
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 14:23:24 +01:00
Andrew Beal
cce2cf9132 fix: update token display timing and remove unused imports
- Add 500ms timeout to chat padding recalculation to prevent race conditions
- Replace svelte tick() with setTimeout for conversation title updates
- Update token display after each conversation save and streaming response
- Remove unused svelte/transition and tick imports
2025-10-18 14:33:17 +01:00
Andrew Beal
c71f18d5c2 fix: use tick() for assistantMessageAction and update edit-mode accent colors
- Wrap assistantMessageAction in tick() to resolve race condition with streaming indicator removal
- Replace interactive-accent with alt-interactive-accent for edit-mode UI elements
- Add alt-interactive-accent CSS variables as color-mixed variants of interactive-accent
2025-10-18 00:11:47 +01:00
Andrew Beal
eeceda00e1 refactor: migrate to Obsidian theme variables for consistent theming
Replace hardcoded color values and custom CSS variables with Obsidian's
built-in theme variables for backgrounds, borders, and interactive elements.
Removes unused isStreaming state and simplifies gradient background. Updates
view display text to "AI Agent".
2025-10-17 23:51:23 +01:00
Andrew Beal
47af43fe1f feat: add token counting display to status bar
Implement real-time input/output token tracking in the status bar by
integrating ITokenService with ChatService. Token counts are calculated
from conversation history and updated on conversation load, reset, and
message completion.
2025-10-17 22:23:45 +01:00
Andrew Beal
2fc9edc194 refactor: move typing-in animation to global styles and add conversation title to top bar
- Extract typing-in animation from ChatArea to global styles.css for reuse
- Add conversation title display in TopBar with fade transition
- Update ChatService to notify title changes via onNameChanged callback
- Fix ConversationNamingService to trigger callback after saving new title
- Clean up unused isAborting flag in ChatService
- Adjust grid layout in TopBar to accommodate title display
2025-10-17 19:34:47 +01:00
Andrew Beal
d0be254c5f feat: add batch file operations and move functionality
- Rename DeleteVaultFile to DeleteVaultFiles with array support
- Add MoveVaultFiles function for file relocation and renaming
- Refactor file operations to return structured success/error results
- Move directory creation logic to VaultService
- Register FileManager dependency for file operations
- Fix CSS variable for interactive accent blue hover state
2025-10-16 22:58:30 +01:00
Andrew Beal
279a89e483 refactor: improve system prompt search strategy and fix UI styles
- Reorder sections to prioritize vault-first decision framework
- Add blanket search tier for comprehensive vault exploration
- Emphasize persistent searching with alternative terms
- Remove duplicate StreamingIndicator component
- Fix edit mode button hover styling specificity
2025-10-15 22:57:06 +01:00
Andrew Beal
a756cee5c0 refactor: replace hardcoded blue with dynamic accent color variable
Replace direct `--color-blue` references with new `--interactive-accent-blue` variable that blends interactive accent with blue, enabling consistent theme-aware styling across edit mode UI elements.
2025-10-15 21:18:59 +01:00
Andrew Beal
6be51ebaae fix: prevent race conditions in chat lifecycle and conversation management
- Add abort flag to prevent semaphore double-release during stop
- Stop active chats before deleting conversations to avoid state corruption
- Treat empty search terms as explicit request for all files
2025-10-14 23:45:10 +01:00
Andrew Beal
1a57bb4872 style: increase streaming indicator glow shadow spread 2025-10-14 22:58:58 +01:00
Andrew Beal
ae5754040a feat: implement progressive search strategy with relationship inference
Adds multi-tier search approach that exhaustively tries broader terms,
partial matches, and synonyms before concluding information doesn't exist.
Enables relationship inference from found content to answer queries about
connected entities. Fixes padding calculation to account for consecutive
assistant messages by summing their heights.
2025-10-14 20:22:01 +01:00
Andrew Beal
f2a7a41705 refactor: replace ListVaultFiles with content-based SearchVaultFiles
Replace list_vault_files function with search_vault_files that performs regex-based content search instead of listing all files. Add escapeRegex helper for search term sanitization. Remove unused edit mode CSS.
2025-10-14 18:54:16 +01:00
Andrew Beal
92d3bc5a31 refactor: enhance system prompt with structured decision framework
Reorganize system prompt with clearer operating principles, vault-first
decision heuristics, semantic directory architecture, and comprehensive
examples. Improve multi-tool workflow guidance and error handling patterns.

Extract edit mode toggle to dedicated function for better code organization.
2025-10-13 20:06:47 +01:00
Andrew Beal
f8aa162a63 fix: improve edit mode deactivation and request cancellation handling
- Deactivate edit mode when resetting or loading conversations
- Fix cancelled request detection using Selector instead of Copy enum
- Standardize quote style in StreamingMarkdownService to double quotes
2025-10-13 19:53:00 +01:00