pi-better-background-tasks 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/README.md +22 -51
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,65 +1,36 @@
1
1
  # pi-better-background-tasks
2
2
 
3
- Generic durable background tasks for [pi](https://pi.dev). The extension lets an
4
- agent start long-running commands or command-based watchers without blocking the
5
- foreground turn. Task metadata and logs are stored under the OS temp directory,
6
- so status and logs remain available across `/reload` and ordinary session use.
3
+ Durable background processes and watchers for [Pi](https://pi.dev).
7
4
 
8
- The core is deliberately domain-neutral. GitHub, Mergify, Cloud Build, Vercel,
9
- and similar integrations should be thin presets on top of the generic watcher,
10
- not special cases in the runtime.
5
+ Use it when work should keep running while the foreground session stays free: dev servers, long scripts, queue watchers, deploy checks, log tails, and other command-driven tasks.
11
6
 
12
- ## Tools
7
+ ## Core Features
13
8
 
14
- | Tool | Purpose |
15
- | ---- | ------- |
16
- | `bg_task_spawn` | Start a long-running process and return immediately. |
17
- | `bg_task_watch` | Poll a command until success/failure/timeout. |
18
- | `bg_task_list` | List known tasks. |
19
- | `bg_task_status` | Inspect one task. Compact by default; pass `verbose:true` for full metadata JSON. |
20
- | `bg_task_log` | Read a bounded task log tail by default, or a full log on request. |
21
- | `bg_task_stop` | Cancel a watcher or terminate a process task. |
22
- | `bg_task` | Action-based wrapper for `spawn`, `watch`, `list`, `status`, `log`, `stop`, `clear`. |
23
- | `bg_status` | Small action wrapper for `list`, `status`, `log`, `stop`, `clear`. |
9
+ - Start long-running commands without blocking the current turn.
10
+ - Watch commands until success, failure, or timeout.
11
+ - Keep task metadata and logs available across reloads.
12
+ - Show active work in Pi's background-work navigator.
24
13
 
25
- `clear` dismisses terminal tasks for the active cwd/session so they no longer
26
- count as foreground attention. It keeps metadata and logs on disk for explicit
27
- inspection.
14
+ ## Install
28
15
 
29
- Callbacks are terminal-only by default. When `callback` is not false, a task that
30
- reaches a terminal state queues one follow-up message telling the foreground
31
- agent which task finished and which tool to call for details.
16
+ ```sh
17
+ pi install npm:pi-better-background-tasks
18
+ ```
32
19
 
33
- Callbacks point to `bg_task_status` first. The default status response is a
34
- compact model-facing summary that omits large command bodies; use
35
- `verbose:true` only when full metadata is required. `bg_task_log` defaults to a
36
- 20-line tail, and `tail_lines: 0` requests the full log explicitly.
20
+ Try it for one run:
37
21
 
38
- Command watchers default to a 15 minute timeout when `timeout_seconds` is
39
- omitted. Pass `timeout_seconds: 0` to disable the watcher timeout explicitly.
40
- Spawned processes do not get a default timeout.
22
+ ```sh
23
+ pi -e npm:pi-better-background-tasks
24
+ ```
41
25
 
42
- ## Examples
26
+ ## Update Or Remove
43
27
 
44
- ```json
45
- {
46
- "name": "dev server",
47
- "command": "npm run dev",
48
- "cwd": "/path/to/app"
49
- }
28
+ ```sh
29
+ pi update npm:pi-better-background-tasks
30
+ pi remove npm:pi-better-background-tasks
50
31
  ```
51
32
 
52
- ```json
53
- {
54
- "name": "wait for success",
55
- "command": "node ./scripts/check-status.js --json",
56
- "interval_seconds": 15,
57
- "timeout_seconds": 600,
58
- "success_when": { "type": "json_path_equals", "path": "$.status", "value": "done" },
59
- "failure_when": { "type": "json_path_equals", "path": "$.status", "value": "failed" }
60
- }
61
- ```
33
+ ## More Detail
62
34
 
63
- Commands run through `/bin/bash -lc` by default so shell-mode watchers behave
64
- consistently across sessions. Set `PI_BETTER_BACKGROUND_TASKS_SHELL` to override
65
- that shell, or pass `argv` and `shell:false` to avoid shell parsing.
35
+ - Repository: https://github.com/1aboveio/pi-better-harness
36
+ - Detailed notes: https://github.com/1aboveio/pi-better-harness/blob/main/packages/pi-better-background-tasks/docs/usage.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-background-tasks",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Generic durable background task and watcher tools for pi.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -50,4 +50,4 @@
50
50
  "vitest": "^3.0.0",
51
51
  "typebox": "^1.1.38"
52
52
  }
53
- }
53
+ }