Commit graph

135 commits

Author SHA1 Message Date
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
eab7e77303 Add test coverage for InputService. 2025-10-31 15:12:31 +00:00
Andrew Beal
9b22f61bbe fix: make search trigger spans non-editable
Prevent users from accidentally modifying search trigger content by setting contenteditable="false" attribute on trigger span elements.
2025-10-31 15:06:35 +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
f2d5c01970 test: add cleanup to prevent memory leaks in test suites
Add DeregisterAllServices() calls in afterEach hooks across all test files to clear singleton registry between tests. Export DeregisterAllServices from DependencyService. Fix StatusBarService test timing issues with animation frames.
2025-10-30 12:15:35 +00:00
Andrew Beal
3852194f2d add: new unit / integration tests
fix: standardize error messages and improve cache path filtering

Standardize "Error parsing function call" message across Claude and OpenAI providers. Fix VaultCacheService to properly handle file events when paths move in/out of cached folders. Update test documentation and setup for Session 4.
2025-10-30 09:33:05 +00:00
Andrew Beal
ae5a5ed5de refactor: consolidate file exclusion logic with shouldBeCached method
Move duplicate exclusion checks into a single shouldBeCached method and apply it consistently across file and folder events. Also fix glob pattern matching to correctly handle directory patterns ending with /.
2025-10-30 08:34:11 +00:00
Andrew Beal
211b8905ca fix: prevent caching of excluded folders in VaultCacheService
Check VaultService exclusions before caching folders on create/rename events to prevent excluded directories (AI Agent root, user exclusions) from being added to the cache.
2025-10-29 22:06:22 +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
063dee3057 Write unit tests for InputService. 2025-10-29 19:59:52 +00:00
Andrew Beal
08706ccdd0 Create unit tests for UserInputService 2025-10-29 19:52:15 +00:00
Andrew Beal
34d28587b4 Convert input helpers into service. 2025-10-29 19:46:20 +00:00
Andrew Beal
e551155230 Add promptContent parameter to ConversationContent class
This change adds a new promptContent parameter to the ConversationContent
constructor and updates all related code including serialization,
deserialization, and tests to support this new field.
2025-10-29 19:41:05 +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
44cfa54e95 feat: add fuzzy search for tags, files, and folders in vault cache
Implement fuzzysort-based matching methods (matchTag, matchFile, matchFolder)
with automatic preparation of search targets. Add folder tracking alongside
existing file/tag caching. Update event handlers to maintain fuzzy search
indices on create/rename/delete operations.
2025-10-25 16:17:45 +01:00
Andrew Beal
182d12173a feat: add VaultCacheService and vault monitoring capabilities
Register VaultCacheService as singleton dependency, add file event registration to VaultService for monitoring vault changes, implement listVaultContents method to retrieve all files and folders with exclusion filtering, and add comprehensive test coverage for new functionality.
2025-10-25 12:46:07 +01:00
Andrew Beal
a35269550d Bump package versions.
Setup Vitest.
Create unit and integration tests.
Co-authored by Claude.
2025-10-24 23:36:55 +01:00
Andrew Beal
ce2be8c16e Bump dependency versions. 2025-10-24 18:40:44 +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
8347ddbdf2 chore: upgrade TypeScript from 5.0.4 to 5.9.3 2025-10-22 10:11:28 +01:00
Andrew Beal
683261a565 chore: bump version to 0.0.3 2025-10-22 10:07:22 +01:00
Andrew Beal
098c598c88 feat: add updated timestamp tracking to conversations
Track when conversations are last modified by adding an `updated` field to the Conversation model. Sort conversation history by last updated time instead of creation time for better user experience.
2025-10-22 10:06:32 +01:00
Andrew Beal
ba77ebc81b refactor: replace API provider dropdown with model selection dropdown
Replace simple API provider selection with comprehensive model dropdown organized by provider (Claude, OpenAI, Gemini). Update settings schema from `apiProvider` to `model`, add AIProvider.fromModel() helper, simplify provider URLs, and fix indentation inconsistencies throughout codebase.
2025-10-21 22:14:35 +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
46d97089a7 refactor: use Role enum for system role instead of string literal 2025-10-19 01:00:46 +01:00
Andrew Beal
6656f4c495 feat: implement Claude and OpenAI conversation naming service
- Add Claude and OpenAI ConversationNamingService with API integration
- Register Claude and OpenAI naming service in dependency injection
- Add model and URL constants for naming
2025-10-19 00:58:30 +01:00
Andrew Beal
bf948a79b2 Add Claude and OpenAI provider support with token services
- Add Claude and OpenAI to AIProviderModel enum
- Implement ClaudeTokenService and OpenAITokenService
- Update service registration to handle new providers
- Install @anthropic-ai/sdk and gpt-tokenizer dependencies
- Add error handling for invalid provider selection
2025-10-19 00:35:26 +01:00
Andrew Beal
023913b0b7 Bump version to 0.0.2 2025-10-18 15:05:00 +01:00
Andrew Beal
9bd38ab0ae fix: improve spacing and layout of API request aborted message
Add inline-block display and vertical margin to aborted request indicator for better visual separation and proper spacing in the UI
2025-10-18 15:03:31 +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
fc892c43be refactor: replace hardcoded colors with CSS variables in syntax highlighting 2025-10-18 14:02:31 +01:00
Andrew Beal
77037472cb Bump svelte version 2025-10-18 13:07:28 +01:00
Andrew
7bbadaf972
Update version from 1.0.0 to 0.0.1
Set initial BETA version
2025-10-18 13:02:08 +01:00
Andrew Beal
cab6616142 feat: add icon to MainView and improve styling with status bar cleanup
- Add sparkles icon to MainView via getIcon() method
- Integrate StatusBarService to clean up status messages on view close
- Center view content with max-width constraint
- Apply consistent background styling to leaf content
2025-10-18 00:44:15 +01:00
Andrew Beal
a35b3dd0c9 refactor: replace let with const for immutable variables 2025-10-18 00:28:23 +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
301a95befb feat: add animated token counter to status bar
Implement smooth ease-out animation when updating input/output token counts in the status bar, replacing instant updates with a 1-second transition for better visual feedback.
2025-10-17 22:40:12 +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
db054744ba Add token counting service and refactor dependencies
- Implement ITokenService interface and GeminiTokenService for token counting
- Add StatusBarService for managing status bar messages
- Extract AIProviderModel enum to centralize model configuration
- Remove unused MessageService and AIThoughtMessage classes
- Update dependency registration to include new services
- Clean up main plugin initialization and status bar handling
2025-10-17 22:23:30 +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
08a6bde961 fix: remove unnecessary alt=sse parameter from GeminiNamer URL 2025-10-17 16:18:39 +01:00