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.
Files changed (72) hide show
  1. package/BACKGROUND-TASKS-INSTRUCTIONS.md +63 -0
  2. package/PUBLISHING.md +43 -29
  3. package/README.md +233 -441
  4. package/TESTING.md +16 -10
  5. package/TEST_PLAN.md +43 -17
  6. package/docs/INDEX.md +157 -0
  7. package/docs/api/eventbus-v1.md +166 -0
  8. package/docs/assets/architecture.svg +78 -0
  9. package/docs/assets/footer-dock.svg +47 -0
  10. package/docs/assets/logo.svg +49 -0
  11. package/docs/attestations.json +189 -0
  12. package/docs/choose-a-workflow.md +98 -0
  13. package/docs/commands/bg-clear.md +70 -0
  14. package/docs/commands/bg-update.md +82 -0
  15. package/docs/commands/bg.md +90 -0
  16. package/docs/commands/fusion-models.md +70 -0
  17. package/docs/commands/fusion.md +69 -0
  18. package/docs/commands/jobs.md +74 -0
  19. package/docs/commands/kill.md +82 -0
  20. package/docs/commands/logs.md +90 -0
  21. package/docs/commands/task-manager.md +109 -0
  22. package/docs/concepts/completion-delivery.md +66 -0
  23. package/docs/concepts/context-projection-and-budgeting.md +79 -0
  24. package/docs/getting-started.md +122 -0
  25. package/docs/manifest.json +1825 -0
  26. package/docs/operations/configuration.md +110 -0
  27. package/docs/operations/releasing.md +67 -0
  28. package/docs/operations/testing.md +101 -0
  29. package/docs/operations/troubleshooting.md +38 -0
  30. package/docs/read-before-edit.md +94 -0
  31. package/docs/reference/runtime-contracts.md +213 -0
  32. package/docs/reference/shortcuts-and-dock.md +70 -0
  33. package/docs/subsystems/attested-pi-runs.md +141 -0
  34. package/docs/subsystems/background-task-runtime.md +85 -0
  35. package/docs/subsystems/child-launch-durability-and-safety.md +57 -0
  36. package/docs/subsystems/delegation.md +190 -0
  37. package/docs/subsystems/docs-freshness-gate.md +26 -0
  38. package/docs/subsystems/fusion.md +123 -0
  39. package/docs/subsystems/host-ui-and-telemetry.md +83 -0
  40. package/docs/tools/bg_delegate.md +193 -0
  41. package/docs/tools/bg_kill.md +114 -0
  42. package/docs/tools/bg_logs.md +133 -0
  43. package/docs/tools/bg_result.md +120 -0
  44. package/docs/tools/bg_run.md +168 -0
  45. package/docs/tools/bg_run_pi_attested.md +170 -0
  46. package/docs/tools/bg_status.md +111 -0
  47. package/docs/tools/fusion_investigate.md +116 -0
  48. package/docs/tools/fusion_reason.md +75 -0
  49. package/docs/tools/fusion_research.md +162 -0
  50. package/docs/tools/fusion_validate.md +206 -0
  51. package/logo.png +0 -0
  52. package/package.json +27 -9
  53. package/src/core/delegate/budget.ts +1 -1
  54. package/src/core/delegate/launch.ts +5 -0
  55. package/src/core/fusion/artifacts.ts +34 -4
  56. package/src/core/fusion/budget.ts +112 -20
  57. package/src/core/fusion/child-protocol.ts +82 -0
  58. package/src/core/fusion/clean-context.ts +91 -0
  59. package/src/core/fusion/config.ts +124 -35
  60. package/src/core/fusion/context.ts +29 -7
  61. package/src/core/fusion/evaluation.ts +392 -15
  62. package/src/core/fusion/orchestrator.ts +217 -23
  63. package/src/core/fusion/pi-child.ts +227 -24
  64. package/src/core/fusion/prompts.ts +39 -26
  65. package/src/core/fusion/source-policy.ts +257 -0
  66. package/src/core/fusion/types.ts +156 -11
  67. package/src/core/fusion/web-fetch.ts +104 -15
  68. package/src/core/fusion/workflows.ts +119 -65
  69. package/src/extension.ts +3 -3
  70. package/src/fusion-child-extension.ts +375 -141
  71. package/src/fusion-extension.ts +585 -240
  72. package/src/testing/normalize.ts +0 -22
