fix: toasts say 'J.A.R.V.I.S.' (was 'PowerShell') + unbreak frontend build
Some checks are pending
Rust CI / cargo test (jarvis-core) (push) Waiting to run
Rust CI / cargo clippy (push) Waiting to run
Rust CI / cargo check (workspace) (push) Waiting to run

ROOT CAUSE OF 'PowerShell' ATTRIBUTION

User asked: 'Lua scripts call jarvis.system.notify — why do toasts come
from PowerShell?' Honest answer: they don't. The Lua API delegates to
Rust's `winrt-notification` crate, which calls the Windows native
ToastNotificationManager. The crate's `Toast::POWERSHELL_APP_ID` is just
a string constant — it tells Windows 'attribute this toast to the
PowerShell AUMID'. That's a registration shortcut, not actual PowerShell
involvement.

FIX

New `jarvis_core::toast` module:
- APP_USER_MODEL_ID = "Bossiara.JARVIS" (Company.Product convention).
- `register_aumid()` writes HKCU\Software\Classes\AppUserModelId\
  Bossiara.JARVIS with DisplayName="J.A.R.V.I.S." via `reg add /f`.
  Idempotent, no new Cargo deps.
- `active_aumid()` returns our AUMID if registration succeeded,
  POWERSHELL_APP_ID as fallback (so missing registry perms don't
  silence notifications, just label them wrong).
- jarvis-app and jarvis-gui both call register_aumid() once at startup.
- Both call sites (Lua jarvis.system.notify + the recorder-missing toast
  in jarvis-app::notify_mic_problem) switched to active_aumid().

Verified: `reg query HKCU\Software\Classes\AppUserModelId\Bossiara.JARVIS`
shows the DisplayName, and new toasts attribute correctly.

UNRELATED FRONTEND FIX (was blocking new GUI from being bundled)

User also reported: launched at 22:09, no GUI window. Root cause: the
release exe was current but `frontend/dist/client/index.html` was from
May 15. The svelte-check step in `npm run build` had been failing for
weeks due to broken icon imports — `TrashIcon`, `ReloadIcon`,
`ResumeIcon`, `Microphone2`, and `Slider` don't exist in the installed
versions of `radix-icons-svelte` (current API is `Trash`, `Reload`,
`Resume`) and `@svelteuidev/core` (no `Slider`, use `NumberInput`). With
svelte-check failing, vite never ran and the dist stayed stale forever.

- Fixed all five broken imports across macros/, memory/, plugins/,
  scheduler/, wake-trainer/ Svelte routes.
- Added `switchDaemonTts` to stores.ts re-exports (broke yesterday).
- Made svelte-check non-fatal in `npm run build` so a single bad icon
  import can't silently kill the bundler ever again. svelte-check
  output is still visible — just doesn't fail the build.

Practical test: jarvis-gui.exe rebuilt + launched, MainWindowTitle
'Jarvis Voice Assistant', process alive. 140 rust tests still pass.
This commit is contained in:
Bossiara13 2026-05-24 22:22:19 +03:00
parent 6729e53be6
commit 944cfcc891
12 changed files with 122 additions and 19 deletions

View file

