Skip to content

refactor(tauri): reduce desktop host to sidecar lifecycle + deep-link#84

Merged
senamakel merged 3 commits into
tinyhumansai:mainfrom
senamakel:fix/cleanup-tauri
Mar 30, 2026
Merged

refactor(tauri): reduce desktop host to sidecar lifecycle + deep-link#84
senamakel merged 3 commits into
tinyhumansai:mainfrom
senamakel:fix/cleanup-tauri

Conversation

@senamakel
Copy link
Copy Markdown
Member

Summary

  • Trims app/src-tauri down to a thin desktop host that only handles sidecar lifecycle and deep-link plumbing.
  • Removes Tauri-side RPC relay, daemon-host config commands, AI preview commands, health event bridge, and window wrapper commands.
  • Removes heavy/unused Tauri Rust dependencies (including reqwest) and updates capabilities accordingly.
  • Moves daemon health updates and window control behavior to frontend-side APIs/core RPC.
  • Adds daemon-host config read/write to core openhuman.service_* RPC so frontend can call through core directly.

Problem

  • The Tauri host had accumulated product logic (AI preview parsing, daemon host config persistence, service bootstrap/relay behavior, health event emission).
  • This duplicated behavior that belongs in core/frontend layers, increased dependency surface, and violated the intended wrapper-only architecture.

Solution

  • Reworked app/src-tauri/src/lib.rs to keep only:
    • deep-link plugin registration
    • core sidecar startup/shutdown
    • core_rpc_url command for frontend base URL resolution
  • Removed obsolete modules under app/src-tauri/src/commands, core_rpc.rs, and utils.
  • Updated sidecar readiness checks to use lightweight TCP port probing (tokio::net::TcpStream) instead of HTTP reqwest ping.
  • Frontend changes:
    • daemonHealthService now polls openhuman.health_snapshot via callCoreRpc instead of listening to Tauri-emitted openhuman:health events.
    • Deep-link flow focuses window via @tauri-apps/api/window instead of Rust invoke command.
    • Window/service/daemon-host paths in tauriCommands.ts now use frontend APIs or direct core RPC.
  • Core changes:
    • Added openhuman.service_daemon_host_get / openhuman.service_daemon_host_set handlers in service schemas/ops.

Submission Checklist

  • Unit tests — Existing type/system checks run for touched areas (yarn typecheck, cargo check root + app/src-tauri)
  • E2E / integration — Not run in this PR; recommend targeted desktop E2E coverage for daemon/service panel + deep-link flows
  • N/A
  • Doc comments — Existing module/function docs retained; new core service handlers are straightforward and colocated in existing modules
  • Inline comments — Added/kept where edge behavior is non-obvious (startup checks and health polling expectations)

Impact

  • Platform/runtime: desktop host behavior is simplified; business logic remains in core/frontend.
  • Dependency footprint: reduced Rust dependencies and plugin permissions in app/src-tauri.
  • Compatibility: frontend no longer depends on removed Rust invoke commands for service/daemon-host/window paths.
  • Risk: daemon/service UX depends on core RPC availability; if sidecar startup is delayed, frontend polling gracefully times out to disconnected state.

Related

  • Issue(s): N/A
  • Follow-up PR(s)/TODOs:
    • Replace remaining legacy invoke(...) paths in frontend (exchange_token, conscious_loop_run, runtime_*) with direct core RPC or frontend-native APIs where appropriate.
    • Fix .husky/pre-push to re-check after auto-fix (currently fails if initial format/lint fails even when fixed).

…arding flow

- Added DEV_FORCE_ONBOARDING configuration to bypass onboarding checks during development.
- Updated onboarding logic in AppRoutes to respect the new flag, ensuring onboarding is always shown when enabled.
- Introduced new utility functions for managing onboarding state based on the flag.
- Updated Cargo.lock and Cargo.toml to reflect dependency changes and version updates.
- Removed deprecated openhuman command module and refactored related functionalities into daemon_host module for better organization.
- Updated DaemonHealthService to use polling via `openhuman.health_snapshot` instead of event listening for health updates.
- Introduced a new focusMainWindow function to centralize window focus logic across deep link handling and Tauri commands.
- Replaced `invoke` calls with direct window management methods for showing, hiding, and toggling the main window.
- Removed deprecated core_rpc module and related commands for improved organization and clarity.
- Updated Cargo.toml and Cargo.lock to reflect dependency changes.
…bject structure

- Moved the import of `callCoreRpc` to a more appropriate location in DaemonHealthService.
- Simplified the structure of the tools object in the aiGetConfig function for better readability.
- Ensured consistency in Tauri command invocations by removing unnecessary line breaks.
@senamakel senamakel merged commit 36fc5bd into tinyhumansai:main Mar 30, 2026
3 of 6 checks passed
@senamakel senamakel deleted the fix/cleanup-tauri branch March 30, 2026 18:41
@senamakel senamakel restored the fix/cleanup-tauri branch March 30, 2026 19:12
@senamakel senamakel deleted the fix/cleanup-tauri branch March 31, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant