Paneflow checks for a new version on its own and, for most installs, downloads it
in the background. A package installed with apt, dnf or zypper can also be
upgraded with that package manager. This page describes Paneflow 0.20.0.

**Restarting into a new version ends every session.** The layout of your panes
comes back, and agent conversations reopen. See [What restarts](#what-restarts).

## Upgrading Paneflow

| Installed with | Upgrade |
| --- | --- |
| macOS app | Paneflow updates itself. |
| Homebrew | Paneflow updates itself, or `brew upgrade --cask paneflow`. |
| Debian, Ubuntu | `sudo apt update && sudo apt install --only-upgrade paneflow` |
| Fedora | `sudo dnf upgrade --refresh paneflow` |
| openSUSE | `sudo zypper refresh && sudo zypper update paneflow` |
| Fedora Atomic | `rpm-ostree upgrade` |
| AppImage | Paneflow updates itself. |
| Archive (`.tar.gz`) | Paneflow updates itself, or run `./install.sh` from the new archive. |
| Windows (MSI) | Paneflow installs the update when you click it, or run the new MSI from [Download](/download). |

Paneflow publishes no WinGet, Flatpak, Snap, AUR or Nix package.

## Updates inside Paneflow

Paneflow checks the latest release when it starts, then every 4 hours, and 30
minutes after a check that failed. **Check for updates** in the command palette and
the Help menu checks at once. The title bar shows what is happening:

| Title bar | Meaning |
| --- | --- |
| Checking for updates… | A check is running. |
| v0.21.0 available | A newer version exists. Click to install it. |
| Downloading update…, Installing update… | The update is being installed. |
| Restart to update | The new version is on disk. Click to restart into it. |
| Retry update | The last attempt failed. Click to try again. |
| Update via package manager | Paneflow can't replace this install; the click copies what to run. |

What Paneflow does depends on how it was installed:

| Installed with | Paneflow |
| --- | --- |
| macOS app, Homebrew, AppImage, archive | Downloads and replaces the app in the background, without a click. |
| Debian, Ubuntu, Fedora, openSUSE | Runs apt, dnf or zypper through `pkexec` when you click. Without `pkexec`, it copies the `sudo` command for you. |
| Windows (MSI) | Runs the new MSI after Paneflow closes, when you click. |
| Fedora Atomic, Flatpak, Snap | Copies the command to run. |

Every download is checked against its minisign signature before anything is
replaced, and on macOS and Windows against the app's code signature too. A file
that fails the check is deleted and the title bar offers a retry. Packages from
apt, dnf and zypper are checked by the package manager against the repository's
signing key. After 3 failed attempts in a row, Paneflow stops retrying on its own
and points you to the releases page.

Update checks can't be turned off from `paneflow.json`. The macOS app updates
itself only from `/Applications` or `~/Applications`.

## What restarts

Clicking **Restart to update** stops every session and every program running in
it, then starts the new version. With live sessions, Paneflow asks first, unless
`on_quit` is `"stop"`:

> Updating ends every session and every process they started.

The `on_quit` setting doesn't keep sessions across an update. When Paneflow starts
again, it restores the layout of your windows, tabs and panes. Agent conversations reopen when `agents.restore_conversations` is on,
which is the default.

A package manager replaces the files but restarts nothing. The open window keeps
running the old version until you quit and open Paneflow again. Then:

| Process | On the next start |
| --- | --- |
| Window | Runs the new version. |
| Worker (`paneflow serve`) | Replaced by the new version, after up to 5 s to finish its work. Terminals are untouched. |
| Host (`paneflow-host`, which runs the terminals) | Kept with its sessions when the new version can still talk to it. |

When the host is too old for the new version, each pane says so and offers
**Retry** and **Stop host and restart**. Stopping the host ends every session.
The Windows installer stops the host itself during an upgrade.

## Checking the version

`paneflow --version` prints the version that's installed, and the About dialog
shows the version of the open window. To see what's running:

```sh
paneflow --version
paneflow serve status
paneflow host status
```

`paneflow serve status` prints the worker's `version`, and `paneflow host status`
the host's version under `identity`. A host too old for this CLI reports
`"state": "incompatible"`. `paneflow api call system.identify` returns the version
of the open window.

## Holding and downgrading

Paneflow has no setting to hold a version, and it only ever offers a newer one.

| Installed with | Go back to an older version |
| --- | --- |
| Fedora | `sudo dnf downgrade paneflow-VERSION`. Older versions stay in the repository. |
| Archive (`.tar.gz`) | Run `./install.sh` from the older archive. It doesn't compare versions. |
| Windows (MSI) | The installer refuses to replace a newer version, so uninstall Paneflow first. |
| Other installs | Install the older release from GitHub. |

An older Paneflow is careful with data a newer one wrote:

- `paneflow.json` loads, and keys the older version doesn't know are ignored and
  kept when Settings saves the file.
- A `session.json` in a newer format is not loaded. Paneflow keeps a copy, never
  overwrites it, and asks whether to retry or start a new session.
- Pane grants are reset when the newer version stored fields the older one doesn't
  know: the older version starts with no grants.

## Keeping your changes

Upgrades never touch your Paneflow home, `~/.paneflow` (or `$PANEFLOW_HOME`), which
holds `paneflow.json`, `init.lua`, your sessions and your grants. Removing a
package leaves it too.

The Debian package writes `/etc/apt/sources.list.d/paneflow.list` only when it
doesn't exist, so a mirror you set there survives upgrades. The RPM package does
the same for `/etc/yum.repos.d/paneflow.repo` and `/etc/zypp/repos.d/paneflow.repo`,
and removes them when you uninstall Paneflow.

## Changing how Paneflow is installed

Keep one copy of Paneflow on a machine. When a package and the archive in
`~/.local/paneflow.app` are both installed, Paneflow warns once that two installs
were found. To move from the archive to a package, install the package, then
remove the archive:

```sh
rm -rf ~/.local/paneflow.app ~/.local/bin/paneflow
```