Commit graph

296 commits

Author SHA1 Message Date
Andrew Beal
9cef35baec refactor: improve agent prompt clarity and workflow control
Clarify execution vs orchestration responsibilities, eliminate conditional step patterns in planning, add explicit plan completion signal, and strengthen guidance on atomic unconditional actions with outcome-based routing.
2026-01-28 23:48:49 +00:00
Andrew Beal
1b47c64c8b fix: prevent plan completion when replan is requested
Track replan state to ensure plan doesn't complete prematurely when a replan
is requested. Also add CompletePlan to orchestration agent definitions and
update step progress callback on successful completion.
2026-01-28 23:03:38 +00:00
Andrew Beal
1bdab361b4 Add debug logging to AI agent workflow execution
Track agent initialization, function calls, workflow transitions, and completion states across MainAgent, OrchestrationAgent, PlanningAgent, ExecutionAgent, and AIController. Remove unused window.debugServiceLog global declaration.
2026-01-28 21:59:48 +00:00
Andrew Beal
cefc408b2e Add context passing between execution steps and enhance orchestration
- Add context_for_next_step parameter to CompleteStep for passing execution history
- Add context parameter to CompleteTask for preserving task completion state
- Update OrchestrationResult to handle context propagation between steps
- Add debug color differentiation for agent types (Main, Execution, Orchestration, Planning)
- Reorganize SearchTypes from Helpers to Types directory
- Add justification requirement for execution deviations
- Support reasonable deviations in orchestration plan validation
- Refactor dependency service with TryResolve utility
- Add whitespace cleanup to Semaphore class
2026-01-28 21:23:47 +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
1694c17baa Bump plugin version to 1.1.7 2026-01-07 20:40:51 +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
67c4f3f2c6 Add comprehensive integration tests for AI agent workflows
Test agent loop function calls, planning mode, execution agent, replan workflow, error handling, save callbacks, and shouldContinue flag behavior. Update mocks to use AIFunctionResponse class and rename onPlanComplete to onPlanReset.
2026-01-07 20:15:57 +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
c5a3a4a5fb Update unit tests. 2026-01-05 22:46:51 +00:00
Andrew Beal
aa1e34185a Bump plugin version to 1.1.6 2026-01-05 22:38:51 +00:00
Andrew Beal
9cc4aca679 Update dependencies: diff2html, zod, TypeScript ESLint, and rollup 2026-01-05 22:30:08 +00:00
Andrew Beal
c748d165c6 docs: add planning mode documentation to README and help text
Document the new two-agent planning workflow, including how it works, when to use it, capabilities, visualization, and planning model configuration. Add planning mode section to both README.md and help copy.
2026-01-05 22:27:58 +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
fbb2d8275d feat: add CompletePlan function to explicitly mark plan execution as complete
Add new CompletePlan function with schema and validation to allow agents to explicitly signal when all execution steps are done. Update system prompt to include completion confirmation step. Refactor execution loop to recursively prompt for completion if incomplete, with MAX_EXECUTION_DEPTH limit replacing MAX_PLANNING_ITERATIONS. Remove automatic incomplete execution handling in favor of explicit agent-driven completion.
2026-01-04 22:47:22 +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
32050767ca feat: enhance conversation naming with prompt injection protection and improved validation
- Wrap user messages in <message_to_title> tags to prevent prompt injection
- Expand NamePrompt with security guidelines and edge case handling
- Add 10-word limit truncation for generated titles
- Move conversation save before naming to ensure persistence
- Add comprehensive task complexity assessment framework to SystemPrompt
- Change stack limit error to warning log for better resilience
2026-01-01 13:06:06 +00:00
Andrew Beal
80e01e1212 refactor: extract function parsing to shared ResponseHelper
Move parseFunctionCall and parseFunctionResponse from BaseAIClass private methods to shared ResponseHelper module for better code reusability across providers and tests.
2025-12-31 23:02:01 +00:00
Andrew Beal
18d0741ec9 refactor: improve function call/response parsing and filtering
- Move parseFunctionCall/parseFunctionResponse to ResponseHelper
- Enhance orphaned call/response filtering with detailed debug logs
- Add toolId to conversation content for better tracking
- Fix planning workflow execution mechanics and step numbering
- Remove unused planning agent appendix and detailedAppendixForPlanningAgent
- Add conversation save callbacks throughout AI controller loops
- Improve multi-agent function handling to avoid exceptions
- Update all tests to include toolId fields for proper filtering
2025-12-31 22:56:22 +00:00
Andrew Beal
2c7e5b41b6 Add provider-specific retry delay extraction for rate limits
Implement extractRetryDelay methods in Claude, Gemini, and OpenAI classes to parse provider-specific retry delay headers/responses. Update StreamingService to use these delays when available, falling back to exponential backoff. Enhance ApiError to include response headers and body for retry delay extraction.
2025-12-31 14:19:42 +00:00
Andrew Beal
fb20108dc9 fix: improve conversation filtering and add plan cancellation
- Add toolId matching validation for function call/response pairs
- Filter orphaned function calls and responses with warnings
- Add CancelPlan function to abort plan execution
- Fix planning response handling in execution agent
- Pass clearThoughtOnContent flag through streaming pipeline
2025-12-31 13:42:33 +00:00
Andrew Beal
1b20533da9 refactor: return structured next step data instead of embedding in message
Previously the next step description was embedded in the completion message string.
Now return it as a separate structured object with step number, description,
instruction, and optional context for better programmatic access.
2025-12-30 22:42:23 +00:00
Andrew Beal
a4daa3a9df refactor: update tests for AIFunctionService and path alias changes
- Remove AIFunctionDefinitions mock from AI class tests
- Update IPrompt import path to AIPrompts directory
- Remove deprecated streamRequest boolean parameter
- Fix error handling assertions in AIFunctionService tests
- Remove ChatService sanitization and assistant message tests
- Add path aliases to tsconfig and vitest config
2025-12-30 21:58:54 +00:00
Andrew Beal
2de8109a74 refactor: restructure AI prompt and agent architecture for multi-agent planning support
- Move prompts from AIClasses to AIPrompts directory
- Replace centralized IPrompt injection with direct property setters on IAIClass
- Remove allowDestructiveActions parameter from streamRequest methods
- Add toolDefinitions, systemPrompt, and userInstruction properties to IAIClass
- Refactor AIFunctionDefinitions to static methods with agent-specific tool sets
- Add planning agent function definitions (CreatePlan, Replan, CompleteStep, SubmitPlan)
- Create AIControllerService to handle agent orchestration
- Add execution plan related copy strings and replacement utility
- Update all AI providers (Claude, Gemini, OpenAI) to use new architecture
2025-12-30 19:07:00 +00:00
Andrew Beal
989fab565d feat: implement prompt caching for Claude API requests
Add cache control to system prompt, tools, and conversation messages to optimize API performance and reduce costs by caching frequently reused content.
Update GitHub link to point directly to project page.
Improve prompt for user suggestion during actions that require confirmation.
Update unit tests.
Bump dependency versions.
2025-12-27 19:52:59 +00:00
Andrew Beal
42fb73383f Bump plugin version to 1.1.5 2025-12-23 23:01:03 +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
dde2120612 Bump plugin version to 1.1.4 2025-12-23 17:09:33 +00:00
Andrew Beal
3e19a08aa8 refactor: improve file upload error handling and return errors array
Replace errorMessage string with uploadErrors array in processAttachments
to provide structured error handling. Enhanced error messages to include
file names. Added getHeader helper method for case-insensitive header
lookups. Fixed Gemini upload to use contentType parameter instead of
Content-Type header.
2025-12-23 17:09:04 +00:00
Andrew Beal
7c1d222b44 Bump plugin version to 1.1.3 2025-12-23 16:04:14 +00:00
Andrew Beal
8db67a23e5 Migrate to mobile compatible api's for handling buffers.
- Add validation check for file ID after upload attempt
- Clear existing file ID before re-uploading to prevent stale IDs
- Replace Node.js Buffer with standard Uint8Array/ArrayBuffer for cross-platform compatibility
- Add missing Content-Type header for Gemini file uploads
- Update tests to use TextDecoder for ArrayBuffer inspection
2025-12-23 16:03:49 +00:00
Andrew Beal
28376053c4 Add exclusion filtering to active file retrieval
Enhance WorkSpaceService.getActiveFile() to filter out excluded files using VaultService.isExclusion(), preventing access to restricted paths. Add optional allowAccessToPluginRoot parameter for cases requiring access to plugin root directory. Update test expectations to match new method signature.
2025-12-23 14:08:10 +00:00
Andrew Beal
1814491289 Bump plugin version to 1.1.2 2025-12-23 13:53:41 +00:00
Andrew Beal
1e5f3a9a9b Bump dependency versions 2025-12-23 13:53:26 +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
2420cec7bf feat: add file monitoring guidelines to settings with provider-specific instructions
Add a new "File Monitoring Guidelines" section in plugin settings that displays provider-specific information about uploaded file retention and cleanup. The section includes a help button that opens the Plugin Guide modal and updates dynamically based on the selected AI provider (Claude, Gemini, or OpenAI). Also update help modal content with file monitoring information and fix example template link.
2025-12-20 15:11:40 +00:00
Andrew Beal
4d72bba087 Add page number tracking to search snippets
- Add pageNumber field to ISearchSnippet and IPageText interfaces
- Update extractSnippets to process content as paginated text
- Switch PDF reading to use readPDF helper for page extraction
- Update search results to include page numbers in snippets
- Add page number assertions to VaultService tests
2025-12-20 14:48:42 +00:00
Andrew Beal
051abbe43b Bump plugin version to 1.1.1 2025-12-20 11:38:22 +00:00
Andrew Beal
961904c471 Update project copy and readme. 2025-12-20 11:37:47 +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
59db78d610 refactor: extract attachment processing logic to base class
Consolidate duplicate file upload and error handling code from Claude, Gemini, and OpenAI into shared `processAttachments` method in BaseAIClass. Remove unnecessary abort service wrapping from BaseAIFileService retry logic.
2025-12-20 10:39:24 +00:00
Andrew Beal
e24a5a02bf Add light unit testing for BaseAIFileService. Replace custom array methods with standard JavaScript methods 2025-12-20 10:07:07 +00:00
Andrew Beal
2d19eee2b6 Update remaining unit tests. 2025-12-20 09:55:15 +00:00