# Installation, packaging, release and upgrade

**Official releases**: v1.4.0 is the version this tree builds; v1.3.0 is the latest tagged. One complete product runtime per platform and architecture. The macOS App adds only the Electron shell to it and the CLI only launchers; Windows and Linux Apps are a [thin shell](#thin-shell) plus a seed. Checks, downloads and platform handoff are in [Automatic updates](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/automatic-updates.html).

## Who gets what

|  | Desktop | CLI / server | Development |
| --- | --- | --- | --- |
| Source | GitHub Release | Same Release | Git checkout |
| Product runtime | macOS: platform archive + Electron. Windows, Linux: thin shell + seed | Platform archive | Same capabilities + development overlay |
| System Python, Node.js | Not needed | Not needed | Toolchain needed |
| Git | Bundled, pinned, first on `PATH` | Same | System Git needed |
| Upgrade target | Published runtime | Same | Explicit Git ref |
| Channel | `stable` | `stable` | `dev` |

Platforms

|  | Desktop | CLI / server | Development |
| --- | --- | --- | --- |
| macOS arm64, x64 | DMG and ZIP. Signed and notarized when Apple credentials exist, otherwise `-unsigned` with an ad-hoc signature | Supported | Supported |
| Linux x86_64 | deb and AppImage, thin | Complete runtime | Supported |
| Linux arm64 | deb and AppImage, thin | Complete runtime | Python and Linux gates |
| Windows x86_64; arm64 behind a switch | Per-user NSIS, thin. `-unsigned.exe` without a certificate | ZIP + PowerShell installer | Sandbox separate: [Windows support](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/windows-support.html) |
| iOS, Android, iPadOS | None | Not applicable | Not applicable |

Browser access works from any device to a supported host, local or remote; it does not make the client OS supported. No mobile layout commitment. Only combinations that pass browser and responsive acceptance may be labelled official.

## What is in the product

| Part | Rule |
| --- | --- |
| Included | Pinned CPython (3.12.10), pinned `uv` (0.11.16), pinned Git, OpenProgram, prebuilt Web, standalone Ink bundle with Node.js. That Node is the only one: on macOS and Linux Playwright's driver runs on it through a link (`scripts/release/share-runtime-node.py`), where the Playwright package would otherwise bring a second copy of about 115 MB; Windows keeps both. Capabilities in `scripts/release/product-runtime.json`: `web providers mcp memory channels search tui.ink browser.playwright` |
| Excluded | Programs, PyTorch, torchvision, OpenCV, EasyOCR, sentence-transformers, triton, NVIDIA/CUDA. Computer use is a built-in tool and ships no weights |
| Office editor | Pinned in the manifest as optional; installed after user consent |
| Mutable data | `~/.openprogram`: configuration, sessions, caches, user-added Programs. The runtime stays read-only |
| Development overlays | Editable source, debugging, local Web and Ink builds, tests, explicit perception, OCR or Browser backends. Never a product dependency, and the baseline capability manifest must still pass |
| Not product entries | `pip install openprogram`, `pipx`, `uv tool install`. Wheels are for assembly, development and tests. Docs and runtime errors point only to official installers |
| Missing dependency | Reinstall the complete product. First use downloads nothing implicitly |

## One version, one artifact set

`pyproject.toml` is the version source; Electron metadata, the lock files and the installers' default keep copies, all written by `scripts/release/release-version.py set` ([version places](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/github-publishing.html#version-places)). The tag, runtime manifest, release manifest and health endpoint must equal it, and the tag must point at the built commit. Tags are immutable: fixes take a higher patch version.

| Artifact | Platforms |
| --- | --- |
| Runtime archive + checksum | macOS arm64, x64; Linux x86_64, arm64; Windows x86_64 (ZIP), arm64 behind a switch |
| Desktop | macOS DMG and ZIP; Windows NSIS EXE; Linux deb and AppImage; one copy each, under its versioned name |
| Update assets | `version-`, `base-` and `toolchain-<platform>.tar.zst`, `repo.bundle`, `SHA256SUMS`, signed `update-manifest.json` |
| Developer | Wheel and sdist, not user entries |
| `release-manifest.json` | Schema 1: version, and path, bytes, SHA-256 per file |

arm64 and x64 build separately, no universal2. A platform leg that fails leaves its files out and is named under "Not in this release"; publication stops only when the wheel or every macOS and Linux runtime is missing. Thin Apps need a trusted update signing key, because without one they could never update.

A leg whose artifact holds no installer or archive counts as failed and publishes nothing. When a planned package or a platform's update files are missing, the publish job turns red after the release is public and names each one. What a switch or a missing key leaves out does not.

**Each file once, under its versioned name**

A release uploads every file once. Up to v1.2.0 it also carried a version-free copy of each App installer (`OpenProgram-mac-arm64.dmg` and six more) and one `SHA256SUMS-<os>-<arch>` per App leg; from v1.3.0 it carries neither, 12 files fewer.

| Question | Answer |
| --- | --- |
| Why versioned names, not version-free | An installed v1.2.0 App looks for `OpenProgram-<version>-mac-<arch>.dmg` (or `-unsigned`) by name in the newest release, and a signed App that replaces itself looks for `OpenProgram-<version>-mac-<arch>.zip` first, so those names must exist. Codex, OpenCode and Goose publish only version-free names, which leaves one name per file too; a second name for the same bytes is what we drop |
| Newest-download links | `latest.html?OpenProgram-mac-arm64.dmg`, published beside the documentation from `docs/_static_root/latest.html` and linked relatively, reads the newest release's file list from the GitHub API and opens that file; without an answer it opens the newest release page. Every App link on the Install and Download pages goes through it, so no install page names a release and none goes stale when one ships. Claude Code resolves "latest" the same way, from a pointer and a manifest rather than a duplicate file |
| Checksums | GitHub shows each file's SHA-256 on the release page, and `release-manifest.json` lists every file's path, size and SHA-256. The App updater checks against that manifest, and the release notes' App table links to it in its checksum column |
| Still published | The runtime archives' `.sha256`: `openprogram upgrade` in v1.2.0 requires that file by name before it updates. The update `SHA256SUMS`, which the signed update manifest hashes. Seed `.sha256`, read by the command-line installer |

| Repository variable | Leg |
| --- | --- |
| `OPENPROGRAM_RELEASE_WINDOWS_RUNTIME`, `OPENPROGRAM_RELEASE_DESKTOP_MAC`, `_WINDOWS`, `_LINUX` | On unless `false` |
| `OPENPROGRAM_RELEASE_WINDOWS_ARM64`, `_MAC_THIN`, `_CLI_SEEDS` | Off unless `true` |

**Release workflow rules**

- Tag push `v*`, or manual dispatch of an existing tag; every checkout stays pinned to it.
- Runtime archives first; Desktop and CLI installer jobs download the same-named archive.
- Signing runs when its secrets exist. macOS: Apple secrets ([Developer ID](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/developer-id.html)). Windows: `WINDOWS_CSC_LINK`, `WINDOWS_CSC_KEY_PASSWORD`. Without them macOS gets an ad-hoc signature, Windows must verify as NotSigned, and both take `-unsigned` names. No PyPI credentials.
- Release uses the short-lived repository token. No Keychain, keyring or Credential Manager integration.
- Notes come from `.github/release-notes/vX.Y.Z.md`, must be English (CJK rejected), lead with user-visible changes, and include a download table. Doc-only corrections update notes without moving the tag.
- A public release is never overwritten; only a draft may be finished. The public `latest` entry is checked afterwards.
- `smoke-packaged-runtime.sh` runs on system Bash 3.2; the deferred-browser flag is explicit, normal validation runs the complete browser check.

## Installing

| Entry | Behaviour |
| --- | --- |
| macOS Desktop | Architecture-matched DMG, copy `OpenProgram.app` to Applications, or `~/Applications` without administrator rights. `-unsigned` assets need Privacy & Security → Open Anyway |
| Windows Desktop | Per-user NSIS wizard. `-unsigned.exe`: SmartScreen **More info → Run anyway**; under Smart App Control use the CLI |
| Linux Desktop | deb through `apt`, or AppImage with FUSE 2 or `APPIMAGE_EXTRACT_AND_RUN=1` |
| macOS, Linux CLI | `curl -fsSL https://fzkuji.github.io/OpenProgram/install \| sh` |
| Windows CLI | `irm https://fzkuji.github.io/OpenProgram/install.ps1 \| iex`, or `install.cmd` from Command Prompt |
| Development | Repository checkout, `uv sync`, Web and Ink builds, same capability probes as a release |

| Stage | Behaviour |
| --- | --- |
| Version | Latest stable unless `OPENPROGRAM_VERSION` is set; only three-part numeric versions |
| No package for the platform | Stops and names the platform |
| Installer source | That immutable tag; never a checkout |
| Unpack | Exact archive and checksum, to `runtime/cli/releases/X.Y.Z` under the state directory |
| Switch | Probes with absolute paths, then atomically switches the `current` symlink (Windows: replaces the launcher and keeps its predecessor) |
| Failure | Keeps the old version |
| Download | States its size, checks free space first and names the shortfall beside the need and the free amount (the two can round to the same figure), resumes through a partial file, names `HTTPS_PROXY` on network failure |
| macOS, before any download | A Mac older than `macosMinimum` (13.5) is refused with the version it runs and where to update macOS, the same floor as the App's `LSMinimumSystemVersion` |
| Linux, before any download | musl is refused. Missing Chromium libraries never stop the install: one line says the browser tool waits for them and gives the `apt` line, and the runtime check leaves the Chromium launch to the browser tool |
| `PATH` (macOS, Linux) | Adds one marked line unless `OPENPROGRAM_NO_MODIFY_PATH` or `OPENPROGRAM_BIN_DIR` is set |

## Upgrading and removing

| Install | How |
| --- | --- |
| Desktop | macOS: Settings downloads and verifies; the user confirms in the installer. Windows, Linux: `openprogram upgrade` on the version store; the App file only when the release needs a newer shell |
| CLI, server | `openprogram upgrade`. Any failed default-asset check prevents activation. Restart a running worker yourself |
| Development | The same command fetches, builds, probes and restarts an explicit ref |
| Programs | Migrate in separate environments; a failed migration disables only that Program |
| Remove Desktop | Delete `OpenProgram.app`; Installed apps on Windows; `apt remove openprogram-desktop`; delete the AppImage |
| Remove CLI | macOS, Linux: `~/.local/bin/openprogram` and `~/.openprogram/runtime/cli`. Windows: `%LOCALAPPDATA%\OpenProgram\bin` and `%USERPROFILE%\.openprogram\runtime\cli` |
| Remove data | Only an explicit purge of `~/.openprogram` |

Worker startup never applies product updates.

## Desktop bundle

```
OpenProgram.app/Contents/
├── MacOS/OpenProgram         # Electron launcher
├── Frameworks/               # Electron Framework and helpers
└── Resources/
    ├── app.asar              # Electron main, preload
    └── runtime/
        ├── python/           # portable CPython + dependencies
        ├── bin/uv
        ├── bin/openprogram-tailnet  # embedded Tailscale (Open from anywhere)
        ├── wheel/            # build evidence
        ├── assets/playwright/
        └── runtime-manifest.json
```

CPython comes from python-build-standalone indexed by the pinned `uv`, never the build machine. The runtime manifest (schema 2) records OpenProgram, Python, uv, capability results, asset paths and the product manifest hash.

1. Electron reads the in-App runtime manifest and verifies capabilities and required files.
2. It starts the in-App Python worker by absolute path, with `-I -B`, ignoring `PYTHONPATH`, user site and system configuration.
3. The launcher sets the bundled Playwright path.
4. The worker reports status and capability hash at `/healthz`.
5. Electron gets the authenticated URL from bundled Python and loads Web UI. A failure shows category, log location and repair action.

**Prohibited at runtime**

- PATH lookups of `openprogram`, `python`, `node`, `git`.
- The App or updater rewriting its own bundle. An AppImage update replaces the file beside it after verification.
- First-use downloads of Python, Web, Browser, OCR or detector weights.
- Reading `apps/web/out`, Program checkouts or development configuration from the repository.
- `npm build`, pip resolution or `git clone` on user machines.

**Icons**

- `apps/desktop/build/AppIcon.icon` is the Apple layered source: SVG layers on a 1024×1024 unmasked canvas, no pre-drawn frame.
- `icon.icns` is the committed Electron input, keeping the accepted extent, contour, transparent corners and shadow.
- The lavender cell and three discs stay centred, with no text or rasters. `actool` is unavailable on the build machine, so `.icon` is not compiled.
- Gates cover layer structure, ICNS representations, 256 px contour, corners and round trip. Dock, Finder and Launchpad are checked only on the installed App.

**Windows package**

- Per-user NSIS, selectable directory, `asInvoker`. Thin: the shell and a seed; x64 by default.
- With a certificate, `OpenProgram.exe` and the installer must be Authenticode Valid. Without one both must be NotSigned and the installer takes the `-unsigned.exe` name.
- Terminal uses Windows PowerShell and ConPTY. Chrome, Edge, Brave and Chromium profiles are discovered under normal paths. No ACL changes.

**Linux package**

- `executableName` `openprogram-desktop`, installed under `/opt/OpenProgram`. The deb lists its libraries, including the `t64` alternatives, and recommends `bubblewrap`; its desktop entry has a Recovery action.
- electron-builder's deb post-install adds an AppArmor profile on systems that support it, so the Chromium sandbox works on Ubuntu 24.04; an AppImage has no such step.
- Built on Ubuntu 22.04. Bundled Git needs glibc 2.34; the supported floor stays Ubuntu 22.04 (glibc 2.35).
- An AppImage records `$APPIMAGE` so every relaunch and update uses the same file.

## Programs

```
~/.openprogram/programs/
├── src/<program-id>/
├── manifests/<program-id>.json
└── environments/<runtime-id>/
    ├── releases/<generation>/
    └── current -> releases/<generation>
```

`runtime-id` covers at least CPython minor, architecture and dependency lock; Desktop and CLI on one platform share it. Install, upgrade and remove are one transaction:

1. Resolve source and declarations into a temporary directory.
2. Create a staging environment with in-App `uv` and CPython.
3. Install dependencies from all enabled manifests; record exact versions and hashes.
4. Import probes, registration checks, worker cold start.
5. Atomically switch `current`. Failure deletes staging.

Programs fall outside release integrity, use separate environments, never overwrite `openprogram`, and are never installed by a wizard.

## Failures

| What happened | Result |
| --- | --- |
| Runtime files or manifest mismatch | Worker does not start; reinstall instructions |
| Missing capability or asset | The whole platform artifact is blocked; no reduced install |
| Older checkout or App over the current App | Fails before build, service stop or writes |
| Older unsigned macOS file | Manual approval and SHA-256 per its filename |
| System injects Python paths | Ignored by isolated start |
| Program dependency overwrites a core package | Environment activation rejected |
| New runtime fails probes | `current` unchanged; Desktop artifact not published |
| Versions disagree | Build or release blocked |

## Local fixed App

The only stable local App is `/Applications/OpenProgram.app`, with a sibling development App (see [dev instance](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/dev-instance.html)). No App name carries a version, commit or task. Build Apps are never launched or kept.

**Full install: `npm --prefix apps/desktop run dist`**

| Stage | Rule |
| --- | --- |
| Build | In a random temporary directory; validates bundle ID, version, main executable, embedded runtime |
| Older candidate | Rejected before touching App, worker or Launch Services. Version segments compare as arbitrary-precision integers; an unverifiable existing App fails, it is kept |
| Locks | A user-level lock plus an atomic lock in Applications: concurrent runs fail before any change, and cleanup removes only locks held by this PID |
| Activate | Unloads a launchd KeepAlive service, stops the lock-holding worker, stages on the Applications volume, then moves the old App into the transaction directory and activates the new one |
| Service | Reinstalled with the new embedded Python and `-I -B`; waits for `/healthz`; opens the App. Service arguments must not retain conda, checkout or deleted-App paths |
| Failure, success | Failure restores old App, launchd service and run state. Success removes old App, wheel cache, staging, build and transaction directories |
| Launch Services | Registers only the fixed path; on restore, best-effort re-registers and keeps the original failure status |
| Signing | electron-builder ad-hoc signs components; a fixed local certificate signs the App and helpers; strict recursive verification follows |

## Thin signed shell

A thin App is the shell alone, in `apps/desktop/shell/`, plus a seed under `Resources/seed`. Windows and Linux Apps are thin. The macOS App stays embedded unless `OPENPROGRAM_RELEASE_MAC_THIN` is on.

| Mode | Selected at start by |
| --- | --- |
| Developer | `<root>/developer.json` |
| Embedded | `Resources/instance.json`, `Resources/runtime` or an unpackaged App. The old path, unchanged |
| Managed | Anything else: the shell reads `current` and loads that sealed version's `desktop/main.js` through `start(context)` |

### First start

1. Check first: `<root>` holds only an older `cli/`, the seed's leftovers and the shell's own `recovery.log`, which records a failed setup, and the disk has room.
2. A refusal names the files in the way, or the space needed, the space free and how much is missing. The setup page shows it, `recovery.log` keeps it, and **Try again** or the next launch checks again.
3. Write `.seeding`, unpack with progress.
4. Run `install_seed.py` with the base's Python: rename the build root in the version, rewrite the seal's file table, install the identity and tools, create `repo/`, write the pointer.
5. Remove `.seeding` last, so an interrupted install starts over.

| Part | Behaviour |
| --- | --- |
| Seed | `base.tar.zst`, `version.tar.zst`, `repo.bundle`, the launcher (on macOS the signed helper bundle, the one identity privacy grants attach to), `shell-compat.json`, the stdlib `bootstrap/` tools. The command-line installers use the same seed as `.tar.gz`; `scripts/release/build-release-seed.sh` builds both |
| Start counting | The worker starts through the launcher, so the guard counts every start; short authentication commands use the version's Python and do not count |
| Desktop load | A failure is recorded in `boot/<id>.desktop-failed` for that shell version and the App relaunches on the fallback. Success writes `boot/<id>.desktop-ready` |
| Recovery page | No version can load; `/healthz` has failed for 120 s on the fallback; the App menu (**File** on Windows and Linux); Shift held at start on macOS and Windows; `--recovery` and the deb launcher action on Linux |
| Git | A base ships a pinned Git on macOS, Windows and Linux, first on `PATH` |
| Shell change | When the shell version changes, it refreshes `shell-compat`, the Python minor and the launcher, renaming a locked Windows launcher aside |
| Running worker | A worker whose version differs from the App is restarted, once per launch |
| macOS placement | An App opened from a disk image or Downloads offers to move to Applications, or `~/Applications` when the shared folder is not writable |

## Acceptance

**Runtime and macOS**

- Native runners, pinned commit and lock. `--version`, cold start, `/healthz`, `/chat`, hashed Web assets. Import and asset probes; excluded distributions absent.
- DMG on clean arm64 and x64 with system Git only. Offline first start, worker, Web and Chromium probes. Python path and capability hash from the embedded runtime.
- Two consecutive builds leave only the one App. Concurrent installers: one enters. A corrupt candidate or failed activation keeps the old App.
- Bundle, runtime manifest, `--version` and Python metadata agree.

**Windows, CLI, release**

| Target | Accepted when |
| --- | --- |
| Windows | Same ZIP as the CLI; manifest, Python, worker health and Web chat from the unpacked App; ConPTY presets; browser paths. Updater takes only the exact EXE. Before packaging, the tests in `scripts/release/windows-contracts.txt`; after it, `smoke-windows-desktop.ps1` installs, launches to a healthy worker, makes one tool call and uninstalls keeping the data. The installed CLI also makes one tool call (`smoke-tool-call.py`) |
| CLI | Both bootstraps with latest and pinned versions; no PyPI or clone; hashes match; old version starts after a failed upgrade |
| Release | One version everywhere; every published asset passed its own leg; a build with no publisher signature carries `-unsigned` in its name |
| Linux Desktop | `scripts/release/smoke-linux-desktop.sh` under Xvfb on clean Ubuntu 22.04 and 24.04 with Git removed: deb install, desktop entry, `node-pty`, first-run seed, restart after unpacking, worker health, `/chat`, the launcher, and the AppImage with `APPIMAGE_EXTRACT_AND_RUN=1` |
| Docs | Docs, indexes and runtime errors contain no `pip install openprogram` or component-install steps |

**References**

| Reference | Use |
| --- | --- |
| [Electron](https://www.electronjs.org/docs/latest/tutorial/distribution-overview), electron-builder ([signing](https://www.electron.build/docs/features/code-signing/code-signing-mac/), [Linux targets](https://www.electron.build/docs/linux/)) | Desktop shell; reads the same runtime archive as the CLI |
| [Apple distribution](https://developer.apple.com/documentation/xcode/packaging-mac-software-for-distribution) | [Developer ID](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/developer-id.html) |
| Apple [icon guidance](https://developer.apple.com/design/human-interface-guidelines/app-icons), [Icon Composer](https://developer.apple.com/documentation/Xcode/creating-your-app-icon-using-icon-composer) | Layered source plus compatible ICNS |
| [AppImage](https://www.electron.build/appimage/), deb, rpm, Snap, Flatpak | deb and AppImage carry the Linux App. rpm, Snap and Flatpak are not published. None of them sets the glibc baseline; the Ubuntu 22.04 build does |
| [Briefcase](https://briefcase.beeware.org/en/latest/reference/platforms/macOS/index.html) | Principle only: Python belongs in the app bundle |
| [PyInstaller](https://pyinstaller.org/en/stable/) | Rejected: does not suit dynamic Program discovery and extension dependencies |
| [py2app](https://py2app.readthedocs.io/en/stable/) | Layout reference for Python.framework and Mach-O |
| uv ([environments](https://docs.astral.sh/uv/pip/environments/), [tools](https://docs.astral.sh/uv/concepts/tools/)) | Adopted for CLI install and Program environments; `uv tool install openprogram` is not an entry |
| [PyPA](https://packaging.python.org/en/latest/tutorials/packaging-projects/), [Trusted Publishing](https://docs.pypi.org/trusted-publishers/using-a-publisher/) | Wheels are developer artifacts only |

## Implementation status

| Part | Status |
| --- | --- |
| Single-port worker, health and recovery, Web in the runtime, capability manifest, shared runtime archive, fixed-App install, icons, CLI installers, tag-driven Release | Implemented |
| macOS signed DMG and ZIP | Implemented; Apple gates are [external](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/developer-id.html) |
| Windows Desktop | Implemented, first published with v1.2.0; never run on real Windows. [Windows support](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/windows-support.html#implementation-status) |
| Thin shell and seed | Implemented, used by the Linux App from v1.1.0 and the Windows App from v1.1.1. The packaged shell passes the macOS smoke; Linux deb and AppImage pass under Xvfb on arm64. Open: x86_64 Linux packages, a real Windows run, and the macOS privacy-grant gate ([Developer ID](https://fzkuji.github.io/OpenProgram/docs/reference/design/distribution/developer-id.html)) before the macOS App can turn thin. `legacy_app` and the App ties in the supervisor still exist |
| Linux Desktop | Implemented, first published with v1.1.0. Update activation and going back on Linux need one more end-to-end run |
| Release workflow | Independent legs and unsigned forms implemented and tested as scripts; the workflow itself has not yet run on GitHub |
| One copy per file | Implemented; first release without the version-free copies and per-leg checksum files is v1.3.0. The runtime `.sha256` files can go once no supported release's `openprogram upgrade` asks for them |
| `openprogram update` | Leftover command: its handler imports helpers that no longer exist and raises `ImportError`. `upgrade` is the update command |

Out of scope: App Store, credential-store integration, replacing Python or Electron, per-Program process isolation, automatic third-party Program installs.

[Single-port worker](https://fzkuji.github.io/OpenProgram/docs/reference/design/cli/single-port.html)
