Commit Graph
85 Commits
Author SHA1 Message Date
Jarvis 7aae6fa45b chore: release 1.2.0 1.2.0 2025-10-31 13:44:30 +01:00
AlexKucera 10a4a9f215 Merge pull request #1 from AlexKucera/dynamic-models
Adds dynamic Claude model fetching and management
2025-10-31 13:42:04 +01:00
AlexKucera 4cb2308bd6 Refines timed prompt notification duration logic
Adjusts notification duration calculation to improve timing precision for different delay intervals

Ensures consistent minimum notification display time while preventing potential overlap or flickering
2025-10-31 13:36:03 +01:00
AlexKucera 5bf804b266 Fixes pagination ID consistency in model sorting
Recomputes pagination first and last IDs after sorting models to ensure consistent
ID references match the sorted array order.

Prevents potential misalignment between sorted model list and pagination metadata
2025-10-31 13:35:49 +01:00
AlexKucera 9b8ff3181a Refines notification timing for timed prompts
Adjusts notification display duration calculation for more predictable behavior

Improves timing logic for prompts with different delay intervals:
- Ensures notifications end 500ms before next tick for delays >1s
- Maintains minimum 300ms display time to prevent flickering
- Keeps existing logic for short delay intervals
2025-10-31 13:21:00 +01:00
AlexKucera 9ee37cd087 Sanitizes writing prompts for consistent formatting
Prevents potential formatting issues by ensuring prompts are single-line and trimmed

Collapses multiple whitespaces and trims prompt text to maintain clean, uniform list rendering in markdown output
2025-10-31 13:20:31 +01:00
AlexKucera bdb4949c1b Adds input constraints to settings numeric fields
Improves user input validation for settings by:
- Adding min/max range limits to numeric settings
- Enforcing input type as number for better UX
- Ensures settings inputs have appropriate constraints

Validates timed count, delay, and note prompt settings with specific numeric ranges
2025-10-31 13:19:28 +01:00
AlexKucera d5af2a08ce Improves ping response validation robustness
Enhances API ping check to handle multiple text content blocks

Modifies response text extraction to:
- Process all text content blocks
- Support multiple text segments
- Normalize and validate ping response more comprehensively

Increases reliability of API connection verification
2025-10-31 13:17:36 +01:00
AlexKucera d31cec0383 Improves prompt notification duration calculation
Enhances notification display logic to prevent flicker and ensure minimum visibility

- Adds floor of 0 for delay milliseconds to prevent negative values
- Ensures minimum notification duration of 300ms to improve user experience
- Maintains existing logic for longer delay times
2025-10-25 10:49:40 +02:00
AlexKucera fc04d3f1af Improves model listing and prompt parsing logic
Adds sorting for model dropdown to ensure consistent user experience across sessions

Enhances prompt extraction by supporting more list prefix formats, improving robustness of text parsing
2025-10-25 10:49:01 +02:00
AlexKucera fca191b850 Simplifies note prompt selection and timestamp formatting
Refactors cursor handling to use setCursor instead of setSelection when collapsing selections

Improves timestamp generation by using environment's default locale automatically instead of manually specifying language

Enhances code clarity and simplifies locale handling for timestamp formatting
2025-10-25 10:48:02 +02:00
AlexKucera 2b9c8fbc5b Prevents cross-key model cache leakage
Clears model cache when API key changes to ensure accurate model list access

Prevents potential issues with stale model entitlements when switching API keys programmatically
2025-10-25 10:47:04 +02:00
AlexKucera 1c1cba6ce5 Enhances model selection and caching in settings
Improves model dropdown handling with debounced settings save
Adds model list cache clearing functionality
Handles edge cases for model availability and selection

Introduces more robust error handling for model dropdowns
Provides user control over model list refreshing
2025-10-25 10:46:20 +02:00
AlexKucera 4c03bed948 Refactors model fetching with deduplication strategy
Extracts common model fetching logic into shared method to prevent duplicate API calls

