gentle-pi 4.9.0 → 5.1.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.
Files changed (443) hide show
  1. package/README.md +2 -2
  2. package/assets/agents/gentle-ai-explore.md +3 -6
  3. package/assets/agents/gentle-ai-verify.md +2 -2
  4. package/assets/agents/gentle-ai-worker.md +9 -9
  5. package/assets/agents/jd-fix-agent.md +2 -2
  6. package/assets/agents/jd-judge-a.md +0 -1
  7. package/assets/agents/jd-judge-b.md +0 -1
  8. package/assets/migrations/agent-body-history.json +9 -0
  9. package/assets/orchestrator-delegation.md +1 -1
  10. package/assets/orchestrator-full-delegation.md +1 -1
  11. package/assets/orchestrator-maintenance.md +11 -0
  12. package/assets/orchestrator-quota-recovery.md +1 -1
  13. package/assets/orchestrator-skills.md +10 -0
  14. package/assets/orchestrator-tracking.md +2 -2
  15. package/assets/orchestrator-verification.md +10 -8
  16. package/assets/orchestrator.md +2 -2
  17. package/bin/gentle-shell.mjs +69 -17
  18. package/contracts/review-provider-contract-mirror/provider-contract.lock.json +11 -10
  19. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/manifest.json +5 -5
  20. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/orchestration/pi.md +5 -3
  21. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/routing/pi.md +2 -2
  22. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/lens.schema.json +3 -3
  23. package/contracts/review-provider-contract-mirror/v1.7.0/bundle/vectors/lens.json +1 -0
  24. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-capabilities.baseline.json +3 -3
  25. package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-roles.baseline.json +3 -3
  26. package/docs/bundled-install.md +2 -2
  27. package/docs/delegated-verification.md +10 -6
  28. package/docs/desktop-feed.md +15 -6
  29. package/docs/desktop-rpc.md +298 -30
  30. package/docs/gentle-shell-desktop.md +10 -3
  31. package/docs/gentle-shell.md +25 -19
  32. package/docs/install-wizard.md +7 -5
  33. package/docs/native-authority-architecture.md +3 -3
  34. package/docs/odd-preparation-continuity.md +2 -2
  35. package/docs/permission-modes.md +10 -2
  36. package/docs/readme-reference.md +53 -24
  37. package/docs/review-coordinator.md +4 -2
  38. package/docs/session-profile-format.md +33 -7
  39. package/docs/sound-notifications.md +1 -1
  40. package/docs/work-continuity.md +7 -7
  41. package/docs/yolo-mode.md +1 -1
  42. package/extensions/ask-user-choice.ts +2 -2
  43. package/extensions/ask-user-question.ts +1 -1
  44. package/extensions/child-context.ts +2 -11
  45. package/extensions/gentle-agents.ts +86 -30
  46. package/extensions/gentle-ai.ts +918 -632
  47. package/extensions/gentle-desktop-feed.ts +13 -3
  48. package/extensions/gentle-desktop-rpc.ts +51 -2
  49. package/extensions/gentle-fast.ts +9 -2
  50. package/extensions/gentle-music.ts +2 -0
  51. package/extensions/gentle-notifications.ts +12 -4
  52. package/extensions/gentle-shell.ts +157 -62
  53. package/extensions/gentle-star-prompt.ts +3 -0
  54. package/extensions/gentle-tps.ts +7 -0
  55. package/extensions/history/index.ts +1 -1
  56. package/extensions/quiet-tools.ts +13 -22
  57. package/extensions/skill-registry.ts +9 -1
  58. package/extensions/startup-banner.ts +8 -13
  59. package/herdr/mods/gentle-agents/snapshot.js +30 -23
  60. package/herdr/mods/gentle-chat/feed.js +6 -0
  61. package/herdr/mods/gentle-chat/main.js +76 -16
  62. package/herdr/mods/gentle-chat/session.js +13 -5
  63. package/herdr/mods/gentle-chat/snapshot.js +30 -23
  64. package/herdr/mods/gentle-chat/ui.js +7 -1
  65. package/herdr/mods/gentle-inspector/main.js +2 -0
  66. package/herdr/mods/gentle-inspector/snapshot.js +30 -23
  67. package/herdr/mods/gentle-palette/main.js +1 -1
  68. package/herdr/mods/gentle-palette/snapshot.js +30 -23
  69. package/herdr/mods/gentle-pane/snapshot.js +30 -23
  70. package/herdr/mods/gentle-sidebar/snapshot.js +30 -23
  71. package/herdr/mods/gentle-spaces/snapshot.js +30 -23
  72. package/herdr/mods/gentle-status/snapshot.js +30 -23
  73. package/herdr/mods/gentle-tabs/main.js +3 -2
  74. package/herdr/mods/gentle-tabs/new-tab.js +9 -0
  75. package/herdr/mods/gentle-tabs/snapshot.js +30 -23
  76. package/herdr/mods/gentle-tokens/snapshot.js +30 -23
  77. package/lib/agent-profiles.ts +50 -10
  78. package/lib/agents-config.ts +69 -5
  79. package/lib/agents-runner.ts +34 -1
  80. package/lib/auto-permission-runtime.ts +2 -1
  81. package/lib/background-jobs-tools.ts +24 -16
  82. package/lib/banner-config.ts +69 -0
  83. package/lib/child-session.ts +6 -0
  84. package/lib/claude-bridge-config.ts +41 -0
  85. package/lib/codex-turn-continuation.ts +40 -0
  86. package/lib/compaction-threshold.ts +46 -0
  87. package/lib/context-threshold.ts +5 -5
  88. package/lib/desktop-agent-definitions-service.ts +93 -0
  89. package/lib/desktop-auth-service.ts +102 -0
  90. package/lib/desktop-background-subagents-service.ts +155 -0
  91. package/lib/desktop-command-rpc.ts +71 -0
  92. package/lib/desktop-feed-sources.ts +44 -1
  93. package/lib/desktop-feed.ts +41 -29
  94. package/lib/desktop-rpc-agent-definitions.ts +119 -0
  95. package/lib/desktop-rpc-agents.ts +44 -3
  96. package/lib/desktop-rpc-auth.ts +103 -0
  97. package/lib/desktop-rpc-background-subagents.ts +126 -0
  98. package/lib/desktop-rpc-changes.ts +13 -4
  99. package/lib/desktop-rpc-config.ts +287 -13
  100. package/lib/desktop-rpc-profile-binding.ts +212 -0
  101. package/lib/desktop-rpc-profiles.ts +2 -0
  102. package/lib/desktop-rpc-stats.ts +16 -4
  103. package/lib/desktop-rpc-status.ts +103 -0
  104. package/lib/desktop-status-service.ts +86 -0
  105. package/lib/destructive-command-guard.ts +9 -185
  106. package/lib/exploration-budget.ts +3 -7
  107. package/lib/gentle-design.ts +23 -4
  108. package/lib/gentle-shell-desktop.ts +85 -0
  109. package/lib/gentle-shell-launcher.ts +120 -8
  110. package/lib/mcp-config.ts +214 -0
  111. package/lib/native-choice-list.ts +1 -1
  112. package/lib/native-fullscreen-interaction.ts +3 -0
  113. package/lib/native-pointer-region.ts +1 -1
  114. package/lib/native-review-cli.ts +213 -397
  115. package/lib/odd-phase-inference.ts +1 -1
  116. package/lib/orchestrator-mode-policy.ts +25 -12
  117. package/lib/path-consent-fence.ts +113 -0
  118. package/lib/persona-config.ts +77 -0
  119. package/lib/pi-settings.ts +157 -0
  120. package/lib/questionnaire/questionnaire-view.ts +1 -1
  121. package/lib/review-continuation-registry.ts +9 -26
  122. package/lib/review-coordinator.ts +13 -2
  123. package/lib/review-host-relay.ts +2 -35
  124. package/lib/review-integration-v2.ts +129 -180
  125. package/lib/review-object-store.ts +0 -57
  126. package/lib/review-repository.ts +0 -44
  127. package/lib/review-risk-assessment.ts +11 -36
  128. package/lib/review-start-context.ts +2 -1
  129. package/lib/review-transaction.ts +6 -6
  130. package/lib/sensitive-paths.ts +45 -0
  131. package/lib/session-profile-binding.ts +29 -0
  132. package/lib/session-profile-freeze.ts +11 -4
  133. package/lib/session-worktree-registry.ts +11 -5
  134. package/lib/shell-bar.ts +41 -18
  135. package/lib/shell-card.ts +27 -1
  136. package/lib/shell-changes-view.ts +6 -2
  137. package/lib/shell-changes.ts +94 -37
  138. package/lib/shell-git-worker.ts +158 -0
  139. package/lib/shell-idle-changes.ts +88 -0
  140. package/lib/shell-untracked-cache.ts +142 -0
  141. package/lib/shell-untracked-lines.ts +178 -0
  142. package/lib/stats-collector.ts +24 -0
  143. package/lib/tower-open.ts +8 -1
  144. package/lib/tps-policy.ts +85 -0
  145. package/lib/vim-editor-adapter.ts +9 -2
  146. package/lib/voice-artifacts.ts +8 -1
  147. package/lib/voice-install.ts +7 -3
  148. package/lib/yolo-session-policy.ts +2 -2
  149. package/package.json +1 -1
  150. package/runtime/gentle-shell-desktop.mjs +85 -0
  151. package/runtime/gentle-shell-launcher.mjs +120 -8
  152. package/runtime/native-review-cli.mjs +206 -390
  153. package/runtime/review-integration-v2.mjs +129 -180
  154. package/runtime/review-risk-assessment.mjs +11 -36
  155. package/runtime/sensitive-paths.mjs +46 -0
  156. package/runtime/tower-open.mjs +8 -1
  157. package/scripts/build-runtime-modules.mjs +2 -0
  158. package/scripts/gentle-ai-installer.mjs +13 -14
  159. package/scripts/installer-preflight.mjs +1 -1
  160. package/scripts/main-channel.mjs +47 -11
  161. package/scripts/pi-update.mjs +10 -4
  162. package/scripts/prepare-verifier.mjs +14 -4
  163. package/scripts/verify-package-files.mjs +45 -13
  164. package/skills/judgment-day/SKILL.md +1 -1
  165. package/skills/judgment-day/references/prompts-and-formats.md +1 -1
  166. package/skills/provider-defect-report/SKILL.md +1 -1
  167. package/skills/rdd-defect-workflow/SKILL.md +2 -2
  168. package/skills/skill-creator/SKILL.md +4 -4
  169. package/skills/skill-improver/SKILL.md +4 -4
  170. package/skills/skill-registry/SKILL.md +2 -2
  171. package/tests/agent-profiles-workflow.test.ts +102 -0
  172. package/tests/agent-risk-escalation.test.ts +15 -0
  173. package/tests/agents-config.test.ts +22 -2
  174. package/tests/agents-protocol.test.ts +1 -1
  175. package/tests/agents-runner.test.ts +94 -2
  176. package/tests/append-system-prompt-route.test.ts +16 -11
  177. package/tests/ask-user-choice.test.ts +19 -0
  178. package/tests/ask-user-question.test.ts +23 -4
  179. package/tests/auto-permission-runtime.test.ts +4 -4
  180. package/tests/bounded-stop-contract.test.ts +50 -62
  181. package/tests/built-web-guard.test.ts +32 -0
  182. package/tests/child-context-files.test.ts +6 -6
  183. package/tests/child-ui-extensions.test.ts +125 -0
  184. package/tests/child-web-package.test.ts +1 -1
  185. package/tests/codex-turn-continuation.test.ts +183 -0
  186. package/tests/committed-range-untracked-exclusion.test.ts +18 -0
  187. package/tests/controlled-engineering-editor.test.ts +192 -0
  188. package/tests/controlled-engineering-launch.test.ts +136 -0
  189. package/tests/controlled-engineering.test.ts +244 -0
  190. package/tests/delegate-for-reason-contract.test.ts +1 -1
  191. package/tests/delivery-b-rendered-surfaces.test.ts +1 -1
  192. package/tests/delivery-conflict-markers.test.ts +2 -3
  193. package/tests/desktop-feed-tool-summaries.test.ts +1 -1
  194. package/tests/desktop-feed-transcript.test.ts +17 -0
  195. package/tests/desktop-feed.test.ts +141 -7
  196. package/tests/desktop-liveness.test.ts +125 -0
  197. package/tests/desktop-persona.test.ts +17 -0
  198. package/tests/desktop-rpc-agent-definitions.test.ts +219 -0
  199. package/tests/desktop-rpc-agents.test.ts +113 -3
  200. package/tests/desktop-rpc-auth.test.ts +278 -0
  201. package/tests/desktop-rpc-background-subagents.test.ts +186 -0
  202. package/tests/desktop-rpc-changes.test.ts +81 -4
  203. package/tests/desktop-rpc-config-mcp-fidelity.test.ts +106 -0
  204. package/tests/desktop-rpc-config-readonly-stores.test.ts +458 -0
  205. package/tests/desktop-rpc-config-settings.test.ts +234 -0
  206. package/tests/desktop-rpc-config.test.ts +17 -3
  207. package/tests/desktop-rpc-design.test.ts +30 -1
  208. package/tests/desktop-rpc-jobs.test.ts +9 -1
  209. package/tests/desktop-rpc-permissions.test.ts +9 -1
  210. package/tests/desktop-rpc-profile-binding.test.ts +195 -0
  211. package/tests/desktop-rpc-review.test.ts +1 -1
  212. package/tests/desktop-rpc-session-snapshot-commands.test.ts +50 -0
  213. package/tests/desktop-rpc-session.test.ts +2 -2
  214. package/tests/desktop-rpc-stats.test.ts +42 -11
  215. package/tests/desktop-rpc-status.test.ts +195 -0
  216. package/tests/desktop-rpc-updates.test.ts +1 -1
  217. package/tests/desktop-rpc-usage.test.ts +9 -1
  218. package/tests/desktop-rpc.test.ts +2 -2
  219. package/tests/desktop-session-switch.test.ts +237 -0
  220. package/tests/desktop-target-session.test.ts +104 -0
  221. package/tests/destructive-command-guard.test.ts +187 -0
  222. package/tests/devbinary/pi-host-relay.devtest.ts +73 -9
  223. package/tests/exploration-budget.test.ts +2 -26
  224. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +15 -11
  225. package/tests/full-delegation-closure.test.ts +19 -9
  226. package/tests/generic-agent-tools.test.ts +3 -3
  227. package/tests/gentle-agents.test.ts +215 -10
  228. package/tests/gentle-ai-binary.test.ts +3 -3
  229. package/tests/gentle-ai-exploration-budget.test.ts +3 -2
  230. package/tests/gentle-ai-installer.test.ts +60 -59
  231. package/tests/gentle-ai.test.ts +30 -59
  232. package/tests/gentle-chat-read-failure.test.ts +74 -0
  233. package/tests/gentle-chat-session-read.test.ts +127 -0
  234. package/tests/gentle-design.test.ts +39 -0
  235. package/tests/gentle-notifications.test.ts +43 -5
  236. package/tests/gentle-shell-desktop.test.ts +108 -0
  237. package/tests/gentle-shell-launcher-auto-provision.test.ts +152 -0
  238. package/tests/gentle-shell-launcher-machine-output.test.ts +356 -0
  239. package/tests/gentle-shell-launcher-tower.test.ts +7 -1
  240. package/tests/gentle-shell.test.ts +163 -15
  241. package/tests/gentle-tps.test.ts +57 -0
  242. package/tests/independent-recovery-delivery.test.ts +15 -13
  243. package/tests/installer-preflight.test.ts +3 -2
  244. package/tests/installer-server.test.ts +3 -2
  245. package/tests/installer-windows-bootstrap.test.ts +6 -0
  246. package/tests/job-turn-end-texts.test.ts +57 -0
  247. package/tests/judgment-day-dispatch-diagnostics.test.ts +87 -0
  248. package/tests/lazy-module-contradictions-contract.test.ts +2 -3
  249. package/tests/main-channel-upgrade.test.ts +14 -7
  250. package/tests/main-channel.test.ts +78 -23
  251. package/tests/maintainer/desktop-rpc.maintest.ts +4 -4
  252. package/tests/native-fullscreen-interaction.test.ts +37 -1
  253. package/tests/native-review-capability-contract.test.ts +13 -1
  254. package/tests/native-review-cli-nonblocking-findings.test.ts +9 -84
  255. package/tests/native-review-cli.test.ts +199 -21
  256. package/tests/native-review-consent.test.ts +20 -3
  257. package/tests/native-review-start-escalation-real-binary.test.ts +42 -0
  258. package/tests/no-self-pause-contract.test.ts +8 -7
  259. package/tests/odd-phase-inference.test.ts +2 -2
  260. package/tests/odd-routing-canonical-ratchet.test.ts +1 -1
  261. package/tests/odd-routing-contract.test.ts +2 -2
  262. package/tests/orchestrator-budget.test.ts +7 -2
  263. package/tests/orchestrator-prompt-diet-contract.test.ts +5 -5
  264. package/tests/orchestrator-skills-inline-contract.test.ts +26 -0
  265. package/tests/package-manifest.test.ts +11 -16
  266. package/tests/packaged-agent-codemode.test.ts +79 -0
  267. package/tests/path-consent-fence.test.ts +326 -0
  268. package/tests/persona-config.test.ts +42 -0
  269. package/tests/pi-update-launcher.test.ts +1 -1
  270. package/tests/pi-update-source.test.ts +48 -2
  271. package/tests/primary-session-prompt.test.ts +9 -7
  272. package/tests/profile-fast-tier.test.ts +79 -4
  273. package/tests/progress-rule-contract.test.ts +54 -0
  274. package/tests/rdd-delivery-warning.test.ts +109 -0
  275. package/tests/review-actor-tool-deny.test.ts +1 -2
  276. package/tests/review-agent-end-preflight.test.ts +3 -1
  277. package/tests/review-assess-escalation-forwarding.test.ts +99 -0
  278. package/tests/review-authority-recovery-docs.test.ts +9 -12
  279. package/tests/review-continuation-registry.test.ts +24 -25
  280. package/tests/review-controller-native-recovery.test.ts +165 -178
  281. package/tests/review-controller-native-routing.test.ts +352 -27
  282. package/tests/review-coordinator-correction-gate.test.ts +5 -9
  283. package/tests/review-coordinator-runtime.test.ts +3 -2
  284. package/tests/review-coordinator.test.ts +14 -0
  285. package/tests/review-due-compaction.test.ts +1 -1
  286. package/tests/review-failure-facts.test.ts +2 -2
  287. package/tests/review-host-relay-restart-parity.test.ts +2 -52
  288. package/tests/review-host-relay-routing.test.ts +59 -298
  289. package/tests/review-host-relay.test.ts +0 -46
  290. package/tests/review-integration-nonblocking-findings.test.ts +3 -6
  291. package/tests/review-integration-v2-forward.test.ts +114 -234
  292. package/tests/review-integration-v2.test.ts +85 -39
  293. package/tests/review-json-arguments.test.ts +30 -9
  294. package/tests/review-legacy-check.test.ts +38 -0
  295. package/tests/review-object-store.test.ts +2 -57
  296. package/tests/review-one-call-findings.test.ts +1 -0
  297. package/tests/review-one-call.test.ts +56 -0
  298. package/tests/review-risk-assessment.test.ts +14 -43
  299. package/tests/review-run-escalate-forwarding.test.ts +59 -0
  300. package/tests/review-sidebar-state.test.ts +2 -1
  301. package/tests/review-untracked-inventory-replay.test.ts +181 -0
  302. package/tests/runtime-harness.mjs +30 -4
  303. package/tests/sensitive-path-tools.test.ts +210 -5
  304. package/tests/session-profile-binding-observers.test.ts +47 -0
  305. package/tests/session-profile-extension.test.ts +109 -11
  306. package/tests/session-profile-freeze.test.ts +49 -2
  307. package/tests/session-profile-v1-compat.test.ts +11 -3
  308. package/tests/session-worktree-registry.test.ts +23 -0
  309. package/tests/shell-bar.test.ts +21 -3
  310. package/tests/shell-changes-idle-start.test.ts +510 -0
  311. package/tests/shell-changes-untracked-bound.test.ts +230 -0
  312. package/tests/shell-changes-view.test.ts +8 -2
  313. package/tests/shell-changes.test.ts +134 -0
  314. package/tests/shell-git-runner-stall.test.ts +74 -0
  315. package/tests/shell-git-worker-fallback.test.ts +140 -0
  316. package/tests/shell-git-worker-lifetime.test.ts +91 -0
  317. package/tests/shell-render-cache-runtime.test.ts +256 -3
  318. package/tests/shell-sidebar-layout.test.ts +1 -1
  319. package/tests/shell-sidebar-scroll-benchmark.test.ts +14 -5
  320. package/tests/shell-untracked-cache.test.ts +213 -0
  321. package/tests/short-check-routing-contract.test.ts +11 -7
  322. package/tests/skill-references.test.ts +39 -0
  323. package/tests/skill-registry.test.ts +4 -4
  324. package/tests/startup-banner.test.ts +2 -1
  325. package/tests/status-timing-diagnostics.test.ts +2 -1
  326. package/tests/support/capabilities-v26.ts +22 -0
  327. package/tests/support/chat-ui.ts +39 -0
  328. package/tests/support/review-coordinator-runtime.ts +11 -2
  329. package/tests/support/status-v9.ts +8 -0
  330. package/tests/t7-recovery-preservation.test.ts +68 -0
  331. package/tests/tower-open.test.ts +24 -0
  332. package/tests/tower-pack.test.ts +48 -0
  333. package/tests/tps-policy.test.ts +96 -0
  334. package/tests/turn-end-rule-contract.test.ts +155 -0
  335. package/tests/turn-end-scope.test.ts +39 -0
  336. package/tests/verification-proportionality.test.ts +1 -1
  337. package/tests/verification-scoped-stop-contract.test.ts +1 -1
  338. package/tests/verification-tiers-contract.test.ts +4 -3
  339. package/tests/verifier-admission.test.ts +1 -1
  340. package/tests/verifier-preparation.test.ts +94 -1
  341. package/tests/verifier-settle-reminder.test.ts +1 -1
  342. package/tests/verify-first-launch-contract.test.ts +19 -7
  343. package/tests/vim-editor-adapter.test.ts +12 -2
  344. package/tests/voice-install.test.ts +97 -11
  345. package/tests/windows-hidden-processes.test.ts +11 -44
  346. package/tests/work-continuity-contract.test.ts +48 -55
  347. package/tests/yolo-session-policy.test.ts +2 -0
  348. package/web/tower/dist/assets/BatchableSprite-BJ_TQxjN.js +217 -0
  349. package/web/tower/dist/assets/BufferResource-DeJpHuO6.js +139 -0
  350. package/web/tower/dist/assets/CanvasPool-cwc03T_x.js +23 -0
  351. package/web/tower/dist/assets/CanvasRenderer-DO84oP5R.js +1 -0
  352. package/web/tower/dist/assets/Filter-BKhT9lO8.js +1 -0
  353. package/web/tower/dist/assets/GlUniformGroupSystem-DluI7cqd.js +130 -0
  354. package/web/tower/dist/assets/GpuUboSystem-CM4Dys0F.js +17 -0
  355. package/web/tower/dist/assets/Graphics-3OyUtCzC.js +1 -0
  356. package/web/tower/dist/assets/RenderTargetSystem-X-9GAQ1C.js +184 -0
  357. package/web/tower/dist/assets/WebGLRenderer-I0fqIX1w.js +20 -0
  358. package/web/tower/dist/assets/WebGPURenderer-BRWSXotK.js +79 -0
  359. package/web/tower/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
  360. package/web/tower/dist/assets/abnfDiagram-VCTEODGH-C4iBBhTL.js +1 -0
  361. package/web/tower/dist/assets/architectureDiagram-5GKGNRK7-Ih-qvfTu.js +36 -0
  362. package/web/tower/dist/assets/blockDiagram-I7D4REHJ-I9z_u3wb.js +129 -0
  363. package/web/tower/dist/assets/browserAll-gmBFNIA4.js +14 -0
  364. package/web/tower/dist/assets/c4Diagram-7LVT6UL2-DOyk2rEJ.js +38 -0
  365. package/web/tower/dist/assets/canvasUtils-DTaMcbkN.js +1 -0
  366. package/web/tower/dist/assets/channel-wuxBkGGz.js +1 -0
  367. package/web/tower/dist/assets/chunk-2Q5K7J3B-BaJ-OrJ_.js +1 -0
  368. package/web/tower/dist/assets/chunk-5VM5RSS4-wICrhvyw.js +15 -0
  369. package/web/tower/dist/assets/chunk-F27PBJKO-DUQ_JqvZ.js +1 -0
  370. package/web/tower/dist/assets/chunk-IMKFNOWR-DKfgQrGM.js +231 -0
  371. package/web/tower/dist/assets/chunk-JWPE2WC7-1k1LW87d.js +1 -0
  372. package/web/tower/dist/assets/chunk-POPQ4Y6H-Df8cN2w9.js +1 -0
  373. package/web/tower/dist/assets/chunk-SVP7TREG-CxU5LDj8.js +88 -0
  374. package/web/tower/dist/assets/chunk-TICWLB2K-CEuHEBi0.js +206 -0
  375. package/web/tower/dist/assets/chunk-XXDRQBXY-CbSAjj9l.js +1 -0
  376. package/web/tower/dist/assets/classDiagram-ZZMXUADV-DbRmVQRX.js +1 -0
  377. package/web/tower/dist/assets/classDiagram-v2-VYDZK3BY-DbRmVQRX.js +1 -0
  378. package/web/tower/dist/assets/cose-bilkent-JH36ORCC-8xZLSHER.js +1 -0
  379. package/web/tower/dist/assets/cynefin-OW5HDTMX-Cw4XG9Zj.js +166 -0
  380. package/web/tower/dist/assets/cynefinDiagram-5FMLGOSQ-CcQdokUv.js +62 -0
  381. package/web/tower/dist/assets/cytoscape.esm-BHa1VTXv.js +321 -0
  382. package/web/tower/dist/assets/d3-scale-4DPf7zan.js +1 -0
  383. package/web/tower/dist/assets/dagre-GXQ25YYZ-D-Xv7L9X.js +4 -0
  384. package/web/tower/dist/assets/diagram-S7CK7UJ4-Bqy2eT2c.js +30 -0
  385. package/web/tower/dist/assets/diagram-UQ7AKVKN-B2wK2GHj.js +41 -0
  386. package/web/tower/dist/assets/diagram-VSXAHHWV-CIZqh7BH.js +3 -0
  387. package/web/tower/dist/assets/diagram-VX7I27RA-BGX4HBj2.js +24 -0
  388. package/web/tower/dist/assets/diagram-Z3DM3KII-DYpsfaJW.js +24 -0
  389. package/web/tower/dist/assets/ebnfDiagram-PWID7BFC-BNnwCZNv.js +1 -0
  390. package/web/tower/dist/assets/erDiagram-RLTQ6QDP-_MN9W-1E.js +99 -0
  391. package/web/tower/dist/assets/flowDiagram-HODETNUW-D_ndx1UC.js +168 -0
  392. package/web/tower/dist/assets/ganttDiagram-EL5Y4UJY-C8chdEiZ.js +292 -0
  393. package/web/tower/dist/assets/getPo2TextureFromSource-CqJsdi0J.js +1 -0
  394. package/web/tower/dist/assets/getTexelRangeRects-DN3N5aFp.js +57 -0
  395. package/web/tower/dist/assets/getTextureBatchBindGroup-RNSiAVH3.js +1 -0
  396. package/web/tower/dist/assets/gitGraphDiagram-WWUBYQGX-B5ijv7LI.js +106 -0
  397. package/web/tower/dist/assets/index-B1Ho-Igs.css +1 -0
  398. package/web/tower/dist/assets/index-CfNjH1Wr.js +45 -0
  399. package/web/tower/dist/assets/infoDiagram-27XIBGKW-AYbp5ElT.js +2 -0
  400. package/web/tower/dist/assets/ishikawaDiagram-5VMMS53U-DnmwARuR.js +70 -0
  401. package/web/tower/dist/assets/journeyDiagram-3NMN7TZE-CK737kko.js +139 -0
  402. package/web/tower/dist/assets/kanban-definition-UXKFOSKX-0AhM3axC.js +89 -0
  403. package/web/tower/dist/assets/katex-HP8lGamR.js +257 -0
  404. package/web/tower/dist/assets/layout-wOIeK9c_.js +1 -0
  405. package/web/tower/dist/assets/mermaid.core-CGYyw6G7.js +310 -0
  406. package/web/tower/dist/assets/mindmap-definition-YA3MSWOX-CkZ_JOdx.js +96 -0
  407. package/web/tower/dist/assets/pegDiagram-XKGWAZYB-CHAPspih.js +1 -0
  408. package/web/tower/dist/assets/pieDiagram-E7YTZNPT-LwCcZl5o.js +39 -0
  409. package/web/tower/dist/assets/preload-helper-PPVm8Dsz.js +1 -0
  410. package/web/tower/dist/assets/quadrantDiagram-AXDQQJYC-Cm4uijV2.js +7 -0
  411. package/web/tower/dist/assets/railroadDiagram-O6MQD6OU-BPQHZ2b5.js +1 -0
  412. package/web/tower/dist/assets/requirementDiagram-BXWQKSXE-JLtSUDfS.js +84 -0
  413. package/web/tower/dist/assets/sankeyDiagram-P5KCCOFB-DJsYv9ii.js +40 -0
  414. package/web/tower/dist/assets/sequenceDiagram-WJ2MYXX4-Ca8T8sT0.js +162 -0
  415. package/web/tower/dist/assets/sizeCapture-INFHLROL-Ch4i2dS-.js +1 -0
  416. package/web/tower/dist/assets/stateDiagram-D77RDMKH-DDSkncYm.js +1 -0
  417. package/web/tower/dist/assets/stateDiagram-v2-MP3YSRHH-BkO_9mIH.js +1 -0
  418. package/web/tower/dist/assets/swimlanes-42K2YHIH-Bns5iI3y.js +1 -0
  419. package/web/tower/dist/assets/swimlanesDiagram-VR7AAH4N--LEBb1ti.js +8 -0
  420. package/web/tower/dist/assets/timeline-definition-24CTP7MA-QJDuVTb3.js +120 -0
  421. package/web/tower/dist/assets/vennDiagram-4TSXK5OY-pBNxKxOV.js +34 -0
  422. package/web/tower/dist/assets/wardleyDiagram-VM6X3IG4-1PEarjN1.js +78 -0
  423. package/web/tower/dist/assets/webworkerAll-D_Np003p.js +83 -0
  424. package/web/tower/dist/assets/xychartDiagram-S5SC5T6Z-CLwsvOg7.js +7 -0
  425. package/web/tower/dist/index.html +41 -0
  426. package/contracts/review-provider-contract-mirror/v1.6.0/bundle/vectors/lens.json +0 -1
  427. package/docs/review-delivery-preflight.md +0 -22
  428. package/extensions/codegraph-tools.ts +0 -437
  429. package/lib/native-review-authority-quarantine.ts +0 -2
  430. package/lib/review-delivery-preflight.ts +0 -85
  431. package/lib/review-legacy-detector.ts +0 -81
  432. package/tests/child-codegraph-bootstrap.test.ts +0 -74
  433. package/tests/codegraph-tools.test.ts +0 -554
  434. package/tests/fixtures/devbinary/capabilities-v2.1.derived.json +0 -331
  435. package/tests/fixtures/refusal-identity.probe.mjs +0 -139
  436. package/tests/native-review-authority-quarantine.test.ts +0 -10
  437. package/tests/native-review-refusal-identity.test.ts +0 -25
  438. package/tests/review-delivery-preflight.test.ts +0 -462
  439. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/README.md +0 -0
  440. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/refuter.schema.json +0 -0
  441. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/targeted-validator.schema.json +0 -0
  442. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/refuter.json +0 -0
  443. /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/targeted-validator.json +0 -0
