diff --git a/app/src-tauri/src/service.rs b/app/src-tauri/src/service.rs index ad96c32..8a26af5 100644 --- a/app/src-tauri/src/service.rs +++ b/app/src-tauri/src/service.rs @@ -301,6 +301,20 @@ fn valid_node_override(custom: Option<&OsStr>) -> Option { custom_path.is_file().then_some(custom_path) } +/// Directory of the bundled sidecar payload (service.js, node, native, +/// node_modules). Windows installs keep it next to the executable; a macOS app +/// bundle keeps it in `Contents/Resources` (UF-004). +fn bundled_resources_dir(exe_dir: &Path) -> PathBuf { + let next_to_exe = exe_dir.join("resources"); + let app_bundle = exe_dir + .parent() + .map(|contents| contents.join("Resources").join("resources")); + std::iter::once(next_to_exe.clone()) + .chain(app_bundle) + .find(|dir| dir.join("service.js").exists()) + .unwrap_or(next_to_exe) +} + /// Resolve the Node.js binary path. /// Priority: WAGGLE_NODE_PATH env → bundled resources/node[.exe] → system PATH "node" fn resolve_node_path() -> String { @@ -313,16 +327,17 @@ fn resolve_node_path() -> String { eprintln!("[waggle] Ignoring WAGGLE_NODE_PATH because it is not a runtime file"); } - // 2. Bundled Node.js in resources/ directory (next to exe) + // 2. Bundled Node.js in the bundled resources directory let exe_dir = std::env::current_exe() .ok() .and_then(|p| p.parent().map(|d| d.to_path_buf())); if let Some(ref dir) = exe_dir { + let resources = bundled_resources_dir(dir); let bundled = if cfg!(windows) { - dir.join("resources").join("node.exe") + resources.join("node.exe") } else { - dir.join("resources").join("node") + resources.join("node") }; if bundled.exists() { return bundled.to_string_lossy().to_string(); @@ -583,7 +598,7 @@ fn resolve_service_script( current_dir: &Path, ) -> Result { if let Some(dir) = exe_dir { - let bundled = dir.join("resources").join("service.js"); + let bundled = bundled_resources_dir(dir).join("service.js"); if bundled.exists() { return Ok(ServiceScript { path: bundled, @@ -640,7 +655,7 @@ fn build_service_command( cmd.env("WAGGLE_SKIP_LITELLM", "1"); if let Some(ref dir) = exe_dir { - let resources_dir = dir.join("resources"); + let resources_dir = bundled_resources_dir(dir); let native_dir = resources_dir.join("native"); let node_modules_dir = resources_dir.join("node_modules"); let configured_data_dir = std::env::var_os("WAGGLE_DATA_DIR"); @@ -957,6 +972,30 @@ mod tests { assert!(state.verified_port().is_err()); } + #[test] + fn service_script_resolves_from_a_macos_app_bundle() { + let root = + std::env::temp_dir().join(format!("waggle-app-bundle-{}", std::process::id())); + let macos = root.join("Waggle.app").join("Contents").join("MacOS"); + let resources = root + .join("Waggle.app") + .join("Contents") + .join("Resources") + .join("resources"); + std::fs::create_dir_all(&macos).expect("creates MacOS dir"); + std::fs::create_dir_all(&resources).expect("creates bundle resources"); + std::fs::write(resources.join("service.js"), "console.log('ok')").expect("writes service"); + + let script = resolve_service_script(Some(&macos), Path::new("/nonexistent")) + .expect("bundled script resolves from Contents/Resources"); + + assert_eq!(script.kind, ServiceScriptKind::Bundled); + assert_eq!(script.path, resources.join("service.js")); + assert_eq!(bundled_resources_dir(&macos), resources); + + let _ = std::fs::remove_dir_all(root); + } + #[test] fn service_script_prefers_bundled_resource_when_present() { let root = diff --git a/apps/web/index.html b/apps/web/index.html index 80062bf..ebb06fa 100644 --- a/apps/web/index.html +++ b/apps/web/index.html @@ -11,6 +11,18 @@ diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx index 03545e0..8b7f643 100644 --- a/apps/web/src/main.tsx +++ b/apps/web/src/main.tsx @@ -6,16 +6,8 @@ if (!root) throw new Error('Waggle root element is missing'); const startup = document.createElement('main'); startup.setAttribute('role', 'status'); startup.setAttribute('aria-live', 'polite'); +// Styled by the [data-waggle-startup] rules in index.html. startup.dataset.waggleStartup = 'loading'; -Object.assign(startup.style, { - alignItems: 'center', - color: '#f6f1e4', - display: 'flex', - fontFamily: 'system-ui, sans-serif', - fontSize: '16px', - justifyContent: 'center', - minHeight: '100vh', -}); const startupMessage = document.createElement('p'); startupMessage.textContent = 'Starting Waggle…'; diff --git a/docs/oss/upstream-fixes.md b/docs/oss/upstream-fixes.md index 15ea8d6..a976cf0 100644 --- a/docs/oss/upstream-fixes.md +++ b/docs/oss/upstream-fixes.md @@ -32,7 +32,7 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`. | UF-001 | Vendored PptxGenJS runtime is missing from the repository | Fixed | Build, git | | UF-002 | Setup instructions skip the package build step | Open | Docs, build | | UF-003 | `npm run dev:web` cannot authenticate against the sidecar | Workaround | Web UI, sidecar | -| UF-004 | Packaged macOS and Linux apps likely cannot find the sidecar | Open | Desktop shell | +| UF-004 | Packaged macOS and Linux apps cannot find the sidecar | Fixed on macOS, open on Linux | Desktop shell | | UF-005 | Live Stripe webhook secret in git history | Open | Security | | UF-006 | Conflicting license files in weaver and optimizer | Open | Licensing | | UF-007 | Onboarding Industry dropdown opens invisibly under the scrim | Fixed | Web UI | @@ -45,7 +45,7 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`. | UF-014 | Timeline "Edit" button has no action | Open | Web UI | | UF-015 | Ctrl+Shift+digit app shortcuts never fire | Open | Web UI | | UF-016 | Tailwind `dark:` variants never apply | Open | Web UI | -| UF-017 | Startup text is invisible in the light theme | Open | Web UI | +| UF-017 | Startup text is invisible in the light theme | Fixed | Web UI | | UF-018 | Default model shown in the top bar disagrees with Model Pilot | Open | Web UI, models | | UF-019 | Memory count pluralization: "1 Memories" | Open | Web UI | | UF-020 | WhatsApp connector bundles GPL-3.0 code into the sidecar | Fixed | Licensing | @@ -98,13 +98,13 @@ Baseline: commit `b20b138` of `git.os-dev.tech/oleg.m/waggle-os`. - What we did: built the UI with `npm run build` and opened it through the sidecar on `http://localhost:3333`, the same way the Playwright suite and `install.sh` run it. No code changes. - Recommendation: set `changeOrigin: false` for the `/api` and `/health` proxies so `Host` stays `localhost:8080`, or allow the dev-server origin explicitly. Confirm the security intent of the bootstrap check first. Update the README accordingly. -### UF-004. Packaged macOS and Linux apps likely cannot find the sidecar -- Status: Open (found by reading the code; not yet confirmed by launching a packaged build) +### UF-004. Packaged macOS and Linux apps cannot find the sidecar +- Status: Fixed on macOS (confirmed on 2026-10-24 by launching a packaged build: the window stays on "Starting Waggle…"); open on Linux - Found: 2026-09-27 - Where: `app/src-tauri/src/service.rs`, functions `resolve_node_path` and `resolve_service_script` - Symptom: expected error on start of a packaged macOS or Linux build: the shell cannot locate `node` or `resources/service.js`. - Cause: both functions look for resources next to the executable (`std::env::current_exe()`). That matches the Windows NSIS layout only. On macOS resources live in `Contents/Resources`, on Linux under `/usr/lib/`. The code never uses Tauri's `resource_dir()`. CI builds the macOS app but never launches it. -- What we did: nothing yet. Planned in work package P1.3d. +- What we did: `bundled_resources_dir()` in `service.rs` looks next to the executable first (Windows) and then in the app bundle's `Contents/Resources/resources` (macOS), for `node`, `service.js`, `native/` and `node_modules/`. The Linux layout follows with the Linux packages in P1.3d. - Recommendation: resolve resources through `app.path().resource_dir()` and add a CI smoke test that launches packaged macOS and Linux builds. ### UF-005. Live Stripe webhook secret in git history @@ -198,9 +198,10 @@ Entries UF-010 to UF-019 come from the UI audit `anti-slop/audit-001-2026-10-14. - Recommendation: use `darkMode: ["selector", '[data-theme="dark"]']` or set `.dark` together with `data-theme`. ### UF-017. Startup text is invisible in the light theme -- Status: Open (code) +- Status: Fixed - Where: `apps/web/src/main.tsx:12` - Symptom: the "Starting Waggle…" text has a fixed colour `#f6f1e4`, while the light theme background is `#f7f1e4`. +- What we did: the startup screen takes its styles from `index.html`, with a dark text colour for the light theme. It is also fixed to the window, so the unstyled body no longer shows scroll bars around it. - Recommendation: use a theme token for the startup text. ### UF-018. Default model shown in the top bar disagrees with Model Pilot