No description
  • TypeScript 98.6%
  • JavaScript 1.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Brandon Verkamp 54a9723919 fix: register an anonymous Koffi struct so Pi /reload can rebind sd-bus.
Named Koffi types are process-global; re-evaluating this module after /reload previously collided on sd_bus_error.
2026-09-24 21:40:19 -06:00
test fix: register an anonymous Koffi struct so Pi /reload can rebind sd-bus. 2026-09-24 21:40:19 -06:00
.gitignore Add Pi systemd sleep inhibitor extension 2026-09-21 23:34:40 -06:00
index.ts test: cover sleep inhibitor lifecycle and sd-bus cleanup 2026-09-21 23:42:25 -06:00
LICENSE Add Pi systemd sleep inhibitor extension 2026-09-21 23:34:40 -06:00
lifecycle.ts test: cover sleep inhibitor lifecycle and sd-bus cleanup 2026-09-21 23:42:25 -06:00
package-lock.json Add Pi systemd sleep inhibitor extension 2026-09-21 23:34:40 -06:00
package.json test: cover sleep inhibitor lifecycle and sd-bus cleanup 2026-09-21 23:42:25 -06:00
README.md Add Pi systemd sleep inhibitor extension 2026-09-21 23:34:40 -06:00
systemd.ts fix: register an anonymous Koffi struct so Pi /reload can rebind sd-bus. 2026-09-24 21:40:19 -06:00
tsconfig.json test: cover sleep inhibitor lifecycle and sd-bus cleanup 2026-09-21 23:42:25 -06:00

pi-sleep-inhibitor

Pi extension that prevents system sleep while Pi is processing an agent run. It acquires a blocking sleep inhibitor at agent_start, then releases it at agent_settled or session_shutdown.

Requirements

  • Linux with systemd-logind and its system D-Bus available.
  • The normal user-session permission to call org.freedesktop.login1.Manager.Inhibit; no elevated permissions are used.

The extension calls logind directly through libsystemd's sd-bus API using the runtime dependency Koffi. It does not spawn systemd-inhibit, busctl, or a helper process.

Installation

Install it as a Pi package; for example, from a checked-out copy:

pi install /path/to/pi-sleep-inhibitor

Restart Pi after installation. This README deliberately does not install the package for you.

Behavior

Each running Pi session independently holds its own inhibitor, so concurrent sessions remain protected until each one settles. On unsupported systems or when logind denies access, Pi continues normally and the extension shows at most one warning per session.

Inspect active inhibitors with:

systemd-inhibit --list

Look for an entry with WHO set to Pi and WHY set to Model turn in progress.