From 7ec6f7efcd1de6e04f7ebed83704f836af5261a6 Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Wed, 30 Sep 2026 13:45:39 -0700 Subject: [PATCH 1/8] feat: add pinned Arch Linux preview packages, session and UEFI image qualification --- .github/workflows/linux-image.yml | 64 + .github/workflows/phishell.yml | 2 +- README.md | 2 + build/build_iso.sh | 78 +- docs/RELEASE_SETUP.md | 4 +- docs/os/BUILD_AND_QUALIFY.md | 58 + docs/os/IMPLEMENTATION_STATUS.md | 12 +- docs/os/RELEASE_CONTRACT.md | 51 + packaging/arch/phios/PKGBUILD | 26 + packaging/arch/phishell/PKGBUILD | 35 + packaging/linux/build-linux.sh | 57 + packaging/linux/packages.x86_64 | 14 + packaging/linux/prepare_profile.py | 143 ++ packaging/linux/release.json | 20 + packaging/linux/session/phios-browser.service | 14 + .../session/phios-curiosity-reader.service | 18 + .../session/phios-history-reader.service | 19 + .../linux/session/phios-observer.service | 19 + packaging/linux/session/phios-open-shell | 14 + packaging/linux/session/phios-session | 18 + packaging/linux/session/phios-session-ready | 5 + packaging/linux/session/phios-session.target | 3 + packaging/linux/session/phios-waybar.service | 12 + packaging/linux/session/phios.desktop | 6 + packaging/linux/session/waybar.json | 9 + packaging/linux/session/wayfire.ini | 24 + packaging/linux/tests/live-smoke.sh | 29 + packaging/linux/tests/qemu_boot.py | 95 + phios/core/launch_artifacts.py | 20 +- phios/core/living_spec.py | 4 +- phios/desktop/install.py | 10 +- phios/desktop/phi_tray.py | 4 +- phios/desktop/sovereignty_indicator.py | 8 +- phios/desktop/wayfire_config.py | 68 +- phios/shell/phi_commands.py | 17 +- phishell/host/packageObservationContract.mjs | 3 +- phishell/host/packageObserver.mjs | 188 +- phishell/host/packageObserver.test.mjs | 32 + phishell/package-lock.json | 1839 +++++++++++++++++ phishell/src/shell/packageObservation.ts | 8 +- tests/test_linux_release_foundation.py | 80 + tests/test_v05_desktop.py | 12 +- tests/test_v10_launch.py | 2 +- 43 files changed, 2886 insertions(+), 260 deletions(-) create mode 100644 .github/workflows/linux-image.yml create mode 100644 docs/os/BUILD_AND_QUALIFY.md create mode 100644 docs/os/RELEASE_CONTRACT.md create mode 100644 packaging/arch/phios/PKGBUILD create mode 100644 packaging/arch/phishell/PKGBUILD create mode 100755 packaging/linux/build-linux.sh create mode 100644 packaging/linux/packages.x86_64 create mode 100644 packaging/linux/prepare_profile.py create mode 100644 packaging/linux/release.json create mode 100644 packaging/linux/session/phios-browser.service create mode 100644 packaging/linux/session/phios-curiosity-reader.service create mode 100644 packaging/linux/session/phios-history-reader.service create mode 100644 packaging/linux/session/phios-observer.service create mode 100755 packaging/linux/session/phios-open-shell create mode 100755 packaging/linux/session/phios-session create mode 100755 packaging/linux/session/phios-session-ready create mode 100644 packaging/linux/session/phios-session.target create mode 100644 packaging/linux/session/phios-waybar.service create mode 100644 packaging/linux/session/phios.desktop create mode 100644 packaging/linux/session/waybar.json create mode 100644 packaging/linux/session/wayfire.ini create mode 100755 packaging/linux/tests/live-smoke.sh create mode 100644 packaging/linux/tests/qemu_boot.py create mode 100644 phishell/package-lock.json create mode 100644 tests/test_linux_release_foundation.py diff --git a/.github/workflows/linux-image.yml b/.github/workflows/linux-image.yml new file mode 100644 index 00000000..8b0484f9 --- /dev/null +++ b/.github/workflows/linux-image.yml @@ -0,0 +1,64 @@ +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 + - 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 + 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" + /usr/bin/python3 -c 'from PIL import Image; import os; Image.open(os.environ["RUNNER_TEMP"] + "/phios-boot/screen.ppm").save(os.environ["RUNNER_TEMP"] + "/phios-boot/screen.png")' + - 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 diff --git a/.github/workflows/phishell.yml b/.github/workflows/phishell.yml index 7e54668f..d7b258b9 100644 --- a/.github/workflows/phishell.yml +++ b/.github/workflows/phishell.yml @@ -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 diff --git a/README.md b/README.md index 8d48a43c..251a0731 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/build/build_iso.sh b/build/build_iso.sh index c36601de..38ef6b55 100755 --- a/build/build_iso.sh +++ b/build/build_iso.sh @@ -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 diff --git a/docs/RELEASE_SETUP.md b/docs/RELEASE_SETUP.md index 331b50f3..8dcf1108 100644 --- a/docs/RELEASE_SETUP.md +++ b/docs/RELEASE_SETUP.md @@ -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 diff --git a/docs/os/BUILD_AND_QUALIFY.md b/docs/os/BUILD_AND_QUALIFY.md new file mode 100644 index 00000000..2b345d89 --- /dev/null +++ b/docs/os/BUILD_AND_QUALIFY.md @@ -0,0 +1,58 @@ +# 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, pacman log, license history and SHA256SUMS. The CI-only +qualification fixture waits for the non-root compositor and browser, checks the +built page and native package observation, 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 exact source marker, +ISO hash, VM command, serial log and screen capture 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. diff --git a/docs/os/IMPLEMENTATION_STATUS.md b/docs/os/IMPLEMENTATION_STATUS.md index 41132e88..62644044 100644 --- a/docs/os/IMPLEMENTATION_STATUS.md +++ b/docs/os/IMPLEMENTATION_STATUS.md @@ -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 | @@ -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. diff --git a/docs/os/RELEASE_CONTRACT.md b/docs/os/RELEASE_CONTRACT.md new file mode 100644 index 00000000..213bdc64 --- /dev/null +++ b/docs/os/RELEASE_CONTRACT.md @@ -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. diff --git a/packaging/arch/phios/PKGBUILD b/packaging/arch/phios/PKGBUILD new file mode 100644 index 00000000..bb33e593 --- /dev/null +++ b/packaging/arch/phios/PKGBUILD @@ -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" +} diff --git a/packaging/arch/phishell/PKGBUILD b/packaging/arch/phishell/PKGBUILD new file mode 100644 index 00000000..c7ad6d2b --- /dev/null +++ b/packaging/arch/phishell/PKGBUILD @@ -0,0 +1,35 @@ +pkgname=phishell +pkgver=0.16.0 +pkgrel=1 +pkgdesc='PhiShell browser interface and local observation transport' +arch=('any') +url='https://github.com/MichaelWave369/PhiOS' +license=('MIT') +depends=('nodejs' 'phios' 'wayfire' 'waybar' 'wofi' 'foot' 'chromium' 'ttf-dejavu') +makedepends=('npm') +source=('phios-source.tar.gz') +sha256sums=("${PHIOS_SOURCE_SHA256:?hashed source archive required}") + +build() { + cd "$srcdir/phios-source/phishell" + npm ci --no-audit --no-fund + npm run build + npm prune --omit=dev --no-audit --no-fund +} + +package() { + cd "$srcdir/phios-source" + install -dm755 "$pkgdir/usr/lib/phishell" + cp -a phishell/dist phishell/host phishell/node_modules phishell/package.json "$pkgdir/usr/lib/phishell/" + find "$pkgdir/usr/lib/phishell" -name '*.test.mjs' -delete + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/phishell/LICENSE" + install -Dm755 packaging/linux/session/phios-session "$pkgdir/usr/bin/phios-session" + install -Dm755 packaging/linux/session/phios-open-shell "$pkgdir/usr/bin/phios-open-shell" + install -Dm755 packaging/linux/session/phios-session-ready "$pkgdir/usr/lib/phishell/session-ready" + install -Dm644 packaging/linux/session/phios.desktop "$pkgdir/usr/share/wayland-sessions/phios.desktop" + for unit in packaging/linux/session/*.service packaging/linux/session/*.target; do + install -Dm644 "$unit" "$pkgdir/usr/lib/systemd/user/${unit##*/}" + done + install -Dm644 packaging/linux/session/wayfire.ini "$pkgdir/etc/xdg/phios/wayfire.ini" + install -Dm644 packaging/linux/session/waybar.json "$pkgdir/etc/xdg/phios/waybar.json" +} diff --git a/packaging/linux/build-linux.sh b/packaging/linux/build-linux.sh new file mode 100755 index 00000000..398b465c --- /dev/null +++ b/packaging/linux/build-linux.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +set -euo pipefail +repo=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) +if [[ $EUID -ne 0 || $(uname -m) != x86_64 ]]; then + echo 'The isolated image builder requires an x86_64 Arch Linux root environment.' >&2 + exit 1 +fi +snapshot=$(sed -n 's/.*"arch_snapshot": "\([0-9/]\{10\}\)".*/\1/p' "$repo/packaging/linux/release.json") +expected_archiso=$(sed -n 's/.*"archiso_version": "\([0-9-]\+\)".*/\1/p' "$repo/packaging/linux/release.json") +[[ $snapshot =~ ^[0-9]{4}/[0-9]{2}/[0-9]{2}$ && $expected_archiso =~ ^[0-9]+-[0-9]+$ ]] || exit 1 +cat > /etc/pacman.d/mirrorlist <&2; exit 1; } +[[ -n ${PHIOS_SOURCE_COMMIT:-} ]] || { echo 'PHIOS_SOURCE_COMMIT is required.' >&2; exit 1; } +[[ $(git -c safe.directory="$repo" -C "$repo" rev-parse HEAD) == "$PHIOS_SOURCE_COMMIT" ]] || { echo 'Source commit mismatch.' >&2; exit 1; } +export SOURCE_DATE_EPOCH +SOURCE_DATE_EPOCH=$(git -c safe.directory="$repo" -C "$repo" show -s --format=%ct HEAD) +work=$(mktemp -d /tmp/phios-build.XXXXXXXX) +output="${PHIOS_OUTPUT_DIR:-$repo/dist/linux}" +mkdir -p "$output" "$work/source" "$work/packages" +git -c safe.directory="$repo" -C "$repo" archive --format=tar --prefix=phios-source/ HEAD | tar -xf - -C "$work/source" +printf '%s\n' "$PHIOS_SOURCE_COMMIT" > "$work/source/phios-source/PHIOS_SOURCE_COMMIT" +tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" --owner=0 --group=0 --numeric-owner --use-compress-program='gzip -n' -cf "$work/phios-source.tar.gz" -C "$work/source" phios-source +export PHIOS_SOURCE_SHA256 +PHIOS_SOURCE_SHA256=$(sha256sum "$work/phios-source.tar.gz" | cut -d' ' -f1) +id phios-build &>/dev/null || useradd -m phios-build +chmod 755 "$work" +for package in phios phishell; do + mkdir "$work/$package" + cp "$repo/packaging/arch/$package/PKGBUILD" "$work/$package/" + cp "$work/phios-source.tar.gz" "$work/$package/" + chown -R phios-build:phios-build "$work/$package" + runuser -u phios-build -- env PHIOS_SOURCE_SHA256="$PHIOS_SOURCE_SHA256" SOURCE_DATE_EPOCH="$SOURCE_DATE_EPOCH" bash -c 'cd "$1"; makepkg --noconfirm --cleanbuild' _ "$work/$package" + cp "$work/$package/"*.pkg.tar.zst "$work/packages/" + pacman -U --noconfirm "$work/$package/"*.pkg.tar.zst +done +(cd /tmp; python -c 'import phios, phios.mcp.server, phios.ghostwalk_operator; assert phios.__file__.startswith("/usr/lib/"); print(phios.__version__)'; phi --version; phi-operator --help) +node "$repo/phishell/host/packageObserver.mjs" --require-native +repo-add "$work/packages/phios-local.db.tar.gz" "$work/packages/"*.pkg.tar.zst +smoke_args=() +[[ ${PHIOS_CI_SMOKE:-0} == 1 ]] && smoke_args+=(--smoke) +python "$repo/packaging/linux/prepare_profile.py" --upstream /usr/share/archiso/configs/releng --destination "$work/profile" --repo "$repo" --package-repo "$work/packages" "${smoke_args[@]}" +mkarchiso -v -w "$work/archiso-work" -o "$output" "$work/profile" +cp "$work/packages/"*.pkg.tar.zst "$output/" +cp "$work/phios-source.tar.gz" "$output/" +cp "$repo/packaging/linux/release.json" "$output/" +pacman -Q > "$output/builder-packages.txt" +pacman --root "$work/archiso-work/x86_64/airootfs" -Q > "$output/image-packages.txt" +printf '%s\n' "$PHIOS_SOURCE_COMMIT" > "$output/source-commit.txt" +printf '%s\n' "$PHIOS_SOURCE_SHA256" > "$output/source-archive-sha256.txt" +cp "$work/archiso-work/x86_64/airootfs/var/log/pacman.log" "$output/image-pacman.log" +cp "$repo/LICENSE_HISTORY.md" "$output/LICENSE_HISTORY.md" +(cd "$output"; sha256sum ./*.iso ./*.pkg.tar.zst ./*.tar.gz > SHA256SUMS) +echo "Unsigned development candidate and provenance: $output" diff --git a/packaging/linux/packages.x86_64 b/packaging/linux/packages.x86_64 new file mode 100644 index 00000000..f33abfe2 --- /dev/null +++ b/packaging/linux/packages.x86_64 @@ -0,0 +1,14 @@ +base +linux +linux-firmware +mkinitcpio +mkinitcpio-archiso +systemd +systemd-sysvcompat +mesa +greetd +greetd-tuigreet +iwd +curl +phios +phishell diff --git a/packaging/linux/prepare_profile.py b/packaging/linux/prepare_profile.py new file mode 100644 index 00000000..4585bae7 --- /dev/null +++ b/packaging/linux/prepare_profile.py @@ -0,0 +1,143 @@ +"""Assemble an isolated Archiso 91 profile; never modify the upstream template.""" +from __future__ import annotations + +import argparse +import json +import shutil +from pathlib import Path + + +def prepare(upstream: Path, destination: Path, repo: Path, package_repo: Path, *, smoke: bool) -> None: + release = json.loads((repo / "packaging/linux/release.json").read_text()) + required = ["profiledef.sh", "efiboot/loader/entries/01-archiso-linux.conf", + "airootfs/etc/mkinitcpio.conf.d/archiso.conf"] + for name in required: + if not (upstream / name).is_file(): + raise ValueError(f"complete Archiso releng template required: {name}") + if destination.exists(): + raise ValueError("profile destination must be new; refusing to overwrite an existing build") + shutil.copytree(upstream, destination, symlinks=True) + # Discard root autologin, ssh, cloud-init and unrelated releng customization. + shutil.rmtree(destination / "airootfs") + root = destination / "airootfs" + + def write(name: str, content: str) -> None: + path = root / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(content) + + write("etc/mkinitcpio.conf.d/archiso.conf", (upstream / required[2]).read_text()) + snapshot = release["arch_snapshot"] + pacman = f"""[options] +Architecture = x86_64 +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional +CheckSpace +ParallelDownloads = 5 +[core] +Server = https://archive.archlinux.org/repos/{snapshot}/$repo/os/$arch +[extra] +Server = https://archive.archlinux.org/repos/{snapshot}/$repo/os/$arch +[phios-local] +SigLevel = Optional TrustAll +Server = file://{package_repo.resolve()} +""" + (destination / "pacman.conf").write_text(pacman) + shutil.copyfile(repo / "packaging/linux/packages.x86_64", destination / "packages.x86_64") + version = release["os_version"] + (destination / "profiledef.sh").write_text(f"""#!/usr/bin/env bash +# Built on the signed Archiso {release['archiso_version']} releng template. +iso_name="phios-linux" +iso_label="PHIOS_PREVIEW" +iso_publisher="PHI369 Labs / Parallax" +iso_application="PhiOS Linux development preview" +iso_version="{version}" +install_dir="arch" +arch="x86_64" +buildmodes=('iso') +bootmodes=('uefi.systemd-boot') +pacman_conf="pacman.conf" +airootfs_image_type="squashfs" +airootfs_image_tool_options=('-comp' 'zstd' '-b' '1M') +file_permissions=( + ["/usr/local/bin/phios-live-setup"]="0:0:755" + ["/usr/local/bin/phios-live-smoke"]="0:0:755" +) +""" if smoke else f"""#!/usr/bin/env bash +iso_name="phios-linux" +iso_label="PHIOS_PREVIEW" +iso_publisher="PHI369 Labs / Parallax" +iso_application="PhiOS Linux development preview" +iso_version="{version}" +install_dir="arch" +arch="x86_64" +buildmodes=('iso') +bootmodes=('uefi.systemd-boot') +pacman_conf="pacman.conf" +airootfs_image_type="squashfs" +airootfs_image_tool_options=('-comp' 'zstd' '-b' '1M') +file_permissions=(["/usr/local/bin/phios-live-setup"]="0:0:755") +""") + entries = destination / "efiboot/loader/entries" + for path in entries.iterdir(): + if path.name != "01-archiso-linux.conf": + path.unlink() + entry = entries / "01-archiso-linux.conf" + entry.write_text(entry.read_text().replace("Arch Linux", "PhiOS development preview") + + "\n# Console logs are preserved by the qualification harness.\n") + # Keep the upstream identifiers/placeholders needed by mkarchiso. + lines = entry.read_text().splitlines() + entry.write_text("\n".join(line + " console=tty0 console=ttyS0,115200" if line.startswith("options ") + else line for line in lines) + "\n") + (destination / "efiboot/loader/loader.conf").write_text("default 01-archiso-linux.conf\ntimeout 1\n") + write("etc/hostname", "phios-live\n") + write("etc/locale.conf", "LANG=C.UTF-8\n") + write("etc/sysusers.d/phios-live.conf", 'u phios 1000 "PhiOS Live" /home/phios /bin/bash\n' + 'u phios-agent 1001 "Reserved isolated agent" /var/lib/phios-agent /usr/bin/nologin\n' + 'u phios-greeter - "PhiOS Greeter" /var/lib/phios-greeter /usr/bin/nologin\n') + write("etc/tmpfiles.d/phios-live.conf", "d /home/phios 0700 phios phios -\n" + "d /home/phios/.local 0700 phios phios -\n" + "d /home/phios/.local/state 0700 phios phios -\n" + "d /home/phios/.local/state/phios 0700 phios phios -\n" + "d /var/lib/phios-agent 0700 phios-agent phios-agent -\n") + write("etc/greetd/config.toml", '[terminal]\nvt = 1\n[default_session]\n' + 'command = "tuigreet --cmd phios-session"\nuser = "phios-greeter"\n' + '[initial_session]\ncommand = "phios-session"\nuser = "phios"\n') + write("etc/systemd/system/greetd.service.d/phios.conf", "[Unit]\n" + "Requires=phios-live-setup.service\nAfter=phios-live-setup.service\n") + write("etc/systemd/system/phios-live-setup.service", "[Unit]\n" + "Description=Configure the volatile PhiOS live session\nAfter=systemd-tmpfiles-setup.service\n" + "[Service]\nType=oneshot\nExecStart=/usr/local/bin/phios-live-setup\nRemainAfterExit=yes\n") + write("usr/local/bin/phios-live-setup", "#!/usr/bin/env bash\nset -euo pipefail\n" + "systemd-sysusers\nsystemd-tmpfiles --create /etc/tmpfiles.d/phios-live.conf\n" + "printf 'phios:phios\\n' | chpasswd\nusermod --lock root\n" + "install -m644 /usr/share/phios/preview-os-release /etc/os-release\n") + write("usr/share/phios/preview-os-release", f'NAME="PhiOS Linux Preview"\nID=phios\nID_LIKE=arch\n' + f'PRETTY_NAME="PhiOS Linux {version} Development Preview"\nVERSION_ID="{version}"\n') + write("etc/systemd/network/20-wired.network", "[Match]\nName=en* eth*\n[Network]\nDHCP=yes\n") + wants = root / "etc/systemd/system/multi-user.target.wants" + wants.mkdir(parents=True) + for name in ["systemd-networkd.service", "systemd-resolved.service", "iwd.service"]: + (wants / name).symlink_to(f"/usr/lib/systemd/system/{name}") + graphical = root / "etc/systemd/system/graphical.target.wants" + graphical.mkdir(parents=True) + (graphical / "greetd.service").symlink_to("/usr/lib/systemd/system/greetd.service") + (root / "etc/systemd/system/default.target").symlink_to("/usr/lib/systemd/system/graphical.target") + (root / "etc/resolv.conf").symlink_to("/run/systemd/resolve/stub-resolv.conf") + if smoke: + write("usr/local/bin/phios-live-smoke", (repo / "packaging/linux/tests/live-smoke.sh").read_text()) + write("etc/systemd/system/phios-live-smoke.service", "[Unit]\nDescription=CI live-image qualification fixture\n" + "After=greetd.service\n[Service]\nType=oneshot\nExecStart=/usr/local/bin/phios-live-smoke\n" + "TimeoutStartSec=480\nStandardOutput=tty\nStandardError=tty\nTTYPath=/dev/ttyS0\n") + (wants / "phios-live-smoke.service").symlink_to("/etc/systemd/system/phios-live-smoke.service") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--upstream", type=Path, required=True) + parser.add_argument("--destination", type=Path, required=True) + parser.add_argument("--repo", type=Path, required=True) + parser.add_argument("--package-repo", type=Path, required=True) + parser.add_argument("--smoke", action="store_true") + args = parser.parse_args() + prepare(args.upstream, args.destination, args.repo, args.package_repo, smoke=args.smoke) diff --git a/packaging/linux/release.json b/packaging/linux/release.json new file mode 100644 index 00000000..a967fe62 --- /dev/null +++ b/packaging/linux/release.json @@ -0,0 +1,20 @@ +{ + "schema_version": "phios.linux-release.v1", + "os_version": "0.1.0-alpha.1", + "stage": "development-preview", + "architecture": "x86_64", + "firmware": "UEFI x64", + "secure_boot": false, + "base": "Arch Linux", + "arch_snapshot": "2026/09/30", + "archiso_version": "91-1", + "archiso_source_commit": "723da192226e1c9d5def9168f13332793c82a85e", + "desktop": "Wayfire", + "interface": "PhiShell", + "installer_available": false, + "whole_os_rollback_available": false, + "linux_desktop_effects_available": false, + "ai_required": false, + "release_tag_prefix": "phios-linux-v", + "builder_image": "archlinux:base@sha256:b21322c663be387c0ed9cbc7bbbfe18e41633ad4e7b7c77cfad45f128be20040" +} diff --git a/packaging/linux/session/phios-browser.service b/packaging/linux/session/phios-browser.service new file mode 100644 index 00000000..b0b3a37c --- /dev/null +++ b/packaging/linux/session/phios-browser.service @@ -0,0 +1,14 @@ +[Unit] +Description=PhiShell Wayland browser +PartOf=phios-session.target +After=phios-observer.service +Wants=phios-observer.service + +[Service] +ExecStart=/usr/bin/phios-open-shell +Restart=on-failure +RestartSec=3 +UMask=0077 + +[Install] +WantedBy=phios-session.target diff --git a/packaging/linux/session/phios-curiosity-reader.service b/packaging/linux/session/phios-curiosity-reader.service new file mode 100644 index 00000000..70448127 --- /dev/null +++ b/packaging/linux/session/phios-curiosity-reader.service @@ -0,0 +1,18 @@ +[Unit] +Description=PhiOS read-only curiosity projection +PartOf=phios-session.target + +[Service] +ExecStart=/usr/bin/python -m phios.curiosity_projection_server --store-root %h/.local/state/phios/curiosity +Restart=on-failure +RestartSec=2 +UMask=0077 +NoNewPrivileges=yes +ProtectSystem=strict +ProtectHome=read-only +PrivateTmp=yes +ReadWritePaths=%h/.local/state/phios +RestrictAddressFamilies=AF_UNIX AF_INET + +[Install] +WantedBy=phios-session.target diff --git a/packaging/linux/session/phios-history-reader.service b/packaging/linux/session/phios-history-reader.service new file mode 100644 index 00000000..2bf767e5 --- /dev/null +++ b/packaging/linux/session/phios-history-reader.service @@ -0,0 +1,19 @@ +[Unit] +Description=PhiOS governed history projection (operator configured) +PartOf=phios-session.target +ConditionPathExists=%h/.config/phios/memory.json + +[Service] +ExecStart=/usr/bin/phi-memory --config %h/.config/phios/memory.json --state-root %h/.local/state/phios --allow memory.read serve-system-history +Restart=on-failure +RestartSec=5 +UMask=0077 +NoNewPrivileges=yes +ProtectSystem=strict +ProtectHome=read-only +PrivateTmp=yes +ReadWritePaths=%h/.local/state/phios +RestrictAddressFamilies=AF_UNIX AF_INET + +[Install] +WantedBy=phios-session.target diff --git a/packaging/linux/session/phios-observer.service b/packaging/linux/session/phios-observer.service new file mode 100644 index 00000000..5d7819cd --- /dev/null +++ b/packaging/linux/session/phios-observer.service @@ -0,0 +1,19 @@ +[Unit] +Description=PhiShell local observation transport +PartOf=phios-session.target + +[Service] +ExecStart=/usr/bin/node /usr/lib/phishell/host/localTransport.mjs +Restart=on-failure +RestartSec=2 +UMask=0077 +NoNewPrivileges=yes +ProtectSystem=strict +ProtectHome=read-only +PrivateTmp=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK +ReadWritePaths=%h/.local/state/phios +Environment=PHIOS_STATE_ROOT=%h/.local/state/phios + +[Install] +WantedBy=phios-session.target diff --git a/packaging/linux/session/phios-open-shell b/packaging/linux/session/phios-open-shell new file mode 100755 index 00000000..85af8d01 --- /dev/null +++ b/packaging/linux/session/phios-open-shell @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail +if [[ $EUID -eq 0 ]]; then + echo 'Refusing to run the PhiShell browser as root.' >&2 + exit 1 +fi +for attempt in {1..60}; do + if /usr/bin/node -e 'fetch("http://127.0.0.1:3969/api/v1/health").then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))'; then + exec chromium --ozone-platform=wayland --app=http://127.0.0.1:3969/ --no-first-run --disable-sync --disable-background-networking + fi + sleep 1 +done +echo 'PhiShell transport did not become healthy; see journalctl --user -u phios-observer.' >&2 +exit 1 diff --git a/packaging/linux/session/phios-session b/packaging/linux/session/phios-session new file mode 100755 index 00000000..94499732 --- /dev/null +++ b/packaging/linux/session/phios-session @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail +if [[ $EUID -eq 0 ]]; then + echo 'PhiOS graphical sessions must run as a non-root user.' >&2 + exit 1 +fi +umask 077 +export XDG_CURRENT_DESKTOP=Wayfire +export XDG_SESSION_DESKTOP=phios +export XDG_SESSION_TYPE=wayland +export PHIOS_STATE_ROOT="$HOME/.local/state/phios" +export PHIOS_CURIOSITY_ROOT="$PHIOS_STATE_ROOT/curiosity" +mkdir -p "$PHIOS_STATE_ROOT" +systemctl --user import-environment PHIOS_STATE_ROOT PHIOS_CURIOSITY_ROOT XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP XDG_SESSION_TYPE +cleanup() { systemctl --user stop phios-session.target; } +trap cleanup EXIT HUP INT TERM +# Autostart starts the user services only after WAYLAND_DISPLAY exists. +wayfire -c /etc/xdg/phios/wayfire.ini diff --git a/packaging/linux/session/phios-session-ready b/packaging/linux/session/phios-session-ready new file mode 100755 index 00000000..eebd07d0 --- /dev/null +++ b/packaging/linux/session/phios-session-ready @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail +systemctl --user import-environment WAYLAND_DISPLAY DISPLAY XDG_CURRENT_DESKTOP +dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP +systemctl --user start phios-session.target diff --git a/packaging/linux/session/phios-session.target b/packaging/linux/session/phios-session.target new file mode 100644 index 00000000..b1e3e439 --- /dev/null +++ b/packaging/linux/session/phios-session.target @@ -0,0 +1,3 @@ +[Unit] +Description=PhiOS graphical session services +Wants=phios-observer.service phios-curiosity-reader.service phios-history-reader.service phios-browser.service phios-waybar.service diff --git a/packaging/linux/session/phios-waybar.service b/packaging/linux/session/phios-waybar.service new file mode 100644 index 00000000..747da507 --- /dev/null +++ b/packaging/linux/session/phios-waybar.service @@ -0,0 +1,12 @@ +[Unit] +Description=PhiOS Waybar panel +PartOf=phios-session.target + +[Service] +ExecStart=/usr/bin/waybar -c /etc/xdg/phios/waybar.json +Restart=on-failure +RestartSec=3 +UMask=0077 + +[Install] +WantedBy=phios-session.target diff --git a/packaging/linux/session/phios.desktop b/packaging/linux/session/phios.desktop new file mode 100644 index 00000000..3ca132d7 --- /dev/null +++ b/packaging/linux/session/phios.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=PhiOS (Wayfire) +Comment=PhiShell local observation desktop preview +Exec=/usr/bin/phios-session +Type=Application +DesktopNames=Wayfire; diff --git a/packaging/linux/session/waybar.json b/packaging/linux/session/waybar.json new file mode 100644 index 00000000..43959845 --- /dev/null +++ b/packaging/linux/session/waybar.json @@ -0,0 +1,9 @@ +{ + "layer": "top", + "position": "top", + "modules-left": ["custom/phi-logo"], + "modules-center": ["custom/preview"], + "modules-right": ["network", "memory", "cpu", "clock"], + "custom/phi-logo": {"format": "φ PhiOS"}, + "custom/preview": {"format": "DEVELOPMENT PREVIEW", "tooltip-format": "Installation, whole-OS recovery and Linux desktop effects are not qualified."} +} diff --git a/packaging/linux/session/wayfire.ini b/packaging/linux/session/wayfire.ini new file mode 100644 index 00000000..14ef17a1 --- /dev/null +++ b/packaging/linux/session/wayfire.ini @@ -0,0 +1,24 @@ +# Wayfire 0.11 public configuration options. +[core] +plugins = autostart command decoration move resize place grid vswitch wm-actions +vwidth = 3 +vheight = 3 +close_top_view = KEY_Q | KEY_F4 + +[autostart] +autostart_wf_shell = false +phios = /usr/lib/phishell/session-ready + +[command] +binding_terminal = KEY_ENTER +command_terminal = foot phi +binding_launcher = KEY_SPACE +command_launcher = wofi --show drun +binding_shell = KEY_P +command_shell = phios-open-shell + +[move] +activate = BTN_LEFT + +[resize] +activate = BTN_RIGHT diff --git a/packaging/linux/tests/live-smoke.sh b/packaging/linux/tests/live-smoke.sh new file mode 100755 index 00000000..bb5158e2 --- /dev/null +++ b/packaging/linux/tests/live-smoke.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# This fixture is included only when PHIOS_CI_SMOKE=1; it performs no disk writes. +set -euo pipefail +trap 'journalctl -b -u greetd --no-pager; runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 journalctl --user -b --no-pager; echo PHIOS_BOOT_FAILED' ERR +for attempt in {1..420}; do + if curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null && + pgrep -u phios -x wayfire >/dev/null && pgrep -u phios -x chromium >/dev/null; then + break + fi + sleep 1 +done +curl -fsS http://127.0.0.1:3969/ | grep -q '
' +curl -fsS http://127.0.0.1:3969/api/v1/package-observation | python -c 'import json,sys; p=json.load(sys.stdin)["observation"]; assert p["adapter"]=="arch-pacman-local" and p["availability"]=="available" and not p["executionAuthority"] and not p["effectPerformed"]' +test "$(id -u phios)" = 1000 +test "$(stat -c %a /home/phios/.local/state/phios)" = 700 +! id -nG phios | grep -qw wheel +! pgrep -u root -x wayfire +! pgrep -u root -x chromium +for pid in $(pgrep -u phios -x chromium); do + ! tr '\0' '\n' < "/proc/$pid/cmdline" | grep -qx -- '--no-sandbox' +done +for endpoint in decisions bindings leases; do + status=$(curl -sS -o /dev/null -w '%{http_code}' -X POST -H 'Content-Type: application/json' --data '{}' "http://127.0.0.1:3969/api/v1/ghostwalk/authorization-console/$endpoint") + test "$status" = 403 +done +runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 systemctl --user is-active phios-observer.service phios-browser.service phios-curiosity-reader.service +python -c 'import phios, phios.mcp.server, phios.ghostwalk_operator; print("Installed Python runtime:",phios.__version__)' +phi --version +printf 'PHIOS_BOOT_OK:%s\n' "$(cat /usr/share/phios/source-commit)" diff --git a/packaging/linux/tests/qemu_boot.py b/packaging/linux/tests/qemu_boot.py new file mode 100644 index 00000000..9f5197fa --- /dev/null +++ b/packaging/linux/tests/qemu_boot.py @@ -0,0 +1,95 @@ +"""Boot a disposable, network-disconnected UEFI VM and preserve exact evidence.""" +from __future__ import annotations + +import argparse +import hashlib +import json +import re +import shutil +import socket +import subprocess +import time +from pathlib import Path + + +def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: + if re.fullmatch(r"[0-9a-f]{40}", source) is None or not iso.is_file(): + raise ValueError("an existing ISO and exact source commit are required") + output.mkdir(parents=True, exist_ok=True) + code = Path("/usr/share/OVMF/OVMF_CODE_4M.fd") + variables = Path("/usr/share/OVMF/OVMF_VARS_4M.fd") + if not code.is_file() or not variables.is_file(): + raise ValueError("OVMF UEFI firmware is required") + qemu = shutil.which("qemu-system-x86_64") + if qemu is None: + raise ValueError("qemu-system-x86_64 is required") + variables_copy = output / "OVMF_VARS.fd" + shutil.copyfile(variables, variables_copy) + serial = output / "serial.log" + qmp_path = output / "qmp.sock" + command = [qemu, "-machine", "q35,accel=tcg", "-cpu", "max", "-m", "4096", "-smp", "2", + "-drive", f"if=pflash,format=raw,readonly=on,file={code}", + "-drive", f"if=pflash,format=raw,file={variables_copy}", + "-cdrom", str(iso.resolve()), "-boot", "d", "-nic", "none", "-vga", "none", + "-device", "virtio-vga", "-display", "none", "-monitor", "none", + "-serial", f"file:{serial}", "-qmp", f"unix:{qmp_path},server=on,wait=off"] + digest = hashlib.sha256() + with iso.open("rb") as handle: + for block in iter(lambda: handle.read(1024 * 1024), b""): + digest.update(block) + receipt = {"schema_version": "phios.live-boot-evidence.v1", "source_commit": source, + "iso_sha256": digest.hexdigest(), "command": command, + "boot_passed": False, "hardware_qualified": False, "release_ready": False} + with (output / "qemu.log").open("w") as log: + process = subprocess.Popen(command, stdout=log, stderr=subprocess.STDOUT) + try: + deadline = time.monotonic() + timeout + marker = f"PHIOS_BOOT_OK:{source}" + while time.monotonic() < deadline: + text = serial.read_text(errors="replace") if serial.exists() else "" + if "PHIOS_BOOT_FAILED" in text: + raise RuntimeError("live-image qualification fixture failed") + if marker in text: + break + if process.poll() is not None: + raise RuntimeError(f"QEMU exited before qualification (exit {process.returncode})") + time.sleep(1) + else: + raise RuntimeError("UEFI boot/session qualification timed out") + with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client: + client.settimeout(15) + client.connect(str(qmp_path)) + stream = client.makefile("rwb") + json.loads(stream.readline()) + for request in [{"execute": "qmp_capabilities"}, + {"execute": "screendump", "arguments": { + "filename": str((output / "screen.ppm").resolve())}}]: + stream.write(json.dumps(request).encode() + b"\n") + stream.flush() + while True: + response = json.loads(stream.readline()) + if "error" in response: + raise RuntimeError(f"QMP evidence capture failed: {response['error']}") + if "return" in response: + break + receipt["boot_passed"] = True + print(f"UEFI live boot and non-root session passed for ISO {receipt['iso_sha256']}") + finally: + process.terminate() + try: + process.wait(timeout=15) + except subprocess.TimeoutExpired: + process.kill() + process.wait(timeout=5) + (output / "boot-evidence.json").write_text(json.dumps(receipt, indent=2) + "\n") + if not receipt["boot_passed"] and serial.exists(): + print("\n".join(serial.read_text(errors="replace").splitlines()[-160:])) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--iso", required=True, type=Path) + parser.add_argument("--source", required=True) + parser.add_argument("--output", required=True, type=Path) + args = parser.parse_args() + boot(args.iso, args.source, args.output.resolve()) diff --git a/phios/core/launch_artifacts.py b/phios/core/launch_artifacts.py index 848b8309..9f15d6de 100644 --- a/phios/core/launch_artifacts.py +++ b/phios/core/launch_artifacts.py @@ -10,7 +10,7 @@ class LaunchArtifactGenerator: def _traction_line(self) -> str: test_files = sorted(Path("tests").glob("test_v*.py")) - return f"{len(test_files)} release generations, full CI-aligned test coverage through {test_files[-1].stem if test_files else 'test_v00'}" + return f"{len(test_files)} historical version test files in this checkout. File counts do not prove passing checks or OS readiness." def generate_distrowatch_submission(self) -> str: text = ( @@ -20,30 +20,30 @@ def generate_distrowatch_submission(self) -> str: "Desktop: Wayfire\n" "Category: Sovereign Computing Shell\n" "Release model: Fixed\n" - "License: GPLv3\n" + "License: MIT (PhiOS source); bundled OS packages retain their own licenses\n" "Homepage: https://enterthefield.org/phios\n" - "Download: \n\n" + "Download: OS image qualification pending; no qualified OS download yet\n\n" "Description:\n" "PhiOS is a local-first sovereign shell operating layer built by PHI369 Labs. " "It couples coherence tracking L(t), secure snapshot workflows, optional TBRC/PHB bridges, and a Wayfire desktop path tuned for auditable local operation. " - "Version 1.0.0 marks the public declaration release with living specification sealing, founding charter exports, and reproducible launch artifacts. " + "The Python package and a future Linux OS image have separate release tracks. The OS is a development preview requiring boot, installation and recovery qualification. " "No cloud dependency is required for core operation.\n" ) return text def generate_announcement_kit(self) -> dict[str, str]: x_post = ( - "PhiOS v1.0 is public. Sovereign. Coherent. Local. Free. " - "pip install phios==1.0.0 · https://enterthefield.org/phios · " + "PhiOS Python shell is available; Linux OS qualification is in progress. " + "pip install phios · https://enterthefield.org/phios · " "Hemavit attribution preserved. #PhiOS #Parallax #PHI369" ) extended = ( - "# PhiOS v1.0 Public Launch\n\n" - "Nine versions forged into one declaration. PhiOS now ships with a sealed living specification, " - "Parallax founding document exports, and reproducible public launch artifacts for operators.\n" + "# PhiOS Development Update\n\n" + "PhiOS provides an alpha operator shell, " + "Parallax founding document exports, and draft public artifacts for operators. A qualified Linux OS release is pending.\n" ) technical = ( - "# PhiOS v1.0 Technical Launch Notes\n\n" + "# PhiOS Python Package Notes\n\n" f"- Version: {__version__}\n" "- Living spec seal workflow: phi spec generate --yes\n" "- Founding export workflow: phi founding export --yes\n" diff --git a/phios/core/living_spec.py b/phios/core/living_spec.py index af413820..e4453bb8 100644 --- a/phios/core/living_spec.py +++ b/phios/core/living_spec.py @@ -61,9 +61,9 @@ def _render(self, seal: str) -> str: "- Name: PhiOS — Sovereign Computing Shell", f"- Version: {__version__}", "- Mission: Sovereign. Coherent. Local. Free.", - "- License: GPLv3", + "- License: MIT; see LICENSE_HISTORY.md for historical licensing", "- Manifesto: https://enterthefield.org/phios", - f"- Launch date: {now}", + f"- Generated at: {now}", "", "## 2. Mathematical Foundation", "- TIEKAT v8.1 is the foundational stack.", diff --git a/phios/desktop/install.py b/phios/desktop/install.py index 6298dbab..66e7a447 100644 --- a/phios/desktop/install.py +++ b/phios/desktop/install.py @@ -34,7 +34,7 @@ def detect_package_manager(self) -> str: def install_packages(self, pkg_manager: str) -> bool: if pkg_manager not in PACKAGES: return False - return True + return all(shutil.which(name) for name in ("wayfire", "waybar", "wofi", "foot", "node", "chromium", "phios-open-shell")) def backup_existing_configs(self) -> list[str]: backups: list[str] = [] @@ -68,13 +68,19 @@ def install(self, dry_run: bool = True) -> dict[str, object]: "would_write_files": [str(self.wayfire_ini), str(self.waybar_dir / "config.jsonc"), str(self.waybar_dir / "style.css")], "backups_made": [], "success": True, + "dry_run": dry_run, + "applied": False, "warnings": [], } if dry_run: return report + if not self.install_packages(pkg): + report["success"] = False + report["warnings"] = ["Desktop dependencies are missing. Install the phishell Arch package before applying this configuration; no packages were installed."] + return report backups = self.backup_existing_configs() report["backups_made"] = backups - self.install_packages(pkg) self.apply_phios_config() + report["applied"] = True return report diff --git a/phios/desktop/phi_tray.py b/phios/desktop/phi_tray.py index 7e301924..e29c2de3 100644 --- a/phios/desktop/phi_tray.py +++ b/phios/desktop/phi_tray.py @@ -50,7 +50,7 @@ def payload(self) -> dict[str, object]: f"Coherence: {float(components.get('A_stability', 0.5)):.3f}", f"Boundary: {1.0 - float(components.get('G_load', 0.5)):.3f}", f"Cadence: {float(components.get('C_variance', 0.5)):.3f}", - "Sovereignty: ON (placeholder)", + "Sovereignty: unverified", "Session: best-effort", f"BrainC: {'Active' if ollama_available() else 'Inactive'}", f"TBRC: {tbrc_info}", @@ -65,7 +65,7 @@ def payload(self) -> dict[str, object]: except Exception: return { "text": "φ 0.500", - "tooltip": "L(t): unavailable\nSovereignty: ON (placeholder)", + "tooltip": "L(t): unavailable\nSovereignty: unverified", "class": "degraded", "percentage": 50, } diff --git a/phios/desktop/sovereignty_indicator.py b/phios/desktop/sovereignty_indicator.py index 9d462a06..54b064a0 100644 --- a/phios/desktop/sovereignty_indicator.py +++ b/phios/desktop/sovereignty_indicator.py @@ -7,10 +7,10 @@ def indicator_payload() -> dict[str, object]: return { - "text": "SOV ON", - "tooltip": "Sovereignty: ON\nMode: local-first", - "class": "coherent", - "percentage": 100, + "text": "UNVERIFIED", + "tooltip": "Sovereignty: unverified\nLocal-first is a design goal, not an attested security state.", + "class": "unverified", + "percentage": 0, } diff --git a/phios/desktop/wayfire_config.py b/phios/desktop/wayfire_config.py index b74f2500..0dc97db7 100644 --- a/phios/desktop/wayfire_config.py +++ b/phios/desktop/wayfire_config.py @@ -33,58 +33,32 @@ def fibonacci_gaps(self, level: int) -> int: return FIBONACCI[level] def _config_text(self) -> str: - return f"""# PhiOS Wayfire Config -# Sacred geometry workspace map: 3x3 with 3/6/9 coherence anchors - + return """# PhiOS Wayfire 0.11 configuration [core] -plugins = grid move resize animate waybar wofi -# custom phi-tray module is integrated through Waybar custom/phi-tray -background_color = {PHIOS_COLORS['deep']} - -[decoration] -border_color = {PHIOS_COLORS['gold']} -border_size = 1 -gap_size = {self.fibonacci_gaps(0)} +plugins = autostart command decoration move resize place grid vswitch wm-actions +vwidth = 3 +vheight = 3 +close_top_view = KEY_Q | KEY_F4 -[grid] -# Golden ratio guidance for primary layout: 61.8 / 38.2 -primary_split = 61.8 -secondary_split = 38.2 +[autostart] +autostart_wf_shell = false +phios = /usr/lib/phishell/session-ready -[workspaces] -rows = 3 -columns = 3 -workspace_1 = 1 -workspace_2 = 2 -workspace_3 = 3 # 3 anchor -workspace_4 = 4 -workspace_5 = 5 -workspace_6 = 6 # 6 anchor -workspace_7 = 7 -workspace_8 = 8 -workspace_9 = 9 # 9 anchor +[command] +binding_terminal = KEY_ENTER +command_terminal = foot phi +binding_launcher = KEY_SPACE +command_launcher = wofi --show drun +binding_coherence = KEY_L +command_coherence = foot phi coherence live +binding_shell = KEY_P +command_shell = phios-open-shell -[keybindings] -super_return = phi -super_space = phi launcher -super_l = phi coherence live -super_s = phi sovereign export ./phi_snapshot_toggle.json -super_shift_q = close -super_1 = workspace 1 -super_2 = workspace 2 -super_3 = workspace 3 -super_4 = workspace 4 -super_5 = workspace 5 -super_6 = workspace 6 -super_7 = workspace 7 -super_8 = workspace 8 -super_9 = workspace 9 +[move] +activate = BTN_LEFT -[animate] -open_animation = fade scale_center -close_animation = fade scale_center -workspace_switch_animation = smooth_slide -duration = 200 +[resize] +activate = BTN_RIGHT """ def generate(self, output_path: str = "~/.config/wayfire.ini") -> str: diff --git a/phios/shell/phi_commands.py b/phios/shell/phi_commands.py index 6f019f26..f8feab92 100644 --- a/phios/shell/phi_commands.py +++ b/phios/shell/phi_commands.py @@ -3971,18 +3971,22 @@ def _iso_status() -> dict[str, object]: dist_dir = Path("dist") latest = None if dist_dir.exists(): - isos = sorted(dist_dir.glob("phios-v*-x86_64.iso")) + isos = sorted([*dist_dir.glob("phios-v*-x86_64.iso"), *(dist_dir / "linux").glob("phios-linux-*-x86_64.iso")], key=lambda path: path.stat().st_mtime) if isos: latest = isos[-1] if latest is None: return {"exists": False, "path": None, "size": None, "sha256": None} - data = latest.read_bytes() + digest = hashlib.sha256() + with latest.open("rb") as handle: + for block in iter(lambda: handle.read(1024 * 1024), b""): + digest.update(block) return { + "release_ready": False, "exists": True, "path": str(latest), "size": latest.stat().st_size, - "sha256": hashlib.sha256(data).hexdigest(), + "sha256": digest.hexdigest(), } @@ -4146,10 +4150,13 @@ def cmd_build(args: list[str], session: object | None = None) -> str: confirmed = len(args) > 1 and args[1] == "--yes" if not confirmed: return "Refusing to build ISO without explicit confirmation. Re-run: phi build iso --yes" - proc = subprocess.run(["bash", "build/build_iso.sh"], capture_output=True, text=True, check=False) + script = Path(__file__).resolve().parents[2] / "build" / "build_iso.sh" + if not script.is_file(): + raise RuntimeError("OS image building requires a source checkout with build/build_iso.sh") + proc = subprocess.run(["bash", str(script)], capture_output=True, text=True, check=False) output = (proc.stdout or "") + (proc.stderr or "") if proc.returncode != 0: - return f"ISO build failed\n{output}" + raise RuntimeError(f"ISO build failed (exit {proc.returncode})\n{output}") return f"ISO build completed\n{output}" return "Usage: build [iso|status|clean]" diff --git a/phishell/host/packageObservationContract.mjs b/phishell/host/packageObservationContract.mjs index 4a0bc820..afe37e25 100644 --- a/phishell/host/packageObservationContract.mjs +++ b/phishell/host/packageObservationContract.mjs @@ -13,8 +13,7 @@ export function validatePackageObservation(o){ const errors=[]; if(!exactKeys(o,TOP_LEVEL_KEYS)) return {ok:false,errors:["top-level package fields invalid"]}; if(o.schemaVersion!=="phios.package-observation.v1") errors.push("schemaVersion"); - if(o.source!=="dpkg-status-file") errors.push("source"); - if(o.adapter!=="debian-dpkg-status") errors.push("adapter"); + if(!((o.source==="dpkg-status-file"&&o.adapter==="debian-dpkg-status")||(o.source==="pacman-local-desc"&&o.adapter==="arch-pacman-local"))) errors.push("source/adapter"); if(!bounded(o.capturedAt,64)||Number.isNaN(Date.parse(o.capturedAt))) errors.push("capturedAt"); if(!["available","unavailable"].includes(o.availability)) errors.push("availability"); if(o.reason!==null&&!["non-linux-host","os-release-unavailable","unsupported-package-database","package-database-unavailable"].includes(o.reason)) errors.push("reason"); diff --git a/phishell/host/packageObserver.mjs b/phishell/host/packageObserver.mjs index 8cd4f426..e3e2dc49 100644 --- a/phishell/host/packageObserver.mjs +++ b/phishell/host/packageObserver.mjs @@ -1,4 +1,4 @@ -import { readFile } from "node:fs/promises"; +import { readFile, readdir, open } from "node:fs/promises"; import { pathToFileURL } from "node:url"; const DPKG_STATUS_PATH = "/var/lib/dpkg/status"; @@ -88,128 +88,100 @@ export function parseDpkgStatus(text) { return packages; } -export async function collectPackageObservation({ - readText = async (path) => readFile(path, "utf8"), -} = {}) { - const capturedAt = new Date().toISOString(); - - if (process.platform !== "linux") { - return { - schemaVersion: "phios.package-observation.v1", - source: "dpkg-status-file", - capturedAt, - availability: "unavailable", - reason: "non-linux-host", - adapter: "debian-dpkg-status", - packageLimit: PACKAGE_LIMIT, - readOnly: true, - executionAuthority: false, - effectPerformed: false, - distro: null, - totalInstalledPackageCount: 0, - packages: [], - }; +const PACMAN_LOCAL_PATH = "/var/lib/pacman/local"; +const DATABASE_ENTRY_LIMIT = 20000; + +export function parsePacmanDescription(text) { + if (typeof text !== "string" || Buffer.byteLength(text) > 8192) return null; + const fields = new Map(); + const lines = text.split("\n"); + for (let i = 0; i < lines.length; i++) { + if (!["%NAME%", "%VERSION%", "%ARCH%"].includes(lines[i])) continue; + if (fields.has(lines[i])) return null; + fields.set(lines[i], lines[i + 1] ?? ""); } + const name = fields.get("%NAME%"); + const version = fields.get("%VERSION%"); + const architecture = fields.get("%ARCH%"); + if (!name || !/^[a-z0-9@+_.-]+$/.test(name) || name.length > MAX_NAME || + !version || version.length > MAX_VERSION || /[\x00-\x1f\x7f]/.test(version) || + !architecture || architecture.length > MAX_ARCH || !/^[a-z0-9_]+$/.test(architecture)) return null; + // Pacman has no Debian Essential flag. Never infer importance from a name. + return { name, version, architecture, essential: false }; +} - let osReleaseText; +async function readBoundedDescription(path) { + const file = await open(path, "r"); try { - osReleaseText = await readText(OS_RELEASE_PATH); - } catch { - return { - schemaVersion: "phios.package-observation.v1", - source: "dpkg-status-file", - capturedAt, - availability: "unavailable", - reason: "os-release-unavailable", - adapter: "debian-dpkg-status", - packageLimit: PACKAGE_LIMIT, - readOnly: true, - executionAuthority: false, - effectPerformed: false, - distro: null, - totalInstalledPackageCount: 0, - packages: [], - }; - } + const buffer = Buffer.alloc(8193); + const { bytesRead } = await file.read(buffer, 0, buffer.length, 0); + if (bytesRead > 8192) throw new Error("package description too large"); + return buffer.subarray(0, bytesRead).toString("utf8"); + } finally { await file.close(); } +} - const osRelease = parseOsRelease(osReleaseText); - const distro = { +export async function collectPackageObservation({ + readText = async (path) => readFile(path, "utf8"), + listPacmanEntries = async () => (await readdir(PACMAN_LOCAL_PATH, { withFileTypes: true })) + .filter(entry => entry.isDirectory()).map(entry => entry.name), + readPacmanText = readBoundedDescription, +} = {}) { + const observation = { + schemaVersion: "phios.package-observation.v1", + source: "dpkg-status-file", capturedAt: new Date().toISOString(), + availability: "unavailable", reason: "non-linux-host", adapter: "debian-dpkg-status", + packageLimit: PACKAGE_LIMIT, readOnly: true, executionAuthority: false, + effectPerformed: false, distro: null, totalInstalledPackageCount: 0, packages: [], + }; + if (process.platform !== "linux") return observation; + let osRelease; + try { osRelease = parseOsRelease(await readText(OS_RELEASE_PATH)); } + catch { return { ...observation, reason: "os-release-unavailable" }; } + observation.distro = { id: boundedText(String(osRelease.ID ?? "unknown"), 64) || "unknown", - name: - boundedText(String(osRelease.PRETTY_NAME ?? osRelease.NAME ?? osRelease.ID ?? "Linux"), 160) || - "Linux", + name: boundedText(String(osRelease.PRETTY_NAME ?? osRelease.NAME ?? osRelease.ID ?? "Linux"), 160) || "Linux", }; - - if (!distroSupportsDpkg(osRelease)) { - return { - schemaVersion: "phios.package-observation.v1", - source: "dpkg-status-file", - capturedAt, - availability: "unavailable", - reason: "unsupported-package-database", - adapter: "debian-dpkg-status", - packageLimit: PACKAGE_LIMIT, - readOnly: true, - executionAuthority: false, - effectPerformed: false, - distro, - totalInstalledPackageCount: 0, - packages: [], - }; + const family = [osRelease.ID, ...String(osRelease.ID_LIKE ?? "").split(/\s+/)]; + const usePacman = family.includes("arch"); + if (!usePacman && !distroSupportsDpkg(osRelease)) { + return { ...observation, reason: "unsupported-package-database" }; } - - let statusText; - try { - statusText = await readText(DPKG_STATUS_PATH); - } catch { - return { - schemaVersion: "phios.package-observation.v1", - source: "dpkg-status-file", - capturedAt, - availability: "unavailable", - reason: "package-database-unavailable", - adapter: "debian-dpkg-status", - packageLimit: PACKAGE_LIMIT, - readOnly: true, - executionAuthority: false, - effectPerformed: false, - distro, - totalInstalledPackageCount: 0, - packages: [], - }; + if (usePacman) { + observation.source = "pacman-local-desc"; + observation.adapter = "arch-pacman-local"; } - - const installed = parseDpkgStatus(statusText).sort( - (a, b) => - Number(b.essential) - Number(a.essential) || - a.name.localeCompare(b.name) || - a.architecture.localeCompare(b.architecture), - ); - - return { - schemaVersion: "phios.package-observation.v1", - source: "dpkg-status-file", - capturedAt: new Date().toISOString(), - availability: "available", - reason: null, - adapter: "debian-dpkg-status", - packageLimit: PACKAGE_LIMIT, - readOnly: true, - executionAuthority: false, - effectPerformed: false, - distro, - totalInstalledPackageCount: installed.length, - packages: installed.slice(0, PACKAGE_LIMIT), - }; + let installed; + try { + if (usePacman) { + const entries = await listPacmanEntries(); + if (!Array.isArray(entries) || entries.length > DATABASE_ENTRY_LIMIT) throw new Error("database entry limit exceeded"); + installed = []; + for (const entry of entries.sort()) { + if (typeof entry !== "string" || !/^[a-zA-Z0-9@+_.-]{1,300}$/.test(entry) || [".", ".."].includes(entry)) { + throw new Error("invalid database entry"); + } + const pkg = parsePacmanDescription(await readPacmanText(`${PACMAN_LOCAL_PATH}/${entry}/desc`)); + if (!pkg) throw new Error("invalid package description"); + installed.push(pkg); + } + } else { + installed = parseDpkgStatus(await readText(DPKG_STATUS_PATH)); + } + } catch { return { ...observation, reason: "package-database-unavailable" }; } + installed.sort((a, b) => Number(b.essential) - Number(a.essential) || + a.name.localeCompare(b.name) || a.architecture.localeCompare(b.architecture)); + return { ...observation, availability: "available", reason: null, + capturedAt: new Date().toISOString(), totalInstalledPackageCount: installed.length, + packages: installed.slice(0, PACKAGE_LIMIT) }; } async function main() { const observation = await collectPackageObservation(); - if (process.argv.includes("--require-debian") && observation.availability !== "available") { + if ((process.argv.includes("--require-debian") || process.argv.includes("--require-native")) && observation.availability !== "available") { throw new Error(`package observation unavailable: ${observation.reason}`); } - if (process.argv.includes("--check") || process.argv.includes("--require-debian")) { + if (process.argv.includes("--check") || process.argv.includes("--require-debian") || process.argv.includes("--require-native")) { return; } diff --git a/phishell/host/packageObserver.test.mjs b/phishell/host/packageObserver.test.mjs index 586ac770..018a6795 100644 --- a/phishell/host/packageObserver.test.mjs +++ b/phishell/host/packageObserver.test.mjs @@ -5,7 +5,39 @@ import { collectPackageObservation, parseDpkgStatus, parseOsRelease, + parsePacmanDescription, } from "./packageObserver.mjs"; +import { validatePackageObservation } from "./packageObservationContract.mjs"; + +test("Arch inventory reads exact installed identities with a bounded projection", async () => { + const observation = await collectPackageObservation({ + readText: async () => 'ID=phios\nID_LIKE=arch\nPRETTY_NAME="PhiOS Preview"\n', + listPacmanEntries: async () => Array.from({length: 70}, (_, i) => `pkg${i}-1.0-1`), + readPacmanText: async path => `%NAME%\n${path.split("/").at(-2).split("-")[0]}\n\n%VERSION%\n1.0-1\n\n%ARCH%\nx86_64\n\n%DESC%\nPrivate description\n`, + }); + assert.equal(observation.adapter, "arch-pacman-local"); + assert.equal(observation.availability, "available"); + assert.equal(observation.totalInstalledPackageCount, 70); + assert.equal(observation.packages.length, 64); + assert.equal(observation.packages[0].essential, false); + assert.equal(JSON.stringify(observation).includes("Private description"), false); + assert.equal(validatePackageObservation(observation).ok, true); + assert.equal(validatePackageObservation({...observation, source: "dpkg-status-file"}).ok, false); +}); + +test("Arch corrupt or changing database never reports a partial inventory as available", async () => { + for (const entry of ["../escape", "bad-1-1"]) { + const result = await collectPackageObservation({ + readText: async () => "ID=arch\n", + listPacmanEntries: async () => [entry], + readPacmanText: async () => "%NAME%\nbad\n%NAME%\nother\n", + }); + assert.equal(result.availability, "unavailable"); + assert.equal(result.reason, "package-database-unavailable"); + assert.deepEqual(result.packages, []); + } + assert.equal(parsePacmanDescription("x".repeat(8193)), null); +}); test("dpkg parser keeps installed package identity only", () => { const parsed = parseDpkgStatus(` diff --git a/phishell/package-lock.json b/phishell/package-lock.json new file mode 100644 index 00000000..618d97c1 --- /dev/null +++ b/phishell/package-lock.json @@ -0,0 +1,1839 @@ +{ + "name": "phishell", + "version": "0.16.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "phishell", + "version": "0.16.0", + "dependencies": { + "@jellybrick/dbus-next": "0.11.3", + "react": "19.1.1", + "react-dom": "19.1.1" + }, + "devDependencies": { + "@types/react": "19.1.12", + "@types/react-dom": "19.1.9", + "typescript": "5.9.2", + "vite": "7.1.5", + "vitest": "3.2.4" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jellybrick/dbus-next": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@jellybrick/dbus-next/-/dbus-next-0.11.3.tgz", + "integrity": "sha512-XaLIXFuG6YWmqmucY0/amh3VQpHXCOJ9mJMnwvvEOPdFFE6hQ3ZjdvkaWQuDWrN1qIfOoR9xTAGqFc3iWRpYbg==", + "license": "MIT", + "dependencies": { + "fast-xml-builder": "^1.3.0", + "fast-xml-parser": "^5.10.1" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@nodable/entities": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@nodable/entities/-/entities-3.1.0.tgz", + "integrity": "sha512-LsS/DjHr+uDM647Gru/cA8+J3a3HfhttwCKLyuoyN7yXTFCxKBtSgMQBvrW9yNPa2/zDRUNuGPaH5QUFoa4arQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/nodable" + } + ], + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.5.tgz", + "integrity": "sha512-J25QJU+B78T4FhhBsNpLJyVWOi31mwtpcMwywHmOKH65Q9IWGA81gPj+dnwlhU8wktVriYE+tFAaQgrnJRzAZg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.5.tgz", + "integrity": "sha512-LDopB3zuZM5Ux9TT2luNEBJW/tYbGU2g1d+VpKk6I+gSKDb+/7sYE6M225gRQt4RbMX6MSwMsVR/phdjVUgRLg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.5.tgz", + "integrity": "sha512-wlJEERGfeuHeBavCL2qVnNacOK43NDoZM4sjkeRPymd04OAE9T1zBqDJgmZ+CIsPTYKwdzpUC8vmOw84dwY4Tg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.5.tgz", + "integrity": "sha512-4nJJGg5jbo2wwPP4JP+LfEBA3bvP8rU9CLuhp7jWvq9sxEyhjQFTFdrqi+/dHEin/pd8jpT0vcehIpnZtmEdcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.5.tgz", + "integrity": "sha512-DrZbyCDF1hneuO6jRbvZ2D7+PIBM6yIwYnJpg2vIk58T+wuFpiaGZrfUr59lDWw45bg+IrpTGLPiNi/Fk4w3Cg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.5.tgz", + "integrity": "sha512-gqfUVMJMB3mehqywxp6hTBFfgtMQykZY19+cfiaYP0toIJLb/1DZRJHVkQQGP13W4TAwfZDWeg1qBcheTRioXQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.5.tgz", + "integrity": "sha512-CFmhpvAwzSaWMlN3VN7UtmoTihlZNzoP0juQib5TQRnYUyDV8dXeWOp29sobWAT6gXl/hQgAClLlEiYozQG3OQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.5.tgz", + "integrity": "sha512-Uc9H8eXCOayV6JLTH5bXKMId6qbhNHa818/BgYjm4jrlq3vZquC9cqyvHBw17xy5Mnj5f+I3gFK5JcEf3hSqrw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.5.tgz", + "integrity": "sha512-VcPr/szv/1BFw112Kt//fxulXt/JPqzzidU84iW68L2DdjnOO8QFUv2zTSYBEPHD6movBD4z+bbr5y60GYM7Jw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.5.tgz", + "integrity": "sha512-BnxtJ5/91BrIHYIkGrmjz/lbMhqEHt1dPFqIxIFR+jPn0xVc/oUSCtIT089zfp5ufwGDlYz2UC+Fe1SRBpYFbQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.5.tgz", + "integrity": "sha512-LrYcHZwF+fAMNKHYTOQ5osWM4AZF7YF6D+XtsjDyEvljtt11twc+zHVXBLNEjxVSUnKYsOhvVz4Z213eW02COQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.5.tgz", + "integrity": "sha512-nj7QKQePAAUpCpJHtg0pR0W/b92A9NO17JS3BAQmHDn/yhmkir2p8llrKY9TOhleKIaSzy1JhxS3T9FVld6coA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.5.tgz", + "integrity": "sha512-5ylkX6dWMeBKge9nTU+Rxfb+ZfaCIJ9lRqIFaK0eAMcWp7OJbYnLveLgXmm0VrvuLKb8qIK+mHyH0qu88RM+iA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.5.tgz", + "integrity": "sha512-oHK4ZHYFDKjZviK34I+NwgfbGxgI7ztrNxj2hPTSSNFgeq1a/lEd7dHV2fdGAuTH4Iym3RHJg+vAbWaWG4B7Zg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.5.tgz", + "integrity": "sha512-UcetmHZ6XOXuUByiKZyQmb55ZPr0LABr3Ec/HB9wKZn6CEAFWZkE+hsJErJ9hbPBC7nI0dKuELx7CoV6IM7TMg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.5.tgz", + "integrity": "sha512-C5CmDPQBtvjVo8cgQsBs+w6WB0JLkiixhgi6hVLV11hERWdn/p0XcPU2OUcZzac9BPOFq7SbaHFa8r3SWEysCQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.5.tgz", + "integrity": "sha512-lHVQHJFKsuuxLMi3MQO9XVL8Tje3JR82CzB+QDKC5NWBcsIWuwsn9uIM5e3lBhI+fF1/s63qnyYqsg65+8rV/w==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.5.tgz", + "integrity": "sha512-3W9bTFcQNJn71cSJVM9RKIiZOy8DO/XLDii8Uv/Pm6WKqDRj7JV3ZfuXIEfyuy5LXpIzAbB/1M4Ukp9GKNa7nA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.5.tgz", + "integrity": "sha512-VDC7rRJlee/scpki96GZ27Omf6yU87s1YXwVTpjE5841faVlDYYT565rgfmoR1U0sqL7z5ivQSDjcsF6VRXyBA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.5.tgz", + "integrity": "sha512-z86Ok2p4pTdv5xqCKZsTooO7yBEiaJR/HzU3Wx8RmWsPoLppnMKROhJusQob8B3IE1ghC343kUW9rC2r+Wf3ig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.5.tgz", + "integrity": "sha512-IzQmj+xXwQFGhMAMKMQVXkMwMZN3TqkJgAE0nSsqvVwWWciP4AIPMmWRqOQ2GfX7TUDZr+xqGFcBS36CRPGw0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.5.tgz", + "integrity": "sha512-F6qpTaPc9bwBH85kjy0/BLmLSW1uv7AoOXCoRIkg2arlgCYlWYcAbiMkvZuAcaWk9TpCRG//okznLAqLGshkMw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.5.tgz", + "integrity": "sha512-igoDsTFhhwECBeGbUuLeIk7t8Y1apa+cs6mDWpx2EZ0ch7oEQgzHbFUXN9euoHekCAQzXdXApAGkV6jznS7tWw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.5.tgz", + "integrity": "sha512-U3teMeMbXFmaM5D+OTJpsOXd+wV/qftIeYF9kBKL4v73641qyJmoXFtA28DQLsnmlyayEsTe72xpLHrArq6vHw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.5.tgz", + "integrity": "sha512-ypfC34F3RKXvCXBglGqGMsUSMKlgwd1HX9AOAlx9RoZZ6GaI42YHVeKpzg3JG+wpBUJYTG+NNZhqbDWL8tBZkw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.1.12", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.12.tgz", + "integrity": "sha512-cMoR+FoAf/Jyq6+Df2/Z41jISvGZZ2eTlnsaJRptmZ76Caldwy1odD4xTr/gNV9VLj0AWgg/nmkevIyUfIIq5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.0.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.1.9", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.1.9.tgz", + "integrity": "sha512-qXRuZaOsAdXKFyOhRBg6Lqqc0yay13vN7KrIg4L7N4aaHN68ma9OK3NE1BoDFgFOTfM7zg+3/8+2n8rLUH3OKQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.0.0" + } + }, + "node_modules/@vitest/expect": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz", + "integrity": "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/spy": "3.2.4", + "@vitest/utils": "3.2.4", + "chai": "^5.2.0", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.4.tgz", + "integrity": "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "3.2.4", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.17" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.7.tgz", + "integrity": "sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.4.tgz", + "integrity": "sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "3.2.4", + "pathe": "^2.0.3", + "strip-literal": "^3.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.4.tgz", + "integrity": "sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.4", + "magic-string": "^0.30.17", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot/node_modules/@vitest/pretty-format": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.4.tgz", + "integrity": "sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.4.tgz", + "integrity": "sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^4.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.4.tgz", + "integrity": "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.4", + "loupe": "^3.1.4", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils/node_modules/@vitest/pretty-format": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.4.tgz", + "integrity": "sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/anynum": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/anynum/-/anynum-1.0.1.tgz", + "integrity": "sha512-N6//FLET/tXYNM/F6ABca1oH6fWB+KlTt909Le28WMDBk8oaT4vY17DCrwg2MvmuqUKt3Ni4N5dGJ/EoBgcO6A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/chai": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.3.3.tgz", + "integrity": "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/check-error": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.3.tgz", + "integrity": "sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/fast-xml-builder": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.3.1.tgz", + "integrity": "sha512-pIM/1n3ntFXKYrUZwW7QCK0gAW7XY+wzj1YMIV3tLDvPj/V+zTGJK5e3/4WJfwj0qWw2ElNXiTixda/R+3YSug==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "path-expression-matcher": "^1.6.2", + "xml-naming": "^0.3.0" + } + }, + "node_modules/fast-xml-parser": { + "version": "5.11.2", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.11.2.tgz", + "integrity": "sha512-R9iDuNrQYeQut46cn2r2wHKn4HYzVDvDm5J1wW+koZewykv0yuO2HChTYeZtrULyHIDM9cj9TUXloCsueCQUog==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "@nodable/entities": "^3.0.1", + "fast-xml-builder": "^1.2.0", + "is-unsafe": "^2.0.0", + "path-expression-matcher": "^1.6.2", + "strnum": "^2.4.2", + "xml-naming": "^0.3.0" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/is-unsafe": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-unsafe/-/is-unsafe-2.0.2.tgz", + "integrity": "sha512-HgbIHPBH0KHHCcjLfGsCvhtPTVxjaAZlXjwdz7/GQC40SjSe4sfQsar8J5VFo8JOSbarkpV0OLG95bbaNd9aAQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, + "node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/loupe": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz", + "integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.19", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz", + "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/path-expression-matcher": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.6.2.tgz", + "integrity": "sha512-enSlaiat05iasnzmgNxRj8reFdj3puY2QpNgP1aPIaVfT6nn9ICuPoFlKHk8EN22HcwewshO+mN2DGbkCEOtqQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathval": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz", + "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/react": { + "version": "19.1.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.1.1.tgz", + "integrity": "sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.1.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.1.tgz", + "integrity": "sha512-Dlq/5LAZgF0Gaz6yiqZCf6VCcZs1ghAJyrsu84Q/GT0gV+mCxbfmKNoGRKBYMJ8IEdGPqu49YWXD02GCknEDkw==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.26.0" + }, + "peerDependencies": { + "react": "^19.1.1" + } + }, + "node_modules/rollup": { + "version": "4.63.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.5.tgz", + "integrity": "sha512-KRWwmNLlPw5M7HcdYfm15oBv9n9LPtjzpzCIxS/phwqvPyxHSoKX6Y2YU3pxSPfy0CLquVgsx/j/hBi6OvH1Nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.63.5", + "@rollup/rollup-android-arm64": "4.63.5", + "@rollup/rollup-darwin-arm64": "4.63.5", + "@rollup/rollup-darwin-x64": "4.63.5", + "@rollup/rollup-freebsd-arm64": "4.63.5", + "@rollup/rollup-freebsd-x64": "4.63.5", + "@rollup/rollup-linux-arm-gnueabihf": "4.63.5", + "@rollup/rollup-linux-arm-musleabihf": "4.63.5", + "@rollup/rollup-linux-arm64-gnu": "4.63.5", + "@rollup/rollup-linux-arm64-musl": "4.63.5", + "@rollup/rollup-linux-loong64-gnu": "4.63.5", + "@rollup/rollup-linux-loong64-musl": "4.63.5", + "@rollup/rollup-linux-ppc64-gnu": "4.63.5", + "@rollup/rollup-linux-ppc64-musl": "4.63.5", + "@rollup/rollup-linux-riscv64-gnu": "4.63.5", + "@rollup/rollup-linux-riscv64-musl": "4.63.5", + "@rollup/rollup-linux-s390x-gnu": "4.63.5", + "@rollup/rollup-linux-x64-gnu": "4.63.5", + "@rollup/rollup-linux-x64-musl": "4.63.5", + "@rollup/rollup-openbsd-x64": "4.63.5", + "@rollup/rollup-openharmony-arm64": "4.63.5", + "@rollup/rollup-win32-arm64-msvc": "4.63.5", + "@rollup/rollup-win32-ia32-msvc": "4.63.5", + "@rollup/rollup-win32-x64-gnu": "4.63.5", + "@rollup/rollup-win32-x64-msvc": "4.63.5", + "fsevents": "~2.3.2" + } + }, + "node_modules/scheduler": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz", + "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==", + "license": "MIT" + }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, + "node_modules/std-env": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", + "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==", + "dev": true, + "license": "MIT" + }, + "node_modules/strip-literal": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.1.0.tgz", + "integrity": "sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/strnum": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.4.2.tgz", + "integrity": "sha512-rDG3Ah4TV0k1hWvLSzkZtMmLN9+eS+h3knq4MP6A42Y3Yh5qGNnOUs1jJkoSr8FG5dsL28c7KgkIBzSEykqtuw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "anynum": "^1.0.1" + } + }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinypool": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", + "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", + "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.6.tgz", + "integrity": "sha512-u8KszXvGfU68hVcZpRHKG28T0krMuv2G5nDhiHaMLen/gIuFEgIJhaJuO69qjnXg5paSrbPMFfx3brNuN8eVSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/typescript": { + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", + "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/vite": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.5.tgz", + "integrity": "sha512-4cKBO9wR75r0BeIWWWId9XK9Lj6La5X846Zw9dFfzMRw38IlTk2iCcUt6hsyiDRcPidc55ZParFYDXi0nXOeLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz", + "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.4.1", + "es-module-lexer": "^1.7.0", + "pathe": "^2.0.3", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vitest": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.4.tgz", + "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/expect": "3.2.4", + "@vitest/mocker": "3.2.4", + "@vitest/pretty-format": "^3.2.4", + "@vitest/runner": "3.2.4", + "@vitest/snapshot": "3.2.4", + "@vitest/spy": "3.2.4", + "@vitest/utils": "3.2.4", + "chai": "^5.2.0", + "debug": "^4.4.1", + "expect-type": "^1.2.1", + "magic-string": "^0.30.17", + "pathe": "^2.0.3", + "picomatch": "^4.0.2", + "std-env": "^3.9.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.14", + "tinypool": "^1.1.1", + "tinyrainbow": "^2.0.0", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0", + "vite-node": "3.2.4", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/debug": "^4.1.12", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@vitest/browser": "3.2.4", + "@vitest/ui": "3.2.4", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/debug": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/xml-naming": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/xml-naming/-/xml-naming-0.3.0.tgz", + "integrity": "sha512-ghig2TBE/H11aOVgmahA3MhimvkBr6JIYknH/Dhdk10nXwdbIqBJsbfMxpvFPG8bAw77gN29aQWvKpmVoPlvPQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "engines": { + "node": ">=16.0.0" + } + } + } +} diff --git a/phishell/src/shell/packageObservation.ts b/phishell/src/shell/packageObservation.ts index c5d6afae..07466666 100644 --- a/phishell/src/shell/packageObservation.ts +++ b/phishell/src/shell/packageObservation.ts @@ -6,11 +6,11 @@ export interface PackageRow { } export interface PackageObservationSnapshot { schemaVersion: "phios.package-observation.v1"; - source: "dpkg-status-file" | "fixture"; + source: "dpkg-status-file" | "pacman-local-desc" | "fixture"; capturedAt: string; availability: "available" | "unavailable"; reason: null | "non-linux-host" | "os-release-unavailable" | "unsupported-package-database" | "package-database-unavailable" | "transport-unavailable"; - adapter: "debian-dpkg-status"; + adapter: "debian-dpkg-status" | "arch-pacman-local"; packageLimit: 64; readOnly: true; executionAuthority: false; @@ -29,8 +29,8 @@ function num(v:unknown):v is number{return typeof v==="number"&&Number.isFinite( function int(v:unknown):v is number{return typeof v==="number"&&Number.isInteger(v)} function native(v:unknown):v is PackageObservationSnapshot{ if(!rec(v)) return false; - if(v.schemaVersion!=="phios.package-observation.v1"||v.source!=="dpkg-status-file"||typeof v.capturedAt!=="string"||Number.isNaN(Date.parse(v.capturedAt))|| - !["available","unavailable"].includes(String(v.availability))||v.adapter!=="debian-dpkg-status"||v.packageLimit!==64|| + if(v.schemaVersion!=="phios.package-observation.v1"||!((v.source==="dpkg-status-file"&&v.adapter==="debian-dpkg-status")||(v.source==="pacman-local-desc"&&v.adapter==="arch-pacman-local"))||typeof v.capturedAt!=="string"||Number.isNaN(Date.parse(v.capturedAt))|| + !["available","unavailable"].includes(String(v.availability))||v.packageLimit!==64|| v.readOnly!==true||v.executionAuthority!==false||v.effectPerformed!==false||!int(v.totalInstalledPackageCount)||v.totalInstalledPackageCount<0|| !Array.isArray(v.packages)||v.packages.length>64||v.packages.length>v.totalInstalledPackageCount) return false; if(v.availability==="available"&&v.reason!==null) return false; diff --git a/tests/test_linux_release_foundation.py b/tests/test_linux_release_foundation.py new file mode 100644 index 00000000..44db3e02 --- /dev/null +++ b/tests/test_linux_release_foundation.py @@ -0,0 +1,80 @@ +from __future__ import annotations + +import importlib.util +import json +from pathlib import Path +from types import SimpleNamespace + +import pytest + +from phios.desktop.install import PhiDesktopInstaller +from phios.shell.phi_router import route_command + +REPO = Path(__file__).resolve().parents[1] +spec = importlib.util.spec_from_file_location("prepare_profile", REPO / "packaging/linux/prepare_profile.py") +assert spec is not None and spec.loader is not None +profile = importlib.util.module_from_spec(spec) +spec.loader.exec_module(profile) + + +def test_incomplete_template_rejected_without_output(tmp_path: Path) -> None: + with pytest.raises(ValueError, match="complete Archiso"): + profile.prepare(tmp_path / "missing", tmp_path / "output", REPO, tmp_path, smoke=False) + assert not (tmp_path / "output").exists() + + +def test_profile_drops_root_autologin_and_keeps_required_boot_inputs(tmp_path: Path) -> None: + upstream = tmp_path / "upstream" + inputs = { + "profiledef.sh": "upstream identity", + "efiboot/loader/entries/01-archiso-linux.conf": "title Arch Linux\noptions archisobasedir=%INSTALL_DIR% archisosearchuuid=%ARCHISO_UUID%\n", + "airootfs/etc/mkinitcpio.conf.d/archiso.conf": "HOOKS=(base udev archiso filesystems)\n", + "airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf": "root autologin", + } + for name, text in inputs.items(): + path = upstream / name + path.parent.mkdir(parents=True, exist_ok=True) + path.write_text(text) + destination = tmp_path / "candidate" + profile.prepare(upstream, destination, REPO, tmp_path / "packages", smoke=False) + assert "uefi.systemd-boot" in (destination / "profiledef.sh").read_text() + assert "%ARCHISO_UUID%" in (destination / "efiboot/loader/entries/01-archiso-linux.conf").read_text() + assert not (destination / "airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf").exists() + assert not (destination / "airootfs/usr/local/bin/phios-live-smoke").exists() + assert "user = \"phios\"" in (destination / "airootfs/etc/greetd/config.toml").read_text() + for name, text in inputs.items(): + assert (upstream / name).read_text() == text + with pytest.raises(ValueError, match="refusing to overwrite"): + profile.prepare(upstream, destination, REPO, tmp_path, smoke=False) + + +def test_missing_desktop_dependencies_never_claim_applied(tmp_path: Path, monkeypatch) -> None: + monkeypatch.setattr("shutil.which", lambda _: None) + installer = PhiDesktopInstaller() + installer.config_dir = tmp_path + installer.wayfire_ini = tmp_path / "wayfire.ini" + installer.waybar_dir = tmp_path / "waybar" + result = installer.install(dry_run=False) + assert result["success"] is False + assert result["applied"] is False + assert not installer.wayfire_ini.exists() + + +def test_image_build_failure_reaches_process_exit_status(monkeypatch) -> None: + monkeypatch.setattr("phios.shell.phi_commands.subprocess.run", + lambda *args, **kwargs: SimpleNamespace(returncode=42, stdout="failed", stderr="")) + output, code = route_command(["build", "iso", "--yes"]) + assert code == 1 + assert "exit 42" in output + + +def test_current_image_status_hashes_candidate_without_claiming_release(tmp_path: Path, monkeypatch) -> None: + monkeypatch.chdir(tmp_path) + artifact = tmp_path / "dist/linux/phios-linux-0.1.0-alpha.1-x86_64.iso" + artifact.parent.mkdir(parents=True) + artifact.write_bytes(b"candidate") + output, code = route_command(["build", "status"]) + status = json.loads(output) + assert code == 0 and status["exists"] + assert len(status["sha256"]) == 64 + assert status["release_ready"] is False diff --git a/tests/test_v05_desktop.py b/tests/test_v05_desktop.py index 6a484d5c..470b6692 100644 --- a/tests/test_v05_desktop.py +++ b/tests/test_v05_desktop.py @@ -44,15 +44,17 @@ def test_color_palette_all_hex_valid(): def test_wayfire_config_contains_phi_keybindings(tmp_path): p = Path(WayfireConfigGenerator().generate(str(tmp_path / "wayfire.ini"))).read_text(encoding="utf-8") - assert "super_return = phi" in p - assert "super_l = phi coherence live" in p + assert "binding_terminal = KEY_ENTER" in p + assert "command_terminal = foot phi" in p + assert "command_coherence = foot phi coherence live" in p def test_wayfire_config_contains_3x3_workspaces(tmp_path): p = Path(WayfireConfigGenerator().generate(str(tmp_path / "wayfire.ini"))).read_text(encoding="utf-8") - assert "rows = 3" in p - assert "columns = 3" in p - assert "workspace_9 = 9" in p + assert "vheight = 3" in p + assert "vwidth = 3" in p + assert "[command]" in p + assert "waybar wofi" not in p def test_installer_detects_package_manager(monkeypatch): diff --git a/tests/test_v10_launch.py b/tests/test_v10_launch.py index 167f94c1..0f59cfbf 100644 --- a/tests/test_v10_launch.py +++ b/tests/test_v10_launch.py @@ -123,7 +123,7 @@ def test_distrowatch_submission_under_250_words() -> None: def test_distrowatch_has_gpl3() -> None: - assert "GPLv3" in LaunchArtifactGenerator().generate_distrowatch_submission() + assert "License: MIT" in LaunchArtifactGenerator().generate_distrowatch_submission() def test_distrowatch_has_manifesto_url() -> None: From a508b1e873901ff06a83e74120e66bdb655968f5 Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Wed, 30 Sep 2026 13:49:13 -0700 Subject: [PATCH 2/8] fix: use supported shell version command and preserve separate boot evidence --- .github/workflows/linux-image.yml | 17 ++++++++++++++++- packaging/linux/build-linux.sh | 2 +- packaging/linux/tests/live-smoke.sh | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux-image.yml b/.github/workflows/linux-image.yml index 8b0484f9..3ba16873 100644 --- a/.github/workflows/linux-image.yml +++ b/.github/workflows/linux-image.yml @@ -39,7 +39,7 @@ jobs: -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 + "$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 @@ -62,3 +62,18 @@ jobs: ${{ 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 diff --git a/packaging/linux/build-linux.sh b/packaging/linux/build-linux.sh index 398b465c..ed860634 100755 --- a/packaging/linux/build-linux.sh +++ b/packaging/linux/build-linux.sh @@ -37,7 +37,7 @@ for package in phios phishell; do cp "$work/$package/"*.pkg.tar.zst "$work/packages/" pacman -U --noconfirm "$work/$package/"*.pkg.tar.zst done -(cd /tmp; python -c 'import phios, phios.mcp.server, phios.ghostwalk_operator; assert phios.__file__.startswith("/usr/lib/"); print(phios.__version__)'; phi --version; phi-operator --help) +(cd /tmp; python -c 'import phios, phios.mcp.server, phios.ghostwalk_operator; assert phios.__file__.startswith("/usr/lib/"); print(phios.__version__)'; phi version; phi-operator --help) node "$repo/phishell/host/packageObserver.mjs" --require-native repo-add "$work/packages/phios-local.db.tar.gz" "$work/packages/"*.pkg.tar.zst smoke_args=() diff --git a/packaging/linux/tests/live-smoke.sh b/packaging/linux/tests/live-smoke.sh index bb5158e2..91c23243 100755 --- a/packaging/linux/tests/live-smoke.sh +++ b/packaging/linux/tests/live-smoke.sh @@ -25,5 +25,5 @@ for endpoint in decisions bindings leases; do done runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 systemctl --user is-active phios-observer.service phios-browser.service phios-curiosity-reader.service python -c 'import phios, phios.mcp.server, phios.ghostwalk_operator; print("Installed Python runtime:",phios.__version__)' -phi --version +phi version printf 'PHIOS_BOOT_OK:%s\n' "$(cat /usr/share/phios/source-commit)" From 61bef11b0a4c38488e4a1516ed0fffc12ffcfc78 Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Wed, 30 Sep 2026 13:55:36 -0700 Subject: [PATCH 3/8] fix: accept pacman epoch versions and report current source license --- phios/shell/phi_commands.py | 2 +- phishell/host/packageObserver.mjs | 2 +- phishell/host/packageObserver.test.mjs | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/phios/shell/phi_commands.py b/phios/shell/phi_commands.py index f8feab92..a18192f0 100644 --- a/phios/shell/phi_commands.py +++ b/phios/shell/phi_commands.py @@ -2212,7 +2212,7 @@ def cmd_version(_: list[str], session: object | None = None) -> str: "PhiOS v0.1.0 (compat)", "PHI369 Labs / Parallax", "Sovereign. Coherent. Local. Free.", - "License: GPL-3.0", + "License: MIT (PhiOS source; bundled packages retain their own licenses)", ] ) diff --git a/phishell/host/packageObserver.mjs b/phishell/host/packageObserver.mjs index e3e2dc49..0eb0d4b4 100644 --- a/phishell/host/packageObserver.mjs +++ b/phishell/host/packageObserver.mjs @@ -157,7 +157,7 @@ export async function collectPackageObservation({ if (!Array.isArray(entries) || entries.length > DATABASE_ENTRY_LIMIT) throw new Error("database entry limit exceeded"); installed = []; for (const entry of entries.sort()) { - if (typeof entry !== "string" || !/^[a-zA-Z0-9@+_.-]{1,300}$/.test(entry) || [".", ".."].includes(entry)) { + if (typeof entry !== "string" || !/^[a-zA-Z0-9@+_.:~-]{1,512}$/.test(entry) || [".", ".."].includes(entry)) { throw new Error("invalid database entry"); } const pkg = parsePacmanDescription(await readPacmanText(`${PACMAN_LOCAL_PATH}/${entry}/desc`)); diff --git a/phishell/host/packageObserver.test.mjs b/phishell/host/packageObserver.test.mjs index 018a6795..bc2e9ad0 100644 --- a/phishell/host/packageObserver.test.mjs +++ b/phishell/host/packageObserver.test.mjs @@ -39,6 +39,19 @@ test("Arch corrupt or changing database never reports a partial inventory as ava assert.equal(parsePacmanDescription("x".repeat(8193)), null); }); +test("Arch epoch versions use colons in the local database directory", async () => { + const result = await collectPackageObservation({ + readText: async () => "ID=arch\n", + listPacmanEntries: async () => ["python-setuptools-1:84.0.0-1"], + readPacmanText: async path => { + assert.equal(path, "/var/lib/pacman/local/python-setuptools-1:84.0.0-1/desc"); + return "%NAME%\npython-setuptools\n\n%VERSION%\n1:84.0.0-1\n\n%ARCH%\nany\n"; + }, + }); + assert.equal(result.availability, "available"); + assert.equal(result.packages[0].version, "1:84.0.0-1"); +}); + test("dpkg parser keeps installed package identity only", () => { const parsed = parseDpkgStatus(` Package: alpha From ce112688a5836764d61465ef7ac84bb978b08309 Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Wed, 30 Sep 2026 14:06:52 -0700 Subject: [PATCH 4/8] fix: complete Archiso hook dependencies and reject incomplete initramfs builds --- packaging/linux/build-linux.sh | 9 +++++++-- packaging/linux/packages.x86_64 | 4 ++++ phishell/host/packageObserver.mjs | 7 ++++--- phishell/host/packageObserver.test.mjs | 3 ++- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/packaging/linux/build-linux.sh b/packaging/linux/build-linux.sh index ed860634..789d78ae 100755 --- a/packaging/linux/build-linux.sh +++ b/packaging/linux/build-linux.sh @@ -43,7 +43,13 @@ repo-add "$work/packages/phios-local.db.tar.gz" "$work/packages/"*.pkg.tar.zst smoke_args=() [[ ${PHIOS_CI_SMOKE:-0} == 1 ]] && smoke_args+=(--smoke) python "$repo/packaging/linux/prepare_profile.py" --upstream /usr/share/archiso/configs/releng --destination "$work/profile" --repo "$repo" --package-repo "$work/packages" "${smoke_args[@]}" -mkarchiso -v -w "$work/archiso-work" -o "$output" "$work/profile" +mkarchiso -v -w "$work/archiso-work" -o "$output" "$work/profile" 2>&1 | tee "$output/mkarchiso.log" +# Pacman hooks can print an initramfs error while the package transaction and +# mkarchiso still return zero. Preserve it and hold the candidate explicitly. +if grep -Eq '==> ERROR:|error: command failed to execute correctly' "$output/mkarchiso.log"; then + echo 'Image contains a failed build hook; candidate qualification is held.' >&2 + exit 1 +fi cp "$work/packages/"*.pkg.tar.zst "$output/" cp "$work/phios-source.tar.gz" "$output/" cp "$repo/packaging/linux/release.json" "$output/" @@ -51,7 +57,6 @@ pacman -Q > "$output/builder-packages.txt" pacman --root "$work/archiso-work/x86_64/airootfs" -Q > "$output/image-packages.txt" printf '%s\n' "$PHIOS_SOURCE_COMMIT" > "$output/source-commit.txt" printf '%s\n' "$PHIOS_SOURCE_SHA256" > "$output/source-archive-sha256.txt" -cp "$work/archiso-work/x86_64/airootfs/var/log/pacman.log" "$output/image-pacman.log" cp "$repo/LICENSE_HISTORY.md" "$output/LICENSE_HISTORY.md" (cd "$output"; sha256sum ./*.iso ./*.pkg.tar.zst ./*.tar.gz > SHA256SUMS) echo "Unsigned development candidate and provenance: $output" diff --git a/packaging/linux/packages.x86_64 b/packaging/linux/packages.x86_64 index f33abfe2..52cc6d85 100644 --- a/packaging/linux/packages.x86_64 +++ b/packaging/linux/packages.x86_64 @@ -3,6 +3,10 @@ linux linux-firmware mkinitcpio mkinitcpio-archiso +mkinitcpio-nfs-utils +nbd +syslinux +pv systemd systemd-sysvcompat mesa diff --git a/phishell/host/packageObserver.mjs b/phishell/host/packageObserver.mjs index 0eb0d4b4..3ee5568a 100644 --- a/phishell/host/packageObserver.mjs +++ b/phishell/host/packageObserver.mjs @@ -7,6 +7,7 @@ const PACKAGE_LIMIT = 64; const MAX_NAME = 128; const MAX_VERSION = 256; const MAX_ARCH = 64; +const MAX_DESC_BYTES = 64 * 1024; function boundedText(value, max) { if (typeof value !== "string") return ""; @@ -92,7 +93,7 @@ const PACMAN_LOCAL_PATH = "/var/lib/pacman/local"; const DATABASE_ENTRY_LIMIT = 20000; export function parsePacmanDescription(text) { - if (typeof text !== "string" || Buffer.byteLength(text) > 8192) return null; + if (typeof text !== "string" || Buffer.byteLength(text) > MAX_DESC_BYTES) return null; const fields = new Map(); const lines = text.split("\n"); for (let i = 0; i < lines.length; i++) { @@ -113,9 +114,9 @@ export function parsePacmanDescription(text) { async function readBoundedDescription(path) { const file = await open(path, "r"); try { - const buffer = Buffer.alloc(8193); + const buffer = Buffer.alloc(MAX_DESC_BYTES + 1); const { bytesRead } = await file.read(buffer, 0, buffer.length, 0); - if (bytesRead > 8192) throw new Error("package description too large"); + if (bytesRead > MAX_DESC_BYTES) throw new Error("package description too large"); return buffer.subarray(0, bytesRead).toString("utf8"); } finally { await file.close(); } } diff --git a/phishell/host/packageObserver.test.mjs b/phishell/host/packageObserver.test.mjs index bc2e9ad0..b49eec12 100644 --- a/phishell/host/packageObserver.test.mjs +++ b/phishell/host/packageObserver.test.mjs @@ -36,7 +36,8 @@ test("Arch corrupt or changing database never reports a partial inventory as ava assert.equal(result.reason, "package-database-unavailable"); assert.deepEqual(result.packages, []); } - assert.equal(parsePacmanDescription("x".repeat(8193)), null); + assert.equal(parsePacmanDescription("x".repeat(65537)), null); + assert.equal(parsePacmanDescription("%NAME%\nlarge\n%VERSION%\n1.0\n%ARCH%\nany\n%DESC%\n" + "x".repeat(31000)).name, "large"); }); test("Arch epoch versions use colons in the local database directory", async () => { From 1dd9bb5e810a7e2c50d1fb51fe16ca79f9d2ae97 Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Wed, 30 Sep 2026 14:26:08 -0700 Subject: [PATCH 5/8] fix: configure live first boot and carry native Arch observations through all contracts --- .github/workflows/linux-image.yml | 7 +- docs/os/BUILD_AND_QUALIFY.md | 7 +- packaging/linux/prepare_profile.py | 7 + packaging/linux/tests/live-smoke.sh | 1 + packaging/linux/tests/qemu_boot.py | 41 +++--- phios/memory/system_history_comparison.py | 4 +- .../contracts/package-observation.schema.json | 130 +++++++++++++++++- phishell/host/localTransportBuiltCheck.mjs | 8 +- phishell/host/systemStateComposer.test.mjs | 31 +++++ phishell/host/systemStateContract.mjs | 5 +- .../components/PackageObservationPanel.tsx | 4 +- phishell/src/shell/packageObservation.test.ts | 6 + phishell/src/shell/systemState.test.ts | 19 +++ phishell/src/shell/systemState.ts | 3 +- tests/test_linux_release_foundation.py | 3 + tests/test_system_history_comparison.py | 33 +++++ 16 files changed, 281 insertions(+), 28 deletions(-) diff --git a/.github/workflows/linux-image.yml b/.github/workflows/linux-image.yml index 3ba16873..d1be38a2 100644 --- a/.github/workflows/linux-image.yml +++ b/.github/workflows/linux-image.yml @@ -49,7 +49,12 @@ jobs: --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" - /usr/bin/python3 -c 'from PIL import Image; import os; Image.open(os.environ["RUNNER_TEMP"] + "/phios-boot/screen.ppm").save(os.environ["RUNNER_TEMP"] + "/phios-boot/screen.png")' + - 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; import os; Image.open(os.environ["RUNNER_TEMP"] + "/phios-boot/screen.ppm").save(os.environ["RUNNER_TEMP"] + "/phios-boot/screen.png")' + fi - name: Preserve candidate and qualification evidence if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 diff --git a/docs/os/BUILD_AND_QUALIFY.md b/docs/os/BUILD_AND_QUALIFY.md index 2b345d89..a43d5808 100644 --- a/docs/os/BUILD_AND_QUALIFY.md +++ b/docs/os/BUILD_AND_QUALIFY.md @@ -43,12 +43,13 @@ it is the internal root-container entrypoint and rewrites its builder environmen The Actions artifact includes the ISO, local packages, source archive/hash, source commit, fixed release inputs, builder image identity, builder and image -package inventories, pacman log, license history and SHA256SUMS. The CI-only +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 and native package observation, verifies private state permissions, +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 exact source marker, -ISO hash, VM command, serial log and screen capture are preserved. This fixture +ISO hash, VM command, serial log and screen capture are preserved, including a +display capture on failed qualification when QEMU is still running. This fixture is omitted from normal locally built previews. A fixture pass is evidence for the checks it performs. Review the screenshot diff --git a/packaging/linux/prepare_profile.py b/packaging/linux/prepare_profile.py index 4585bae7..e0c2d52f 100644 --- a/packaging/linux/prepare_profile.py +++ b/packaging/linux/prepare_profile.py @@ -92,6 +92,13 @@ def write(name: str, content: str) -> None: (destination / "efiboot/loader/loader.conf").write_text("default 01-archiso-linux.conf\ntimeout 1\n") write("etc/hostname", "phios-live\n") write("etc/locale.conf", "LANG=C.UTF-8\n") + write("etc/vconsole.conf", "KEYMAP=us\n") + (root / "etc/localtime").symlink_to("/usr/share/zoneinfo/UTC") + # Releng masks this interactive first-boot wizard. Keep that behavior for + # a configured volatile live session rather than blocking graphical.target. + firstboot = root / "etc/systemd/system/systemd-firstboot.service" + firstboot.parent.mkdir(parents=True, exist_ok=True) + firstboot.symlink_to("/dev/null") write("etc/sysusers.d/phios-live.conf", 'u phios 1000 "PhiOS Live" /home/phios /bin/bash\n' 'u phios-agent 1001 "Reserved isolated agent" /var/lib/phios-agent /usr/bin/nologin\n' 'u phios-greeter - "PhiOS Greeter" /var/lib/phios-greeter /usr/bin/nologin\n') diff --git a/packaging/linux/tests/live-smoke.sh b/packaging/linux/tests/live-smoke.sh index 91c23243..bbf30fc0 100755 --- a/packaging/linux/tests/live-smoke.sh +++ b/packaging/linux/tests/live-smoke.sh @@ -11,6 +11,7 @@ for attempt in {1..420}; do done curl -fsS http://127.0.0.1:3969/ | grep -q '
' curl -fsS http://127.0.0.1:3969/api/v1/package-observation | python -c 'import json,sys; p=json.load(sys.stdin)["observation"]; assert p["adapter"]=="arch-pacman-local" and p["availability"]=="available" and not p["executionAuthority"] and not p["effectPerformed"]' +curl -fsS http://127.0.0.1:3969/api/v1/system-state | python -c 'import json,sys; r=json.load(sys.stdin)["receipt"]; p=next(c for c in r["components"] if c["id"]=="packages"); assert p["source"]=="pacman-local-desc" and p["availability"]=="available" and r["readOnly"] and not r["executionAuthority"] and not r["effectPerformed"]' test "$(id -u phios)" = 1000 test "$(stat -c %a /home/phios/.local/state/phios)" = 700 ! id -nG phios | grep -qw wheel diff --git a/packaging/linux/tests/qemu_boot.py b/packaging/linux/tests/qemu_boot.py index 9f5197fa..d449af9f 100644 --- a/packaging/linux/tests/qemu_boot.py +++ b/packaging/linux/tests/qemu_boot.py @@ -12,6 +12,25 @@ from pathlib import Path +def capture_display(qmp_path: Path, output: Path) -> None: + with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client: + client.settimeout(15) + client.connect(str(qmp_path)) + stream = client.makefile("rwb") + json.loads(stream.readline()) + for request in [{"execute": "qmp_capabilities"}, + {"execute": "screendump", "arguments": { + "filename": str((output / "screen.ppm").resolve())}}]: + stream.write(json.dumps(request).encode() + b"\n") + stream.flush() + while True: + response = json.loads(stream.readline()) + if "error" in response: + raise RuntimeError(f"QMP evidence capture failed: {response['error']}") + if "return" in response: + break + + def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: if re.fullmatch(r"[0-9a-f]{40}", source) is None or not iso.is_file(): raise ValueError("an existing ISO and exact source commit are required") @@ -56,25 +75,15 @@ def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: time.sleep(1) else: raise RuntimeError("UEFI boot/session qualification timed out") - with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client: - client.settimeout(15) - client.connect(str(qmp_path)) - stream = client.makefile("rwb") - json.loads(stream.readline()) - for request in [{"execute": "qmp_capabilities"}, - {"execute": "screendump", "arguments": { - "filename": str((output / "screen.ppm").resolve())}}]: - stream.write(json.dumps(request).encode() + b"\n") - stream.flush() - while True: - response = json.loads(stream.readline()) - if "error" in response: - raise RuntimeError(f"QMP evidence capture failed: {response['error']}") - if "return" in response: - break + capture_display(qmp_path, output) receipt["boot_passed"] = True print(f"UEFI live boot and non-root session passed for ISO {receipt['iso_sha256']}") finally: + if not (output / "screen.ppm").exists() and process.poll() is None: + try: + capture_display(qmp_path, output) + except (OSError, ValueError, RuntimeError) as exc: + receipt["display_capture_error"] = str(exc) process.terminate() try: process.wait(timeout=15) diff --git a/phios/memory/system_history_comparison.py b/phios/memory/system_history_comparison.py index 3095a4a5..0a74c592 100644 --- a/phios/memory/system_history_comparison.py +++ b/phios/memory/system_history_comparison.py @@ -111,7 +111,9 @@ def _comparable_state_payload( expected_schema, expected_source = COMPONENT_CONTRACTS[expected_id] if component.get("schemaVersion") != expected_schema: raise ValueError(f"component {expected_id} schema is not canonical") - if component.get("source") != expected_source: + if component.get("source") != expected_source and not ( + expected_id == "packages" and component.get("source") == "pacman-local-desc" + ): raise ValueError(f"component {expected_id} source is not canonical") _timestamp(component.get("capturedAt"), f"component {expected_id} capturedAt") if component.get("readOnly") is not True: diff --git a/phishell/contracts/package-observation.schema.json b/phishell/contracts/package-observation.schema.json index cceaa1e9..86930874 100644 --- a/phishell/contracts/package-observation.schema.json +++ b/phishell/contracts/package-observation.schema.json @@ -1 +1,129 @@ -{"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"phios.package-observation.v1","type":"object","required":["schemaVersion","source","capturedAt","availability","reason","adapter","packageLimit","readOnly","executionAuthority","effectPerformed","distro","totalInstalledPackageCount","packages"],"properties":{"schemaVersion":{"const":"phios.package-observation.v1"},"source":{"const":"dpkg-status-file"},"capturedAt":{"type":"string","format":"date-time"},"availability":{"enum":["available","unavailable"]},"reason":{"type":["string","null"]},"adapter":{"const":"debian-dpkg-status"},"packageLimit":{"const":64},"readOnly":{"const":true},"executionAuthority":{"const":false},"effectPerformed":{"const":false},"distro":{"type":["object","null"]},"totalInstalledPackageCount":{"type":"integer","minimum":0},"packages":{"type":"array","maxItems":64,"items":{"type":"object","required":["name","version","architecture","essential"],"properties":{"name":{"type":"string","maxLength":128},"version":{"type":"string","maxLength":256},"architecture":{"type":"string","maxLength":64},"essential":{"type":"boolean"}},"additionalProperties":false}}},"additionalProperties":false} \ No newline at end of file +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "phios.package-observation.v1", + "type": "object", + "required": [ + "schemaVersion", + "source", + "capturedAt", + "availability", + "reason", + "adapter", + "packageLimit", + "readOnly", + "executionAuthority", + "effectPerformed", + "distro", + "totalInstalledPackageCount", + "packages" + ], + "properties": { + "schemaVersion": { + "const": "phios.package-observation.v1" + }, + "source": { + "enum": [ + "dpkg-status-file", + "pacman-local-desc" + ] + }, + "capturedAt": { + "type": "string", + "format": "date-time" + }, + "availability": { + "enum": [ + "available", + "unavailable" + ] + }, + "reason": { + "type": [ + "string", + "null" + ] + }, + "adapter": { + "enum": [ + "debian-dpkg-status", + "arch-pacman-local" + ] + }, + "packageLimit": { + "const": 64 + }, + "readOnly": { + "const": true + }, + "executionAuthority": { + "const": false + }, + "effectPerformed": { + "const": false + }, + "distro": { + "type": [ + "object", + "null" + ] + }, + "totalInstalledPackageCount": { + "type": "integer", + "minimum": 0 + }, + "packages": { + "type": "array", + "maxItems": 64, + "items": { + "type": "object", + "required": [ + "name", + "version", + "architecture", + "essential" + ], + "properties": { + "name": { + "type": "string", + "maxLength": 128 + }, + "version": { + "type": "string", + "maxLength": 256 + }, + "architecture": { + "type": "string", + "maxLength": 64 + }, + "essential": { + "type": "boolean" + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false, + "anyOf": [ + { + "properties": { + "source": { + "const": "dpkg-status-file" + }, + "adapter": { + "const": "debian-dpkg-status" + } + } + }, + { + "properties": { + "source": { + "const": "pacman-local-desc" + }, + "adapter": { + "const": "arch-pacman-local" + } + } + } + ] +} diff --git a/phishell/host/localTransportBuiltCheck.mjs b/phishell/host/localTransportBuiltCheck.mjs index d5de00b5..d84ec884 100644 --- a/phishell/host/localTransportBuiltCheck.mjs +++ b/phishell/host/localTransportBuiltCheck.mjs @@ -126,8 +126,12 @@ try { assert.equal(packageEnvelope.readOnly, true); assert.equal(packageEnvelope.executionAuthority, false); assert.equal(packageEnvelope.effectPerformed, false); - assert.equal(packageEnvelope.observation.source, "dpkg-status-file"); - assert.equal(packageEnvelope.observation.adapter, "debian-dpkg-status"); + assert.ok( + (packageEnvelope.observation.source === "dpkg-status-file" && + packageEnvelope.observation.adapter === "debian-dpkg-status") || + (packageEnvelope.observation.source === "pacman-local-desc" && + packageEnvelope.observation.adapter === "arch-pacman-local"), + ); assert.ok(packageEnvelope.observation.packages.length <= 64); const deviceObservation = await fetch(`${base}/api/v1/device-observation`); diff --git a/phishell/host/systemStateComposer.test.mjs b/phishell/host/systemStateComposer.test.mjs index 14d727b5..c679ae9a 100644 --- a/phishell/host/systemStateComposer.test.mjs +++ b/phishell/host/systemStateComposer.test.mjs @@ -10,6 +10,37 @@ import { import { collectLinuxHostObservation } from "./linuxProbe.mjs"; import { assertValidSystemStateReceipt } from "./systemStateContract.mjs"; +test("native Arch package observation survives unified composition without extending other planes", async () => { + const receipt = await composeSystemStateReceipt({ + collectPackages: async () => ({ + schemaVersion: "phios.package-observation.v1", + source: "pacman-local-desc", + capturedAt: new Date().toISOString(), + availability: "available", + reason: null, + adapter: "arch-pacman-local", + packageLimit: 64, + readOnly: true, + executionAuthority: false, + effectPerformed: false, + distro: { id: "phios", name: "PhiOS" }, + totalInstalledPackageCount: 1, + packages: [{ name: "phios", version: "1.0.0-1", architecture: "any", essential: false }], + }), + }); + assert.equal(receipt.components[3].source, "pacman-local-desc"); + assert.equal(receipt.summary.installedPackageCount, 1); + assert.equal(assertValidSystemStateReceipt(receipt), receipt); + const wrongPlane = structuredClone(receipt); + wrongPlane.components[0].source = "pacman-local-desc"; + wrongPlane.receiptDigest = recomputeSystemStateReceiptDigest(wrongPlane); + assert.throws(() => assertValidSystemStateReceipt(wrongPlane), /component source host/); + const unknownSource = structuredClone(receipt); + unknownSource.components[3].source = "unknown-package-source"; + unknownSource.receiptDigest = recomputeSystemStateReceiptDigest(unknownSource); + assert.throws(() => assertValidSystemStateReceipt(unknownSource), /component source packages/); +}); + test( "system state composer produces one bounded read-only receipt over all observation planes", { skip: process.platform !== "linux" }, diff --git a/phishell/host/systemStateContract.mjs b/phishell/host/systemStateContract.mjs index 3721ab41..342a90e5 100644 --- a/phishell/host/systemStateContract.mjs +++ b/phishell/host/systemStateContract.mjs @@ -145,7 +145,10 @@ export function validateSystemStateReceipt(receipt) { if (component.schemaVersion !== expected.schemaVersion) { errors.push(`component schema ${expectedId}`); } - if (component.source !== expected.source) errors.push(`component source ${expectedId}`); + if ( + component.source !== expected.source && + !(expectedId === "packages" && component.source === "pacman-local-desc") + ) errors.push(`component source ${expectedId}`); if (!validTimestamp(component.capturedAt)) errors.push(`component time ${expectedId}`); if (!["available", "unavailable"].includes(component.availability)) { errors.push(`component availability ${expectedId}`); diff --git a/phishell/src/components/PackageObservationPanel.tsx b/phishell/src/components/PackageObservationPanel.tsx index a8a6918d..406a08c3 100644 --- a/phishell/src/components/PackageObservationPanel.tsx +++ b/phishell/src/components/PackageObservationPanel.tsx @@ -5,9 +5,9 @@ export function PackageObservationPanel(){ const refresh=useCallback(async()=>{setBusy(true);try{setO(await packageObservationProvider.observe())}finally{setBusy(false)}},[]); useEffect(()=>{void refresh()},[refresh]); if(!o) return
Reading package inventory…
; - const live=o.source==="dpkg-status-file"; + const label=o.source==="pacman-local-desc"?"PACMAN LOCAL DATABASE":o.source==="dpkg-status-file"?"DPKG STATUS DATABASE":"FIXTURE FALLBACK"; return
-
PACKAGE INVENTORY · READ ONLY{live?"DPKG STATUS DATABASE":"FIXTURE FALLBACK"}
{o.totalInstalledPackageCount} INSTALLED
+
PACKAGE INVENTORY · READ ONLY{label}
{o.totalInstalledPackageCount} INSTALLED
{o.availability==="unavailable"&&
Package observation unavailable{o.reason?" · "+o.reason:""}. No package state is inferred.
} {o.distro&&
DISTRO{o.distro.name}{o.adapter}
}
PACKAGEVERSIONARCHESSENTIAL
{o.packages.map(p=>
{p.name}{p.version}{p.architecture}{p.essential?"YES":"NO"}
)}
diff --git a/phishell/src/shell/packageObservation.test.ts b/phishell/src/shell/packageObservation.test.ts index 25c95472..9e07a459 100644 --- a/phishell/src/shell/packageObservation.test.ts +++ b/phishell/src/shell/packageObservation.test.ts @@ -3,6 +3,12 @@ import {FIXTURE_PACKAGE_OBSERVATION,createPackageObservationProvider,isPackageTr function live(){return {...FIXTURE_PACKAGE_OBSERVATION,source:"dpkg-status-file" as const,capturedAt:new Date().toISOString(),availability:"available" as const,reason:null,distro:{id:"ubuntu",name:"Ubuntu"},totalInstalledPackageCount:1,packages:[{name:"base-files",version:"1.0",architecture:"amd64",essential:true}]}} function envelope(age=1){return {transportSchemaVersion:"phios.package-transport.v1",transport:"loopback-http",transportIdentity:"phishell-local-observer",localOnly:true,readOnly:true,executionAuthority:false,effectPerformed:false,servedAt:new Date().toISOString(),snapshotAgeMs:age,observation:live()}} describe("package observation transport",()=>{ + it("accepts native Arch inventory and rejects a mismatched adapter",async()=>{ + const payload={...envelope(),observation:{...live(),source:"pacman-local-desc",adapter:"arch-pacman-local",distro:{id:"phios",name:"PhiOS"}}}; + const p=createPackageObservationProvider({fetcher:async()=>new Response(JSON.stringify(payload),{status:200})}); + expect((await p.observe()).source).toBe("pacman-local-desc"); + expect(isPackageTransportEnvelope({...payload,observation:{...payload.observation,adapter:"debian-dpkg-status"}})).toBe(false); + }); it("accepts fresh bounded package metadata",async()=>{const p=createPackageObservationProvider({fetcher:async()=>new Response(JSON.stringify(envelope()),{status:200})});const o=await p.observe();expect(o.source).toBe("dpkg-status-file");expect(o.packages[0].essential).toBe(true);expect(o.executionAuthority).toBe(false)}); it("rejects package descriptions smuggled into rows",async()=>{const u=JSON.parse(JSON.stringify(envelope())) as {observation:{packages:Array>}};u.observation.packages[0].description="secretly too much";const p=createPackageObservationProvider({fetcher:async()=>new Response(JSON.stringify(u),{status:200})});expect((await p.observe()).source).toBe("fixture")}); it("rejects stale or authority-bearing envelopes",()=>{expect(isPackageTransportEnvelope(envelope(60000))).toBe(false);expect(isPackageTransportEnvelope({...envelope(),executionAuthority:true})).toBe(false)}); diff --git a/phishell/src/shell/systemState.test.ts b/phishell/src/shell/systemState.test.ts index c8663bc2..82db3562 100644 --- a/phishell/src/shell/systemState.test.ts +++ b/phishell/src/shell/systemState.test.ts @@ -80,6 +80,25 @@ async function envelope() { } describe("unified system state provider", () => { + it.each(["pacman-local-desc", "unknown-package-source"])( + "validates the package source %s through the unified state contract", + async (source) => { + const payload = await envelope(); + const components = payload.receipt.components as Array>; + components[3].source = source; + payload.receipt.receiptDigest = await digestBody(payload.receipt); + const provider = createSystemStateProvider({ + fetcher: async () => new Response(JSON.stringify(payload), { status: 200 }), + }); + const observed = await provider.observe(); + if (source === "pacman-local-desc") { + expect(observed?.components[3].source).toBe(source); + expect(observed?.executionAuthority).toBe(false); + } else { + expect(observed).toBeNull(); + } + }, + ); it("accepts a coherent digest-valid receipt", async () => { const payload = await envelope(); const provider = createSystemStateProvider({ diff --git a/phishell/src/shell/systemState.ts b/phishell/src/shell/systemState.ts index f8455154..96eabdb7 100644 --- a/phishell/src/shell/systemState.ts +++ b/phishell/src/shell/systemState.ts @@ -161,7 +161,8 @@ function isSystemStateReceipt(value: unknown): value is SystemStateReceipt { !exactKeys(component, componentKeys) || component.id !== expected.id || component.schemaVersion !== expected.schemaVersion || - component.source !== expected.source || + (component.source !== expected.source && + !(expected.id === "packages" && component.source === "pacman-local-desc")) || !isTimestamp(component.capturedAt) || !["available", "unavailable"].includes(String(component.availability)) || !isSha256(component.digest) || diff --git a/tests/test_linux_release_foundation.py b/tests/test_linux_release_foundation.py index 44db3e02..a8d468e9 100644 --- a/tests/test_linux_release_foundation.py +++ b/tests/test_linux_release_foundation.py @@ -42,6 +42,9 @@ def test_profile_drops_root_autologin_and_keeps_required_boot_inputs(tmp_path: P assert not (destination / "airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf").exists() assert not (destination / "airootfs/usr/local/bin/phios-live-smoke").exists() assert "user = \"phios\"" in (destination / "airootfs/etc/greetd/config.toml").read_text() + assert (destination / "airootfs/etc/systemd/system/systemd-firstboot.service").readlink() == Path("/dev/null") + assert (destination / "airootfs/etc/localtime").readlink() == Path("/usr/share/zoneinfo/UTC") + assert (destination / "airootfs/etc/vconsole.conf").read_text() == "KEYMAP=us\n" for name, text in inputs.items(): assert (upstream / name).read_text() == text with pytest.raises(ValueError, match="refusing to overwrite"): diff --git a/tests/test_system_history_comparison.py b/tests/test_system_history_comparison.py index c680ccdf..6296ec82 100644 --- a/tests/test_system_history_comparison.py +++ b/tests/test_system_history_comparison.py @@ -242,6 +242,39 @@ def test_comparison_derives_bounded_nonpersistent_differences(tmp_path: Path) -> assert ledger_after == ledger_before +@pytest.mark.parametrize("package_source", ["pacman-local-desc", "unknown-package-source"]) +def test_native_arch_package_history_preserves_source_contract( + tmp_path: Path, package_source: str, +) -> None: + runtime = _runtime(tmp_path / "memory") + previous = _state("2026-09-23T04:00:00+00:00", digest_char="a", cpu=8, process_count=100) + current = _state("2026-09-23T04:05:00+00:00", digest_char="b", cpu=8, process_count=101) + components = current["components"] + assert isinstance(components, list) + components[3]["source"] = package_source + current["receiptDigest"] = _body_digest(current, "receiptDigest") + persisted = SystemHistoryPersistenceBridge(runtime).persist_transition( + previous_state=previous, + current_state=current, + change_receipt=_change(previous, current, "2026-09-23T04:05:01+00:00"), + task_id="native-package-history", + ) + service = SystemHistoryComparisonService(runtime) + if package_source == "pacman-local-desc": + comparison = service.compare( + from_record_id=persisted.state_record_ids[0], + to_record_id=persisted.state_record_ids[1], + ).to_dict() + assert comparison["executionAuthority"] is False + assert comparison["effectPerformed"] is False + else: + with pytest.raises(ValueError, match="component packages source is not canonical"): + service.compare( + from_record_id=persisted.state_record_ids[0], + to_record_id=persisted.state_record_ids[1], + ) + + def test_comparison_requires_explicit_compare_read_and_memory_grants(tmp_path: Path) -> None: no_compare = _runtime( tmp_path / "no-compare", From d0f7837c63169826a1c7a0ab2763eb50d93de221 Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Wed, 30 Sep 2026 14:46:25 -0700 Subject: [PATCH 6/8] fix: preserve compositor startup evidence and accelerate UEFI qualification --- .github/workflows/linux-image.yml | 4 ++++ docs/os/BUILD_AND_QUALIFY.md | 6 +++++- packaging/linux/prepare_profile.py | 3 +++ packaging/linux/session/phios-session | 3 ++- packaging/linux/tests/live-smoke.sh | 12 +++++++++++- packaging/linux/tests/qemu_boot.py | 8 +++++++- 6 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux-image.yml b/.github/workflows/linux-image.yml index d1be38a2..0e0dd911 100644 --- a/.github/workflows/linux-image.yml +++ b/.github/workflows/linux-image.yml @@ -45,6 +45,10 @@ jobs: 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)" \ diff --git a/docs/os/BUILD_AND_QUALIFY.md b/docs/os/BUILD_AND_QUALIFY.md index a43d5808..ef0550a6 100644 --- a/docs/os/BUILD_AND_QUALIFY.md +++ b/docs/os/BUILD_AND_QUALIFY.md @@ -47,7 +47,11 @@ package inventories, complete builder/Archiso logs, license history and SHA256SU 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 exact source marker, +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. This fixture is omitted from normal locally built previews. diff --git a/packaging/linux/prepare_profile.py b/packaging/linux/prepare_profile.py index e0c2d52f..74e630cf 100644 --- a/packaging/linux/prepare_profile.py +++ b/packaging/linux/prepare_profile.py @@ -132,6 +132,9 @@ def write(name: str, content: str) -> None: (root / "etc/systemd/system/default.target").symlink_to("/usr/lib/systemd/system/graphical.target") (root / "etc/resolv.conf").symlink_to("/run/systemd/resolve/stub-resolv.conf") if smoke: + # The qualification fixture owns this console; an interactive getty + # must not reset/consume its serial evidence. + (root / "etc/systemd/system/serial-getty@ttyS0.service").symlink_to("/dev/null") write("usr/local/bin/phios-live-smoke", (repo / "packaging/linux/tests/live-smoke.sh").read_text()) write("etc/systemd/system/phios-live-smoke.service", "[Unit]\nDescription=CI live-image qualification fixture\n" "After=greetd.service\n[Service]\nType=oneshot\nExecStart=/usr/local/bin/phios-live-smoke\n" diff --git a/packaging/linux/session/phios-session b/packaging/linux/session/phios-session index 94499732..7e2964d2 100755 --- a/packaging/linux/session/phios-session +++ b/packaging/linux/session/phios-session @@ -8,6 +8,7 @@ umask 077 export XDG_CURRENT_DESKTOP=Wayfire export XDG_SESSION_DESKTOP=phios export XDG_SESSION_TYPE=wayland +export WLR_RENDERER_ALLOW_SOFTWARE=1 export PHIOS_STATE_ROOT="$HOME/.local/state/phios" export PHIOS_CURIOSITY_ROOT="$PHIOS_STATE_ROOT/curiosity" mkdir -p "$PHIOS_STATE_ROOT" @@ -15,4 +16,4 @@ systemctl --user import-environment PHIOS_STATE_ROOT PHIOS_CURIOSITY_ROOT XDG_CU cleanup() { systemctl --user stop phios-session.target; } trap cleanup EXIT HUP INT TERM # Autostart starts the user services only after WAYLAND_DISPLAY exists. -wayfire -c /etc/xdg/phios/wayfire.ini +wayfire -c /etc/xdg/phios/wayfire.ini >> "$PHIOS_STATE_ROOT/wayfire.log" 2>&1 diff --git a/packaging/linux/tests/live-smoke.sh b/packaging/linux/tests/live-smoke.sh index bbf30fc0..a4916bac 100755 --- a/packaging/linux/tests/live-smoke.sh +++ b/packaging/linux/tests/live-smoke.sh @@ -1,12 +1,22 @@ #!/usr/bin/env bash # This fixture is included only when PHIOS_CI_SMOKE=1; it performs no disk writes. set -euo pipefail -trap 'journalctl -b -u greetd --no-pager; runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 journalctl --user -b --no-pager; echo PHIOS_BOOT_FAILED' ERR +dump_failure() { + journalctl -b -u greetd --no-pager + runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 journalctl --user -b --no-pager || true + cat /home/phios/.local/state/phios/wayfire.log || true + echo PHIOS_BOOT_FAILED +} +trap dump_failure ERR for attempt in {1..420}; do if curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null && pgrep -u phios -x wayfire >/dev/null && pgrep -u phios -x chromium >/dev/null; then break fi + if (( attempt % 60 == 0 )); then + journalctl -b -u greetd --no-pager + cat /home/phios/.local/state/phios/wayfire.log || true + fi sleep 1 done curl -fsS http://127.0.0.1:3969/ | grep -q '
' diff --git a/packaging/linux/tests/qemu_boot.py b/packaging/linux/tests/qemu_boot.py index d449af9f..5fec6e7c 100644 --- a/packaging/linux/tests/qemu_boot.py +++ b/packaging/linux/tests/qemu_boot.py @@ -4,6 +4,7 @@ import argparse import hashlib import json +import os import re import shutil import socket @@ -46,7 +47,11 @@ def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: shutil.copyfile(variables, variables_copy) serial = output / "serial.log" qmp_path = output / "qmp.sock" - command = [qemu, "-machine", "q35,accel=tcg", "-cpu", "max", "-m", "4096", "-smp", "2", + accelerated = os.access("/dev/kvm", os.R_OK | os.W_OK) + accelerator = "kvm" if accelerated else "tcg" + if not accelerated: + timeout = max(timeout, 1800) + command = [qemu, "-machine", f"q35,accel={accelerator}", "-cpu", "host" if accelerated else "max", "-m", "4096", "-smp", "2", "-drive", f"if=pflash,format=raw,readonly=on,file={code}", "-drive", f"if=pflash,format=raw,file={variables_copy}", "-cdrom", str(iso.resolve()), "-boot", "d", "-nic", "none", "-vga", "none", @@ -58,6 +63,7 @@ def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: digest.update(block) receipt = {"schema_version": "phios.live-boot-evidence.v1", "source_commit": source, "iso_sha256": digest.hexdigest(), "command": command, + "accelerator": accelerator, "timeout_seconds": timeout, "boot_passed": False, "hardware_qualified": False, "release_ready": False} with (output / "qemu.log").open("w") as log: process = subprocess.Popen(command, stdout=log, stderr=subprocess.STDOUT) From aec65c45d8ccf4a113394a92bb6e612100515103 Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Wed, 30 Sep 2026 15:00:53 -0700 Subject: [PATCH 7/8] test: prove desktop service recovery and a second UEFI boot --- .github/workflows/linux-image.yml | 2 +- docs/os/BUILD_AND_QUALIFY.md | 6 +++++- packaging/linux/tests/live-smoke.sh | 32 ++++++++++++++++++++++++++++- packaging/linux/tests/qemu_boot.py | 30 ++++++++++++++++++++------- phishell/src/PhiShell.tsx | 19 +++++++++-------- 5 files changed, 70 insertions(+), 19 deletions(-) diff --git a/.github/workflows/linux-image.yml b/.github/workflows/linux-image.yml index 0e0dd911..0d36c0aa 100644 --- a/.github/workflows/linux-image.yml +++ b/.github/workflows/linux-image.yml @@ -57,7 +57,7 @@ jobs: if: always() run: | if [[ -f "$RUNNER_TEMP/phios-boot/screen.ppm" ]]; then - /usr/bin/python3 -c 'from PIL import Image; import os; Image.open(os.environ["RUNNER_TEMP"] + "/phios-boot/screen.ppm").save(os.environ["RUNNER_TEMP"] + "/phios-boot/screen.png")' + /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() diff --git a/docs/os/BUILD_AND_QUALIFY.md b/docs/os/BUILD_AND_QUALIFY.md index ef0550a6..ffc06a70 100644 --- a/docs/os/BUILD_AND_QUALIFY.md +++ b/docs/os/BUILD_AND_QUALIFY.md @@ -53,7 +53,11 @@ 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. This fixture +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 diff --git a/packaging/linux/tests/live-smoke.sh b/packaging/linux/tests/live-smoke.sh index a4916bac..3f90a2b9 100755 --- a/packaging/linux/tests/live-smoke.sh +++ b/packaging/linux/tests/live-smoke.sh @@ -35,6 +35,36 @@ for endpoint in decisions bindings leases; do test "$status" = 403 done runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 systemctl --user is-active phios-observer.service phios-browser.service phios-curiosity-reader.service +userctl() { runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 systemctl --user "$@"; } +old_pid=$(userctl show phios-observer.service --property=MainPID --value) +userctl kill --signal=KILL phios-observer.service +for attempt in {1..60}; do + new_pid=$(userctl show phios-observer.service --property=MainPID --value) + if [[ $new_pid != 0 && $new_pid != "$old_pid" ]] && curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null; then + break + fi + sleep 1 +done +test "$new_pid" != "$old_pid" +curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null +# A compositor exit must stop every PartOf session service. Restarting greetd +# opens a fresh configured live login; no terminal workaround launches the UI. +pkill -TERM -u phios -x wayfire +for attempt in {1..30}; do + if ! userctl is-active --quiet phios-session.target; then break; fi + sleep 1 +done +! userctl is-active --quiet phios-session.target +! curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null +systemctl restart greetd +for attempt in {1..90}; do + if curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null && + pgrep -u phios -x wayfire >/dev/null && pgrep -u phios -x chromium >/dev/null; then break; fi + sleep 1 +done +userctl is-active phios-observer.service phios-browser.service phios-curiosity-reader.service +curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null +echo PHIOS_SESSION_RESTART_OK python -c 'import phios, phios.mcp.server, phios.ghostwalk_operator; print("Installed Python runtime:",phios.__version__)' phi version -printf 'PHIOS_BOOT_OK:%s\n' "$(cat /usr/share/phios/source-commit)" +printf 'PHIOS_BOOT_OK:%s:%s\n' "$(cat /usr/share/phios/source-commit)" "$(tr -d '-' < /proc/sys/kernel/random/boot_id)" diff --git a/packaging/linux/tests/qemu_boot.py b/packaging/linux/tests/qemu_boot.py index 5fec6e7c..682e5dd0 100644 --- a/packaging/linux/tests/qemu_boot.py +++ b/packaging/linux/tests/qemu_boot.py @@ -11,17 +11,16 @@ import subprocess import time from pathlib import Path +from typing import Any -def capture_display(qmp_path: Path, output: Path) -> None: +def qmp_request(qmp_path: Path, request: dict[str, Any]) -> None: with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client: client.settimeout(15) client.connect(str(qmp_path)) stream = client.makefile("rwb") json.loads(stream.readline()) - for request in [{"execute": "qmp_capabilities"}, - {"execute": "screendump", "arguments": { - "filename": str((output / "screen.ppm").resolve())}}]: + for request in [{"execute": "qmp_capabilities"}, request]: stream.write(json.dumps(request).encode() + b"\n") stream.flush() while True: @@ -32,9 +31,16 @@ def capture_display(qmp_path: Path, output: Path) -> None: break +def capture_display(qmp_path: Path, output: Path, *, name: str = "screen") -> None: + qmp_request(qmp_path, {"execute": "screendump", "arguments": { + "filename": str((output / f"{name}.ppm").resolve())}}) + + def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: if re.fullmatch(r"[0-9a-f]{40}", source) is None or not iso.is_file(): raise ValueError("an existing ISO and exact source commit are required") + if output.exists() and any(output.iterdir()): + raise ValueError("boot evidence destination must be fresh") output.mkdir(parents=True, exist_ok=True) code = Path("/usr/share/OVMF/OVMF_CODE_4M.fd") variables = Path("/usr/share/OVMF/OVMF_VARS_4M.fd") @@ -64,18 +70,27 @@ def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: receipt = {"schema_version": "phios.live-boot-evidence.v1", "source_commit": source, "iso_sha256": digest.hexdigest(), "command": command, "accelerator": accelerator, "timeout_seconds": timeout, - "boot_passed": False, "hardware_qualified": False, "release_ready": False} + "boot_passed": False, "reboot_passed": False, "boot_ids": [], + "hardware_qualified": False, "release_ready": False} with (output / "qemu.log").open("w") as log: process = subprocess.Popen(command, stdout=log, stderr=subprocess.STDOUT) try: deadline = time.monotonic() + timeout marker = f"PHIOS_BOOT_OK:{source}" + reset_sent = False while time.monotonic() < deadline: text = serial.read_text(errors="replace") if serial.exists() else "" if "PHIOS_BOOT_FAILED" in text: raise RuntimeError("live-image qualification fixture failed") - if marker in text: + boot_ids = list(dict.fromkeys(re.findall(re.escape(marker) + r":([0-9a-f]{32})", text))) + receipt["boot_ids"] = boot_ids + if len(boot_ids) >= 2 and reset_sent: break + if boot_ids and not reset_sent: + capture_display(qmp_path, output, name="screen-first") + qmp_request(qmp_path, {"execute": "system_reset"}) + reset_sent = True + deadline = time.monotonic() + timeout if process.poll() is not None: raise RuntimeError(f"QEMU exited before qualification (exit {process.returncode})") time.sleep(1) @@ -83,7 +98,8 @@ def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: raise RuntimeError("UEFI boot/session qualification timed out") capture_display(qmp_path, output) receipt["boot_passed"] = True - print(f"UEFI live boot and non-root session passed for ISO {receipt['iso_sha256']}") + receipt["reboot_passed"] = True + print(f"UEFI boot, session restart and second boot passed for ISO {receipt['iso_sha256']}") finally: if not (output / "screen.ppm").exists() and process.poll() is None: try: diff --git a/phishell/src/PhiShell.tsx b/phishell/src/PhiShell.tsx index 51182176..2a30a92b 100644 --- a/phishell/src/PhiShell.tsx +++ b/phishell/src/PhiShell.tsx @@ -1,4 +1,5 @@ import { useEffect, useMemo, useReducer, useRef, useState } from "react"; +import packageMetadata from "../package.json"; import { HostObservationPanel } from "./components/HostObservationPanel"; import { GhostWalkControlPanel } from "./components/GhostWalkControlPanel"; import { GhostWalkVesselContextCard } from "./components/GhostWalkVesselContextCard"; @@ -230,13 +231,13 @@ function Home() {
-
SYSTEM STATUS
+
CAPABILITY OBSERVATIONS
{[ - ["PhiVessel", "Online"], - ["Models", "Ready"], - ["Memory", "Nominal"], - ["SOMA", "Active"], - ["Ledger", "Recording"], + ["PhiVessel", "Advisory"], + ["Models", "Not observed"], + ["Memory", "Not observed"], + ["SOMA", "Not observed"], + ["Ledger", "Read only"], ["Linux Effects", "Blocked"], ].map(([a, b]) => (
@@ -247,7 +248,7 @@ function Home() {
-
RECENT PROJECTS
+
EXAMPLE PROJECTS
{projects.map(([name, type, when]) => (
@@ -593,7 +594,7 @@ function PhiVessel() {
{mode.toUpperCase()} MODE · ADVISORY -

Governed runtime context online.

+

Runtime context · advisory.

PhiVessel can read a stripped Ghost Walk explanation projection without receiving its lifecycle controls or execution primitives.

The intelligence layer may propose an action. Proposal is still not authority. @@ -855,7 +856,7 @@ export function PhiShell() {

{title} - PhiShell v0.13 · canonical history comparison · execution authority false + PhiShell v{packageMetadata.version} · canonical history comparison · execution authority false
From 1cd84ccc5f985489f43072fead91c49805ebf530 Mon Sep 17 00:00:00 2001 From: Michael Hughes Date: Wed, 30 Sep 2026 15:34:34 -0700 Subject: [PATCH 8/8] test: exercise real greeter login after live session logout --- packaging/linux/tests/live-smoke.sh | 29 +++++++++++++++++------------ packaging/linux/tests/qemu_boot.py | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/packaging/linux/tests/live-smoke.sh b/packaging/linux/tests/live-smoke.sh index 3f90a2b9..a17f0929 100755 --- a/packaging/linux/tests/live-smoke.sh +++ b/packaging/linux/tests/live-smoke.sh @@ -2,10 +2,10 @@ # This fixture is included only when PHIOS_CI_SMOKE=1; it performs no disk writes. set -euo pipefail dump_failure() { - journalctl -b -u greetd --no-pager - runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 journalctl --user -b --no-pager || true - cat /home/phios/.local/state/phios/wayfire.log || true echo PHIOS_BOOT_FAILED + timeout 15 journalctl -b -u greetd --no-pager || true + timeout 15 runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 journalctl --user -b --no-pager || true + cat /home/phios/.local/state/phios/wayfire.log || true } trap dump_failure ERR for attempt in {1..420}; do @@ -24,11 +24,11 @@ curl -fsS http://127.0.0.1:3969/api/v1/package-observation | python -c 'import j curl -fsS http://127.0.0.1:3969/api/v1/system-state | python -c 'import json,sys; r=json.load(sys.stdin)["receipt"]; p=next(c for c in r["components"] if c["id"]=="packages"); assert p["source"]=="pacman-local-desc" and p["availability"]=="available" and r["readOnly"] and not r["executionAuthority"] and not r["effectPerformed"]' test "$(id -u phios)" = 1000 test "$(stat -c %a /home/phios/.local/state/phios)" = 700 -! id -nG phios | grep -qw wheel -! pgrep -u root -x wayfire -! pgrep -u root -x chromium +if id -nG phios | grep -qw wheel; then false; fi +if pgrep -u root -x wayfire; then false; fi +if pgrep -u root -x chromium; then false; fi for pid in $(pgrep -u phios -x chromium); do - ! tr '\0' '\n' < "/proc/$pid/cmdline" | grep -qx -- '--no-sandbox' + if tr '\0' '\n' < "/proc/$pid/cmdline" | grep -qx -- '--no-sandbox'; then false; fi done for endpoint in decisions bindings leases; do status=$(curl -sS -o /dev/null -w '%{http_code}' -X POST -H 'Content-Type: application/json' --data '{}' "http://127.0.0.1:3969/api/v1/ghostwalk/authorization-console/$endpoint") @@ -37,6 +37,7 @@ done runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 systemctl --user is-active phios-observer.service phios-browser.service phios-curiosity-reader.service userctl() { runuser -u phios -- env XDG_RUNTIME_DIR=/run/user/1000 systemctl --user "$@"; } old_pid=$(userctl show phios-observer.service --property=MainPID --value) +[[ $old_pid =~ ^[1-9][0-9]*$ ]] userctl kill --signal=KILL phios-observer.service for attempt in {1..60}; do new_pid=$(userctl show phios-observer.service --property=MainPID --value) @@ -46,17 +47,21 @@ for attempt in {1..60}; do sleep 1 done test "$new_pid" != "$old_pid" +[[ $new_pid =~ ^[1-9][0-9]*$ ]] curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null +echo PHIOS_SIDECAR_RESTART_OK # A compositor exit must stop every PartOf session service. Restarting greetd -# opens a fresh configured live login; no terminal workaround launches the UI. +# does not repeat initial_session. The VM driver enters the public volatile +# live credentials at the real greeter; production login policy stays intact. pkill -TERM -u phios -x wayfire for attempt in {1..30}; do - if ! userctl is-active --quiet phios-session.target; then break; fi + if ! userctl is-active --quiet phios-session.target && + ! curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null; then break; fi sleep 1 done -! userctl is-active --quiet phios-session.target -! curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null -systemctl restart greetd +if userctl is-active --quiet phios-session.target; then false; fi +if curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null; then false; fi +printf 'PHIOS_LOGIN_REQUIRED:%s\n' "$(tr -d '-' < /proc/sys/kernel/random/boot_id)" for attempt in {1..90}; do if curl -fsS http://127.0.0.1:3969/api/v1/health >/dev/null && pgrep -u phios -x wayfire >/dev/null && pgrep -u phios -x chromium >/dev/null; then break; fi diff --git a/packaging/linux/tests/qemu_boot.py b/packaging/linux/tests/qemu_boot.py index 682e5dd0..5271e6aa 100644 --- a/packaging/linux/tests/qemu_boot.py +++ b/packaging/linux/tests/qemu_boot.py @@ -36,6 +36,19 @@ def capture_display(qmp_path: Path, output: Path, *, name: str = "screen") -> No "filename": str((output / f"{name}.ppm").resolve())}}) +def enter_live_login(qmp_path: Path) -> None: + """Exercise greetd/PAM with the documented public volatile credentials.""" + qmp_request(qmp_path, {"execute": "send-key", "arguments": { + "keys": [{"type": "qcode", "data": key} for key in ["ctrl", "alt", "f1"]]}}) + time.sleep(1) + for field in ["phios", "phios"]: + for key in [*field, "ret"]: + qmp_request(qmp_path, {"execute": "send-key", "arguments": { + "keys": [{"type": "qcode", "data": key}], "hold-time": 80}}) + time.sleep(0.12) + time.sleep(1) + + def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: if re.fullmatch(r"[0-9a-f]{40}", source) is None or not iso.is_file(): raise ValueError("an existing ISO and exact source commit are required") @@ -78,10 +91,15 @@ def boot(iso: Path, source: str, output: Path, *, timeout: int = 600) -> None: deadline = time.monotonic() + timeout marker = f"PHIOS_BOOT_OK:{source}" reset_sent = False + login_ids_sent: set[str] = set() while time.monotonic() < deadline: text = serial.read_text(errors="replace") if serial.exists() else "" if "PHIOS_BOOT_FAILED" in text: raise RuntimeError("live-image qualification fixture failed") + for login_id in re.findall(r"PHIOS_LOGIN_REQUIRED:([0-9a-f]{32})", text): + if login_id not in login_ids_sent: + enter_live_login(qmp_path) + login_ids_sent.add(login_id) boot_ids = list(dict.fromkeys(re.findall(re.escape(marker) + r":([0-9a-f]{32})", text))) receipt["boot_ids"] = boot_ids if len(boot_ids) >= 2 and reset_sent: