diff --git a/src/facade/README.md b/src/facade/README.md index 675a962..fdf14d6 100644 --- a/src/facade/README.md +++ b/src/facade/README.md @@ -7,10 +7,20 @@ Portable iframe facade for the Wippy frontend. Serves a thin HTML shell that loa 1. `index.html` is served as a static file via `http.static` 2. On load, it fetches `GET /api/public/facade/config` to get runtime configuration 3. Checks `localStorage` for an auth token, redirects to `login_path` if missing -4. Creates an iframe pointing to the CDN-hosted frontend bundle -5. Bridges auth and routing between the host page and the iframe via `postMessage` +4. Loads the Web Host bundle from CDN (`facade_url + '/module.js'`) +5. Calls `initWippyApp()` with auth, feature flags, and customization config +6. Shows inline loader/error UI during initialization (no external CSS dependencies) -API URL and WebSocket URL are derived from the `domain` requirement. If `domain` is empty, the browser falls back to `window.location`. +## Derived values + +These fields are NOT configurable via requirements — they are computed at runtime: + +| Field | Source | Description | +|---|---|---| +| `api_url` | `PUBLIC_API_URL` env var | Base URL for API calls. Falls back to `window.location.origin` in the browser if empty. | +| `ws_url` | Derived from `api_url` | WebSocket URL — `http://` → `ws://`, `https://` → `wss://` | +| `iframe_origin` | Extracted from `fe_facade_url` | Origin portion of facade URL (e.g. `https://web-host.wippy.ai`), used for `postMessage` security | +| `iframe_url` | `fe_facade_url` + `fe_entry_path` + `?waitForCustomConfig` | Full iframe URL passed to the Web Host | ## Requirements @@ -25,36 +35,50 @@ API URL and WebSocket URL are derived from the `domain` requirement. If `domain` | Requirement | Default | Description | |---|---|---| -| `domain` | _(empty)_ | Canonical app domain (e.g. `localhost:8085`, `app.wippy.ai`). Derives API and WS URLs. | -| `fe_facade_url` | `https://web-host.wippy.ai/webcomponents-1.0.5` | CDN base URL for frontend bundle | -| `fe_entry_path` | `/iframe.html` | Entry point path within the bundle | +| `fe_facade_url` | `https://web-host.wippy.ai/webcomponents-1.0.12` | CDN base URL for the Web Host frontend bundle | +| `fe_entry_path` | `/iframe.html` | Iframe HTML entry point path (appended to `fe_facade_url`) | ### App Identity -| Requirement | Default | Description | -|---|---|---| -| `app_title` | `Wippy` | Sidebar title | -| `app_name` | `Wippy AI` | Full app name | -| `app_icon` | `wippy:logo` | Iconify icon reference | +Passed to the Web Host as `customization.i18n.app` — controls branding in sidebar and navigation. + +| Requirement | Default | Config path | Description | +|---|---|---|---| +| `app_title` | `Wippy` | `customization.i18n.app.title` | Short title shown in sidebar header | +| `app_name` | `Wippy AI` | `customization.i18n.app.appName` | Full application name | +| `app_icon` | `wippy:logo` | `customization.i18n.app.icon` | Iconify icon reference (e.g. `custom:logo`, `tabler:home`) | ### Feature Flags -| Requirement | Default | Description | -|---|---|---| -| `show_admin` | `true` | Show admin panel and keeper controls in the sidebar | -| `start_nav_open` | `false` | Navigation drawer open by default (collapsed shows icons only) | -| `hide_nav_bar` | `false` | Completely hide the left navigation sidebar | -| `disable_right_panel` | `false` | Disable the right sidebar panel | -| `allow_select_model` | `false` | Allow LLM model selection | -| `session_type` | `non-persistent` | Chat session persistence (`non-persistent` or `persistent`) | -| `history_mode` | `hash` | Browser history mode (`hash` or `history`) | +Passed to the Web Host as `feature.*` — control UI behavior and visibility. + +| Requirement | Default | Type | Description | +|---|---|---|---| +| `show_admin` | `true` | bool (`~= "false"`) | Show admin panel and keeper controls in the sidebar | +| `start_nav_open` | `false` | bool (`== "true"`) | Navigation drawer open by default (collapsed shows icons only) | +| `hide_nav_bar` | `false` | bool (`== "true"`) | Completely hide the left navigation sidebar | +| `disable_right_panel` | `false` | bool (`== "true"`) | Disable the right sidebar panel | +| `allow_select_model` | `false` | bool (`== "true"`) | Allow LLM model selection dropdown in chat | +| `session_type` | `non-persistent` | string | Chat session persistence (`non-persistent` or `cookie`) | +| `history_mode` | `hash` | string | Browser history mode (`hash` or `history`/`browser`) | + +> **Boolean parsing:** `show_admin` defaults to `true` (any value except `"false"` is truthy). All other boolean flags default to `false` (only `"true"` is truthy). This is implemented in `config_handler.lua`. -### Auth & Theming +### Auth | Requirement | Default | Description | |---|---|---| -| `login_path` | `/login.html` | Unauthenticated redirect path | -| `custom_css` | Poppins font import | Custom CSS injected into iframe config | +| `login_path` | `/login.html` | Path to redirect unauthenticated users (no token in localStorage) | + +### Theming & Customization + +Passed to the Web Host as `customization.*` — control visual appearance across all host-rendered pages and web components. + +| Requirement | Default | Config path | Description | +|---|---|---|---| +| `custom_css` | Poppins font `@import` | `customization.custom_css` | Raw CSS string injected as `
-