mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 10:58:10 +00:00
* fix(windows): remove Orca's agent hooks and PATH entry when uninstalling On Windows most agents' managed hooks, and Claude's status line, call Orca's .cmd scripts by bare path (to avoid starting PowerShell per event), and the uninstaller removed neither those entries nor the `orca` command's user PATH entry. Once %USERPROFILE%\.orca went, every agent failed a hook on each event. A real uninstall (not an update) now runs the installed exe with --orca-uninstall-remove-agent-hooks, mirroring the WSL holder release: no window, lock or IPC, file edits only, a 30 s self-exit, and an exit code the uninstaller ignores. It then drops $INSTDIR\resources\bin from the user PATH with native registry calls, keeping every other entry and the value's type, and skipping the edit if the read could have been truncated. * fix(windows): keep agent hooks while another Orca install remains; skip PATH edits of unknown type The hook scripts live in the shared ~/.orca\agent-hooks and reference nothing in $INSTDIR (they call system curl/more and a copy of orca-agent-hook.exe there), so they outlive an uninstall; the entries only break once that folder is removed. The last Orca install for this user now takes them out: the uninstaller reads the other per-user/per-machine registration (every channel shares one app GUID) with native registry calls, and skips the removal if another install still has the app or a read fails. PATH cleanup still runs, as it is per $INSTDIR. PATH cleanup now writes only with a value type it actually read (REG_SZ or REG_EXPAND_SZ); a failed open or query skips the write instead of assuming REG_SZ. * fix(windows): install the app environment before the uninstall hook removers run The uninstall mode skips the app's own preflight, so setAppEnvironment was never called. Claude's remover then threw at getAppEnvironment() right after writing settings.json: its agent-view keybinding stayed in every profile home and its status-line marker stayed too. Install ElectronAppEnvironment right after the AppData path, as main-process-preflight does. A new test runs every agent's real remover in that mode with no environment preset; none warns, the mode exits 0, and Claude's agent-view binding and status-line marker are gone. * test(windows): register the uninstall preflight's host port and keep its real-remover test off real homes The uninstall hook-removal preflight installs the app environment, so it joins HOST_PORT_SOURCES. Its real-remover test now points HOME, USERPROFILE, ORCA_USER_DATA_PATH, XDG_CONFIG_HOME, APPDATA, CODEX_HOME and CLAUDE_CONFIG_DIR at the fixture: on Linux CI the Codex runtime home resolved from the runner's XDG_CONFIG_HOME, which the real-agent-home write guard rejected.
91 lines
2.5 KiB
NSIS
91 lines
2.5 KiB
NSIS
; Uninstall twin of removeWindowsPathEntry (src/main/cli/cli-path-registration.ts): drop this
|
|
; install's command directory from the user PATH and keep every other entry byte-for-byte.
|
|
; Native registry calls only: no PowerShell or reg.exe at uninstall (Windows EDR rules).
|
|
|
|
!define ORCA_HKEY_CURRENT_USER 0x80000001
|
|
!define ORCA_KEY_QUERY_VALUE 0x20019
|
|
!define ORCA_REG_SZ 1
|
|
!define ORCA_REG_EXPAND_SZ 2
|
|
|
|
!macro ORCA_REMOVE_USER_PATH_ENTRY DIR
|
|
Push $R0
|
|
Push $R1
|
|
Push $R2
|
|
Push $R3
|
|
Push $R4
|
|
Push $R5
|
|
Push $R6
|
|
Push $R7
|
|
Push $R8
|
|
Push $R9
|
|
StrCpy $R9 "${DIR}"
|
|
ReadRegStr $R0 HKCU "Environment" "Path"
|
|
StrLen $R1 $R0
|
|
IntOp $R2 ${NSIS_MAX_STRLEN} - 1
|
|
; A PATH at the string limit may have been truncated on read; writing it back would lose entries.
|
|
${if} $R0 != ""
|
|
${andIf} $R1 < $R2
|
|
; Read the value type so an expandable PATH stays expandable; an unknown type skips the edit.
|
|
StrCpy $R8 ""
|
|
System::Call 'advapi32::RegOpenKeyEx(p ${ORCA_HKEY_CURRENT_USER}, t "Environment", i 0, i ${ORCA_KEY_QUERY_VALUE}, *p .R6) i .R7'
|
|
${if} $R7 == 0
|
|
System::Call 'advapi32::RegQueryValueEx(p R6, t "Path", p 0, *i .R4, p 0, p 0) i .R7'
|
|
System::Call 'advapi32::RegCloseKey(p R6)'
|
|
${if} $R7 == 0
|
|
StrCpy $R8 $R4
|
|
${endIf}
|
|
${endIf}
|
|
StrCpy $R3 ""
|
|
StrCpy $R4 ""
|
|
StrCpy $R5 0
|
|
; $R2: no entry kept yet; $R7: an entry was removed.
|
|
StrCpy $R2 1
|
|
StrCpy $R7 0
|
|
${Do}
|
|
StrCpy $R6 $R0 1 $R5
|
|
${if} $R6 == ";"
|
|
${orIf} $R6 == ""
|
|
; LogicLib == is case-insensitive, as Windows paths are.
|
|
${if} $R4 == $R9
|
|
${orIf} $R4 == "$R9\"
|
|
StrCpy $R7 1
|
|
${elseIf} $R2 == 1
|
|
StrCpy $R3 $R4
|
|
StrCpy $R2 0
|
|
${else}
|
|
StrCpy $R3 "$R3;$R4"
|
|
${endIf}
|
|
StrCpy $R4 ""
|
|
${if} $R6 == ""
|
|
${ExitDo}
|
|
${endIf}
|
|
${else}
|
|
StrCpy $R4 "$R4$R6"
|
|
${endIf}
|
|
IntOp $R5 $R5 + 1
|
|
${Loop}
|
|
${if} $R7 == 1
|
|
${andIf} $R8 != ""
|
|
${if} $R3 == ""
|
|
DeleteRegValue HKCU "Environment" "Path"
|
|
${elseIf} $R8 == ${ORCA_REG_EXPAND_SZ}
|
|
WriteRegExpandStr HKCU "Environment" "Path" $R3
|
|
${elseIf} $R8 == ${ORCA_REG_SZ}
|
|
WriteRegStr HKCU "Environment" "Path" $R3
|
|
${endIf}
|
|
; Tell Explorer, so new shells stop seeing the removed entry.
|
|
SendMessage 0xFFFF 0x1A 0 "STR:Environment" /TIMEOUT=5000
|
|
${endIf}
|
|
${endIf}
|
|
Pop $R9
|
|
Pop $R8
|
|
Pop $R7
|
|
Pop $R6
|
|
Pop $R5
|
|
Pop $R4
|
|
Pop $R3
|
|
Pop $R2
|
|
Pop $R1
|
|
Pop $R0
|
|
!macroend
|