Skip to content

Component: FlowEnhance

Canonical source: SmrtApps/PythonApp/python_core/flow_enhance/README.md (mirrored below)


python_core.flow_enhance

Overview & Responsibilities

  • Hosts the SmrtSearch automation helpers that translate clipboard content into browser navigation actions triggered from the SmrtHub desktop shell.
  • Surface convenience exports (start_listener, on_smrtsearch_trigger, etc.) so supervisors and bridge routes can drive automation without touching submodules directly.
  • Maintains parity with the documentation policy by keeping business rules in code docstrings while this README tracks integration and operational notes.

Dependencies & Integrations

  • Depends on keyboard and pywin32 (win32clipboard) to register global hotkeys and read the Windows clipboard safely across threads.
  • Emits logs through python_core.utils.logger.get_logger_for("flow-enhance"), landing in %LOCALAPPDATA%/SmrtHub/Logs/flow-enhance/flow-enhance-log.{txt,json} alongside the rest of the Smrt.Logging sinks.
  • Consumed by python_core.net.routes.trigger_dispatch when the C# bridge forwards SmrtSearch hotkey activations, and by diagnostic helpers that query get_module_info().

Runtime Flows / Operational Workflows

  • start_listener() registers the default Ctrl+Alt+] hotkey and directs callbacks to on_smrtsearch_trigger(); stop_listener() releases that binding.
  • on_smrtsearch_trigger() reads clipboard text, classifies URLs versus search queries, and launches the default browser; it emits concise console cues for manual runs but defers to structured logging for audit trails.
  • initialize_flow_enhancement() performs lightweight readiness checks so supervisors can verify clipboard accessibility during startup sequences.

Configuration & Log Paths

  • No bespoke configuration files are introduced; runtime behavior is driven by module constants documented inside smrtsearch.py.
  • Structured/text logs respect the Operational Data Policy via the flow-enhance slug and are automatically included in Support Bundles.

Testing & Validation Expectations

  • Run pytest -k smrtsearch inside SmrtApps/PythonApp after altering clipboard logic or hotkey wiring to ensure regression coverage stays green.
  • Verify SmrtSearch activation end-to-end by launching the PythonApp under the VS Code debugger and triggering the registered hotkey, confirming URLs and search queries resolve as expected.

Support Bundle / Diagnostics Touchpoints

  • Support Bundles ingest the flow-enhance log set; avoid adding alternate log locations.
  • get_module_info() returns a stable metadata payload that diagnostics scripts and health panels rely on—extend cautiously and document any new keys here when introduced.