@@ -0,0 +1,110 @@
1
+ ---
2
+ doc_id: operations/configuration
3
+ audience: maintainer
4
+ mode: authored
5
+ review_policy: contract
6
+ stability: stable
7
+ covers_surfaces: []
8
+ covers_sources: []
9
+ ---
10
+ # Configuration
11
+
12
+ This page lists operator-facing configuration found in source. It intentionally does not invent undocumented environment variables.
13
+
14
+ ## Update check
15
+
16
+ At `session_start`, the extension performs a one-shot, time-boxed npm latest-version lookup. Failures are offline-safe: the footer simply shows no update segment.
17
+
18
+ | Variable | Effect |
19
+ |---|---|
20
+ | `PI_BG_DISABLE_UPDATE_CHECK=1` | Skip the update check. |
21
+ | `PI_OFFLINE=1` | Skip the update check. |
22
+ | `PI_BG_REGISTRY_URL=<url>` | Use a registry mirror instead of `https://registry.npmjs.org`. |
23
+
24
+ `/bg-update` only prints update commands; it does not install or self-update.
25
+
26
+ ## Shell selection
27
+
28
+ ### POSIX
29
+
30
+ For ordinary `bg_run` and `/bg` shell commands, non-Windows platforms use `SHELL` when it is set, otherwise `/bin/sh`.
31
+
32
+ ### Windows
33
+
34
+ Windows defaults to `cmd.exe`/`ComSpec`. The generic `SHELL` variable is ignored on Windows so existing `cmd` syntax does not silently change language.
35
+
36
+ | Variable | Effect |
37
+ |---|---|
38
+ | `PI_BG_SHELL=cmd` | Use Windows `cmd` dialect. |
39
+ | `PI_BG_SHELL=bash` | Use POSIX-style `bash -c` on Windows. |
40
+ | `PI_BG_SHELL_PATH=<absolute .exe/.com>` | Explicit shell path; requires `PI_BG_SHELL`. |
41
+
42
+ Invalid Windows shell settings fail loudly instead of falling back. `bash` is invoked with `-c`, not `-lc`.
43
+
44
+ ## Output and log caps
45
+
46
+ | Setting/surface | Value/behavior |
47
+ |---|---|
48
+ | `PI_BG_MAX_OUTPUT_BYTES` | Optional environment override for task output cap. Default is 20 MiB. Exceeding it fails/kills the task rather than claiming success. |
49
+ | `bg_logs.maxBytes` / `/logs <id> [maxBytes]` | Bounded model-visible read. The package cap is 50 KiB. |
50
+ | Full output | Written under `.pi/tasks/<session-id>-<pid>/<task-id>.output`. |
51
+
52
+ Bounded logs are for context safety; they point to the full local output file when more bytes exist.
53
+
54
+ ## Pi-agent telemetry opt-out
55
+
56
+ | Variable | Effect |
57
+ |---|---|
58
+ | `PI_BG_DISABLE_PI_TELEMETRY=1` | Do not wrap shell commands that appear to launch `pi -p ...` or `pi --mode json ...` when `isAgent:true`. Raw stdout is preserved. |
59
+
60
+ Telemetry wrapping is best-effort and task-owned. Missing telemetry is reported as unavailable, never as zero. Under Windows `cmd`, safe interception is unavailable and the command is left unchanged.
61
+
62
+ ## Fusion model configuration
63
+
64
+ Fusion model slots are stored globally under the Pi agent directory as:
65
+
66
+ ```text
67
+ fusion-models.json
68
+ ```
69
+
70
+ Use `/fusion-models` in TUI mode to configure five slots:
71
+
72
+ - Candidate 1
73
+ - Candidate 2
74
+ - Candidate 3
75
+ - Evaluator
76
+ - Merger
77
+
78
+ Missing config means all five slots are `$current`. Config entries are qualified `provider/model` selections or `$current`; malformed config, stale explicit models, unavailable current models, and concurrent selector conflicts fail loudly before child inference.
79
+
80
+ Fusion accepts frontier-model routes only through Pi Anthropic or Codex subscription OAuth where `ModelRegistry.isUsingOAuth` confirms the route. Metered frontier API-key/base-URL paths are rejected before child creation, and relevant metered environment variables are stripped from Fusion children.
81
+
82
+ ## Fusion runtime limits
83
+
84
+ These are source constants, not documented operator env knobs:
85
+
86
+ | Limit | Value |
87
+ |---|---:|
88
+ | Child absolute timeout | 30 minutes |
89
+ | Child stale-output watchdog | 20 minutes |
90
+ | Child stdout cap | 32 MiB |
91
+ | Child stderr cap | 4 MiB |
92
+ | Candidate output contract | 48 KiB JSON-rendered bytes |
93
+ | Evaluator output contract | 64 KiB JSON-rendered bytes |
94
+ | Merger output contract | 64 KiB JSON-rendered bytes |
95
+ | `fusion_web_fetch` timeout | 60 seconds |
96
+ | `fusion_web_fetch` response body cap | 2 MiB |
97
+ | `fusion_web_fetch` returned content cap | 32 KiB |
98
+ | `fusion_web_fetch` redirect cap | 5 hops |
99
+
100
+ Oversized Fusion outputs fail loudly and are preserved in local artifacts where applicable. They are not forwarded or silently truncated.
101
+
102
+ ## Offline behavior
103
+
104
+ - Update checks skip when `PI_OFFLINE=1` and degrade to no footer update segment on any lookup failure.
105
+ - Background shell commands may still do whatever the command does; the package does not block their network access.
106
+ - Fusion child model calls require configured Pi model routes. `fusion_research` additionally requires network access to the caller-supplied public URLs it fetches.
107
+
108
+ ## Durability and platform note
109
+
110
+ Task metadata, delegate/Fusion artifacts, attestation sidecars, and `fusion-models.json` use durable write helpers. Ordinary task `.output` streams are ended and drained before terminal publication but are not explicitly fsynced. POSIX performs directory `fsync` after atomic replacement. Windows still flushes replaced file contents before rename and treats rename failures as fatal, but it does not get the same portable directory-entry crash-durability guarantee.
@@ -0,0 +1,67 @@
1
+ ---
2
+ doc_id: operations/releasing
3
+ audience: maintainer
4
+ mode: authored
5
+ review_policy: contract
6
+ stability: evolving
7
+ covers_surfaces: []
8
+ covers_sources: []
9
+ ---
10
+ # Releasing operations
11
+
12
+ Package maintenance entrypoint: `PUBLISHING.md`. Source version is always `package.json`; never hard-code a release version in commands.
13
+
14
+ ```bash
15
+ VERSION=$(node -p "require('./package.json').version")
16
+ printf 'pi-background-tasks@%s\n' "$VERSION"
17
+ ```
18
+
19
+ Current observed standalone git tags stop at `v0.6.0`. Do not advertise or certify a `v1.x` git install tag until that tag exists in the standalone package repository.
20
+
21
+ ## Ordinary release checks
22
+
23
+ Run from the `pi-background-tasks` package root in an isolated environment. These are release-candidate checks, not tag certification:
24
+
25
+ ```bash
26
+ npm run typecheck
27
+ npm run test:type-safety
28
+ npm run test:unit
29
+ npm run test:sdk
30
+ npm run test:rpc
31
+ npm run test:component
32
+ npm run test:package
33
+ npm run test:hook-contract
34
+ npm run smoke
35
+ npm run smoke:large-context
36
+ npm run pack:dry-run
37
+ npm run docs:verify
38
+ npm run payload:check
39
+ # On a tag ref only: GITHUB_REF_TYPE=tag GITHUB_REF_NAME=v$VERSION npm run release:check-version
40
+ npm run test:compat
41
+ npm view pi-background-tasks name version --json
42
+ ```
43
+
44
+ `npm run test:full` additionally runs PTY and scripted-provider agent-loop gates. Treat it as a full interactive gate; do not run it for routine docs edits.
45
+
46
+ Live evidence (`npx tsx scripts/delegate-live-run.ts`) is release-time and performs real subscription-OAuth inference. It must never use API-key/metered frontier channels.
47
+
48
+ ## Payload verification
49
+
50
+ Use `npm pack --dry-run --json` output as the payload source of truth. Verify at minimum:
51
+
52
+ - `extensions/background-tasks.ts` is included as the Pi entrypoint;
53
+ - runtime `src/` files needed by the entrypoint are included;
54
+ - `docs/`, `README.md`, `TESTING.md`, `TEST_PLAN.md`, `PUBLISHING.md`, `BACKGROUND-TASKS-INSTRUCTIONS.md`, root `logo.png`, and `LICENSE` are included per current `package.json.files`;
55
+ - tests, scripts, node_modules, local `.pi/` artifacts, generated evidence not meant for runtime, and nested tarballs are excluded;
56
+ - TypeBox remains a Pi-provided peer and no private/nested runtime TypeBox copy is bundled;
57
+ - docs/assets/gateway/logo inclusion matches `package.json.files` exactly.
58
+
59
+ ## Tag certification vs npm publishing
60
+
61
+ Separate these activities:
62
+
63
+ 1. **npm release candidate:** version comes from `package.json`; run ordinary release checks; inspect pack payload; publish only on operator approval.
64
+ 2. **git tag certification:** verify the standalone repo is at the exact release commit, clean, and already has or is about to receive tag `v$VERSION`. `npm run release:check-version` requires an explicit tag ref (`GITHUB_REF_TYPE=tag`, `GITHUB_REF_NAME=v$VERSION`) and never publishes. Tags currently observed stop at `v0.6.0`, so `v$VERSION` is not certified merely because npm has that version.
65
+ 3. **post-publish install smoke:** install by `npm:pi-background-tasks@$VERSION` in an isolated Pi agent dir. Use git install smoke only after the corresponding standalone tag exists.
66
+
67
+ No auto-publish. No automated push/tag from repair runs unless the operator explicitly asks.
@@ -0,0 +1,101 @@
1
+ ---
2
+ doc_id: operations/testing
3
+ audience: maintainer
4
+ mode: authored
5
+ review_policy: contract
6
+ stability: evolving
7
+ covers_surfaces: []
8
+ covers_sources: []
9
+ ---
10
+ # Testing operations
11
+
12
+ Package entry docs: `TESTING.md` and `TEST_PLAN.md`. This page explains how to choose gates without losing the detailed coverage matrix.
13
+
14
+ ## Isolation defaults
15
+
16
+ Automated package tests should use isolated temp project/agent/session directories and these defaults unless a test intentionally overrides them:
17
+
18
+ ```bash
19
+ PI_OFFLINE=1
20
+ PI_SKIP_VERSION_CHECK=1
21
+ PI_TELEMETRY=0
22
+ CI=1
23
+ ```
24
+
25
+ Never point tests at the user's real `~/.pi/agent`.
26
+
27
+ ## Current package scripts
28
+
29
+ From current `package.json`:
30
+
31
+ | Lane | Script | Meaning |
32
+ |---|---|---|
33
+ | Typecheck | `npm run typecheck` | `tsc --noEmit`. |
34
+ | Type safety package tests | `npm run test:type-safety` | Package/type-safety tests. |
35
+ | Unit | `npm run test:unit` | Pure/unit coverage, including durable fs, budgets, projection, Fusion/delegate core. |
36
+ | SDK | `npm run test:sdk` | Real package entrypoint through SDK-style harnesses. |
37
+ | RPC | `npm run test:rpc` | RPC command/tool surface. |
38
+ | Component | `npm run test:component` | TUI component rendering/key behavior. |
39
+ | Package | `npm run test:package` | Manifest/payload/mutation/package guards. |
40
+ | Hook contract | `npm run test:hook-contract` | Real Pi hook characterization evidence comparison. |
41
+ | Default | `npm run test` | Typecheck + type-safety + unit + SDK + RPC + component + package + hook-contract. |
42
+ | PTY | `npm run test:pty` | Real expect/TUI scenarios; full gate only. |
43
+ | Agent loop | `npm run test:agent-loop` | Scripted-provider real agent-loop behavior; full gate only. |
44
+ | Full | `npm run test:full` | Default + PTY + agent-loop. |
45
+ | Smoke | `npm run smoke` | Isolated load-only `/jobs`. |
46
+ | Large context smoke | `npm run smoke:large-context` | Offline Fusion context/budget reproduction; no inference/child spawn. |
47
+ | Compatibility | `npm run test:compat` | Release-only exact Pi version install/compat plus current-host witness. |
48
+ | Pack | `npm run pack:dry-run` | Release payload preview. |
49
+ | Docs generate | `npm run docs:generate` | Regenerates generated docs regions/index/manifest. |
50
+ | Docs verify | `npm run docs:verify` | Offline, read-only deterministic docs freshness verification; renders generated files twice in memory and compares committed bytes. |
51
+ | Docs attestation | `npm run docs:attest/record -- <doc_id> --reviewer <identity-after-semantic-review> --verdict PASS --notes <review-notes>` | Computes hashes and records an explicit semantic PASS receipt after review; `npm run docs:attest` is an alias and still needs args. |
52
+ | Docs unit/package gate | `npm run test:docs` | Docs-gate unit/package tests. |
53
+ | Payload check | `npm run payload:check` | Package payload policy check. |
54
+ | Release version check | `npm run release:check-version` | Tag-only version sanity; requires explicit `GITHUB_REF_TYPE=tag`/`GITHUB_REF_NAME=v$VERSION` and never publishes. |
55
+
56
+ Do not run full/default/root suites for documentation-only edits unless the operator explicitly asks. If the operator restricts verification to focused checks, report that `docs:verify`/attestation were not run.
57
+
58
+ ## Evidence that must be preserved
59
+
60
+ `TESTING.md` and `TEST_PLAN.md` intentionally carry exhaustive QA knowledge. Do not replace them with generic summaries.
61
+
62
+ Preserve especially:
63
+
64
+ - Pi hook contract evidence and byte-identical shipped copy behavior;
65
+ - Fusion golden-byte and independent oracle coverage;
66
+ - delegate seed/budget/artifact/result/guard/mutation coverage;
67
+ - scripted-provider no-poll/no-sleep follow-up behavior;
68
+ - PTY keyboard-protocol negotiation notes;
69
+ - compatibility TypeBox peer/payload checks;
70
+ - live subscription evidence caveat: it is release-time, real inference, and subscription OAuth only.
71
+
72
+ ## Focused docs checks
73
+
74
+ When a change is constrained to focused docs checks, use targeted checks such as:
75
+
76
+ ```bash
77
+ python3 - <<'PY'
78
+ from pathlib import Path
79
+ for p in [*Path('docs').rglob('*.md'), Path('TESTING.md'), Path('TEST_PLAN.md'), Path('PUBLISHING.md')]:
80
+ if p.exists(): print(p)
81
+ PY
82
+ ```
83
+
84
+ Recommended focused checks for docs changes:
85
+
86
+ 1. frontmatter schema on `docs/**/*.md`;
87
+ 2. package-local markdown links resolve;
88
+ 3. no standalone links to removed parent `../EXTENSION_*` standards;
89
+ 4. docs workflow wording matches current `package.json` scripts;
90
+ 5. version/tag references derive from `package.json` or observed git tags.
91
+
92
+ These checks are not substitutes for code gates when source behavior changes.
93
+
94
+ ## Gate selection
95
+
96
+ - **Doc-only navigation/release wording:** focused link/frontmatter/version checks.
97
+ - **EventBus docs vs API changes:** EventBus unit/SDK targeted tests if code changed; otherwise focused docs checks.
98
+ - **Context projection/budget changes:** unit tests for projection/budget/golden/oracle; do not update goldens casually.
99
+ - **Durability/launch changes:** durable-fs, pi-launch, Windows argv targeted units.
100
+ - **Delegate guard changes:** hook contract, delegate unit/SDK/scripted-provider targeted gates.
101
+ - **Release candidate:** ordinary release checks in `docs/operations/releasing.md`; live subscription evidence only when explicitly certifying release behavior.
@@ -0,0 +1,38 @@
1
+ ---
2
+ doc_id: operations/troubleshooting
3
+ audience: maintainer
4
+ mode: authored
5
+ review_policy: contract
6
+ stability: evolving
7
+ covers_surfaces: []
8
+ covers_sources: []
9
+ ---
10
+ # Troubleshooting
11
+
12
+ Start from the symptom, verify the source-owned doc, then apply the remediation. Do not tier-bump models, switch routes, or add fallbacks to make a failure disappear.
13
+
14
+ | Symptom/error | Likely cause | Remediation |
15
+ |---|---|---|
16
+ | EventBus response says `request frame must be an object`, `unknown key`, `schema_version mismatch`, or duplicate `request_id` | Request frame violates the closed EventBus v1 schema | Fix caller frame to match `docs/api/eventbus-v1.md`; never relax closed-frame validation. |
17
+ | EventBus says service unavailable before `session_start` | Extension API is installed but no session context exists | Start/await Pi session startup; do not fabricate a context. |
18
+ | Terminal event arrives unexpectedly early in a consumer | Consumer is not waiting for the `run` response before correlating task id, or an older implementation lacks the gate | Bind response first; current API gates terminal publication for `run`/`kill`. See `docs/api/eventbus-v1.md`. |
19
+ | `bg_run` starts but logs are bounded/truncated | `bg_logs` is model-visible and capped by design | Read the full output file path from the notice only when operator-approved; do not increase model-visible logs casually. |
20
+ | Output cap terminates a task | `PI_BG_MAX_OUTPUT_BYTES` cap reached | Inspect full command behavior; raise cap only deliberately for that run environment. The task failure is intentional safety. |
21
+ | `PI_BG_SHELL` or `PI_BG_SHELL_PATH` error on Windows | Windows shell selection is closed and path-validated | Use `PI_BG_SHELL=cmd` or `bash`; if setting `PI_BG_SHELL_PATH`, provide an absolute `.exe`/`.com`. See `docs/subsystems/child-launch-durability-and-safety.md`. |
22
+ | `pi_executable_resolution_failed` | Windows Pi package bin cannot be resolved/validated | Reinstall/repair Pi package; do not fall back to shell PATH shims. |
23
+ | `pi_command_line_too_long` | Rendered Windows command line exceeds 32,767 UTF-16 units | Move large payload to stdin/artifact path; do not truncate argv. |
24
+ | Terminal metadata/output durability failure | Fsync/close/metadata write failed | Treat terminal state as failed; inspect `DurableFileError` operation/path/cause. See `docs/subsystems/child-launch-durability-and-safety.md`. |
25
+ | Delegate refuses with `delegate_hook_contract_unsupported` | Current Pi hook behavior does not match committed evidence | Re-run the hook characterization gate during release work and re-review the guard; do not weaken the guard. See `docs/operations/testing.md`. |
26
+ | Delegate refuses with `route_unresolved` or `route_capacity_unknown` | Requested/default route unavailable or lacks usable context window | Pin an available provider/model with declared context window; no substitute route is selected. |
27
+ | Delegate refuses with `seed_budget_exceeded` | Frozen seed plus child prompt/system prompt exceeds allowed input tokens | Use a larger-context subscription route, delegate earlier, or reduce visible parent text. Nothing was clipped. |
28
+ | `bg_result` says not ready | Child has not committed `result.json` yet | Wait for terminal notification or inspect later; do not poll tightly. |
29
+ | Delegate result corruption/hash/identity mismatch | Result package does not match task/seed/route/hash contract | Treat as invalid; inspect artifact bytes. Do not synthesize an answer. |
30
+ | Fusion model unavailable or metered route refusal | Frontier route is not admitted as a Pi subscription/OAuth route, or configured model is stale | Fix `/fusion-models` config to available subscription routes. Never route GPT/Claude-class work through metered APIs. |
31
+ | Fusion prompt budget exceeded | Stage forecast or measured prompt exceeds limiting route capacity | Use larger configured routes or reduce explicit request/context. Do not route-substitute after planning. |
32
+ | Fusion child timeout vs idle timeout | Absolute timeout is 30 minutes; idle watchdog is 20 minutes of no stdout/stderr activity | Preserve distinction in errors. `FUSION_CHILD_IDLE_TIMEOUT_MS` is a source constant, not documented as env-configurable. |
33
+ | Fusion research URL rejected | Source URL is not declared/public http(s), has credentials, resolves to blocked address class, or redirects unsafely | Provide declared public source URLs with purpose; targeted fetch is not search. |
34
+ | `/fusion-models` rejects in non-TUI mode | Selector requires interactive UI | Use an interactive Pi TUI session to edit config; headless path should fail loudly. |
35
+ | `/bg-update` shows no update | Offline/opt-out/current-version/registry failure path | Check `PI_OFFLINE`, `PI_BG_DISABLE_UPDATE_CHECK`, `PI_BG_REGISTRY_URL`; update check is one-shot and non-blocking. |
36
+ | TypeBox/compat failure | Installed package resolved a private/nested TypeBox or used removed APIs | Keep TypeBox as Pi-provided peer and verify installed payload. See `docs/operations/releasing.md`. |
37
+
38
+ Detailed references: EventBus API (`docs/api/eventbus-v1.md`), context budgeting (`docs/concepts/context-projection-and-budgeting.md`), launch/durability (`docs/subsystems/child-launch-durability-and-safety.md`), runtime registry (`docs/reference/runtime-contracts.md`), testing (`docs/operations/testing.md`), releasing (`docs/operations/releasing.md`).
@@ -0,0 +1,94 @@
1
+ ---
2
+ doc_id: read-before-edit
3
+ audience: agent
4
+ mode: generated
5
+ review_policy: contract
6
+ stability: stable
7
+ covers_surfaces: []
8
+ covers_sources: []
9
+ ---
10
+ # Read before editing production sources
11
+
12
+ Every production file under `src/**` and `extensions/**` has exactly one primary behavioral documentation owner. This file is generated from authored ownership frontmatter and owns no production source itself.
13
+
14
+ ## Source ownership
15
+
16
+ | Source | Primary behavioral owner |
17
+ | --- | --- |
18
+ | `extensions/background-tasks.ts` | [subsystems/host-ui-and-telemetry](./subsystems/host-ui-and-telemetry.md) |
19
+ | `extensions/delegate-child.ts` | [subsystems/delegation](./subsystems/delegation.md) |
20
+ | `extensions/fusion-child.ts` | [subsystems/fusion](./subsystems/fusion.md) |
21
+ | `src/core/attested-pi-run.ts` | [subsystems/attested-pi-runs](./subsystems/attested-pi-runs.md) |
22
+ | `src/core/common.ts` | [subsystems/background-task-runtime](./subsystems/background-task-runtime.md) |
23
+ | `src/core/context/parent-snapshot.ts` | [concepts/context-projection-and-budgeting](./concepts/context-projection-and-budgeting.md) |
24
+ | `src/core/context/token-budget.ts` | [concepts/context-projection-and-budgeting](./concepts/context-projection-and-budgeting.md) |
25
+ | `src/core/context/visible-conversation-v2.ts` | [concepts/context-projection-and-budgeting](./concepts/context-projection-and-budgeting.md) |
26
+ | `src/core/delegate/artifacts.ts` | [subsystems/delegation](./subsystems/delegation.md) |
27
+ | `src/core/delegate/budget.ts` | [subsystems/delegation](./subsystems/delegation.md) |
28
+ | `src/core/delegate/hook-contract-evidence.json` | [subsystems/delegation](./subsystems/delegation.md) |
29
+ | `src/core/delegate/hook-contract.ts` | [subsystems/delegation](./subsystems/delegation.md) |
30
+ | `src/core/delegate/launch.ts` | [subsystems/delegation](./subsystems/delegation.md) |
31
+ | `src/core/delegate/result-package.ts` | [subsystems/delegation](./subsystems/delegation.md) |
32
+ | `src/core/delegate/runner.ts` | [subsystems/delegation](./subsystems/delegation.md) |
33
+ | `src/core/delegate/seed.ts` | [subsystems/delegation](./subsystems/delegation.md) |
34
+ | `src/core/delegate/types.ts` | [subsystems/delegation](./subsystems/delegation.md) |
35
+ | `src/core/durable-fs.ts` | [subsystems/child-launch-durability-and-safety](./subsystems/child-launch-durability-and-safety.md) |
36
+ | `src/core/extension-api.ts` | [api/eventbus-v1](./api/eventbus-v1.md) |
37
+ | `src/core/fusion/artifacts.ts` | [subsystems/fusion](./subsystems/fusion.md) |
38
+ | `src/core/fusion/budget.ts` | [subsystems/fusion](./subsystems/fusion.md) |
39
+ | `src/core/fusion/child-protocol.ts` | [subsystems/fusion](./subsystems/fusion.md) |
40
+ | `src/core/fusion/clean-context.ts` | [subsystems/fusion](./subsystems/fusion.md) |
41
+ | `src/core/fusion/config.ts` | [subsystems/fusion](./subsystems/fusion.md) |
42
+ | `src/core/fusion/context.ts` | [subsystems/fusion](./subsystems/fusion.md) |
43
+ | `src/core/fusion/evaluation.ts` | [subsystems/fusion](./subsystems/fusion.md) |
44
+ | `src/core/fusion/orchestrator.ts` | [subsystems/fusion](./subsystems/fusion.md) |
45
+ | `src/core/fusion/pi-child.ts` | [subsystems/fusion](./subsystems/fusion.md) |
46
+ | `src/core/fusion/prompts.ts` | [subsystems/fusion](./subsystems/fusion.md) |
47
+ | `src/core/fusion/source-policy.ts` | [subsystems/fusion](./subsystems/fusion.md) |
48
+ | `src/core/fusion/types.ts` | [subsystems/fusion](./subsystems/fusion.md) |
49
+ | `src/core/fusion/web-fetch.ts` | [subsystems/fusion](./subsystems/fusion.md) |
50
+ | `src/core/fusion/workflows.ts` | [subsystems/fusion](./subsystems/fusion.md) |
51
+ | `src/core/pi-launch.ts` | [subsystems/child-launch-durability-and-safety](./subsystems/child-launch-durability-and-safety.md) |
52
+ | `src/core/registry.ts` | [subsystems/background-task-runtime](./subsystems/background-task-runtime.md) |
53
+ | `src/core/update-check.ts` | [subsystems/host-ui-and-telemetry](./subsystems/host-ui-and-telemetry.md) |
54
+ | `src/core/windows-taskkill.ts` | [subsystems/background-task-runtime](./subsystems/background-task-runtime.md) |
55
+ | `src/delegate-child-extension.ts` | [subsystems/delegation](./subsystems/delegation.md) |
56
+ | `src/delegate-extension.ts` | [subsystems/delegation](./subsystems/delegation.md) |
57
+ | `src/extension.ts` | [subsystems/host-ui-and-telemetry](./subsystems/host-ui-and-telemetry.md) |
58
+ | `src/fusion-child-extension.ts` | [subsystems/fusion](./subsystems/fusion.md) |
59
+ | `src/fusion-extension.ts` | [subsystems/fusion](./subsystems/fusion.md) |
60
+ | `src/ui/background-tasks-manager.ts` | [subsystems/host-ui-and-telemetry](./subsystems/host-ui-and-telemetry.md) |
61
+ | `src/ui/fusion-model-selector.ts` | [subsystems/fusion](./subsystems/fusion.md) |
62
+
63
+ ## Public surfaces
64
+
65
+ - `command:bg`
66
+ - `command:bg-clear`
67
+ - `command:bg-tasks`
68
+ - `command:bg-update`
69
+ - `command:fusion`
70
+ - `command:fusion-models`
71
+ - `command:jobs`
72
+ - `command:kill`
73
+ - `command:logs`
74
+ - `command:tasks`
75
+ - `eventbus:background-task-v1`
76
+ - `renderer:background-task-notification`
77
+ - `renderer:fusion-result`
78
+ - `shortcut:ctrl+alt+c`
79
+ - `shortcut:shift+down`
80
+ - `tool:bg_delegate`
81
+ - `tool:bg_kill`
82
+ - `tool:bg_logs`
83
+ - `tool:bg_result`
84
+ - `tool:bg_run`
85
+ - `tool:bg_run_pi_attested`
86
+ - `tool:bg_status`
87
+ - `tool:fusion_investigate`
88
+ - `tool:fusion_reason`
89
+ - `tool:fusion_research`
90
+ - `tool:fusion_validate`
91
+ - `workflow:investigate`
92
+ - `workflow:reason`
93
+ - `workflow:research`
94
+ - `workflow:validate`
@@ -0,0 +1,213 @@
1
+ ---
2
+ doc_id: reference/runtime-contracts
3
+ audience: maintainer
4
+ mode: mixed
5
+ review_policy: contract
6
+ stability: evolving
7
+ covers_surfaces: []
8
+ covers_sources: []
9
+ ---
10
+ # Runtime contracts reference
11
+
12
+ This generated registry lists production environment-variable references, runtime paths/artifacts, schema identifiers, and status vocabularies extracted from package source. It intentionally excludes incidental source-code literals such as package metadata import paths.
13
+
14
+ <!-- pi-docs:begin name="runtime-contracts" generator="scripts/docs/generate.mjs" -->
15
+ ### Environment variable references
16
+
17
+ | Name | Access | Provenance |
18
+ | --- | --- | --- |
19
+ | `ANTHROPIC_API_KEY` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:70` |
20
+ | `ANTHROPIC_AUTH_TOKEN` | remove | `src/core/fusion/pi-child.ts:70` |
21
+ | `ANTHROPIC_BASE_URL` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:70` |
22
+ | `AZURE_OPENAI_AD_TOKEN` | remove | `src/core/fusion/pi-child.ts:70` |
23
+ | `AZURE_OPENAI_API_KEY` | remove | `src/core/fusion/pi-child.ts:70` |
24
+ | `AZURE_OPENAI_API_VERSION` | remove | `src/core/fusion/pi-child.ts:70` |
25
+ | `AZURE_OPENAI_BASE_URL` | remove | `src/core/fusion/pi-child.ts:70` |
26
+ | `AZURE_OPENAI_DEPLOYMENT_NAME_MAP` | remove | `src/core/fusion/pi-child.ts:70` |
27
+ | `AZURE_OPENAI_ENDPOINT` | remove | `src/core/fusion/pi-child.ts:70` |
28
+ | `AZURE_OPENAI_RESOURCE_NAME` | remove | `src/core/fusion/pi-child.ts:70` |
29
+ | `ComSpec` | read | `src/core/common.ts:683`<br>`src/core/common.ts:692` |
30
+ | `OPENAI_API_KEY` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:70` |
31
+ | `OPENAI_BASE_URL` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:70` |
32
+ | `OPENROUTER_API_KEY` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:70` |
33
+ | `OPENROUTER_BASE_URL` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:70` |
34
+ | `path` | read | `src/core/common.ts:638` |
35
+ | `Path` | read | `src/core/common.ts:638` |
36
+ | `PATH` | read | `src/core/common.ts:638` |
37
+ | `PI_API_BASE_URL` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:70` |
38
+ | `PI_API_KEY` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:70` |
39
+ | `PI_AUTH_FILE` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:70` |
40
+ | `PI_BG_DELEGATE_ARTIFACT_DIR` | read, write | `src/core/delegate/launch.ts:324`<br>`src/delegate-child-extension.ts:277` |
41
+ | `PI_BG_DELEGATE_LAUNCH_NONCE` | read, write | `src/core/delegate/launch.ts:328`<br>`src/delegate-child-extension.ts:281` |
42
+ | `PI_BG_DELEGATE_SEED_PATH` | read, write | `src/core/delegate/launch.ts:325`<br>`src/delegate-child-extension.ts:278` |
43
+ | `PI_BG_DELEGATE_SEED_SHA256` | read, write | `src/core/delegate/launch.ts:326`<br>`src/delegate-child-extension.ts:279` |
44
+ | `PI_BG_DELEGATE_TASK_ID` | read, write | `src/core/delegate/launch.ts:327`<br>`src/delegate-child-extension.ts:280` |
45
+ | `PI_BG_DISABLE_PI_TELEMETRY` | read | `src/core/registry.ts:193` |
46
+ | `PI_BG_DISABLE_UPDATE_CHECK` | read | `src/extension.ts:444` |
47
+ | `PI_BG_MAX_OUTPUT_BYTES` | read | `src/core/registry.ts:67` |
48
+ | `PI_BG_REGISTRY_URL` | read | `src/extension.ts:453` |
49
+ | `PI_BG_SHELL` | read | `src/core/common.ts:679` |
50
+ | `PI_BG_SHELL_PATH` | read | `src/core/common.ts:680` |
51
+ | `PI_FUSION_RESEARCH_ENABLED` | read, remove, write | `src/core/fusion/pi-child.ts:1291`<br>`src/core/fusion/pi-child.ts:70`<br>`src/fusion-child-extension.ts:393` |
52
+ | `PI_FUSION_SOURCE_POLICY_PATH` | read, remove, write | `src/core/fusion/pi-child.ts:1292`<br>`src/core/fusion/pi-child.ts:70`<br>`src/fusion-child-extension.ts:349` |
53
+ | `PI_FUSION_SOURCE_POLICY_SHA256` | read, remove, write | `src/core/fusion/pi-child.ts:1293`<br>`src/core/fusion/pi-child.ts:70`<br>`src/fusion-child-extension.ts:350` |
54
+ | `PI_FUSION_TOOL_CALL_LOG_PATH` | read, remove, write | `src/core/fusion/pi-child.ts:1280`<br>`src/core/fusion/pi-child.ts:70`<br>`src/fusion-child-extension.ts:392` |
55
+ | `PI_MODEL` | remove | `src/core/delegate/launch.ts:301`<br>`src/core/fusion/pi-child.ts:70` |
56
+ | `PI_OFFLINE` | read | `src/extension.ts:445` |
57
+ | `PI_PROVIDER` | remove | `src/core/delegate/launch.ts:301`<br>`src/core/fusion/pi-child.ts:70` |
58
+ | `PI_REASONING_LEVEL` | remove | `src/core/delegate/launch.ts:301`<br>`src/core/fusion/pi-child.ts:70` |
59
+ | `PI_SESSION_FILE` | remove | `src/core/delegate/launch.ts:301`<br>`src/core/fusion/pi-child.ts:70` |
60
+ | `PI_SESSION_ID` | remove | `src/core/delegate/launch.ts:301`<br>`src/core/fusion/pi-child.ts:70` |
61
+ | `PI_SKIP_VERSION_CHECK` | write | `src/core/delegate/launch.ts:323`<br>`src/core/fusion/pi-child.ts:234` |
62
+ | `SHELL` | read | `src/core/common.ts:675` |
63
+ | `SystemRoot` | read | `src/core/windows-taskkill.ts:96` |
64
+ | `WINDIR` | read | `src/core/windows-taskkill.ts:101` |
65
+
66
+ ### Runtime paths and artifacts
67
+
68
+ | Kind | Path/artifact | Provenance |
69
+ | --- | --- | --- |
70
+ | config | `fusion-models.json` | `src/core/fusion/config.ts:20` |
71
+ | delegate-artifact | `budget-plan.json` | `src/core/delegate/artifacts.ts:42` |
72
+ | delegate-artifact | `child-prompt.txt` | `src/core/delegate/artifacts.ts:46` |
73
+ | delegate-artifact | `child.stderr.txt` | `src/core/delegate/artifacts.ts:47` |
74
+ | delegate-artifact | `child.stdout.txt` | `src/core/delegate/artifacts.ts:48` |
75
+ | delegate-artifact | `context-omission-ledger.json` | `src/core/delegate/artifacts.ts:41` |
76
+ | delegate-artifact | `error.json` | `src/core/delegate/artifacts.ts:49` |
77
+ | delegate-artifact | `manifest.json` | `src/core/delegate/artifacts.ts:43` |
78
+ | delegate-artifact | `outcome.json` | `src/core/delegate/artifacts.ts:44` |
79
+ | delegate-artifact | `result.json` | `src/core/delegate/result-package.ts:28` |
80
+ | delegate-artifact | `seed.json` | `src/core/delegate/artifacts.ts:40` |
81
+ | delegate-artifact | `spill/<receipt-named-file>` | `src/core/delegate/artifacts.ts:53` |
82
+ | directory | `.pi/delegate/<session-id>-<pid>/<task-id>/` | `src/core/delegate/artifacts.ts:157` |
83
+ | directory | `.pi/fusion/<session-id>-<pid>/<run-id>/` | `src/core/fusion/artifacts.ts:251` |
84
+ | directory | `.pi/tasks/<session-id>-<pid>/` | `src/core/registry.ts:780` |
85
+ | fusion-artifact | `<attempt-prefix> = candidate-<slot>.attempt-<n> \| evaluation.attempt-<n> \| merge.attempt-<n>` | `src/core/fusion/artifacts.ts:193` |
86
+ | fusion-artifact | `<attempt-prefix>.calibration-violation.json` | `src/core/fusion/artifacts.ts:208` |
87
+ | fusion-artifact | `<attempt-prefix>.events.jsonl` | `src/core/fusion/artifacts.ts:402` |
88
+ | fusion-artifact | `<attempt-prefix>.prompt.txt` | `src/core/fusion/artifacts.ts:401` |
89
+ | fusion-artifact | `<attempt-prefix>.stderr.txt` | `src/core/fusion/artifacts.ts:403` |
90
+ | fusion-artifact | `blind-candidates.json` | `src/core/fusion/artifacts.ts:373` |
91
+ | fusion-artifact | `budget-plan.json` | `src/core/fusion/artifacts.ts:369` |
92
+ | fusion-artifact | `candidate-<slot>.attempt-<n>.response.md \| candidate-<slot>.attempt-<n>.response.partial.md` | `src/core/fusion/artifacts.ts:203` |
93
+ | fusion-artifact | `candidate-<slot>.attempt-<n>.tool-calls.jsonl` | `src/core/fusion/artifacts.ts:301` |
94
+ | fusion-artifact | `candidate-<slot>.attempt-<n>.tool-calls.jsonl.seal.json` | `src/core/fusion/child-protocol.ts:13` |
95
+ | fusion-artifact | `canonical-input.json` | `src/core/fusion/artifacts.ts:339` |
96
+ | fusion-artifact | `context-omission-ledger.json` | `src/core/fusion/artifacts.ts:348` |
97
+ | fusion-artifact | `error.json` | `src/core/fusion/artifacts.ts:385` |
98
+ | fusion-artifact | `evaluation.attempt-<n>.response.txt \| evaluation.attempt-<n>.response.partial.txt` | `src/core/fusion/artifacts.ts:203` |
99
+ | fusion-artifact | `evaluation.json` | `src/core/fusion/artifacts.ts:377` |
100
+ | fusion-artifact | `merge.attempt-<n>.response.md \| merge.attempt-<n>.response.partial.md` | `src/core/fusion/artifacts.ts:203` |
101
+ | fusion-artifact | `merged.md` | `src/core/fusion/artifacts.ts:316` |
102
+ | fusion-artifact | `source-policy.private.json` | `src/core/fusion/artifacts.ts:355` |
103
+ | task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.attestation.json` | `src/core/attested-pi-run.ts:583` |
104
+ | task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.json` | `src/core/registry.ts:808` |
105
+ | task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.output` | `src/core/registry.ts:807` |
106
+ | task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.pi-events.jsonl` | `src/core/attested-pi-run.ts:580` |
107
+ | task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.pi-telemetry-wrapper.cjs` | `src/core/attested-pi-run.ts:582` |
108
+ | task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.stderr` | `src/core/attested-pi-run.ts:581` |
109
+
110
+ ### Schema identifiers
111
+
112
+ | Schema | Provenance |
113
+ | --- | --- |
114
+ | `phase2.pi_task_attestation.v1` | `src/core/attested-pi-run.ts:20` |
115
+ | `pi-background-tasks.delegate-budget-plan.v2` | `src/core/delegate/types.ts:21` |
116
+ | `pi-background-tasks.delegate-child-terminal.v1` | `src/delegate-child-extension.ts:381` |
117
+ | `pi-background-tasks.delegate-hook-contract.v1` | `src/core/delegate/hook-contract.ts:15` |
118
+ | `pi-background-tasks.delegate-launch.v1` | `src/delegate-extension.ts:373` |
119
+ | `pi-background-tasks.delegate-ledger.v1` | `src/core/delegate/types.ts:16` |
120
+ | `pi-background-tasks.delegate-manifest.v1` | `src/core/delegate/types.ts:22` |
121
+ | `pi-background-tasks.delegate-outcome.v1` | `src/core/delegate/runner.ts:200` |
122
+ | `pi-background-tasks.delegate-receipt.v1` | `src/core/delegate/types.ts:19` |
123
+ | `pi-background-tasks.delegate-result-view.v1` | `src/delegate-extension.ts:528` |
124
+ | `pi-background-tasks.delegate-result.v1` | `src/core/delegate/types.ts:18` |
125
+ | `pi-background-tasks.delegate-seed.v1` | `src/core/delegate/types.ts:15` |
126
+ | `pi-background-tasks.extension-request.v1` | `src/core/extension-api.ts:15` |
127
+ | `pi-background-tasks.extension-response.v1` | `src/core/extension-api.ts:16` |
128
+ | `pi-background-tasks.extension-terminal.v1` | `src/core/extension-api.ts:17` |
129
+ | `pi-background-tasks.fusion-blind-candidates.v1` | `src/core/fusion/prompts.ts:299` |
130
+ | `pi-background-tasks.fusion-budget-plan.v3` | `src/core/fusion/types.ts:24` |
131
+ | `pi-background-tasks.fusion-calibration-violation.v1` | `src/core/fusion/types.ts:26` |
132
+ | `pi-background-tasks.fusion-child-result.v2` | `src/core/fusion/child-protocol.ts:5` |
133
+ | `pi-background-tasks.fusion-context-ledger.v2` | `src/core/fusion/types.ts:22` |
134
+ | `pi-background-tasks.fusion-evaluation-repair-input.v1` | `src/core/fusion/prompts.ts:279` |
135
+ | `pi-background-tasks.fusion-evaluation.v1` | `src/core/fusion/types.ts:16` |
136
+ | `pi-background-tasks.fusion-input.v4` | `src/core/fusion/types.ts:14` |
137
+ | `pi-background-tasks.fusion-input.v5` | `src/core/fusion/types.ts:15` |
138
+ | `pi-background-tasks.fusion-manifest.v3` | `src/core/fusion/types.ts:20` |
139
+ | `pi-background-tasks.fusion-manifest.v4` | `src/core/fusion/types.ts:21` |
140
+ | `pi-background-tasks.fusion-merge-input.v1` | `src/core/fusion/prompts.ts:325` |
141
+ | `pi-background-tasks.fusion-models.v1` | `src/core/fusion/types.ts:13` |
142
+ | `pi-background-tasks.fusion-progress.v1` | `src/fusion-extension.ts:57` |
143
+ | `pi-background-tasks.fusion-request.v1` | `src/fusion-extension.ts:58` |
144
+ | `pi-background-tasks.fusion-result.v4` | `src/core/fusion/types.ts:18` |
145
+ | `pi-background-tasks.fusion-result.v5` | `src/core/fusion/types.ts:19` |
146
+ | `pi-background-tasks.fusion-source-policy.v1` | `src/core/fusion/types.ts:23` |
147
+ | `pi-background-tasks.fusion-tool-call-seal.v1` | `src/core/fusion/child-protocol.ts:12` |
148
+ | `pi-background-tasks.fusion-tool-call.v1` | `src/core/fusion/types.ts:27` |
149
+ | `pi-background-tasks.fusion-validation-candidate.v1` | `src/core/fusion/types.ts:17` |
150
+ | `pi-background-tasks.input-token-calibration.v1` | `src/core/context/token-budget.ts:18` |
151
+
152
+ ### Status vocabularies
153
+
154
+
155
+ ```json
156
+ {
157
+ "DELEGATE_MANIFEST_STATES": [
158
+ "launched",
159
+ "running",
160
+ "committed",
161
+ "failed",
162
+ "cancelled"
163
+ ],
164
+ "FUSION_BUDGET_STAGE_VALUES": [
165
+ "candidate",
166
+ "evaluation",
167
+ "evaluation_repair",
168
+ "merge"
169
+ ],
170
+ "FUSION_CAPABILITY_VALUES": [
171
+ "reason",
172
+ "inspect",
173
+ "research"
174
+ ],
175
+ "FUSION_STAGE_VALUES": [
176
+ "candidate",
177
+ "evaluation",
178
+ "merge"
179
+ ],
180
+ "FUSION_STATE_VALUES": [
181
+ "initializing",
182
+ "candidates_running",
183
+ "candidates_complete",
184
+ "evaluating",
185
+ "evaluation_complete",
186
+ "merging",
187
+ "completed",
188
+ "failed",
189
+ "cancelled"
190
+ ],
191
+ "FUSION_TERMINAL_STATE_VALUES": [
192
+ "completed",
193
+ "failed",
194
+ "cancelled"
195
+ ],
196
+ "TASK_STATUS_VALUES": [
197
+ "running",
198
+ "completed",
199
+ "failed",
200
+ "killed"
201
+ ],
202
+ "TERMINAL_TASK_STATUS_VALUES": [
203
+ "completed",
204
+ "failed",
205
+ "killed"
206
+ ]
207
+ }
208
+ ```
209
+ <!-- pi-docs:end name="runtime-contracts" -->
210
+
211
+ ## Maintenance rule
212
+
213
+ If a runtime fact changes in source, update the owning subsystem/API doc and run `npm run docs:generate`. Do not hand-edit generated tables.