pi-harness-runtime 1.1.475 → 1.1.477
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/AGENTS.md +18 -0
- package/CHANGELOG.md +107 -0
- package/harness/key-file-audit.ts +106 -6
- package/harness/startup-report.ts +101 -8
- package/index.ts +21 -4
- package/package.json +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/logging/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/relay/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/tooling-preference/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/two-phase-review/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/package.json +1 -1
- package/packages/write-review/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -563,6 +563,24 @@ Use tools in this order (highest to lowest priority):
|
|
|
563
563
|
- Wiki/documentation changes go in `wiki/` (gitignored)
|
|
564
564
|
- API keys, tokens, credentials: **never commit**
|
|
565
565
|
|
|
566
|
+
### Key Files That Need `sudo` (CRITICAL)
|
|
567
|
+
|
|
568
|
+
The startup summary names every key file that other accounts on the machine can
|
|
569
|
+
read. The harness repairs the permissions itself whenever it can, and a file it
|
|
570
|
+
cannot repair is reported with the reason and with the command.
|
|
571
|
+
|
|
572
|
+
**When the startup report offers a `sudo` command:**
|
|
573
|
+
|
|
574
|
+
- **Ask the user once.** Offer the command that is in the report: "May I run
|
|
575
|
+
this command for you?" The user decides.
|
|
576
|
+
- **Run it with `sudo -n`.** The agent never waits for a password: `sudo -n`
|
|
577
|
+
fails immediately when a password is required.
|
|
578
|
+
- **Never ask for a password in the chat.** A password belongs in the terminal
|
|
579
|
+
of the user. When `sudo -n` fails, tell the user to run the command in their
|
|
580
|
+
own terminal.
|
|
581
|
+
- **Never run `sudo` without the answer of the user.** The harness repairs what
|
|
582
|
+
it owns; everything else needs the permission of the user.
|
|
583
|
+
|
|
566
584
|
---
|
|
567
585
|
|
|
568
586
|
## React Best Practices (CRITICAL)
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,113 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.477](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.477) (2026-11-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
|
|
11
|
+
* **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
|
|
12
|
+
* **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
|
|
13
|
+
* **jev:** one decision per question, bound to the question it was evaluated for ([03448aa](https://github.com/ManotLuijiu/pi-harness-runtime/commit/03448aaa17f2d0c3bcf644b0b1d5949727dfff8c))
|
|
14
|
+
* **jev:** the evaluation of a choice sees what the options mean ([f0c207e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f0c207e074701e6b7dab0965170ec39453d9d502))
|
|
15
|
+
* **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
|
|
16
|
+
* **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
|
|
17
|
+
* **keys:** tell the user what to do about an exposed key file ([7031003](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7031003574307351b7a8f28ee14159b58e17b793))
|
|
18
|
+
* **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
|
|
19
|
+
* **mcp:** the harness connects the registered servers when nobody else does ([7fef951](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7fef95137ad4664df57f045cd91b7d233315b0bc))
|
|
20
|
+
* **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
|
|
21
|
+
* **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
|
|
22
|
+
* **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
|
|
23
|
+
* **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
|
|
24
|
+
* **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
|
|
25
|
+
* **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
|
|
26
|
+
* **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
|
|
27
|
+
* **workspace:** a Frappe bench names the mode of the workspace ([9d58517](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d585172063a330992fee933316e268ae9985e3c))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
|
|
33
|
+
* **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
|
|
34
|
+
* **honcho:** a probe that the end of the session cuts off is not a failure ([493fd93](https://github.com/ManotLuijiu/pi-harness-runtime/commit/493fd938ba09fdcf57bed4aaf259d81c4040909e))
|
|
35
|
+
* **honcho:** the report names the state of the MCP server, not the registration ([762f4d5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/762f4d59e4eabcab9a1c21a61aa522c3267621b3))
|
|
36
|
+
* **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
|
|
37
|
+
* **jev:** a prohibition must not hide a destructive action ([78a6cc1](https://github.com/ManotLuijiu/pi-harness-runtime/commit/78a6cc199e647f812e145483f7e94991358d8f34))
|
|
38
|
+
* **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
|
|
39
|
+
* **jev:** keep a comparative caveat with the option it constrains ([7be306b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7be306b0d0872713ebca9386d613ae5a8da9d5b6))
|
|
40
|
+
* **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
|
|
41
|
+
* **jev:** the facts of an option survive the wording of the agent ([5a6250c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5a6250c07aa8d965bc6ae242cccbf519477598f8))
|
|
42
|
+
* **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
|
|
43
|
+
* **mcp:** the connector and the watcher stop with the session ([4d1b87d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/4d1b87d14d015749025b62bf54d6d0b6137295f7))
|
|
44
|
+
* **mcp:** the connector survives a runtime that cannot list the servers ([d0f555f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0f555fa14f51de33591e572a41ded5b59a3e4dd))
|
|
45
|
+
* **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
|
|
46
|
+
* **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
|
|
47
|
+
* **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
|
|
48
|
+
* **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
|
|
49
|
+
* **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
|
|
50
|
+
* **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
|
|
51
|
+
* **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
|
|
52
|
+
* **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
|
|
53
|
+
* **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
|
|
54
|
+
* **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
|
|
55
|
+
* **workspace:** a strong bench signal decides, and the question is not a fact of an option ([303a828](https://github.com/ManotLuijiu/pi-harness-runtime/commit/303a828f55aa7c4e0a611231f482489b530ff5a3))
|
|
56
|
+
* **workspace:** keep a client name out of the comment about the search depth ([b572e0a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b572e0af16ff562203bda2b5c47b41807cff5a95))
|
|
57
|
+
* **workspace:** the repository names the mode before the mode stays unknown ([188a32c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/188a32c7a6af1465dd24714278fccc73d06f6477))
|
|
58
|
+
|
|
59
|
+
### [1.1.476](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.476) (2026-11-08)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
* **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
|
|
65
|
+
* **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
|
|
66
|
+
* **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
|
|
67
|
+
* **jev:** one decision per question, bound to the question it was evaluated for ([03448aa](https://github.com/ManotLuijiu/pi-harness-runtime/commit/03448aaa17f2d0c3bcf644b0b1d5949727dfff8c))
|
|
68
|
+
* **jev:** the evaluation of a choice sees what the options mean ([f0c207e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f0c207e074701e6b7dab0965170ec39453d9d502))
|
|
69
|
+
* **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
|
|
70
|
+
* **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
|
|
71
|
+
* **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
|
|
72
|
+
* **mcp:** the harness connects the registered servers when nobody else does ([7fef951](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7fef95137ad4664df57f045cd91b7d233315b0bc))
|
|
73
|
+
* **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
|
|
74
|
+
* **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
|
|
75
|
+
* **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
|
|
76
|
+
* **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
|
|
77
|
+
* **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
|
|
78
|
+
* **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
|
|
79
|
+
* **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
|
|
80
|
+
* **workspace:** a Frappe bench names the mode of the workspace ([9d58517](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d585172063a330992fee933316e268ae9985e3c))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Bug Fixes
|
|
84
|
+
|
|
85
|
+
* **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
|
|
86
|
+
* **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
|
|
87
|
+
* **honcho:** a probe that the end of the session cuts off is not a failure ([493fd93](https://github.com/ManotLuijiu/pi-harness-runtime/commit/493fd938ba09fdcf57bed4aaf259d81c4040909e))
|
|
88
|
+
* **honcho:** the report names the state of the MCP server, not the registration ([762f4d5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/762f4d59e4eabcab9a1c21a61aa522c3267621b3))
|
|
89
|
+
* **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
|
|
90
|
+
* **jev:** a prohibition must not hide a destructive action ([78a6cc1](https://github.com/ManotLuijiu/pi-harness-runtime/commit/78a6cc199e647f812e145483f7e94991358d8f34))
|
|
91
|
+
* **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
|
|
92
|
+
* **jev:** keep a comparative caveat with the option it constrains ([7be306b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7be306b0d0872713ebca9386d613ae5a8da9d5b6))
|
|
93
|
+
* **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
|
|
94
|
+
* **jev:** the facts of an option survive the wording of the agent ([5a6250c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5a6250c07aa8d965bc6ae242cccbf519477598f8))
|
|
95
|
+
* **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
|
|
96
|
+
* **mcp:** the connector and the watcher stop with the session ([4d1b87d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/4d1b87d14d015749025b62bf54d6d0b6137295f7))
|
|
97
|
+
* **mcp:** the connector survives a runtime that cannot list the servers ([d0f555f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0f555fa14f51de33591e572a41ded5b59a3e4dd))
|
|
98
|
+
* **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
|
|
99
|
+
* **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
|
|
100
|
+
* **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
|
|
101
|
+
* **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
|
|
102
|
+
* **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
|
|
103
|
+
* **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
|
|
104
|
+
* **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
|
|
105
|
+
* **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
|
|
106
|
+
* **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
|
|
107
|
+
* **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
|
|
108
|
+
* **workspace:** a strong bench signal decides, and the question is not a fact of an option ([303a828](https://github.com/ManotLuijiu/pi-harness-runtime/commit/303a828f55aa7c4e0a611231f482489b530ff5a3))
|
|
109
|
+
* **workspace:** keep a client name out of the comment about the search depth ([b572e0a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b572e0af16ff562203bda2b5c47b41807cff5a95))
|
|
110
|
+
* **workspace:** the repository names the mode before the mode stays unknown ([188a32c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/188a32c7a6af1465dd24714278fccc73d06f6477))
|
|
111
|
+
|
|
5
112
|
### [1.1.475](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.475) (2026-11-08)
|
|
6
113
|
|
|
7
114
|
|
|
@@ -358,6 +358,8 @@ export interface KeyEntryInfo {
|
|
|
358
358
|
isDirectory?: boolean;
|
|
359
359
|
/** Is it a symbolic link? */
|
|
360
360
|
isSymbolicLink?: boolean;
|
|
361
|
+
/** The owner of the entry (Unix only). */
|
|
362
|
+
uid?: number;
|
|
361
363
|
}
|
|
362
364
|
|
|
363
365
|
/** How deep the audit walks into the key tree. */
|
|
@@ -396,12 +398,35 @@ export interface KeyFileAuditResult {
|
|
|
396
398
|
exposedDirectories: ExposedKeyDirectory[];
|
|
397
399
|
}
|
|
398
400
|
|
|
401
|
+
/**
|
|
402
|
+
* An entry of the key tree that the harness could not restrict.
|
|
403
|
+
*
|
|
404
|
+
* The reason is the part the user needs: "it belongs to another account" and
|
|
405
|
+
* "the file system is read-only" ask for two different actions, and a report
|
|
406
|
+
* that names neither leaves the user without a way to act.
|
|
407
|
+
*/
|
|
408
|
+
export interface SecureKeyTreeFailure {
|
|
409
|
+
/** The path the harness could not restrict. */
|
|
410
|
+
path: string;
|
|
411
|
+
/** What the path is. */
|
|
412
|
+
kind: "file" | "directory";
|
|
413
|
+
/** Why the harness could not restrict it. */
|
|
414
|
+
reason:
|
|
415
|
+
| "owned by another account"
|
|
416
|
+
| "not permitted"
|
|
417
|
+
| "read-only"
|
|
418
|
+
| "gone"
|
|
419
|
+
| "unknown";
|
|
420
|
+
}
|
|
421
|
+
|
|
399
422
|
export interface SecureKeyTreeResult {
|
|
400
423
|
/** False on platforms where chmod does not express the required ACL. */
|
|
401
424
|
supported: boolean;
|
|
402
425
|
securedFiles: number;
|
|
403
426
|
securedDirectories: number;
|
|
404
427
|
failedPaths: string[];
|
|
428
|
+
/** The failed paths with the reason of each failure. */
|
|
429
|
+
failures: SecureKeyTreeFailure[];
|
|
405
430
|
}
|
|
406
431
|
|
|
407
432
|
/**
|
|
@@ -421,12 +446,24 @@ export function secureKeyTree(
|
|
|
421
446
|
securedFiles: 0,
|
|
422
447
|
securedDirectories: 0,
|
|
423
448
|
failedPaths: [],
|
|
449
|
+
failures: [],
|
|
424
450
|
};
|
|
425
451
|
if (!result.supported) return result;
|
|
426
452
|
|
|
453
|
+
// A failure is recorded with the reason, so the report can tell the user
|
|
454
|
+
// what to do instead of naming a path it cannot explain.
|
|
455
|
+
const recordFailure = (
|
|
456
|
+
path: string,
|
|
457
|
+
kind: "file" | "directory",
|
|
458
|
+
error: unknown,
|
|
459
|
+
): void => {
|
|
460
|
+
result.failedPaths.push(path);
|
|
461
|
+
result.failures.push({ path, kind, reason: failureReason(path, error) });
|
|
462
|
+
};
|
|
463
|
+
|
|
427
464
|
const root = defaultStat(keysDir);
|
|
428
465
|
if (!root?.isDirectory || root.isSymbolicLink) {
|
|
429
|
-
|
|
466
|
+
recordFailure(keysDir, "directory", new Error("the key directory is not a directory"));
|
|
430
467
|
return result;
|
|
431
468
|
}
|
|
432
469
|
|
|
@@ -435,8 +472,8 @@ export function secureKeyTree(
|
|
|
435
472
|
chmodSync(path, 0o700);
|
|
436
473
|
result.securedDirectories++;
|
|
437
474
|
return true;
|
|
438
|
-
} catch {
|
|
439
|
-
|
|
475
|
+
} catch (error) {
|
|
476
|
+
recordFailure(path, "directory", error);
|
|
440
477
|
return false;
|
|
441
478
|
}
|
|
442
479
|
};
|
|
@@ -445,8 +482,8 @@ export function secureKeyTree(
|
|
|
445
482
|
try {
|
|
446
483
|
chmodSync(path, 0o600);
|
|
447
484
|
result.securedFiles++;
|
|
448
|
-
} catch {
|
|
449
|
-
|
|
485
|
+
} catch (error) {
|
|
486
|
+
recordFailure(path, "file", error);
|
|
450
487
|
}
|
|
451
488
|
};
|
|
452
489
|
|
|
@@ -502,12 +539,54 @@ function defaultStat(path: string): KeyEntryInfo | undefined {
|
|
|
502
539
|
isFile: info.isFile(),
|
|
503
540
|
isDirectory: info.isDirectory(),
|
|
504
541
|
isSymbolicLink: info.isSymbolicLink(),
|
|
542
|
+
uid: info.uid,
|
|
505
543
|
};
|
|
506
544
|
} catch {
|
|
507
545
|
return undefined;
|
|
508
546
|
}
|
|
509
547
|
}
|
|
510
548
|
|
|
549
|
+
/**
|
|
550
|
+
* The reason a permission could not be changed.
|
|
551
|
+
*
|
|
552
|
+
* The mapping is pure, so every reason can be tested without a second
|
|
553
|
+
* account and without a read-only file system.
|
|
554
|
+
*/
|
|
555
|
+
export function keyPermissionFailureReason(options: {
|
|
556
|
+
/** The error code of the failed change (e.g. "EPERM"). */
|
|
557
|
+
code?: string;
|
|
558
|
+
/** Does the entry belong to another account? */
|
|
559
|
+
ownedByAnother?: boolean;
|
|
560
|
+
}): SecureKeyTreeFailure["reason"] {
|
|
561
|
+
const code = options.code;
|
|
562
|
+
if (code === "ENOENT") return "gone";
|
|
563
|
+
if (code === "EROFS") return "read-only";
|
|
564
|
+
if (code === "EPERM" || code === "EACCES") {
|
|
565
|
+
return options.ownedByAnother ? "owned by another account" : "not permitted";
|
|
566
|
+
}
|
|
567
|
+
return "unknown";
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Why the harness could not restrict an entry of the key tree.
|
|
572
|
+
*
|
|
573
|
+
* The reason decides what the user has to do: a file of another account is
|
|
574
|
+
* changed with `sudo` or by its owner, a read-only file system is changed
|
|
575
|
+
* nowhere, and a file that is gone needs nothing at all.
|
|
576
|
+
*/
|
|
577
|
+
function failureReason(path: string, error: unknown): SecureKeyTreeFailure["reason"] {
|
|
578
|
+
const code = (error as NodeJS.ErrnoException | undefined)?.code;
|
|
579
|
+
let ownedByAnother = false;
|
|
580
|
+
if (code === "EPERM" || code === "EACCES") {
|
|
581
|
+
const uid = typeof process.getuid === "function" ? process.getuid() : undefined;
|
|
582
|
+
const info = defaultStat(path);
|
|
583
|
+
ownedByAnother = Boolean(
|
|
584
|
+
info && uid !== undefined && info.uid !== undefined && info.uid !== uid,
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
return keyPermissionFailureReason({ code, ownedByAnother });
|
|
588
|
+
}
|
|
589
|
+
|
|
511
590
|
/**
|
|
512
591
|
* The default directory reader.
|
|
513
592
|
*/
|
|
@@ -707,7 +786,7 @@ export function formatExposedKeyFileFix(
|
|
|
707
786
|
entry: ExposedKeyFile,
|
|
708
787
|
keysDir: string,
|
|
709
788
|
): string {
|
|
710
|
-
return `chmod 600 ${join(displayKeysDir(keysDir), entry.file)}`;
|
|
789
|
+
return `chmod 600 ${shellQuoteIfNeeded(join(displayKeysDir(keysDir), entry.file))}`;
|
|
711
790
|
}
|
|
712
791
|
|
|
713
792
|
/**
|
|
@@ -721,6 +800,27 @@ export function shellQuote(value: string): string {
|
|
|
721
800
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
722
801
|
}
|
|
723
802
|
|
|
803
|
+
/**
|
|
804
|
+
* Quote a path for a POSIX shell, but only when it needs it.
|
|
805
|
+
*
|
|
806
|
+
* A plain path stays readable (`chmod 600 ~/.pi-harness-runtime/keys/x.txt`)
|
|
807
|
+
* and a path with a space or a quote becomes one quoted argument.
|
|
808
|
+
*/
|
|
809
|
+
function shellQuoteIfNeeded(value: string): string {
|
|
810
|
+
return /^[A-Za-z0-9_@%+=:,./~-]+$/.test(value) ? value : shellQuote(value);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* The command that makes an entry of another account private.
|
|
815
|
+
*
|
|
816
|
+
* The command needs `sudo`, so it is not a command the harness runs: the
|
|
817
|
+
* report offers it to the user as a question.
|
|
818
|
+
*/
|
|
819
|
+
export function formatUnrepairableKeyFix(failure: SecureKeyTreeFailure): string {
|
|
820
|
+
const mode = failure.kind === "directory" ? "700" : "600";
|
|
821
|
+
return `sudo chmod ${mode} ${shellQuote(failure.path)}`;
|
|
822
|
+
}
|
|
823
|
+
|
|
724
824
|
/**
|
|
725
825
|
* The one command that makes the whole key tree private again.
|
|
726
826
|
*
|
|
@@ -153,30 +153,123 @@ export function relayEndpointReport(options: {
|
|
|
153
153
|
* the harness reads the file successfully, so no feature fails and no other
|
|
154
154
|
* line warns. This line is the only place where the fact can surface.
|
|
155
155
|
*
|
|
156
|
-
* The line
|
|
156
|
+
* The line tells the user what to do. A fact without an action leaves the
|
|
157
|
+
* reader with a warning they cannot act on, so the text carries the command
|
|
158
|
+
* itself: "make it private: chmod 600 <file>". The line names the count, the
|
|
159
|
+
* command and the reason a repair did not happen - and never a value.
|
|
157
160
|
*/
|
|
158
161
|
export function exposedKeyFilesReport(options: {
|
|
159
162
|
/** The key files that other users can read. */
|
|
160
163
|
exposed: ExposedKeyFile[];
|
|
161
164
|
/** The directories of the key tree that other users can reach. */
|
|
162
165
|
exposedDirectories?: ExposedKeyDirectory[];
|
|
163
|
-
/** The `chmod` command
|
|
166
|
+
/** The `chmod` command that repairs the whole key tree. */
|
|
164
167
|
fixes: string[];
|
|
168
|
+
/** The `chmod` command that repairs one exposed key file. */
|
|
169
|
+
fileFixes?: string[];
|
|
170
|
+
/** The entries the harness could not repair itself. */
|
|
171
|
+
unrepairable?: {
|
|
172
|
+
/** The path as the user reads it (the home directory as "~"). */
|
|
173
|
+
path: string;
|
|
174
|
+
/** The command that repairs it (with sudo). */
|
|
175
|
+
command: string;
|
|
176
|
+
/** Why the harness could not repair it. */
|
|
177
|
+
reason: string;
|
|
178
|
+
}[];
|
|
165
179
|
}): StartupReport | null {
|
|
166
180
|
const directories = options.exposedDirectories ?? [];
|
|
167
181
|
if (options.exposed.length === 0 && directories.length === 0) return null;
|
|
168
182
|
const files = options.exposed.length;
|
|
169
183
|
const dirs = directories.length;
|
|
170
|
-
const
|
|
171
|
-
const details = [
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
184
|
+
const fact = exposedPermissionText(files, dirs);
|
|
185
|
+
const details: string[] = [];
|
|
186
|
+
|
|
187
|
+
// The entries the harness could not repair: the user has to do it, and
|
|
188
|
+
// the reason decides how.
|
|
189
|
+
for (const failure of options.unrepairable ?? []) {
|
|
190
|
+
details.push(...unrepairableAdvice(failure));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const fileFixes = options.fileFixes ?? [];
|
|
194
|
+
const oneFile = files === 1 && dirs === 0 && fileFixes.length === 1;
|
|
195
|
+
const oneDirectory = files === 0 && dirs === 1 && options.fixes.length > 0;
|
|
196
|
+
|
|
197
|
+
let text: string;
|
|
198
|
+
if (oneFile) {
|
|
199
|
+
text = `${fact} - make it private: ${fileFixes[0]}`;
|
|
200
|
+
} else if (oneDirectory) {
|
|
201
|
+
text = `${fact} - make it private: ${options.fixes[0]}`;
|
|
202
|
+
} else {
|
|
203
|
+
text = `${fact} - make them private with the command below`;
|
|
204
|
+
details.push(...options.fixes);
|
|
205
|
+
if (options.fixes.length === 0) {
|
|
206
|
+
details.push(
|
|
207
|
+
"Make the key directory private: chmod 700 ~/.pi-harness-runtime/keys",
|
|
208
|
+
);
|
|
209
|
+
}
|
|
176
210
|
}
|
|
211
|
+
|
|
212
|
+
// Why the warning appears on some machines and not on others.
|
|
213
|
+
details.push(
|
|
214
|
+
"A key file is private with the mode 600. The mode comes from the shell that created the file: the umask 022 gives a new file the mode 644. That is why the warning appears on some machines and not on others.",
|
|
215
|
+
);
|
|
216
|
+
|
|
177
217
|
return { label: "Keys", text, status: "warn", details };
|
|
178
218
|
}
|
|
179
219
|
|
|
220
|
+
/**
|
|
221
|
+
* What the user has to do about an entry the harness could not repair.
|
|
222
|
+
*
|
|
223
|
+
* The reason decides the action: another account needs `sudo` or its owner,
|
|
224
|
+
* a read-only file system cannot be changed at all, and a file that is gone
|
|
225
|
+
* needs nothing. The path is a line of its own, so the instruction that
|
|
226
|
+
* follows stays readable on a narrow terminal.
|
|
227
|
+
*/
|
|
228
|
+
function unrepairableAdvice(failure: {
|
|
229
|
+
path: string;
|
|
230
|
+
command: string;
|
|
231
|
+
reason: string;
|
|
232
|
+
}): string[] {
|
|
233
|
+
const path = failure.path;
|
|
234
|
+
const command = failure.command;
|
|
235
|
+
switch (failure.reason) {
|
|
236
|
+
case "owned by another account":
|
|
237
|
+
return [
|
|
238
|
+
path,
|
|
239
|
+
"The harness could not change it: the file belongs to another account.",
|
|
240
|
+
sudoAsk(),
|
|
241
|
+
command,
|
|
242
|
+
];
|
|
243
|
+
case "not permitted":
|
|
244
|
+
return [
|
|
245
|
+
path,
|
|
246
|
+
"The harness could not change it: the permissions are not yours to change.",
|
|
247
|
+
sudoAsk(),
|
|
248
|
+
command,
|
|
249
|
+
];
|
|
250
|
+
case "read-only":
|
|
251
|
+
return [
|
|
252
|
+
path,
|
|
253
|
+
"The harness could not change it: the file system is read-only. Run the command where the file can be written.",
|
|
254
|
+
];
|
|
255
|
+
case "gone":
|
|
256
|
+
return [path, "The harness could not change it: the file is gone. Nothing to do."];
|
|
257
|
+
default:
|
|
258
|
+
return [path, "The harness could not change it. Run the command yourself."];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* The offer to run the command with `sudo`.
|
|
264
|
+
*
|
|
265
|
+
* The offer is a question, so the user decides. The command runs with
|
|
266
|
+
* `sudo -n`, so it never waits for a password: a password belongs in the
|
|
267
|
+
* terminal of the user and never in the chat of the agent.
|
|
268
|
+
*/
|
|
269
|
+
function sudoAsk(): string {
|
|
270
|
+
return "May the agent run the command below with sudo for you? It uses `sudo -n`, so it never waits for a password. If your sudo asks for one, run the command in your own terminal. A password never belongs in the chat.";
|
|
271
|
+
}
|
|
272
|
+
|
|
180
273
|
/**
|
|
181
274
|
* The text of the exposure line.
|
|
182
275
|
*
|
package/index.ts
CHANGED
|
@@ -22,9 +22,12 @@ import type {
|
|
|
22
22
|
import { HarnessStartupStatus, harnessStatusMarker, type HarnessStatus } from "./harness-startup-status.ts";
|
|
23
23
|
import {
|
|
24
24
|
auditKeyFiles,
|
|
25
|
+
displayKeysDir,
|
|
25
26
|
fallbackKeyFileFixes,
|
|
27
|
+
formatExposedKeyFileFixes,
|
|
26
28
|
formatKeyFileFixes,
|
|
27
29
|
formatKeyPermissionFixes,
|
|
30
|
+
formatUnrepairableKeyFix,
|
|
28
31
|
selectKeyFileFixes,
|
|
29
32
|
secureKeyTree,
|
|
30
33
|
type KeyFileAuditResult,
|
|
@@ -259,16 +262,30 @@ function reportExposedKeyFiles(): void {
|
|
|
259
262
|
}
|
|
260
263
|
}
|
|
261
264
|
|
|
265
|
+
// The entries the harness could not repair are only reported when they
|
|
266
|
+
// are the exposed ones: an entry that is already private needs nothing.
|
|
267
|
+
const exposedPaths = new Set<string>();
|
|
268
|
+
for (const entry of exposed) exposedPaths.add(join(harnessKeysDir(), entry.file));
|
|
269
|
+
for (const entry of exposedDirectories) {
|
|
270
|
+
exposedPaths.add(join(harnessKeysDir(), entry.name));
|
|
271
|
+
}
|
|
272
|
+
const unrepairable = repair.failures
|
|
273
|
+
.filter((failure) => exposedPaths.has(failure.path))
|
|
274
|
+
.map((failure) => ({
|
|
275
|
+
path: displayKeysDir(failure.path),
|
|
276
|
+
command: formatUnrepairableKeyFix(failure),
|
|
277
|
+
reason: failure.reason,
|
|
278
|
+
}));
|
|
279
|
+
|
|
262
280
|
const report = exposedKeyFilesReport({
|
|
263
281
|
exposed,
|
|
264
282
|
exposedDirectories,
|
|
265
283
|
fixes: formatKeyPermissionFixes({ keysDir: harnessKeysDir() }),
|
|
284
|
+
fileFixes: formatExposedKeyFileFixes(exposed, harnessKeysDir()),
|
|
285
|
+
unrepairable,
|
|
266
286
|
});
|
|
267
287
|
if (!report) return;
|
|
268
|
-
|
|
269
|
-
? [`Could not change permissions for: ${repair.failedPaths.join(", ")}`]
|
|
270
|
-
: [];
|
|
271
|
-
addHarnessMessage(report.label, report.text, report.status, [...failedPaths, ...report.details]);
|
|
288
|
+
addHarnessMessage(report.label, report.text, report.status, report.details);
|
|
272
289
|
}
|
|
273
290
|
|
|
274
291
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/two-phase-review",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.477",
|
|
4
4
|
"description": "pi-harness-runtime — two-phase implementation and review workflow (queue review signals, gate the phase, scope the diff)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|