pi-background-tasks 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any purpose
6
+ with or without fee is hereby granted, provided that the above copyright notice
7
+ and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
13
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
14
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
15
+ THIS SOFTWARE.
package/PUBLISHING.md ADDED
@@ -0,0 +1,62 @@
1
+ # Publishing pi-background-tasks
2
+
3
+ This package is ready for both npm publishing and standalone git publishing.
4
+
5
+ ## Preconditions
6
+
7
+ - npm account with publish rights for `pi-background-tasks`.
8
+ - Standalone GitHub repository, expected: `github.com/ismailsaleekh/pi-background-tasks`.
9
+ - Clean worktree.
10
+
11
+ ## Verify
12
+
13
+ ```bash
14
+ cd packages/pi-background-tasks
15
+ npm run smoke
16
+ npm pack --dry-run
17
+ npm view pi-background-tasks name version --json
18
+ ```
19
+
20
+ At creation time, `npm view pi-background-tasks` returned 404, so the unscoped name appeared available.
21
+
22
+ ## Publish to npm
23
+
24
+ ```bash
25
+ cd packages/pi-background-tasks
26
+ npm login
27
+ npm publish --access public
28
+ ```
29
+
30
+ Pi install smoke after publish:
31
+
32
+ ```bash
33
+ pi -e npm:pi-background-tasks@0.1.0 --offline --no-tools --no-session -p "/jobs"
34
+ pi install npm:pi-background-tasks@0.1.0
35
+ ```
36
+
37
+ ## Publish to git
38
+
39
+ Because Pi git package installs treat the repository root as the package root, do not point Pi at the `ai-pipeline` monorepo root for this package. Push the contents of `packages/pi-background-tasks/` to a standalone repository.
40
+
41
+ ```bash
42
+ cd packages/pi-background-tasks
43
+ git init
44
+ git add .
45
+ git commit -m "Initial pi-background-tasks package"
46
+ git branch -M main
47
+ git remote add origin git@github.com:ismailsaleekh/pi-background-tasks.git
48
+ git push -u origin main
49
+ git tag v0.1.0
50
+ git push origin v0.1.0
51
+ ```
52
+
53
+ Pi install smoke after git tag:
54
+
55
+ ```bash
56
+ pi -e git:github.com/ismailsaleekh/pi-background-tasks@v0.1.0 --offline --no-tools --no-session -p "/jobs"
57
+ pi install git:github.com/ismailsaleekh/pi-background-tasks@v0.1.0
58
+ ```
59
+
60
+ ## pi.dev/packages
61
+
62
+ The package includes the `pi-package` keyword and a `pi.extensions` manifest. After npm publish, it should be discoverable by pi.dev package indexing. If it does not appear automatically, submit/refresh the package according to the pi.dev package-gallery process.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # pi-background-tasks
2
+
3
+ Claude-Code-like explicit background shell task manager for [Pi](https://pi.dev/).
4
+
5
+ This package adds tracked background shell jobs with durable output files, bounded log reads, kill/timeout safety, a `/tasks` manager UI, and completion notifications that can wake the agent when LLM-launched work finishes.
6
+
7
+ ## Install
8
+
9
+ From npm after publish:
10
+
11
+ ```bash
12
+ pi install npm:pi-background-tasks@0.1.0
13
+ ```
14
+
15
+ From git after pushing this package to its standalone repository and tagging:
16
+
17
+ ```bash
18
+ pi install git:github.com/ismailsaleekh/pi-background-tasks@v0.1.0
19
+ ```
20
+
21
+ For project-local install:
22
+
23
+ ```bash
24
+ pi install -l npm:pi-background-tasks@0.1.0
25
+ ```
26
+
27
+ ## Commands
28
+
29
+ - `/bg <command>` — start a tracked background shell command.
30
+ - `/jobs` — list running and recent completed/failed/killed tasks.
31
+ - `/logs <id> [maxBytes]` — show bounded tail output and full output path.
32
+ - `/kill <id>` — stop a running task.
33
+ - `/tasks` or `/bg-tasks` — open the interactive task manager UI.
34
+
35
+ ## LLM tools
36
+
37
+ - `bg_run` — start long-running commands without blocking the conversation.
38
+ - `bg_status` — inspect one task or all recent tasks.
39
+ - `bg_logs` — read bounded task output.
40
+ - `bg_kill` — stop a running task.
41
+
42
+ `bg_run` defaults to `triggerOnCompletion: true`, so completion notifications trigger a follow-up agent turn. User-launched `/bg` jobs are display-only by default.
43
+
44
+ ## Runtime files
45
+
46
+ Task output and metadata are written under the current project:
47
+
48
+ ```text
49
+ .pi/tasks/<session-id>-<pid>/<task-id>.output
50
+ .pi/tasks/<session-id>-<pid>/<task-id>.json
51
+ ```
52
+
53
+ These are runtime artifacts and should remain gitignored.
54
+
55
+ ## Safety model
56
+
57
+ - Commands are spawned and tracked with `child_process.spawn`; the package does not rely on shell `&`.
58
+ - stdout/stderr are captured to task output files.
59
+ - Model-visible logs are bounded and point to full output files.
60
+ - POSIX process groups are used for process-tree kill where possible, with child-process fallback.
61
+ - Running tasks are cleaned up on Pi session shutdown/reload.
62
+ - Cross-Pi-restart process reattachment and Ctrl+B backgrounding of already-running foreground tools are intentionally out of scope.
63
+
64
+ ## Development smoke
65
+
66
+ ```bash
67
+ npm run smoke
68
+ npm run pack:dry-run
69
+ ```