@@ -61,7 +61,7 @@ const V014_MANAGED_ASSETS = join(
61
61
  // gentle-ai-explore.md as their exemplar (packaged, absent from the v0.13
62
62
  // manifest) after review-refuter.md was retired together with every
63
63
  // Pi-authored adversarial review verdict.
64
- const MANAGED_EXEMPLAR_TOOLS = ["read", "grep", "find", "codegraph", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content", "mcp__codegraph__codegraph_explore"];
64
+ const MANAGED_EXEMPLAR_TOOLS = ["read", "grep", "find", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content", "codemode"];
65
65
  const RETIRED_ADVERSARIAL_AGENTS = ["review-refuter.md", "review-validator.md"];
66
66
 
67
67
  interface ManagedAssetsManifest {
@@ -431,14 +431,14 @@ test("package manifest installs pi-pretty through a wrapper without bundling nat
431
431
  );
432
432
  });
433
433
 
434
- test("package verification binds the published Gentle AI v4.6.0 runtime pin", () => {
434
+ test("package verification binds the published Gentle AI v5.1.0 runtime pin", () => {
435
435
  const installer = readFileSync(join(PACKAGE_ROOT, "scripts", "gentle-ai-installer.mjs"), "utf8");
436
436
  const binary = readFileSync(join(PACKAGE_ROOT, "lib", "gentle-ai-binary.ts"), "utf8");
437
437
  const verifier = readFileSync(join(PACKAGE_ROOT, "scripts", "verify-package-files.mjs"), "utf8");
438
438
 
439
- assert.match(installer, /INSTALLER_VERSION = "4\.6\.0"/);
439
+ assert.match(installer, /INSTALLER_VERSION = "5\.1\.0"/);
440
440
  assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_PACKAGE.*GENTLE_AI_WINDOWS_SOURCE_MODULE/);
441
- assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:FXR0FEGvnov6eCf\/FR7Ey8PfxxdhbDHq1\/WnkjpA1AQ="/);
441
+ assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:SrWjhJn\+hvtGM\+N7O3k5JM3x\+MPxOVDsH4B5QODlYjQ="/);
442
442
  assert.match(installer, /GOTOOLCHAIN: "local"/);
443
443
  assert.match(installer, /GOSUMDB: "sum\.golang\.org"/);
444
444
  assert.match(binary, /GENTLE_AI_VERSION = INSTALLER_VERSION/);
@@ -1583,8 +1583,8 @@ test("gentle-ai-worker packages the exact scoped writer contract", () => {
1583
1583
  "edit",
1584
1584
  "write",
1585
1585
  "bash",
1586
+ "codemode",
1586
1587
  "mem_save",
1587
- "mcp__codegraph__codegraph_explore",
1588
1588
  ]);
1589
1589
  assert.ok(
1590
1590
  tools.every((tool) => !tool.startsWith("subagent_")),
@@ -1703,8 +1703,8 @@ test("package installation gives gentle-ai-worker a loader-compatible scoped ide
1703
1703
  "edit",
1704
1704
  "write",
1705
1705
  "bash",
1706
+ "codemode",
1706
1707
  "mem_save",
1707
- "mcp__codegraph__codegraph_explore",
1708
1708
  ]);
1709
1709
  assert.doesNotMatch(
1710
1710
  readAgentFrontmatter(installedAgentPath),
@@ -1828,8 +1828,8 @@ test("global model routing uses PI_CODING_AGENT_DIR for package-installed agents
1828
1828
  test("normal and forced installation copy generic agents with complete role contracts", () => {
1829
1829
  const previousAgentHome = process.env.GENTLE_PI_AGENT_HOME;
1830
1830
  const expectedTools = {
1831
- "gentle-ai-explore": ["read", "grep", "find", "codegraph", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content", "mcp__codegraph__codegraph_explore"],
1832
- "gentle-ai-verify": ["read", "grep", "find", "bash", "mcp__codegraph__codegraph_explore"],
1831
+ "gentle-ai-explore": ["read", "grep", "find", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content", "codemode"],
1832
+ "gentle-ai-verify": ["read", "grep", "find", "bash", "codemode"],
1833
1833
  } as const;
1834
1834
 
1835
1835
  try {
@@ -1849,12 +1849,7 @@ test("normal and forced installation copy generic agents with complete role cont
1849
1849
  assert.match(source, /generic ODD work/);
1850
1850
  assert.match(source, /Do not (?:fix findings, delegate to child agents|delegate to child agents, commit)/);
1851
1851
  if (name === "gentle-ai-explore") {
1852
- assert.match(source, /cwd-scoped `codegraph` tool/);
1853
- assert.match(source, /never ask it to target another path/);
1854
- assert.match(source, /sole permitted mutation/);
1855
- assert.match(source, /all tracked files, source files, and other project content remain read-only/);
1856
- assert.match(source, /CodeGraph reports that it is unavailable or fails/);
1857
- assert.match(source, /Do not use that fallback before CodeGraph is unavailable or fails/);
1852
+ assert.match(source, /Read and search only\. Do not edit, write, run commands, or mutate project state\./);
1858
1853
  }
1859
1854
  assert.match(source, /Do not (?:edit, write|edit, write, or fix findings)/);
1860
1855
  // Cost/speed S4: reports are compact and never restate the task.
@@ -1949,9 +1944,9 @@ test("pi-pretty wrapper uses cached ESM loading for compiled and pnpm symlink in
1949
1944
  assert.match(wrapper, /quietToolsEnabled/);
1950
1945
  });
1951
1946
 
1952
- test("Gentle Shell v4.9.0 package manifest declares the release version", () => {
1947
+ test("Gentle Shell v5.1.0 package manifest declares the release version", () => {
1953
1948
  const packageJson = readPackageJson();
1954
- assert.equal(packageJson.version, "4.9.0", "the release manifest must be explicitly pinned to v4.9.0");
1949
+ assert.equal(packageJson.version, "5.1.0", "the release manifest must be explicitly pinned to v5.1.0");
1955
1950
  assert.equal(packageJson.scripts?.test, "node scripts/run-test-suite.mjs");
1956
1951
  assert.ok(packageJson.files?.includes("assets/"));
1957
1952
  assert.ok(packageJson.files?.includes("contracts/"));
@@ -0,0 +1,79 @@
1
+ import assert from "node:assert/strict";
2
+ import { readdirSync, readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import test from "node:test";
5
+
6
+ // `codemode` is the only route that lets a child batch independent tool calls in
7
+ // one model turn and filter their output before it reaches its context, so every
8
+ // packaged agent that discovers, verifies, or implements declares it. The
9
+ // read-only review actors keep their narrow, deny-all allowlist: a script there
10
+ // would widen the sandbox of the lane whose job is to judge, not to act.
11
+ const ROOT = join(import.meta.dirname, "..");
12
+ const AGENTS_DIR = join(ROOT, "assets", "agents");
13
+
14
+ /** Agents whose unit of work is discovery, verification, or implementation. */
15
+ const CODEMODE_AGENTS = [
16
+ "gentle-ai-explore.md",
17
+ "gentle-ai-verify.md",
18
+ "gentle-ai-worker.md",
19
+ "jd-fix-agent.md",
20
+ ] as const;
21
+
22
+ /** Adversarial read-only reviewers: they report findings and never act. */
23
+ const REVIEW_ACTOR_AGENTS = [
24
+ "jd-judge-a.md",
25
+ "jd-judge-b.md",
26
+ "review-risk.md",
27
+ "review-reliability.md",
28
+ "review-resilience.md",
29
+ "review-readability.md",
30
+ ] as const;
31
+
32
+ const CODEMODE_TOOL = "codemode";
33
+
34
+ function readDeclaredTools(file: string): string[] {
35
+ const text = readFileSync(join(AGENTS_DIR, file), "utf8");
36
+ const frontmatter = text.match(/^---\n([\s\S]*?)\n---/)?.[1];
37
+ assert.ok(frontmatter, `${file} must have YAML frontmatter`);
38
+ const lines = frontmatter.split("\n");
39
+ const toolsIndex = lines.findIndex((line) => line === "tools:");
40
+ assert.notEqual(toolsIndex, -1, `${file} must declare tools as a YAML list`);
41
+ const tools: string[] = [];
42
+ for (const line of lines.slice(toolsIndex + 1)) {
43
+ if (!line.startsWith(" - ")) break;
44
+ tools.push(line.slice(4).trim().replace(/^['"]|['"]$/g, ""));
45
+ }
46
+ return tools;
47
+ }
48
+
49
+ test("packaged discovery, verification, and implementation agents declare codemode", () => {
50
+ for (const file of CODEMODE_AGENTS) {
51
+ const tools = readDeclaredTools(file);
52
+ assert.ok(
53
+ tools.includes(CODEMODE_TOOL),
54
+ `${file} must declare ${CODEMODE_TOOL} so its child can batch tool calls in one turn`,
55
+ );
56
+ }
57
+ });
58
+
59
+ test("packaged read-only review actors keep a codemode-free allowlist", () => {
60
+ for (const file of REVIEW_ACTOR_AGENTS) {
61
+ const tools = readDeclaredTools(file);
62
+ assert.ok(
63
+ !tools.includes(CODEMODE_TOOL),
64
+ `${file} is a read-only review actor: ${CODEMODE_TOOL} must not widen its deny-all allowlist`,
65
+ );
66
+ }
67
+ });
68
+
69
+ test("every packaged agent is classified for codemode", () => {
70
+ const classified = new Set<string>([...CODEMODE_AGENTS, ...REVIEW_ACTOR_AGENTS]);
71
+ const packaged = readdirSync(AGENTS_DIR).filter((entry) => entry.endsWith(".md"));
72
+ assert.ok(packaged.length > 0, "gentle-pi must ship packaged agents");
73
+ for (const file of packaged) {
74
+ assert.ok(
75
+ classified.has(file),
76
+ `${file} is not classified for ${CODEMODE_TOOL}: add it to CODEMODE_AGENTS or REVIEW_ACTOR_AGENTS`,
77
+ );
78
+ }
79
+ });
@@ -0,0 +1,326 @@
1
+ import assert from "node:assert/strict";
2
+ import { execFileSync } from "node:child_process";
3
+ import { existsSync, mkdirSync, mkdtempSync, realpathSync, renameSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
4
+ import { tmpdir } from "node:os";
5
+ import { join, parse, relative } from "node:path";
6
+ import test from "node:test";
7
+ import { runToolCall, type RunToolCallOptions } from "@earendil-works/pi-agent-core";
8
+ import { SessionManager, type ExtensionAPI, type ExtensionContext, type ToolCallEventResult } from "@earendil-works/pi-coding-agent";
9
+ import { Type } from "typebox";
10
+ import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
11
+ import skillRegistry from "../extensions/skill-registry.ts";
12
+ import { isTempTarget } from "../lib/path-consent-fence.ts";
13
+ import type { PermissionMode } from "../lib/permission-mode-policy.ts";
14
+ import { SESSION_WORKTREE_ENTRY, SessionWorktreeRegistry, worktreeGitEnvironment } from "../lib/session-worktree-registry.ts";
15
+
16
+ const prompt = (tool: string, path: string) => ["Allow access outside the session worktree?", `${tool}: ${path} (approval covers only this target for the rest of the session)`];
17
+ const outside = join(parse(process.cwd()).root, "__gentle_path_consent_fixture__", "notes.md");
18
+ const declined = { block: true, reason: "Gentle AI safety policy blocked the path access because it was not confirmed." };
19
+ const headless = (path: string) => ({ block: true, reason: `Gentle AI safety policy requires interactive confirmation before accessing paths outside the session worktree: ${path}. Ask the user for an explicit safer plan.` });
20
+
21
+ function fixture(t: test.TestContext, options: { mode?: PermissionMode; hasUI?: boolean; approve?: boolean; confirm?: () => Promise<boolean>; skills?: boolean; classify?: () => "allow" | "deny" } = {}) {
22
+ const dir = realpathSync(mkdtempSync(join(tmpdir(), "path-consent-")));
23
+ t.after(() => rmSync(dir, { recursive: true, force: true }));
24
+ const repo = join(dir, "repo"), config = join(dir, "config");
25
+ // The exemption test names an existing directory outside the fixture as
26
+ // TMPDIR. The hook is probed without executing a write.
27
+ const temp = options.skills ? join(process.cwd(), "assets") : join(dir, "scratch");
28
+ for (const path of [repo, config]) mkdirSync(path);
29
+ if (options.skills) isolateFixedTempRoots(t, temp, realpathSync(process.cwd()), repo);
30
+ else mkdirSync(temp);
31
+ const gitConfig = join(dir, "git-config");
32
+ writeFileSync(gitConfig, "");
33
+ const git = (...args: string[]) => execFileSync("git", ["-C", repo, "-c", `core.hooksPath=${config}`, "-c", "commit.gpgsign=false", ...args], {
34
+ env: { ...worktreeGitEnvironment(), GIT_CONFIG_GLOBAL: gitConfig, GIT_CONFIG_NOSYSTEM: "1" }, stdio: "pipe",
35
+ });
36
+ git("init", "--quiet", `--template=${config}`);
37
+ writeFileSync(join(config, "permission-mode.json"), JSON.stringify({ schema: "gentle-pi.permission-mode/v1", mode: options.mode ?? "normal" }));
38
+ const manager = SessionManager.inMemory(repo);
39
+ const prompts: string[][] = [], permissionEvents: unknown[] = [];
40
+ const handlers = new Map<string, ((event: any, ctx: ExtensionContext) => unknown)[]>();
41
+ const pi = {
42
+ on(name: string, handler: (event: any, ctx: ExtensionContext) => unknown) { handlers.set(name, [...handlers.get(name) ?? [], handler]); },
43
+ events: { on() {}, emit(name: string, data: unknown) { if (name === "pi-permission-system:permission-request") permissionEvents.push(data); } },
44
+ registerTool() {}, registerCommand() {}, registerShortcut() {}, registerMessageRenderer() {}, registerFlag() {},
45
+ getFlag: () => false, getActiveTools: () => [], getAllTools: () => [],
46
+ appendEntry: (type: string, data: unknown) => { manager.appendCustomEntry(type, data); },
47
+ };
48
+ let classifications = 0;
49
+ createGentleAiExtension({
50
+ processEnv: { GENTLE_PI_AGENTS_CHILD: "0", GENTLE_PI_CONFIG_HOME: config, TMPDIR: temp },
51
+ nativeReviewCli: null,
52
+ resolveTelemetryTriggerBinary: () => { throw new Error("No native telemetry in fixture"); },
53
+ autoPermissionClassifier: { run: async () => { classifications++; return { status: "available", decision: options.classify?.() ?? "deny", reason: "Fixture restriction" }; }, cancel() {} },
54
+ })(pi as unknown as ExtensionAPI);
55
+ if (options.skills) skillRegistry(pi as unknown as ExtensionAPI);
56
+ const ctx = {
57
+ cwd: repo, mode: "tui", hasUI: options.hasUI ?? true, sessionManager: manager,
58
+ model: { id: "fixture", provider: "fixture" }, signal: new AbortController().signal,
59
+ ui: { confirm: async (...args: string[]) => { prompts.push(args); return options.confirm ? options.confirm() : options.approve === true; }, setStatus() {}, setWidget() {} },
60
+ } as unknown as ExtensionContext;
61
+ async function emit(name: string, event: unknown) {
62
+ for (const fn of handlers.get(name) ?? []) {
63
+ const verdict = await fn(event, ctx);
64
+ if (verdict !== undefined) return verdict;
65
+ }
66
+ return undefined;
67
+ }
68
+ let callId = 0;
69
+ return { dir, repo, temp, git, manager, ctx, pi, prompts, permissionEvents, emit, classifications: () => classifications,
70
+ call: (toolName: string, input: unknown) => emit("tool_call", { toolName, input, toolCallId: `path-${++callId}` }),
71
+ };
72
+ }
73
+
74
+ function isolateFixedTempRoots(t: test.TestContext, temp: string, target: string, repo: string) {
75
+ const env = { TMPDIR: temp };
76
+ if (isTempTarget(target, env)) {
77
+ // A fixture target may live under a fixed temp root. Redirect only the
78
+ // fixed aliases to the worktree so TMPDIR remains a distinct exemption.
79
+ const native = realpathSync.native;
80
+ t.mock.method(realpathSync, "native", (path: string) => native(path === "/tmp" || path === "/var/tmp" ? repo : path));
81
+ }
82
+ assert.equal(isTempTarget(target, env), false);
83
+ }
84
+
85
+ function worktreeFixture(t: test.TestContext) {
86
+ const f = fixture(t, { hasUI: false });
87
+ isolateFixedTempRoots(t, f.temp, f.dir, f.repo);
88
+ return f;
89
+ }
90
+
91
+ const inputs = (path: string) => [
92
+ ["read", { path }], ["write", { path, content: "fixture" }], ["edit", { path, edits: [] }],
93
+ ["grep", { path, pattern: "fixture" }], ["find", { path, pattern: "*" }], ["ls", { path }],
94
+ ] as const;
95
+
96
+ test("all six file tools ask for the exact outside target and a refusal blocks", async t => {
97
+ const f = fixture(t);
98
+ for (const [tool, input] of inputs(outside)) assert.deepEqual(await f.call(tool, input), declined, tool);
99
+ assert.deepEqual(f.prompts, inputs(outside).map(([tool]) => prompt(tool, outside)));
100
+ for (const [index, [toolName]] of inputs(outside).entries()) {
101
+ const request = f.permissionEvents[2 * index] as { requestId: string };
102
+ assert.ok(request.requestId);
103
+ for (const [phase, state] of ["waiting", "denied"].entries()) {
104
+ assert.deepEqual(f.permissionEvents[2 * index + phase], { requestId: request.requestId, state, source: "tool_call",
105
+ message: "Gentle AI safety policy requires confirmation for this tool call.", toolName });
106
+ }
107
+ }
108
+ assert.equal(f.permissionEvents.length, 12);
109
+ });
110
+
111
+ test("a rejected confirmation explicitly blocks execution and leaves no grant", async t => {
112
+ const disconnect = new Error("fixture UI disconnected");
113
+ const f = fixture(t, { confirm: async () => { throw disconnect; } });
114
+ const blocked = { block: true, reason: "Gentle AI safety policy blocked the path access because it was not confirmed." };
115
+ let executed = 0;
116
+ let verdict: ToolCallEventResult | undefined;
117
+ const result = await runToolCall({ type: "toolCall", name: "read", id: "disconnect", arguments: { path: outside } }, {
118
+ assistantMessage: {} as RunToolCallOptions["assistantMessage"],
119
+ context: { messages: [] },
120
+ tools: [{ name: "read", label: "Fixture read", description: "Count executions without touching the file", parameters: Type.Object({ path: Type.String() }),
121
+ execute: async () => { executed++; return { content: [], details: undefined }; } }],
122
+ beforeToolCall: async ({ args }) => verdict = await f.call("read", args) as typeof verdict,
123
+ });
124
+ assert.equal(result.isError, true);
125
+ assert.equal(executed, 0);
126
+ const request = f.permissionEvents[0] as { requestId: string };
127
+ assert.ok(request.requestId);
128
+ assert.deepEqual(f.permissionEvents, ["waiting", "denied"].map(state => ({ requestId: request.requestId, state, source: "tool_call",
129
+ message: "Gentle AI safety policy requires confirmation for this tool call.", toolName: "read" })));
130
+ assert.deepEqual({ verdict, content: result.result.content }, { verdict: blocked, content: [{ type: "text", text: blocked.reason }] });
131
+ Object.assign(f.ctx, { hasUI: false });
132
+ assert.deepEqual(await f.call("read", { path: outside }), headless(outside));
133
+ assert.deepEqual(f.prompts, [prompt("read", outside)]);
134
+ assert.equal(f.permissionEvents.length, 2);
135
+ });
136
+
137
+ test("headless outside access is denied without showing an ask", async t => {
138
+ const f = fixture(t, { hasUI: false, approve: true });
139
+ assert.deepEqual(await f.call("write", { path: outside, content: "fixture" }), headless(outside));
140
+ assert.deepEqual(f.prompts, []);
141
+ assert.deepEqual(f.permissionEvents, []);
142
+ });
143
+
144
+ test("inside targets pass without rewriting the tool input", async t => {
145
+ const f = worktreeFixture(t);
146
+ f.ctx.cwd = join(f.repo, "session");
147
+ mkdirSync(f.ctx.cwd);
148
+ f.ctx.sessionManager = SessionManager.inMemory(f.ctx.cwd);
149
+ for (const [tool, input] of inputs("../subdir/file.txt")) {
150
+ const original = structuredClone(input);
151
+ assert.equal(await f.call(tool, Object.freeze(input)), undefined, tool);
152
+ assert.deepEqual(input, original);
153
+ }
154
+ assert.equal(await f.call("ls", {}), undefined);
155
+ assert.deepEqual(f.prompts, []);
156
+ });
157
+
158
+ test("the existing session registry admits a linked worktree in the same clone", async t => {
159
+ const f = worktreeFixture(t);
160
+ f.git("-c", "user.name=Test", "-c", "user.email=test@example.invalid", "commit", "--quiet", "--allow-empty", "-m", "Fixture");
161
+ const linked = join(f.dir, "linked"), path = join(linked, "file.md");
162
+ f.git("worktree", "add", "--quiet", "--detach", linked);
163
+ assert.deepEqual(await f.call("read", { path }), headless(path));
164
+ const registry = new SessionWorktreeRegistry(f.pi, f.manager, f.repo);
165
+ assert.equal(registry.register(linked, "explicit"), linked);
166
+ assert.equal(await f.call("read", { path }), undefined);
167
+ assert.deepEqual(f.prompts, []);
168
+ });
169
+
170
+ test("session TMPDIR and exact files from both session skill indexes need no consent", async t => {
171
+ const f = fixture(t, { hasUI: false, skills: true });
172
+ // Use real checked-in skill files beyond this fixture's worktree. An isolated
173
+ // HOME prevents the loose registry scan from consulting the developer's home.
174
+ for (const [key, value] of Object.entries({ HOME: f.dir, USERPROFILE: f.dir, CODEX_HOME: process.cwd(), GENTLE_PI_NO_SKILL_REGISTRY: "0" })) {
175
+ const previous = process.env[key];
176
+ process.env[key] = value;
177
+ t.after(() => { if (previous === undefined) delete process.env[key]; else process.env[key] = previous; });
178
+ }
179
+ const native = join(process.cwd(), "skills", "branch-pr", "SKILL.md");
180
+ const loose = join(process.cwd(), "skills", "chained-pr", "SKILL.md");
181
+ const options = { skills: [{ name: "branch-pr", description: "A fixture skill", filePath: native }], appendSystemPrompt: "" };
182
+ await f.emit("before_agent_start", { prompt: "Load indexed skill files", systemPrompt: "", systemPromptOptions: options });
183
+ assert.match(options.appendSystemPrompt, /Effective session skills/);
184
+ assert.ok(options.appendSystemPrompt.includes(loose));
185
+ assert.equal(await f.call("write", { path: join(f.temp, "scratch.txt"), content: "fixture" }), undefined);
186
+ for (const path of [native, loose]) assert.equal(await f.call("read", { path }), undefined, path);
187
+ assert.deepEqual(await f.call("write", { path: loose, content: "fixture" }), headless(realpathSync(loose)));
188
+ const other = join(process.cwd(), "skills", "chained-pr", "not-indexed.md");
189
+ assert.deepEqual(await f.call("read", { path: other }), headless(join(realpathSync(process.cwd()), "skills", "chained-pr", "not-indexed.md")));
190
+ assert.deepEqual(f.prompts, []);
191
+ });
192
+
193
+ test("a grant covers only the approved canonical target and only in the current session", async t => {
194
+ const f = fixture(t, { approve: true });
195
+ assert.equal(await f.call("read", { path: outside }), undefined);
196
+ assert.equal(await f.call("write", { path: outside, content: "fixture" }), undefined);
197
+ const other = join(outside, "other.md");
198
+ assert.equal(await f.call("read", { path: other }), undefined);
199
+ f.ctx.sessionManager = SessionManager.inMemory(f.repo);
200
+ assert.equal(await f.call("read", { path: outside }), undefined);
201
+ assert.deepEqual(f.prompts, [prompt("read", outside), prompt("read", other), prompt("read", outside)]);
202
+ });
203
+
204
+ test("a relative dangling symlink to an outside file requests consent (#1659)", { skip: process.platform === "win32" }, async t => {
205
+ const f = fixture(t);
206
+ const dangling = join(parse(outside).root, "__gentle_path_consent_dangling_fixture__.md");
207
+ symlinkSync(relative(f.repo, dangling), join(f.repo, "alias"), "file");
208
+ assert.deepEqual(await f.call("write", { path: "alias", content: "fixture" }), declined);
209
+ assert.deepEqual(f.prompts, [prompt("write", dangling)]);
210
+ assert.equal(existsSync(dangling), false);
211
+ });
212
+
213
+ test("a dangling outside link with an ordinary parent segment asks", { skip: process.platform === "win32" }, async t => {
214
+ const f = fixture(t, { skills: true });
215
+ const work = realpathSync(process.cwd());
216
+ const leaf = "__gentle_path_consent_missing_leaf__.md";
217
+ const target = join(work, leaf);
218
+ assert.equal(existsSync(target), false);
219
+ symlinkSync(`${relative(f.repo, work)}/skills/../${leaf}`, join(f.repo, "alias"), "file");
220
+ assert.deepEqual(await f.call("write", { path: "alias", content: "fixture" }), declined);
221
+ assert.deepEqual(f.prompts, [prompt("write", target)]);
222
+ assert.equal(existsSync(target), false);
223
+
224
+ // Lexically cancelling prefix/.. would leave this path inside f.repo.
225
+ symlinkSync(join(work, "skills"), join(f.repo, "prefix"), "dir");
226
+ symlinkSync(`prefix/../${leaf}`, join(f.repo, "redirected"), "file");
227
+ assert.deepEqual(await f.call("write", { path: "redirected", content: "fixture" }), declined);
228
+ assert.deepEqual(f.prompts, [prompt("write", target), prompt("write", target)]);
229
+ assert.equal(existsSync(target), false);
230
+ });
231
+
232
+ test("an empty or malformed durable registration cannot widen the worktree boundary (#1660)", async t => {
233
+ const f = fixture(t, { hasUI: false });
234
+ for (const root of ["", ".", "../repo", parse(outside).root]) {
235
+ f.manager.appendCustomEntry(SESSION_WORKTREE_ENTRY, { sessionId: f.manager.getSessionId(), root, evidence: "malformed fixture" });
236
+ }
237
+ assert.deepEqual(await f.call("read", { path: outside }), headless(outside));
238
+ assert.deepEqual(new SessionWorktreeRegistry(f.pi, f.manager, f.repo).roots(), []);
239
+ assert.deepEqual(f.prompts, []);
240
+ });
241
+
242
+ test("a sensitive outside path still denies first with its existing message", async t => {
243
+ const f = fixture(t, { approve: true });
244
+ const path = join(outside, ".env");
245
+ assert.deepEqual(await f.call("read", { path }), { block: true, reason: `Gentle AI safety policy blocked access to sensitive path: ${path}. Ask the user for an explicit safer plan.` });
246
+ assert.deepEqual(f.prompts, []);
247
+ assert.deepEqual(f.permissionEvents, []);
248
+ });
249
+
250
+ test("Normal asks for outside access and does not invoke Auto", async t => {
251
+ const f = fixture(t, { mode: "normal", approve: true });
252
+ assert.equal(await f.call("read", { path: outside }), undefined);
253
+ assert.deepEqual(f.prompts, [prompt("read", outside)]);
254
+ assert.equal(f.classifications(), 0);
255
+ });
256
+
257
+ test("Auto still classifies after outside consent, and its denial still wins", async t => {
258
+ const f = fixture(t, { mode: "auto", approve: true });
259
+ assert.deepEqual(await f.call("read", { path: outside }), { block: true, reason: "Auto denied this action: Fixture restriction. Find a materially safer alternative within the request, or ask the user; do not pursue the same effect through another tool." });
260
+ assert.deepEqual(f.prompts, [prompt("read", outside)]);
261
+ assert.equal(f.classifications(), 1);
262
+ });
263
+
264
+ test("Auto blocks a target retargeted during classification without granting either path", { skip: process.platform === "win32" }, async t => {
265
+ let retarget: (() => void) | undefined;
266
+ const f = fixture(t, { mode: "auto", approve: true, classify: () => { retarget?.(); return "allow"; } });
267
+ const alias = join(f.repo, "alias"), replacement = join(f.repo, "replacement"), other = `${outside}.other`;
268
+ symlinkSync(outside, alias, "file");
269
+ symlinkSync(other, replacement, "file");
270
+ retarget = () => { renameSync(replacement, alias); retarget = undefined; };
271
+ assert.deepEqual(await f.call("read", { path: "alias" }), {
272
+ block: true, reason: "Gentle AI safety policy blocked the path access because its target changed during Auto classification. Retry to request fresh consent.",
273
+ });
274
+ assert.deepEqual(f.prompts, [prompt("read", outside)]);
275
+ assert.equal(f.classifications(), 1);
276
+ for (const path of [outside, other]) assert.equal(await f.call("read", { path }), undefined);
277
+ assert.deepEqual(f.prompts, [prompt("read", outside), prompt("read", outside), prompt("read", other)]);
278
+ });
279
+
280
+ test("Auto blocks a worktree alias retargeted outside during classification without granting access", { skip: process.platform === "win32" }, async t => {
281
+ let retarget: (() => void) | undefined;
282
+ const f = fixture(t, { mode: "auto", approve: true, classify: () => { retarget?.(); return "allow"; } });
283
+ const inside = join(f.repo, "inside.md"), other = join(f.dir, "outside.md");
284
+ isolateFixedTempRoots(t, f.temp, other, f.repo);
285
+ writeFileSync(inside, "fixture");
286
+ writeFileSync(other, "fixture");
287
+ const alias = join(f.repo, "alias"), replacement = join(f.repo, "replacement");
288
+ symlinkSync(inside, alias, "file");
289
+ symlinkSync(other, replacement, "file");
290
+ retarget = () => { renameSync(replacement, alias); retarget = undefined; };
291
+ assert.deepEqual(await f.call("read", { path: "alias" }), {
292
+ block: true, reason: "Gentle AI safety policy blocked the path access because its target changed during Auto classification. Retry to request fresh consent.",
293
+ });
294
+ assert.equal(f.classifications(), 1);
295
+ assert.deepEqual(f.prompts, []);
296
+ assert.deepEqual(f.permissionEvents, []);
297
+ assert.equal(await f.call("read", { path: "alias" }), undefined);
298
+ assert.deepEqual(f.prompts, [prompt("read", other)]);
299
+ });
300
+
301
+ test("Auto allows an unchanged worktree alias without asking", { skip: process.platform === "win32" }, async t => {
302
+ const f = fixture(t, { mode: "auto", classify: () => "allow" });
303
+ const inside = join(f.repo, "inside.md");
304
+ writeFileSync(inside, "fixture");
305
+ symlinkSync(inside, join(f.repo, "alias"), "file");
306
+ assert.equal(await f.call("read", { path: "alias" }), undefined);
307
+ assert.equal(f.classifications(), 1);
308
+ assert.deepEqual(f.prompts, []);
309
+ assert.deepEqual(f.permissionEvents, []);
310
+ });
311
+
312
+ test("YOLO allows non-sensitive outside reads and listings but not outside mutations", async t => {
313
+ const f = fixture(t, { mode: "yolo" });
314
+ for (const [tool, input] of inputs(outside)) assert.deepEqual(await f.call(tool, input), tool === "write" || tool === "edit" ? declined : undefined, tool);
315
+ assert.deepEqual(f.prompts, [prompt("write", outside), prompt("edit", outside)]);
316
+ assert.equal(f.classifications(), 0);
317
+ });
318
+
319
+ test("Super Yolo waives outside permission asks, but not sensitive-path denials", async t => {
320
+ const f = fixture(t, { mode: "super-yolo" });
321
+ assert.equal(await f.call("write", { path: outside, content: "fixture" }), undefined);
322
+ const path = join(outside, ".env");
323
+ assert.deepEqual(await f.call("read", { path }), { block: true, reason: `Gentle AI safety policy blocked access to sensitive path: ${path}. Ask the user for an explicit safer plan.` });
324
+ assert.deepEqual(f.prompts, []);
325
+ assert.equal(f.classifications(), 0);
326
+ });
@@ -0,0 +1,42 @@
1
+ import assert from "node:assert/strict";
2
+ import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import { test } from "node:test";
6
+ import { resolvePersonaMode, writePersonaMode } from "../lib/persona-config.ts";
7
+
8
+ // lib/persona-config.ts keeps the exact precedence `/gentle:persona` always had.
9
+
10
+ function dirs(t: test.TestContext) {
11
+ const root = mkdtempSync(join(tmpdir(), "persona-config-"));
12
+ t.after(() => rmSync(root, { recursive: true, force: true }));
13
+ const configHome = join(root, "config");
14
+ const cwd = join(root, "repo");
15
+ mkdirSync(join(cwd, ".pi", "gentle-ai"), { recursive: true });
16
+ mkdirSync(configHome, { recursive: true });
17
+ return { configHome, cwd, project: join(cwd, ".pi", "gentle-ai", "persona.json"), global: join(configHome, "persona.json") };
18
+ }
19
+
20
+ test("any project mode other than neutral reads as gentleman", (t) => {
21
+ const d = dirs(t);
22
+ writeFileSync(d.global, JSON.stringify({ mode: "neutral" }));
23
+ writeFileSync(d.project, JSON.stringify({ mode: "x" }));
24
+ assert.equal(resolvePersonaMode(d.cwd, d.configHome), "gentleman");
25
+ });
26
+
27
+ test("an unusable project file falls through to the global file, and nothing usable means gentleman", (t) => {
28
+ const d = dirs(t);
29
+ writeFileSync(d.global, JSON.stringify({ mode: "neutral" }));
30
+ for (const content of ["[]", "null", "{ broken"]) {
31
+ writeFileSync(d.project, content);
32
+ assert.equal(resolvePersonaMode(d.cwd, d.configHome), "neutral", content);
33
+ }
34
+ rmSync(d.global);
35
+ assert.equal(resolvePersonaMode(d.cwd, d.configHome), "gentleman");
36
+ });
37
+
38
+ test("writePersonaMode never creates a missing project file", (t) => {
39
+ const d = dirs(t);
40
+ assert.deepEqual(writePersonaMode(d.cwd, d.configHome, "neutral"), [d.global]);
41
+ assert.equal(existsSync(d.project), false);
42
+ });
@@ -38,7 +38,7 @@ function launch(args: string[], scenario = 'owned', piVersion = '1.2.0') {
38
38
  source = source.replace('runtime = resolvePiRuntime({', ${JSON.stringify(`runtime = ({ kind: '${adjacent ? 'bundled' : 'env'}', command: '${adjacent ? 'node' : piRoot + '/dist/bundle/cli.js'}', args: ${JSON.stringify(adjacent ? [piRoot + '/dist/bundle/cli.js'] : [])} }); /*`)}).replace('nodeExecPath: process.execPath,\\n\\t\\t});', 'nodeExecPath: process.execPath, */');
39
39
  source = source.replace('const versionProbe = spawnSync(versionProbePlan.command, versionProbePlan.args, {', 'const versionProbe = { stdout: "${piVersion}" }; /*').replace('env: bundledEnv ?? process.env,\\n\\t});', 'env: bundledEnv ?? process.env, */');
40
40
  source = source.replace('async function packageManagerAdapters() {', 'async function packageManagerAdapters() { return globalThis.fakeAdapters; } async function unusedAdapters() {');
41
- source = source.replace('let homeHadContentBeforeBootstrap = false;', 'if (passthrough.length === 1) { console.error("error: pi cannot self-update this installation. This installation is not managed by a global pnpm install."); process.exitCode = 1; return; } console.log("FORWARD " + JSON.stringify(passthrough)); return; let homeHadContentBeforeBootstrap = false;');
41
+ source = source.replace('const homeHadContentBeforeBootstrap = homeHasContent(home.dir);', 'if (passthrough.length === 1) { console.error("error: pi cannot self-update this installation. This installation is not managed by a global pnpm install."); process.exitCode = 1; return; } console.log("FORWARD " + JSON.stringify(passthrough)); return; const homeHadContentBeforeBootstrap = homeHasContent(home.dir);');
42
42
  return {format:'module', source, shortCircuit:true};
43
43
  }
44
44
  return next(url,context);
@@ -8,7 +8,7 @@ import { updateSelectedPi } from '../scripts/pi-update.mjs';
8
8
  const PI = '@earendil-works/pi-coding-agent';
9
9
  const CLI = 'dist/bundle/cli.js';
10
10
 
11
- async function fixture(t: any, options: {manager?: string, locks?: string[], workspace?: boolean, range?: string, mismatch?: boolean, managerVersion?: string, fail?: boolean, unreadable?: boolean, unlink?: boolean, installedSource?: boolean, configOnly?: boolean, multipleProjects?: boolean, latest?: string, excludeOutput?: string, piDependencies?: Record<string, unknown>, manifestView?: {code: number, stdout: string}, siblingDependencies?: Record<string, Record<string, unknown>>} = {}) {
11
+ async function fixture(t: any, options: {directSiblings?: Record<string, string>, manager?: string, locks?: string[], workspace?: boolean, range?: string, mismatch?: boolean, managerVersion?: string, fail?: boolean, unreadable?: boolean, unlink?: boolean, installedSource?: boolean, configOnly?: boolean, multipleProjects?: boolean, latest?: string, excludeOutput?: string, piDependencies?: Record<string, unknown>, manifestView?: {code: number, stdout: string}, siblingDependencies?: Record<string, Record<string, unknown>>} = {}) {
12
12
  const temp = await fs.realpath(await fs.mkdtemp(join(tmpdir(), 'pi-source-')));
13
13
  t.after(() => fs.rm(temp, {recursive: true, force: true}));
14
14
  const root = join(temp, 'checkout');
@@ -17,7 +17,7 @@ async function fixture(t: any, options: {manager?: string, locks?: string[], wor
17
17
  const peer = join(root, 'node_modules', PI);
18
18
  const manager = options.manager ?? 'pnpm';
19
19
  const lock = manager === 'npm' ? 'package-lock.json' : 'pnpm-lock.yaml';
20
- const manifest = JSON.stringify({name: 'gentle-pi', version: '4.4.0', packageManager: `${manager}@11.1.1`, devDependencies: {[PI]: options.range ?? '^1.0.0'}});
20
+ const manifest = JSON.stringify({name: 'gentle-pi', version: '4.4.0', packageManager: `${manager}@11.1.1`, devDependencies: {[PI]: options.range ?? '^1.0.0', ...options.directSiblings}});
21
21
  await fs.mkdir(join(root, '.git'), {recursive: true});
22
22
  await fs.mkdir(modules, {recursive: true});
23
23
  await fs.mkdir(join(peer, 'dist', 'bundle'), {recursive: true});
@@ -114,6 +114,19 @@ const DEPENDENCIES = {'@earendil-works/pi-ai':'2.0.0', '@earendil-works/pi-tui':
114
114
  const SIBLINGS = {'@earendil-works/pi-ai@2.0.0':{'@earendil-works/pi-schema':'2.0.0', '@earendil-works/pi-telemetry':'2.0.0', openai:'7.19.0'},
115
115
  '@earendil-works/pi-tui@2.0.0':{'@earendil-works/pi-ai':'2.0.0', marked:'18.0.11'}, '@earendil-works/pi-schema@2.0.0':{}, '@earendil-works/pi-telemetry@2.0.0':{'@earendil-works/pi-ranged':'^2.0.0'}};
116
116
 
117
+ // A source Shell that also depends directly on Pi's exact siblings (pi-ai,
118
+ // pi-tui) moves them with Pi, so one copy of each remains instead of the old
119
+ // root copy beside Pi's nested new one. Siblings it does not declare stay out.
120
+ for (const manager of ['pnpm', 'npm']) test(`source ${manager} moves the Shell's direct Pi siblings to the exact versions the selected Pi pins`, async t => {
121
+ const f = await fixture(t, {manager, latest:'2.0.0', piDependencies:DEPENDENCIES, siblingDependencies:SIBLINGS, directSiblings:{'@earendil-works/pi-ai':'>=1.2.0', '@earendil-works/pi-tui':'>=1.2.0', chalk:'^5.0.0'}});
122
+ assert.equal(await updateSelectedPi(f.input), 0);
123
+ const specs = f.updates[0].args.filter(arg => arg.startsWith('@earendil-works/'));
124
+ assert.deepEqual(specs, [`${PI}@2.0.0`, '@earendil-works/pi-ai@2.0.0', '@earendil-works/pi-tui@2.0.0']);
125
+ assert.equal(f.updates.length, 1);
126
+ assert.ok(f.updates[0].args.includes('--no-save'));
127
+ assert.equal((await f.snapshot()).manifest, f.before.manifest);
128
+ });
129
+
117
130
  test('source pnpm also exempts only the Pi-scope packages the selected Pi pins exactly, transitively', async t => {
118
131
  const f = await fixture(t, {configOnly:true, latest:'2.0.0', piDependencies:DEPENDENCIES, siblingDependencies:SIBLINGS});
119
132
  assert.equal(await updateSelectedPi(f.input), 0);
@@ -267,3 +280,36 @@ test('source update cannot claim success when its global Shell link disappeared'
267
280
  assert.equal(f.updates.length, 1);
268
281
  assert.deepEqual(f.output, []);
269
282
  });
283
+
284
+ test('source update failure with siblings names every spec from the same command', async t => {
285
+ const f = await fixture(t, {manager: 'npm', fail: true, latest:'1.6.0', piDependencies:{'@earendil-works/pi-ai':'1.6.0','@earendil-works/pi-tui':'1.6.0'}, siblingDependencies:{'@earendil-works/pi-ai@1.6.0':{}, '@earendil-works/pi-tui@1.6.0':{}}, directSiblings:{'@earendil-works/pi-ai':'*','@earendil-works/pi-tui':'*'}});
286
+ await assert.rejects(updateSelectedPi(f.input), {message:`gentle-shell update: npm (/fake/npm) could not install ${PI}@1.6.0, @earendil-works/pi-ai@1.6.0, @earendil-works/pi-tui@1.6.0\nnpm error fixture install failed`});
287
+ assert.equal(f.updates.length, 1);
288
+ });
289
+
290
+ const REAL_PI = {'@earendil-works/pi-agent-core':'1.6.0','@earendil-works/pi-ai':'1.6.0','@earendil-works/pi-codemode':'1.6.0','@earendil-works/pi-mcp':'1.6.0','@earendil-works/pi-tui':'1.6.0', chalk:'6.0.0'};
291
+ const REAL_SIBLINGS = {'@earendil-works/pi-ai@1.6.0':{'@earendil-works/pi-schema':'1.6.0','@earendil-works/pi-telemetry':'1.6.0'}, '@earendil-works/pi-tui@1.6.0':{}, '@earendil-works/pi-agent-core@1.6.0':{'@earendil-works/pi-ai':'1.6.0','@earendil-works/pi-schema':'1.6.0'}, '@earendil-works/pi-codemode@1.6.0':{}, '@earendil-works/pi-mcp@1.6.0':{}, '@earendil-works/pi-schema@1.6.0':{}, '@earendil-works/pi-telemetry@1.6.0':{}};
292
+ const scoped = (args: string[]) => args.filter(a => a.startsWith('@earendil-works/'));
293
+ for (const manager of ['pnpm', 'npm']) test(`source ${manager}: the real Shell manifest moves exactly pi-ai and pi-tui under Pi 1.6.0 and keeps the wildcard exclusion`, async t => {
294
+ const f = await fixture(t, {manager, configOnly: manager === 'pnpm', latest:'1.6.0', piDependencies:REAL_PI, siblingDependencies:REAL_SIBLINGS, excludeOutput:'["@earendil-works/*"]\n'});
295
+ const text = JSON.stringify({name:'gentle-pi', version:'4.9.0', packageManager:`${manager}@11.1.1`, peerDependencies:{[PI]:'>=1.2.0','@earendil-works/pi-ai':'*','@earendil-works/pi-tui':'*'}, devDependencies:{[PI]:'>=1.2.0','@earendil-works/pi-ai':'>=1.2.0','@earendil-works/pi-tui':'>=1.2.0'}}, null, '\t') + '\n';
296
+ await fs.writeFile(join(f.root, 'package.json'), text);
297
+ assert.equal(await updateSelectedPi(f.input), 0);
298
+ assert.deepEqual(scoped(f.updates[0].args), [`${PI}@1.6.0`, '@earendil-works/pi-ai@1.6.0', '@earendil-works/pi-tui@1.6.0']);
299
+ assert.equal(await fs.readFile(join(f.root, 'package.json'), 'utf8'), text);
300
+ const ex = f.updates[0].args.filter(a => a.startsWith('--config.minimum-release-age-exclude=')).map(a => a.slice(a.indexOf('=') + 1));
301
+ if (manager === 'pnpm') { assert.equal(ex[0], '@earendil-works/*'); for (const n of ['pi-ai','pi-tui']) assert.ok(ex.includes(`@earendil-works/${n}@1.6.0`)); }
302
+ else assert.deepEqual(ex, []);
303
+ });
304
+ for (const manager of ['pnpm', 'npm']) test(`source ${manager}: only declared, exactly pinned stable siblings move; peer-only, unpinned, ranged and prerelease stay`, async t => {
305
+ const f = await fixture(t, {manager, latest:'2.0.0', piDependencies:{...DEPENDENCIES, '@earendil-works/pi-peeronly':'2.0.0'}, siblingDependencies:{...SIBLINGS, '@earendil-works/pi-peeronly@2.0.0':{}}});
306
+ await fs.writeFile(join(f.root, 'package.json'), JSON.stringify({name:'gentle-pi', version:'4.4.0', packageManager:`${manager}@11.1.1`, dependencies:{'@earendil-works/pi-ai':'*', [PI]:'^1.0.0'}, optionalDependencies:{'@earendil-works/pi-schema':'*','@earendil-works/pi-ai':'*'}, peerDependencies:{'@earendil-works/pi-peeronly':'*'}, devDependencies:{[PI]:'^1.0.0','@earendil-works/pi-unrelated':'1.0.0','@earendil-works/pi-ranged':'^2.0.0','@earendil-works/pi-next':'*','@earendil-works/pi-tui':'*'}}));
307
+ assert.equal(await updateSelectedPi(f.input), 0);
308
+ assert.deepEqual(scoped(f.updates[0].args).sort(), [`${PI}@2.0.0`,'@earendil-works/pi-ai@2.0.0','@earendil-works/pi-schema@2.0.0','@earendil-works/pi-tui@2.0.0'].sort());
309
+ });
310
+ test('source npm with declared siblings refuses without mutation when a pinned sibling manifest is unreadable', async t => {
311
+ const {'@earendil-works/pi-tui@2.0.0': _gone, ...partial} = SIBLINGS;
312
+ const f = await fixture(t, {manager:'npm', latest:'2.0.0', piDependencies:DEPENDENCIES, siblingDependencies:partial, directSiblings:{'@earendil-works/pi-ai':'*'}});
313
+ await assert.rejects(updateSelectedPi(f.input), {message:'gentle-shell update: the published dependencies of @earendil-works/pi-tui@2.0.0 could not be verified. No installation changed.'});
314
+ assert.deepEqual(f.updates, []); assert.deepEqual(await f.snapshot(), f.before);
315
+ });