Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
88 changes: 88 additions & 0 deletions .github/workflows/linux-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Linux development image

on:
pull_request:
paths:
- 'packaging/**'
- 'build/build_iso.sh'
- 'phishell/**'
- 'phios/**'
- 'pyproject.toml'
- '.github/workflows/linux-image.yml'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: linux-image-${{ github.ref }}
cancel-in-progress: true

jobs:
live-image:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
persist-credentials: false
- name: Build an unsigned development image in isolated Arch Linux
run: |
set -euo pipefail
mkdir -p dist/linux
builder_image=$(python3 -c 'import json; print(json.load(open("packaging/linux/release.json"))["builder_image"])')
docker pull "$builder_image"
docker image inspect "$builder_image" > dist/linux/builder-image.json
docker run --rm --privileged \
-v "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE:ro" \
-v "$GITHUB_WORKSPACE/dist/linux:/artifacts" \
-w "$GITHUB_WORKSPACE" \
-e PHIOS_SOURCE_COMMIT="$(git rev-parse HEAD)" \
-e PHIOS_OUTPUT_DIR=/artifacts -e PHIOS_CI_SMOKE=1 \
"$builder_image" bash packaging/linux/build-linux.sh 2>&1 | tee dist/linux/build.log
- name: Qualify the exact ISO in a disposable UEFI VM
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y qemu-system-x86 ovmf python3-pil
if [[ -e /dev/kvm ]]; then
sudo chgrp "$(id -gn)" /dev/kvm
sudo chmod g+rw /dev/kvm
fi
python3 packaging/linux/tests/qemu_boot.py \
--iso dist/linux/phios-linux-0.1.0-alpha.1-x86_64.iso \
--source "$(cat dist/linux/source-commit.txt)" \
--output "$RUNNER_TEMP/phios-boot"
- name: Convert display evidence even when qualification fails
if: always()
run: |
if [[ -f "$RUNNER_TEMP/phios-boot/screen.ppm" ]]; then
/usr/bin/python3 -c 'from PIL import Image; from pathlib import Path; import os; [Image.open(p).save(p.with_suffix(".png")) for p in Path(os.environ["RUNNER_TEMP"] + "/phios-boot").glob("*.ppm")]'
fi
- name: Preserve candidate and qualification evidence
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: phios-linux-development-${{ github.run_id }}
path: |
dist/linux/
${{ runner.temp }}/phios-boot/*.log
${{ runner.temp }}/phios-boot/*.json
${{ runner.temp }}/phios-boot/*.png
if-no-files-found: warn
retention-days: 7
- name: Preserve reviewable logs and screenshot separately
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: phios-linux-evidence-${{ github.run_id }}
path: |
dist/linux/*.json
dist/linux/*.txt
dist/linux/*.log
dist/linux/SHA256SUMS
${{ runner.temp }}/phios-boot/*.log
${{ runner.temp }}/phios-boot/*.json
${{ runner.temp }}/phios-boot/*.png
if-no-files-found: warn
retention-days: 7
2 changes: 1 addition & 1 deletion .github/workflows/phishell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
node-version: "22"
package-manager-cache: false
- name: Install PhiShell dependencies
run: npm install --no-audit --no-fund
run: npm ci --no-audit --no-fund
- name: Test PhiShell contracts
run: npm test
- name: Exercise read-only Linux host probe
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ platform, memory/ledger system, and constrained agent runtime built around one r

The project is under active development and should be treated as **alpha software**.

The Python package release is separate from the Linux OS effort. The Linux target is an x86_64 UEFI Arch-based Wayfire/PhiShell development preview. Installation, whole-OS recovery, Secure Boot, hardware support and Linux desktop effects are not yet qualified. See [the OS release contract](docs/os/RELEASE_CONTRACT.md) and [implementation status](docs/os/IMPLEMENTATION_STATUS.md).

## What PhiOS is

PhiOS is designed for systems that can observe, reason, retrieve, plan, and act without
Expand Down
78 changes: 16 additions & 62 deletions build/build_iso.sh
Original file line number Diff line number Diff line change
@@ -1,63 +1,17 @@
#!/usr/bin/env bash
set -e

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PROFILE_DIR="$ROOT_DIR/build/archiso-profile"
DIST_DIR="$ROOT_DIR/dist"
WORK_DIR="$ROOT_DIR/build/work"
OUT_DIR="$ROOT_DIR/build/out"

VERSION="$(python - <<'PY'
from phios import __version__
print(__version__)
PY
)"
ISO_NAME="phios-v${VERSION}-x86_64.iso"

echo "[1/6] Validating mkarchiso availability"
if ! command -v mkarchiso >/dev/null 2>&1; then
echo "Error: mkarchiso not found. Install archiso first."
exit 1
fi

echo "[2/6] Preparing profile directories"
mkdir -p "$PROFILE_DIR/airootfs/etc/skel/.config/waybar" "$PROFILE_DIR/airootfs/usr/share/pixmaps" "$DIST_DIR"

echo "[3/6] Generating Wayfire/Waybar defaults"
python - <<'PY'
from pathlib import Path
from phios.desktop.waybar_config import WAYBAR_CSS, render_waybar_config
from phios.desktop.wayfire_config import WayfireConfigGenerator

profile = Path("build/archiso-profile/airootfs/etc/skel/.config")
profile.mkdir(parents=True, exist_ok=True)
WayfireConfigGenerator().generate(str(profile / "wayfire.ini"))
waybar = profile / "waybar"
waybar.mkdir(parents=True, exist_ok=True)
(waybar / "config.jsonc").write_text(render_waybar_config(), encoding="utf-8")
(waybar / "style.css").write_text(WAYBAR_CSS, encoding="utf-8")
PY

echo "[4/6] Writing default shell login bootstrap"
cat > "$PROFILE_DIR/airootfs/etc/skel/.bashrc" <<'BASHRC'
if command -v phi >/dev/null 2>&1; then
phi
fi
BASHRC

if [[ -f "$ROOT_DIR/build/assets/phios-splash.png" ]]; then
cp "$ROOT_DIR/build/assets/phios-splash.png" "$PROFILE_DIR/airootfs/usr/share/pixmaps/phios-splash.png" || true
fi

echo "[5/6] Building ISO via mkarchiso"
rm -rf "$WORK_DIR" "$OUT_DIR"
mkarchiso -v -w "$WORK_DIR" -o "$OUT_DIR" "$PROFILE_DIR"

echo "[6/6] Finalizing artifact"
FOUND_ISO="$(find "$OUT_DIR" -maxdepth 1 -name '*.iso' | head -n 1)"
if [[ -z "$FOUND_ISO" ]]; then
echo "Error: mkarchiso completed but no ISO found."
exit 1
fi
cp "$FOUND_ISO" "$DIST_DIR/$ISO_NAME"
echo "ISO ready: $DIST_DIR/$ISO_NAME"
set -euo pipefail
repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
command -v docker >/dev/null || { echo 'Docker is required for the isolated Arch image builder.' >&2; exit 1; }
command -v python3 >/dev/null || { echo 'Python 3 is required to read the release contract.' >&2; exit 1; }
git -C "$repo" diff --quiet HEAD -- phios phishell packaging build/build_iso.sh || { echo 'Commit candidate inputs before building an exact-source ISO.' >&2; exit 1; }
source_commit=$(git -C "$repo" rev-parse HEAD)
git_common=$(git -C "$repo" rev-parse --path-format=absolute --git-common-dir)
builder_image=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["builder_image"])' "$repo/packaging/linux/release.json")
mkdir -p "$repo/dist/linux"
docker pull "$builder_image"
docker image inspect "$builder_image" > "$repo/dist/linux/builder-image.json"
docker run --rm --privileged \
-v "$repo:$repo:ro" -v "$git_common:$git_common:ro" \
-v "$repo/dist/linux:/artifacts" -w "$repo" \
-e PHIOS_SOURCE_COMMIT="$source_commit" -e PHIOS_OUTPUT_DIR=/artifacts \
"$builder_image" bash packaging/linux/build-linux.sh
4 changes: 3 additions & 1 deletion docs/RELEASE_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ No API token is needed.

## 3) Triggering releases

- Automatic: push/merge to `main` (per workflow).
- Automatic: push a `v*` tag matching the Python package version (per workflow).
- Manual: use `workflow_dispatch` from Actions tab.

This workflow publishes Python wheels and source distributions, not an OS image. OS candidate tags use the separate `phios-linux-v` prefix and must not trigger PyPI publishing.

The pipeline runs tests, builds packages, publishes to PyPI via OIDC, generates release notes from `CHANGELOG.md`, and creates a GitHub Release.

## Security posture
Expand Down
67 changes: 67 additions & 0 deletions docs/os/BUILD_AND_QUALIFY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Build and qualify the Linux development preview

Use the `Linux development image` pull-request workflow. It builds in a pinned
x86_64 Arch container, downgrades/synchronizes to the fixed Arch repository
snapshot in `packaging/linux/release.json`, checks the Archiso package version,
and builds the Python and UI packages from a hashed archive of the exact source
commit. Arch repository packages require signatures; the two local development
packages are unsigned and must not be presented as a signed public OS release.
`npm ci` uses the committed lockfile. No floating git checkout is used as source.

The image profile is staged from the installed complete Archiso releng template
and keeps its UEFI and initramfs inputs. The staging step removes root autologin,
SSH, cloud-init and unrelated services. It selects a graphical session for the
non-root `phios` user, with no wheel membership. In this **volatile live preview**
the public login is `phios` / `phios`, and root is locked. Never reuse that login
for an installed system or place private data in this live image. The reserved
`phios-agent` account cannot read the operator home and runs no agent by default.

The browser keeps Chromium's sandbox. The compositor's autostart imports its
Wayland environment before starting `phios-session.target`. Transport, curiosity
projection, optional history, browser and Waybar have separate user services.
Session exit stops the target. Default state is `%h/.local/state/phios` with
umask 0077. History is not auto-enabled: an operator must create and review
`~/.config/phios/memory.json` before that reader starts. Windows GhostWalk and
the curiosity authority broker are not started in this Linux preview.

For a local build, from a committed source checkout on an x86_64 Docker host:

```sh
bash build/build_iso.sh
# Or, after reviewing the privileged container build:
phi build iso --yes
```

The source mount is read-only; the privileged build runs inside the container,
with only `dist/linux` writable. It changes that container's pacman mirror,
never the host's mirror. The build must fail with a nonzero exit status if an
input, package install, UI build, profile assembly or mkarchiso step fails.
Do not run `packaging/linux/build-linux.sh` on a personal Arch installation:
it is the internal root-container entrypoint and rewrites its builder environment.

## Evidence

The Actions artifact includes the ISO, local packages, source archive/hash,
source commit, fixed release inputs, builder image identity, builder and image
package inventories, complete builder/Archiso logs, license history and SHA256SUMS. The CI-only
qualification fixture waits for the non-root compositor and browser, checks the
built page, native package observation and unified system state, verifies private state permissions,
and confirms all three approval HTTP routes return 403. QEMU runs with no
network and no target disk, using x64 UEFI firmware. The harness uses KVM when
the runner exposes it and records the selected accelerator; software TCG has
a longer explicit deadline. Wayfire permits software GLES rendering for this
virtual display, and its startup log remains in the private state directory.
The exact source marker,
ISO hash, VM command, serial log and screen capture are preserved, including a
display capture on failed qualification when QEMU is still running. The fixture
also kills the observer to verify supervised restart, ends the compositor to
verify service cleanup, and restarts greetd to prove a fresh graphical login.
The harness then resets the VM and requires the complete fixture on a second,
distinct kernel boot ID. Both desktop captures are preserved. This fixture
is omitted from normal locally built previews.

A fixture pass is evidence for the checks it performs. Review the screenshot
and session behavior. It does not prove installation, persisted receipts,
crash recovery, whole-OS updates, hardware compatibility or a Linux effect
executor. Those remain explicit gates in RELEASE_CONTRACT.md. CI never tags,
signs, publishes or automatically promotes this candidate.
12 changes: 8 additions & 4 deletions docs/os/IMPLEMENTATION_STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ proof that PhiOS is a completed OS. Preserve the repository AGENTS.md rules.
| Requirement | Candidate change | Evidence / remaining gate |
| --- | --- | --- |
| R1: HTTP callers cannot mint operator authority | Decision, binding and lease POSTs held; explicit terminal review | HTTP rejection, cancellation and stale-review tests; same-user isolation and Windows ACL evidence remain required |
| R2: Freeze a truthful Linux release contract | Pending | x86_64 UEFI, Arch, Wayfire, PhiShell, distinct OS version |
| R3: Install current Python and UI packages | Pending | Locked inputs, pacman inventory, installed smoke checks |
| R4: Real non-root graphical login and supervised services | Pending | Session start, stop, reboot and no elevated browser |
| R5: Produce and UEFI boot exact live ISO | Pending | Archiso build and QEMU evidence, graphical qualification |
| R2: Freeze a truthful Linux release contract | Candidate contract and generated metadata corrected | docs/os/RELEASE_CONTRACT.md and packaging/linux/release.json; Python and OS release tracks separate |
| R3: Install current Python and UI packages | Candidate PKGBUILDs, JS lock and native pacman adapter | CI must build/install exact source packages; fixed Arch snapshot and signed upstream inputs |
| R4: Real non-root graphical login and supervised services | Candidate Wayfire session and user service target | Live/VM qualification pending; no privileged browser or agent auto-start |
| R5: Produce and UEFI boot exact live ISO | Candidate isolated Archiso/QEMU workflow | Exact ISO/source/hash/serial/screenshot evidence required; no ready claim until observed |
| R6: Recover durable private state | Pending | Concurrent writes, crash recovery, backup/restore, migrations |
| R7: Explicit blank-disk installation | Pending | Disposable VM install, boot without ISO, persistence |
| R8: Whole-OS update and recovery | Pending | Signed artifacts, failed update recovery; app rollback is insufficient |
Expand All @@ -35,3 +35,7 @@ register with actual artifact identities and evidence, rather than readiness
percentages or forecast dates.

Validation: 73 focused Python tests passed; Ruff and mypy (301 source files) passed. PhiShell production build and 12 targeted HTTP boundary/proposal tests passed. Full PhiShell TypeScript suite passed; three existing Node integration tests fail on this host due to restricted network enumeration and absent systemd, as recorded in the audit. GitHub CI remains the required full-platform check.

## Linux foundation handoff

The candidate implements release-contract, package, session and live-image build milestones. 85 focused Python release/desktop/profile tests, lint and types pass locally. PhiShell build and the Arch inventory/security transport tests pass. The CI image workflow must provide the installed-package and actual UEFI boot evidence before these milestones are called qualified. Root autologin and unrelated releng services are removed. The CI-only live qualification fixture is excluded from normal local previews. Installation, durable crash recovery, OS update/rollback, Linux effect execution, hardware beta and signed public release remain held; no code or evidence in this milestone grants those claims.
51 changes: 51 additions & 0 deletions docs/os/RELEASE_CONTRACT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# PhiOS Linux release contract

Target: **0.1.0-alpha.1 development preview**, x86_64, x64 UEFI, Arch Linux,
Wayfire and PhiShell. Linux supplies the kernel. Private PhiKernel/TIEKAT
implementation is not part of this image or a prerequisite to boot it.
`packaging/linux/release.json` supplies machine-readable candidate identity.
Python package versions and OS versions are independent. OS tags start with
`phios-linux-v`; the existing `v*` workflow publishes Python artifacts only.

## Included preview

- Current PhiOS Python code and built PhiShell, installed as pacman packages.
- Local observation of host, services, processes, devices and native packages.
- A non-root Wayfire session, Chromium application window, Waybar and terminal.
- Supervised user services with bounded loopback ports and private state umask.
- Optional governed history when an operator supplies an enabled memory config.
- Curiosity projection access, with consequential persistence approval held.

The default preview does not run an AI model or an autonomous agent. Ollama,
vector memory, OCR, Windows UI Automation/GhostWalk and hardware bridges are
optional or platform-specific. Missing capabilities must show unavailable.
No Linux desktop effect executor or lease issuance is advertised. The browser
cannot mint operator approvals; see OPERATOR_AUTHORIZATION.md.

## Deliberately unqualified capabilities

This preview is a volatile live image. It has no qualified disk installer,
persistent installed-system recovery, whole-OS rollback, Secure Boot or BIOS
support. No hardware compatibility claim follows from a VM boot. Agent
isolation requires separate OS principals and a verified restricted broker;
an operator-owned shell or pseudo-TTY is not human authentication.

## Acceptance gates

| Gate | Required evidence |
| --- | --- |
| Candidate packages | Source commit/archive hash, JS lock, signed Arch snapshot, installed wheel/entrypoints and UI smoke |
| Live boot | Exact ISO hash, UEFI VM serial log, non-root compositor/browser, local HTTP observations, screenshot |
| Session lifecycle | Login, sidecar failure/restart, logout stopping services, reboot, no sandbox bypass |
| Durable state | Private permissions, concurrent writers, abrupt termination, verified backup/restore and schema migration |
| Installed system | Explicit blank-disk identity/confirmation, disposable VM install, no-ISO reboot and persisted receipts |
| Updates/recovery | Verified signed update, interrupted update, recovery boot and restore; application rollback alone does not satisfy this |
| Linux workflow | Explicit operator decision, exact binding, single-use lease, Linux effect and independent post-effect verification |
| Hardware beta | Named machines, firmware/GPU/network/input/audio/storage results and recovery evidence |
| Public OS release | All applicable gates passed for the exact artifact; SHA256SUMS, signature, SBOM, third-party licenses/source provenance, notes and maintainer decision |

CI artifacts are unsigned **test candidates**. A successful build or boot does
not automatically promote an adapter, establish readiness or publish a release.
Maintain historical documents and licensing provenance rather than rewriting
past releases. PhiOS source is MIT; Linux and bundled packages retain their own
licenses. Full distribution source/license compliance remains a release gate.
26 changes: 26 additions & 0 deletions packaging/arch/phios/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Build only from the local, hashed archive made by build-linux.sh.
pkgname=phios
pkgver=1.0.0
pkgrel=1
pkgdesc='PhiOS operator shell, verification spine and governed local runtime'
arch=('any')
url='https://github.com/MichaelWave369/PhiOS'
license=('MIT')
depends=('python' 'python-psutil' 'python-mcp>=1.26' 'python-mcp<2')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
source=('phios-source.tar.gz')
sha256sums=("${PHIOS_SOURCE_SHA256:?hashed source archive required}")

build() {
cd "$srcdir/phios-source"
python -m build --wheel --no-isolation
}

package() {
cd "$srcdir/phios-source"
python -m installer --destdir="$pkgdir" dist/*.whl
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/phios/LICENSE"
install -Dm644 LICENSE_HISTORY.md "$pkgdir/usr/share/doc/phios/LICENSE_HISTORY.md"
install -Dm644 packaging/linux/release.json "$pkgdir/usr/share/phios/linux-release.json"
install -Dm644 PHIOS_SOURCE_COMMIT "$pkgdir/usr/share/phios/source-commit"
}
Loading
Loading