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(architecture): standardize punctuation style in documentation
Steven Enamakeld65ae6639bb4
diff --git a/crates/openhuman-core/src/channels/runtime/README.md b/crates/openhuman-core/src/channels/runtime/README.mdindex 4693cdb1ad..825b536d19 100644--- a/crates/openhuman-core/src/channels/runtime/README.md+++ b/crates/openhuman-core/src/channels/runtime/README.md@@ -27,7 +27,7 @@ Model authentication and account lifetime are separate. A local or CLI model can| --- | --- || `helpers.rs` | Stateless helpers: per-turn context block for non-web channels, deterministic ACK-emoji picker, worker join logging, scoped typing task || `routing.rs` | `AgentScoping`, `resolve_target_agent`, `build_visible_tool_set`, `connected_with_fallback`: picks the active agent for the channel and its visible/delegation tool surface from `Config`, `AgentDefinitionRegistry`, and the connected-integrations snapshot |-| `processor.rs` (+ `processor/` — `message.rs`, `approval.rs`, `turn.rs`, `dispatch_loop.rs`) | `RuntimeChannelMessage`, `channel_has_approval_surface`, `try_route_approval_reply`, `process_channel_message`, `process_channel_runtime_message`, `run_message_dispatch_loop` |+| `processor.rs` (+ `processor/`: `message.rs`, `approval.rs`, `turn.rs`, `dispatch_loop.rs`) | `RuntimeChannelMessage`, `channel_has_approval_surface`, `try_route_approval_reply`, `process_channel_message`, `process_channel_runtime_message`, `run_message_dispatch_loop` || `mod.rs` | Declares the three submodules and the `#[cfg(test)]` / `#[cfg(any(test, debug_assertions))]` re-exports the test modules reach through `super::*` |Two policy points here: `channel_has_approval_surface` is `true` only for `TELEGRAM_APPROVAL_CLIENT_ID`, so other channels still run in the legacy "no chat context, silently allow" state until they get a surface subscriber; and scoping is per channel (`resolve_target_agent(&msg.channel)`), falling back to `AgentScoping::unscoped()` (every registered tool visible) when the registry is not initialised or the target agent is unknown.diff --git a/gitbooks/developing/architecture/frontend.md b/gitbooks/developing/architecture/frontend.mdindex 135cd7611f..ea818232f7 100644--- a/gitbooks/developing/architecture/frontend.md+++ b/gitbooks/developing/architecture/frontend.md@@ -53,7 +53,7 @@ app/src/### System architecture-OpenHuman’s desktop UI is a **React 19** app (`app/src/`) that:+OpenHuman's desktop UI is a **React 19** app (`app/src/`) that:- Uses **Redux Toolkit** with persistence for session-related state- Connects to the backend with **REST** (`apiClient`) and to the local core with **Socket.io** (`socketService` → core socket endpoint)@@ -150,8 +150,8 @@ The application uses Redux Toolkit with Redux-Persist. There is no single root p### Storage backends-- **`userScopedStorage`** (`store/userScopedStorage.ts`) — the default storage for persisted slices. Blobs are keyed `${userId}:persist:<key>` so state never leaks across users on logout/login (#900).-- **Plain `localStorage`** — used only for pre-login, device-wide slices (`coreMode`, `locale`, `theme`) that must survive user switches.+- **`userScopedStorage`** (`store/userScopedStorage.ts`): the default storage for persisted slices. Blobs are keyed `${userId}:persist:<key>` so state never leaks across users on logout/login (#900).+- **Plain `localStorage`**: used only for pre-login, device-wide slices (`coreMode`, `locale`, `theme`) that must survive user switches.### Slices@@ -179,7 +179,7 @@ Authoritative list = the `reducer` map in `store/index.ts`. One-line purposes:| `thread` | Chat thread list + per-thread message caches | only `selectedThreadId` || `userErrors` | User-actionable runtime errors (#3931) | no (in-memory only) |-Ephemeral chat state (streaming buffers, tool timelines) must **not** survive a restart — the UI would try to resume a turn whose live driver is gone. The one exception, agent-generated artifacts, goes through the `artifactsReadyOnlyTransform` in `store/index.ts` (pure logic in `store/artifactsPersistFilter.ts`).+Ephemeral chat state (streaming buffers, tool timelines) must **not** survive a restart: the UI would try to resume a turn whose live driver is gone. The one exception, agent-generated artifacts, goes through the `artifactsReadyOnlyTransform` in `store/index.ts` (pure logic in `store/artifactsPersistFilter.ts`).### Typed hooks@@ -193,10 +193,10 @@ export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector;### Best practices-1. **Always use typed hooks** — `useAppDispatch` and `useAppSelector`.-2. **Use selectors for derived state** — see `store/socketSelectors.ts`, `store/connectivitySelectors.ts`, `store/userErrorsSelectors.ts`.-3. **Whitelist persistence per slice** — never persist transient/loading state; add a per-slice `persistReducer` in `store/index.ts`.-4. **Prefer Redux over ad-hoc `localStorage`** — plain localStorage is reserved for the pre-login slices noted above.+1. **Always use typed hooks**: `useAppDispatch` and `useAppSelector`.+2. **Use selectors for derived state**: see `store/socketSelectors.ts`, `store/connectivitySelectors.ts`, `store/userErrorsSelectors.ts`.+3. **Whitelist persistence per slice**: never persist transient/loading state; add a per-slice `persistReducer` in `store/index.ts`.+4. **Prefer Redux over ad-hoc `localStorage`**: plain localStorage is reserved for the pre-login slices noted above.5. In dev / E2E builds the store is exposed as `window.__OPENHUMAN_STORE__` so WDIO specs can assert backing state; production bundles do not expose it.---@@ -239,22 +239,22 @@ const result = await apiClient.post<LoginResponse>("/auth/login", {\~50 domain-scoped modules, one per feature surface, each wrapping either backend REST endpoints or core RPC methods. Representative examples:-- `authApi` / `userApi` — auth + user profile-- `threadApi`, `threadUsageApi` — chat threads-- `agentTeamApi`, `agentWorkApi`, `subagentApi` — agents-- `skillsApi`, `skillRegistryApi`, `flowsApi`, `workflowRunsApi` — skills & automation-- `channelConnectionsApi`, `mcpClientsApi`, `mcpSetupApi`, `tunnelsApi` — connections-- `memoryTimelineApi`, `memoryFreshnessApi`, `graphCentralityApi`, `namespaceOverviewApi` — memory/graph-- `billingApi`, `creditsApi`, `referralApi`, `inviteApi` — commerce-- `voiceSettingsApi`, `voiceInstallApi`, `aiSettingsApi`, `modelCouncilApi` — AI/voice config+- `authApi` / `userApi`: auth + user profile+- `threadApi`, `threadUsageApi`: chat threads+- `agentTeamApi`, `agentWorkApi`, `subagentApi`: agents+- `skillsApi`, `skillRegistryApi`, `flowsApi`, `workflowRunsApi`: skills & automation+- `channelConnectionsApi`, `mcpClientsApi`, `mcpSetupApi`, `tunnelsApi`: connections+- `memoryTimelineApi`, `memoryFreshnessApi`, `graphCentralityApi`, `namespaceOverviewApi`: memory/graph+- `billingApi`, `creditsApi`, `referralApi`, `inviteApi`: commerce+- `voiceSettingsApi`, `voiceInstallApi`, `aiSettingsApi`, `modelCouncilApi`: AI/voice configFor the full list, `ls app/src/services/api/`. New feature surfaces get their own module here rather than growing `apiClient`.### Socket Service (`services/socketService.ts`)-Socket.io client singleton connected to the **local core's** socket endpoint (base URL derived from the resolved RPC URL via `coreSocket.ts`; authenticated with the core RPC token). It ingests realtime core events — chat/meet/channel/companion updates — and dispatches them into Redux (`socketSlice`, `backendMeetSlice`, `channelConnectionsSlice`, `companionSlice`, `connectivitySlice`). It also hosts the MCP-style transport (`SocketIOMCPTransportImpl` from `lib/mcp`).+Socket.io client singleton connected to the **local core's** socket endpoint (base URL derived from the resolved RPC URL via `coreSocket.ts`; authenticated with the core RPC token). It ingests realtime core events (chat/meet/channel/companion updates) and dispatches them into Redux (`socketSlice`, `backendMeetSlice`, `channelConnectionsSlice`, `companionSlice`, `connectivitySlice`). It also hosts the MCP-style transport (`SocketIOMCPTransportImpl` from `lib/mcp`).-Keep `socketService` and the core socket behavior aligned (the "dual socket sync" rule in AGENTS.md). Connection lifecycle is owned by `providers/SocketProvider.tsx`; on mobile the provider is not mounted at all — events arrive through the `TunnelTransport` relay instead.+Keep `socketService` and the core socket behavior aligned (the "dual socket sync" rule in AGENTS.md). Connection lifecycle is owned by `providers/SocketProvider.tsx`; on mobile the provider is not mounted at all: events arrive through the `TunnelTransport` relay instead.### Core RPC (`services/coreRpcClient.ts`)@@ -275,25 +275,25 @@ const result = await callCoreRpc<MyType>({How a call flows:-1. **URL + token resolution** — the RPC URL follows the precedence in [Runtime config precedence](frontend.md#runtime-config-precedence); the per-launch bearer token comes from the Tauri `core_rpc_token` command (or the stored token for self-hosted cores).-2. **Direct fetch** — the webview `fetch()`es the JSON-RPC envelope straight to the core (loopback http or any https URL).-3. **Shell relay fallback** — plain `http://` to a **non-loopback** host is active mixed content and Chromium blocks it (#3865). `rpcUrlNeedsShellRelay()` detects this and routes the call through `invoke('relay_http_rpc', { url, token, body })`, implemented in **`crates/openhuman-app/src/core_rpc.rs`** (a thin wrapper over `openhuman_rpc::post_json_rpc` from `crates/openhuman-rpc/`), which returns `{ status, body }` re-wrapped as a `Response`.-4. **Transport override** — iOS/remote connection profiles install a `CoreTransport` (`setActiveCoreTransport`) so the same `callCoreRpc` surface rides LAN/tunnel/cloud transports.+1. **URL + token resolution**: the RPC URL follows the precedence in [Runtime config precedence](frontend.md#runtime-config-precedence); the per-launch bearer token comes from the Tauri `core_rpc_token` command (or the stored token for self-hosted cores).+2. **Direct fetch**: the webview `fetch()`es the JSON-RPC envelope straight to the core (loopback http or any https URL).+3. **Shell relay fallback**: plain `http://` to a **non-loopback** host is active mixed content and Chromium blocks it (#3865). `rpcUrlNeedsShellRelay()` detects this and routes the call through `invoke('relay_http_rpc', { url, token, body })`, implemented in **`crates/openhuman-app/src/core_rpc.rs`** (a thin wrapper over `openhuman_rpc::post_json_rpc` from `crates/openhuman-rpc/`), which returns `{ status, body }` re-wrapped as a `Response`.+4. **Transport override**: iOS/remote connection profiles install a `CoreTransport` (`setActiveCoreTransport`) so the same `callCoreRpc` surface rides LAN/tunnel/cloud transports.-Errors are classified into a stable `CoreRpcError.kind` (`auth_expired`, `transport`, `timeout`, `rate_limited`, …) — callers branch on `kind`, never on message regexes. An `auth_expired` classification broadcasts `core-rpc-auth-expired`, which `CoreStateProvider` turns into a session clear.+Errors are classified into a stable `CoreRpcError.kind` (`auth_expired`, `transport`, `timeout`, `rate_limited`, …): callers branch on `kind`, never on message regexes. An `auth_expired` classification broadcasts `core-rpc-auth-expired`, which `CoreStateProvider` turns into a session clear.### Best Practices-1. **Use singletons** — never create multiple service instances.-2. **Keep Tauri IPC and RPC calls in services** — do not scatter `invoke()` or raw fetches through components.-3. **Clean up on unmount** — disconnect in `useEffect` cleanup.-4. **Handle errors via `CoreRpcError.kind`** — retry only transient failures.+1. **Use singletons**: never create multiple service instances.+2. **Keep Tauri IPC and RPC calls in services**: do not scatter `invoke()` or raw fetches through components.+3. **Clean up on unmount**: disconnect in `useEffect` cleanup.+4. **Handle errors via `CoreRpcError.kind`**: retry only transient failures.---## Providers-React context providers (`app/src/providers/`) manage service lifecycle and expose core-owned state. The full nesting (including gates that live in `components/`) is the generated [provider chain](frontend.md#provider-chain) above. There is **no** `UserProvider`, `AIProvider`, or `SkillProvider` — auth/user state lives in `CoreStateProvider`, AI configuration lives in the Rust core, and skills execute in the core (the frontend QuickJS skills engine was removed).+React context providers (`app/src/providers/`) manage service lifecycle and expose core-owned state. The full nesting (including gates that live in `components/`) is the generated [provider chain](frontend.md#provider-chain) above. There is **no** `UserProvider`, `AIProvider`, or `SkillProvider`: auth/user state lives in `CoreStateProvider`, AI configuration lives in the Rust core, and skills execute in the core (the frontend QuickJS skills engine was removed).### ThemeProvider (`providers/ThemeProvider.tsx`)@@ -301,21 +301,21 @@ Applies theme tokens and dark-mode handling from the persisted `theme` slice (mo### CoreStateProvider (`providers/CoreStateProvider.tsx`)-The authoritative auth/session/onboarding context. Fetches the core app snapshot (`fetchCoreAppSnapshot()` RPC), exposes it via `useCoreState()` (`{ snapshot, isBootstrapping, refresh }`), and clears the session on the global `core-rpc-auth-expired` event. It follows a **turn-boundary refetch contract**: after every agent reply completes (`chat_done` in `ChatRuntimeProvider`) it refetches the user state (debounced 750ms) and merges it into the snapshot via `patchSnapshot` — see `providers/README.md`.+The authoritative auth/session/onboarding context. Fetches the core app snapshot (`fetchCoreAppSnapshot()` RPC), exposes it via `useCoreState()` (`{ snapshot, isBootstrapping, refresh }`), and clears the session on the global `core-rpc-auth-expired` event. It follows a **turn-boundary refetch contract**: after every agent reply completes (`chat_done` in `ChatRuntimeProvider`) it refetches the user state (debounced 750ms) and merges it into the snapshot via `patchSnapshot`: see `providers/README.md`.### SocketProvider (`providers/SocketProvider.tsx`)-Owns the socket.io connection to the local core: connects once core state is ready, updates the `socket` slice, and tears down on unmount. Desktop only — `App.tsx` skips it on mobile, where events arrive through the `TunnelTransport` relay.+Owns the socket.io connection to the local core: connects once core state is ready, updates the `socket` slice, and tears down on unmount. Desktop only: `App.tsx` skips it on mobile, where events arrive through the `TunnelTransport` relay.### ChatRuntimeProvider (`providers/ChatRuntimeProvider.tsx`)-Subscribes to chat runtime socket events (message streaming, tool calls, subagent lifecycle, approval requests) and reduces them into the `chatRuntime` slice — per-thread tool timelines, streaming buffers, artifacts, and approval state consumed by the chat surface and the mascot.+Subscribes to chat runtime socket events (message streaming, tool calls, subagent lifecycle, approval requests) and reduces them into the `chatRuntime` slice: per-thread tool timelines, streaming buffers, artifacts, and approval state consumed by the chat surface and the mascot.### Gates and shell-level contexts (in `components/`)-- **`BootCheckGate`** (`components/BootCheckGate/`) — blocks render until the core boot snapshot resolves.-- **`CommandProvider`** (`components/commands/`) — command palette context.-- **`ServiceBlockingGate`** (`components/daemon/`) — blocks the shell until required services are configured.+- **`BootCheckGate`** (`components/BootCheckGate/`): blocks render until the core boot snapshot resolves.+- **`CommandProvider`** (`components/commands/`): command palette context.+- **`ServiceBlockingGate`** (`components/daemon/`): blocks the shell until required services are configured.### Context vs Redux@@ -335,14 +335,14 @@ The mascot appears on **two** surfaces, deliberately. `/human`(`app/src/features/human/HumanPage.tsx`) is the dedicated full-bleed stage with aright-rail chat. `/chat` carries the same mascot docked on its composer, where itexpands into a voice stage in place. Both read one set of mascot preferences from-`mascotSlice` — colour, voice, speak-replies, dismissal — so the two can never+`mascotSlice` (colour, voice, speak-replies, dismissal) so the two can neverdisagree about the same setting.`app/src/features/human/chatMascot/` owns the chat-side surface:| Module | Role || ----------------------- | --------------------------------------------------------------------------------------------------------- |-| `ChatMascotContext.tsx` | Shared dock/stage refs and the send binding. Every value is stable — see the re-render note below. |+| `ChatMascotContext.tsx` | Shared dock/stage refs and the send binding. Every value is stable: see the re-render note below. || `ChatMascotDock.tsx` | The small mascot standing on the composer's input box. An anchor + hit area; it draws nothing. || `ChatMascotStage.tsx` | The scaled-up voice surface: `MicComposer`, input-device selector, speak-replies switch, collapse button. || `ChatMascotOverlay.tsx` | The single Rive instance, moved between dock and stage with a `transform`. |@@ -357,7 +357,7 @@ preference are persisted in `mascotSlice`.**Two invariants worth keeping.** The mascot re-renders at ~60fps during TTSlipsync, so (a) it is rendered as a leaf with nothing beneath it, and (b) the-mascot context value is deliberately non-reactive — reactive state lives in+mascot context value is deliberately non-reactive: reactive state lives inRedux or in the send-binding external store instead. A reactive context valuewould reconcile the whole chat tree every frame, which is the stall #5357 had tofix. And the overlay only mounts while the agent account is selected, so a fixed@@ -432,7 +432,7 @@ The application uses HashRouter with protected and public route guards. Desktop### Route map-Current desktop routes (read `AppRoutes.tsx` for the authoritative table — the file is heavily commented with the rationale for each redirect):+Current desktop routes (read `AppRoutes.tsx` for the authoritative table: the file is heavily commented with the rationale for each redirect):```/ → Welcome (PublicRoute; redirects to /home if logged in)@@ -462,15 +462,15 @@ Back-compat redirects (all `Navigate replace`, query params preserved):/workflows → /settings/automations /webhooks → /settings/integrations#webhooks```-There is **no** `/login` route — authentication flows through the Welcome page, the `/auth` callback, and deep links. Desktop **Settings is not an inline route**: when the URL is `/settings/*`, `AppShellDesktop` keeps rendering the _background_ location and mounts `SettingsModal` on top (see [Settings](frontend.md#settings)). Note that `/agents` does not exist.+There is **no** `/login` route: authentication flows through the Welcome page, the `/auth` callback, and deep links. Desktop **Settings is not an inline route**: when the URL is `/settings/*`, `AppShellDesktop` keeps rendering the _background_ location and mounts `SettingsModal` on top (see [Settings](frontend.md#settings)). Note that `/agents` does not exist.### Route guardsAll three guards read `useCoreState()` (not Redux auth state) and render `RouteLoadingScreen` while bootstrapping:-- **`ProtectedRoute`** (`components/ProtectedRoute.tsx`) — `({ children, requireAuth = true, redirectTo })`; without a session token, navigates to `redirectTo || '/'`. Onboarding gating is _not_ done here — an effect in `AppShellDesktop` (App.tsx) forces non-onboarding routes back to `/onboarding` while `onboarding_completed` is false, and bounces off it once complete.-- **`PublicRoute`** (`components/PublicRoute.tsx`) — redirects signed-in users to `/home` (which forwards to `/chat`).-- **`DefaultRedirect`** (`components/DefaultRedirect.tsx`) — signed out → `/`; signed in but onboarding incomplete → `/onboarding`; otherwise → `/chat`. Waits for `snapshot.currentUser` to avoid the post-login race.+- **`ProtectedRoute`** (`components/ProtectedRoute.tsx`) (`({ children, requireAuth = true, redirectTo })`; without a session token, navigates to `redirectTo || '/'`. Onboarding gating is _not_ done here) an effect in `AppShellDesktop` (App.tsx) forces non-onboarding routes back to `/onboarding` while `onboarding_completed` is false, and bounces off it once complete.+- **`PublicRoute`** (`components/PublicRoute.tsx`): redirects signed-in users to `/home` (which forwards to `/chat`).+- **`DefaultRedirect`** (`components/DefaultRedirect.tsx`): signed out → `/`; signed in but onboarding incomplete → `/onboarding`; otherwise → `/chat`. Waits for `snapshot.currentUser` to avoid the post-login race.### Onboarding Flow (`pages/onboarding/`)@@ -490,12 +490,12 @@ Each custom step offers **Default** (let OpenHuman manage it) vs **Configure** (Settings is a full `/settings/*` URL surface, presented on desktop as a **modal overlay** and on iOS as a full page. The old `SettingsPanelLayout` / `useSettingsAnimation` / `ProfilePanel` modal system is gone.-- **`components/settings/settingsRouteRegistry.ts`** — single declarative source of truth for every settings destination (id/route slug, i18n keys, section, sidebar `navGroup`, `devOnly`, search keywords). Navigation menus, breadcrumbs, and settings search all derive from it.-- **`components/settings/settingsRouteElements.tsx`** — maps registry entries to panel `<Route>` elements.-- **`components/settings/modal/`** — `SettingsModal` (mounted by `AppShellDesktop` whenever the path is a settings path; `settingsOverlay.ts` computes `{ settingsOpen, baseLocation }` so the page behind stays rendered), `SettingsModalFrame` (backdrop / Esc / focus / close), `SettingsModalLayout` (routed two-column layout).-- **`components/settings/layout/`** — two-pane chrome: `SettingsLayout`, `SettingsSidebar` (grouped by `SettingsNavGroup`: general, assistant, data, connections, knowledge & memory, agents & autonomy, models & inference, automation & integrations, diagnostics & logs), `SettingsSubNav`, `SettingsIndexRedirect`.-- **`components/settings/panels/`** — \~50 leaf panels (`AccountPanel`, `AppearancePanel`, `AIPanel`, `AgentsPanel`, `AgentAccessPanel`, `AutonomyPanel`, `BillingPanel`, `CronJobsPanel`, `IntegrationsPanel`, `McpServerPanel`, `NotificationsTabbedPanel`, `PrivacyPanel`, `DeveloperOptionsPanel`, …). Adding a panel = add the component + a registry entry; nav, breadcrumbs, and search pick it up automatically.-- **`components/settings/search/`** — settings search bar + registry-derived index.+- **`components/settings/settingsRouteRegistry.ts`**: single declarative source of truth for every settings destination (id/route slug, i18n keys, section, sidebar `navGroup`, `devOnly`, search keywords). Navigation menus, breadcrumbs, and settings search all derive from it.+- **`components/settings/settingsRouteElements.tsx`**: maps registry entries to panel `<Route>` elements.+- **`components/settings/modal/`**: `SettingsModal` (mounted by `AppShellDesktop` whenever the path is a settings path; `settingsOverlay.ts` computes `{ settingsOpen, baseLocation }` so the page behind stays rendered), `SettingsModalFrame` (backdrop / Esc / focus / close), `SettingsModalLayout` (routed two-column layout).+- **`components/settings/layout/`**: two-pane chrome: `SettingsLayout`, `SettingsSidebar` (grouped by `SettingsNavGroup`: general, assistant, data, connections, knowledge & memory, agents & autonomy, models & inference, automation & integrations, diagnostics & logs), `SettingsSubNav`, `SettingsIndexRedirect`.+- **`components/settings/panels/`**: \~50 leaf panels (`AccountPanel`, `AppearancePanel`, `AIPanel`, `AgentsPanel`, `AgentAccessPanel`, `AutonomyPanel`, `BillingPanel`, `CronJobsPanel`, `IntegrationsPanel`, `McpServerPanel`, `NotificationsTabbedPanel`, `PrivacyPanel`, `DeveloperOptionsPanel`, …). Adding a panel = add the component + a registry entry; nav, breadcrumbs, and search pick it up automatically.+- **`components/settings/search/`**: settings search bar + registry-derived index.### HashRouter vs BrowserRouter@@ -550,10 +550,10 @@ components/Conventions:-- **Modal via portal** — shell modals (Settings, link modal) render above routed content; the Settings modal uses the backgroundLocation pattern rather than unmounting the page underneath.-- **Controlled modals** — parents own `isOpen` state and pass `onClose`.-- **i18n everywhere** — all user-facing text goes through `useT()` (`lib/i18n/I18nContext`); CI enforces locale parity.-- **No dynamic imports** in production `app/src` code — static `import` / `import type` only.+- **Modal via portal**: shell modals (Settings, link modal) render above routed content; the Settings modal uses the backgroundLocation pattern rather than unmounting the page underneath.+- **Controlled modals**: parents own `isOpen` state and pass `onClose`.+- **i18n everywhere**: all user-facing text goes through `useT()` (`lib/i18n/I18nContext`); CI enforces locale parity.+- **No dynamic imports** in production `app/src` code: static `import` / `import type` only.---@@ -563,12 +563,12 @@ Conventions:\~40 app-level hooks. Representative examples:-- **`useUser`** — thin wrapper over `useCoreState()`; returns `{ user: snapshot.currentUser, isLoading, error, refetch }`. There is no standalone user store.-- **`useBackendUrl`** — runtime backend URL resolution (see [Runtime config precedence](frontend.md#runtime-config-precedence)).-- **`useThreadQueries`** — chat thread fetching.-- **`useDaemonHealth` / `useDaemonLifecycle`** — core service health.-- **`useDictationHotkey` / `usePttHotkey`** — global hotkey managers.-- **`useDeveloperMode`**, **`useMediaQuery`**, **`useEscapeKey`** — UI utilities.+- **`useUser`**: thin wrapper over `useCoreState()`; returns `{ user: snapshot.currentUser, isLoading, error, refetch }`. There is no standalone user store.+- **`useBackendUrl`**: runtime backend URL resolution (see [Runtime config precedence](frontend.md#runtime-config-precedence)).+- **`useThreadQueries`**: chat thread fetching.+- **`useDaemonHealth` / `useDaemonLifecycle`**: core service health.+- **`useDictationHotkey` / `usePttHotkey`**: global hotkey managers.+- **`useDeveloperMode`**, **`useMediaQuery`**, **`useEscapeKey`**: UI utilities.- Feature hooks: `useFlowRunProgress`, `useWorkflowBuilderChat`, `useConsciousItems`, `useIntelligenceStats`, `useCostDashboard`, ….Feature-local hooks live next to their feature under `features/*/`.@@ -577,7 +577,7 @@ Feature-local hooks live next to their feature under `features/*/`.#### Configuration (`utils/config.ts`)-Centralized build-time environment variable access — **never read `import.meta.env` directly elsewhere**. These constants only carry the value baked into the bundle; for the **runtime** URL the app actually talks to, see `services/backendUrl` and `hooks/useBackendUrl`.+Centralized build-time environment variable access: **never read `import.meta.env` directly elsewhere**. These constants only carry the value baked into the bundle; for the **runtime** URL the app actually talks to, see `services/backendUrl` and `hooks/useBackendUrl`.```typescript// Build-time fallback only (used outside Tauri).@@ -606,15 +606,15 @@ Handles incoming `openhuman://` deep links via the Tauri deep-link plugin: parse#### URL Opener (`utils/openUrl.ts`)-Cross-platform URL opening — tries the Tauri opener plugin, falls back to `window.open`. Always use this instead of raw `window.open` so links open in the system browser.+Cross-platform URL opening: tries the Tauri opener plugin, falls back to `window.open`. Always use this instead of raw `window.open` so links open in the system browser.#### Tauri command wrappers (`utils/tauriCommands/`)-Typed wrappers around `invoke(...)`, including the bridge-gap-aware `isTauri()` guard (checks `__TAURI_INTERNALS__.invoke` is actually wired, not merely that the app runs under Tauri). Use it — never check `window.__TAURI__` directly.+Typed wrappers around `invoke(...)`, including the bridge-gap-aware `isTauri()` guard (checks `__TAURI_INTERNALS__.invoke` is actually wired, not merely that the app runs under Tauri). Use it: never check `window.__TAURI__` directly.### Polyfills (`polyfills.ts`)-Node.js globals (`Buffer`, `process`, `util`) polyfilled for the browser. Several browser-side modules use Node APIs — e.g. voice/PTT audio encoding (`features/voice/pttAudio.ts`, `wavEncoder.ts`), mascot Rive asset caching (`features/human/Mascot/`), the Meet mascot frame producer, and tool-timeline formatting.+Node.js globals (`Buffer`, `process`, `util`) polyfilled for the browser. Several browser-side modules use Node APIs: e.g. voice/PTT audio encoding (`features/voice/pttAudio.ts`, `wavEncoder.ts`), mascot Rive asset caching (`features/human/Mascot/`), the Meet mascot frame producer, and tool-timeline formatting.Two layers provide them:diff --git a/gitbooks/developing/architecture/tauri-shell.md b/gitbooks/developing/architecture/tauri-shell.mdindex b5bfc8bf02..bca32d4fcd 100644--- a/gitbooks/developing/architecture/tauri-shell.md+++ b/gitbooks/developing/architecture/tauri-shell.md@@ -43,7 +43,7 @@ Non-desktop targets fail at compile time (`compile_error!` in `lib.rs`).crates/openhuman-app/src/├── lib.rs # `run()`, tray/menu, plugins, `generate_handler!`, most window/update/lifecycle commands├── main.rs # Binary entry-├── core_process.rs # CoreProcessHandle — embedded core server task, RPC token, port conflict handling+├── core_process.rs # CoreProcessHandle: embedded core server task, RPC token, port conflict handling├── core_rpc.rs # Auth helpers + `relay_http_rpc` host-side HTTP relay├── gateway/ # Where the frontend's RPC goes: the core in this process, a│ # core at a URL, or one this app provisions in a container /@@ -69,7 +69,7 @@ crates/openhuman-app/src/This listing was rewritten against the real tree after #5478 / #5456. Gone withthe move off Chromium: `cdp/`, the `cef_*` preflight modules, `webview_accounts/`,every `*_scanner/` but `imessage_scanner/`, the `meet_*` call window,-`fake_camera/` and `companion_commands.rs`. `webview_apis/` went later — it was+`fake_camera/` and `companion_commands.rs`. `webview_apis/` went later: it wasthe WS bridge those scanners called, and once they were gone its routerdispatched nothing while still binding a loopback listener at boot.@@ -84,7 +84,7 @@ React (fetch)→ embedded openhuman core server (tokio task in this process)```-The renderer talks to the local core **directly over HTTP** — `app/src/services/coreRpcClient.ts` invokes `core_rpc_url` / `core_rpc_token` once, then issues plain `fetch()` calls. The `relay_http_rpc` Tauri command is a host-side fallback used only when the RPC URL is **not** a trustworthy origin for the secure `tauri://localhost` webview (e.g. a self-hosted runtime on a LAN IP, blocked as mixed content — #3865): the Rust host delegates to `openhuman_rpc::post_json_rpc` from the shared `crates/openhuman-rpc` crate (feature `http-client`): 30 s timeout, redirects disabled when a bearer is present, status + body mirrored back verbatim as `HttpRpcResponse`. The shell adds only the gateway transport guard (`validate_remote_transport`, feature `gateways`) before delegating.+The renderer talks to the local core **directly over HTTP** (`app/src/services/coreRpcClient.ts` invokes `core_rpc_url` / `core_rpc_token` once, then issues plain `fetch()` calls. The `relay_http_rpc` Tauri command is a host-side fallback used only when the RPC URL is **not** a trustworthy origin for the secure `tauri://localhost` webview (e.g. a self-hosted runtime on a LAN IP, blocked as mixed content) #3865): the Rust host delegates to `openhuman_rpc::post_json_rpc` from the shared `crates/openhuman-rpc` crate (feature `http-client`): 30 s timeout, redirects disabled when a bearer is present, status + body mirrored back verbatim as `HttpRpcResponse`. The shell adds only the gateway transport guard (`validate_remote_transport`, feature `gateways`) before delegating.`CoreProcessHandle` in `core_process.rs` owns the embedded server task (started via `openhuman_core::core::jsonrpc::run_server_embedded_with_ready` with a per-launch random bearer token) and handles stale-listener/port-conflict recovery.@@ -107,13 +107,13 @@ The renderer talks to the local core **directly over HTTP** — `app/src/service## Tauri IPC commands (`crates/openhuman-app`)-All commands are registered in **`crates/openhuman-app/src/lib.rs`** inside `tauri::generate_handler![...]` — that list is the authoritative reference. The major families:+All commands are registered in **`crates/openhuman-app/src/lib.rs`** inside `tauri::generate_handler![...]`: that list is the authoritative reference. The major families:### Core RPC & diagnostics| Command | Purpose || -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |-| `core_rpc_url` | Return the **active gateway's** JSON-RPC URL — the embedded core's `http://127.0.0.1:<port>/rpc` unless another gateway is active |+| `core_rpc_url` | Return the **active gateway's** JSON-RPC URL: the embedded core's `http://127.0.0.1:<port>/rpc` unless another gateway is active || `core_rpc_token` | Return the active gateway's bearer. Paired with `core_rpc_url`: a token minted for the embedded core is meaningless to a core in a container || `relay_http_rpc` | Host-side JSON-RPC POST (`{ url, token?, body }` → `{ status, body }`) for self-hosted runtimes the webview cannot fetch (mixed content, #3865) || `overlay_parent_rpc_url` | RPC URL inherited from a parent process (overlay windows), from `OPENHUMAN_CORE_RPC_URL` |@@ -121,10 +121,10 @@ All commands are registered in **`crates/openhuman-app/src/lib.rs`** inside `tauUse **`app/src/services/coreRpcClient.ts`** (`callCoreRpc`) from the frontend.-### Gateways — running the core somewhere else+### Gateways: running the core somewhere elseA **gateway** is one way of reaching an OpenHuman core. Four exist: the core inside this-process, a core somebody else is running at a URL, and two this app provisions itself — in+process, a core somebody else is running at a URL, and two this app provisions itself: ina Docker container, or on a machine reached over SSH. The last two are the same code:[tinybox](https://github.com/tinyhumansai/tinybox) models *reach* (`local` / `ssh`) and*confinement* (`passthrough` / `docker`) as independent axes, so "a container on the build@@ -132,13 +132,13 @@ server" is those two choices made separately rather than a third case with code**The seam is one line.** A gateway resolves to a URL and a bearer, and `core_rpc_url` /`core_rpc_token` answer from the active one. Every RPC call site in the renderer therefore-follows along unchanged — there is no per-gateway transport in the frontend, and+follows along unchanged: there is no per-gateway transport in the frontend, and`services/transport/` (the iOS `ConnectionProfile` path) is not involved.Provisioning is four tinybox calls: `create` a box publishing the core's port, `spawn` thecore in it detached with a freshly minted bearer, `forward` that published port back tothis machine, then poll the core's unauthenticated `/health`. The third step is the one-that is easy to omit and impossible to notice missing — publishing puts the port on the+that is easy to omit and impossible to notice missing: publishing puts the port on the*box's* host, which for an SSH placement is the far machine.| Command | Purpose |@@ -202,7 +202,7 @@ A JWT accepted while the backend is unreachable (live `exp`, subject claim) is i| Command | Purpose || ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- || `register_dictation_hotkey` / `unregister_dictation_hotkey` | Global dictation shortcuts (`dictation_hotkeys.rs`) |-| `register_ptt_hotkey` / `unregister_ptt_hotkey` / `show_ptt_overlay` | Push-to-talk — see the [PTT section](#push-to-talk-ptt-hotkey--overlay) below |+| `register_ptt_hotkey` / `unregister_ptt_hotkey` / `show_ptt_overlay` | Push-to-talk: see the [PTT section](#push-to-talk-ptt-hotkey--overlay) below |### Notifications@@ -216,7 +216,7 @@ A JWT accepted while the backend is unreachable (live `exp`, subject claim) is i| `mascot_window_show` / `mascot_window_hide` | Toggle the mascot native window || `notch_window_show` / `notch_window_hide` | Toggle the notch window |-Hide-to-tray / reopen behavior is **not** an IPC command — it lives in the `RunEvent` handlers in `lib.rs` (see [Window and tray behavior](#window-and-tray-behavior)).+Hide-to-tray / reopen behavior is **not** an IPC command: it lives in the `RunEvent` handlers in `lib.rs` (see [Window and tray behavior](#window-and-tray-behavior)).### Artifacts, logs, MCP, OAuth@@ -302,7 +302,7 @@ The Tauri crate **does not** embed a duplicate Socket.io server or Telegram clie### `CoreProcessHandle` (`core_process.rs`)-- Runs the core's HTTP/JSON-RPC server as a **tokio task inside the Tauri host** via `openhuman_core::core::jsonrpc::run_server_embedded_with_ready` — no sidecar binary.+- Runs the core's HTTP/JSON-RPC server as a **tokio task inside the Tauri host** via `openhuman_core::core::jsonrpc::run_server_embedded_with_ready`: no sidecar binary.- Generates a per-launch 256-bit hex bearer token (`generate_rpc_token`) and hands it to the embedded server; the renderer reads it via the `core_rpc_token` command.- Stale-listener policy (#1130): if the core port is already occupied, probes whether the listener is an old OpenHuman core (terminate + respawn) or something foreign (surface the conflict). `OPENHUMAN_CORE_REUSE_EXISTING=1` opts back into attach-to-existing for debugging.- Managed as Tauri state in `lib.rs` (`app.manage(core_handle)`).