pi-lean-bg0.1.0
Lean background shell task runner for Pi with Shift+Down dock and reload survival
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.
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,Enterinspect,↑/↓/PgUp/PgDnscroll,Gresume live tail,xstop,rrerun,cclear finished notices,Esc/qclose)./bg [--survive-reload] [--name "Label"] <command>— launches a background shell task withnotify: "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>.logwith a 20 MiB cap (override viaPI_BG_MAX_OUTPUT_BYTES) andfsyncon 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