2fce81e94d5d4060474ed1192ef6d407b22c888b
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d3ba4ee743 |
fix(injection): send newlines as Return on the xdotool backend (#962)
* fix(injection): send newlines as Return on the xdotool backend xdotool type maps '\n' to the Linefeed keysym, which GTK targets silently drop — "new line" produced nothing on X11 even though the segment reached the injector. Split each chunk on '\n' and press Return between typed segments so a newline lands as a real keypress in every app. Verified against a live GtkTextView on Xvfb: the same "A\nB" input that previously produced 'AB' now produces 'A\nB'. Fixes #955 * fix(commands): consume trailing punctuation after mid-utterance commands "New paragraph." inside a longer utterance substituted correctly but left the engine's sentence-final period typed after the break ("\\n\\n. Does this work now?"). Text-command substitution now consumes a run of trailing , . ! ? ; : … when it precedes whitespace or the end of the segment — the reporter's comma-phrased case ("…, new paragraph, …") stops leaking the stray comma the same way. A mark glued to following text ("newline.io") is untouched. Fixes #955 * fix(injection,commands): resume mid-chunk on retry, don't eat produced marks Greptile review follow-ups on #962: - A failed Return mid-chunk left 'typed' at the chunk start, so the retry re-sent text xdotool had already delivered. 'typed' now advances per typed segment and per Return keypress, so the retry resumes exactly at the un-typed position — and the clipboard fallback reports the same progress if retries run out. - _TRAILING_PUNCTUATION could consume a mark produced by an earlier command replacement ('hello new line exclamation mark' gave '\\n' instead of '\\n!'). The eater now only consumes marks before whitespace; the end-of-utterance case ('hello new line.') is a pre-pass on the raw segment before any substitution runs. * style: black-format comment indent and test condition * fix(commands): strip segment before the end-of-utterance cleanup Trailing whitespace ('hello new line. ') hid the final mark from the pre-pass: the raw segment ended in a space, and the stripped segment left the dot at end-of-string where the mid-utterance eater cannot touch it. Strip first, then run the cleanup. Also add the missing type hints on the new test helper. --------- Co-authored-by: Jatin K Malik <jatinkrmalik@gmail.com> |
||
|
|
0ddb127437 |
fix(commands): keep line breaks from standalone voice commands (#958)
* fix(commands): keep line breaks from standalone voice commands
Two stacked defects ate the newline "new line" / "new paragraph"
produce when spoken alone:
* _normalize_segment_text stripped all leading whitespace, so the
command's leading newline never reached the injector (a clean
"new line" segment was dropped entirely).
* whisper.cpp transcripts arrive punctuated ("New line."), which
missed the exact-match ladder and left a stray "." after the
substituted break, injected as ". ".
Normalize now strips only spaces/tabs, and the generic path
substitutes on a punctuation-stripped core when the whole segment
is command phrases, so engine edge punctuation cannot leak while
real text keeps it.
Fixes #955
* fix(injection): deliver newline-only segments to the focused app
inject_text treated whitespace-only text as empty and returned early,
so the "\n" a standalone "new line" now correctly produces was
discarded before any backend ran ("Empty text provided, skipping
injection"). Only a truly empty segment is skipped; whitespace-only
input is typed/pasted verbatim (xdotool types "\n" as Return).
Space/tab-only segments never reach this point: segment normalization
strips them upstream.
Fixes #955
* fix(injection): keep skipping space/tab-only segments
The previous commit let every whitespace-only string through, which
also delivered bare spaces and tabs a caller never wants typed.
Narrow the skip to text with no content outside space/tab so "\n"
still reaches the backend while " " stays a no-op (the pre-existing
test_empty_text_injection contract).
Fixes #955
* fix(injection): deliver newline segments over IBus too
IBusTextInjector.inject_text had the same whitespace guard and dropped
"\n" before it reached the engine socket; narrow it the same way so
a newline-only segment is sent while space/tab-only stays a no-op.
Also let capitalize_sentences uppercase the first letter after leading
whitespace, so Vosk + auto_capitalize keeps working on "\n hello".
Covers Greptile's findings: real-socket test for the IBus path, the
capitalize regression via the main() callback seam, and type hints on
the new injector tests.
Fixes #955
* test(injection): add type hints to new IBus socket test
AGENTS.md requires hints on every signature; the Greptile review
flagged the new test for missing them.
---------
Co-authored-by: Jatin K Malik <jatinkrmalik@gmail.com>
|
||
|
|
7664266823 |
feat(commands): localize punctuation voice commands (#640) (#642)
* feat(commands): localize punctuation voice commands by language Voice command phrases were English-only even when recognition language was set to Italian, French, etc. Merge locale punctuation/line-break aliases from the recognition language into CommandProcessor, keep English phrases available, and document the behavior. Fixes #640 Co-authored-by: Jatin K Malik <jatinkrmalik@users.noreply.github.com> * fix(commands): keep line breaks and French apostrophe aliases Attach-left punctuation now eats only horizontal whitespace, so a localized "new line" followed by a period or comma still inserts a newline. French aliases include ASCII, U+2019, and backtick apostrophes, and longest-match still wins so "point" cannot fire inside "point d'interrogation". --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Jatin K Malik <jatinkrmalik@users.noreply.github.com> |
||
|
|
38bacabee0 |
fix(command-processor): remove leading space from first speech (#234)
The command processor was adding a leading space when processing action commands with text after them (e.g., 'delete that text' -> ' text'). This was causing the first speech to always have an unwanted leading space. Changes: - Modified command_processor.py to only add space when there's text BEFORE the action command, not at the beginning of the transcription - Updated test cases to reflect the correct behavior without leading spaces Fixes leading space issue on first speech. |
||
|
|
94f71853e0 |
reliability: Microphone Reconnection and Audio Buffer Limits (#109)
* fix: implement microphone reconnection and audio buffer limits for reliability - Add microphone reconnection logic with exponential backoff - Implement audio buffer limits to prevent memory issues - Add configurable buffer size limits with clamping - Improve error handling for audio device failures - Add buffer statistics and monitoring capabilities - Graceful stream cleanup and resource management Resolves #92 Changes made: - Added _max_buffer_size, _reconnection_attempts, _max_reconnection_attempts attributes - Implemented _attempt_audio_reconnection() method with exponential backoff - Enhanced _record_audio() method with buffer limit checking and reconnection - Added set_buffer_limit() and get_buffer_stats() methods - Improved error handling for IOError/OSError during audio recording - Added test scripts to validate reliability improvements The implementation prevents memory issues by limiting audio buffer size and automatically reconnecting to audio devices when they fail, with proper exponential backoff to prevent rapid reconnection attempts. * fix: Address code review feedback for PR #109 - Add thread lock (_buffer_lock) for audio_buffer to prevent race conditions - Fix _last_audio_error_time reset in cleanup - Protect buffer access in stop_recognition and get_buffer_stats with lock - Fix test_max_reconnection_attempts to match actual counter behavior Addresses review feedback for microphone reconnection and audio buffer limits * style: fix lint errors * fix: add missing sys import in audio_feedback.py - Add sys import required by _is_ci_mode() function - Remove temporary test_reliability scripts * style: fix black formatting --------- Co-authored-by: OpenClaw Reviewer <review@openclaw.ai> |
||
|
|
9e5b632710 |
test: Improve test coverage to 80%+ (#122)
* test: Improve test coverage to 80% Increased test coverage from ~33% to 80.15% statement coverage. New test files added: - test_action_handler.py (100% coverage) - test_version.py (100% coverage) - test_logging_manager.py (100% coverage) - test_common_types.py - test_speech_recognition_init.py (100% coverage) - test_resource_manager.py (93% coverage) Significantly expanded existing tests: - test_tray_indicator.py: 76% -> 98% - test_main.py: 50% -> 92% - test_text_injector.py: 60% -> 94% - test_recognition_manager.py: 30% -> 48% - test_command_processor.py: 85% -> 98% - test_keyboard_shortcuts.py: 88% -> 95% - test_config_manager.py: improved to 98% - test_audio_feedback.py: improved to 92% Configuration changes: - Updated pyproject.toml to exclude untestable GTK dialog files (settings_dialog.py, logging_dialog.py) from coverage metrics Key testing improvements: - Added comprehensive GTK mocking for UI components - Added edge case tests for text injection on X11/Wayland - Added keyboard shortcut injection tests - Added error handling and callback tests - Added configuration management tests * fix: Use runtime CI mode detection to fix Python 3.8/3.10 tests Change CI_MODE from module-level constant to _is_ci_mode() function that is evaluated at runtime. This ensures pytest detection works correctly on all Python versions, since pytest modules may not be loaded at import time. * fix: Add PYTEST_RUNNING env var for reliable pytest detection in CI The previous approach to detect pytest at runtime wasn't working reliably on Python 3.8/3.10 in CI environments. This adds a PYTEST_RUNNING=1 environment variable set early in conftest.py that _is_ci_mode() can check to reliably determine if tests are running. * fix: Use patch.object for reliable mocking in audio_feedback tests The previous approach using patch() with module paths didn't work reliably because the module reimport caused the patched objects to not be the same as the ones the functions referenced. Using patch.object() on the imported module's attributes ensures the patches are applied to the actual objects the functions use. * fix: Use patch.object for reliable mocking in test_settings_callback The test was failing on Python 3.8/3.10 because the module-level patch for SettingsDialog wasn't being applied reliably across all Python versions due to import timing differences. Using patch.object() on the imported module ensures the mock is applied to the actual reference that _on_settings_clicked() uses, regardless of Python version or module caching behavior. |
||
|
|
1dc1d44665 |
feat: Alpha Launch v0.2.0 - Complete UX Overhaul 🚀🎤 (#39)
* feat: prepare for v0.2.0-alpha release * feat: prepare for v0.2.0-alpha release * chore: remove CHANGELOG.md, use GitHub Releases instead * refactor: use existing About dialog instead of Settings section * style: enhance About dialog UI readability * style: fix formatting with black and isort * feat: show VAD and silence timeout settings for Whisper engine - Renamed 'VOSK Settings' to 'Recognition Settings' - VAD Sensitivity and Silence Timeout now apply to both engines - Added tooltips explaining each setting - VOSK-specific model info only shown when VOSK selected * fix: resolve overlapping UI elements in settings dialog * fix: save VAD and silence timeout settings for both engines Previously these settings were only saved when VOSK was selected. Now they persist correctly for Whisper as well. * fix: show download progress when selecting undownloaded model Previously when auto-applying settings, models would download silently in the background without showing the progress dialog. Now: - Download progress dialog appears for undownloaded models - Model icons update correctly after download completes * feat: add download progress, speed, ETA and cancel button - Show real download progress percentage for VOSK models - Display download speed (MB/s) and estimated time remaining - Add Cancel button to abort downloads - Update status during extraction phase - Whisper downloads still pulse (uses internal downloader) * fix: defer model download until needed, don't block startup - App now starts instantly even if models aren't downloaded - Models are downloaded on-demand when selected in Settings - If user tries to dictate without a model, plays error sound - Added model_ready property to check if engine is usable * fix: improve first-run UX without downloaded models - Settings dialog now defaults to smallest available model, not saved config - Only show saved model if it's actually downloaded - Add desktop notification when trying to dictate without a model - Prevents auto-downloading large models on first launch * feat: add download progress tracking for Whisper models - Implement custom Whisper model download with progress/speed/ETA - Uses OpenAI's CDN URLs directly instead of whisper.load_model() - Progress callback works the same as VOSK downloads - Supports cancellation during download * fix: enable download progress callback for Whisper models Progress callback was only being set for VOSK downloads, not Whisper. Now both engines show real-time progress, speed, and ETA. * fix: update tests for defer_download and config manager mocking - test_main: Mock ConfigManager to prevent saved config from overriding test values - test_settings_dialog: Mock ModelDownloadDialog to prevent GTK init errors - test_speech_recognition: Use proper MockVoskModule class instead of MagicMock, pass defer_download=False for download test - test_whisper_support: Pass defer_download=False to trigger model loading in test * fix: resolve test failures for CI - test_main: Fix ConfigManager patch path to use source module - test_settings_dialog: Mock _is_vosk_model_downloaded and _is_whisper_model_downloaded to skip download flow, add missing dialog attributes - test_speech_recognition: Replace recognizer with properly configured mock that returns valid JSON, fixing test isolation issues when running all tests together * fix: mock _download_whisper_model in whisper test to avoid requests exception handling issue * fix: add gir1.2-girepository-2.0 dep for PyGObject on Ubuntu 24.04 - Add missing girepository-2.0 package for newer Ubuntu runners - Use --no-build-isolation for PyGObject to use system packages * fix: skip PyGObject pip install, use system python3-gi package - Use --no-deps for editable install to skip PyGObject - Install other deps explicitly without PyGObject - Add python3-gi-cairo for complete GTK support - Removes problematic girepository-2.0 build requirement * fix: install PyGObject via pip with proper build deps - Remove python3-gi/python3-gi-cairo (doesn't work with setup-python) - Install PyGObject from pip after installing build dependencies - Simplify venv setup without --system-site-packages hack * Fix GObject * fix: set GI_TYPELIB_PATH for pip-installed PyGObject to find AppIndicator3 |
||
|
|
b5af600714 |
Custom Icons Implementation and Package Restructuring (#21)
* Implement custom icon for Vocalinux (Closes #10) * Fix system tray icon display issue * Temp commit before purging * refactor: restructure project into proper vocalinux package * test: fix and improve audio_feedback and tray_indicator tests with proper mocking and isolation * test: update import paths in test files to use the new package structure * Remove icon background * fix: implement robust resource path discovery in audio_feedback module * fix: improve resource discovery across application for consistent icon and sound loading * chore: ensure uninstall script is compatible with new resource paths * Fix black formatting |
||
|
|
642be732db |
Fix test suite and improve code stability (#6)
* Improved test coverage for audio_feedback, main, and tray_indicator modules * Fix test suite and improve code stability * Black formatter changes * Fixing import sorting |
||
|
|
3645c692fd |
Test Structure Reorganization and CI Improvements (#5)
* Add GitHub Actions CI/CD workflows and status badges * Fix CI workflow dependency installation * Fix CI workflow: remove pip caching and add explicit requirements.txt * Fix CI workflow: add system dependencies for PyGObject and pycairo * Refactor code for improved readability and consistency - Cleaned up whitespace and formatting in audio_feedback.py, config_manager.py, keyboard_shortcuts.py, tray_indicator.py, run_basic_tests.py, and test_basic.py. - Enhanced the structure of the code by aligning comments and ensuring consistent indentation. - Updated function definitions and calls to maintain a uniform style across the codebase. - Improved logging messages for better clarity during debugging. - Ensured all files end with a newline for better compatibility with various tools. * Refactor imports for consistency and clarity across multiple modules * Fix test imports by setting PYTHONPATH and adding conftest.py * Update CI workflow to use Python 3.12 and ensure proper import path in tests * Fix CI: Add GObject Introspection development dependencies * Update CI: Use virtual environment like local setup * Fix CI * Update README and setup.py: Change Python version to 3.8 and correct author email * Restructure tests for better organization and maintainability * Fix formatting * Update CI workflow to remove redundant test step * Fix CI tests by properly mocking VOSK model loading * Update CI and Tests * Simplify |