Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cursor/rules/architecture.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ The binary inventory and launch ownership live in
`nvpair-engine-manager` owns lifecycle and model operations.

- Engine server ports and proxy ports are persisted by their backend owners.
- The engine manager on the selected node identifies the installed version,
selects the release, and applies managed updates. The desktop uses the
engine manager's paired-peer control surface for remote engines.
- Desired engine state is restored by the backend.
- Leave shutdown ordering to the broker. Its shutdown stops the proxy, then the
engines through `engine:prepare-shutdown`, then the workers. Clients do not
Expand Down
7 changes: 5 additions & 2 deletions .cursor/rules/system-architecture.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,11 @@ detail of either; a change to one is a change to both. Neither drives the other.
`nvpair-engine-manager` owns lifecycle, port, desired-state, and model
operations.

- Local lifecycle supports install, start, stop, uninstall, update, and port
changes.
- Local lifecycle supports install, start, stop, uninstall, and port changes.
The desktop uses `engine:check-updates` and `engine:update` locally.
On a paired node, `engine:remote-check-updates` and `engine:remote-update`
delegate both operations to the target engine manager. It selects the
release, verifies ownership, and supplies vendor links for external copies.
- Remote lifecycle uses the engine manager's remote control methods where
available.
- `engine:prepare-shutdown` stops processes without clearing persisted desired
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,9 @@ Each entry assumes the ones before it.
most users need. When you update, **[Release notes](docs/release-notes.mdx)**
lists what changed and the **[Upgrade guide](docs/upgrade-guide.mdx)** covers
any steps the update needs.
3. **[Managing engines](docs/engine-lifecycle.mdx)** — install, start, stop,
update, and uninstall engines; what PAIR restores after you quit or relaunch.
3. **[Managing engines](docs/engine-lifecycle.mdx)** — install, start, stop, and
update engines on this machine or a paired one, remove local engines, and
see what PAIR restores on relaunch.
4. **[Engine settings](docs/engine-settings.mdx)** — change an engine's ports and
its launch command, on this machine or a paired one, and give a browser access
to your models.
Expand Down
37 changes: 37 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ binaries across the Windows, Linux, and macOS targets. First-party modules
| `github.com/rivo/uniseg` | v0.4.7 | MIT |
| `github.com/xo/terminfo` | v0.0.0-20220910002029-abceb7e1c41e | MIT |
| `github.com/yusufpapurcu/wmi` | v1.2.4 | MIT |
| `golang.org/x/mod` | v0.12.0 | BSD-3-Clause |
| `golang.org/x/net` | v0.58.0 | BSD-3-Clause |
| `golang.org/x/sys` | v0.47.0 | BSD-3-Clause |
| `golang.org/x/text` | v0.3.8 | BSD-3-Clause |
Expand Down Expand Up @@ -7212,6 +7213,42 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
```

### golang.org/x/mod v0.12.0

License: BSD-3-Clause

Repository: https://golang.org/x/mod

```text
Copyright (c) 2009 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```

### golang.org/x/net v0.58.0

License: BSD-3-Clause
Expand Down
6 changes: 6 additions & 0 deletions desktop/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ closed `EngineType` union and narrows external strings with `isEngineType()`.
`engineManagerName()` / `engineTypeFromManagerName()` are the one place that
translation to and from the engine manager's own spelling lives.

Each node's engine manager compares versions, determines installation
ownership, and applies managed updates. For a paired node the desktop requests
the check or update through the peer control surface. The bridge publishes
availability by node and engine through the engine snapshot and
`engines:state-changed` updates.

### Model downloads

A download is started with `engine:action{pull_model}`, or
Expand Down
5 changes: 4 additions & 1 deletion desktop/docs/frontend-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ They do not imply a WebSocket connection. Browser clients are not supported.

- `getInitialState()` returns engine statuses, models, active progress, and available
updates.
- `toggle`, `install`, `uninstall`, and `update` manage engine lifecycle.
- `toggle`, `install`, and `uninstall` manage engine lifecycle. `update` applies
an available release to a PAIR-managed engine on the selected local or
paired node. For an external installation, the engine row links to the
vendor instructions or release reported by that node.
- `pullModel`, `cancelModelPull`, `loadModel`, `unloadModel`, `deleteModel`, and
`setModelExpiry` manage models.
- `searchHub(engineType, nodeId)` returns the curated model catalog for a
Expand Down
8 changes: 8 additions & 0 deletions desktop/docs/services-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
| `engine:action` | request (we call) | ✅ yes |
| `engine:cancel-pull` | request (we call) | ✅ yes |
| `engine:catalog` | request (we call) | ✅ yes |
| `engine:check-updates` | request (we call) | ✅ yes |
| `engine:configure-launch` | request (we call) | ⚠️ not called |
| `engine:configured-ports` | request (we call) | ⚠️ not called |
| `engine:describe` | request (we call) | ⚠️ not called |
Expand All @@ -110,6 +111,7 @@
| `engine:preview-launch` | request (we call) | ⚠️ not called |
| `engine:remote-apply-settings` | request (we call) | ⚠️ not called |
| `engine:remote-cancel-pull` | request (we call) | ✅ yes |
| `engine:remote-check-updates` | request (we call) | ✅ yes |
| `engine:remote-delete-model` | request (we call) | ✅ yes |
| `engine:remote-get-installed` | request (we call) | ✅ yes |
| `engine:remote-get-settings` | request (we call) | ⚠️ not called |
Expand All @@ -120,13 +122,15 @@
| `engine:remote-start` | request (we call) | ✅ yes |
| `engine:remote-stop` | request (we call) | ✅ yes |
| `engine:remote-unload-model` | request (we call) | ✅ yes |
| `engine:remote-update` | request (we call) | ✅ yes |
| `engine:restart` | request (we call) | ⚠️ not called |
| `engine:set-port` | request (we call) | ⚠️ not called |
| `engine:start` | request (we call) | ✅ yes |
| `engine:status` | request (we call) | ✅ yes |
| `engine:stop` | request (we call) | ✅ yes |
| `engine:uninstall` | request (we call) | ✅ yes |
| `engine:uninstall-managed` | request (we call) | ✅ yes |
| `engine:update` | request (we call) | ✅ yes |
| `error` | request (we call) | ✅ yes |
| `internal:set-reserved-port` | request (we call) | ⚠️ not called |

Expand Down Expand Up @@ -275,17 +279,21 @@
| `discovery:subscribe` | request (we call) | ✅ yes |
| `discovery:unsubscribe` | request (we call) | ⚠️ not called |
| `engine:apply-settings` | request (we call) | ✅ yes |
| `engine:check-updates` | request (we call) | ✅ yes |
| `engine:configure-launch` | request (we call) | ⚠️ not called |
| `engine:get-installed` | request (we call) | ✅ yes |
| `engine:get-settings` | request (we call) | ✅ yes |
| `engine:install` | request (we call) | ✅ yes |
| `engine:preview-settings` | request (we call) | ✅ yes |
| `engine:restart` | request (we call) | ⚠️ not called |
| `engine:set-port` | request (we call) | ⚠️ not called |
| `engine:set-reserved-port` | request (we call) | ⚠️ not called |
| `engine:start` | request (we call) | ✅ yes |
| `engine:status` | request (we call) | ✅ yes |
| `engine:stop` | request (we call) | ✅ yes |
| `engine:subscribe` | request (we call) | ✅ yes |
| `engine:unsubscribe` | request (we call) | ⚠️ not called |
| `engine:update` | request (we call) | ✅ yes |
| `errors:get-initial` | request (we call) | ✅ yes |
| `internal:set-reserved-port` | request (we call) | ⚠️ not called |
| `node/add` | request (we call) | ✅ yes |
Expand Down
11 changes: 8 additions & 3 deletions desktop/docs/services-backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,14 @@ one centralized pending-action layer so controls respond immediately while
waiting for authoritative state. Pending state clears on matching engine state,
progress, or error pushes.

Local engine operations include install, start, stop, uninstall, update, port
changes, and model actions. Remote cluster operations use the engine manager's
remote control surface where supported.
Local engine operations include install, start, stop, uninstall, port changes,
and model actions. The desktop calls `engine:check-updates` at startup and every
six hours for each installed local engine. A local start or stop also triggers
a background check for that engine. The bridge projects each successful result into
`updateAvailable` for the renderer. For a paired node, the desktop requests
`engine:remote-check-updates` with the node and engine. Selecting **Update**
sends `engine:update` locally or `engine:remote-update` to the peer. The
selected node determines ownership and runs its own updater.

### Cancelling a download

Expand Down
22 changes: 11 additions & 11 deletions desktop/docs/services-parity.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ history.
| llama.cpp backend | Integrated | Desktop and TUI expose install, lifecycle, catalog pull, inventory, load/unload, endpoints, routing, and demo traffic |
| vLLM engine | Integrated (Linux, macOS arm64) | Desktop and TUI expose install, lifecycle, the cached-model list, switching the served model (Load), Hugging Face catalog search and download, endpoints and routing; eject (stops the engine), delete of cached models; no demo traffic |
| Local engine lifecycle | Complete | Install, start, stop, uninstall, update, and port configuration |
| Remote engine lifecycle | Partial | Remote install, start, stop, status, and model pull are supported |
| Remote engine lifecycle | Partial | Remote install, start, stop, status, update checks, managed updates, and model pull are supported |
| Engine models | Partial | Core list, pull, load, unload, and supported delete actions are wired |
| Engine version metadata | Backend-limited | The backend status surface does not provide a complete version/install-owner/update contract |
| Engine version metadata | Local engines | The engine manager compares the installed version with the applicable platform release and distinguishes managed and external installs. |
| Errors | Complete | Broker-relayed registry with peer synchronization |
| Workloads | Complete after subscription | Local and peer workload events feed one Electron catalog |
| Cluster pairing | Complete | PIN pairing, identity, membership, leave, and removal |
Expand Down Expand Up @@ -279,21 +279,21 @@ genuinely foreign listener (with an actionable error). Personal AI Router treats
desired state as authoritative and surfaces a stop error as guidance, not as a
sign the OFF choice was discarded.

For ease of use, Personal AI Router issues starts in two additional cases and
keeps no auto-start list of its own: every install sends `engine:install` with
`start: true`, so a successful install (or managed update) starts the engine;
and on the first app open Personal AI Router starts every already-installed local
engine once. Both paths rely on the backend recording desired-enabled as a side
Every local install sends `engine:install` with `start: true`, so a successful install
starts the engine. A local managed engine update uses `engine:update` and preserves
the engine's running or stopped state. On the first app open Personal AI Router
starts every already-installed local engine once. Install and first-open starts
rely on the engine manager recording desired-enabled as a side
effect of start, so `nvpair-engine-manager` remains the single owner of
desired-state persistence and restoration.

Personal AI Router synthesizes one centralized pending-action state while waiting for
terminal backend notifications. It never treats optimistic state as
authoritative.

Remote cluster support includes status, install, start, stop, model pull, and
remote model load, unload (eject), and delete via the `ec` surface. Uninstall
and update remain local-only.
Remote cluster support includes status, install, start, stop, update checks,
managed updates, and model pull, load, unload (eject), and delete via the
`ec` surface. Uninstall requires the local client.

Server port, proxy port, and engine arguments are one authoritative record owned
by the node running the engine, read and written through the broker's
Expand Down Expand Up @@ -358,7 +358,7 @@ Load uses a separate 10/31-minute response-header budget:
| `OLLAMA_LOAD_PENDING_TIMEOUT_MS` (`pending-actions.store.ts`) | 32min | Ollama's Load control stays locked beyond the remote path's 31-minute header budget, while backend success or failure still clears it immediately. |
| `PENDING_TIMEOUT_MS` | 60s | Unchanged for every other command, including an Ollama delete. |
| `remoteReadyResponseHeaderTimeout` (`remoteclient.go`) | 31min | Start, settings apply, delete, Ollama and vLLM loads (a vLLM load restarts vLLM on the new model), and download cancel can answer only after slow work on the peer, so `waitsForEngineReadiness` sends them to the client pool `NewManager` (`manager.go`) creates with this budget. |
| `remoteResponseHeaderTimeout` (`remoteclient.go`) | 30s | Every other remote call, a streamed pull or install included. It bounds only how long the peer takes to begin its answer, not how long the call runs. |
| `remoteResponseHeaderTimeout` (`remoteclient.go`) | 30s | Every other remote call, including a streamed pull, install, or update. It bounds only how long the peer takes to begin its answer, not how long the call runs. |

The net is a backstop, not the mechanism: a delete now ends the spinner on real
backend truth either way. On success the refreshed `list_models` drops the model;
Expand Down
8 changes: 8 additions & 0 deletions desktop/src/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { macPrivilege } from '@/electron/services/mac-privilege-service'
import { registerAllIpc } from '@/electron/ipc'
import { destroyConnector, destroyConnectorSync, initializeConnector } from '@/electron/connector'
import { initializeUpdater } from '@/electron/updater'
import { subscribeEngineUpdateNotifications } from '@/electron/updater/engine-update-notification'
import { getModularBridgeState } from '@/electron/service-bridge/modular-state'
import { ensureNvpairOnPath } from '@/electron/nvpair-command'
import { isAppDataWipeScheduled } from '@/electron/app-data-wipe-orchestrator'
import { destroyInferenceDemoSync, stopInferenceDemo } from '@/electron/inference-demo'
Expand Down Expand Up @@ -162,6 +164,12 @@ if (!gotTheLock || exitRequested) {

registerAllIpc()
initializeUpdater()
const unsubscribeEngineUpdates = subscribeEngineUpdateNotifications(nodeId => {
const state = getModularBridgeState()
if (nodeId === state.getSelfId()) return 'This node'
return state.getNodesInitial().nodes[nodeId]?.name || nodeId
})
app.once('will-quit', unsubscribeEngineUpdates)

// Bound startup on broker `app:ready` before opening the normal Overview.
// Proxy readiness is not part of this gate — it is an asynchronous
Expand Down
Loading
Loading