Improves error handling and caching for model retrieval by:
- Creating a centralized fetchWithDeduplication method
- Adding model type filtering in cache update
- Resetting fallback notice flag during cache clearing

Enhances reliability of model list retrieval across multiple service methods
2025-10-25 10:44:53 +02:00
AlexKucera 3f53bb5a30 Improves model list pagination with safety measures
Adds robust pagination handling for Anthropic model retrieval:
- Implements duplicate model filtering
- Adds iteration limit to prevent infinite loops
- Introduces cursor advancement validation
- Fixes potential API pagination edge cases

Ensures more reliable and predictable model list retrieval
2025-10-24 16:56:38 +02:00
AlexKucera b57fe8cd89 Adds deduplication for concurrent prompt generation
Prevents duplicate API calls by tracking in-flight requests
Ensures consistent prompt generation under high concurrency
Mitigates potential race conditions in prompt retrieval

Improves performance and reliability of prompt generation service
2025-10-24 16:55:05 +02:00
AlexKucera 902d2b1b9a Refines Anthropic model type and list definitions
Updates model type to use ModelId type for stronger type safety

Improves hardcoded model list with TODO for keeping it current
Removes outdated comments and simplifies model list annotations

Prepares for more dynamic model handling with explicit update guidance
2025-10-24 16:53:06 +02:00
AlexKucera ea14071d22 Improves notification duration calculation for timed prompts
Refines notification display timing logic to prevent flickering and ensure smoother user experience

Adjusts notification duration calculation for short delays, using a more nuanced approach that:
- Caps notification time at 900ms or delay-100ms for very short intervals
- Maintains existing behavior for longer delays
2025-10-24 16:51:35 +02:00
AlexKucera 329c12ab4b Refactors Anthropic API client configuration
Centralizes API base URL and version configuration for improved maintainability

Adds constants for API base URL and version to prevent potential drift
Normalizes API version header usage across request methods
Improves ping validation to handle variations in response text

Supports more robust and consistent API client configuration
2025-10-24 16:50:20 +02:00
AlexKucera a93c887cad Optimizes settings handling with debounce and async improvements
Introduces debounce mechanism for settings saves to reduce unnecessary disk writes

Refactors settings change handlers to:
- Improve performance by debouncing save operations
- Simplify async method handling
- Prevent excessive API calls and disk writes
- Add more robust handling of model loading and settings updates

Enhances user experience by minimizing unnecessary background operations
2025-10-24 16:46:59 +02:00
AlexKucera 8e6441ff7d Improves timestamp localization for note prompts
Uses the user's preferred language locale for timestamp formatting, enhancing regional customization and user experience

Allows automatic fallback to 'en-US' if navigator language is unavailable
2025-10-24 16:42:04 +02:00
AlexKucera 13645af300 Improves data loading with robust error handling
Adds comprehensive error handling for plugin data loading to prevent potential startup failures

Implements graceful fallback to default settings when data loading fails or is corrupted
Ensures plugin can initialize even with invalid or missing persistent data
Separates model cache extraction to prevent type drift and improve data integrity
2025-10-24 16:41:53 +02:00
AlexKucera c9adf05a82 Improves model fetching resilience and performance
Adds deduplication of concurrent API calls to prevent redundant requests

Enhances error handling by preferring stale cache over hardcoded fallback models
Introduces new getStaleCacheModels method to provide more robust model retrieval
Prevents multiple simultaneous model fetch attempts with in-flight request tracking
2025-10-24 16:37:45 +02:00
AlexKucera afa725df7f Enhances ESLint configuration for TypeScript project
Updates ESLint configuration to:
- Use latest globals for Node.js and browser environments
- Enable type-aware TypeScript ESLint rules
- Improve parser and ecmaVersion settings
- Add explicit TypeScript ESLint plugin

Increases code quality and type safety for the project
2025-10-24 16:35:01 +02:00
AlexKucera 893aae5bca Improves timed prompts command concurrency handling
Enhances execution flow to prevent race conditions during async prompt generation

