Carry a service script, and declare the backend as a component

ai-server is now something Dev Updater can install, start and stop from
the phone: the project declares a Server component naming ./server/service,
and that script is where knowing about systemd and OpenRC lives.

Detection asks rather than looks -- `systemctl --user show-environment`
answering, or `rc-service --user` existing -- because a machine can carry
both binaries and an OpenRC below 0.60 has rc-service without --user.
Neither present is an error with a message, not a guess at a fallback.

Two things the script will not do. It never prompts: Dev Updater runs it
with stdin closed, so a sudo prompt would hang rather than fail, and
anything needing root exits telling you to run it yourself once. And on
OpenRC it refuses when XDG_RUNTIME_DIR is unset rather than proceeding --
user services store their state there, and the failure otherwise reads as
a broken service instead of a missing variable.

The server is declared before the app so it is built and delivered first;
a failed APK build then leaves the phone with the APK it already had
rather than half of a matched pair.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QQz6R4kBQcWSHBNZMgBnjL
This commit is contained in:
irisandClaude Opus 5 committed 2026-08-26 00:48:25 -04:00
1 parent 0da6a542bd
commit effefdeb03
2 files changed
+166 -1

No files matched your search

+11 -1
View File
@@ -3,9 +3,19 @@
label: "AI Sessions",
// The server is built and delivered before the APK: if the APK build then
// fails, the phone keeps being offered the one it already had rather than
// half of a matched pair.
components: [
Server(
name: "backend",
build: "cargo build --release --manifest-path ../server/Cargo.toml",
// Installs into whichever user-service manager is here, and is how
// this server is started, stopped and asked about. See the script.
service: "../server/service",
),
Apk(
name: "app",
build: "./build-apk.sh",
),
],
]