omp packages

pi-lean-bg0.1.0

Lean background shell task runner for Pi with Shift+Down dock and reload survival

GitHub Actions Published 4 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-lean-bg

A lean background shell task runner for Pi with automatic completion wake-ups, a Shift+Down live log dock, and /reload survival.

Install

pi install npm:pi-lean-bg

Or add "npm:pi-lean-bg" to packages in ~/.pi/agent/settings.json.

Tools

Tool Parameters Behavior
bg_run name, command, timeoutSeconds?, surviveReload?, notify? Spawns /bin/bash -c <command> in a detached POSIX process group, streams output to .pi/tasks/, and returns immediately. notify: "wake" (default, delivers <background-task-notification> and triggers a follow-up turn), "silent" (delivers notification without triggering a turn), or "none".
bg_status taskId? Inspects one task by ID/prefix or lists all tasks in the session.
bg_logs taskId, tail?, maxBytes? Reads a bounded tail (default) or head slice of the task log file (default 16 KiB, max 50 KiB).
bg_kill taskId Stops a running task and its entire process group (SIGTERM → 3s grace → SIGKILL).

Commands & Shortcuts

  • Shift+Down — opens the bottom-center task dock overlay (list view + live-tailing log view, Enter inspect, ↑/↓/PgUp/PgDn scroll, G resume live tail, x stop, r rerun, c clear finished notices, Esc/q close).
  • /bg [--survive-reload] [--name "Label"] <command> — launches a background shell task with notify: "silent".
  • /jobs — opens the task dock (or prints the task list in non-interactive mode).

Runtime Behavior

  • Logs: written to .pi/tasks/<session>-<pid>/<id>.log with a 20 MiB cap (override via PI_BG_MAX_OUTPUT_BYTES) and fsync on completion.
  • Reload survival: tasks started with surviveReload: true (or /bg --survive-reload) stay running across Pi /reload, reattach to the new extension instance, and flush any notifications that completed during the reload window.
  • Clean shutdown: real session exits terminate all running task process groups.
  • Footer status: shows running/finished task counts and Shift↓ in the status line; refreshes every second while tasks are active and clears when idle.

License

MIT