Refines inProgress flag management to ensure reliable concurrent execution:
- Sets flag before async work begins
- Guarantees flag reset in finally block
- Prevents potential state inconsistencies during rapid command triggers

Clarifies code comments explaining concurrency protection mechanism
2025-10-24 13:48:25 +02:00
AlexKucera 52ea9de4c0 Improves model fallback and settings handling
Enhances model selection resilience by adding detailed fallback notifications

Adds model ID check before changing default model to prevent unnecessary updates
Improves user experience with more informative model unavailability notices
Removes redundant API key update and settings save operations

Supports dynamic model management on model refresh
2025-10-24 13:46:25 +02:00
AlexKucera 53e61abd3b Optimize settings and API key management
Improves settings loading and saving by preventing model cache merging and tracking API key changes

Prevents type drift in settings by destructuring saved data
Adds tracking of last API key to avoid unnecessary prompt generator updates
Ensures only meaningful settings are merged with defaults

Reduces redundant operations and improves plugin performance
2025-10-24 13:44:45 +02:00
AlexKucera 61788b39ad Enforces precise prompt generation count
Trims generated prompts to requested count

Ensures consistent user experience by slicing array if model over-generates
Prevents potential cache key mismatches due to inconsistent prompt counts
2025-10-24 13:41:44 +02:00
AlexKucera b76f085137 Improves model fetching with deduplication and notice control
Adds a session-based flag to prevent repeated fallback notices during API failures

Implements model list deduplication to handle potential duplicate entries
Prevents spamming users with repeated error notifications
Resets notice flag on successful model fetches to allow future warnings
2025-10-24 13:40:42 +02:00
AlexKucera e5c7a523c5 Improves Anthropic API client robustness
Enhances API client with more reliable pagination and response handling:
- Uses URLSearchParams for clearer parameter management
- Increases pagination limit to 1000 to reduce API calls
- Adds more robust content parsing for multi-block responses
- Implements stricter API health check validation

Ensures more predictable and resilient API interactions
2025-10-24 13:38:28 +02:00
AlexKucera cc1b452872 Extracts note command execute validation logic
Refactors active note validation into a dedicated static method for improved readability and reusability

Enhances code maintainability by centralizing the check for valid editor and view
2025-10-24 13:36:33 +02:00
AlexKucera c698a19345 Improves timed prompt notification duration calculation
Refines notification display duration for timed prompts to handle both short and long delay intervals

Adjusts duration calculation to:
- Cap notifications at 500ms for very short delays
- Subtract 500ms from longer delays to prevent prompt overlap
- Ensures smoother user experience during prompt sequences
2025-10-24 13:36:26 +02:00
AlexKucera db641cfe9d Updates ANTHROPIC_MODELS with latest model versions
Refreshes hardcoded fallback model list with recent Claude AI model releases

Adds newest model versions:
- Sonnet 4.5
- Haiku 4.5
- Opus 4.1

Reorganizes model list for clarity, keeping legacy models for backward compatibility
2025-10-24 13:33:50 +02:00
AlexKucera 456a2226ea Updates ESLint configuration to latest standards
Migrates ESLint configuration to new flat config format

Upgrades TypeScript and ESLint dependencies to latest versions
Removes legacy .eslintignore and .eslintrc files
Consolidates linting configuration into a single eslint.config.mjs file

Improves project code quality and linting consistency
2025-10-24 13:29:15 +02:00
AlexKucera da6056bf0d Improves prompt insertion logic and timestamp formatting
Refines text insertion handling for writing prompts:
- Collapses text selection before insertion
- Adds more intelligent newline management
- Uses Intl.DateTimeFormat for consistent timestamp generation

Enhances edge case handling for cursor and text positioning
2025-10-24 13:27:14 +02:00
AlexKucera ee7faef92b Adds debounce mechanism for API key refresh
Implements debounce timer to prevent excessive API calls when updating API key

Prevents rapid repeated model refreshes by:
- Adding a 500ms delay timer
- Clearing previous timers to avoid multiple concurrent requests
- Cleaning up timers when settings tab is hidden

