pi-background-tasks 0.9.0 → 1.0.4
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/BACKGROUND-TASKS-INSTRUCTIONS.md +63 -0
- package/PUBLISHING.md +43 -29
- package/README.md +233 -441
- package/TESTING.md +16 -10
- package/TEST_PLAN.md +43 -17
- package/docs/INDEX.md +157 -0
- package/docs/api/eventbus-v1.md +166 -0
- package/docs/assets/architecture.svg +78 -0
- package/docs/assets/footer-dock.svg +47 -0
- package/docs/assets/logo.svg +49 -0
- package/docs/attestations.json +189 -0
- package/docs/choose-a-workflow.md +98 -0
- package/docs/commands/bg-clear.md +70 -0
- package/docs/commands/bg-update.md +82 -0
- package/docs/commands/bg.md +90 -0
- package/docs/commands/fusion-models.md +70 -0
- package/docs/commands/fusion.md +69 -0
- package/docs/commands/jobs.md +74 -0
- package/docs/commands/kill.md +82 -0
- package/docs/commands/logs.md +90 -0
- package/docs/commands/task-manager.md +109 -0
- package/docs/concepts/completion-delivery.md +66 -0
- package/docs/concepts/context-projection-and-budgeting.md +79 -0
- package/docs/getting-started.md +122 -0
- package/docs/manifest.json +1825 -0
- package/docs/operations/configuration.md +110 -0
- package/docs/operations/releasing.md +67 -0
- package/docs/operations/testing.md +101 -0
- package/docs/operations/troubleshooting.md +38 -0
- package/docs/read-before-edit.md +94 -0
- package/docs/reference/runtime-contracts.md +213 -0
- package/docs/reference/shortcuts-and-dock.md +70 -0
- package/docs/subsystems/attested-pi-runs.md +141 -0
- package/docs/subsystems/background-task-runtime.md +85 -0
- package/docs/subsystems/child-launch-durability-and-safety.md +57 -0
- package/docs/subsystems/delegation.md +190 -0
- package/docs/subsystems/docs-freshness-gate.md +26 -0
- package/docs/subsystems/fusion.md +123 -0
- package/docs/subsystems/host-ui-and-telemetry.md +83 -0
- package/docs/tools/bg_delegate.md +193 -0
- package/docs/tools/bg_kill.md +114 -0
- package/docs/tools/bg_logs.md +133 -0
- package/docs/tools/bg_result.md +120 -0
- package/docs/tools/bg_run.md +168 -0
- package/docs/tools/bg_run_pi_attested.md +170 -0
- package/docs/tools/bg_status.md +111 -0
- package/docs/tools/fusion_investigate.md +116 -0
- package/docs/tools/fusion_reason.md +75 -0
- package/docs/tools/fusion_research.md +162 -0
- package/docs/tools/fusion_validate.md +206 -0
- package/logo.png +0 -0
- package/package.json +27 -9
- package/src/core/delegate/budget.ts +1 -1
- package/src/core/delegate/launch.ts +5 -0
- package/src/core/fusion/artifacts.ts +34 -4
- package/src/core/fusion/budget.ts +112 -20
- package/src/core/fusion/child-protocol.ts +82 -0
- package/src/core/fusion/clean-context.ts +91 -0
- package/src/core/fusion/config.ts +124 -35
- package/src/core/fusion/context.ts +29 -7
- package/src/core/fusion/evaluation.ts +392 -15
- package/src/core/fusion/orchestrator.ts +217 -23
- package/src/core/fusion/pi-child.ts +227 -24
- package/src/core/fusion/prompts.ts +39 -26
- package/src/core/fusion/source-policy.ts +257 -0
- package/src/core/fusion/types.ts +156 -11
- package/src/core/fusion/web-fetch.ts +104 -15
- package/src/core/fusion/workflows.ts +119 -65
- package/src/extension.ts +3 -3
- package/src/fusion-child-extension.ts +375 -141
- package/src/fusion-extension.ts +585 -240
- package/src/testing/normalize.ts +0 -22
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc_id: commands/bg-clear
|
|
3
|
+
audience: user
|
|
4
|
+
mode: mixed
|
|
5
|
+
review_policy: contract
|
|
6
|
+
stability: stable
|
|
7
|
+
covers_surfaces: [command:bg-clear]
|
|
8
|
+
covers_sources: []
|
|
9
|
+
---
|
|
10
|
+
# `/bg-clear`
|
|
11
|
+
|
|
12
|
+
<!-- pi-docs:begin name="command-contract-bg-clear" generator="scripts/docs/generate.mjs" -->
|
|
13
|
+
| Command | Description | Provenance |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `/bg-clear` | Clear finished background task footer notices | `src/extension.ts:548` |
|
|
16
|
+
<!-- pi-docs:end name="command-contract-bg-clear" -->
|
|
17
|
+
|
|
18
|
+
Clear finished background task footer notices.
|
|
19
|
+
|
|
20
|
+
## Synopsis
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
`/bg-clear`
|
|
24
|
+
|
|
25
|
+
## When to use
|
|
26
|
+
|
|
27
|
+
Use this after you have seen completed, failed, or killed task badges in the footer and want to remove those finished counts from the dock status.
|
|
28
|
+
|
|
29
|
+
## Defaults
|
|
30
|
+
|
|
31
|
+
No arguments. It only marks currently unseen finished tasks as seen.
|
|
32
|
+
|
|
33
|
+
## Lifecycle
|
|
34
|
+
|
|
35
|
+
A finished task's footer badge is marked seen when its detail view opens. `/bg-clear` or the equivalent shortcut marks every currently unseen finished task seen at once. Merely opening the list view or closing the task manager does not clear badges. Running task counts remain visible after clearing finished notices.
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
/bg-clear
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Output/result
|
|
44
|
+
|
|
45
|
+
Interactive notification:
|
|
46
|
+
|
|
47
|
+
- `Cleared N finished background task notice(s).` when at least one unseen finished task was marked seen.
|
|
48
|
+
- `No finished background task notices to clear.` when none were pending.
|
|
49
|
+
|
|
50
|
+
## Errors
|
|
51
|
+
|
|
52
|
+
No task-resolution errors; the command operates on the in-memory task registry.
|
|
53
|
+
|
|
54
|
+
## Runtime artifacts
|
|
55
|
+
|
|
56
|
+
No task files are deleted. Output and metadata under `.pi/tasks/...` remain intact.
|
|
57
|
+
|
|
58
|
+
## Safety boundaries
|
|
59
|
+
|
|
60
|
+
`/bg-clear` does not kill, prune, or modify tasks. It only updates the host UI's seen set for this extension runtime.
|
|
61
|
+
|
|
62
|
+
## Related docs
|
|
63
|
+
|
|
64
|
+
- [Shortcuts and dock](../reference/shortcuts-and-dock.md)
|
|
65
|
+
- [`/tasks` and `/bg-tasks`](task-manager.md)
|
|
66
|
+
- [Host UI and telemetry](../subsystems/host-ui-and-telemetry.md)
|
|
67
|
+
|
|
68
|
+
## Source ownership/reference
|
|
69
|
+
|
|
70
|
+
Surface registration lives in `src/extension.ts`; footer behavior is owned by [host-ui-and-telemetry](../subsystems/host-ui-and-telemetry.md).
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc_id: commands/bg-update
|
|
3
|
+
audience: user
|
|
4
|
+
mode: mixed
|
|
5
|
+
review_policy: contract
|
|
6
|
+
stability: stable
|
|
7
|
+
covers_surfaces: [command:bg-update]
|
|
8
|
+
covers_sources: []
|
|
9
|
+
---
|
|
10
|
+
# `/bg-update`
|
|
11
|
+
|
|
12
|
+
<!-- pi-docs:begin name="command-contract-bg-update" generator="scripts/docs/generate.mjs" -->
|
|
13
|
+
| Command | Description | Provenance |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `/bg-update` | Show how to update pi-background-tasks to the latest published version | `src/extension.ts:556` |
|
|
16
|
+
<!-- pi-docs:end name="command-contract-bg-update" -->
|
|
17
|
+
|
|
18
|
+
Show update instructions for `pi-background-tasks`.
|
|
19
|
+
|
|
20
|
+
## Synopsis
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
`/bg-update`
|
|
24
|
+
|
|
25
|
+
## When to use
|
|
26
|
+
|
|
27
|
+
Use this when the footer shows an update segment such as `⬆ v999.0.0 /bg-update`, or whenever you want the package's install/update commands printed without performing an install.
|
|
28
|
+
|
|
29
|
+
## Defaults
|
|
30
|
+
|
|
31
|
+
No arguments. The command reads the installed package name/version and any latest version found by the session update check.
|
|
32
|
+
|
|
33
|
+
## Lifecycle
|
|
34
|
+
|
|
35
|
+
The update check is one-shot per extension runtime, started after `session_start`, and is not awaited on the session-start path. It is skipped when:
|
|
36
|
+
|
|
37
|
+
- `PI_BG_DISABLE_UPDATE_CHECK=1`,
|
|
38
|
+
- `PI_OFFLINE=1`, or
|
|
39
|
+
- the installed package version is unavailable.
|
|
40
|
+
|
|
41
|
+
The registry request is time-boxed by `fetchLatestVersion` and failures resolve to no update segment. `/bg-update` itself only prints instructions; it never installs, self-updates, or mutates package files.
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
/bg-update
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Output/result
|
|
50
|
+
|
|
51
|
+
The notification includes current installed version and, when known, latest published version, then prints:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
pi install npm:pi-background-tasks@latest
|
|
55
|
+
pi install npm:pi-background-tasks@<version>
|
|
56
|
+
pi install git:github.com/ismailsaleekh/pi-background-tasks@main
|
|
57
|
+
For a pinned git release, first verify the tag exists, then use git:github.com/ismailsaleekh/pi-background-tasks@<existing-tag>.
|
|
58
|
+
This command only prints update instructions; it does not install or self-update.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
If no latest npm version is known, `<version>` is printed for the pinned npm command. The command never derives a git tag from the npm version: npm releases and repository tags are independent, and a pinned git tag must be verified separately.
|
|
62
|
+
|
|
63
|
+
## Errors
|
|
64
|
+
|
|
65
|
+
The command has no task-resolution errors. Update-check network, timeout, bad status, and malformed payload failures are offline-safe and do not throw into the UI.
|
|
66
|
+
|
|
67
|
+
## Runtime artifacts
|
|
68
|
+
|
|
69
|
+
No task artifacts. The footer segment is UI state only.
|
|
70
|
+
|
|
71
|
+
## Safety boundaries
|
|
72
|
+
|
|
73
|
+
Instruction-only. It does not run `pi install`, `npm`, `git`, or any package manager.
|
|
74
|
+
|
|
75
|
+
## Related docs
|
|
76
|
+
|
|
77
|
+
- [Shortcuts and dock](../reference/shortcuts-and-dock.md)
|
|
78
|
+
- [Host UI and telemetry](../subsystems/host-ui-and-telemetry.md)
|
|
79
|
+
|
|
80
|
+
## Source ownership/reference
|
|
81
|
+
|
|
82
|
+
Surface registration lives in `src/extension.ts`; update lookup is implemented in `src/core/update-check.ts` and owned by [host-ui-and-telemetry](../subsystems/host-ui-and-telemetry.md).
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc_id: commands/bg
|
|
3
|
+
audience: user
|
|
4
|
+
mode: mixed
|
|
5
|
+
review_policy: contract
|
|
6
|
+
stability: stable
|
|
7
|
+
covers_surfaces: [command:bg]
|
|
8
|
+
covers_sources: []
|
|
9
|
+
---
|
|
10
|
+
# `/bg`
|
|
11
|
+
|
|
12
|
+
<!-- pi-docs:begin name="command-contract-bg" generator="scripts/docs/generate.mjs" -->
|
|
13
|
+
| Command | Description | Provenance |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `/bg` | Start a shell command as a tracked background task: /bg [--agent] [--name "Task name"] <command> | `src/extension.ts:506` |
|
|
16
|
+
<!-- pi-docs:end name="command-contract-bg" -->
|
|
17
|
+
|
|
18
|
+
Start a shell command as a tracked background task from the command line.
|
|
19
|
+
|
|
20
|
+
## Synopsis
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
`/bg [--agent|--llm-agent] [--script|--no-agent] [--name <name>|-n <name>] [--] <command>`
|
|
24
|
+
|
|
25
|
+
`--name=<name>` and `-n=<name>` are also accepted. Quoted names are parsed by the extension before the remaining bytes become the shell command.
|
|
26
|
+
|
|
27
|
+
## When to use
|
|
28
|
+
|
|
29
|
+
Use `/bg` for user-driven long-running commands where you want a footer entry, output file, and display notification, but **not** an automatic agent follow-up turn. For agent-driven launches, prefer [`bg_run`](../tools/bg_run.md) because its default completion delivery wakes the agent.
|
|
30
|
+
|
|
31
|
+
## Defaults
|
|
32
|
+
|
|
33
|
+
- `isAgent`: `false`; set `--agent`/`--llm-agent` only when the command launches a Pi/LLM agent whose telemetry should be wrapped.
|
|
34
|
+
- `--script`/`--no-agent`: forces `isAgent:false` after earlier flags.
|
|
35
|
+
- `notifyOnCompletion`: `true`.
|
|
36
|
+
- `triggerOnCompletion`: `false` for `/bg`, so completion is display-only by default.
|
|
37
|
+
- Task name: explicit `--name` if present, otherwise derived from the command.
|
|
38
|
+
|
|
39
|
+
## Lifecycle
|
|
40
|
+
|
|
41
|
+
The command returns after the child process is spawned and reports task id, output path, and command. Terminal statuses are exactly `running`, `completed`, `failed`, or `killed`. A finished footer badge remains visible until that task's detail view is opened or [`/bg-clear`](bg-clear.md) marks unseen finished tasks seen.
|
|
42
|
+
|
|
43
|
+
## Examples
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
/bg --name "Docs build" npm run docs
|
|
47
|
+
/bg --agent --name "Child Pi" pi -p "summarize this repo"
|
|
48
|
+
/bg --name="Server" -- npm run dev -- --host 127.0.0.1
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Output/result
|
|
52
|
+
|
|
53
|
+
Start notification:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
Started <task-name> (<task-id>)
|
|
57
|
+
Output: .pi/tasks/<session>-<pid>/<task-id>.output
|
|
58
|
+
Command: <command>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Completion is delivered as a durable `background-task-notification` custom message when notifications are enabled, but `/bg` sets `triggerOnCompletion:false` so it does not start a provider follow-up turn.
|
|
62
|
+
|
|
63
|
+
## Errors
|
|
64
|
+
|
|
65
|
+
- Empty command: `Background command is empty`.
|
|
66
|
+
- Missing or unterminated `--name`: `requires a task name`.
|
|
67
|
+
- Shell/spawn errors fail the task loudly and write failure metadata.
|
|
68
|
+
- Unknown shell policy on Windows can reject the launch before a task is created.
|
|
69
|
+
|
|
70
|
+
## Runtime artifacts
|
|
71
|
+
|
|
72
|
+
Outputs and metadata are written under `.pi/tasks/<session-id>-<pid>/` as `<task-id>.output` and `<task-id>.json`. Model-visible log reads are bounded; the full output path is preserved in notices.
|
|
73
|
+
|
|
74
|
+
## Safety boundaries
|
|
75
|
+
|
|
76
|
+
Shell commands are **not sandboxed**. They run in the current project cwd through the platform shell selected by the runtime. `/bg` tracks and kills the child process/tree, but does not restrict filesystem, network, or subprocess behavior.
|
|
77
|
+
|
|
78
|
+
## Related docs
|
|
79
|
+
|
|
80
|
+
- [`bg_run`](../tools/bg_run.md)
|
|
81
|
+
- [`/jobs`](jobs.md)
|
|
82
|
+
- [`/logs`](logs.md)
|
|
83
|
+
- [`/kill`](kill.md)
|
|
84
|
+
- [`/bg-clear`](bg-clear.md)
|
|
85
|
+
- [Background task runtime](../subsystems/background-task-runtime.md)
|
|
86
|
+
- [Completion delivery](../concepts/completion-delivery.md)
|
|
87
|
+
|
|
88
|
+
## Source ownership/reference
|
|
89
|
+
|
|
90
|
+
Surface registration lives in `src/extension.ts`; argument parsing and lifecycle behavior are owned by [background-task-runtime](../subsystems/background-task-runtime.md).
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc_id: commands/fusion-models
|
|
3
|
+
audience: user
|
|
4
|
+
mode: mixed
|
|
5
|
+
review_policy: contract
|
|
6
|
+
stability: stable
|
|
7
|
+
covers_surfaces: [command:fusion-models]
|
|
8
|
+
covers_sources: []
|
|
9
|
+
---
|
|
10
|
+
# `/fusion-models`
|
|
11
|
+
|
|
12
|
+
<!-- pi-docs:begin name="command-contract-fusion-models" generator="scripts/docs/generate.mjs" -->
|
|
13
|
+
| Command | Description | Provenance |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `/fusion-models` | Open the five-slot global fusion model selector. | `src/fusion-extension.ts:914` |
|
|
16
|
+
<!-- pi-docs:end name="command-contract-fusion-models" -->
|
|
17
|
+
|
|
18
|
+
Open the global Fusion model selector.
|
|
19
|
+
|
|
20
|
+
## Availability
|
|
21
|
+
|
|
22
|
+
`/fusion-models` is **TUI-only**. RPC, JSON, print, and other non-TUI modes reject it; non-UI command contexts throw an error instead of relying on a no-op notification path.
|
|
23
|
+
|
|
24
|
+
## Slots
|
|
25
|
+
|
|
26
|
+
The selector edits exactly five global slots:
|
|
27
|
+
|
|
28
|
+
1. `Candidate 1`
|
|
29
|
+
2. `Candidate 2`
|
|
30
|
+
3. `Candidate 3`
|
|
31
|
+
4. `Evaluator`
|
|
32
|
+
5. `Merger`
|
|
33
|
+
|
|
34
|
+
Duplicate model selections are allowed. `$current` is the default for every slot and resolves at run time to Pi's current model; it is available only when a current model exists and is available to child Pi. Slash-containing model ids are stored as `provider/model-id` strings.
|
|
35
|
+
|
|
36
|
+
## UI behavior
|
|
37
|
+
|
|
38
|
+
The selector starts from the loaded config or the default all-`$current` config. It lists:
|
|
39
|
+
|
|
40
|
+
- `$current` first, with the current provider/model in the description when known;
|
|
41
|
+
- currently available registry models sorted by `provider/model`;
|
|
42
|
+
- configured-but-unavailable selections, marked unavailable, so stale configs can still be seen and replaced.
|
|
43
|
+
|
|
44
|
+
In the five-slot view, arrow keys move, Enter opens the model list, `r` resets the draft to defaults, `s` saves, and Esc or `q` cancels without saving. In the model-choice view, arrow keys move, typed text—including `q`—filters the list, Backspace edits the filter, Enter chooses and returns to the slots, and Esc returns to the slots without changing that slot.
|
|
45
|
+
|
|
46
|
+
## Persistence and conflicts
|
|
47
|
+
|
|
48
|
+
The config file is `fusion-models.json` in Pi's agent directory (`fusionModelConfigPath()`). Its schema is closed:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"schema_version": "pi-background-tasks.fusion-models.v1",
|
|
53
|
+
"candidates": ["$current", "$current", "$current"],
|
|
54
|
+
"evaluator": "$current",
|
|
55
|
+
"merger": "$current"
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Loads reject invalid JSON, unknown keys, wrong schema version, blank selections, surrounding whitespace, unqualified configured selections, and candidate arrays that do not contain exactly three entries.
|
|
60
|
+
|
|
61
|
+
Saves are durable and revision-safe: the parent captures the file revision hash on load, takes a lock next to the config, verifies the on-disk revision still matches, then atomically replaces the file. If another process changes the file first, the save fails with a config-conflict error shown inside the selector; it does not overwrite concurrent work. Lock acquisition times out loudly after 10 seconds.
|
|
62
|
+
|
|
63
|
+
## Route admission
|
|
64
|
+
|
|
65
|
+
At run time every slot is resolved through the available model registry. Frontier routes are accepted only through the Pi subscription OAuth path for `anthropic` or `openai-codex` and only on trusted subscription endpoints. Direct OpenAI/OpenRouter/Azure/frontier API-key routes, endpoint/header overrides of subscription auth, unavailable models, missing current model, and missing positive context windows fail before child creation. There is no fallback, model substitution, or tier bump.
|
|
66
|
+
|
|
67
|
+
## Related
|
|
68
|
+
|
|
69
|
+
- Command using the selected routes: [`fusion.md`](fusion.md)
|
|
70
|
+
- Behavioral owner/troubleshooting: [`../subsystems/fusion.md`](../subsystems/fusion.md)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc_id: commands/fusion
|
|
3
|
+
audience: user
|
|
4
|
+
mode: mixed
|
|
5
|
+
review_policy: contract
|
|
6
|
+
stability: stable
|
|
7
|
+
covers_surfaces: [command:fusion]
|
|
8
|
+
covers_sources: []
|
|
9
|
+
---
|
|
10
|
+
# `/fusion`
|
|
11
|
+
|
|
12
|
+
<!-- pi-docs:begin name="command-contract-fusion" generator="scripts/docs/generate.mjs" -->
|
|
13
|
+
| Command | Description | Provenance |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `/fusion` | Run fixed-purpose Fusion reason (no candidate tools) and append the merged result directly. | `src/fusion-extension.ts:891` |
|
|
16
|
+
<!-- pi-docs:end name="command-contract-fusion" -->
|
|
17
|
+
|
|
18
|
+
Run the fixed-purpose Fusion **reason** workflow from the command line.
|
|
19
|
+
|
|
20
|
+
## Synopsis
|
|
21
|
+
|
|
22
|
+
`/fusion <prompt>`
|
|
23
|
+
|
|
24
|
+
`/fusion` with no arguments opens Pi's multiline editor in UI-capable modes. If the editor is cancelled or the edited text is blank after trimming, Fusion returns without spawning children.
|
|
25
|
+
|
|
26
|
+
## Current v1 behavior
|
|
27
|
+
|
|
28
|
+
`/fusion` is shorthand for `fusion_reason({prompt})`:
|
|
29
|
+
|
|
30
|
+
- the public workflow is always `reason`;
|
|
31
|
+
- there is no capability or mode argument;
|
|
32
|
+
- candidate children run without tools;
|
|
33
|
+
- evaluator, conditional evaluator-repair, and merger children also run without tools;
|
|
34
|
+
- the request is captured as a versioned visible-conversation projection, not as a raw transcript.
|
|
35
|
+
|
|
36
|
+
The retired `fusion_brainstorm` public tool is not registered and is removed from active tools on session start. Historical completed v4 result messages can still render, but `/fusion` never reactivates the retired surface.
|
|
37
|
+
|
|
38
|
+
## Conversation input
|
|
39
|
+
|
|
40
|
+
Reason/session-projection input uses schema `pi-background-tasks.fusion-input.v5`. The child-facing input contains:
|
|
41
|
+
|
|
42
|
+
- `request.text` with the exact command prompt;
|
|
43
|
+
- request authority `directive_over_projected_conversation` for the command path;
|
|
44
|
+
- the parent system prompt inside the versioned session-projection context;
|
|
45
|
+
- visible user/assistant text entries preserved verbatim;
|
|
46
|
+
- deterministic omission receipts for assistant thinking, tool calls, and text/image tool results.
|
|
47
|
+
|
|
48
|
+
Omitted payload bytes are not summarized or previewed for the children. If a fact exists only inside omitted tool output, restate it in the prompt.
|
|
49
|
+
|
|
50
|
+
## Result delivery
|
|
51
|
+
|
|
52
|
+
After a successful run, `/fusion` appends two custom messages without asking the parent model to rewrite the answer:
|
|
53
|
+
|
|
54
|
+
1. a hidden `fusion-request` record for the command request/run id;
|
|
55
|
+
2. a visible `fusion-result` record whose content is the merger's exact text and whose details include run id, artifact directory, model summary, usage/cost, evaluator-attempt count, and budget metadata.
|
|
56
|
+
|
|
57
|
+
In TUI mode `/fusion` uses a cancellable loader. Cancelling aborts the active child process tree and records a cancelled run when a run directory exists.
|
|
58
|
+
|
|
59
|
+
## Calls and failure shape
|
|
60
|
+
|
|
61
|
+
A successful run uses three candidate children, one blind evaluator, and one merger. If the first evaluator response is invalid JSON or violates the closed evaluation schema, Fusion performs exactly one evaluator-repair attempt before failing or continuing. Therefore a successful run may have five or six child invocations; preflight failures launch zero children, and candidate/evaluator/merge failures stop the workflow rather than substituting another model.
|
|
62
|
+
|
|
63
|
+
Failures are reported as `Fusion failed: ...`; tool/stage errors include the artifact directory when one exists. Prompt-budget forecast failures happen before child creation. Child cancellation, timeout, output caps, model-route admission failures, invalid evaluator JSON after repair, invalid compact child metadata, and invalid tool-call audits are loud failures.
|
|
64
|
+
|
|
65
|
+
## Related
|
|
66
|
+
|
|
67
|
+
- Tool equivalent: [`../tools/fusion_reason.md`](../tools/fusion_reason.md)
|
|
68
|
+
- Model selector: [`fusion-models.md`](fusion-models.md)
|
|
69
|
+
- Behavioral owner/troubleshooting: [`../subsystems/fusion.md`](../subsystems/fusion.md)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc_id: commands/jobs
|
|
3
|
+
audience: user
|
|
4
|
+
mode: mixed
|
|
5
|
+
review_policy: contract
|
|
6
|
+
stability: stable
|
|
7
|
+
covers_surfaces: [command:jobs]
|
|
8
|
+
covers_sources: []
|
|
9
|
+
---
|
|
10
|
+
# `/jobs`
|
|
11
|
+
|
|
12
|
+
<!-- pi-docs:begin name="command-contract-jobs" generator="scripts/docs/generate.mjs" -->
|
|
13
|
+
| Command | Description | Provenance |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `/jobs` | List running and recent background tasks | `src/extension.ts:594` |
|
|
16
|
+
<!-- pi-docs:end name="command-contract-jobs" -->
|
|
17
|
+
|
|
18
|
+
List running and recent background tasks.
|
|
19
|
+
|
|
20
|
+
## Synopsis
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
`/jobs`
|
|
24
|
+
|
|
25
|
+
## When to use
|
|
26
|
+
|
|
27
|
+
Use `/jobs` for a point-in-time textual snapshot when the interactive task manager is unavailable or unnecessary.
|
|
28
|
+
|
|
29
|
+
## Defaults
|
|
30
|
+
|
|
31
|
+
No arguments. It lists all tasks currently retained by this extension runtime: running tasks plus recent finished tasks not pruned from the in-memory registry.
|
|
32
|
+
|
|
33
|
+
## Lifecycle
|
|
34
|
+
|
|
35
|
+
Tasks have exactly these statuses: `running`, `completed`, `failed`, `killed`. Finished tasks are kept as recent history up to the runtime's recent-task retention limit; running tasks are preserved when pruning old finished tasks.
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
/jobs
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Output/result
|
|
44
|
+
|
|
45
|
+
If no tasks exist:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
No background tasks in this Pi extension runtime.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Otherwise each task line includes status icon, id, status, age, optional exit code, optional pid, task-owned telemetry summaries when reported, display name, optional error, and a following `output: <path>` line.
|
|
52
|
+
|
|
53
|
+
## Errors
|
|
54
|
+
|
|
55
|
+
No task-resolution errors; it formats the current registry contents.
|
|
56
|
+
|
|
57
|
+
## Runtime artifacts
|
|
58
|
+
|
|
59
|
+
`/jobs` reads in-memory task snapshots. It points at `.pi/tasks/<session-id>-<pid>/<task-id>.output` but does not read output bytes.
|
|
60
|
+
|
|
61
|
+
## Safety boundaries
|
|
62
|
+
|
|
63
|
+
Read-only inspection. It does not wait, poll, kill, or modify tasks.
|
|
64
|
+
|
|
65
|
+
## Related docs
|
|
66
|
+
|
|
67
|
+
- [`/logs`](logs.md)
|
|
68
|
+
- [`/kill`](kill.md)
|
|
69
|
+
- [`bg_status`](../tools/bg_status.md)
|
|
70
|
+
- [Background task runtime](../subsystems/background-task-runtime.md)
|
|
71
|
+
|
|
72
|
+
## Source ownership/reference
|
|
73
|
+
|
|
74
|
+
Surface registration lives in `src/extension.ts`; snapshot formatting is owned by [background-task-runtime](../subsystems/background-task-runtime.md).
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc_id: commands/kill
|
|
3
|
+
audience: user
|
|
4
|
+
mode: mixed
|
|
5
|
+
review_policy: contract
|
|
6
|
+
stability: stable
|
|
7
|
+
covers_surfaces: [command:kill]
|
|
8
|
+
covers_sources: []
|
|
9
|
+
---
|
|
10
|
+
# `/kill`
|
|
11
|
+
|
|
12
|
+
<!-- pi-docs:begin name="command-contract-kill" generator="scripts/docs/generate.mjs" -->
|
|
13
|
+
| Command | Description | Provenance |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `/kill` | Stop a running background task: /kill <id> | `src/extension.ts:638` |
|
|
16
|
+
<!-- pi-docs:end name="command-contract-kill" -->
|
|
17
|
+
|
|
18
|
+
Stop a running background task.
|
|
19
|
+
|
|
20
|
+
## Synopsis
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
`/kill <task-id-or-prefix>`
|
|
24
|
+
|
|
25
|
+
## When to use
|
|
26
|
+
|
|
27
|
+
Use `/kill` when a tracked background task is no longer needed or is hung. Use [`bg_kill`](../tools/bg_kill.md) for the same operation from an agent tool call.
|
|
28
|
+
|
|
29
|
+
## Defaults
|
|
30
|
+
|
|
31
|
+
No defaults beyond task id/prefix resolution. Prefixes must be unambiguous.
|
|
32
|
+
|
|
33
|
+
## Lifecycle
|
|
34
|
+
|
|
35
|
+
Only `running` tasks can be killed. A successful user kill sets terminal status `killed` and records the task output path. Trying to kill a `completed`, `failed`, or already `killed` task fails loudly.
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
/kill b12345678
|
|
41
|
+
/kill b1234
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Output/result
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
Killed <task-name> (<task-id>). Output: .pi/tasks/.../<task-id>.output
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Errors
|
|
51
|
+
|
|
52
|
+
- Missing id: `Task ID is required`.
|
|
53
|
+
- Unknown id/prefix: `Unknown background task ID: <id>`.
|
|
54
|
+
- Ambiguous prefix: lists matching task ids.
|
|
55
|
+
- Non-running task: `Task <id> is <status>, not running`.
|
|
56
|
+
- Kill failure: platform-specific loud error.
|
|
57
|
+
|
|
58
|
+
Errors are shown as `Background kill error: ...`.
|
|
59
|
+
|
|
60
|
+
## Runtime artifacts
|
|
61
|
+
|
|
62
|
+
The task's output file and metadata remain in `.pi/tasks/...`. Termination notices and errors may be appended to the output and metadata.
|
|
63
|
+
|
|
64
|
+
## Safety boundaries
|
|
65
|
+
|
|
66
|
+
Process termination differs by platform:
|
|
67
|
+
|
|
68
|
+
- POSIX first targets the detached process group with `SIGTERM`, falls back to the child handle, and escalates to `SIGKILL` after the grace window.
|
|
69
|
+
- Windows uses `taskkill.exe /PID <pid> /T`, then `/F` after the grace window. Force failure is surfaced loudly because descendant processes may have leaked.
|
|
70
|
+
|
|
71
|
+
Shell commands are not sandboxed; killing controls only tracked process handles/trees.
|
|
72
|
+
|
|
73
|
+
## Related docs
|
|
74
|
+
|
|
75
|
+
- [`bg_kill`](../tools/bg_kill.md)
|
|
76
|
+
- [`/jobs`](jobs.md)
|
|
77
|
+
- [`/logs`](logs.md)
|
|
78
|
+
- [Background task runtime](../subsystems/background-task-runtime.md)
|
|
79
|
+
|
|
80
|
+
## Source ownership/reference
|
|
81
|
+
|
|
82
|
+
Surface registration lives in `src/extension.ts`; process termination is owned by [background-task-runtime](../subsystems/background-task-runtime.md).
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc_id: commands/logs
|
|
3
|
+
audience: user
|
|
4
|
+
mode: mixed
|
|
5
|
+
review_policy: contract
|
|
6
|
+
stability: stable
|
|
7
|
+
covers_surfaces: [command:logs]
|
|
8
|
+
covers_sources: []
|
|
9
|
+
---
|
|
10
|
+
# `/logs`
|
|
11
|
+
|
|
12
|
+
<!-- pi-docs:begin name="command-contract-logs" generator="scripts/docs/generate.mjs" -->
|
|
13
|
+
| Command | Description | Provenance |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `/logs` | Show bounded output from a background task: /logs <id> [maxBytes] | `src/extension.ts:607` |
|
|
16
|
+
<!-- pi-docs:end name="command-contract-logs" -->
|
|
17
|
+
|
|
18
|
+
Show bounded output from a background task.
|
|
19
|
+
|
|
20
|
+
## Synopsis
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
`/logs <task-id-or-prefix> [maxBytes]`
|
|
24
|
+
|
|
25
|
+
Slash-command logs always read the tail.
|
|
26
|
+
|
|
27
|
+
## When to use
|
|
28
|
+
|
|
29
|
+
Use `/logs` when you need task output in the host UI. For agent tool calls, use [`bg_logs`](../tools/bg_logs.md) and avoid repeated calls as a waiting loop.
|
|
30
|
+
|
|
31
|
+
## Defaults
|
|
32
|
+
|
|
33
|
+
- `maxBytes`: defaults to the model-safe log cap, currently up to 50 KiB.
|
|
34
|
+
- Values are normalized to an integer in `[1, MAX_LOG_BYTES]`; invalid numbers use the default.
|
|
35
|
+
- `tail`: always `true` for `/logs`.
|
|
36
|
+
|
|
37
|
+
## Lifecycle
|
|
38
|
+
|
|
39
|
+
`/logs` is a point-in-time read of the output file. It does not subscribe, follow, or poll. Running tasks may produce more output after the read.
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
/logs b12345678
|
|
45
|
+
/logs b1234 2000
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Output/result
|
|
49
|
+
|
|
50
|
+
The notification contains output text. If truncated, a notice is prepended for tail reads:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
[Showing tail <bytes-read> of <total>; <omitted> omitted. Full output: .pi/tasks/.../<task-id>.output]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
If not truncated, the result ends with:
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
[Full output: .pi/tasks/.../<task-id>.output]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The full output path is preserved even when model-visible bytes are bounded.
|
|
63
|
+
|
|
64
|
+
## Errors
|
|
65
|
+
|
|
66
|
+
- Missing id: `Task ID is required`.
|
|
67
|
+
- Unknown id/prefix: `Unknown background task ID: <id>`.
|
|
68
|
+
- Ambiguous prefix: lists matching task ids.
|
|
69
|
+
- Missing output file: `Output file does not exist for <id>: <path>`.
|
|
70
|
+
|
|
71
|
+
Errors are shown as `Background logs error: ...`.
|
|
72
|
+
|
|
73
|
+
## Runtime artifacts
|
|
74
|
+
|
|
75
|
+
Reads `.pi/tasks/<session-id>-<pid>/<task-id>.output`; does not modify output or metadata.
|
|
76
|
+
|
|
77
|
+
## Safety boundaries
|
|
78
|
+
|
|
79
|
+
Read-only bounded inspection. It is not a polling primitive and should not be used merely to wait for completion.
|
|
80
|
+
|
|
81
|
+
## Related docs
|
|
82
|
+
|
|
83
|
+
- [`bg_logs`](../tools/bg_logs.md)
|
|
84
|
+
- [`/jobs`](jobs.md)
|
|
85
|
+
- [`/kill`](kill.md)
|
|
86
|
+
- [Background task runtime](../subsystems/background-task-runtime.md)
|
|
87
|
+
|
|
88
|
+
## Source ownership/reference
|
|
89
|
+
|
|
90
|
+
Surface registration lives in `src/extension.ts`; bounded log reading is owned by [background-task-runtime](../subsystems/background-task-runtime.md).
|