feat(app): Tauri window and the Windows build

M5 step 5, first part. app/shell is a Tauri 2 crate (jarvis.exe): one
window over app/ui whose invoke("admin") goes to AdminApi::call. Its
WebView2 data sits next to the location file; closing the window stops
the services and waits for a cancelled start (AdminApi::shutdown).

app/shell/package.sh cross-builds it on Linux (x86_64-pc-windows-gnu)
and lays out Jarvis/ with WebView2Loader.dll and python-src/
(voice_worker, jarvis). The worker's default sources are python-src next
to the executable when present, else the repository's src/.

The bot screen now shows the masked token right after saving.

Checked on the win-ci VM: the window and wizard, PC check, uv and worker
venv installed, a cancel leaving no uv/Python process, the token stored
DPAPI-encrypted, a start failing with its reason, logs, error copy, zip
export, closing the window ending the process, nothing under %APPDATA% or
%LOCALAPPDATA%; the core's unit tests on Windows (156/157, the one
Linux-path assumption fixed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-12 18:16:02 +09:00
parent 81ba5e3521
commit ac8c30022d
17 changed files with 7752 additions and 7 deletions

View File

@@ -129,8 +129,7 @@ impl Default for Settings {
chat_channels: vec![],
voice_worker: WorkerSettings {
python: if cfg!(windows) { "python.exe".into() } else { "python3".into() },
// The repo's src/, next to this crate.
cwd: Path::new(env!("CARGO_MANIFEST_DIR")).join("..").join("src"),
cwd: worker_cwd_for(std::env::current_exe().ok().as_deref()),
args: vec![],
},
call: CallSettings::default(),
@@ -142,6 +141,18 @@ impl Default for Settings {
}
}
/// Where the worker's Python sources (`voice_worker`, `jarvis`) are by default: `python-src` next to
/// the app's executable (the Windows build ships them there), else the repository's `src/` next to
/// this crate (development and tests).
pub fn worker_cwd_for(exe: Option<&Path>) -> PathBuf {
if let Some(shipped) = exe.and_then(Path::parent).map(|d| d.join("python-src")) {
if shipped.join("voice_worker").is_dir() {
return shipped;
}
}
Path::new(env!("CARGO_MANIFEST_DIR")).join("..").join("src")
}
fn err<T>(msg: impl Into<String>) -> Result<T, SettingsError> {
Err(SettingsError(msg.into()))
}
@@ -456,6 +467,16 @@ mod tests {
use super::*;
use serde_json::json;
#[test]
fn the_python_sources_shipped_next_to_the_app_win_over_the_repository() {
let dir = crate::datadir::temp_dir("pysrc");
let exe = dir.join("jarvis.exe");
assert!(worker_cwd_for(Some(&exe)).ends_with("src"), "nothing shipped: the repository's src/");
std::fs::create_dir_all(dir.join("python-src").join("voice_worker")).unwrap();
assert_eq!(worker_cwd_for(Some(&exe)), dir.join("python-src"));
assert_eq!(worker_cwd_for(None), Path::new(env!("CARGO_MANIFEST_DIR")).join("..").join("src"));
}
const ID: &str = "123456789012345678";
const IDN: u64 = 123456789012345678;