Commit graph

72 commits

Author SHA1 Message Date
Andrew Beal
2bc12691d3 feat: add early tool call feedback for improved UI responsiveness
Emit tool call start events immediately when tools begin execution,
allowing UI to display contextual "thinking" messages (e.g., "Generating
note contents..." for WriteVaultFile) before tool completion. Add
Spinner to ThoughtIndicator component for visual feedback during tool
operations.
2026-02-16 17:40:14 +00:00
Andrew Beal
7878ac804d refactor: simplify chat layout update logic and extract applyLayout
- Remove isObserver parameter from updateChatAreaLayout
- Extract layout calculation logic into separate applyLayout function
- Add resetAutoScroll export to re-enable auto-scrolling
- Clear layoutUpdateTimeout when debounce is interrupted
- Simplify conditional logic for instant vs debounced updates
- Call resetAutoScroll when submitting new message
2026-01-29 17:01:50 +00:00
Andrew Beal
ab9ee08281 refactor: implement multi-agent orchestration architecture
Restructure the AI workflow from a single-agent model to a specialized
multi-agent system with distinct roles:

- Add AgentType enum (Main, Orchestration, Planning, Execution) to define
  agent specializations
- Replace AIControllerService and AIFunctionService with modular agent
  classes in Services/AIServices/:
  - MainAgent: Handles user interaction and delegates to orchestration
  - OrchestrationAgent: Coordinates plan execution and step-by-step workflow
  - PlanningAgent: Creates and revises execution plans
  - ExecutionAgent: Executes individual plan steps
  - AIController: Base class providing common agent loop functionality
- Create specialized prompts (OrchestrationPrompt, ExecutionPrompt) for
  agent-specific behavior
- Add OrchestrationResult type to communicate workflow control decisions
  (continue, abort, replan)
- Introduce agent-specific function scoping:
  - ExecuteWorkflow for main agent
  - CompleteTask for execution agent
  - CompleteStep/Replan/CancelPlan for orchestration agent
  - SubmitPlan/AskUserQuestionPlanning for planning agent
- Update BaseAIClass to use agentType property instead of isPlanningAgent
  boolean for model selection
- Simplify ExecutionPlan and ExecutionStep types by removing execution
  state tracking (moved to agent coordination)
- Remove PlanningEnabledAppendix and ExecutionStatus enum (superseded by
  agent architecture)
- Add comprehensive integration tests for agent workflows

This architecture provides better separation of concerns, clearer agent
responsibilities, and more robust plan execution with explicit orchestration
control flow.
2026-01-27 20:29:20 +00:00
Andrew Beal
19cd82ad7d feat: split ask_user_question into separate planning and execution functions
Add distinct AskUserQuestionPlanning and AskUserQuestionExecution functions to enable user consultation during both planning and execution phases. Update system prompt to clarify when to seek user input vs. replan. Fix plan area rendering timing and improve execution flow handling.
2026-01-07 20:00:40 +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
4614ec5639 feat: add markdown formatting support to AI planning questions
Enhance user question display with markdown rendering for better readability.
Display formatted questions with emphasis, lists, and code snippets. Adjust
input display max-height based on platform (mobile: 15vh, desktop: 30vh).
2026-01-04 23:59:07 +00:00
Andrew Beal
817ab3d332 fix: improve planning mode error handling and UI state management
- Add MAX_AGENT_DEPTH check to prevent infinite planning recursion
- Prompt user to submit plan if not provided instead of silent failure
- Clear planning mode when deactivating edit mode
- Remove inline overflow-y style in favor of CSS declaration
- Update error copy for clarity
- Remove unused deactivateEditMode method
2026-01-04 23:40:31 +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
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