Commit graph

149 commits

Author SHA1 Message Date
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
a4c65f16c2 Update file attachment messaging and add document file support
Add support for DOCX, PPTX, XLSX, ODT, ODP, and ODS document formats by converting them to plain text. Standardize attachment introduction messages across all AI providers from "Binary data for X follows" to "The contents of the file 'X' are provided below."
2026-03-15 19:48:28 +00:00
Andrew Beal
562ab8d036 fix: add scrolling to user messages and validate file uploads
- Limit user message height to 15vh with hidden scrollbar
- Show notice for unsupported file types instead of silently failing
- Extract file type check to prevent invalid MIME type lookups
2026-03-15 12:21:41 +00:00
Andrew Beal
581c7f1686 refactor: standardize background colors to use primary variant
Update Spinner and ThoughtIndicator components to use --background-primary instead of --background-secondary and --background-primary-alt for visual consistency across the UI.
2026-03-05 23:14:43 +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
d18f5ef655 refactor: replace Replan with granular orchestration tools
Replace the single Replan tool with three targeted alternatives:
ReviseStep, RevisePlan, and SkipStep. This gives the orchestration
agent more precise control over plan recovery — revising only the
current step, replacing all remaining steps, or skipping a step
entirely — rather than triggering a full replan each time.

Also give the orchestration agent read access to vault files so it
can resolve execution failures without routing back to the planning
agent, and update the execution agent prompt to stop it from
attempting self-recovery (gap resolution is now the orchestrator's
responsibility).
2026-02-19 20:48:59 +00:00
Andrew Beal
13e9030b4b fix: correct scroll positioning and spinner layout in chat plan area
- Calculate step position relative to scroll container for accurate centering
- Add flex-shrink: 0 to spinner to prevent unwanted shrinking
- Pass alternateBackground prop to active step spinner
2026-02-16 21:56:31 +00:00
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
a4800bd6da refactor: convert attachments to file-based storage with lazy loading.
Migrate attachment storage from base64-in-JSON to separate binary files with SHA-256 naming, add automatic garbage collection, implement lazy loading via getBase64() and getMimeType() methods, normalize text MIME types, add image resizing, and update all AI provider integrations. Fix small issue that caused the chat area to scroll down on message streaming end even when scrolled up.
2026-02-15 22:46:25 +00:00
Andrew Beal
3d56643772 refactor: strengthen task execution boundaries and search strategy
Adds explicit "golden rule" to prevent scope creep in ExecutionPrompt,
restructures PlanningPrompt with progressive multi-tier search methodology,
and fixes ChatPlanArea height calculation timing issues.
2026-01-30 22:04:00 +00:00
Andrew Beal
ac835d1346 refactor: rename toolDefinitions to aiFunctionDefinitions and add AIFunctionUsageMode support
- Rename toolDefinitions to aiFunctionDefinitions across all AI classes
- Add aiFunctionUsageMode property to control function calling behavior
- Implement provider-specific tool_choice/tool_config based on usage mode
- Remove AIController and create BaseAgent base class
- Update ExecutionPrompt with scope of execution guidelines
- Simplify ChatArea layout update logic by removing debounce
- Add naming service completion wait in ChatService
- Replace console.warn with Exception.warn in InputService
- Delete unused AIController.ts file
- Update all tests to use new aiFunctionDefinitions property
2026-01-30 19:36:52 +00:00
Andrew Beal
9276d2d0cd fix: improve mobile layout spacing and modal margins
- Add horizontal margin to conversation divider in TopBar
- Adjust grid row sizing in conversation history modal
- Remove margin from modals on mobile screens (≤600px)
- Reduce bottom margin for diff mobile controls
- Remove redundant background styling from diff button container
- Fix diff view height calculation on mobile to avoid control overlap
2026-01-30 10:00:16 +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
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
638b229239 feat: enhance wiki-link documentation and fix ChatPlanArea height updates
- Expand SystemPrompt wiki-link guidance with examples and common mistakes
- Add ResizeObserver to ChatPlanArea for dynamic height adjustments
- Improve plan completion summary prompt with more context requirements
2026-01-29 13:32:23 +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
789302ade4 fix: improve height calculation reliability in ChatPlanArea
Move step height measurements into updateHeight function to ensure fresh calculations on each update, preventing stale reactive declarations from causing incorrect collapsed height values
2026-01-07 20:40:16 +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
7e71861a4d refactor: improve plan execution with stricter scope and error handling
- Add currentProvider getter to AI classes for provider access
- Enhance planning prompt to discourage over-engineering and scope creep
- Return Unknown enum instead of throwing for invalid AI functions
- Add completion reminders to execution steps
- Fix ChatPlanArea height calculation timing
- Update tests to handle Unknown function gracefully
2026-01-06 20:49:02 +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
6836f65431 Add height animation to chat attachments container
Wrap attachments container in a wrapper div with reactive height calculation to enable smooth height transitions when attachments are added or removed
2025-12-23 20:25:10 +00:00
Andrew Beal
d2e7b47c65 refactor: centralize icon handling and improve attachment UI
- Move icon name logic to Attachment and Reference classes
- Create reusable setElementIcon Svelte action in ElementHelper
- Update ChatArea and ChatAttachments to use new icon helper
- Add visual separator and background color for message attachments
- Fix duplicate URIs in drag-and-drop file handling
- Improve attachment icon centering with flexbox layout
2025-12-23 20:18:27 +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
cf952352d0 fix: optimize chat area layout updates and add fade gradients
- Add isObserver parameter to updateChatAreaLayout for instant ResizeObserver updates
- Wrap chat area in container with top and bottom fade gradients
- Improve scroll visual feedback with gradient overlays
- Update dependencies: openai 6.15.0, svelte-check 4.3.5, @testing-library/svelte 5.2.10
2025-12-20 11:20:43 +00:00
Andrew Beal
e3e30a2b47 fix: improve chat scroll calculation and conversation deletion handling
- Use getOuterHeight helper for accurate element measurements including margins
- Simplify gap calculation for thought and streaming indicators
- Add top fade gradient to chat area for better visual polish
- Queue AI file deletions to prevent blocking conversation deletion
- Only trigger modal close callback when no conversation is active
2025-12-20 01:34:41 +00:00
Andrew Beal
3e013f6c9f refactor: migrate from flag-based content types to typed properties
Replace boolean flags (isFunctionCall, isFunctionCallResponse,
isProviderSpecificContent) with explicit typed properties (functionCall,
functionResponse, attachments) in ConversationContent. Introduce Attachment
class and BaseAIFileService. Update all AI providers (Claude, Gemini, OpenAI)
to use new attachment-based binary file handling with proper error handling,
retry logic, and AbortService integration.
Implement new Files API service for all providers (not yet integrated).
2025-12-19 12:30:51 +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
b2856aa294 feat: add image and PDF support to ReadVaultFiles function
Add support for reading images (PNG, JPG, JPEG, WebP) and PDFs in ReadVaultFiles. Implement provider-specific formatting for binary content (Claude, OpenAI, Gemini). Update conversation structure to handle binary files separately from text responses. Add unpdf library for PDF text extraction in search.
2025-12-16 20:50:28 +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
3e43d9f558 refactor: improve legacy tool call conversion format and system prompt clarity
Simplify historical tool call/result format from bracketed text to JSON with HTML comments indicating completed status. Update system prompt to clarify this is historical context, not a pattern to reproduce. Improve chat area layout performance with debouncing and reduce minimum padding. Update all tests to match new format.
2025-12-12 23:37:30 +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
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
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
33440d17bf refactor: standardize error handling and logging across codebase
Replace console.error/log with Exception.log helper, improve OpenAI error handling with retryable errors, add type-safe model validation, and add new AI models (Claude Opus 4.5, Gemini 3 Pro Preview, GPT-5.1)
2025-12-06 14:09:46 +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
065d475d74 Refactor file patching from unified diff to direct string replace
This change simplifies the patch mechanism by replacing the unified diff format with a straightforward find-and-replace approach. The PatchVaultFile function now accepts oldContent and newContent parameters instead of a diff patch string, making it more intuitive and reliable for AI agents to use.

Key changes:
- Update PatchVaultFile function signature and documentation
- Replace diff.applyPatch() with String.replace()
- Simplify error handling for content matching
- Update all tests to reflect new API
- Remove unused applyPatch method from DiffService
- Fix diff container height calculation in CSS
- Fix error notification logic in ChatService
- Fix conversation deletion order in TopBar component
2025-12-05 23:02:55 +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
d93e61bc9d fix: improve chat service lifecycle and diff handling reliability
- Stop chat service before loading conversations and resetting
- Add proper diff cancellation with resolve callback
- Add runtime type guards for plugin settings API access
- Improve diff view layout with padding adjustments
- Remove overly permissive TypeScript ESLint overrides
2025-11-27 16:47:21 +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
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