pi-simple-background-tasks 0.0.0-stage → 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.
@@ -0,0 +1,66 @@
1
+ # Fork changes: pi-simple-background-tasks vs pi-background-tasks
2
+
3
+ This package is a **KISS fork** of
4
+ [pi-background-tasks](https://github.com/ismailsaleekh/pi-background-tasks).
5
+
6
+ ## Fork base and comparison versions
7
+
8
+ - **Fork base**: upstream `v2.6.9`, commit `4aceb55`.
9
+ The first commit of this repo (`990d60a`, "Import pi-background-tasks 2.6.9 as the fork base") is byte-identical to that upstream commit.
10
+ - **Upstream at last comparison** (2026-10-17): `v2.6.10`, commit `799182f`.
11
+ - **Commits in upstream after the fork base**: 4 — see "Upstream since the fork base" below. None are adopted.
12
+
13
+ ## Divergence summary
14
+
15
+ Relative to the 2.6.9 source, the fork changes **63 files (31,260 lines removed, 3,704 added)**, ending with **13 source files**:
16
+
17
+ | Subsystem (as in 2.6.9) | Fork |
18
+ | --- | --- |
19
+ | Background-task core: `registry`, `common`, `extension-api`, `durable-fs`, `task-durable`, `shell-policy`, `windows-taskkill`, `reload-shell-owner`, `ui/background-tasks-manager` | **Kept, simplified** |
20
+ | Fusion workflows (`src/core/fusion/*` + `fusion-extension.ts` + `fusion-child-extension.ts` + `ui/fusion-model-selector.ts`) | **Removed** (~15k lines) |
21
+ | Delegate (`src/core/delegate/*` + `delegate-extension.ts` + `delegate-child-extension.ts`) | **Removed** (~5k lines) |
22
+ | Claude/Anthropic impersonation (`anthropic-attribution*.ts`) | **Removed** (~3.7k lines) |
23
+ | Attested Pi runs (`attested-pi-*.ts`) | **Removed** (~1k lines) |
24
+ | Context projection & budgeting (`src/core/context/*`) | **Removed** (~1.6k lines) |
25
+ | Pi-agent telemetry (`isAgent` end-to-end) | **Removed** |
26
+ | Dead EventBus request layer | **Removed** |
27
+ | Update check + footer update hint (`update-check.ts`) | **Removed** |
28
+ | TUI footer + seen/unread task state | **Removed** |
29
+ | `/bg-tasks` alias | **Removed** |
30
+ | `pi-launch.ts`, `canonical-json.ts`, `BACKGROUND-TASKS-INSTRUCTIONS.md` | **Removed** |
31
+
32
+ ## What the fork adds / changes
33
+
34
+ - **`/clean` command + `bg_clean` tool** — delete finished tasks (`session` / `all` / `<id>`). New file `src/core/task-cleanup.ts`; empty run directories are removed after cleanup (tasks live under `~/.pi/agent/tasks`).
35
+ - **Task runtime moved to `~/.pi/agent/tasks`** with the PI extension-config pattern (`pi-background-tasks.json`, `tasksDir`).
36
+ - **KISS packaging** — single entry point `src/extension.ts`, no `dist/`, no tests, no docs tree; fork identity in `package.json`.
37
+ - **Task manager UI** — opens top-right as a fixed 96-column modal (96 % width left the box stuck left on wide terminals); `d` deletes the selected task; both shortcuts registered (Shift↓ / Ctrl+Alt+B); footer options contextual to the selected task; empty-state footer shows only sensible actions; task detail adapts to terminal height (modal title dropped).
38
+ - **`--agent` flag** removed from `/bg` (stale).
39
+ - **Lazy module loader simplified.**
40
+ - **Dependencies** — pi `^1.3.0`, TypeScript `^7.0.2`, `@types/node ^26.6.5`, tsx `^4.23.15`, typebox `^1.4.1`; peer ranges broadened to `|| ^1.0.0` (installs on pi 1.x, still accepts 0.81.1–0.84.0).
41
+ - **biome** lint/format + `tsconfig.json` for `tsc --noEmit`.
42
+
43
+ ## Upstream since the fork base (2.6.9 → 2.6.10)
44
+
45
+ Checked 2026-10-17. All 4 commits are about one new subsystem, **host-api**: an optional EventBus API (request / response / changed channels, leases, cursors, `~1.8k` lines of code plus docs and tests) for **native front ends** (desktop or mobile job panels). Its own docs state it does **not** change the TUI, the registered tools/commands, the dock, notifications or wake-up behavior.
46
+
47
+ **Not adopted** — it targets a surface this fork does not ship, and its size/complexity contradict the KISS design.
48
+
49
+ | Commit | What it is | Adopted |
50
+ | --- | --- | --- |
51
+ | `7781fe3` | land host-api: `host-api.ts`, `host-protocol.ts`, `host-results.ts`, docs, tests | No |
52
+ | `1857b3c` | test(host-api): freeze background UI contract and terminal guard | No |
53
+ | `9923a95` | test(host-api): correct passing group count label | No |
54
+ | `799182f` | chore(release): bump version to 2.6.10 | n/a (this fork uses 0.1.x versioning) |
55
+
56
+ ## Re-checking the divergence
57
+
58
+ ```bash
59
+ # inside this repo — everything this fork changed since the import:
60
+ git diff --stat 990d60a7f0db3b61af80daf9d35607ff90009d75..HEAD
61
+
62
+ # from any clone of ismailsaleekh/pi-background-tasks — what upstream
63
+ # has done since the fork base (4aceb55):
64
+ git log --oneline 4aceb55..main
65
+ git diff --stat 4aceb55 main
66
+ ```
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/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # pi-simple-background-tasks
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **Durable background shell tasks for Pi.**
4
+
5
+ A KISS fork of [pi-background-tasks](https://github.com/ismailsaleekh/pi-background-tasks). It keeps the core — running long shell jobs in the background without blocking the session. See [FORK-CHANGES.md](FORK-CHANGES.md) for the full list of changes relative to upstream and how to re-check the divergence.
6
+
7
+ ## Features
8
+
9
+ - **Run long jobs without blocking**: start a named shell command in the background, keep talking to Pi, and get a completion notification in chat when it finishes.
10
+ - **Durable tasks**: task state is persisted under `~/.pi/agent/tasks`, so it survives session restarts.
11
+ - **Task manager overlay**: a TUI panel lists running and recent tasks with status and bounded output (default **Shift↓**).
12
+ - **Survive Pi reloads**: opt in to keeping a shell task alive across a same-process `/reload`.
13
+ - **Cross-platform**: POSIX shell and Windows (process-group kill).
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ # Global install from the git main branch
19
+ pi install git:github.com/jlsalvador/pi-simple-background-tasks@main
20
+
21
+ # Project-local install from git
22
+ pi install git:github.com/jlsalvador/pi-simple-background-tasks@main -l
23
+ ```
24
+
25
+ ## Quick start
26
+
27
+ 1. Start a background command:
28
+
29
+ ```text
30
+ /bg --name "Typecheck watch" npm run typecheck -- --watch
31
+ ```
32
+
33
+ `/bg` starts a tracked shell task and returns the task id plus output path. User-launched `/bg` tasks notify in the UI but do not automatically wake a follow-up model turn. Add one leading `--survive-reload` only when the shell process must keep running across a same-process `/reload`.
34
+
35
+ 2. List tasks or open the task manager:
36
+
37
+ ```text
38
+ /jobs
39
+ ```
40
+
41
+ 3. Read bounded output only when you need it:
42
+
43
+ ```text
44
+ /logs b12ab34c 20000
45
+ ```
46
+
47
+ ## Tools
48
+
49
+ | Tool | Purpose |
50
+ | --- | --- |
51
+ | `bg_run` | Start a background shell command and return a task id plus output path. |
52
+ | `bg_status` | Inspect one task, or list running and recent tasks. |
53
+ | `bg_logs` | Read bounded output from a task. |
54
+ | `bg_kill` | Stop a running task. |
55
+ | `bg_clean` | Delete finished tasks to free disk space. Only terminal tasks are removed; running tasks are reported and left alone. Scope: one task by ID, this session (default), or the whole folder. |
56
+
57
+ ## Commands
58
+
59
+ | Command | Purpose |
60
+ | --- | --- |
61
+ | `/bg [--survive-reload] [--name "name"] <command>` | Start a tracked shell command. |
62
+ | `/jobs` | List running and recent tasks. |
63
+ | `/tasks [id]` | Open the task manager overlay. |
64
+ | `/logs <id> [maxBytes]` | Show bounded output from a task. |
65
+ | `/kill <id>` | Stop a running task. |
66
+ | `/clean [session\|all\|<id>]` | Delete finished tasks: one, this session (default), or all. |
67
+
68
+ **Shift↓** and **Ctrl+Alt+B** both open the task manager.
69
+
70
+ ## Configuration
71
+
72
+ Configuration follows the PI extension-config pattern. Create `pi-background-tasks.json` in the global or project location; project keys override global keys, and absent keys keep their defaults.
73
+
74
+ | Location | Path |
75
+ | --- | --- |
76
+ | Global | `~/.pi/agent/extensions/pi-background-tasks.json` |
77
+ | Project | `.pi/pi-background-tasks.json` |
78
+
79
+ | Key | Type | Default |
80
+ | --- | --- | --- |
81
+ | `tasksDir` | string path | `~/.pi/agent/tasks` |
82
+
83
+ Example:
84
+
85
+ ```json
86
+ {
87
+ "tasksDir": "~/my-tasks"
88
+ }
89
+ ```
90
+
91
+ ## Development
92
+
93
+ ```bash
94
+ npm install
95
+ npm run check # tsc --noEmit && biome check .
96
+ npm run fix # biome check --write .
97
+ ```
98
+
99
+ ## License
100
+
101
+ ISC — see [LICENSE](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,61 @@
1
1
  {
2
2
  "name": "pi-simple-background-tasks",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Durable background shell tasks for Pi. KISS fork of pi-background-tasks.",
5
+ "type": "module",
6
+ "license": "ISC",
7
+ "author": "José Luis Salvador Rufo <salvador.joseluis@gmail.com>",
8
+ "keywords": [
9
+ "pi-package",
10
+ "pi-extension",
11
+ "pi",
12
+ "background-tasks",
13
+ "coding-agent",
14
+ "shell",
15
+ "tasks",
16
+ "task-manager",
17
+ "pi-dev"
18
+ ],
19
+ "homepage": "https://github.com/jlsalvador/pi-simple-background-tasks#readme",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/jlsalvador/pi-simple-background-tasks.git"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/jlsalvador/pi-simple-background-tasks/issues"
26
+ },
27
+ "files": [
28
+ "src/",
29
+ "README.md",
30
+ "FORK-CHANGES.md",
31
+ "LICENSE"
32
+ ],
33
+ "scripts": {
34
+ "check": "tsc --noEmit && biome check .",
35
+ "fix": "biome check --write ."
36
+ },
37
+ "pi": {
38
+ "extensions": [
39
+ "./src/extension.ts"
40
+ ]
41
+ },
42
+ "peerDependencies": {
43
+ "@earendil-works/pi-ai": "*",
44
+ "@earendil-works/pi-coding-agent": "^0.81.1 || ^0.82.1 || ^0.83.0 || ^0.84.0 || ^1.0.0",
45
+ "@earendil-works/pi-tui": "^0.81.1 || ^0.82.1 || ^0.83.0 || ^0.84.0 || ^1.0.0",
46
+ "typebox": "*"
47
+ },
48
+ "devDependencies": {
49
+ "@biomejs/biome": "^2.5.15",
50
+ "@earendil-works/pi-ai": "^1.3.0",
51
+ "@earendil-works/pi-coding-agent": "^1.3.0",
52
+ "@earendil-works/pi-tui": "^1.3.0",
53
+ "@types/node": "^26.6.5",
54
+ "tsx": "^4.23.15",
55
+ "typebox": "^1.4.1",
56
+ "typescript": "^7.0.2"
57
+ },
58
+ "engines": {
59
+ "node": ">=22.19.0"
60
+ }
61
+ }