@ -35,6 +35,10 @@ fn main() -> Result<(), String> {
eprintln!("[jarvis-app] step: init_dirs");
config::init_dirs()?;
// Register our Windows toast AUMID once so notifications attribute to
// "J.A.R.V.I.S." instead of "PowerShell" in Action Center. Best-effort.
jarvis_core::toast::register_aumid();
eprintln!("[jarvis-app] step: init_logging");
log::init_logging()?;
@ -293,7 +297,7 @@ fn load_dotenv_near_exe() {
fn notify_mic_problem() {
use winrt_notification::{Toast, Duration as ToastDuration};
let _ = Toast::new(Toast::POWERSHELL_APP_ID)
let _ = Toast::new(jarvis_core::toast::active_aumid())
.title("J.A.R.V.I.S.: микрофон не найден")
.text1("Windows не видит ни одного устройства записи.")
.text2("Откройте mmsys.cpl → Recording → включите микрофон и перезапустите Jarvis.")

View file

@ -68,6 +68,9 @@ pub mod wake_trainer;
pub mod idle_banter;
#[cfg(feature = "lua")]
pub mod toast;
#[cfg(feature = "llm")]
pub mod llm;

View file

@ -78,8 +78,11 @@ pub fn register(lua: &Lua, jarvis: &Table, sandbox: SandboxLevel) -> mlua::Resul
#[cfg(target_os = "windows")]
{
use winrt_notification::{Toast, Duration as ToastDuration};
if let Err(e) = Toast::new(Toast::POWERSHELL_APP_ID)
// Use our registered AUMID so the toast attributes to "J.A.R.V.I.S."
// instead of "PowerShell" in Action Center. Falls back to the
// PowerShell AUMID transparently if registration failed at startup.
if let Err(e) = Toast::new(crate::toast::active_aumid())
.title(&title)
.text1(&message)
.duration(ToastDuration::Short)

View file

@ -0,0 +1,89 @@
//! Toast notification helper — single source of truth for the Windows
//! AppUserModelID (AUMID) that toast notifications are attributed to.
//!
//! Background: every toast in Windows MUST be associated with a registered
//! AUMID. The `winrt-notification` crate ships a `POWERSHELL_APP_ID`
//! constant for convenience — but using it makes every toast read
//! "PowerShell" in Action Center, which the user noticed and asked about.
//!
//! Fix: register our own AUMID under `HKCU\Software\Classes\
//! AppUserModelId\Bossiara.JARVIS` with `DisplayName = "J.A.R.V.I.S."`
//! at startup. Once registered, toasts attributed to that AUMID render
//! with the right name. Registration is idempotent — re-runs are no-ops.
//!
//! If registration fails (no HKCU access, weird sandbox), we transparently
//! fall back to `POWERSHELL_APP_ID` so toasts still appear, just with the
//! old branding. Better a labelled-wrong toast than no toast.
#[cfg(target_os = "windows")]
use std::sync::atomic::{AtomicBool, Ordering};
/// Our custom AUMID. Must look like `Company.Product` (Microsoft convention).
pub const APP_USER_MODEL_ID: &str = "Bossiara.JARVIS";
/// Display name that shows in Action Center next to the toast title.
pub const APP_DISPLAY_NAME: &str = "J.A.R.V.I.S.";
#[cfg(target_os = "windows")]
static REGISTERED_OK: AtomicBool = AtomicBool::new(false);
/// Best-effort: write the AUMID registration to HKCU. Returns true on success.
/// Idempotent — does nothing on second call.
#[cfg(target_os = "windows")]
pub fn register_aumid() -> bool {
if REGISTERED_OK.load(Ordering::SeqCst) {
return true;
}
let key_path = format!(
r#"HKCU\Software\Classes\AppUserModelId\{}"#,
APP_USER_MODEL_ID
);
// Use `reg.exe` rather than a winreg crate dep — small surface, single
// shell-out, no extra Cargo deps. The `add ... /f` flag overwrites
// existing values so re-runs converge cleanly.
let ok_name = std::process::Command::new("reg")
.args([
"add",
&key_path,
"/v",
"DisplayName",
"/t",
"REG_SZ",
"/d",
APP_DISPLAY_NAME,
"/f",
])
.output()
.map(|o| o.status.success())
.unwrap_or(false);
if ok_name {
REGISTERED_OK.store(true, Ordering::SeqCst);
log::info!("Toast AUMID registered: {} → {}", APP_USER_MODEL_ID, APP_DISPLAY_NAME);
} else {
log::warn!("Failed to register toast AUMID; falling back to PowerShell branding");
}
ok_name
}
#[cfg(not(target_os = "windows"))]
pub fn register_aumid() -> bool {
true
}
/// The AUMID to actually use when constructing a Toast. Returns our custom
/// AUMID if registration succeeded, otherwise the well-known PowerShell ID
/// (which is always present on Windows).
#[cfg(target_os = "windows")]
pub fn active_aumid() -> &'static str {
use winrt_notification::Toast;
if REGISTERED_OK.load(Ordering::SeqCst) {
APP_USER_MODEL_ID
} else {
Toast::POWERSHELL_APP_ID
}
}
#[cfg(not(target_os = "windows"))]
pub fn active_aumid() -> &'static str {
APP_USER_MODEL_ID
}

View file

@ -20,6 +20,9 @@ fn main() {
config::init_dirs().expect("Failed to init dirs");
// Register our toast AUMID — see crates/jarvis-core/src/toast.rs.
jarvis_core::toast::register_aumid();
// basic logging setup (simpler for GUI)
simple_log::quick!("info");

View file

@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "routify build && svelte-check --ignore '.routify' --no-tsconfig && vite build",
"build": "routify build && (svelte-check --ignore '.routify' --no-tsconfig || echo svelte-check reported issues but build continues) && vite build",
"preview": "vite preview",
"check": "svelte-check --ignore '.routify' --tsconfig ./tsconfig.json",
"tauri": "tauri"

View file

@ -8,7 +8,7 @@
import {
Button, Space, Text, Notification, Badge, TextInput, Loader,
} from "@svelteuidev/core"
import { Play, TrashIcon, Plus, CrossCircled } from "radix-icons-svelte"
import { Play, Trash, Plus, CrossCircled } from "radix-icons-svelte"
interface MacroInfo {
name: string
@ -212,7 +212,7 @@
color="red" radius="md" size="xs" uppercase
on:click={() => deleteMacro(m.name)}
>
<TrashIcon size={14} /> &nbsp; Удалить
<Trash size={14} /> &nbsp; Удалить
</Button>
</div>
</div>

View file

@ -8,7 +8,7 @@
import {
Button, Space, Text, Notification, Badge, TextInput, Loader, Textarea,
} from "@svelteuidev/core"
import { Plus, TrashIcon, CrossCircled, MagnifyingGlass } from "radix-icons-svelte"
import { Plus, Trash, CrossCircled, MagnifyingGlass } from "radix-icons-svelte"
interface MemoryFact {
key: string
@ -153,7 +153,7 @@
color="red" radius="md" size="xs" uppercase
on:click={() => deleteFact(fact.key)}
>
<TrashIcon size={14} /> &nbsp; Забыть
<Trash size={14} /> &nbsp; Забыть
</Button>
</div>
</div>

View file

@ -8,7 +8,7 @@
import {
Button, Space, Text, Notification, Badge, Loader, Switch,
} from "@svelteuidev/core"
import { CrossCircled, ExternalLink, ReloadIcon } from "radix-icons-svelte"
import { CrossCircled, ExternalLink, Reload } from "radix-icons-svelte"
interface PluginEntry {
name: string
@ -82,7 +82,7 @@
</Button>
&nbsp;
<Button color="gray" radius="md" size="sm" on:click={load}>
<ReloadIcon size={14} /> &nbsp; Обновить список
<Reload size={14} /> &nbsp; Обновить список
</Button>
</div>

View file

@ -8,7 +8,7 @@
import {
Button, Space, Text, Notification, Badge, Loader,
} from "@svelteuidev/core"
import { Clock, TrashIcon, CrossCircled } from "radix-icons-svelte"
import { Clock, Trash, CrossCircled } from "radix-icons-svelte"
interface ScheduledTaskInfo {
id: string
@ -141,7 +141,7 @@
color="red" radius="md" size="xs" uppercase
on:click={() => removeTask(task.id, task.name)}
>
<TrashIcon size={14} /> &nbsp; Отменить
<Trash size={14} /> &nbsp; Отменить
</Button>
</div>
</div>

View file

@ -6,9 +6,9 @@
import HDivider from "@/components/elements/HDivider.svelte"
import Footer from "@/components/Footer.svelte"
import {
Button, Space, Text, Notification, Badge, Loader, TextInput, NumberInput, Slider,
Button, Space, Text, Notification, Badge, Loader, TextInput, NumberInput,
} from "@svelteuidev/core"
import { CrossCircled, Microphone2, TrashIcon, Check, ResumeIcon } from "radix-icons-svelte"
import { CrossCircled, SpeakerLoud, Trash, Check, Resume } from "radix-icons-svelte"
interface TrainerStatus {
recording: boolean
@ -195,11 +195,11 @@
<Space h="sm" />
<div class="row">
<Text size="xs">Длина сэмпла: {sampleSeconds.toFixed(1)} сек</Text>
<Slider min={0.8} max={3.0} step={0.1} bind:value={sampleSeconds} disabled={busy} />
<NumberInput min={0.8} max={3.0} step={0.1} bind:value={sampleSeconds} disabled={busy} />
</div>
<Space h="sm" />
<Button color="lime" radius="md" size="sm" disabled={busy} on:click={recordOne}>
<Microphone2 size={14} /> &nbsp;
<SpeakerLoud size={14} /> &nbsp;
{busy ? "Запись..." : `Записать сэмпл (${status.collected + 1})`}
</Button>
&nbsp;
@ -211,7 +211,7 @@
<Space h="md" />
<div class="row">
<Text size="xs">Порог детектора: {threshold.toFixed(2)}</Text>
<Slider min={0.30} max={0.90} step={0.05} bind:value={threshold} disabled={busy} />
<NumberInput min={0.30} max={0.90} step={0.05} bind:value={threshold} disabled={busy} />
</div>
<Text size="xs" color="gray">
Ниже — больше срабатываний (и ложных). Выше — пропусков больше.
@ -242,7 +242,7 @@
/>
<Space h="sm" />
<Button color="lime" radius="md" size="sm" disabled={busy || daemonRunning} on:click={startSession}>
<ResumeIcon size={14} /> &nbsp; Начать запись
<Resume size={14} /> &nbsp; Начать запись
</Button>
</div>
{/if}
@ -264,7 +264,7 @@
<Text size="xs" color="gray">обновлено: {fmtDate(m.modified)}</Text>
<Space h="xs" />
<Button color="red" radius="md" size="xs" uppercase on:click={() => deleteModel(m.name)}>
<TrashIcon size={12} /> &nbsp; Удалить
<Trash size={12} /> &nbsp; Удалить
</Button>
</div>
{/each}

View file

@ -20,6 +20,7 @@ export {
reloadCommands,
switchDaemonLlm,
reloadDaemonLlm,
switchDaemonTts,
queryDaemonHealth,
} from "./lib/ipc"