Improves performance and reduces unnecessary API load during key entry
2025-10-24 13:13:49 +02:00
AlexKucera f9fefceac1 Adds pagination support for Anthropic models API
Enhances models fetching to handle paginated API responses

Implements robust pagination mechanism to retrieve all available models
- Continues fetching pages while 'has_more' is true
- Accumulates models across multiple API calls
- Preserves first and last page identifiers
- Ensures complete model list retrieval

Improves error handling and response validation
2025-10-24 13:12:32 +02:00
AlexKucera def8bbcfe5 Improves Anthropic models API response validation
Enhances type checking and validation for API response structure

Adds more robust type validation to ensure:
- Correct response object structure
- Presence of required model fields
- Type safety for model data retrieval

Prevents potential runtime errors by implementing stricter type checks
2025-10-24 13:11:06 +02:00
AlexKucera e96ef65200 Added DocStrings 2025-10-24 13:09:10 +02:00
AlexKucera 03d2b1c93d Adds robust model list response validation
Improves models API response handling by adding structural validation

Ensures that the API response contains an array of model data before processing
Prevents potential runtime errors from unexpected response formats
2025-10-24 13:00:31 +02:00
AlexKucera 361f946d87 Improves async model loading for settings UI
Refactors model loading to prevent UI blocking
Adds fallback mechanism for model selection
Ensures smooth dropdown population and model persistence

Handles cases where previously selected model may no longer be available
2025-10-24 13:00:02 +02:00
AlexKucera 92e109e2e8 Fixes timed prompts generation race condition
Reorders initialization of in-progress flag to prevent potential race conditions during timed prompt generation

Ensures that the in-progress status is set before stopping existing sequences and generates prompts
2025-10-24 12:59:19 +02:00
AlexKucera 6ccfb9e023 Optimizes token usage for timed prompts
Reduces max tokens for timed prompts to improve latency and cost-efficiency

Introduces dynamic max_tokens configuration based on prompt type, using a smaller token limit for time-sensitive requests
2025-10-24 11:29:33 +02:00
AlexKucera e8443a878d Improves model selection fallback handling
Adds null check when selecting fallback model to prevent potential errors

Ensures graceful handling when the current model becomes unavailable by verifying a fallback model exists before setting it
2025-10-24 11:27:50 +02:00
AlexKucera e06b07eb26 Adds API key validation and model sorting
Improves model retrieval by adding API key validation check for both model fetching methods

Adds fallback to predefined models when no API key is present
Sorts model lists alphabetically by display name for consistent presentation

Enhances robustness of model service handling
2025-10-24 11:26:48 +02:00
AlexKucera 7932663d2a Adds type refinement for dynamic model selection
Introduces ModelId type alias to clarify model ID intent
Refines prompt generator type to support specific prompt types
Improves type safety for model and prompt configuration
2025-10-24 11:25:36 +02:00
AlexKucera 435af4ccab Adds required Claude model validation check
Enforces Claude model selection as a mandatory setting

Prevents configuration submission without specifying a valid Claude model to ensure proper API interaction and prevent potential errors
2025-10-24 11:24:09 +02:00
AlexKucera 8e19f6bc8f Simplifies data loading and initialization logic
Combines data loading for settings and model cache
Reduces redundant data loading steps and improves initialization efficiency

Supports dynamic model handling on the dynamic-models branch
2025-10-24 11:23:29 +02:00
AlexKucera 766eb26df3 Improves model fetch error notification message
Updates error notification to provide clearer feedback when API model retrieval fails

Enhances user experience by making the fallback model list error message more descriptive and informative
2025-10-24 11:22:33 +02:00
AlexKucera 4164471ed0 Adds fallback for unavailable AI models
Handles scenario where previously selected AI model is no longer available

Automatically selects the first available model and notifies the user when their current model is removed, improving user experience and preventing potential configuration errors
2025-10-24 11:21:02 +02:00