@caupulican/pi-adaptative 0.80.7 → 0.80.8
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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/core/reload-blockers.d.ts +2 -0
- package/dist/core/reload-blockers.d.ts.map +1 -1
- package/dist/core/reload-blockers.js +8 -2
- package/dist/core/reload-blockers.js.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +7 -3
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +3 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +1 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +88 -26
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/adaptive-extension-shared-state-audit.md +43 -0
- package/docs/settings.md +2 -2
- package/docs/skills.md +3 -3
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Pi adaptive extension shared-state audit
|
|
2
|
+
|
|
3
|
+
Date: 2026-06-04
|
|
4
|
+
Scope: `~/.pi/agent/extensions`, TypeScript sources, excluding `node_modules`, `dist`, `build`, `.git`, and coverage folders.
|
|
5
|
+
|
|
6
|
+
## Classification legend
|
|
7
|
+
|
|
8
|
+
- **Tenant-scoped**: mutable state is under a current session/tenant key; tools should not list or mutate other tenants by default.
|
|
9
|
+
- **User-global guarded**: state is intentionally shared across Pi sessions because it represents a user-level transport, daemon, or coordinator. The extension must document this and guard mutating actions.
|
|
10
|
+
- **Utility/no durable mutable state**: no relevant shared durable state, or only bounded artifacts with no session/task ownership implications.
|
|
11
|
+
|
|
12
|
+
## Audit table
|
|
13
|
+
|
|
14
|
+
| Extension/file | Shared artifacts found | Classification | Status / evidence |
|
|
15
|
+
| --- | --- | --- | --- |
|
|
16
|
+
| `harness-stack/index.ts` | Previously global `tasks.json`, `team-peers.json`, `team-agent-runs/`, `runs/`; global UI preset `state.json` remains. | Tenant-scoped for orchestration; user-global for UI preset only. | Patched to `~/.pi/agent/harness-stack/tenants/<tenant-id>/...`. Behavioral two-session proof: `/tmp/harness-stack-isolation-check.mjs` PASS, cross-session task/binding invisibility and no global task/run artifacts. |
|
|
17
|
+
| `task-scheduler/index.ts` | Previously global `jobs.json`, `runs/`, `logs/`, `output/`, `tick.lock`. | Tenant-scoped. | Patched to `~/.pi/agent/task-scheduler/tenants/<tenant-id>/...`. Behavioral two-session proof: `/tmp/task-scheduler-isolation-check.mjs` PASS; cross-session status/pause/remove blocked as not found. |
|
|
18
|
+
| `task-steps/index.ts` | `task-steps/tenants/<tenant>/state.json`, background jobs/logs/output. | Tenant-scoped. | Already hardened before this round; tool descriptions say current-session tenant only. |
|
|
19
|
+
| `subagent/index.ts` | `subagent-background/sessions/<tenant>/...`, `subagent-runs/sessions/<tenant>/...`, persistent user/project agent dirs. | Tenant-scoped for runs; user/project agent dirs are deliberate durable assets. | Already hardened before this round; `agent_runtime` only lists/controls current-session tenant runs and prune requires sweep+memory evidence. |
|
|
20
|
+
| `continuous-learning/index.ts` | Auto-learn state/lock, run logs, per-tenant learner artifacts, Automata writes. | Mixed: tenant-scoped artifacts/concurrency; user-global learner lease is deliberate coordination. | Already patched before this round for per-session tenant artifact dirs, per-tenant concurrency, prompt/log cleanup, and memory-first validation tree. |
|
|
21
|
+
| `adaptative-agent/index.ts` | Adaptive work/truth/renewal state, reload coordinator awareness. | User-global adaptive coordinator with guardrails. | Previously patched: auto-learn sessions ignored in reload blockers; adaptive state records evidence and renewal requires judged packets/source audit. |
|
|
22
|
+
| `pi-auto-reload/index.ts` | `pi-auto-reload-state.json/.lock`, `pi-active-turns.json/.lock`, handoff/config. | User-global guarded coordinator. | Intentional cross-session reload coordination so sessions do not reload over active foreground turns; README updated to document global coordinator files and auto-learn exclusion. |
|
|
23
|
+
| `pi-chat/*` | `~/.pi/pi-chat/config.json`, `identity.json`, `peers.json`, `devices.json`, `sessions/local/audit.jsonl`, pairing QR artifacts, socket/relay runtime. | User-global guarded transport endpoint. | Inspected constants/state/tools/commands/local-mesh/qrcode. README/tool guidelines/status/setup text updated: user-global transport state, metadata-only audit, no message body persistence, token-gated TCP, no shell execution. |
|
|
24
|
+
| `mobile-gateway/index.ts`, `mobile-gateway/daemon.cjs` | `~/.pi/agent/mobile-gateway/runtime.json`, `daemon.log`, Telegram offset, WhatsApp session/QR files, daemon process. | User-global guarded singleton. | Patched: start records owner tenant/session, daemon persists owner metadata, status/logs expose `singletonScope=user-global`, cross-tenant stop refuses unless `confirm=yes-stop-global-mobile-gateway`. Behavioral guard proof: `/tmp/mobile-gateway-singleton-guard-check.mjs` PASS. |
|
|
25
|
+
| `pi-chat/src/qrcode.ts` | Pairing QR `.svg/.txt` under pi-chat pairing dir. | User-global guarded artifact. | Artifacts contain short-lived pairing URI/token, private mode best-effort; documented under pi-chat transport guardrails. |
|
|
26
|
+
| `mobile-gateway/README.md`, `pi-chat/README.md`, `pi-auto-reload/README.md` | Documentation state. | Guardrail documentation. | Updated to make deliberate global/singleton behavior auditable for future agents. |
|
|
27
|
+
| `bash-guard/index.ts` | No durable mutable state. | Utility/no durable mutable state. | Pattern hits were static block-rule names, not shared files. |
|
|
28
|
+
| `ask-user-question.ts` | No durable mutable state found. | Utility/no durable mutable state. | UI question helper; no cross-tenant file store. |
|
|
29
|
+
| `context.ts`, `learning-review.ts`, `md-link.ts`, `lib/context-limits.ts` | No high-risk shared runtime state found in audit; bounded helper behavior. | Utility/no durable mutable state or read-only/helper artifacts. | No patch needed from this sweep. |
|
|
30
|
+
| `antigravity-ui/index.ts`, `web-fetch/index.ts`, `web-search/index.ts`, `google-image-search/index.ts`, `youtube-search/index.ts`, `video-extract/index.ts`, `trello/index.ts`, `rg-tool.ts` | No high-risk shared session/task state found in TypeScript audit. | Utility/no durable mutable state. | No patch needed from this sweep. |
|
|
31
|
+
|
|
32
|
+
## Validation evidence
|
|
33
|
+
|
|
34
|
+
- Harness-stack behavioral isolation: `node /tmp/harness-stack-isolation-check.mjs` -> PASS.
|
|
35
|
+
- Task-scheduler behavioral isolation: `node /tmp/task-scheduler-isolation-check.mjs` -> PASS.
|
|
36
|
+
- Mobile-gateway singleton guard: `node /tmp/mobile-gateway-singleton-guard-check.mjs` -> PASS.
|
|
37
|
+
- Focused extension builds: `esbuild` passed for `harness-stack`, `task-scheduler`, `mobile-gateway`, and `pi-chat`.
|
|
38
|
+
- Core prompt behavior source/test: MAPE + tenant-safety + Automata-memory guardrails added to `packages/coding-agent/src/core/system-prompt.ts`; `packages/coding-agent/test/system-prompt.test.ts` covers them.
|
|
39
|
+
- Full repo validation previously passed after prompt changes: `npm run check`.
|
|
40
|
+
|
|
41
|
+
## Runtime activation note
|
|
42
|
+
|
|
43
|
+
The authorized source repo `/mnt/d/GitHub/mine/pi-adaptative` has the updated prompt source and built source `packages/coding-agent/dist/core/system-prompt.js` contains the new rules after `npm run build`. The global `pi` package was relinked with `npm link` from `/mnt/d/GitHub/mine/pi-adaptative/packages/coding-agent`; `readlink -f $(which pi)` now resolves to `/mnt/d/GitHub/mine/pi-adaptative/packages/coding-agent/dist/cli.js`, and the global package path `/home/caudev/.nvm/versions/node/v22.22.3/lib/node_modules/@caupulican/pi-adaptative` resolves to the authorized source package. The active global runtime `dist/core/system-prompt.js` contains the MAPE, tenant-safety, and Automata-memory prompt lines for new Pi sessions.
|
package/docs/settings.md
CHANGED
|
@@ -118,7 +118,7 @@ Hard stops still require explicit foreground approval even in `full`: publishing
|
|
|
118
118
|
| `autoLearn.longSessionContextPercent` | number | `70` | Trigger when current context usage reaches this percent |
|
|
119
119
|
| `autoLearn.cooldownMinutes` | number | `120` | Per-session-tenant cooldown between learner launches |
|
|
120
120
|
| `autoLearn.leaseMinutes` | number | `90` | Shared-state lease duration for a running background learner |
|
|
121
|
-
| `autoLearn.maxConcurrentLearners` | number | `2` | Maximum running Auto Learn background learners
|
|
121
|
+
| `autoLearn.maxConcurrentLearners` | number | `2` | Maximum running Auto Learn background learners per session tenant |
|
|
122
122
|
| `autoLearn.applyHighConfidence` | boolean | `false` | Allow the learner to apply high-confidence memory candidates; broader write authority is controlled by `autonomy.mode` |
|
|
123
123
|
| `autoLearn.reflectionReview` | boolean | `true` | When Auto Learn is enabled, also run bounded post-turn reflection after corrective or complex turns |
|
|
124
124
|
| `autoLearn.reflectionMinToolCalls` | number | `5` | Trigger reflection review after this many tool calls in one completed turn |
|
|
@@ -126,7 +126,7 @@ Hard stops still require explicit foreground approval even in `full`: publishing
|
|
|
126
126
|
|
|
127
127
|
Use `/settings` → **Auto Learn Advanced** to override the active autonomy preset, including the scavenger model and reflection review. The submenu lets you choose whether to save globally or to the current project's `.pi/settings.json`. The model picker prioritizes models from currently configured subscription/API accounts and still offers a manual custom-pattern entry. Use `/autonomy status` for the compact preset dashboard, `/auto-learn status` to inspect trigger state, reflection cooldown, and running leases, or `/auto-learn run` to start one learner immediately.
|
|
128
128
|
|
|
129
|
-
When enabled, Auto Learn
|
|
129
|
+
When enabled, Auto Learn keeps a small shared state file for visibility/cooldowns, but prompt/log/session artifacts are isolated under per-session-tenant directories so one session's learner does not consume another session's concurrency budget. Learners must confront available user/project memory first, using existing rules, preferences, corrections, and project facts to decide whether each candidate is useful, unique versus merge/upgrade-worthy, and agent-improving. Candidate validation is chunked/vectorized instead of one memory query per candidate. Successful Auto Learn workers purge their internal prompt/log/session artifacts after exit; the 7-day retention pruner is a fallback for unfinished or failed artifacts, and active leases are skipped so running learners are not raced. Provider/user history pruning is delegated to the continuous-learning tool after it records a learning outcome: only files older than 7 days whose current fingerprint still matches a successfully extracted index entry are deleted, and active/current sessions are protected.
|
|
130
130
|
|
|
131
131
|
```json
|
|
132
132
|
{
|
package/docs/skills.md
CHANGED
|
@@ -63,12 +63,12 @@ For project-level Claude Code skills, add to `.pi/settings.json`:
|
|
|
63
63
|
|
|
64
64
|
## How Skills Work
|
|
65
65
|
|
|
66
|
-
1. At startup, pi scans skill locations
|
|
67
|
-
2. The system prompt includes
|
|
66
|
+
1. At startup, pi scans skill locations and extracts names and descriptions
|
|
67
|
+
2. The system prompt includes available skills in XML format per the [specification](https://agentskills.io/integrate-skills)
|
|
68
68
|
3. When a task matches, the agent uses `read` to load the full SKILL.md (models don't always do this; use prompting or `/skill:name` to force it)
|
|
69
69
|
4. The agent follows the instructions, using relative paths to reference scripts and assets
|
|
70
70
|
|
|
71
|
-
This is progressive disclosure:
|
|
71
|
+
This is progressive disclosure: names and descriptions are always in context, while full instructions load on-demand.
|
|
72
72
|
|
|
73
73
|
## Skill Commands
|
|
74
74
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.8",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "0.80.
|
|
9
|
+
"version": "0.80.8",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.8",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-sandbox",
|
|
9
|
-
"version": "0.80.
|
|
9
|
+
"version": "0.80.8",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.8",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "0.80.
|
|
9
|
+
"version": "0.80.8",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caupulican/pi-adaptative",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.8",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@caupulican/pi-adaptative",
|
|
9
|
-
"version": "0.80.
|
|
9
|
+
"version": "0.80.8",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@earendil-works/pi-agent-core": "npm:@caupulican/pi-agent-core@0.80.
|
|
13
|
-
"@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.
|
|
14
|
-
"@earendil-works/pi-tui": "npm:@caupulican/pi-tui@0.80.
|
|
12
|
+
"@earendil-works/pi-agent-core": "npm:@caupulican/pi-agent-core@0.80.8",
|
|
13
|
+
"@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.8",
|
|
14
|
+
"@earendil-works/pi-tui": "npm:@caupulican/pi-tui@0.80.8",
|
|
15
15
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
16
16
|
"chalk": "5.6.2",
|
|
17
17
|
"cross-spawn": "7.0.6",
|
|
@@ -474,11 +474,11 @@
|
|
|
474
474
|
}
|
|
475
475
|
},
|
|
476
476
|
"node_modules/@earendil-works/pi-agent-core": {
|
|
477
|
-
"version": "0.80.
|
|
478
|
-
"resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.80.
|
|
477
|
+
"version": "0.80.8",
|
|
478
|
+
"resolved": "https://registry.npmjs.org/@caupulican/pi-agent-core/-/pi-agent-core-0.80.8.tgz",
|
|
479
479
|
"license": "MIT",
|
|
480
480
|
"dependencies": {
|
|
481
|
-
"@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.
|
|
481
|
+
"@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.8",
|
|
482
482
|
"ignore": "7.0.5",
|
|
483
483
|
"typebox": "1.1.38",
|
|
484
484
|
"yaml": "2.9.0"
|
|
@@ -488,8 +488,8 @@
|
|
|
488
488
|
}
|
|
489
489
|
},
|
|
490
490
|
"node_modules/@earendil-works/pi-ai": {
|
|
491
|
-
"version": "0.80.
|
|
492
|
-
"resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.80.
|
|
491
|
+
"version": "0.80.8",
|
|
492
|
+
"resolved": "https://registry.npmjs.org/@caupulican/pi-ai/-/pi-ai-0.80.8.tgz",
|
|
493
493
|
"license": "MIT",
|
|
494
494
|
"dependencies": {
|
|
495
495
|
"@anthropic-ai/sdk": "0.91.1",
|
|
@@ -511,8 +511,8 @@
|
|
|
511
511
|
}
|
|
512
512
|
},
|
|
513
513
|
"node_modules/@earendil-works/pi-tui": {
|
|
514
|
-
"version": "0.80.
|
|
515
|
-
"resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.80.
|
|
514
|
+
"version": "0.80.8",
|
|
515
|
+
"resolved": "https://registry.npmjs.org/@caupulican/pi-tui/-/pi-tui-0.80.8.tgz",
|
|
516
516
|
"license": "MIT",
|
|
517
517
|
"dependencies": {
|
|
518
518
|
"get-east-asian-width": "1.6.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caupulican/pi-adaptative",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.8",
|
|
4
4
|
"description": "Adaptive fork of Pi coding agent for self-evolving agent harness experiments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@earendil-works/pi-agent-core": "npm:@caupulican/pi-agent-core@0.80.
|
|
45
|
-
"@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.
|
|
46
|
-
"@earendil-works/pi-tui": "npm:@caupulican/pi-tui@0.80.
|
|
44
|
+
"@earendil-works/pi-agent-core": "npm:@caupulican/pi-agent-core@0.80.8",
|
|
45
|
+
"@earendil-works/pi-ai": "npm:@caupulican/pi-ai@0.80.8",
|
|
46
|
+
"@earendil-works/pi-tui": "npm:@caupulican/pi-tui@0.80.8",
|
|
47
47
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
48
48
|
"chalk": "5.6.2",
|
|
49
49
|
"cross-spawn": "7.0.6",
|