fix(desktop): find the sidecar in a macOS app bundle and fit the startup screen (UF-004, UF-017)
- The packaged macOS app stayed on "Starting Waggle…": the shell looked for node, service.js, native/ and node_modules/ next to the executable, the Windows layout, while a macOS bundle keeps them in Contents/Resources/resources. bundled_resources_dir() checks both. - The startup screen used min-height 100vh on an unstyled body, which showed scroll bars, and a fixed light text colour that is invisible in the light theme. It is now styled from index.html, fixed to the window, with a dark text colour for the light theme.
This commit is contained in:
@@ -301,6 +301,20 @@ fn valid_node_override(custom: Option<&OsStr>) -> Option<PathBuf> {
|
|||||||
custom_path.is_file().then_some(custom_path)
|
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.
|
/// Resolve the Node.js binary path.
|
||||||
/// Priority: WAGGLE_NODE_PATH env → bundled resources/node[.exe] → system PATH "node"
|
/// Priority: WAGGLE_NODE_PATH env → bundled resources/node[.exe] → system PATH "node"
|
||||||
fn resolve_node_path() -> String {
|
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");
|
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()
|
let exe_dir = std::env::current_exe()
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|p| p.parent().map(|d| d.to_path_buf()));
|
.and_then(|p| p.parent().map(|d| d.to_path_buf()));
|
||||||
|
|
||||||
if let Some(ref dir) = exe_dir {
|
if let Some(ref dir) = exe_dir {
|
||||||
|
let resources = bundled_resources_dir(dir);
|
||||||
let bundled = if cfg!(windows) {
|
let bundled = if cfg!(windows) {
|
||||||
dir.join("resources").join("node.exe")
|
resources.join("node.exe")
|
||||||
} else {
|
} else {
|
||||||
dir.join("resources").join("node")
|
resources.join("node")
|
||||||
};
|
};
|
||||||
if bundled.exists() {
|
if bundled.exists() {
|
||||||
return bundled.to_string_lossy().to_string();
|
return bundled.to_string_lossy().to_string();
|
||||||
@@ -583,7 +598,7 @@ fn resolve_service_script(
|
|||||||
current_dir: &Path,
|
current_dir: &Path,
|
||||||
) -> Result<ServiceScript, String> {
|
) -> Result<ServiceScript, String> {
|
||||||
if let Some(dir) = exe_dir {
|
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() {
|
if bundled.exists() {
|
||||||
return Ok(ServiceScript {
|
return Ok(ServiceScript {
|
||||||
path: bundled,
|
path: bundled,
|
||||||
@@ -640,7 +655,7 @@ fn build_service_command(
|
|||||||
cmd.env("WAGGLE_SKIP_LITELLM", "1");
|
cmd.env("WAGGLE_SKIP_LITELLM", "1");
|
||||||
|
|
||||||
if let Some(ref dir) = exe_dir {
|
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 native_dir = resources_dir.join("native");
|
||||||
let node_modules_dir = resources_dir.join("node_modules");
|
let node_modules_dir = resources_dir.join("node_modules");
|
||||||
let configured_data_dir = std::env::var_os("WAGGLE_DATA_DIR");
|
let configured_data_dir = std::env::var_os("WAGGLE_DATA_DIR");
|
||||||
@@ -957,6 +972,30 @@ mod tests {
|
|||||||
assert!(state.verified_port().is_err());
|
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]
|
#[test]
|
||||||
fn service_script_prefers_bundled_resource_when_present() {
|
fn service_script_prefers_bundled_resource_when_present() {
|
||||||
let root =
|
let root =
|
||||||
|
|||||||
@@ -11,6 +11,18 @@
|
|||||||
<style>
|
<style>
|
||||||
html { background-color: #14110b; }
|
html { background-color: #14110b; }
|
||||||
html[data-theme="light"] { background-color: #f7f1e4; }
|
html[data-theme="light"] { background-color: #f7f1e4; }
|
||||||
|
/* Startup screen (src/main.tsx), shown before the app's styles load. It
|
||||||
|
fills the window without overflowing the unstyled body. */
|
||||||
|
[data-waggle-startup] {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font: 16px system-ui, sans-serif;
|
||||||
|
color: #f6f1e4;
|
||||||
|
}
|
||||||
|
html[data-theme="light"] [data-waggle-startup] { color: #14110b; }
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<link rel="icon" type="image/png" href="/waggle-logo.png" />
|
<link rel="icon" type="image/png" href="/waggle-logo.png" />
|
||||||
|
|||||||
@@ -6,16 +6,8 @@ if (!root) throw new Error('Waggle root element is missing');
|
|||||||
const startup = document.createElement('main');
|
const startup = document.createElement('main');
|
||||||
startup.setAttribute('role', 'status');
|
startup.setAttribute('role', 'status');
|
||||||
startup.setAttribute('aria-live', 'polite');
|
startup.setAttribute('aria-live', 'polite');
|
||||||
|
// Styled by the [data-waggle-startup] rules in index.html.
|
||||||
startup.dataset.waggleStartup = 'loading';
|
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');
|
const startupMessage = document.createElement('p');
|
||||||
startupMessage.textContent = 'Starting Waggle…';
|
startupMessage.textContent = 'Starting Waggle…';
|
||||||
|
|||||||
@@ -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-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-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-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-005 | Live Stripe webhook secret in git history | Open | Security |
|
||||||
| UF-006 | Conflicting license files in weaver and optimizer | Open | Licensing |
|
| UF-006 | Conflicting license files in weaver and optimizer | Open | Licensing |
|
||||||
| UF-007 | Onboarding Industry dropdown opens invisibly under the scrim | Fixed | Web UI |
|
| 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-014 | Timeline "Edit" button has no action | Open | Web UI |
|
||||||
| UF-015 | Ctrl+Shift+digit app shortcuts never fire | 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-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-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-019 | Memory count pluralization: "1 Memories" | Open | Web UI |
|
||||||
| UF-020 | WhatsApp connector bundles GPL-3.0 code into the sidecar | Fixed | Licensing |
|
| 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.
|
- 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.
|
- 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
|
### UF-004. Packaged macOS and Linux apps cannot find the sidecar
|
||||||
- Status: Open (found by reading the code; not yet confirmed by launching a packaged build)
|
- 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
|
- Found: 2026-09-27
|
||||||
- Where: `app/src-tauri/src/service.rs`, functions `resolve_node_path` and `resolve_service_script`
|
- 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`.
|
- 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/<app>`. The code never uses Tauri's `resource_dir()`. CI builds the macOS app but never launches it.
|
- 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/<app>`. 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.
|
- 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
|
### 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`.
|
- Recommendation: use `darkMode: ["selector", '[data-theme="dark"]']` or set `.dark` together with `data-theme`.
|
||||||
|
|
||||||
### UF-017. Startup text is invisible in the light theme
|
### UF-017. Startup text is invisible in the light theme
|
||||||
- Status: Open (code)
|
- Status: Fixed
|
||||||
- Where: `apps/web/src/main.tsx:12`
|
- Where: `apps/web/src/main.tsx:12`
|
||||||
- Symptom: the "Starting Waggle…" text has a fixed colour `#f6f1e4`, while the light theme background is `#f7f1e4`.
|
- 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.
|
- Recommendation: use a theme token for the startup text.
|
||||||
|
|
||||||
### UF-018. Default model shown in the top bar disagrees with Model Pilot
|
### UF-018. Default model shown in the top bar disagrees with Model Pilot
|
||||||
|
|||||||
Reference in New Issue
Block a user