fix(windows): add windowless agent-libw for scheduled sync

agent-lib.exe is a console program, so Windows opens a terminal window on
every scheduled run. Ship agent-libw.exe, the same program built with
-H=windowsgui, in the Windows zip for use in the task action. Start the
PowerShell toast without a window, since agent-libw has no console to
inherit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
m3tam3reandClaude Opus 5.5 committed 2026-10-31 14:36:41 +01:00
1 parent 5e7d693699
commit e41ffa6a14
5 files changed
+32 -1

No files matched your search

+6
View File
@@ -6,8 +6,12 @@ import (
"fmt"
"os/exec"
"strings"
"syscall"
)
// createNoWindow is the Win32 CREATE_NO_WINDOW process creation flag.
const createNoWindow = 0x08000000
// PowerShellToast raises a Windows toast notification by invoking
// PowerShell with an AppId-tagged script — the same mechanism go-toast
// uses, without the dependency.
@@ -36,6 +40,8 @@ func (p PowerShellToast) Send(title, body string) error {
}
script := fmt.Sprintf(toastScript, escape(appID), escape(title), escape(body))
cmd := exec.Command("powershell", "-NoProfile", "-NonInteractive", "-Command", script)
// agent-libw has no console to inherit, so PowerShell would open its own.
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true, CreationFlags: createNoWindow}
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("toast failed: %v: %s", err, strings.TrimSpace(string(out)))
}