Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(packaging): per-user Windows installer (Inno Setup)

rubenluetke10-beep9ce04fb66c95
diff --git a/packaging/windows/PersonalJarvis.iss b/packaging/windows/PersonalJarvis.iss
new file mode 100644
index 0000000000..abf874d1f4
--- /dev/null
+++ b/packaging/windows/PersonalJarvis.iss
@@ -0,0 +1,249 @@
+; Inno Setup script for the Personal Jarvis Windows installer.
+;
+; Shape of the install, and why:
+; * PER-USER (PrivilegesRequired=lowest, {localappdata}\Programs). Exactly how
+; Chrome installs: double-click, no UAC prompt, no administrator account
+; needed. It also means an upgrade never has to elevate, which is what makes
+; the in-app "Update Now" button work unattended.
+; * A fixed AppId. Every future release reuses it, so Windows recognises the
+; new setup as the SAME application and upgrades in place instead of leaving
+; two entries in "Installed apps".
+; * CloseApplications=yes. The updater runs this file with /CLOSEAPPLICATIONS
+; /RESTARTAPPLICATIONS, so Restart Manager closes the running app, the files
+; are replaced, and Personal Jarvis comes back by itself.
+; * The uninstaller removes the program directory ONLY. Settings, memory,
+; skills and logs live in %LOCALAPPDATA%\Jarvis and are deliberately kept, so
+; an uninstall/reinstall cycle does not destroy the user's data.
+;
+; Compile through packaging/windows/build.ps1, which passes the version:
+; ISCC.exe /DAppVersion=1.5.3 /DSourceDir=<dist\Jarvis> /DOutputDir=<out> ...
+
+#ifndef AppVersion
+ #define AppVersion "0.0.0"
+#endif
+#ifndef SourceDir
+ #define SourceDir "..\..\dist\Jarvis"
+#endif
+#ifndef OutputDir
+ #define OutputDir "..\..\dist\installers"
+#endif
+#ifndef IconFile
+ #define IconFile "..\..\assets\icons\jarvis.ico"
+#endif
+
+#define AppName "Personal Jarvis"
+#define AppPublisher "Personal Jarvis"
+#define AppUrl "https://personaljarvis.ai"
+#define GuiExeName "PersonalJarvis.exe"
+#define CliExeName "jarvis.exe"
+#define UserDataDirDisplay "%LOCALAPPDATA%\Jarvis"
+
+[Setup]
+; NEVER change this GUID. It is the identity Windows upgrades against.
+AppId={{7F1C4E42-2E5B-4F0A-9E1B-1A7B6C0D5E88}
+AppName={#AppName}
+AppVersion={#AppVersion}
+AppVerName={#AppName} {#AppVersion}
+VersionInfoVersion={#AppVersion}
+AppPublisher={#AppPublisher}
+AppPublisherURL={#AppUrl}
+AppSupportURL={#AppUrl}
+AppUpdatesURL={#AppUrl}
+
+; Per-user install: no administrator prompt, ever.
+PrivilegesRequired=lowest
+PrivilegesRequiredOverridesAllowed=dialog
+DefaultDirName={localappdata}\Programs\{#AppName}
+DefaultGroupName={#AppName}
+DisableProgramGroupPage=yes
+AllowNoIcons=yes
+
+; 64-bit only. There is no 32-bit Python payload in the bundle, and
+; x64compatible also covers ARM64 machines running x64 code under emulation.
+ArchitecturesAllowed=x64compatible
+ArchitecturesInstallIn64BitMode=x64compatible
+MinVersion=10.0
+
+OutputDir={#OutputDir}
+OutputBaseFilename=PersonalJarvis-Setup-x64
+SetupIconFile={#IconFile}
+UninstallDisplayName={#AppName}
+UninstallDisplayIcon={app}\{#GuiExeName}
+WizardStyle=modern
+Compression=lzma2/max
+SolidCompression=yes
+LZMANumBlockThreads=4
+
+; Restart Manager closes the running app instead of failing on locked files.
+CloseApplications=yes
+RestartApplications=yes
+CloseApplicationsFilter=*.exe,*.dll,*.pyd
+; The PATH task edits the user's environment; tell Windows so open shells and
+; Explorer pick it up (this is on top of the explicit broadcast in [Code]).
+ChangesEnvironment=yes
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+[Tasks]
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
+Name: "addtopath"; Description: "Add the ""jarvis"" command to PATH (lets you run ""jarvis serve"" in any terminal)"; GroupDescription: "Command line"
+
+[Files]
+Source: "{#SourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+
+[Icons]
+Name: "{group}\{#AppName}"; Filename: "{app}\{#GuiExeName}"; WorkingDir: "{app}"
+Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
+Name: "{userdesktop}\{#AppName}"; Filename: "{app}\{#GuiExeName}"; WorkingDir: "{app}"; Tasks: desktopicon
+
+[Run]
+Filename: "{app}\{#GuiExeName}"; Description: "{cm:LaunchProgram,{#AppName}}"; WorkingDir: "{app}"; Flags: nowait postinstall skipifsilent
+
+[Messages]
+ConfirmUninstall=Do you really want to remove %1?%n%nYour settings, memory, skills and logs are NOT deleted - they stay in {#UserDataDirDisplay}.
+
+[Code]
+const
+ { Prefixed on purpose: Inno Setup's Pascal Script already declares some of
+ these Win32 names, and redeclaring one aborts the compile. }
+ EnvironmentKey = 'Environment';
+ JarvisHwndBroadcast = $FFFF;
+ JarvisWmSettingChange = $001A;
+ JarvisSmtoAbortIfHung = $0002;
+
+function SendMessageTimeout(hWnd: Longint; Msg: Cardinal; wParam: Longint;
+ lParam: string; fuFlags: Cardinal; uTimeout: Cardinal;
+ var lpdwResult: Cardinal): Longint;
+ external '[email protected] stdcall';
+
+{ Windows only re-reads the Environment key when it is told to. Without this
+ broadcast the new PATH is invisible until the user signs out and back in. }
+procedure BroadcastEnvironmentChange;
+var
+ Unused: Cardinal;
+begin
+ SendMessageTimeout(JarvisHwndBroadcast, JarvisWmSettingChange, 0, 'Environment',
+ JarvisSmtoAbortIfHung, 5000, Unused);
+end;
+
+function NormalizePathEntry(const Value: string): string;
+begin
+ Result := Lowercase(RemoveBackslashUnlessRoot(Trim(Value)));
+end;
+
+{ True when Dir is already one of the semicolon-separated entries of Path.
+ Compared entry by entry (not as a substring) so ...\Personal Jarvis Beta
+ never counts as ...\Personal Jarvis. }
+function PathContainsDir(const Path, Dir: string): Boolean;
+var
+ Remaining, Entry, Wanted: string;
+ Separator: Integer;
+begin
+ Result := False;
+ Wanted := NormalizePathEntry(Dir);
+ Remaining := Path;
+ while Remaining <> '' do
+ begin
+ Separator := Pos(';', Remaining);
+ if Separator > 0 then
+ begin
+ Entry := Copy(Remaining, 1, Separator - 1);
+ Remaining := Copy(Remaining, Separator + 1, Length(Remaining) - Separator);
+ end
+ else
+ begin
+ Entry := Remaining;
+ Remaining := '';
+ end;
+ if NormalizePathEntry(Entry) = Wanted then
+ begin
+ Result := True;
+ Exit;
+ end;
+ end;
+end;
+
+function ReadUserPath(var Path: string): Boolean;
+begin
+ Result := RegQueryStringValue(HKCU, EnvironmentKey, 'Path', Path);
+ if not Result then
+ Path := '';
+end;
+
+procedure AddDirToUserPath(const Dir: string);
+var
+ Path: string;
+begin
+ ReadUserPath(Path);
+ { Idempotent: repeated upgrades must not grow PATH by one copy each time. }
+ if PathContainsDir(Path, Dir) then
+ Exit;
+ if (Path <> '') and (Copy(Path, Length(Path), 1) <> ';') then
+ Path := Path + ';';
+ Path := Path + Dir;
+ if RegWriteExpandStringValue(HKCU, EnvironmentKey, 'Path', Path) then
+ BroadcastEnvironmentChange;
+end;
+
+procedure RemoveDirFromUserPath(const Dir: string);
+var
+ Path, Rebuilt, Entry, Remaining, Wanted: string;
+ Separator: Integer;
+ Changed: Boolean;
+begin
+ if not ReadUserPath(Path) then
+ Exit;
+ Wanted := NormalizePathEntry(Dir);
+ Rebuilt := '';
+ Remaining := Path;
+ Changed := False;
+ while Remaining <> '' do
+ begin
+ Separator := Pos(';', Remaining);
+ if Separator > 0 then
+ begin
+ Entry := Copy(Remaining, 1, Separator - 1);
+ Remaining := Copy(Remaining, Separator + 1, Length(Remaining) - Separator);
+ end
+ else
+ begin
+ Entry := Remaining;
+ Remaining := '';
+ end;
+ if NormalizePathEntry(Entry) = Wanted then
+ Changed := True
+ else if Trim(Entry) <> '' then
+ begin
+ if Rebuilt <> '' then
+ Rebuilt := Rebuilt + ';';
+ Rebuilt := Rebuilt + Entry;
+ end;
+ end;
+ if not Changed then
+ Exit;
+ if Rebuilt = '' then
+ RegDeleteValue(HKCU, EnvironmentKey, 'Path')
+ else
+ RegWriteExpandStringValue(HKCU, EnvironmentKey, 'Path', Rebuilt);
+ BroadcastEnvironmentChange;
+end;
+
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+ if CurStep = ssPostInstall then
+ begin
+ if WizardIsTaskSelected('addtopath') then
+ AddDirToUserPath(ExpandConstant('{app}'))
+ else
+ { An upgrade where the user cleared the task must also take the entry
+ back out, or the choice silently does nothing. }
+ RemoveDirFromUserPath(ExpandConstant('{app}'));
+ end;
+end;
+
+procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
+begin
+ if CurUninstallStep = usPostUninstall then
+ RemoveDirFromUserPath(ExpandConstant('{app}'));
+end;
diff --git a/packaging/windows/build.ps1 b/packaging/windows/build.ps1
new file mode 100644
index 0000000000..414931d262
--- /dev/null
+++ b/packaging/windows/build.ps1
@@ -0,0 +1,194 @@
+#Requires -Version 5.1
+<#
+.SYNOPSIS
+ Build the Windows installer for Personal Jarvis.
+
+.DESCRIPTION
+ One command from a clean checkout to a shippable installer:
+
+ 1. build the React frontend when jarvis/ui/web/dist is missing,
+ 2. freeze the app with PyInstaller (jarvis.spec, onedir),
+ 3. wrap dist/Jarvis in an Inno Setup wizard.
+
+ The result is dist/installers/PersonalJarvis-Setup-x64.exe - the exact asset
+ name the website's download button and the in-app updater expect.
+
+ Every failure stops the script with a non-zero exit code; nothing is left
+ half-built and reported as success.
+
+.PARAMETER Python
+ Interpreter to freeze with. Defaults to the repository's .venv, then to
+ whatever `python` resolves to.
+
+.PARAMETER SkipFrontend
+ Never run npm, even when jarvis/ui/web/dist is missing. For a CI job that
+ built the bundle in an earlier step.
+
+.PARAMETER SkipPyInstaller
+ Package the existing dist/Jarvis instead of freezing again. Cuts the
+ edit-compile loop on the .iss file from minutes to seconds.
+
+.EXAMPLE
+ pwsh packaging/windows/build.ps1
+#>
+[CmdletBinding()]
+param(
+ [string] $Python = "",
+ [switch] $SkipFrontend,
+ [switch] $SkipPyInstaller
+)
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = "Stop"
+
+function Write-Step {
+ param([string] $Message)
+ Write-Host "[build] $Message"
+}
+
+function Stop-WithError {
+ param([string] $Message)
+ Write-Host "[build] FAILED: $Message" -ForegroundColor Red
+ exit 1
+}
+
+function Invoke-Checked {
+ param(
+ [string] $Executable,
+ [string[]] $Arguments,
+ [string] $WorkingDirectory,
+ [string] $What
+ )
+ Push-Location $WorkingDirectory
+ try {
+ & $Executable @Arguments
+ $code = $LASTEXITCODE
+ } finally {
+ Pop-Location
+ }
+ if ($code -ne 0) {
+ Stop-WithError "$What exited with code $code"
+ }
+}
+
+# --- Locate the repository -------------------------------------------------
+$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
+$SpecFile = Join-Path $RepoRoot "jarvis.spec"
+$BundleDir = Join-Path $RepoRoot "dist\Jarvis"
+$InstallerDir = Join-Path $RepoRoot "dist\installers"
+$FrontendDir = Join-Path $RepoRoot "jarvis\ui\web\frontend"
+$FrontendDist = Join-Path $RepoRoot "jarvis\ui\web\dist"
+$IssFile = Join-Path $PSScriptRoot "PersonalJarvis.iss"
+$IconFile = Join-Path $RepoRoot "assets\icons\jarvis.ico"
+
+if (-not (Test-Path $SpecFile)) { Stop-WithError "jarvis.spec not found at $SpecFile" }
+if (-not (Test-Path $IssFile)) { Stop-WithError "PersonalJarvis.iss not found at $IssFile" }
+
+# --- Version ---------------------------------------------------------------
+# Single source of truth. A hand-typed version here would drift from the tag
+# the release workflow verifies against.
+$InitFile = Join-Path $RepoRoot "jarvis\__init__.py"
+$InitText = Get-Content -Raw -Encoding UTF8 $InitFile
+$VersionMatch = [regex]::Match($InitText, '__version__\s*=\s*"([^"]+)"')
+if (-not $VersionMatch.Success) { Stop-WithError "jarvis/__init__.py does not define __version__" }
+$AppVersion = $VersionMatch.Groups[1].Value
+Write-Step "Personal Jarvis $AppVersion"
+
+# --- Python ----------------------------------------------------------------
+if ($Python -eq "") {
+ $VenvPython = Join-Path $RepoRoot ".venv\Scripts\python.exe"
+ if (Test-Path $VenvPython) { $Python = $VenvPython } else { $Python = "python" }
+}
+Write-Step "interpreter: $Python"
+
+# --- 1. Frontend -----------------------------------------------------------
+if (Test-Path (Join-Path $FrontendDist "index.html")) {
+ Write-Step "1/3 frontend bundle already present - skipping npm"
+} elseif ($SkipFrontend) {
+ Stop-WithError "jarvis/ui/web/dist is missing and -SkipFrontend was passed"
+} else {
+ Write-Step "1/3 building the frontend"
+ if (-not (Test-Path (Join-Path $FrontendDir "node_modules"))) {
+ Invoke-Checked -Executable "npm" -Arguments @("ci") -WorkingDirectory $FrontendDir -What "npm ci"
+ }
+ Invoke-Checked -Executable "npm" -Arguments @("run", "build") -WorkingDirectory $FrontendDir -What "npm run build"
+ if (-not (Test-Path (Join-Path $FrontendDist "index.html"))) {
+ Stop-WithError "npm run build did not produce jarvis/ui/web/dist/index.html"
+ }
+}
+
+# --- 2. PyInstaller --------------------------------------------------------
+if ($SkipPyInstaller) {
+ Write-Step "2/3 reusing the existing bundle (-SkipPyInstaller)"
+} else {
+ Write-Step "2/3 freezing with PyInstaller"
+ Invoke-Checked -Executable $Python `
+ -Arguments @("-m", "PyInstaller", "jarvis.spec", "--noconfirm", "--clean") `
+ -WorkingDirectory $RepoRoot -What "pyinstaller"
+}
+
+foreach ($required in @("PersonalJarvis.exe", "jarvis.exe")) {
+ $candidate = Join-Path $BundleDir $required
+ if (-not (Test-Path $candidate)) {
+ Stop-WithError "the frozen bundle is missing $required (expected at $candidate)"
+ }
+}
+
+# Running the app straight out of dist/Jarvis (the obvious way to smoke-test a
+# build) leaves runtime state behind in _internal: a jarvis.db, flight-recorder
+# JSONL, logs. Shipping that would put the builder's own data inside every
+# downloaded installer. The build output is defined by jarvis.spec, so anything
+# below is not part of it and goes before the payload is compressed.
+$strayState = @("_internal\data", "_internal\data-dev", "_internal\logs")
+foreach ($stray in $strayState) {
+ $path = Join-Path $BundleDir $stray
+ if (Test-Path $path) {
+ Write-Step "removing runtime state left in the bundle: $stray"
+ Remove-Item -Recurse -Force $path
+ }
+}
+
+# --- 3. Inno Setup ---------------------------------------------------------
+function Find-Iscc {
+ $command = Get-Command "ISCC.exe" -ErrorAction SilentlyContinue
+ if ($null -ne $command) { return $command.Source }
+ # ${env:ProgramFiles(x86)} needs the braces: without them PowerShell reads
+ # $env:ProgramFiles and leaves a literal "(x86)" behind.
+ $candidates = @(
+ "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
+ "$env:ProgramFiles\Inno Setup 6\ISCC.exe",
+ "$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe"
+ )
+ foreach ($candidate in $candidates) {
+ if ($candidate -and (Test-Path $candidate)) { return $candidate }
+ }
+ return $null
+}
+
+$Iscc = Find-Iscc
+if ($null -eq $Iscc) {
+ Stop-WithError ("Inno Setup 6 is not installed. Install it with " +
+ "'winget install --id JRSoftware.InnoSetup -e' and run this script again.")
+}
+Write-Step "3/3 packaging with $Iscc"
+
+New-Item -ItemType Directory -Force -Path $InstallerDir | Out-Null
+
+$IsccArgs = @(
+ "/DAppVersion=$AppVersion",
+ "/DSourceDir=$BundleDir",
+ "/DOutputDir=$InstallerDir",
+ "/DIconFile=$IconFile",
+ $IssFile
+)
+Invoke-Checked -Executable $Iscc -Arguments $IsccArgs -WorkingDirectory $RepoRoot -What "ISCC"
+
+$Artifact = Join-Path $InstallerDir "PersonalJarvis-Setup-x64.exe"
+if (-not (Test-Path $Artifact)) {
+ Stop-WithError "ISCC reported success but $Artifact does not exist"
+}
+
+$SizeMb = [math]::Round((Get-Item $Artifact).Length / 1MB, 1)
+Write-Step "done - $Artifact ($SizeMb MB)"
+Write-Output $Artifact
+exit 0