Commit graph

62 commits

Author SHA1 Message Date
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
385271cb75 Remove Token Services.
The token services weren't providing much value and have become more maintenance than they are worth given the addition of binary conversation data.
2025-12-17 10:54:04 +00:00
Andrew Beal
1f099ed45c refactor: clean up imports and improve view focus handling
- Remove unused Platform import from ChatWindow
- Add grid column for mobile layout in TopBar
- Add await to tick() promise in UserInstruction
- Enhance refocusMainView with explicit focus setting in DiffView
2025-12-13 14:45:56 +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
187b831155 refactor: improve chat layout updates and remove unused imports
- Remove unused StoredFunctionCall/Response imports from AI classes
- Replace settled flag with shouldSettle parameter for better control
- Add ResizeObserver to handle dynamic content size changes
- Bind indicator elements for accurate height calculations
- Update layout calculation to account for indicators when not settled
2025-12-11 08:42:09 +00:00
Andrew Beal
d36815c214 feat: add Gemini thought signature support and OpenAI Responses API migration
Implement thought signature tracking for Gemini function calls to support Gemini 3 requirements. Migrate OpenAI integration from Chat Completions to Responses API with proper input/output item handling. Add cross-provider compatibility via legacy text format fallback for conversations without thought signatures or tool IDs. Improve chat auto-scroll behavior and conversation validation. Add and update AI class and conversation tests.
2025-12-10 21:27:58 +00:00
Andrew Beal
28772e7d0e feat: implement centralized abort controller with enhanced cancellation UX
Introduce a new AbortService to centralize cancellation logic across all async operations, replacing scattered AbortSignal parameters with a unified singleton service. This improves maintainability and provides consistent cancellation behavior throughout the application.

Key changes:
- Add AbortService for centralized abort signal management with automatic cleanup
- Refactor all AI providers (Claude, Gemini, OpenAI) to use AbortService instead of passing AbortSignal parameters
- Update streaming operations to use centralized abort handling
- Add CancellationIndicator component to show visual feedback during operation cancellation
- Rename ChatAreaThought to ThoughtIndicator for better semantic clarity
- Add Environment enum for consistent environment detection
- Enhance ChatService lifecycle with proper cancellation state management
- Remove scattered abort-related UI selectors and error messages in favor of dedicated indicator
- Add safeContinue() factory method to ConversationContent for internal continuations
- Update all tests to reflect new abort handling architecture

This change simplifies the API surface by removing AbortSignal parameters from method signatures while improving the user experience with clearer cancellation feedback.
2025-12-04 23:04:20 +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
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
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
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
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
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
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
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
Andrew Beal
b82d38e799 feat: add edit mode styling to streaming indicator
Pass editModeActive prop through ChatArea to StreamingIndicator to change
streaming animation color from accent to blue when in edit mode
2025-10-13 19:25:29 +01:00
Andrew Beal
1aa0d0000d feat: add edit mode toggle to enable destructive AI actions
- Add allowDestructiveActions parameter throughout AI request chain
- Implement edit mode UI toggle with visual indicators
- Update getQueryActions to conditionally include destructive tools
- Add blue highlight styling when edit mode is active
2025-10-13 19:12:06 +01:00
Andrew Beal
c188f5727e Add allowAccessToPluginRoot parameter to prevent AI editing user instructions
This change adds a new `allowAccessToPluginRoot` parameter throughout the filesystem and vault service layers to control access to plugin root directories. The AI assistant is now prevented from modifying the user instruction file while still allowing internal plugin operations to access conversation data and configuration files.
2025-10-12 23:11:36 +01:00
Andrew Beal
e543bf5351 refactor: improve dependency injection type safety and add AI exclusions setting
- Add generic types to all Resolve() calls for type safety
- Introduce VaultService abstraction layer for file operations
- Add AI File Exclusions setting with textarea and glob pattern support
- Refactor FileSystemService to use VaultService instead of direct Vault access
- Improve code organization with comments and renamed variables
- Update styles for exclusions input field
2025-10-12 21:26:01 +01:00
Andrew Beal
ae5a836c21 refactor: extract chat logic into ChatService
Move streaming, submission, and AI interaction logic from ChatWindow
component into new ChatService for better separation of concerns.
2025-10-12 18:55:39 +01:00
Andrew Beal
9c45a05abc feat: add abort controller to cancel streaming AI requests
- Add AbortSignal parameter to streamRequest interface and implementations
- Implement handleStop function to abort ongoing requests
- Change submit button to stop button when streaming
- Handle AbortError gracefully with user-friendly message
- Add styling for cancellation notification
2025-10-12 13:33:25 +01:00
Andrew Beal
8cc9441276 Remove debugging 2025-10-12 13:08:32 +01:00
Andrew Beal
b99c2062dd refactor: use stable message IDs instead of index-based tracking
Replace index-based message identification with stable UUID-based IDs for proper streaming state management and message updates across chat components
2025-10-12 13:07:54 +01:00
Andrew Beal
84ea96c394 fix: improve chat UI padding calculation and request completion handling
- Add critical instruction to system prompt ensuring AI completes full requests
- Fix race condition in chat padding calculation when streaming ends
- Add onFinishedSubmitting callback to recalculate padding after stream completion
- Replace paragraph tags with div tags for message rendering
- Clean up commented code and improve code formatting
2025-10-12 00:33:04 +01:00
Andrew Beal
9bb0df7df3 Add multi-turn conversation support with shouldContinue flag
Implement continuation logic for AI responses that require multiple turns
without explicit function calls. Add STOP_REASON_STOP constant to detect
when conversation should naturally end versus when it needs continuation.

