The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(accessibility, util): add README files for desktop accessibility and utility modules
Steven Enamakel05d3c89026d0
diff --git a/crates/openhuman-core/src/desktop/accessibility/README.md b/crates/openhuman-core/src/desktop/accessibility/README.mdindex 18301e9be3..a93edd4c2a 100644--- a/crates/openhuman-core/src/desktop/accessibility/README.md+++ b/crates/openhuman-core/src/desktop/accessibility/README.md@@ -1,6 +1,6 @@# Accessibility-Cross-platform accessibility middleware. Owns macOS AX / CGEvent / IOKit FFI, the unified Swift helper-process bridge, focused-text inspection, system-permission detection (Accessibility, Input Monitoring, Microphone), the Globe-key listener, "System Events" automation-denial tracking, terminal heuristics, and AX-string normalization. Centralises platform-specific code so that `voice` never touches FFI directly.+Cross-platform accessibility middleware. Owns the macOS AX / IOKit FFI, the unified Swift helper-process bridge (focus queries, paste, and overlay in one persistent process), focused-text inspection, system-permission detection (Accessibility, Input Monitoring, Microphone), the Globe-key listener, "System Events" automation-denial tracking, terminal heuristics, and AX-string normalization. Centralises platform-specific code so that `voice` never touches FFI directly.## Public surface@@ -9,24 +9,27 @@ Re-exported from `mod.rs`:- `pub fn clear_automation_denial` / `mark_system_events_denied` / `system_events_denied` — `automation_state.rs` — tracks whether macOS has denied AppleScript "System Events" automation, so callers can stop retrying until the user re-grants it.- `pub fn focused_text_context` / `focused_text_context_verbose` / `validate_focused_target` — `focus.rs` — query the OS for the currently focused text field.- `pub fn globe_listener_start` / `globe_listener_stop` / `globe_listener_poll` / `pub struct GlobeHotkeyPollResult` / `pub enum GlobeHotkeyStatus` — `globe.rs` — macOS Globe-key (Fn) hotkey monitor.-- `pub fn precompile_helper_background` — split across `helper_part_01.rs` and `helper_part_02.rs` (re-exported via `helper.rs`) — warm the Swift helper process at startup.-- Permission detection: `detect_permissions`, `detect_microphone_permission`, `microphone_denied_message`, `permission_to_str`, `request_microphone_access` (cross-platform); macOS-only `detect_accessibility_permission`, `detect_input_monitoring_permission`, `open_macos_privacy_pane`, `request_accessibility_access` — `permissions.rs`.+- `pub fn precompile_helper_background` — `helper.rs`, whose body is `include!`d from `helper_part_01.rs` (process management, `pub(crate) helper_send_receive`) and `helper_part_02.rs` (the embedded Swift source) — warm the Swift helper process in the background. No caller outside this module today.+- Permission detection: `detect_permissions`, `detect_microphone_permission`, `microphone_denied_message`, `permission_to_str`, `request_microphone_access` (cross-platform); macOS-only `detect_accessibility_permission`, `detect_input_monitoring_permission`, `open_macos_privacy_pane`, `request_accessibility_access` — `permissions.rs`. Microphone detection probes `cpal` for a default input device and needs the `inference` feature; without it the result is `PermissionState::Unknown`.- `pub fn extract_terminal_input_context` / `is_terminal_app` / `is_text_role` / `looks_like_terminal_buffer` — `terminal.rs` — terminal-window heuristics.- `pub fn normalize_ax_value` / `parse_ax_number` / `truncate_tail` — `text_util.rs` — AX value normalization.- `pub struct ElementBounds` / `FocusedTextContext` / `PermissionKind` / `PermissionState` / `PermissionStatus` — `types.rs`.## Calls into-- macOS frameworks (`ApplicationServices`, `CoreGraphics`, `IOKit`, `AVFoundation`) via FFI.-- Bundled Swift helper process for AX queries that require a separate process.-- `crates/openhuman-core/src/config/` — overlay sizing and helper paths (light dependency).+- macOS frameworks `ApplicationServices`, `CoreFoundation`, and `IOKit` via `#[link]` FFI in `permissions.rs`; `CGEvent` key synthesis happens inside the Swift helper, not in Rust.+- The Swift helper process compiled from the source embedded in `helper_part_02.rs` (stdin/stdout JSON), driven by `helper_send_receive`.+- `cpal` (behind the `inference` feature) for the microphone probe.+- No `crate::*` imports: this module does not read `Config`.## Called by-- `crates/openhuman-core/src/voice/` (`server_part_01.rs`, `always_on_part_02.rs`, `audio_capture.rs`, `text_input.rs`) — microphone permission, focused-text, and terminal-context helpers.-- `crates/openhuman-core/src/core/all_tests.rs` — registry-level test coverage.+- `crates/openhuman-core/src/voice/server_part_01.rs` — `globe_listener_start` / `globe_listener_poll` for the Fn hotkey; `server_part_02.rs` — `focused_text_context_verbose` to capture the frontmost app at hotkey press.+- `crates/openhuman-core/src/voice/text_input.rs` — `validate_focused_target` before inserting dictated text.+- `crates/openhuman-core/src/voice/always_on_part_02.rs` and `audio_capture.rs` — `detect_microphone_permission`, `microphone_denied_message`, `request_microphone_access`.+- `crates/openhuman-core/src/core/all_tests.rs` — asserts `detect_microphone_permission()` is `Unknown` when `inference` is compiled out.## Tests-- Permission and focus coverage runs through `permissions_tests.rs`, inline module tests, and retained consumers.-- AX FFI surface is best validated end-to-end on a real macOS host — most CI runs are Linux and skip platform-gated paths.+- Sibling `*_tests.rs` files for `automation_state`, `focus`, `globe`, `permissions`, `terminal`, and `text_util`, attached via `#[cfg(test)] #[path = ...] mod tests;`.+- AX FFI and the Swift helper are only exercised on a real macOS host — Linux CI skips the platform-gated paths.diff --git a/crates/openhuman-core/src/util/README.md b/crates/openhuman-core/src/util/README.mdindex a2675de44c..38377ddcf7 100644--- a/crates/openhuman-core/src/util/README.md+++ b/crates/openhuman-core/src/util/README.md@@ -1,33 +1,35 @@# util-Kernel helper family — always compiled, never feature-gated. These are-dependency-free helpers reused across domains; nothing here may reach into a-domain (`use crate::<domain>::...`). `bm25` and `redact` say why explicitly in-their own module docs; the same rule applies to every file in this directory.+Kernel helper family — `pub mod util;` in `lib.rs` is unconditional, never+feature-gated. Helpers reused across domains; nothing here may reach into a+domain. No file in this directory has a `use crate::` line, and that is the+rule: a helper that needs config, a `Tool`, a workspace, or security policy+belongs in the domain that owns those, not here. New external crates are also+off-limits — this is kernel surface under the `scripts/kernel-floor.limits`+dependency ratchet, which is why `bm25` is hand-rolled and `redact` is a+six-line copy rather than an engine link.## Layout| File | Purpose || --- | --- |-| `bm25.rs` | BM25 ranking over short documents, shared by `tool_search` and `skill_search`. Deliberately names nothing from `crate::` so it stays extraction-ready for a loadable module. |-| `redact.rs` | `redact()` — SHA-256-based PII redaction for log output (source ids, entity ids, content paths). Kept independent of `tinymemory_core::util::redact`, the engine's own copy, so the host does not link the memory engine just for a log formatter. |-| `retry.rs` | `retry_with_backoff` / `retry_with_backoff_async` and `is_transient_fs_error` — exponential-backoff retry for filesystem operations, mainly to ride out Windows mandatory-file-locking errors (`ERROR_SHARING_VIOLATION`, `ERROR_ACCESS_DENIED`). |-| `sanitize.rs` | Re-exports `tinymcp_bus::sanitize` (`sanitize_for_llm`, `strip_control_chars`, `strip_instruction_fences`, `truncate_utf8_safe`, `MAX_DESCRIPTION_BYTES`, `MAX_TITLE_BYTES`) under the path callers have always used. LLM-facing text sanitization for tool and skill descriptions; the real implementation lives in `tinymcp_bus` so MCP transports and the orchestrator prompt builder share one stripping rule. |-| `text.rs` | UTF-8-safe string helpers: `truncate_with_ellipsis` / `truncate_with_suffix` (char-boundary-safe truncation), `floor_char_boundary` / `ceil_char_boundary` / `utf8_safe_prefix_at_byte_boundary` (byte-boundary rounding), `provenance_tag` (non-leaky `chat:xxxxxxxx` tag hashed from a session id for the cross-chat context block). |-| `types.rs` | `MaybeSet<T>` — tri-state `Set(T)` / `Unset` / `Null` for optional-update payloads. |-| `tls/` | Platform-conditional TLS backend selection for `reqwest` clients — see [tls/README.md](tls/README.md). |+| `bm25.rs` | `Bm25Index` + `tokenize` — BM25 ranking over `(id, text)` pairs, the shared core behind `tools/impl/meta/tool_search.rs` and `skills/search.rs`. Names nothing from `crate::` so it can move into a loadable module unchanged. |+| `redact.rs` | `redact()` — SHA-256 → 8 hex chars for source ids, entity ids, and content paths in log lines. Same helper as `tinymemory_core::util::redact`, kept as a local copy so the host does not link the memory engine for a log formatter; the two copies never need to agree. |+| `retry.rs` | `retry_with_backoff` / `retry_with_backoff_async` (`base_ms * 2^i` backoff, `warn!` per retry) and `is_transient_fs_error` — for Windows mandatory-locking errors (`ERROR_SHARING_VIOLATION`, `ERROR_ACCESS_DENIED`) on a tree another handle still holds. |+| `sanitize.rs` | Pure re-export of `tinymcp_bus::sanitize` (`sanitize_for_llm`, `strip_control_chars`, `strip_instruction_fences`, `truncate_utf8_safe`, `MAX_DESCRIPTION_BYTES`, `MAX_TITLE_BYTES`) at the path callers already use. The rule lives in `tinymcp_bus` so MCP tool descriptions and the orchestrator prompt builder's skill descriptions get the same stripping; do not fork it back here. |+| `text.rs` | `truncate_with_ellipsis` / `truncate_with_suffix` (char-count truncation), `truncate_at_byte_boundary` (byte-cap with `…`), `floor_char_boundary` / `ceil_char_boundary` / `utf8_safe_prefix_at_byte_boundary` (byte-index rounding), `provenance_tag` (`chat:xxxxxxxx` hash of a session id for the cross-chat context block, so the raw `client_id` never reaches a prompt). |+| `types.rs` | `MaybeSet<T>` — `Set(T)` / `Unset` / `Null`, distinguishing "field absent" from "field explicitly null" in partial-update payloads (see `tools/impl/system/proxy_config.rs`). |+| `tls/` | `tls_client_builder()` — platform-conditional TLS backend for `reqwest` clients. See [tls/README.md](tls/README.md). |-## Public surface--Everything is re-exported at the module root (`pub use` in `mod.rs`), so-`crate::util::<fn>` resolves for every helper above without naming the-submodule.+`*_tests.rs` files sit beside each module.-## Notes+## Public surface-- No file here may depend on another domain. `bm25` and `redact` exist as- separate copies from otherwise-similar engine/vendor code specifically to- avoid pulling in a dependency for a few lines of logic — keep new additions- to the same standard.-- `sanitize.rs` is a thin re-export; the sanitization rule itself is owned by- `tinymcp_bus` and must not be forked back into this crate.+`mod.rs` re-exports `retry`, `text`, and `types` items at the module root, so+`crate::util::truncate_with_ellipsis`, `crate::util::retry_with_backoff`, and+`crate::util::MaybeSet` resolve without the submodule. `bm25`, `redact`,+`sanitize`, and `tls` are reached through their submodule:+`crate::util::bm25::Bm25Index`, `crate::util::redact::redact`,+`crate::util::sanitize::sanitize_for_llm`, `crate::util::tls::tls_client_builder`.+From outside the crate the lib is `openhuman_core`, which is the path the+`truncate_with_ellipsis` doctest uses.