shraga 0.1.41 → 0.1.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shraga",
3
- "version": "0.1.41",
3
+ "version": "0.1.42",
4
4
  "description": "The teammate you delegate coding to — a self-hostable, multi-user AI coding agent web UI (Claude Code, with a pluggable engine seam).",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -27,6 +27,24 @@ BUN="${BUN:-bun}"
27
27
  BOOT_TIMEOUT="${BOOT_TIMEOUT:-180}"
28
28
  SOAK="${SOAK:-60}"
29
29
 
30
+ # ── Escape the service cgroup ─────────────────────────────────────────────────
31
+ # Under systemd the default KillMode=control-group kills EVERY process in the unit's cgroup on
32
+ # restart — and a detached child of the server is in that cgroup. So the supervisor would be killed
33
+ # by the very restart it triggers, taking the verify AND the rollback with it: exactly the guarantees
34
+ # it exists to provide. Re-exec into a transient scope (same uid, so `bun install` doesn't leave
35
+ # root-owned files) and we live outside the unit. Best-effort: where systemd-run or passwordless sudo
36
+ # is absent, carry on in-cgroup — an unsupervised upgrade still beats no upgrade.
37
+ if [ -z "${UPGRADE_DETACHED:-}" ]; then
38
+ export UPGRADE_DETACHED=1
39
+ if command -v systemd-run >/dev/null 2>&1 && sudo -n true >/dev/null 2>&1; then
40
+ escape=(sudo -n systemd-run --scope --quiet --collect --uid="$(id -u)" --gid="$(id -g)")
41
+ for v in APP_ROOT PKG TARGET FROM RESTART_CMD HEALTH_URL REPORT BUN BOOT_TIMEOUT SOAK PATH UPGRADE_DETACHED; do
42
+ escape+=("--setenv=$v=${!v-}")
43
+ done
44
+ exec "${escape[@]}" bash "$0"
45
+ fi
46
+ fi
47
+
30
48
  cd "$APP_ROOT" || exit 1
31
49
  BACKUP="$(mktemp -d)"
32
50
  LOG="${REPORT%.json}.log"