# Linux isolation service release and installation

CLI 0.17.0 includes isolation service 0.5.0 as source in the npm package. The package contains
`Cargo.toml`, `Cargo.lock`, all Rust source, the Linux installer and security probes. It does not contain
a prebuilt root binary. npm installation does not build Rust, invoke sudo or install a service.
The CLI and root service remain separate processes and upgrades.

Drone compiles and tests the Linux Rust code with the pinned official Rust 1.90.0 Bookworm image before
publishing the npm version. It also checks the actual npm package list for every shipped source,
installer and probe. The root/systemd network suite is a separate test on a disposable Linux host;
ordinary Docker CI cannot prove the host's kernel or deployed policy.

## Prepare as the ordinary machine user

Obtain the exact CLI version from the tested npm `beta` release or from the same reviewed release tag.
Stage the tarball separately from the active global install. Verify npm's version and integrity before
using it. Do not replace a running daemon's installed files.

From the extracted package, with Cargo on the user's `PATH`:

```sh
cargo test --locked --manifest-path isolator/Cargo.toml
cargo build --release --locked --manifest-path isolator/Cargo.toml
isolator/target/release/boujot-isolator --version
node --test isolator/tests/install-config.test.mjs
```

These commands need no root privileges. On machines with rustup, Cargo may be in `~/.cargo/bin`, not
`/usr/bin`. Build on the destination architecture; the Linux network boundary supports x86_64 and
aarch64. macOS cannot supply the required Linux network evidence.

## Drain before replacing the root service or CLI

1. Prevent new chats from being placed on the machine and let current chats finish. Inspect the
   daemon's sessions, the root service's `list_runtimes`, and `boujot-rt-*.service` units. Retirement
   records whose process is already gone are retained; they are not running chats.
2. Inspect the existing supervisor first: a service with `Restart=always` will respawn a daemon stopped
   only through its CLI. Temporarily inhibit that restart policy, preserving the unit and drop-ins.
   Use the daemon's own childless stop/admission fence so a new spawn cannot race a zero-session
   snapshot. Prove that exact daemon has exited before stopping its supervisor. Restore the existing
   restart policy after the upgrade. Never kill a running chat to make this check pass.
3. With normal administrator authorization, stop `boujot-isolator.service` and
   `boujot-isolator-sectest.service` if installed. A service restart discards live network relay handles;
   the daemon also loses model-token bindings when it restarts. Existing protected runtimes cannot
   supply fresh evidence after either restart.
4. Run the root installer with the existing owner and program paths. It refuses active or uncertain
   root/runtime units before changing installed files. It does not stop units for you. An expired sudo
   grant requires the normal attended administrator path.

```sh
sudo bash isolator/install/linux/install.sh \
  --owner USER \
  --binary "$PWD/isolator/target/release/boujot-isolator" \
  --boujot-package /absolute/stable/path/to/node_modules/@boujot/happy-coder \
  --node-root /absolute/stable/node-installation \
  --codex-dir /absolute/path/to/codex/standalone/current/bin \
  --claude /absolute/path/to/native/claude \
  --security-test "$PWD/isolator/tests/probe.sh" \
  --no-start
```

Use `--without-claude` if the machine does not run Claude. All program paths are explicit. For an
existing installation, the installer preserves its configuration, including mounts, limits, paths,
allowlist and network policy, and preserves existing unit files/drop-ins. Program-path arguments are
defaults for a new configuration; they do not rewrite an existing owner's paths. It validates staged
configurations with the candidate binary before replacing installed files. It never removes the
registry, conversation state, retirement records or credentials. Existing unit enablement is kept;
only new units are enabled. Without `--no-start`, it starts the previously stopped instances after
installation; it never performs a restart. An existing unit at a different installation path requires
an explicit administrator review instead of an automatic overwrite.

Stage the independently verified CLI tarball with the shipped helper before the cutover:

```sh
bash isolator/install/linux/stage-package.sh /absolute/verified-release.tgz /absolute/new-private-prefix
```

The helper scopes `umask 022` to npm, even when the maintenance shell uses `umask 077`. It keeps the
staging prefix private and checks the entire package, including dependencies and symlinks, for access
by isolated workers. Keep credentials, configuration backups and conversation state private. Do not
apply program permissions to their folders. On 24 October 2026 a staged install inherited `umask 077`:
the daemon's owner could read it, but every isolated worker failed with `MODULE_NOT_FOUND`.

While the daemon remains stopped, move the checked package into its established package path and
run `node isolator/install/linux/package-access.mjs /absolute/installed-package` again. The root
installer also checks the package mount in the effective configuration, including preserved mounts.
Start the root instances and check `hello` reports 0.5.0 and the expected file/process capabilities.
Before restarting the daemon, require a check through the **main** isolation service:

```sh
node isolator/install/linux/check-runtime-start.mjs /run/boujot-isolator.sock
```

This loads the installed CLI entry point under a real isolated identity. It supplies
no credential or bootstrap capability and expects the CLI's explicit unauthenticated-start refusal;
it sends no prompt or model request. A missing module, timeout or other error fails the check. It
stops and forgets only its own test runtime; the small diagnostic environment is retained. A CLI
version check as the owner, an active daemon or the separate security-test probe cannot replace it.
Then start the daemon through its existing supervisor and check its version, execution contract and
ordinary session readiness. Keep the old package/binary and private configuration backups for an
explicit rollback under the same childless conditions.

## Enable project operations separately

The new binary alone does not enable network isolation. An ordinary existing installation remains
ordinary unless the owner supplies an explicit reviewed policy. Provide a root-owned regular JSON
file, without group/other writes, containing exactly the network policy object:

```json
{
  "policyId": "boujot-project-operations-v1",
  "gateways": [
    { "id": "model_proxy", "port": 18001 },
    { "id": "happy_gateway", "port": 18002 }
  ]
}
```

Add `--network-policy /absolute/root-owned/policy.json` to the drained installation command. It changes
only the main configuration's `networkIsolation` and adds the exact `BOUJOT_MODEL_GATEWAY_TOKEN` name
to its environment allowlist. It adds no wildcard permission and does not copy a provider credential.
The security-test instance keeps its own configuration. Without this argument, an existing policy is
preserved; an existing policy missing the exact token name gains only that name.

Before enabling project-granted chats, provide the fixed Happy/model gateways, the private trusted
model-observer socket, daemon model settings and the Agent Plane machine's approved policy hash.
`hello.networkEvidenceVersion: 1` advertises an API; it is not live runtime evidence. Run and review the
actual kernel/network probes and admit a fresh runtime. Missing gateways, policy or model observation
must continue to refuse project operations. The executor, Vault project authority and independent
passkey origin have their own deployment and are not installed by this package.

See [the protocol and network proof](../docs/project-operations-network.md) and
[the isolation contract](../docs/isolation-service.md). On a disposable root Linux/systemd host:

```sh
node isolator/tests/network-suite.mjs isolator/target/release/boujot-isolator
```

The general file/process security suite uses the separately configured security-test service; follow
the arguments documented at the start of `isolator/tests/security-suite.mjs`. Do not run these probes
against active user chats.
