Application Composition

Browser, server, and native surfaces enter through separate source-defined compositions. In the mogo-src app, the global enhancement subtree is gated separately from startup effects.

flowchart TD
  subgraph Browser["Browser roots"]
    M1["mogo-src/main.tsx"] -->|"renders"| M2["mogo-src/app/App.tsx"]
    R1["Mogo Robot/src/main.tsx"] -->|"renders"| R2["Mogo Robot/src/app/App.tsx"]
    V1["Mogo Robot/Mogo Moving/src/main.tsx"] -->|"renders"| V2["Mogo Robot/Mogo Moving/src/app/App.tsx"]
  end

  subgraph Next["Next composition"]
    L["app/layout.tsx"] -->|"wraps"| P["app/[[...slug]]/page.tsx"]
    P -->|"returns"| M2
  end

  subgraph Worker["Worker request boundary"]
    W["worker/index.ts fetch"] -->|"image path"| I["Image optimization"]
    W -->|"other paths"| H["Imported handler.fetch"]
  end

  subgraph Expo["Expo composition"]
    E["Mogo Robot/app/_layout.tsx"] -->|"renders"| S["Route Stack"]
    X["Mogo Robot/app/index.tsx"] -->|"/web, path /"| Q["Declared /web route"]
  end

  subgraph Native["Native WebView source"]
    N["Mogo Robot/app/web.native.tsx"] --> D{"Remote base and reachability?"}
    D -->|"yes"| U1["Remote URI"]
    D -->|"otherwise"| U2["Local path"]
  end

  Q -.->|"target-platform route resolution unestablished"| N

[!NOTE] These are source-declared handoffs, not proof of which browser root a target build selects; check the target workspace and build entrypoint before attributing behavior or choosing an edit point. The Expo index redirects to /web, but target-platform resolution among its route modules is not established; verify the target resolver. The native helper returns no remote base when __DEV__ is defined and false; if __DEV__ is undefined, that guard does not return early. Remote URI selection still requires a configured EXPO_PUBLIC_WEB_APP_URL and the source-defined reachability check to pass; actual host availability remains unverified. The Worker delegates requests that fall through its image branch to an imported handler; its internal composition and deployed wiring are not established, so check the target Worker build configuration.

When global enhancements render

Timing Source-defined composition
Outside the 900 ms enhancement gate Usage tracking, reminder speech, announcement queue, and SPA-location bridge; separate idle schedulers.
900 ms readiness-gated subtree Adaptation and AI usage meter; live voice and global commands; motion and idle overlays.