diff --git a/frontends/desktop/src-tauri/capabilities/default.json b/frontends/desktop/src-tauri/capabilities/default.json index aa9ad1e2d..a99fa8660 100644 --- a/frontends/desktop/src-tauri/capabilities/default.json +++ b/frontends/desktop/src-tauri/capabilities/default.json @@ -11,6 +11,7 @@ "core:window:allow-show", "core:window:allow-hide", "core:window:allow-set-focus", + "core:window:allow-start-dragging", "core:window:allow-close", "core:window:allow-get-all-windows", "core:webview:default", diff --git a/frontends/desktop/src-tauri/src/lib.rs b/frontends/desktop/src-tauri/src/lib.rs index 56b289cde..8d1973423 100644 --- a/frontends/desktop/src-tauri/src/lib.rs +++ b/frontends/desktop/src-tauri/src/lib.rs @@ -946,11 +946,15 @@ pub fn run() { let no_autostart = args.iter().any(|a| a == "--no-autostart"); let dev_mode = args.iter().any(|a| a == "--dev"); - // Resolve the effective config once. project_dir is ALWAYS the bundle's own (方案三: we run - // our own bridge/frontend); the external核, if any, is injected via GA_ROOT in - // sanitize_bundle_env. Identity/takeover must compare against the EFFECTIVE ga_root (what the - // bridge will report), not the bundle script dir. - let (eff_py, eff_project) = get_or_discover_config(); + // Resolve the effective config once. Development must use the checkout that produced this + // binary; otherwise a persisted path from an installed macOS app can make `tauri dev` serve + // stale frontend files from /Applications. Do not persist the temporary dev paths. + // Packaged builds still use their bundled runtime (or the normal saved-config discovery). + let (eff_py, eff_project) = if dev_mode { + (find_python(), find_project_dir().unwrap_or_default()) + } else { + get_or_discover_config() + }; let effective_ga_root = valid_ga_source_override().unwrap_or_else(|| eff_project.clone()); let needs_prepare = needs_first_run_prepare(&eff_project); diff --git a/frontends/desktop/src-tauri/tauri.macos.conf.json b/frontends/desktop/src-tauri/tauri.macos.conf.json new file mode 100644 index 000000000..28b50c204 --- /dev/null +++ b/frontends/desktop/src-tauri/tauri.macos.conf.json @@ -0,0 +1,33 @@ +{ + "app": { + "windows": [ + { + "title": "GenericAgent", + "label": "main", + "width": 1280, + "height": 800, + "resizable": true, + "decorations": true, + "titleBarStyle": "Overlay", + "hiddenTitle": true, + "trafficLightPosition": { + "x": 18, + "y": 26 + }, + "maximized": false, + "visible": false, + "url": "loading.html" + }, + { + "title": "GenericAgent — Setup", + "label": "setup", + "width": 600, + "height": 580, + "resizable": false, + "visible": false, + "center": true, + "url": "fallback.html" + } + ] + } +} diff --git a/frontends/desktop/static/index.html b/frontends/desktop/static/index.html index 385a116b9..9c0387cff 100644 --- a/frontends/desktop/static/index.html +++ b/frontends/desktop/static/index.html @@ -4,7 +4,7 @@ GenericAgent - + @@ -41,6 +41,11 @@ var hljs=document.getElementById('hljs-theme'); if(hljs&&app==='dark') hljs.href='https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9.0/build/styles/github-dark.min.css'; try{ var sraw=localStorage.getItem('ga_sessions'); if(sraw && JSON.parse(sraw).length) document.documentElement.dataset.bootHasSessions='1'; }catch(_){} + var nav_platform=navigator.platform; + document.documentElement.dataset.platform = + /Mac/i.test(nav_platform) ? 'macos' : + /Win/i.test(nav_platform) ? 'windows' : + 'linux'; })(); @@ -52,7 +57,8 @@