python-voiceio 1.18.19__tar.gz → 1.18.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_voiceio-1.18.19/python_voiceio.egg-info → python_voiceio-1.18.20}/PKG-INFO +3 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/README.md +2 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/pyproject.toml +1 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20/python_voiceio.egg-info}/PKG-INFO +3 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/python_voiceio.egg-info/SOURCES.txt +5 -0
- python_voiceio-1.18.20/tests/test_architecture_ratchets.py +399 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_dead_mic.py +18 -4
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_hotkey_modes.py +19 -11
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_ibus_pids.py +17 -8
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_ibus_typer.py +26 -14
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_quiet.py +37 -7
- python_voiceio-1.18.20/tests/test_lifecycle_hardening.py +459 -0
- python_voiceio-1.18.20/tests/test_property_chaos.py +474 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_robustness.py +4 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_service.py +10 -6
- python_voiceio-1.18.20/tests/test_state_machine.py +711 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_streaming.py +30 -5
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_transcriber.py +7 -3
- python_voiceio-1.18.20/voiceio/__init__.py +1 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/app.py +264 -146
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/audio_source.py +8 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/config.py +13 -7
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/decoders/faster_whisper/__init__.py +79 -25
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/history.py +1 -13
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/hotkeys/base.py +5 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/hotkeys/evdev.py +45 -13
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/hotkeys/pynput_backend.py +20 -2
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/hotkeys/socket_backend.py +1 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/ibus/engine.py +5 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/ibus/session.py +20 -6
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/recorder.py +8 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/retention.py +1 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/server/app.py +84 -47
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/server/runtime.py +24 -22
- python_voiceio-1.18.20/voiceio/state.py +219 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/streaming.py +44 -49
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/clipboard.py +8 -15
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/manager.py +34 -21
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/paste.py +21 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/wtype.py +2 -5
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/xdotool.py +2 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/ydotool.py +5 -16
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/watchdog.py +19 -18
- python_voiceio-1.18.19/voiceio/__init__.py +0 -1
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/LICENSE +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/python_voiceio.egg-info/dependency_links.txt +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/python_voiceio.egg-info/entry_points.txt +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/python_voiceio.egg-info/requires.txt +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/python_voiceio.egg-info/top_level.txt +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/setup.cfg +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_announce.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_app_wiring.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_audio_devices.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_audio_quality.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_audio_source.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_backend_probes.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_cancel.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_cli.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_clipboard_read.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_clipboard_typer.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_commands.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_concurrency_lockdown.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_config.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_context_terms.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_corrections.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_cuda_setup_hint.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_decoders.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_engine.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_errorlog.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_evdev_uaccess.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_evdev_x11_optional.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_fallback.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_fcitx_bridge.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_feedback_stream.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_focus.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_gpu_fallback.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_health.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_hints.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_history.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_ibus_engine_limits.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_ibus_engine_listener.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_ibus_pending.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_ibus_ping.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_ibus_session.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_ibus_textlimit.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_idle_audio.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_input_latency.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_install_env.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_clean.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_import.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_language.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_metrics.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_pipeline.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_resume.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_review.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_summary.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_learn_targets.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_llm.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_llm_api.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_mic_gain.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_mic_test.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_modifier_guard.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_numbers.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_paste_last.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_pipeline.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_platform.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_postcorrect.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_postprocess.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_prebuffer.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_presence.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_prompt.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_quiet_audio.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_recorder_integration.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_replies.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_report.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_retention.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_security_hardening.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_server.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_setup.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_setup_sherpa_install.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_sherpa.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_silent_tail.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_spool.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_suggest.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_telemetry.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_tokens.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_tray.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_tts.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_tts_socket.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_typer_manager.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_vad.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_vocabulary.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_wordfreq.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/tests/test_worker_decode.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/__main__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/announce.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/audio_devices.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/backends.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/configcmd.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/corrections.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/doctor.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/history.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/learn.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/models.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/replies.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/servicecmd.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/uninstall.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/cli/vocab.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/clipboard_read.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/commands.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/consent.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/context_terms.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/bias.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/decoders/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/decoders/base.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/decoders/catalog.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/decoders/faster_whisper/worker.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/decoders/fetch.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/decoders/lanes.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/decoders/sherpa.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/decoders/whispercpp.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/engine.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/core/pipeline.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/corrections.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/data/60-voiceio-uaccess.rules +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/data/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/demo.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/display.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/errorlog.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/feedback.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/focus.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/health.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/hints.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/hotkeys/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/hotkeys/chain.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/ibus/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/ibus/install.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/ibus/pending.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/ibus/textlimit.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/idle_audio.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/install_env.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/augment.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/clean.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/evaluate.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/importer.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/lastrun.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/metrics.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/quiet.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/review.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/store.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/summary.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/teacher.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/learn/train.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/llm.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/llm_api.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/mic_gain.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/models/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/models/silero_vad.onnx +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/numbers.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/pidlock.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/platform.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/postcorrect.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/postprocess.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/power.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/presence.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/privacy.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/prompt.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/quiet_audio.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/replies.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/report.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/server/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/server/__main__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/server/config.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/service.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/setup/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/setup/configfile.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/setup/extras.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/setup/hotkey.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/setup/noninteractive.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/setup/speech.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/setup/steps.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/setup/system.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/setup/ui.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/sounds/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/sounds/alert.wav +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/sounds/commit.wav +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/sounds/start.wav +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/sounds/stop.wav +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/spool.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/suggest.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/telemetry.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tokens.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tray/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tray/_icons.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tray/_indicator.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tray/_pystray.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tts/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tts/base.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tts/chain.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tts/edge_engine.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tts/espeak.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tts/piper_engine.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tts/player.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/tts/supertonic_engine.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/__init__.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/base.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/chain.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/collecting.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/fcitx_bridge.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/ibus.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/modifier_guard.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/typers/pynput_type.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/ui.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/vad.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/vocab_stats.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/vocabulary.py +0 -0
- {python_voiceio-1.18.19 → python_voiceio-1.18.20}/voiceio/wordfreq.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-voiceio
|
|
3
|
-
Version: 1.18.
|
|
3
|
+
Version: 1.18.20
|
|
4
4
|
Summary: Voice dictation for Linux. Speak → text, locally, instantly.
|
|
5
5
|
Author: Hugo Montenegro
|
|
6
6
|
License-Expression: MIT
|
|
@@ -88,6 +88,8 @@ pipx install 'python-voiceio[desktop]' # or: uv tool install 'python-voicei
|
|
|
88
88
|
voiceio setup # model, hotkey, autostart
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
Fedora 45 and later ship Python 3.15, which onnxruntime has no wheels for yet: also `sudo dnf install python3.14 python3.14-devel`, then install with `pipx install --python python3.14 'python-voiceio[desktop]'`.
|
|
92
|
+
|
|
91
93
|
`uvx` is fine for a quick try, but run `voiceio setup` from a `pipx` or `uv tool` install: uvx runs from uv's cache, which uv deletes on `uv cache clean`, and the autostart service would point there.
|
|
92
94
|
|
|
93
95
|
**Or as a Debian/Ubuntu package** (new; bundles everything, nothing to compile):
|
|
@@ -35,6 +35,8 @@ pipx install 'python-voiceio[desktop]' # or: uv tool install 'python-voicei
|
|
|
35
35
|
voiceio setup # model, hotkey, autostart
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
Fedora 45 and later ship Python 3.15, which onnxruntime has no wheels for yet: also `sudo dnf install python3.14 python3.14-devel`, then install with `pipx install --python python3.14 'python-voiceio[desktop]'`.
|
|
39
|
+
|
|
38
40
|
`uvx` is fine for a quick try, but run `voiceio setup` from a `pipx` or `uv tool` install: uvx runs from uv's cache, which uv deletes on `uv cache clean`, and the autostart service would point there.
|
|
39
41
|
|
|
40
42
|
**Or as a Debian/Ubuntu package** (new; bundles everything, nothing to compile):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-voiceio
|
|
3
|
-
Version: 1.18.
|
|
3
|
+
Version: 1.18.20
|
|
4
4
|
Summary: Voice dictation for Linux. Speak → text, locally, instantly.
|
|
5
5
|
Author: Hugo Montenegro
|
|
6
6
|
License-Expression: MIT
|
|
@@ -88,6 +88,8 @@ pipx install 'python-voiceio[desktop]' # or: uv tool install 'python-voicei
|
|
|
88
88
|
voiceio setup # model, hotkey, autostart
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
+
Fedora 45 and later ship Python 3.15, which onnxruntime has no wheels for yet: also `sudo dnf install python3.14 python3.14-devel`, then install with `pipx install --python python3.14 'python-voiceio[desktop]'`.
|
|
92
|
+
|
|
91
93
|
`uvx` is fine for a quick try, but run `voiceio setup` from a `pipx` or `uv tool` install: uvx runs from uv's cache, which uv deletes on `uv cache clean`, and the autostart service would point there.
|
|
92
94
|
|
|
93
95
|
**Or as a Debian/Ubuntu package** (new; bundles everything, nothing to compile):
|
|
@@ -9,6 +9,7 @@ python_voiceio.egg-info/requires.txt
|
|
|
9
9
|
python_voiceio.egg-info/top_level.txt
|
|
10
10
|
tests/test_announce.py
|
|
11
11
|
tests/test_app_wiring.py
|
|
12
|
+
tests/test_architecture_ratchets.py
|
|
12
13
|
tests/test_audio_devices.py
|
|
13
14
|
tests/test_audio_quality.py
|
|
14
15
|
tests/test_audio_source.py
|
|
@@ -59,6 +60,7 @@ tests/test_learn_resume.py
|
|
|
59
60
|
tests/test_learn_review.py
|
|
60
61
|
tests/test_learn_summary.py
|
|
61
62
|
tests/test_learn_targets.py
|
|
63
|
+
tests/test_lifecycle_hardening.py
|
|
62
64
|
tests/test_llm.py
|
|
63
65
|
tests/test_llm_api.py
|
|
64
66
|
tests/test_mic_gain.py
|
|
@@ -73,6 +75,7 @@ tests/test_postprocess.py
|
|
|
73
75
|
tests/test_prebuffer.py
|
|
74
76
|
tests/test_presence.py
|
|
75
77
|
tests/test_prompt.py
|
|
78
|
+
tests/test_property_chaos.py
|
|
76
79
|
tests/test_quiet_audio.py
|
|
77
80
|
tests/test_recorder_integration.py
|
|
78
81
|
tests/test_replies.py
|
|
@@ -87,6 +90,7 @@ tests/test_setup_sherpa_install.py
|
|
|
87
90
|
tests/test_sherpa.py
|
|
88
91
|
tests/test_silent_tail.py
|
|
89
92
|
tests/test_spool.py
|
|
93
|
+
tests/test_state_machine.py
|
|
90
94
|
tests/test_streaming.py
|
|
91
95
|
tests/test_suggest.py
|
|
92
96
|
tests/test_telemetry.py
|
|
@@ -142,6 +146,7 @@ voiceio/report.py
|
|
|
142
146
|
voiceio/retention.py
|
|
143
147
|
voiceio/service.py
|
|
144
148
|
voiceio/spool.py
|
|
149
|
+
voiceio/state.py
|
|
145
150
|
voiceio/streaming.py
|
|
146
151
|
voiceio/suggest.py
|
|
147
152
|
voiceio/telemetry.py
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
"""Architectural CI ratchets and exhaustive finite-table verification.
|
|
2
|
+
|
|
3
|
+
These tests enforce structural invariants directly against the production AST
|
|
4
|
+
and tables so architectural entropy cannot creep back in silently:
|
|
5
|
+
1. Single owner for daemon state mutations (no scattered state writes).
|
|
6
|
+
2. Single canonical source of truth for `DEBOUNCE_SECS`.
|
|
7
|
+
3. Headless import boundary (no desktop-only module-level imports in core/server).
|
|
8
|
+
4. Atomic 0600 persistence on history and retention rewrites.
|
|
9
|
+
5. Wayland 4096-byte IBus safety boundary (`VoiceIOEngine.preedit`/`commit`).
|
|
10
|
+
6. No dead duplicate diff helpers anywhere in `voiceio/streaming.py`.
|
|
11
|
+
7. Exhaustive reachability, partition, and totality proofs over production
|
|
12
|
+
finite state and backend chain tables.
|
|
13
|
+
"""
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import ast
|
|
17
|
+
import functools
|
|
18
|
+
from collections import deque
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
from voiceio.hotkeys import chain as hotkey_chain
|
|
22
|
+
from voiceio.state import (
|
|
23
|
+
ALLOWED_TRANSITIONS,
|
|
24
|
+
DaemonEvent,
|
|
25
|
+
DaemonState,
|
|
26
|
+
DaemonStateMachine,
|
|
27
|
+
ToggleAction,
|
|
28
|
+
)
|
|
29
|
+
from voiceio.typers import chain as typer_chain
|
|
30
|
+
|
|
31
|
+
SRC_ROOT = Path(__file__).resolve().parent.parent / "voiceio"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@functools.lru_cache(maxsize=1)
|
|
35
|
+
def _parsed_sources() -> dict[str, ast.Module]:
|
|
36
|
+
"""Parse every Python module under voiceio/ once per test session."""
|
|
37
|
+
return {
|
|
38
|
+
py.relative_to(SRC_ROOT).as_posix(): ast.parse(
|
|
39
|
+
py.read_text(encoding="utf-8"),
|
|
40
|
+
filename=py.relative_to(SRC_ROOT).as_posix(),
|
|
41
|
+
)
|
|
42
|
+
for py in sorted(SRC_ROOT.rglob("*.py"))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _iter_target_nodes(target: ast.AST):
|
|
47
|
+
"""Yield leaf assignment targets, unpacking tuples and lists."""
|
|
48
|
+
if isinstance(target, (ast.Tuple, ast.List)):
|
|
49
|
+
for elt in target.elts:
|
|
50
|
+
yield from _iter_target_nodes(elt)
|
|
51
|
+
else:
|
|
52
|
+
yield target
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _is_state_enum_value(node: ast.AST | None) -> bool:
|
|
56
|
+
"""True if AST expression directly evaluates to DaemonState.* / _State.*
|
|
57
|
+
(including conditional expressions and tuples, excluding nested lambdas/calls)."""
|
|
58
|
+
if node is None:
|
|
59
|
+
return False
|
|
60
|
+
if isinstance(node, ast.Attribute):
|
|
61
|
+
if isinstance(node.value, ast.Name) and node.value.id in ("DaemonState", "_State"):
|
|
62
|
+
return True
|
|
63
|
+
if (isinstance(node.value, ast.Attribute)
|
|
64
|
+
and node.value.attr in ("DaemonState", "_State")):
|
|
65
|
+
return True
|
|
66
|
+
return False
|
|
67
|
+
if isinstance(node, ast.IfExp):
|
|
68
|
+
return _is_state_enum_value(node.body) or _is_state_enum_value(node.orelse)
|
|
69
|
+
if isinstance(node, (ast.Tuple, ast.List)):
|
|
70
|
+
return any(_is_state_enum_value(elt) for elt in node.elts)
|
|
71
|
+
return False
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# ── AST Architectural Ratchets ──────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def test_single_owner_for_daemon_state_mutations():
|
|
78
|
+
"""Daemon state transitions must go through DaemonStateMachine methods in
|
|
79
|
+
voiceio/state.py:
|
|
80
|
+
- voiceio/app.py has zero `._state =`, `.state =` on state-machine attrs,
|
|
81
|
+
or `setattr(..., "_state"|"state", ...)` outside VoiceIO._state.setter.
|
|
82
|
+
- No module outside voiceio/state.py assigns DaemonState.* / _State.* to
|
|
83
|
+
an object attribute (local variables like `expected = DaemonState.IDLE`
|
|
84
|
+
are allowed).
|
|
85
|
+
"""
|
|
86
|
+
sources = _parsed_sources()
|
|
87
|
+
app_tree = sources["app.py"]
|
|
88
|
+
app_offenders: list[str] = []
|
|
89
|
+
|
|
90
|
+
def scan_app(node: ast.AST, in_state_setter: bool = False) -> None:
|
|
91
|
+
if isinstance(node, ast.FunctionDef) and node.name == "_state":
|
|
92
|
+
is_setter = any(
|
|
93
|
+
isinstance(d, ast.Attribute) and d.attr == "setter"
|
|
94
|
+
for d in node.decorator_list
|
|
95
|
+
)
|
|
96
|
+
if is_setter:
|
|
97
|
+
return # legacy compatibility setter for test fixtures
|
|
98
|
+
if isinstance(node, (ast.Assign, ast.AnnAssign)):
|
|
99
|
+
targets = node.targets if isinstance(node, ast.Assign) else [node.target]
|
|
100
|
+
for raw_t in targets:
|
|
101
|
+
for t in _iter_target_nodes(raw_t):
|
|
102
|
+
if isinstance(t, ast.Attribute) and t.attr == "_state":
|
|
103
|
+
app_offenders.append(f"app.py:{node.lineno} (._state)")
|
|
104
|
+
elif (isinstance(t, ast.Attribute) and t.attr == "state"
|
|
105
|
+
and isinstance(t.value, (ast.Name, ast.Attribute))):
|
|
106
|
+
name = t.value.id if isinstance(t.value, ast.Name) else t.value.attr
|
|
107
|
+
if name in ("_sm", "sm"):
|
|
108
|
+
app_offenders.append(f"app.py:{node.lineno} ({name}.state)")
|
|
109
|
+
elif (isinstance(node, ast.Call)
|
|
110
|
+
and isinstance(node.func, ast.Name) and node.func.id == "setattr"
|
|
111
|
+
and len(node.args) >= 2
|
|
112
|
+
and isinstance(node.args[1], ast.Constant)
|
|
113
|
+
and node.args[1].value in ("_state", "state")):
|
|
114
|
+
app_offenders.append(f"app.py:{node.lineno} (setattr)")
|
|
115
|
+
for child in ast.iter_child_nodes(node):
|
|
116
|
+
scan_app(child, in_state_setter)
|
|
117
|
+
|
|
118
|
+
scan_app(app_tree)
|
|
119
|
+
assert not app_offenders, f"Direct daemon state mutations in app.py: {app_offenders}"
|
|
120
|
+
|
|
121
|
+
attr_enum_offenders: list[str] = []
|
|
122
|
+
for rel, tree in sources.items():
|
|
123
|
+
if rel == "state.py":
|
|
124
|
+
continue
|
|
125
|
+
for node in ast.walk(tree):
|
|
126
|
+
if not isinstance(node, (ast.Assign, ast.AnnAssign)):
|
|
127
|
+
continue
|
|
128
|
+
if not _is_state_enum_value(node.value):
|
|
129
|
+
continue
|
|
130
|
+
targets = node.targets if isinstance(node, ast.Assign) else [node.target]
|
|
131
|
+
for raw_t in targets:
|
|
132
|
+
for t in _iter_target_nodes(raw_t):
|
|
133
|
+
if isinstance(t, ast.Attribute):
|
|
134
|
+
attr_enum_offenders.append(f"{rel}:{node.lineno}")
|
|
135
|
+
assert not attr_enum_offenders, (
|
|
136
|
+
f"Direct DaemonState attribute assignment outside state.py: {attr_enum_offenders}"
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def test_debounce_secs_has_single_definition():
|
|
141
|
+
"""DEBOUNCE_SECS must be defined (via Assign or AnnAssign) ONLY in
|
|
142
|
+
voiceio/hotkeys/base.py; every other module must import it."""
|
|
143
|
+
defs: list[str] = []
|
|
144
|
+
for rel, tree in _parsed_sources().items():
|
|
145
|
+
for node in ast.walk(tree):
|
|
146
|
+
if not isinstance(node, (ast.Assign, ast.AnnAssign)):
|
|
147
|
+
continue
|
|
148
|
+
if node.value is None:
|
|
149
|
+
continue
|
|
150
|
+
targets = node.targets if isinstance(node, ast.Assign) else [node.target]
|
|
151
|
+
for raw_t in targets:
|
|
152
|
+
for t in _iter_target_nodes(raw_t):
|
|
153
|
+
name = t.id if isinstance(t, ast.Name) else (
|
|
154
|
+
t.attr if isinstance(t, ast.Attribute) else None
|
|
155
|
+
)
|
|
156
|
+
if name in ("DEBOUNCE_SECS", "_DEBOUNCE_SECS"):
|
|
157
|
+
defs.append(f"{rel}:{node.lineno}")
|
|
158
|
+
assert len(defs) == 1 and defs[0].startswith("hotkeys/base.py:"), (
|
|
159
|
+
f"Expected single DEBOUNCE_SECS definition in hotkeys/base.py, found: {defs}"
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def test_headless_modules_never_import_desktop_deps_at_module_load():
|
|
164
|
+
"""Core, server, streaming, state, display, and audio_source must stay
|
|
165
|
+
importable on headless servers without desktop-only libraries — checking
|
|
166
|
+
all module-level statements including if/try blocks (excluding function
|
|
167
|
+
bodies and TYPE_CHECKING blocks)."""
|
|
168
|
+
desktop_only = {"sounddevice", "evdev", "pynput", "pystray", "PIL", "gi"}
|
|
169
|
+
sources = _parsed_sources()
|
|
170
|
+
headless_rels = [
|
|
171
|
+
rel for rel in sources
|
|
172
|
+
if rel in ("state.py", "streaming.py", "display.py", "audio_source.py")
|
|
173
|
+
or rel.startswith("core/")
|
|
174
|
+
or rel.startswith("server/")
|
|
175
|
+
]
|
|
176
|
+
offenders: list[str] = []
|
|
177
|
+
|
|
178
|
+
def is_type_checking(test: ast.AST) -> bool:
|
|
179
|
+
return isinstance(test, ast.Name) and test.id == "TYPE_CHECKING"
|
|
180
|
+
|
|
181
|
+
def scan_module_level(stmts: list[ast.stmt], rel: str) -> None:
|
|
182
|
+
for stmt in stmts:
|
|
183
|
+
if isinstance(stmt, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)):
|
|
184
|
+
continue # lazy imports inside functions/methods are allowed
|
|
185
|
+
if isinstance(stmt, ast.Import):
|
|
186
|
+
for alias in stmt.names:
|
|
187
|
+
root = alias.name.split(".")[0]
|
|
188
|
+
if root in desktop_only:
|
|
189
|
+
offenders.append(f"{rel}:{stmt.lineno} imports {alias.name}")
|
|
190
|
+
elif isinstance(stmt, ast.ImportFrom) and stmt.module:
|
|
191
|
+
root = stmt.module.split(".")[0]
|
|
192
|
+
if root in desktop_only:
|
|
193
|
+
offenders.append(f"{rel}:{stmt.lineno} imports from {stmt.module}")
|
|
194
|
+
elif isinstance(stmt, ast.If):
|
|
195
|
+
if not is_type_checking(stmt.test):
|
|
196
|
+
scan_module_level(stmt.body, rel)
|
|
197
|
+
scan_module_level(stmt.orelse, rel)
|
|
198
|
+
elif isinstance(stmt, ast.Try):
|
|
199
|
+
scan_module_level(stmt.body, rel)
|
|
200
|
+
for h in stmt.handlers:
|
|
201
|
+
scan_module_level(h.body, rel)
|
|
202
|
+
scan_module_level(stmt.orelse, rel)
|
|
203
|
+
scan_module_level(stmt.finalbody, rel)
|
|
204
|
+
elif isinstance(stmt, (ast.With, ast.For, ast.While)):
|
|
205
|
+
scan_module_level(stmt.body, rel)
|
|
206
|
+
if hasattr(stmt, "orelse"):
|
|
207
|
+
scan_module_level(stmt.orelse, rel)
|
|
208
|
+
|
|
209
|
+
for rel in headless_rels:
|
|
210
|
+
scan_module_level(sources[rel].body, rel)
|
|
211
|
+
assert not offenders, f"Desktop-only module-load imports in headless modules: {offenders}"
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def test_sensitive_persistence_uses_atomic_secure_write():
|
|
215
|
+
"""history.py and retention.py must rewrite files via config.secure_write(),
|
|
216
|
+
never via non-atomic write_text/write_bytes or truncating open(..., 'w')."""
|
|
217
|
+
sources = _parsed_sources()
|
|
218
|
+
offenders: list[str] = []
|
|
219
|
+
secure_write_calls: dict[str, int] = {"history.py": 0, "retention.py": 0}
|
|
220
|
+
|
|
221
|
+
for rel in ("history.py", "retention.py"):
|
|
222
|
+
tree = sources[rel]
|
|
223
|
+
for node in ast.walk(tree):
|
|
224
|
+
if not isinstance(node, ast.Call):
|
|
225
|
+
continue
|
|
226
|
+
if isinstance(node.func, ast.Attribute):
|
|
227
|
+
if node.func.attr in ("write_text", "write_bytes"):
|
|
228
|
+
offenders.append(f"{rel}:{node.lineno} (.{node.func.attr})")
|
|
229
|
+
elif node.func.attr == "secure_write":
|
|
230
|
+
secure_write_calls[rel] += 1
|
|
231
|
+
elif (node.func.attr == "open"
|
|
232
|
+
and not (isinstance(node.func.value, ast.Name)
|
|
233
|
+
and node.func.value.id == "wave")):
|
|
234
|
+
mode_args = [
|
|
235
|
+
a.value for a in node.args
|
|
236
|
+
if isinstance(a, ast.Constant) and isinstance(a.value, str)
|
|
237
|
+
] + [
|
|
238
|
+
kw.value.value for kw in node.keywords
|
|
239
|
+
if kw.arg == "mode" and isinstance(kw.value, ast.Constant)
|
|
240
|
+
and isinstance(kw.value.value, str)
|
|
241
|
+
]
|
|
242
|
+
if any("w" in m for m in mode_args):
|
|
243
|
+
offenders.append(f"{rel}:{node.lineno} (Path.open write)")
|
|
244
|
+
elif isinstance(node.func, ast.Name) and node.func.id == "open":
|
|
245
|
+
mode = None
|
|
246
|
+
if len(node.args) >= 2 and isinstance(node.args[1], ast.Constant):
|
|
247
|
+
mode = node.args[1].value
|
|
248
|
+
for kw in node.keywords:
|
|
249
|
+
if kw.arg == "mode" and isinstance(kw.value, ast.Constant):
|
|
250
|
+
mode = kw.value.value
|
|
251
|
+
if isinstance(mode, str) and "w" in mode:
|
|
252
|
+
offenders.append(f"{rel}:{node.lineno} (open({mode!r}))")
|
|
253
|
+
|
|
254
|
+
assert not offenders, f"Non-atomic writes in sensitive persistence modules: {offenders}"
|
|
255
|
+
assert secure_write_calls["history.py"] >= 1
|
|
256
|
+
assert secure_write_calls["retention.py"] >= 1
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def test_ibus_engine_only_emits_bounded_text():
|
|
260
|
+
"""All calls to update_preedit_text / update_preedit_text_with_mode /
|
|
261
|
+
commit_text in voiceio/ibus/engine.py must stay inside VoiceIOEngine.preedit()
|
|
262
|
+
or VoiceIOEngine.commit(), and those methods must call tail_utf8 / split_utf8."""
|
|
263
|
+
tree = _parsed_sources()["ibus/engine.py"]
|
|
264
|
+
sanctioned = {
|
|
265
|
+
"update_preedit_text": ("VoiceIOEngine", "preedit"),
|
|
266
|
+
"update_preedit_text_with_mode": ("VoiceIOEngine", "preedit"),
|
|
267
|
+
"commit_text": ("VoiceIOEngine", "commit"),
|
|
268
|
+
}
|
|
269
|
+
offenders: list[str] = []
|
|
270
|
+
seen_bounds = {"preedit": False, "commit": False}
|
|
271
|
+
|
|
272
|
+
def scan(node: ast.AST, cls_name: str | None, fn_stack: tuple[str, ...]) -> None:
|
|
273
|
+
if isinstance(node, ast.ClassDef):
|
|
274
|
+
cls_name = node.name
|
|
275
|
+
elif isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
|
|
276
|
+
fn_stack = (*fn_stack, node.name)
|
|
277
|
+
if isinstance(node, ast.Call):
|
|
278
|
+
if isinstance(node.func, ast.Attribute):
|
|
279
|
+
req = sanctioned.get(node.func.attr)
|
|
280
|
+
if req is not None:
|
|
281
|
+
req_cls, req_fn = req
|
|
282
|
+
if cls_name != req_cls or req_fn not in fn_stack:
|
|
283
|
+
offenders.append(
|
|
284
|
+
f"ibus/engine.py:{node.lineno} {node.func.attr} in "
|
|
285
|
+
f"{cls_name or '<module>'}.{'/'.join(fn_stack) or '<top>'}"
|
|
286
|
+
)
|
|
287
|
+
elif isinstance(node.func, ast.Name):
|
|
288
|
+
if cls_name == "VoiceIOEngine" and "preedit" in fn_stack and node.func.id == "tail_utf8":
|
|
289
|
+
seen_bounds["preedit"] = True
|
|
290
|
+
if cls_name == "VoiceIOEngine" and "commit" in fn_stack and node.func.id == "split_utf8":
|
|
291
|
+
seen_bounds["commit"] = True
|
|
292
|
+
for child in ast.iter_child_nodes(node):
|
|
293
|
+
scan(child, cls_name, fn_stack)
|
|
294
|
+
|
|
295
|
+
scan(tree, None, ())
|
|
296
|
+
assert not offenders, f"Unbounded IBus text call outside VoiceIOEngine.preedit/commit: {offenders}"
|
|
297
|
+
assert seen_bounds["preedit"], "VoiceIOEngine.preedit must bound text via tail_utf8"
|
|
298
|
+
assert seen_bounds["commit"], "VoiceIOEngine.commit must bound text via split_utf8"
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def test_no_duplicate_diff_helpers_in_streaming():
|
|
302
|
+
"""Text-diff helpers live canonically in voiceio/display.py, never copied
|
|
303
|
+
anywhere (top-level, method, or nested) in voiceio/streaming.py."""
|
|
304
|
+
tree = _parsed_sources()["streaming.py"]
|
|
305
|
+
defs = {
|
|
306
|
+
node.name
|
|
307
|
+
for node in ast.walk(tree)
|
|
308
|
+
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef))
|
|
309
|
+
}
|
|
310
|
+
forbidden = {"_common_prefix_len", "_clean_word", "_word_match_len"}
|
|
311
|
+
assert not (defs & forbidden), f"Duplicate diff helpers in streaming.py: {defs & forbidden}"
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
# ── Exhaustive Finite-Table Proofs ──────────────────────────────────────
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def test_daemon_state_partition_and_reachability_proof():
|
|
318
|
+
"""Universal finite-state proof over voiceio.state.ALLOWED_TRANSITIONS:
|
|
319
|
+
1. IDLE, active ({RECORDING, FINALIZING}), and ERROR form an exact disjoint
|
|
320
|
+
partition of DaemonState.
|
|
321
|
+
2. Every DaemonState is reachable from IDLE.
|
|
322
|
+
3. Every DaemonState has a finite recovery/completion path back to IDLE
|
|
323
|
+
(zero absorbing trap states).
|
|
324
|
+
4. Safety properties hold universally across all edges in the table.
|
|
325
|
+
"""
|
|
326
|
+
idle = {DaemonState.IDLE}
|
|
327
|
+
active = {DaemonState.RECORDING, DaemonState.FINALIZING}
|
|
328
|
+
error = {DaemonState.ERROR}
|
|
329
|
+
all_states = set(DaemonState)
|
|
330
|
+
|
|
331
|
+
# Exact disjoint partition
|
|
332
|
+
assert idle | active | error == all_states
|
|
333
|
+
assert not (idle & active) and not (idle & error) and not (active & error)
|
|
334
|
+
|
|
335
|
+
# Build adjacency graph directly from production ALLOWED_TRANSITIONS
|
|
336
|
+
adj: dict[DaemonState, set[DaemonState]] = {s: set() for s in DaemonState}
|
|
337
|
+
for (src, _ev), dst in ALLOWED_TRANSITIONS.items():
|
|
338
|
+
adj[src].add(dst)
|
|
339
|
+
|
|
340
|
+
def reachable(start: DaemonState) -> set[DaemonState]:
|
|
341
|
+
seen = {start}
|
|
342
|
+
q = deque([start])
|
|
343
|
+
while q:
|
|
344
|
+
cur = q.popleft()
|
|
345
|
+
for nxt in adj[cur]:
|
|
346
|
+
if nxt not in seen:
|
|
347
|
+
seen.add(nxt)
|
|
348
|
+
q.append(nxt)
|
|
349
|
+
return seen
|
|
350
|
+
|
|
351
|
+
# Every state is reachable from IDLE
|
|
352
|
+
assert reachable(DaemonState.IDLE) == all_states
|
|
353
|
+
# No trap state: IDLE is reachable from every state
|
|
354
|
+
for state in DaemonState:
|
|
355
|
+
assert DaemonState.IDLE in reachable(state), f"{state} cannot reach IDLE"
|
|
356
|
+
|
|
357
|
+
# Universal edge invariants
|
|
358
|
+
assert ALLOWED_TRANSITIONS[(DaemonState.RECORDING, DaemonEvent.DECODER_FAILED)] is DaemonState.RECORDING
|
|
359
|
+
assert ALLOWED_TRANSITIONS[(DaemonState.ERROR, DaemonEvent.CANCEL)] is DaemonState.ERROR
|
|
360
|
+
recover_sources = {src for (src, ev) in ALLOWED_TRANSITIONS if ev is DaemonEvent.RECOVER}
|
|
361
|
+
assert recover_sources == {DaemonState.ERROR}
|
|
362
|
+
assert ALLOWED_TRANSITIONS[(DaemonState.ERROR, DaemonEvent.RECOVER)] is DaemonState.IDLE
|
|
363
|
+
|
|
364
|
+
# Toggle decision totality & iff RESUME exclusivity
|
|
365
|
+
sm = DaemonStateMachine()
|
|
366
|
+
for state in DaemonState:
|
|
367
|
+
sm.state = state
|
|
368
|
+
for pending in (False, True):
|
|
369
|
+
action = sm.decide_toggle(has_pending_stop=pending)
|
|
370
|
+
assert isinstance(action, ToggleAction)
|
|
371
|
+
assert (action is ToggleAction.RESUME) == (
|
|
372
|
+
state is DaemonState.RECORDING and pending is True
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
def test_backend_chain_tables_have_no_duplicates_and_valid_names():
|
|
377
|
+
"""Every backend listed in typer and hotkey chain tables is unique per chain
|
|
378
|
+
and constructs a backend whose `.name` matches the chain entry."""
|
|
379
|
+
from voiceio.hotkeys import create_hotkey_backend
|
|
380
|
+
from voiceio.platform import Platform
|
|
381
|
+
from voiceio.typers import create_typer_backend
|
|
382
|
+
|
|
383
|
+
plat = Platform(os="linux", display_server="wayland", desktop="gnome")
|
|
384
|
+
|
|
385
|
+
typer_names: set[str] = set()
|
|
386
|
+
for key, chain in typer_chain._CHAINS.items():
|
|
387
|
+
assert len(chain) == len(set(chain)), f"Duplicate typer in chain {key}: {chain}"
|
|
388
|
+
typer_names.update(chain)
|
|
389
|
+
for name in sorted(typer_names):
|
|
390
|
+
backend = create_typer_backend(name, plat)
|
|
391
|
+
assert backend.name == name
|
|
392
|
+
|
|
393
|
+
hotkey_names: set[str] = set()
|
|
394
|
+
for key, chain in hotkey_chain._CHAINS.items():
|
|
395
|
+
assert len(chain) == len(set(chain)), f"Duplicate hotkey in chain {key}: {chain}"
|
|
396
|
+
hotkey_names.update(chain)
|
|
397
|
+
for name in sorted(hotkey_names):
|
|
398
|
+
backend = create_hotkey_backend(name, plat)
|
|
399
|
+
assert backend.name == name
|
|
@@ -32,6 +32,12 @@ def _armed(rec: AudioRecorder) -> threading.Event:
|
|
|
32
32
|
return fired
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
def _drain_revive_threads() -> None:
|
|
36
|
+
for t in threading.enumerate():
|
|
37
|
+
if t.name == "revive-mic":
|
|
38
|
+
t.join(timeout=2)
|
|
39
|
+
|
|
40
|
+
|
|
35
41
|
def test_zeros_after_real_audio_fire_once():
|
|
36
42
|
rec = _recorder()
|
|
37
43
|
rec.start()
|
|
@@ -39,9 +45,11 @@ def test_zeros_after_real_audio_fire_once():
|
|
|
39
45
|
_feed(rec, 0.02, 1.0)
|
|
40
46
|
_feed(rec, 0.0, 1.2)
|
|
41
47
|
assert fired.wait(2)
|
|
48
|
+
_drain_revive_threads()
|
|
42
49
|
fired.clear()
|
|
43
50
|
_feed(rec, 0.0, 1.2) # still reviving: not fired again
|
|
44
|
-
|
|
51
|
+
_drain_revive_threads()
|
|
52
|
+
assert not fired.is_set()
|
|
45
53
|
|
|
46
54
|
|
|
47
55
|
def test_a_mic_silent_from_the_start_is_left_to_the_muted_check():
|
|
@@ -49,7 +57,8 @@ def test_a_mic_silent_from_the_start_is_left_to_the_muted_check():
|
|
|
49
57
|
rec.start()
|
|
50
58
|
fired = _armed(rec)
|
|
51
59
|
_feed(rec, 0.0, 2.0)
|
|
52
|
-
|
|
60
|
+
_drain_revive_threads()
|
|
61
|
+
assert not fired.is_set()
|
|
53
62
|
|
|
54
63
|
|
|
55
64
|
def test_quiet_room_noise_is_not_a_dead_stream():
|
|
@@ -58,7 +67,8 @@ def test_quiet_room_noise_is_not_a_dead_stream():
|
|
|
58
67
|
fired = _armed(rec)
|
|
59
68
|
_feed(rec, 0.02, 0.5)
|
|
60
69
|
_feed(rec, 0.0005, 3.0) # a working mic's silence is never exact zero
|
|
61
|
-
|
|
70
|
+
_drain_revive_threads()
|
|
71
|
+
assert not fired.is_set()
|
|
62
72
|
|
|
63
73
|
|
|
64
74
|
def test_revive_reopens_and_allows_at_most_two_attempts():
|
|
@@ -69,9 +79,13 @@ def test_revive_reopens_and_allows_at_most_two_attempts():
|
|
|
69
79
|
fired = _armed(rec)
|
|
70
80
|
_feed(rec, 0.02, 0.2)
|
|
71
81
|
_feed(rec, 0.0, 1.2)
|
|
72
|
-
assert fired.wait(0.5) is expected
|
|
73
82
|
if expected:
|
|
83
|
+
assert fired.wait(2.0)
|
|
84
|
+
_drain_revive_threads()
|
|
74
85
|
rec.revive_stream()
|
|
86
|
+
else:
|
|
87
|
+
_drain_revive_threads()
|
|
88
|
+
assert not fired.is_set()
|
|
75
89
|
assert opened.call_count == 2
|
|
76
90
|
assert rec.is_recording
|
|
77
91
|
|
|
@@ -106,10 +106,10 @@ def test_unknown_mode_falls_back_to_toggle():
|
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
def test_release_tail_keeps_recording_briefly():
|
|
109
|
-
vio = _make_app("hold", tail_ms=
|
|
109
|
+
vio = _make_app("hold", tail_ms=120)
|
|
110
110
|
vio.on_hotkey_press()
|
|
111
111
|
vio.on_hotkey_release()
|
|
112
|
-
time.sleep(0.
|
|
112
|
+
time.sleep(0.01)
|
|
113
113
|
assert vio._state == _State.RECORDING # still capturing the last word
|
|
114
114
|
assert _wait_stopped(vio)
|
|
115
115
|
|
|
@@ -120,14 +120,20 @@ def test_press_during_tail_keeps_recording():
|
|
|
120
120
|
vio = _make_app("hold", tail_ms=100)
|
|
121
121
|
vio.on_hotkey_press()
|
|
122
122
|
vio.on_hotkey_release()
|
|
123
|
+
first_pending = vio._pending_stop
|
|
124
|
+
assert first_pending is not None
|
|
123
125
|
_after_debounce(vio)
|
|
124
126
|
vio.on_hotkey_press() # withdraws the stop
|
|
125
|
-
|
|
127
|
+
assert vio._pending_stop is None
|
|
128
|
+
first_pending.timer.join(timeout=1.0)
|
|
129
|
+
assert not first_pending.timer.is_alive()
|
|
126
130
|
assert vio.stops == [] and vio._state == _State.RECORDING
|
|
127
131
|
assert vio._recording == 1
|
|
128
132
|
vio.on_hotkey_release()
|
|
133
|
+
second_pending = vio._pending_stop
|
|
129
134
|
assert _wait_stopped(vio)
|
|
130
|
-
|
|
135
|
+
if second_pending is not None:
|
|
136
|
+
second_pending.timer.join(timeout=1.0)
|
|
131
137
|
assert vio.stops == [1]
|
|
132
138
|
|
|
133
139
|
|
|
@@ -136,7 +142,7 @@ def test_release_after_auto_stop_does_nothing():
|
|
|
136
142
|
vio.on_hotkey_press()
|
|
137
143
|
vio._state = _State.FINALIZING # silence auto-stop meanwhile
|
|
138
144
|
vio.on_hotkey_release()
|
|
139
|
-
|
|
145
|
+
assert vio._pending_stop is None
|
|
140
146
|
assert vio.stops == []
|
|
141
147
|
|
|
142
148
|
|
|
@@ -144,9 +150,12 @@ def test_release_never_stops_a_newer_recording():
|
|
|
144
150
|
vio = _make_app("hold", tail_ms=100)
|
|
145
151
|
vio.on_hotkey_press()
|
|
146
152
|
vio.on_hotkey_release()
|
|
153
|
+
stale = vio._pending_stop
|
|
154
|
+
assert stale is not None
|
|
147
155
|
vio._do_stop() # recording 1 ends some other way
|
|
148
156
|
vio._do_start() # recording 2 starts within the tail
|
|
149
|
-
|
|
157
|
+
stale.timer.join(timeout=2.0) # let stale timer actually fire
|
|
158
|
+
assert not stale.timer.is_alive()
|
|
150
159
|
assert vio.stops == [1]
|
|
151
160
|
assert vio._state == _State.RECORDING
|
|
152
161
|
|
|
@@ -154,23 +163,22 @@ def test_release_never_stops_a_newer_recording():
|
|
|
154
163
|
def test_release_while_start_is_slow_is_still_a_tap():
|
|
155
164
|
"""The release waits on the hotkey lock while the start runs (stream
|
|
156
165
|
reopen can take 0.4s): the tap's length is when the key came up."""
|
|
157
|
-
vio = _make_app("auto", hold_ms=
|
|
166
|
+
vio = _make_app("auto", hold_ms=200)
|
|
158
167
|
started = threading.Event()
|
|
159
168
|
fast_start = vio._do_start
|
|
160
169
|
|
|
161
170
|
def slow_start():
|
|
162
171
|
started.set()
|
|
163
|
-
time.sleep(0.
|
|
172
|
+
time.sleep(0.25)
|
|
164
173
|
fast_start()
|
|
165
174
|
|
|
166
175
|
vio._do_start = slow_start
|
|
167
176
|
press = threading.Thread(target=vio.on_hotkey_press)
|
|
168
177
|
press.start()
|
|
169
|
-
started.wait(1)
|
|
170
|
-
time.sleep(0.05)
|
|
178
|
+
assert started.wait(1)
|
|
171
179
|
vio.on_hotkey_release() # blocks until the start is done
|
|
172
180
|
press.join(2)
|
|
173
|
-
|
|
181
|
+
assert vio._pending_stop is None
|
|
174
182
|
assert vio._state == _State.RECORDING and vio.stops == []
|
|
175
183
|
|
|
176
184
|
|
|
@@ -22,14 +22,23 @@ def test_engine_pids_match_exact_argv_not_lookalikes(tmp_path):
|
|
|
22
22
|
|
|
23
23
|
def test_kill_stale_engines_waits_for_exit(tmp_path):
|
|
24
24
|
from voiceio.ibus.session import _running, kill_stale_engines
|
|
25
|
-
# Exits ~0.
|
|
25
|
+
# Exits ~0.15s after SIGTERM — a slow engine whose cleanup used to run
|
|
26
26
|
# after the successor had already bound the socket.
|
|
27
27
|
code = ("import signal, sys, time\n"
|
|
28
|
-
"signal.signal(signal.SIGTERM, lambda *a: (time.sleep(0.
|
|
28
|
+
"signal.signal(signal.SIGTERM, lambda *a: (time.sleep(0.15), sys.exit(0)))\n"
|
|
29
|
+
"print('READY', flush=True)\n"
|
|
29
30
|
"time.sleep(30)")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
with subprocess.Popen(
|
|
32
|
+
[sys.executable, "-c", code, "-m", "voiceio.ibus.engine"],
|
|
33
|
+
stdout=subprocess.PIPE, text=True,
|
|
34
|
+
) as slow:
|
|
35
|
+
try:
|
|
36
|
+
assert slow.stdout is not None
|
|
37
|
+
assert slow.stdout.readline().strip() == "READY"
|
|
38
|
+
kill_stale_engines(tmp_path / "sock")
|
|
39
|
+
assert not _running(slow.pid)
|
|
40
|
+
slow.wait(timeout=1) # already gone (reaped here), not still exiting
|
|
41
|
+
finally:
|
|
42
|
+
if slow.poll() is None:
|
|
43
|
+
slow.kill()
|
|
44
|
+
slow.wait(timeout=1)
|