agent: §8 provenance toast on Windows (PowerShell/WinRT)
Adds the Windows arm to notify() — a WinRT toast via PowerShell (no extra modules on Win10/11), completing the "Copied from <device>" provenance across all three desktop OSes (macOS osascript, Linux notify-send, Windows toast). Verified: `cargo check --target x86_64-pc-windows-gnu --features iroh` passes — the whole agent incl. the new arm type-checks for Windows. The final binary LINK can't be done via the macOS→windows-gnu mingw cross-toolchain (iroh-relay pulls Windows system libs mingw doesn't auto-link); a native MSVC build is the real target and is expected to link. Code-complete + type-checked; runtime untested without a Windows box. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -79,7 +79,25 @@ fn notify(source: &str, text: &str) {
|
||||
.args([&format!("tether — copied from {who}"), &body])
|
||||
.status();
|
||||
}
|
||||
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
// Toast via PowerShell + WinRT — no extra modules on Win10/11.
|
||||
let esc = |s: &str| s.replace('\'', "''"); // PowerShell single-quote escape
|
||||
let script = format!(
|
||||
"[Windows.UI.Notifications.ToastNotificationManager,Windows.UI.Notifications,ContentType=WindowsRuntime]>$null;\
|
||||
[Windows.UI.Notifications.ToastNotification,Windows.UI.Notifications,ContentType=WindowsRuntime]>$null;\
|
||||
$tpl=[Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02);\
|
||||
$t=$tpl.GetElementsByTagName('text');\
|
||||
$t[0].InnerText='Copied from {who}';$t[1].InnerText='{body}';\
|
||||
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('tether').Show([Windows.UI.Notifications.ToastNotification]::new($tpl))",
|
||||
who = esc(&who),
|
||||
body = esc(&body),
|
||||
);
|
||||
let _ = std::process::Command::new("powershell")
|
||||
.args(["-NoProfile", "-NonInteractive", "-Command", &script])
|
||||
.status();
|
||||
}
|
||||
#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
|
||||
let _ = (who, body);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user