Update streaming flow to handle both function calls and continuation flags,
enabling more fluid multi-step conversations.
2025-10-11 13:57:11 +01:00
Andrew Beal
19be7ccf8d Refactor chat scroll behavior to use dynamic padding instead of intervals
Replace auto-scroll interval logic with ResizeObserver-based dynamic padding system that maintains scroll position during streaming by adjusting container bottom padding based on message and thought bubble heights
2025-10-11 12:28:42 +01:00
Andrew Beal
9cbedb6b53 refactor: extract and reuse focusInput logic across components
Move focus logic to exported method and trigger it after conversation
resets to maintain input focus consistently throughout the UI flow.
2025-10-09 21:34:40 +01:00
Andrew Beal
d910239a7f Add wiki-link support, API key validation, and refactor AI provider initialization
Implement clickable wiki-links in assistant responses with WorkSpaceService for note navigation. Add API key validation with visual feedback in ChatWindow, automatically opening settings when empty. Extract settings helper to reduce code duplication. Refactor Gemini class to resolve API key from plugin settings rather than constructor parameter. Update system prompt with wiki-link usage guidelines. Remove unused ODB cache implementation and loadExternalCSS helper. Improve UI with enhanced empty state styling and input textarea scrolling behavior.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 22:06:25 +01:00
Andrew Beal
f5a3a513ec Change thought component to use svelte binding.
Add styling to thought.
2025-10-07 22:27:51 +01:00
Andrew Beal
43c31cf18d Fix duplicate function call messages in ChatWindow by removing placeholder message when function call is captured.
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 20:42:42 +01:00
Andrew Beal
88901ec927 Refactor ChatArea to simplify message rendering logic and introduce isSubmitting state for improved UI feedback. Consolidate user and assistant message rendering into unified structure and move StreamingIndicator and ChatAreaThought to appear during submission phase.
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 00:57:08 +01:00
Andrew Beal
6f0e6d0342 Enhance Gemini web search directive for clarity, improve ChatArea streaming message handling, and ensure conversation saving logic in ChatWindow. Update AIFunction enum and AIFunctionService for RequestWebSearch functionality. Modify ConversationFileSystemService to include function call response handling. 2025-10-07 00:24:45 +01:00
Andrew Beal
62104f0abd Refactor AI function handling by introducing AIFunctionCall and AIFunctionResponse classes, updating function definitions, and enhancing conversation content management. Remove unused code and improve service registration for AIFunctionService. 2025-10-06 23:01:20 +01:00
Andrew Beal
82ee600979 Refactor Gemini and IAIClass to remove IActioner dependency, update streamRequest method signature, and enhance service registration. Remove unused Actioner and related action definitions. Introduce AIFunctionService and implement ListVaultFiles function definition. 2025-10-05 18:04:47 +01:00
Andrew Beal
0d93516d93 Enhance conversation loading functionality by adding conversation selection handling in ConversationHistoryModal and ConversationHistoryModalSvelte, updating conversationStore for improved state management, and implementing current conversation path retrieval in ConversationFileSystemService. 2025-10-05 14:15:04 +01:00
Andrew Beal
d0b4d5b852 Refactor Gemini class to use Conversation object in streamRequest method, update IAIClass interface, and enhance ChatWindow component for conversation handling. Add logging for conversation saving in ConversationFileSystemService and comment out OdbCache references in ServiceRegistration and main files. 2025-10-04 13:27:40 +01:00
Andrew Beal
ace478c311 Refactor conversation handling by introducing Conversation and ConversationContent classes, updating ChatArea and ChatWindow components, and enhancing file system service for conversation management. 2025-10-04 13:10:22 +01:00