pi-background-tasks 2.1.4 → 2.3.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/BACKGROUND-TASKS-INSTRUCTIONS.md +1 -1
- package/PUBLISHING.md +2 -0
- package/README.md +15 -8
- package/TESTING.md +15 -10
- package/TEST_PLAN.md +10 -9
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/docs/INDEX.md +8 -4
- package/docs/choose-a-workflow.md +5 -2
- package/docs/commands/claude-cache.md +50 -0
- package/docs/getting-started.md +3 -0
- package/docs/manifest.json +84 -19
- package/docs/operations/configuration.md +15 -1
- package/docs/operations/releasing.md +6 -3
- package/docs/read-before-edit.md +4 -1
- package/docs/reference/runtime-contracts.md +52 -52
- package/docs/subsystems/anthropic-attribution.md +63 -0
- package/docs/subsystems/attested-pi-runs.md +2 -2
- package/docs/subsystems/child-launch-durability-and-safety.md +3 -3
- package/docs/subsystems/delegation.md +12 -4
- package/docs/subsystems/docs-freshness-gate.md +5 -5
- package/docs/subsystems/fusion.md +2 -2
- package/docs/tools/bg_delegate.md +21 -9
- package/docs/tools/bg_result.md +1 -1
- package/docs/tools/bg_run.md +5 -0
- package/extensions/anthropic-attribution.ts +1 -0
- package/package.json +4 -2
- package/src/core/anthropic-attribution-path.ts +26 -0
- package/src/core/{fusion/anthropic-attribution.ts → anthropic-attribution.ts} +61 -8
- package/src/core/attested-pi-run.ts +10 -1
- package/src/core/common.ts +2 -1
- package/src/core/delegate/artifacts.ts +4 -0
- package/src/core/delegate/launch.ts +44 -14
- package/src/core/delegate/runner.ts +24 -0
- package/src/core/delegate/seed.ts +12 -0
- package/src/core/delegate/types.ts +10 -2
- package/src/core/fusion/config.ts +1 -1
- package/src/core/fusion/pi-child.ts +7 -124
- package/src/core/registry.ts +4 -1
- package/src/delegate-child-extension.ts +9 -2
- package/src/delegate-extension.ts +53 -4
package/docs/manifest.json
CHANGED
|
@@ -27,16 +27,27 @@
|
|
|
27
27
|
"state": "pass"
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"authored_body_sha256": "sha256:
|
|
30
|
+
"authored_body_sha256": "sha256:72c53dcc104f9b5efa57e38bcb21a4c3c620d5caf1571af82348f94dcafbe941",
|
|
31
|
+
"covers_sources": [
|
|
32
|
+
"extensions/anthropic-attribution.ts",
|
|
33
|
+
"src/core/anthropic-attribution-path.ts",
|
|
34
|
+
"src/core/anthropic-attribution.ts"
|
|
35
|
+
],
|
|
36
|
+
"doc_id": "subsystems/anthropic-attribution",
|
|
37
|
+
"rel": "docs/subsystems/anthropic-attribution.md",
|
|
38
|
+
"required": true,
|
|
39
|
+
"state": "missing"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"authored_body_sha256": "sha256:0840d793b8c18869f9a3bb8a72beeb602824ed1a580161f3456126af8af9b459",
|
|
31
43
|
"covers_sources": [
|
|
32
44
|
"src/core/attested-pi-run.ts"
|
|
33
45
|
],
|
|
34
46
|
"doc_id": "subsystems/attested-pi-runs",
|
|
35
|
-
"notes": "Reviewed attested Pi event parsing, last-reported stopReason semantics, OAuth route observation, argv/environment safeguards, git authority, hashes, failure handling, and atomic sidecar durability.",
|
|
36
47
|
"rel": "docs/subsystems/attested-pi-runs.md",
|
|
37
48
|
"required": true,
|
|
38
49
|
"reviewer": "gpt-5.5-final-attested-safety-reviewer",
|
|
39
|
-
"state": "
|
|
50
|
+
"state": "stale-authored-prose"
|
|
40
51
|
},
|
|
41
52
|
{
|
|
42
53
|
"authored_body_sha256": "sha256:253948c8b1f4dd339b0c1eeabd6e8addf584fe208a0f71c3a7f094921ff4547f",
|
|
@@ -52,20 +63,19 @@
|
|
|
52
63
|
"state": "stale-authored-prose"
|
|
53
64
|
},
|
|
54
65
|
{
|
|
55
|
-
"authored_body_sha256": "sha256:
|
|
66
|
+
"authored_body_sha256": "sha256:40ee5dac92b9e873d6a9f71a59c03ff1ccd44d6717a13d3be18f74b19e68326e",
|
|
56
67
|
"covers_sources": [
|
|
57
68
|
"src/core/durable-fs.ts",
|
|
58
69
|
"src/core/pi-launch.ts"
|
|
59
70
|
],
|
|
60
71
|
"doc_id": "subsystems/child-launch-durability-and-safety",
|
|
61
|
-
"notes": "Reviewed durable file replacement and child launch sources, including file fsync, POSIX directory sync, Windows limitation, ordinary versus attested output wording, and loud launch/durability failures.",
|
|
62
72
|
"rel": "docs/subsystems/child-launch-durability-and-safety.md",
|
|
63
73
|
"required": true,
|
|
64
74
|
"reviewer": "gpt-5.5-final-attested-safety-reviewer",
|
|
65
|
-
"state": "
|
|
75
|
+
"state": "stale-authored-prose"
|
|
66
76
|
},
|
|
67
77
|
{
|
|
68
|
-
"authored_body_sha256": "sha256:
|
|
78
|
+
"authored_body_sha256": "sha256:bc319ce7e62d2592c71476f950947c8ff011fb74e7f2093b0169f77d59980f18",
|
|
69
79
|
"covers_sources": [
|
|
70
80
|
"extensions/delegate-child.ts",
|
|
71
81
|
"src/core/delegate/artifacts.ts",
|
|
@@ -87,10 +97,9 @@
|
|
|
87
97
|
"state": "stale-authored-prose"
|
|
88
98
|
},
|
|
89
99
|
{
|
|
90
|
-
"authored_body_sha256": "sha256:
|
|
100
|
+
"authored_body_sha256": "sha256:b6238bacecf46139dab1d6a8622783db76d913f0ce727205151b65b7cb210481",
|
|
91
101
|
"covers_sources": [
|
|
92
102
|
"extensions/fusion-child.ts",
|
|
93
|
-
"src/core/fusion/anthropic-attribution.ts",
|
|
94
103
|
"src/core/fusion/artifacts.ts",
|
|
95
104
|
"src/core/fusion/budget.ts",
|
|
96
105
|
"src/core/fusion/child-protocol.ts",
|
|
@@ -198,6 +207,17 @@
|
|
|
198
207
|
"review_policy": "contract",
|
|
199
208
|
"stability": "stable"
|
|
200
209
|
},
|
|
210
|
+
"commands/claude-cache": {
|
|
211
|
+
"audience": "user",
|
|
212
|
+
"covers_sources": [],
|
|
213
|
+
"covers_surfaces": [
|
|
214
|
+
"command:claude-cache"
|
|
215
|
+
],
|
|
216
|
+
"mode": "mixed",
|
|
217
|
+
"rel": "docs/commands/claude-cache.md",
|
|
218
|
+
"review_policy": "contract",
|
|
219
|
+
"stability": "evolving"
|
|
220
|
+
},
|
|
201
221
|
"commands/fusion": {
|
|
202
222
|
"audience": "user",
|
|
203
223
|
"covers_sources": [],
|
|
@@ -364,6 +384,19 @@
|
|
|
364
384
|
"review_policy": "contract",
|
|
365
385
|
"stability": "stable"
|
|
366
386
|
},
|
|
387
|
+
"subsystems/anthropic-attribution": {
|
|
388
|
+
"audience": "maintainer",
|
|
389
|
+
"covers_sources": [
|
|
390
|
+
"extensions/anthropic-attribution.ts",
|
|
391
|
+
"src/core/anthropic-attribution-path.ts",
|
|
392
|
+
"src/core/anthropic-attribution.ts"
|
|
393
|
+
],
|
|
394
|
+
"covers_surfaces": [],
|
|
395
|
+
"mode": "authored",
|
|
396
|
+
"rel": "docs/subsystems/anthropic-attribution.md",
|
|
397
|
+
"review_policy": "behavioral",
|
|
398
|
+
"stability": "evolving"
|
|
399
|
+
},
|
|
367
400
|
"subsystems/attested-pi-runs": {
|
|
368
401
|
"audience": "maintainer",
|
|
369
402
|
"covers_sources": [
|
|
@@ -435,7 +468,6 @@
|
|
|
435
468
|
"audience": "maintainer",
|
|
436
469
|
"covers_sources": [
|
|
437
470
|
"extensions/fusion-child.ts",
|
|
438
|
-
"src/core/fusion/anthropic-attribution.ts",
|
|
439
471
|
"src/core/fusion/artifacts.ts",
|
|
440
472
|
"src/core/fusion/budget.ts",
|
|
441
473
|
"src/core/fusion/child-protocol.ts",
|
|
@@ -624,6 +656,12 @@
|
|
|
624
656
|
"name": "command-contract-bg-update",
|
|
625
657
|
"rel": "docs/commands/bg-update.md"
|
|
626
658
|
},
|
|
659
|
+
{
|
|
660
|
+
"doc_id": "commands/claude-cache",
|
|
661
|
+
"generator": "scripts/docs/generate.mjs",
|
|
662
|
+
"name": "command-contract-claude-cache",
|
|
663
|
+
"rel": "docs/commands/claude-cache.md"
|
|
664
|
+
},
|
|
627
665
|
{
|
|
628
666
|
"doc_id": "commands/fusion",
|
|
629
667
|
"generator": "scripts/docs/generate.mjs",
|
|
@@ -775,7 +813,10 @@
|
|
|
775
813
|
"engines": {
|
|
776
814
|
"node": ">=22.19.0"
|
|
777
815
|
},
|
|
778
|
-
"
|
|
816
|
+
"entrypoints": [
|
|
817
|
+
"./extensions/anthropic-attribution.ts",
|
|
818
|
+
"./extensions/background-tasks.ts"
|
|
819
|
+
],
|
|
779
820
|
"files": [
|
|
780
821
|
"BACKGROUND-TASKS-INSTRUCTIONS.md",
|
|
781
822
|
"LICENSE",
|
|
@@ -783,6 +824,7 @@
|
|
|
783
824
|
"README.md",
|
|
784
825
|
"TESTING.md",
|
|
785
826
|
"TEST_PLAN.md",
|
|
827
|
+
"THIRD_PARTY_NOTICES.md",
|
|
786
828
|
"docs/",
|
|
787
829
|
"extensions/",
|
|
788
830
|
"logo.png",
|
|
@@ -791,13 +833,14 @@
|
|
|
791
833
|
"image": "https://raw.githubusercontent.com/ismailsaleekh/pi-background-tasks/main/logo.png",
|
|
792
834
|
"name": "pi-background-tasks",
|
|
793
835
|
"type": "module",
|
|
794
|
-
"version": "2.
|
|
836
|
+
"version": "2.3.0"
|
|
795
837
|
},
|
|
796
838
|
"public_surface_ids": [
|
|
797
839
|
"command:bg",
|
|
798
840
|
"command:bg-clear",
|
|
799
841
|
"command:bg-tasks",
|
|
800
842
|
"command:bg-update",
|
|
843
|
+
"command:claude-cache",
|
|
801
844
|
"command:fusion",
|
|
802
845
|
"command:fusion-models",
|
|
803
846
|
"command:jobs",
|
|
@@ -855,6 +898,13 @@
|
|
|
855
898
|
"name": "bg-update",
|
|
856
899
|
"source": "src/extension.ts:567"
|
|
857
900
|
},
|
|
901
|
+
{
|
|
902
|
+
"description": "Show or set Claude cache retention for this session (short, long, default)",
|
|
903
|
+
"id": "command:claude-cache",
|
|
904
|
+
"kind": "command",
|
|
905
|
+
"name": "claude-cache",
|
|
906
|
+
"source": "src/core/anthropic-attribution.ts:1928"
|
|
907
|
+
},
|
|
858
908
|
{
|
|
859
909
|
"description": "Start fixed-purpose Fusion reason in the background and return immediately.",
|
|
860
910
|
"id": "command:fusion",
|
|
@@ -950,7 +1000,7 @@
|
|
|
950
1000
|
],
|
|
951
1001
|
"tool": [
|
|
952
1002
|
{
|
|
953
|
-
"description": "Launch one background Pi agent seeded with a frozen projection of the current conversation, then return a launch receipt immediately. The child has its own session, a route pinned at launch that is never substituted, and read-only tools. Retrieve its verified answer with bg_result.",
|
|
1003
|
+
"description": "Launch one background Pi agent seeded with a frozen projection of the current conversation, then return a launch receipt immediately. The child has its own session, a route pinned at launch that is never substituted, and read-only tools. Extension discovery is isolated by default; ambient mode supports extension-registered providers but executes arbitrary discovered extension code. Retrieve its verified answer with bg_result.",
|
|
954
1004
|
"id": "tool:bg_delegate",
|
|
955
1005
|
"kind": "tool",
|
|
956
1006
|
"label": "Background Delegate",
|
|
@@ -958,7 +1008,9 @@
|
|
|
958
1008
|
"promptGuidelines": [
|
|
959
1009
|
"Use bg_delegate when work should continue in the background and the worker needs what you already know: it is seeded with a projection of this conversation.",
|
|
960
1010
|
"The prompt is authoritative. State exactly what you want investigated and what the answer should contain.",
|
|
961
|
-
"The delegate is inspect-only: it can read, search, and list files, but cannot run shell commands, edit or write files, use the network, or delegate further.",
|
|
1011
|
+
"The delegate is inspect-only at the model-visible tool boundary: it can read, search, and list files, but cannot run shell commands, edit or write files, use the network, or delegate further.",
|
|
1012
|
+
"Extension discovery is isolated by default. Use extensionMode:\"ambient\" only when the pinned provider is registered by an ambient user/project extension.",
|
|
1013
|
+
"Ambient mode executes arbitrary discovered extension code in the child process. Tool allowlists do not sandbox extension code, so ambient mode weakens inspect-only process isolation.",
|
|
962
1014
|
"Facts that exist only inside omitted tool output are not available to the delegate. Restate such findings in the prompt.",
|
|
963
1015
|
"bg_delegate returns immediately. Do not poll; retrieve the answer with bg_result after the terminal notification arrives."
|
|
964
1016
|
],
|
|
@@ -974,6 +1026,10 @@
|
|
|
974
1026
|
"description": "Capability profile. Only \"inspect\" (read/search/list, no shell, no writes, no network, no recursion) is supported.",
|
|
975
1027
|
"type": "string"
|
|
976
1028
|
},
|
|
1029
|
+
"extensionMode": {
|
|
1030
|
+
"description": "Extension discovery: isolated | ambient. Default isolated. Ambient is for extension-registered providers and executes arbitrary discovered extension code, weakening process isolation.",
|
|
1031
|
+
"type": "string"
|
|
1032
|
+
},
|
|
977
1033
|
"maxToolCalls": {
|
|
978
1034
|
"description": "Maximum tool calls. Default 120.",
|
|
979
1035
|
"type": "number"
|
|
@@ -1028,7 +1084,7 @@
|
|
|
1028
1084
|
],
|
|
1029
1085
|
"type": "object"
|
|
1030
1086
|
},
|
|
1031
|
-
"source": "src/delegate-extension.ts:
|
|
1087
|
+
"source": "src/delegate-extension.ts:340"
|
|
1032
1088
|
},
|
|
1033
1089
|
{
|
|
1034
1090
|
"description": "Stop a running background task by ID. Fails loudly if the task is unknown or already finished.",
|
|
@@ -1116,7 +1172,7 @@
|
|
|
1116
1172
|
],
|
|
1117
1173
|
"type": "object"
|
|
1118
1174
|
},
|
|
1119
|
-
"source": "src/delegate-extension.ts:
|
|
1175
|
+
"source": "src/delegate-extension.ts:515"
|
|
1120
1176
|
},
|
|
1121
1177
|
{
|
|
1122
1178
|
"description": "Start a named long-running shell command in the background and return immediately with a task ID and output path. By default, completed, failed, or killed terminal state is delivered automatically as <background-task-notification> and starts a follow-up agent turn; do not sleep or poll merely to wait. Output is written to .pi/tasks and model-visible logs are bounded to 50.0KB.",
|
|
@@ -1608,6 +1664,9 @@
|
|
|
1608
1664
|
},
|
|
1609
1665
|
"schema_version": "pi-background-tasks.docs-manifest.v2",
|
|
1610
1666
|
"source_to_docs": {
|
|
1667
|
+
"extensions/anthropic-attribution.ts": [
|
|
1668
|
+
"subsystems/anthropic-attribution"
|
|
1669
|
+
],
|
|
1611
1670
|
"extensions/background-tasks.ts": [
|
|
1612
1671
|
"subsystems/host-ui-and-telemetry"
|
|
1613
1672
|
],
|
|
@@ -1617,6 +1676,12 @@
|
|
|
1617
1676
|
"extensions/fusion-child.ts": [
|
|
1618
1677
|
"subsystems/fusion"
|
|
1619
1678
|
],
|
|
1679
|
+
"src/core/anthropic-attribution-path.ts": [
|
|
1680
|
+
"subsystems/anthropic-attribution"
|
|
1681
|
+
],
|
|
1682
|
+
"src/core/anthropic-attribution.ts": [
|
|
1683
|
+
"subsystems/anthropic-attribution"
|
|
1684
|
+
],
|
|
1620
1685
|
"src/core/attested-pi-run.ts": [
|
|
1621
1686
|
"subsystems/attested-pi-runs"
|
|
1622
1687
|
],
|
|
@@ -1665,9 +1730,6 @@
|
|
|
1665
1730
|
"src/core/extension-api.ts": [
|
|
1666
1731
|
"api/eventbus-v1"
|
|
1667
1732
|
],
|
|
1668
|
-
"src/core/fusion/anthropic-attribution.ts": [
|
|
1669
|
-
"subsystems/fusion"
|
|
1670
|
-
],
|
|
1671
1733
|
"src/core/fusion/artifacts.ts": [
|
|
1672
1734
|
"subsystems/fusion"
|
|
1673
1735
|
],
|
|
@@ -1766,6 +1828,9 @@
|
|
|
1766
1828
|
"command:bg-update": [
|
|
1767
1829
|
"commands/bg-update"
|
|
1768
1830
|
],
|
|
1831
|
+
"command:claude-cache": [
|
|
1832
|
+
"commands/claude-cache"
|
|
1833
|
+
],
|
|
1769
1834
|
"command:fusion": [
|
|
1770
1835
|
"commands/fusion"
|
|
1771
1836
|
],
|
|
@@ -59,6 +59,20 @@ Bounded logs are for context safety; they point to the full local output file wh
|
|
|
59
59
|
|
|
60
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
61
|
|
|
62
|
+
## Global Anthropic attribution and caching
|
|
63
|
+
|
|
64
|
+
Normal package installation loads the package-owned Anthropic attribution/sanitization extension before the background-task extension. Non-Anthropic sessions are unchanged. Anthropic sessions require Pi's subscription OAuth route; the provider refuses metered Anthropic credentials and reads `userID` plus `oauthAccount.accountUuid` from `~/.claude.json` without writing it.
|
|
65
|
+
|
|
66
|
+
| Variable/command | Effect |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `PI_CACHE_RETENTION=long` | Default to one-hour Anthropic cache breakpoints where the model supports them. This is the package default when unset. |
|
|
69
|
+
| `PI_CACHE_RETENTION=short` | Default to ordinary ephemeral cache breakpoints without a one-hour TTL. |
|
|
70
|
+
| `PI_CACHE_RETENTION=none` | Do not add default cache breakpoints. Explicit call-level policy remains authoritative. |
|
|
71
|
+
| `/claude-cache status` | Show the effective cache-retention policy for the current session. |
|
|
72
|
+
| `/claude-cache short\|long\|default` | Store or clear a branch-local session override. |
|
|
73
|
+
|
|
74
|
+
Invalid retention values and malformed persisted overrides fail loudly. The extension also removes only the three reviewed exact-match Pi system-prompt lines rejected by Anthropic; it has no external sanitizer dependency. See [Anthropic attribution](../subsystems/anthropic-attribution.md) and [`/claude-cache`](../commands/claude-cache.md).
|
|
75
|
+
|
|
62
76
|
## Fusion model configuration
|
|
63
77
|
|
|
64
78
|
Fusion model slots are stored globally under the Pi agent directory as:
|
|
@@ -77,7 +91,7 @@ Use `/fusion-models` in TUI mode to configure five slots:
|
|
|
77
91
|
|
|
78
92
|
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
93
|
|
|
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. Anthropic children
|
|
94
|
+
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. Anthropic children explicitly load the same package-owned global attribution/sanitization extension because Fusion disables ambient extension discovery. Missing or malformed attribution data fails loudly before Anthropic transport. Its subscription request policy is 200K, so Fusion clamps Anthropic budget capacity to 200K even when Pi's model catalog advertises a larger context.
|
|
81
95
|
|
|
82
96
|
## Fusion Claude prompt caching
|
|
83
97
|
|
|
@@ -34,6 +34,8 @@ npm run test:hook-contract
|
|
|
34
34
|
npm run smoke
|
|
35
35
|
npm run smoke:large-context
|
|
36
36
|
npm run pack:dry-run
|
|
37
|
+
# With pnpm 11.18.0 on PATH:
|
|
38
|
+
npm run test:pnpm-pack
|
|
37
39
|
npm run docs:verify
|
|
38
40
|
npm run payload:check
|
|
39
41
|
# On a tag ref only: GITHUB_REF_TYPE=tag GITHUB_REF_NAME=v$VERSION npm run release:check-version
|
|
@@ -49,11 +51,12 @@ Live evidence (`npx tsx scripts/delegate-live-run.ts`) is release-time and perfo
|
|
|
49
51
|
|
|
50
52
|
Use `npm pack --dry-run --json` output as the payload source of truth. Verify at minimum:
|
|
51
53
|
|
|
52
|
-
- `extensions/background-tasks.ts`
|
|
53
|
-
- runtime `src/` files needed by
|
|
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`;
|
|
54
|
+
- `extensions/anthropic-attribution.ts` and `extensions/background-tasks.ts` are included as the ordered Pi entrypoints;
|
|
55
|
+
- runtime `src/` files needed by both entrypoints are included;
|
|
56
|
+
- `docs/`, `README.md`, `TESTING.md`, `TEST_PLAN.md`, `PUBLISHING.md`, `BACKGROUND-TASKS-INSTRUCTIONS.md`, `THIRD_PARTY_NOTICES.md`, root `logo.png`, and `LICENSE` are included per current `package.json.files`;
|
|
55
57
|
- tests, scripts, node_modules, local `.pi/` artifacts, generated evidence not meant for runtime, and nested tarballs are excluded;
|
|
56
58
|
- TypeBox remains a Pi-provided peer and no private/nested runtime TypeBox copy is bundled;
|
|
59
|
+
- production dependencies use registry versions only; no exotic URL/git/file subdependency is shipped;
|
|
57
60
|
- docs/assets/gateway/logo inclusion matches `package.json.files` exactly.
|
|
58
61
|
|
|
59
62
|
## Tag certification vs npm publishing
|
package/docs/read-before-edit.md
CHANGED
|
@@ -15,9 +15,12 @@ Every production file under `src/**` and `extensions/**` has exactly one primary
|
|
|
15
15
|
|
|
16
16
|
| Source | Primary behavioral owner |
|
|
17
17
|
| --- | --- |
|
|
18
|
+
| `extensions/anthropic-attribution.ts` | [subsystems/anthropic-attribution](./subsystems/anthropic-attribution.md) |
|
|
18
19
|
| `extensions/background-tasks.ts` | [subsystems/host-ui-and-telemetry](./subsystems/host-ui-and-telemetry.md) |
|
|
19
20
|
| `extensions/delegate-child.ts` | [subsystems/delegation](./subsystems/delegation.md) |
|
|
20
21
|
| `extensions/fusion-child.ts` | [subsystems/fusion](./subsystems/fusion.md) |
|
|
22
|
+
| `src/core/anthropic-attribution-path.ts` | [subsystems/anthropic-attribution](./subsystems/anthropic-attribution.md) |
|
|
23
|
+
| `src/core/anthropic-attribution.ts` | [subsystems/anthropic-attribution](./subsystems/anthropic-attribution.md) |
|
|
21
24
|
| `src/core/attested-pi-run.ts` | [subsystems/attested-pi-runs](./subsystems/attested-pi-runs.md) |
|
|
22
25
|
| `src/core/common.ts` | [subsystems/background-task-runtime](./subsystems/background-task-runtime.md) |
|
|
23
26
|
| `src/core/context/parent-snapshot.ts` | [concepts/context-projection-and-budgeting](./concepts/context-projection-and-budgeting.md) |
|
|
@@ -34,7 +37,6 @@ Every production file under `src/**` and `extensions/**` has exactly one primary
|
|
|
34
37
|
| `src/core/delegate/types.ts` | [subsystems/delegation](./subsystems/delegation.md) |
|
|
35
38
|
| `src/core/durable-fs.ts` | [subsystems/child-launch-durability-and-safety](./subsystems/child-launch-durability-and-safety.md) |
|
|
36
39
|
| `src/core/extension-api.ts` | [api/eventbus-v1](./api/eventbus-v1.md) |
|
|
37
|
-
| `src/core/fusion/anthropic-attribution.ts` | [subsystems/fusion](./subsystems/fusion.md) |
|
|
38
40
|
| `src/core/fusion/artifacts.ts` | [subsystems/fusion](./subsystems/fusion.md) |
|
|
39
41
|
| `src/core/fusion/budget.ts` | [subsystems/fusion](./subsystems/fusion.md) |
|
|
40
42
|
| `src/core/fusion/child-protocol.ts` | [subsystems/fusion](./subsystems/fusion.md) |
|
|
@@ -70,6 +72,7 @@ Every production file under `src/**` and `extensions/**` has exactly one primary
|
|
|
70
72
|
- `command:bg-clear`
|
|
71
73
|
- `command:bg-tasks`
|
|
72
74
|
- `command:bg-update`
|
|
75
|
+
- `command:claude-cache`
|
|
73
76
|
- `command:fusion`
|
|
74
77
|
- `command:fusion-models`
|
|
75
78
|
- `command:jobs`
|
|
@@ -26,43 +26,43 @@ This generated registry lists production environment-variable references, runtim
|
|
|
26
26
|
| `AZURE_OPENAI_DEPLOYMENT_NAME_MAP` | remove | `src/core/fusion/pi-child.ts:98` |
|
|
27
27
|
| `AZURE_OPENAI_ENDPOINT` | remove | `src/core/fusion/pi-child.ts:98` |
|
|
28
28
|
| `AZURE_OPENAI_RESOURCE_NAME` | remove | `src/core/fusion/pi-child.ts:98` |
|
|
29
|
-
| `ComSpec` | read | `src/core/common.ts:
|
|
29
|
+
| `ComSpec` | read | `src/core/common.ts:726`<br>`src/core/common.ts:737` |
|
|
30
30
|
| `OPENAI_API_KEY` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:98` |
|
|
31
31
|
| `OPENAI_BASE_URL` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:98` |
|
|
32
32
|
| `OPENROUTER_API_KEY` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:98` |
|
|
33
33
|
| `OPENROUTER_BASE_URL` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:98` |
|
|
34
|
-
| `path` | read | `src/core/common.ts:
|
|
35
|
-
| `Path` | read | `src/core/common.ts:
|
|
36
|
-
| `PATH` | read | `src/core/common.ts:
|
|
34
|
+
| `path` | read | `src/core/common.ts:681` |
|
|
35
|
+
| `Path` | read | `src/core/common.ts:681` |
|
|
36
|
+
| `PATH` | read | `src/core/common.ts:681` |
|
|
37
37
|
| `PI_API_BASE_URL` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:98` |
|
|
38
38
|
| `PI_API_KEY` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:98` |
|
|
39
39
|
| `PI_AUTH_FILE` | remove | `src/core/attested-pi-run.ts:135`<br>`src/core/fusion/pi-child.ts:98` |
|
|
40
|
-
| `PI_BG_DELEGATE_ARTIFACT_DIR` | read, write | `src/core/delegate/launch.ts:
|
|
41
|
-
| `PI_BG_DELEGATE_LAUNCH_NONCE` | read, write | `src/core/delegate/launch.ts:
|
|
42
|
-
| `PI_BG_DELEGATE_SEED_PATH` | read, write | `src/core/delegate/launch.ts:
|
|
43
|
-
| `PI_BG_DELEGATE_SEED_SHA256` | read, write | `src/core/delegate/launch.ts:
|
|
44
|
-
| `PI_BG_DELEGATE_TASK_ID` | read, write | `src/core/delegate/launch.ts:
|
|
45
|
-
| `PI_BG_DISABLE_PI_TELEMETRY` | read | `src/core/registry.ts:
|
|
40
|
+
| `PI_BG_DELEGATE_ARTIFACT_DIR` | read, write | `src/core/delegate/launch.ts:353`<br>`src/delegate-child-extension.ts:279` |
|
|
41
|
+
| `PI_BG_DELEGATE_LAUNCH_NONCE` | read, write | `src/core/delegate/launch.ts:357`<br>`src/delegate-child-extension.ts:283` |
|
|
42
|
+
| `PI_BG_DELEGATE_SEED_PATH` | read, write | `src/core/delegate/launch.ts:354`<br>`src/delegate-child-extension.ts:280` |
|
|
43
|
+
| `PI_BG_DELEGATE_SEED_SHA256` | read, write | `src/core/delegate/launch.ts:355`<br>`src/delegate-child-extension.ts:281` |
|
|
44
|
+
| `PI_BG_DELEGATE_TASK_ID` | read, write | `src/core/delegate/launch.ts:356`<br>`src/delegate-child-extension.ts:282` |
|
|
45
|
+
| `PI_BG_DISABLE_PI_TELEMETRY` | read | `src/core/registry.ts:195` |
|
|
46
46
|
| `PI_BG_DISABLE_UPDATE_CHECK` | read | `src/extension.ts:455` |
|
|
47
|
-
| `PI_BG_MAX_OUTPUT_BYTES` | read | `src/core/registry.ts:
|
|
47
|
+
| `PI_BG_MAX_OUTPUT_BYTES` | read | `src/core/registry.ts:69` |
|
|
48
48
|
| `PI_BG_REGISTRY_URL` | read | `src/extension.ts:464` |
|
|
49
|
-
| `PI_BG_SHELL` | read | `src/core/common.ts:
|
|
50
|
-
| `PI_BG_SHELL_PATH` | read | `src/core/common.ts:
|
|
51
|
-
| `PI_CACHE_RETENTION` | read, write | `src/core/
|
|
52
|
-
| `PI_FUSION_CANDIDATE_OUTPUT_RECOVERY_PATH` | read, remove, write | `src/core/fusion/pi-child.ts:
|
|
53
|
-
| `PI_FUSION_RESEARCH_ENABLED` | read, remove, write | `src/core/fusion/pi-child.ts:
|
|
54
|
-
| `PI_FUSION_SOURCE_POLICY_PATH` | read, remove, write | `src/core/fusion/pi-child.ts:
|
|
55
|
-
| `PI_FUSION_SOURCE_POLICY_SHA256` | read, remove, write | `src/core/fusion/pi-child.ts:
|
|
56
|
-
| `PI_FUSION_TOOL_CALL_LOG_PATH` | read, remove, write | `src/core/fusion/pi-child.ts:
|
|
57
|
-
| `PI_MODEL` | remove | `src/core/delegate/launch.ts:
|
|
49
|
+
| `PI_BG_SHELL` | read | `src/core/common.ts:722` |
|
|
50
|
+
| `PI_BG_SHELL_PATH` | read | `src/core/common.ts:723` |
|
|
51
|
+
| `PI_CACHE_RETENTION` | read, write | `src/core/anthropic-attribution.ts:587`<br>`src/core/fusion/claude-cache.ts:57`<br>`src/core/fusion/pi-child.ts:271`<br>`src/core/fusion/pi-child.ts:272` |
|
|
52
|
+
| `PI_FUSION_CANDIDATE_OUTPUT_RECOVERY_PATH` | read, remove, write | `src/core/fusion/pi-child.ts:1872`<br>`src/core/fusion/pi-child.ts:98`<br>`src/fusion-child-extension.ts:599` |
|
|
53
|
+
| `PI_FUSION_RESEARCH_ENABLED` | read, remove, write | `src/core/fusion/pi-child.ts:1895`<br>`src/core/fusion/pi-child.ts:98`<br>`src/fusion-child-extension.ts:608` |
|
|
54
|
+
| `PI_FUSION_SOURCE_POLICY_PATH` | read, remove, write | `src/core/fusion/pi-child.ts:1896`<br>`src/core/fusion/pi-child.ts:98`<br>`src/fusion-child-extension.ts:555` |
|
|
55
|
+
| `PI_FUSION_SOURCE_POLICY_SHA256` | read, remove, write | `src/core/fusion/pi-child.ts:1897`<br>`src/core/fusion/pi-child.ts:98`<br>`src/fusion-child-extension.ts:556` |
|
|
56
|
+
| `PI_FUSION_TOOL_CALL_LOG_PATH` | read, remove, write | `src/core/fusion/pi-child.ts:1884`<br>`src/core/fusion/pi-child.ts:98`<br>`src/fusion-child-extension.ts:598` |
|
|
57
|
+
| `PI_MODEL` | remove | `src/core/delegate/launch.ts:330`<br>`src/core/fusion/pi-child.ts:98` |
|
|
58
58
|
| `PI_OFFLINE` | read | `src/extension.ts:456` |
|
|
59
|
-
| `PI_PROVIDER` | remove | `src/core/delegate/launch.ts:
|
|
60
|
-
| `PI_REASONING_LEVEL` | remove | `src/core/delegate/launch.ts:
|
|
61
|
-
| `PI_SESSION_FILE` | remove | `src/core/delegate/launch.ts:
|
|
62
|
-
| `PI_SESSION_ID` | remove | `src/core/delegate/launch.ts:
|
|
63
|
-
| `PI_SKIP_VERSION_CHECK` | write | `src/core/delegate/launch.ts:
|
|
64
|
-
| `PIPELINE_ANTHROPIC_ATTRIBUTION_AUDIT_PATH` | read | `src/core/
|
|
65
|
-
| `SHELL` | read | `src/core/common.ts:
|
|
59
|
+
| `PI_PROVIDER` | remove | `src/core/delegate/launch.ts:330`<br>`src/core/fusion/pi-child.ts:98` |
|
|
60
|
+
| `PI_REASONING_LEVEL` | remove | `src/core/delegate/launch.ts:330`<br>`src/core/fusion/pi-child.ts:98` |
|
|
61
|
+
| `PI_SESSION_FILE` | remove | `src/core/delegate/launch.ts:330`<br>`src/core/fusion/pi-child.ts:98` |
|
|
62
|
+
| `PI_SESSION_ID` | remove | `src/core/delegate/launch.ts:330`<br>`src/core/fusion/pi-child.ts:98` |
|
|
63
|
+
| `PI_SKIP_VERSION_CHECK` | write | `src/core/delegate/launch.ts:352`<br>`src/core/fusion/pi-child.ts:270` |
|
|
64
|
+
| `PIPELINE_ANTHROPIC_ATTRIBUTION_AUDIT_PATH` | read | `src/core/anthropic-attribution.ts:1013` |
|
|
65
|
+
| `SHELL` | read | `src/core/common.ts:718` |
|
|
66
66
|
| `SystemRoot` | read | `src/core/windows-taskkill.ts:96` |
|
|
67
67
|
| `WINDIR` | read | `src/core/windows-taskkill.ts:101` |
|
|
68
68
|
|
|
@@ -71,20 +71,20 @@ This generated registry lists production environment-variable references, runtim
|
|
|
71
71
|
| Kind | Path/artifact | Provenance |
|
|
72
72
|
| --- | --- | --- |
|
|
73
73
|
| config | `fusion-models.json` | `src/core/fusion/config.ts:21` |
|
|
74
|
-
| delegate-artifact | `budget-plan.json` | `src/core/delegate/artifacts.ts:
|
|
75
|
-
| delegate-artifact | `child-prompt.txt` | `src/core/delegate/artifacts.ts:
|
|
76
|
-
| delegate-artifact | `child.stderr.txt` | `src/core/delegate/artifacts.ts:
|
|
77
|
-
| delegate-artifact | `child.stdout.txt` | `src/core/delegate/artifacts.ts:
|
|
78
|
-
| delegate-artifact | `context-omission-ledger.json` | `src/core/delegate/artifacts.ts:
|
|
79
|
-
| delegate-artifact | `error.json` | `src/core/delegate/artifacts.ts:
|
|
80
|
-
| delegate-artifact | `manifest.json` | `src/core/delegate/artifacts.ts:
|
|
81
|
-
| delegate-artifact | `outcome.json` | `src/core/delegate/artifacts.ts:
|
|
74
|
+
| delegate-artifact | `budget-plan.json` | `src/core/delegate/artifacts.ts:43` |
|
|
75
|
+
| delegate-artifact | `child-prompt.txt` | `src/core/delegate/artifacts.ts:47` |
|
|
76
|
+
| delegate-artifact | `child.stderr.txt` | `src/core/delegate/artifacts.ts:48` |
|
|
77
|
+
| delegate-artifact | `child.stdout.txt` | `src/core/delegate/artifacts.ts:49` |
|
|
78
|
+
| delegate-artifact | `context-omission-ledger.json` | `src/core/delegate/artifacts.ts:42` |
|
|
79
|
+
| delegate-artifact | `error.json` | `src/core/delegate/artifacts.ts:50` |
|
|
80
|
+
| delegate-artifact | `manifest.json` | `src/core/delegate/artifacts.ts:44` |
|
|
81
|
+
| delegate-artifact | `outcome.json` | `src/core/delegate/artifacts.ts:45` |
|
|
82
82
|
| delegate-artifact | `result.json` | `src/core/delegate/result-package.ts:28` |
|
|
83
|
-
| delegate-artifact | `seed.json` | `src/core/delegate/artifacts.ts:
|
|
84
|
-
| delegate-artifact | `spill/<receipt-named-file>` | `src/core/delegate/artifacts.ts:
|
|
85
|
-
| directory | `.pi/delegate/<session-id>-<pid>/<task-id>/` | `src/core/delegate/artifacts.ts:
|
|
83
|
+
| delegate-artifact | `seed.json` | `src/core/delegate/artifacts.ts:41` |
|
|
84
|
+
| delegate-artifact | `spill/<receipt-named-file>` | `src/core/delegate/artifacts.ts:54` |
|
|
85
|
+
| directory | `.pi/delegate/<session-id>-<pid>/<task-id>/` | `src/core/delegate/artifacts.ts:160` |
|
|
86
86
|
| directory | `.pi/fusion/<session-id>-<pid>/<run-id>/` | `src/core/fusion/artifacts.ts:563` |
|
|
87
|
-
| directory | `.pi/tasks/<session-id>-<pid>/` | `src/core/registry.ts:
|
|
87
|
+
| directory | `.pi/tasks/<session-id>-<pid>/` | `src/core/registry.ts:784` |
|
|
88
88
|
| fusion-artifact | `<attempt-prefix> = candidate-<slot>.attempt-<n> \| evaluation.attempt-<n> \| merge.attempt-<n>` | `src/core/fusion/artifacts.ts:248` |
|
|
89
89
|
| fusion-artifact | `<attempt-prefix>.calibration-violation.json` | `src/core/fusion/artifacts.ts:263` |
|
|
90
90
|
| fusion-artifact | `<attempt-prefix>.events.jsonl` | `src/core/fusion/artifacts.ts:804` |
|
|
@@ -104,12 +104,12 @@ This generated registry lists production environment-variable references, runtim
|
|
|
104
104
|
| fusion-artifact | `merged.md` | `src/core/fusion/artifacts.ts:387` |
|
|
105
105
|
| fusion-artifact | `result.json` | `src/core/fusion/artifacts.ts:647` |
|
|
106
106
|
| fusion-artifact | `source-policy.private.json` | `src/core/fusion/artifacts.ts:690` |
|
|
107
|
-
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.attestation.json` | `src/core/attested-pi-run.ts:
|
|
108
|
-
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.json` | `src/core/registry.ts:
|
|
109
|
-
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.output` | `src/core/registry.ts:
|
|
110
|
-
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.pi-events.jsonl` | `src/core/attested-pi-run.ts:
|
|
111
|
-
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.pi-telemetry-wrapper.cjs` | `src/core/attested-pi-run.ts:
|
|
112
|
-
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.stderr` | `src/core/attested-pi-run.ts:
|
|
107
|
+
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.attestation.json` | `src/core/attested-pi-run.ts:592` |
|
|
108
|
+
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.json` | `src/core/registry.ts:812` |
|
|
109
|
+
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.output` | `src/core/registry.ts:811` |
|
|
110
|
+
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.pi-events.jsonl` | `src/core/attested-pi-run.ts:589` |
|
|
111
|
+
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.pi-telemetry-wrapper.cjs` | `src/core/attested-pi-run.ts:591` |
|
|
112
|
+
| task-file | `.pi/tasks/<session-id>-<pid>/<task-id>.stderr` | `src/core/attested-pi-run.ts:590` |
|
|
113
113
|
|
|
114
114
|
### Schema identifiers
|
|
115
115
|
|
|
@@ -117,16 +117,16 @@ This generated registry lists production environment-variable references, runtim
|
|
|
117
117
|
| --- | --- |
|
|
118
118
|
| `phase2.pi_task_attestation.v1` | `src/core/attested-pi-run.ts:20` |
|
|
119
119
|
| `pi-background-tasks.delegate-budget-plan.v2` | `src/core/delegate/types.ts:21` |
|
|
120
|
-
| `pi-background-tasks.delegate-child-terminal.v1` | `src/delegate-child-extension.ts:
|
|
120
|
+
| `pi-background-tasks.delegate-child-terminal.v1` | `src/delegate-child-extension.ts:387` |
|
|
121
121
|
| `pi-background-tasks.delegate-hook-contract.v1` | `src/core/delegate/hook-contract.ts:15` |
|
|
122
|
-
| `pi-background-tasks.delegate-launch.v1` | `src/delegate-extension.ts:
|
|
122
|
+
| `pi-background-tasks.delegate-launch.v1` | `src/delegate-extension.ts:458` |
|
|
123
123
|
| `pi-background-tasks.delegate-ledger.v1` | `src/core/delegate/types.ts:16` |
|
|
124
|
-
| `pi-background-tasks.delegate-manifest.
|
|
125
|
-
| `pi-background-tasks.delegate-outcome.v1` | `src/core/delegate/runner.ts:
|
|
124
|
+
| `pi-background-tasks.delegate-manifest.v2` | `src/core/delegate/types.ts:22` |
|
|
125
|
+
| `pi-background-tasks.delegate-outcome.v1` | `src/core/delegate/runner.ts:224` |
|
|
126
126
|
| `pi-background-tasks.delegate-receipt.v1` | `src/core/delegate/types.ts:19` |
|
|
127
|
-
| `pi-background-tasks.delegate-result-view.v1` | `src/delegate-extension.ts:
|
|
127
|
+
| `pi-background-tasks.delegate-result-view.v1` | `src/delegate-extension.ts:731` |
|
|
128
128
|
| `pi-background-tasks.delegate-result.v1` | `src/core/delegate/types.ts:18` |
|
|
129
|
-
| `pi-background-tasks.delegate-seed.
|
|
129
|
+
| `pi-background-tasks.delegate-seed.v2` | `src/core/delegate/types.ts:15` |
|
|
130
130
|
| `pi-background-tasks.extension-request.v1` | `src/core/extension-api.ts:15` |
|
|
131
131
|
| `pi-background-tasks.extension-response.v1` | `src/core/extension-api.ts:16` |
|
|
132
132
|
| `pi-background-tasks.extension-terminal.v1` | `src/core/extension-api.ts:17` |
|
|
@@ -149,7 +149,7 @@ This generated registry lists production environment-variable references, runtim
|
|
|
149
149
|
| `pi-background-tasks.fusion-merge-input.v1` | `src/core/fusion/prompts.ts:336` |
|
|
150
150
|
| `pi-background-tasks.fusion-models.v1` | `src/core/fusion/types.ts:13` |
|
|
151
151
|
| `pi-background-tasks.fusion-progress.v1` | `src/fusion-extension.ts:59` |
|
|
152
|
-
| `pi-background-tasks.fusion-result-view.v1` | `src/delegate-extension.ts:
|
|
152
|
+
| `pi-background-tasks.fusion-result-view.v1` | `src/delegate-extension.ts:772` |
|
|
153
153
|
| `pi-background-tasks.fusion-result.v4` | `src/core/fusion/types.ts:19` |
|
|
154
154
|
| `pi-background-tasks.fusion-result.v5` | `src/core/fusion/types.ts:20` |
|
|
155
155
|
| `pi-background-tasks.fusion-runtime-guard.v2` | `src/core/fusion/child-protocol.ts:24` |
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc_id: subsystems/anthropic-attribution
|
|
3
|
+
audience: maintainer
|
|
4
|
+
mode: authored
|
|
5
|
+
review_policy: behavioral
|
|
6
|
+
stability: evolving
|
|
7
|
+
covers_surfaces: []
|
|
8
|
+
covers_sources: [extensions/anthropic-attribution.ts, src/core/anthropic-attribution-path.ts, src/core/anthropic-attribution.ts]
|
|
9
|
+
---
|
|
10
|
+
# Anthropic attribution subsystem
|
|
11
|
+
|
|
12
|
+
This subsystem owns the package-wide Anthropic subscription attribution provider, exact-match system-prompt sanitization, cache-retention command, and the package extension path shared by isolated child Pi processes.
|
|
13
|
+
|
|
14
|
+
## Global package behavior
|
|
15
|
+
|
|
16
|
+
`package.json.pi.extensions` loads `extensions/anthropic-attribution.ts` for every normal `pi-background-tasks` installation, before the background-task entrypoint. The extension is provider-gated: non-Anthropic sessions and payloads are unchanged.
|
|
17
|
+
|
|
18
|
+
For Anthropic sessions it registers the package-owned `anthropic` provider transport and applies the Claude Code subscription request contract:
|
|
19
|
+
|
|
20
|
+
- subscription OAuth token transport only; metered Anthropic credentials are refused;
|
|
21
|
+
- Claude Code session, account, device, beta, user-agent, and system-identity attribution;
|
|
22
|
+
- model-specific fixed/adaptive thinking policy;
|
|
23
|
+
- the conservative 200K subscription context policy;
|
|
24
|
+
- system, final-tool, and final-conversation cache surfaces;
|
|
25
|
+
- provider-authoritative usage and one-hour cache-write accounting when reported.
|
|
26
|
+
|
|
27
|
+
The extension reads `userID` and `oauthAccount.accountUuid` from `~/.claude.json` without writing it. Missing/malformed account data, unsupported model policy, malformed payload/cache controls, and non-OAuth transport fail loudly.
|
|
28
|
+
|
|
29
|
+
## Sanitization
|
|
30
|
+
|
|
31
|
+
The package has no runtime dependency on `@ravshansbox/pi-anthropic-sps`. Its three reviewed exact-match prompt-line rules are implemented locally in `src/core/anthropic-attribution.ts`, with the upstream MIT notice retained in `THIRD_PARTY_NOTICES.md`.
|
|
32
|
+
|
|
33
|
+
Only complete matching lines are removed. Other system text, non-text blocks, custom block fields, and valid cache controls are preserved. The rules cover both Pi documentation-list variants—with and without `environment-variables.md`—plus the cross-reference instruction line.
|
|
34
|
+
|
|
35
|
+
## Duplicate-owner protocol
|
|
36
|
+
|
|
37
|
+
A package extension and an independent project/user copy can otherwise register duplicate provider hooks and `/claude-cache` commands. The factory therefore probes `pi-anthropic-attribution:claim:v1` on Pi's shared EventBus before registration. The first successfully registered copy installs one responder; later compatible copies become inert.
|
|
38
|
+
|
|
39
|
+
Ownership is published only after all hooks and the command register. Extension loading is sequential and EventBus listener invocation is synchronous at the probe boundary, so a failed first factory cannot strand a false claim. The responder lives for the shared EventBus runtime, matching the extension registrations it protects.
|
|
40
|
+
|
|
41
|
+
## Isolated package children
|
|
42
|
+
|
|
43
|
+
Ambient discovery is insufficient for child paths that use `--no-extensions`. `resolveAnthropicAttributionExtensionPath()` is the single package path seam used by:
|
|
44
|
+
|
|
45
|
+
- Fusion Anthropic children, before the Fusion runtime governor;
|
|
46
|
+
- Anthropic delegate children, before the delegate guard;
|
|
47
|
+
- Anthropic attested Pi children.
|
|
48
|
+
|
|
49
|
+
Non-Anthropic child argv does not resolve or add this extension. Missing package extension bytes fail before child creation; no route substitution or sanitizer fallback is attempted.
|
|
50
|
+
|
|
51
|
+
Arbitrary shell commands started through `bg_run` are not rewritten. An Anthropic child `pi` launched this way must keep normal extension discovery enabled. If the command deliberately uses `--no-extensions`, it must also explicitly load this package's `extensions/anthropic-attribution.ts` with `-e`/`--extension`; otherwise attribution and sanitization are bypassed and the launch is unsupported. The package does not parse or override arbitrary shell authority.
|
|
52
|
+
|
|
53
|
+
## Cache retention
|
|
54
|
+
|
|
55
|
+
`PI_CACHE_RETENTION=none|short|long` selects process/provider policy. `/claude-cache status|short|long|default` stores a branch-local session override as a custom entry that does not enter model context. Call-level `cacheRetention` remains highest precedence, notably preserving Pi's compaction opt-out.
|
|
56
|
+
|
|
57
|
+
## Related docs
|
|
58
|
+
|
|
59
|
+
- [`/claude-cache`](../commands/claude-cache.md)
|
|
60
|
+
- [Configuration](../operations/configuration.md)
|
|
61
|
+
- [Fusion subsystem](fusion.md)
|
|
62
|
+
- [Delegation subsystem](delegation.md)
|
|
63
|
+
- [Attested Pi runs](attested-pi-runs.md)
|
|
@@ -40,9 +40,9 @@ The logical argv always begins:
|
|
|
40
40
|
pi --mode json --provider <provider> --model <model>
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
For an Anthropic request, the package then adds `--extension <package-owned-anthropic-attribution>` before optional thinking. Next come optional `--thinking <thinking>`, literal `extraPiArgs`, and the prompt as the final user prompt argument. Forbidden extra args are direct auth (`--api-key`, `--auth-file`), mode/print (`-p`, `--print`, `--mode`), and duplicate structured fields (`--provider`, `--model`, `--thinking`). Missing attribution bytes refuse an Anthropic launch before task creation.
|
|
44
44
|
|
|
45
|
-
The registry launches exactly one child through the resolved Pi executable with `shell:false`. The attestation records the stable logical argv (`['pi', ...]`), not platform-specific Windows Node/CLI shims. Attested tasks are created with generic background completion notification/wake disabled; terminal snapshots are still published through the task system.
|
|
45
|
+
The registry launches exactly one child through the resolved Pi executable with `shell:false`. The attestation records the stable logical argv (`['pi', ...]`), including any package-owned attribution extension, not platform-specific Windows Node/CLI shims. Attested tasks are created with generic background completion notification/wake disabled; terminal snapshots are still published through the task system.
|
|
46
46
|
|
|
47
47
|
## Auth and environment boundary
|
|
48
48
|
|
|
@@ -46,9 +46,9 @@ After atomic replace, POSIX-like platforms open and sync the parent directory to
|
|
|
46
46
|
## Process trust boundaries
|
|
47
47
|
|
|
48
48
|
- Background shell tasks run the operator-provided shell command in the project cwd and are not sandboxed.
|
|
49
|
-
- Delegate children are direct `pi` spawns, not shell commands. They use a task-owned session id and session dir, stripped parent session environment, disabled discovery, and an explicit child guard extension.
|
|
50
|
-
- Fusion children are direct `pi --mode text` spawns with private metadata/tool-call audit extensions and workflow-specific tool policy.
|
|
51
|
-
- Attested Pi tasks are direct `pi --mode json` spawns and produce evidence sidecars after successful parsing and durability.
|
|
49
|
+
- Delegate children are direct `pi` spawns, not shell commands. They use a task-owned session id and session dir, stripped parent session environment, disabled discovery, and an explicit child guard extension; Anthropic delegates first load the package attribution extension.
|
|
50
|
+
- Fusion children are direct `pi --mode text` spawns with private metadata/tool-call audit extensions and workflow-specific tool policy; Anthropic children first load the package attribution extension.
|
|
51
|
+
- Attested Pi tasks are direct `pi --mode json` spawns and produce evidence sidecars after successful parsing and durability; Anthropic tasks receive the package attribution extension explicitly.
|
|
52
52
|
|
|
53
53
|
Never blur parent and child authority: parent tools can start/inspect/kill tasks, but child tools must stay within their explicit argv tool set.
|
|
54
54
|
|