gentle-pi 4.5.1 → 4.7.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 (428) hide show
  1. package/README.md +17 -15
  2. package/assets/agents/gentle-ai-explore.md +1 -0
  3. package/assets/agents/gentle-ai-verify.md +8 -1
  4. package/assets/agents/gentle-ai-worker.md +4 -0
  5. package/assets/agents/jd-fix-agent.md +1 -0
  6. package/assets/agents/jd-judge-a.md +1 -0
  7. package/assets/agents/jd-judge-b.md +1 -0
  8. package/assets/design-canvas/canvas.css +13 -1
  9. package/assets/design-canvas/canvas.js +11 -2
  10. package/assets/install-wizard/wizard.js +1 -0
  11. package/assets/migrations/agent-body-history.json +162 -0
  12. package/assets/orchestrator-delegation-reference.md +7 -7
  13. package/assets/orchestrator-delegation.md +3 -3
  14. package/assets/orchestrator-full-delegation-card.md +65 -0
  15. package/assets/orchestrator-full-delegation.md +34 -0
  16. package/assets/orchestrator-memory.md +3 -3
  17. package/assets/orchestrator-prompts.md +1 -1
  18. package/assets/orchestrator-skills.md +1 -1
  19. package/assets/orchestrator-verification.md +14 -8
  20. package/assets/orchestrator.md +11 -11
  21. package/bin/gentle-shell.mjs +225 -82
  22. package/docs/agent-status.md +61 -0
  23. package/docs/bundled-install.md +7 -5
  24. package/docs/ci-performance.md +11 -0
  25. package/docs/delegated-verification.md +35 -7
  26. package/docs/fast-mode.md +15 -0
  27. package/docs/gentle-agents-activity.md +22 -0
  28. package/docs/gentle-shell.md +113 -25
  29. package/docs/install-wizard.md +2 -2
  30. package/docs/mcp-status.md +52 -0
  31. package/docs/permission-modes.md +9 -4
  32. package/docs/prompt-budget.md +28 -0
  33. package/docs/readme-reference.md +154 -50
  34. package/docs/render-cache-performance.md +11 -1
  35. package/docs/review-coordinator.md +33 -0
  36. package/docs/review-request-context.md +19 -0
  37. package/docs/review-windows-acl.md +18 -0
  38. package/docs/session-profile-format.md +20 -5
  39. package/docs/sound-notifications.md +1 -1
  40. package/docs/star-prompt.md +32 -0
  41. package/docs/voice.md +6 -3
  42. package/docs/work-continuity.md +46 -0
  43. package/docs/yolo-mode.md +5 -5
  44. package/extensions/ask-user-choice.ts +1 -0
  45. package/extensions/ask-user-question.ts +2 -0
  46. package/extensions/child-safety.ts +3 -0
  47. package/extensions/codegraph-tools.ts +38 -4
  48. package/extensions/gentle-agent-status.ts +99 -0
  49. package/extensions/gentle-agents.ts +803 -84
  50. package/extensions/gentle-ai.ts +2491 -596
  51. package/extensions/gentle-fast.ts +61 -0
  52. package/extensions/gentle-guide.ts +174 -0
  53. package/extensions/gentle-herdr-activity.ts +21 -1
  54. package/extensions/gentle-herdr-agent.ts +144 -0
  55. package/extensions/gentle-program-identity.ts +61 -0
  56. package/extensions/gentle-shell.ts +895 -120
  57. package/extensions/gentle-star-prompt.ts +334 -0
  58. package/extensions/gentle-stats.ts +5 -5
  59. package/extensions/gentle-todo.ts +59 -23
  60. package/extensions/gentle-tps.ts +48 -0
  61. package/extensions/history/store.ts +18 -12
  62. package/extensions/quiet-tools.ts +38 -8
  63. package/extensions/skill-registry.ts +210 -21
  64. package/extensions/startup-banner.ts +69 -10
  65. package/lib/agent-assets.ts +74 -17
  66. package/lib/agent-profile-pin.ts +3 -3
  67. package/lib/agent-profiles.ts +161 -3
  68. package/lib/agent-status.ts +105 -0
  69. package/lib/agents-config.ts +58 -3
  70. package/lib/agents-history.ts +24 -5
  71. package/lib/agents-keys.ts +8 -16
  72. package/lib/agents-messaging.ts +47 -5
  73. package/lib/agents-protocol.ts +80 -4
  74. package/lib/agents-runner.ts +287 -15
  75. package/lib/agents-view.ts +6 -1
  76. package/lib/agents-widget.ts +132 -9
  77. package/lib/auto-permission-runtime.ts +1 -1
  78. package/lib/bounded-writer-admission.ts +13 -1
  79. package/lib/bridge-cost.ts +28 -0
  80. package/lib/card-content-policy.ts +8 -6
  81. package/lib/codemode-renderer.ts +16 -0
  82. package/lib/command-palette-catalog.ts +1 -0
  83. package/lib/command-palette.ts +154 -25
  84. package/lib/context-backstop.ts +14 -5
  85. package/lib/destructive-command-guard.ts +48 -4
  86. package/lib/execution-surface-guard.ts +20 -0
  87. package/lib/exploration-budget.ts +64 -0
  88. package/lib/gentle-ai-binary.ts +1 -1
  89. package/lib/gentle-design.ts +3 -0
  90. package/lib/gentle-guide.ts +201 -0
  91. package/lib/gentle-shell-bundled.ts +6 -19
  92. package/lib/gentle-shell-launcher.ts +47 -8
  93. package/lib/herdr-activity.ts +23 -5
  94. package/lib/herdr-busy.ts +45 -0
  95. package/lib/herdr-task-summary-policy.ts +85 -0
  96. package/lib/image-attachments.ts +33 -0
  97. package/lib/image-disk-cache.ts +137 -0
  98. package/lib/inprocess-reviewer.ts +282 -132
  99. package/lib/jobs-sidebar-state.ts +5 -6
  100. package/lib/jobs-view.ts +198 -11
  101. package/lib/jobs-widget.ts +16 -52
  102. package/lib/keymaps-customize.ts +81 -0
  103. package/lib/keymaps.ts +291 -0
  104. package/lib/model-fallback-notice.ts +61 -0
  105. package/lib/model-fallback-policy.ts +141 -0
  106. package/lib/model-fallback-store.ts +143 -0
  107. package/lib/model-routing-authority.ts +32 -6
  108. package/lib/nan-provider.ts +3 -2
  109. package/lib/native-choice-list.ts +20 -2
  110. package/lib/native-review-cli.ts +103 -21
  111. package/lib/notification-customize.ts +48 -51
  112. package/lib/openai-fast-tier.ts +22 -0
  113. package/lib/orchestrator-discovery.ts +5 -1
  114. package/lib/orchestrator-fallback.ts +75 -0
  115. package/lib/orchestrator-mode-policy.ts +105 -0
  116. package/lib/pasted-image-paths.ts +113 -0
  117. package/lib/questionnaire/questionnaire-view.ts +225 -18
  118. package/lib/rdd-mode-control.ts +32 -0
  119. package/lib/reply-language-anchor.ts +104 -0
  120. package/lib/review-blocker.ts +92 -0
  121. package/lib/review-candidate-symlink-scan.ts +136 -0
  122. package/lib/review-candidate-view-owner.ts +85 -44
  123. package/lib/review-candidate-view.ts +10 -7
  124. package/lib/review-continuation-registry.ts +99 -0
  125. package/lib/review-coordinator.ts +163 -0
  126. package/lib/review-failure-facts.ts +49 -0
  127. package/lib/review-host-relay.ts +51 -11
  128. package/lib/review-integration-v2.ts +29 -8
  129. package/lib/review-relay-phase-timing.ts +45 -0
  130. package/lib/review-repository.ts +5 -0
  131. package/lib/review-start-context.ts +17 -0
  132. package/lib/session-profile-append-controller.ts +21 -6
  133. package/lib/session-profile-authority.ts +119 -0
  134. package/lib/session-profile-binding.ts +54 -5
  135. package/lib/session-profile-freeze.ts +107 -9
  136. package/lib/session-profile-integration.ts +313 -0
  137. package/lib/session-profile-persistence.ts +63 -9
  138. package/lib/shell-bar.ts +269 -72
  139. package/lib/shell-card.ts +26 -6
  140. package/lib/shell-changes.ts +2 -0
  141. package/lib/shell-page.ts +120 -0
  142. package/lib/shell-panel.ts +163 -0
  143. package/lib/shell-prompt.ts +53 -1
  144. package/lib/shell-sidebar-layout.ts +198 -53
  145. package/lib/shell-sidebar.ts +61 -1
  146. package/lib/shell-stats.ts +123 -0
  147. package/lib/shell-todo.ts +79 -1
  148. package/lib/shell-usage.ts +12 -2
  149. package/lib/star-prompt.ts +197 -0
  150. package/lib/verifier-admission.ts +18 -8
  151. package/lib/verifier-settle-reminder.ts +64 -0
  152. package/lib/vim-editor-adapter.ts +6 -1
  153. package/lib/visual-customization-policy.ts +67 -12
  154. package/lib/visual-customize-view.ts +373 -40
  155. package/lib/visual-layout-preview.ts +47 -0
  156. package/lib/visual-profiles.ts +2 -2
  157. package/lib/windows-session-transport.ts +53 -2
  158. package/lib/yolo-session-policy.ts +68 -16
  159. package/package.json +2 -1
  160. package/runtime/gentle-ai-binary.mjs +1 -1
  161. package/runtime/gentle-shell-bundled.mjs +6 -19
  162. package/runtime/gentle-shell-launcher.mjs +46 -7
  163. package/runtime/native-review-cli.mjs +100 -18
  164. package/runtime/review-integration-v2.mjs +29 -8
  165. package/runtime/windows-session-transport.ps1 +60 -3
  166. package/scripts/bootstrap.sh +4 -1
  167. package/scripts/build-full-delegation-card.mjs +175 -0
  168. package/scripts/bundled-install.mjs +38 -8
  169. package/scripts/download-progress.mjs +68 -0
  170. package/scripts/gentle-ai-installer.mjs +41 -18
  171. package/scripts/gentle-ai-proxy.mjs +294 -0
  172. package/scripts/install-gentle-ai.mjs +14 -1
  173. package/scripts/installer-preflight.mjs +6 -6
  174. package/scripts/installer-runner.mjs +27 -12
  175. package/scripts/installer-server.mjs +8 -7
  176. package/scripts/pi-update.mjs +113 -3
  177. package/scripts/render-cache-host.mjs +72 -0
  178. package/scripts/render-cache-performance-worker.mjs +5 -4
  179. package/scripts/render-cache-performance.mjs +6 -1
  180. package/scripts/run-test-suite.mjs +41 -13
  181. package/scripts/shell-snapshot.mjs +340 -0
  182. package/scripts/test-packed-runner.mjs +1 -1
  183. package/scripts/update-agent-body-history.mjs +41 -0
  184. package/scripts/verify-installer-tap.mjs +45 -0
  185. package/scripts/verify-package-files.mjs +14 -2
  186. package/scripts/voice-worker.cjs +32 -6
  187. package/skills/design/SKILL.md +11 -8
  188. package/skills/gentle-ai/SKILL.md +4 -4
  189. package/skills/gentle-ui-design/SKILL.md +46 -0
  190. package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
  191. package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
  192. package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
  193. package/skills/gentle-ui-design/references/task-and-content.md +60 -0
  194. package/skills/skill-registry/SKILL.md +4 -2
  195. package/skills/tui-design/NOTICE.md +5 -0
  196. package/skills/tui-design/SKILL.md +56 -0
  197. package/skills/tui-design/references/commands.md +75 -0
  198. package/skills/tui-design/references/critique.md +48 -0
  199. package/skills/tui-design/references/design-doc.md +44 -0
  200. package/skills/tui-design/references/terminal-craft.md +64 -0
  201. package/skills/tui-design/references/visual-loop.md +32 -0
  202. package/skills/work-unit-commits/SKILL.md +6 -7
  203. package/tests/agent-home.test.ts +28 -9
  204. package/tests/agent-profiles-workflow.test.ts +163 -0
  205. package/tests/agent-risk-escalation.test.ts +1 -1
  206. package/tests/agent-status.test.ts +143 -0
  207. package/tests/agents-config.test.ts +96 -0
  208. package/tests/agents-history.test.ts +31 -0
  209. package/tests/agents-jobs-frames.test.ts +93 -0
  210. package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
  211. package/tests/agents-protocol.test.ts +53 -1
  212. package/tests/agents-runner-drain.test.ts +193 -0
  213. package/tests/agents-runner.test.ts +345 -4
  214. package/tests/agents-view.test.ts +27 -0
  215. package/tests/agents-widget.test.ts +312 -10
  216. package/tests/append-system-prompt-route.test.ts +4 -1
  217. package/tests/ask-user-choice.test.ts +4 -3
  218. package/tests/ask-user-question.test.ts +97 -0
  219. package/tests/auto-permission-runtime.test.ts +1 -1
  220. package/tests/autonomous-guard.test.ts +346 -10
  221. package/tests/bounded-scan-contract.test.ts +39 -0
  222. package/tests/bounded-stop-contract.test.ts +43 -3
  223. package/tests/bridge-cost.test.ts +47 -0
  224. package/tests/bundled-install.test.ts +36 -9
  225. package/tests/card-content-policy.test.ts +3 -3
  226. package/tests/chained-pr-skill.test.ts +8 -6
  227. package/tests/child-safety.test.ts +11 -0
  228. package/tests/ci-concurrency.test.ts +11 -0
  229. package/tests/ci-merge-base-identity.test.ts +114 -0
  230. package/tests/codegraph-tools.test.ts +80 -5
  231. package/tests/codemode-rendering.test.ts +22 -2
  232. package/tests/command-palette.test.ts +300 -3
  233. package/tests/commit-slice-signal.test.ts +11 -9
  234. package/tests/delegate-for-reason-contract.test.ts +8 -7
  235. package/tests/design-canvas-assets.test.ts +185 -2
  236. package/tests/destructive-command-guard.test.ts +52 -0
  237. package/tests/download-progress.test.ts +71 -0
  238. package/tests/execution-surface-guard.test.ts +55 -0
  239. package/tests/exploration-budget.test.ts +128 -0
  240. package/tests/fixtures/agent-assets/gentle-ai-worker.strict-tdd-era.md +122 -0
  241. package/tests/fixtures/measure-orchestrator-prompt.mjs +2 -1
  242. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +26 -14
  243. package/tests/fixtures/proxy-tls/proxy.crt +19 -0
  244. package/tests/fixtures/proxy-tls/proxy.key +28 -0
  245. package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
  246. package/tests/fixtures/session-profile-v1/replay.ts +172 -0
  247. package/tests/fixtures/session-profile-v1/session-profile-authority.ts +113 -0
  248. package/tests/fixtures/session-profile-v1/session-profile-binding.ts +83 -0
  249. package/tests/fixtures/session-profile-v1/session-profile-disk-reader.ts +182 -0
  250. package/tests/fixtures/session-profile-v1/session-profile-freeze.ts +290 -0
  251. package/tests/fixtures/session-profile-v1/session-profile-persistence.ts +195 -0
  252. package/tests/fixtures/session-profile-v1/v1-inputs.ts +16 -0
  253. package/tests/fixtures/windows-pipe-availability.ps1 +26 -0
  254. package/tests/fixtures/windows-session-bootstrap.ps1 +6 -2
  255. package/tests/full-delegation-closure.test.ts +131 -0
  256. package/tests/full-delegation-notices.test.ts +76 -0
  257. package/tests/generic-agent-tools.test.ts +3 -3
  258. package/tests/gentle-agent-status.test.ts +74 -0
  259. package/tests/gentle-agents-child-jobs.test.ts +237 -0
  260. package/tests/gentle-agents.test.ts +1491 -38
  261. package/tests/gentle-ai-binary.test.ts +3 -1
  262. package/tests/gentle-ai-elapsed-store.test.ts +19 -0
  263. package/tests/gentle-ai-exploration-budget.test.ts +151 -0
  264. package/tests/gentle-ai-installer.test.ts +134 -51
  265. package/tests/gentle-ai-proxy.test.ts +434 -0
  266. package/tests/gentle-ai.test.ts +1101 -52
  267. package/tests/gentle-design.test.ts +21 -0
  268. package/tests/gentle-fast.test.ts +73 -0
  269. package/tests/gentle-guide.test.ts +208 -0
  270. package/tests/gentle-herdr-activity.test.ts +80 -3
  271. package/tests/gentle-herdr-agent.test.ts +111 -0
  272. package/tests/gentle-program-identity.test.ts +197 -0
  273. package/tests/gentle-shell-bin.test.ts +172 -26
  274. package/tests/gentle-shell-bundled.test.ts +207 -31
  275. package/tests/gentle-shell-launcher.test.ts +93 -10
  276. package/tests/gentle-shell.test.ts +1937 -66
  277. package/tests/gentle-stats.test.ts +15 -2
  278. package/tests/gentle-todo.test.ts +67 -4
  279. package/tests/gentle-tps.test.ts +123 -0
  280. package/tests/gentle-ui-design-skill.test.ts +59 -0
  281. package/tests/herdr-busy.test.ts +59 -0
  282. package/tests/herdr-task-summary-policy.test.ts +132 -0
  283. package/tests/history-store-private-mode.test.ts +40 -0
  284. package/tests/image-disk-cache.test.ts +163 -0
  285. package/tests/image-paste-chips.test.ts +42 -0
  286. package/tests/independent-recovery-delivery.test.ts +83 -0
  287. package/tests/inprocess-reviewer.test.ts +298 -4
  288. package/tests/installer-posix-bootstrap.test.ts +68 -6
  289. package/tests/installer-preflight.test.ts +5 -4
  290. package/tests/installer-runner.test.ts +79 -44
  291. package/tests/installer-server.test.ts +14 -11
  292. package/tests/installer-windows-diagnostics.test.ts +4 -5
  293. package/tests/isolated-config-home.ts +28 -0
  294. package/tests/jobs-view.test.ts +260 -6
  295. package/tests/jobs-widget.test.ts +25 -37
  296. package/tests/keymaps-customize.test.ts +114 -0
  297. package/tests/keymaps.test.ts +103 -0
  298. package/tests/maintainer/mcp-status.maintest.ts +88 -0
  299. package/tests/maintainer/pi-update-source.maintest.ts +116 -0
  300. package/tests/modal-mouse-boundaries.test.ts +136 -0
  301. package/tests/model-fallback-notice.test.ts +45 -0
  302. package/tests/model-fallback-policy.test.ts +83 -0
  303. package/tests/model-fallback-store.test.ts +111 -0
  304. package/tests/model-routing-authority.test.ts +178 -2
  305. package/tests/nan-provider.test.ts +4 -4
  306. package/tests/native-choice-list.test.ts +77 -2
  307. package/tests/native-review-capability-contract.test.ts +7 -1
  308. package/tests/native-review-cli.test.ts +269 -1
  309. package/tests/no-self-pause-contract.test.ts +22 -0
  310. package/tests/notification-customize.test.ts +58 -34
  311. package/tests/odd-routing-canonical-ratchet.test.ts +6 -6
  312. package/tests/odd-routing-contract.test.ts +1 -1
  313. package/tests/orchestrator-budget.test.ts +7 -2
  314. package/tests/orchestrator-delegation-mode.test.ts +153 -0
  315. package/tests/orchestrator-fallback.test.ts +82 -0
  316. package/tests/orchestrator-mode-policy.test.ts +175 -0
  317. package/tests/orchestrator-prompt-budget.test.ts +133 -0
  318. package/tests/orchestrator-rdd-ownership.test.ts +2 -2
  319. package/tests/package-manifest.test.ts +169 -14
  320. package/tests/pasted-image-paths.test.ts +118 -0
  321. package/tests/permission-allowlist.test.ts +202 -0
  322. package/tests/persona-reply-language.test.ts +20 -1
  323. package/tests/pi-update-launcher.test.ts +40 -8
  324. package/tests/pi-update-source.test.ts +162 -0
  325. package/tests/pnpm-workspace-config.test.ts +58 -0
  326. package/tests/primary-session-prompt.test.ts +13 -0
  327. package/tests/profile-fast-tier.test.ts +311 -0
  328. package/tests/profile-pin.test.ts +29 -2
  329. package/tests/profile-tier-footer.test.ts +84 -0
  330. package/tests/profiles-panel-delegation-mode.test.ts +422 -0
  331. package/tests/questionnaire-view.test.ts +265 -0
  332. package/tests/quiet-bash-runtime.test.ts +1 -1
  333. package/tests/quiet-tool-rendering.test.ts +48 -0
  334. package/tests/rdd-aware-verification-contract.test.ts +16 -11
  335. package/tests/rdd-customize.test.ts +287 -0
  336. package/tests/rdd-mode-cache.test.ts +450 -0
  337. package/tests/rdd-mode-control.test.ts +407 -0
  338. package/tests/rdd-mode-scope-regression.test.ts +137 -0
  339. package/tests/rdd-off-independent-regression.test.ts +69 -0
  340. package/tests/rdd-status-line.test.ts +18 -0
  341. package/tests/render-cache-performance.test.ts +171 -2
  342. package/tests/reply-language-anchor.test.ts +173 -0
  343. package/tests/review-agent-end-preflight.test.ts +1 -1
  344. package/tests/review-blocker.test.ts +193 -0
  345. package/tests/review-candidate-owner-retry.test.ts +1 -1
  346. package/tests/review-candidate-owner-sweep.test.ts +93 -0
  347. package/tests/review-candidate-symlink-scan.test.ts +157 -0
  348. package/tests/review-candidate-view.test.ts +52 -1
  349. package/tests/review-candidate-windows-boundary.test.ts +131 -0
  350. package/tests/review-candidate-windows-probe.test.ts +63 -0
  351. package/tests/review-committed-restart-ack.test.ts +129 -0
  352. package/tests/review-continuation-registry.test.ts +76 -0
  353. package/tests/review-controller-native-routing.test.ts +381 -11
  354. package/tests/review-controller-workspace-root.test.ts +230 -3
  355. package/tests/review-controller.test.ts +96 -11
  356. package/tests/review-coordinator-runtime.test.ts +117 -0
  357. package/tests/review-coordinator.test.ts +195 -0
  358. package/tests/review-failure-facts.test.ts +87 -0
  359. package/tests/review-gate.test.ts +24 -0
  360. package/tests/review-host-relay-routing.test.ts +258 -4
  361. package/tests/review-host-relay.test.ts +39 -0
  362. package/tests/review-inspect-preflight.test.ts +197 -0
  363. package/tests/review-integration-v2-forward.test.ts +59 -0
  364. package/tests/review-integration-v2.test.ts +46 -3
  365. package/tests/review-json-arguments.test.ts +65 -10
  366. package/tests/review-last-event-closure.test.ts +68 -0
  367. package/tests/review-loadout-rdd-off-sdk.test.ts +65 -31
  368. package/tests/review-owner-identity.test.ts +60 -24
  369. package/tests/review-relay-phase-timing.test.ts +128 -0
  370. package/tests/review-relay-transport-agent.test.ts +12 -2
  371. package/tests/review-repository.test.ts +52 -1
  372. package/tests/review-reviewer-evidence.test.ts +183 -0
  373. package/tests/review-risk-assessment.test.ts +74 -3
  374. package/tests/review-session-standing-permission-controller.test.ts +21 -1
  375. package/tests/review-sidebar-state.test.ts +5 -5
  376. package/tests/review-start-context.test.ts +19 -0
  377. package/tests/review-tool-prose-budget.test.ts +121 -0
  378. package/tests/run-test-suite.test.ts +183 -6
  379. package/tests/runtime-harness.mjs +4 -1
  380. package/tests/sensitive-path-tools.test.ts +250 -0
  381. package/tests/session-profile-append-controller-pi.test.ts +60 -31
  382. package/tests/session-profile-append-controller.test.ts +63 -0
  383. package/tests/session-profile-authority.test.ts +259 -0
  384. package/tests/session-profile-binding.test.ts +34 -1
  385. package/tests/session-profile-disk-reader-pi.test.ts +58 -16
  386. package/tests/session-profile-extension.test.ts +615 -0
  387. package/tests/session-profile-freeze.test.ts +110 -2
  388. package/tests/session-profile-integration.test.ts +857 -0
  389. package/tests/session-profile-persistence.test.ts +57 -0
  390. package/tests/session-profile-v1-compat.test.ts +255 -0
  391. package/tests/shell-bar.test.ts +274 -72
  392. package/tests/shell-card.test.ts +13 -1
  393. package/tests/shell-page.test.ts +108 -0
  394. package/tests/shell-panel.test.ts +360 -0
  395. package/tests/shell-prompt.test.ts +54 -0
  396. package/tests/shell-render-cache.test.ts +5 -0
  397. package/tests/shell-sidebar-fullscreen.test.ts +13 -1
  398. package/tests/shell-sidebar-layout.test.ts +447 -44
  399. package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
  400. package/tests/shell-stats.test.ts +90 -0
  401. package/tests/shell-surface-transparent.test.ts +89 -0
  402. package/tests/shell-todo.test.ts +12 -0
  403. package/tests/shell-usage.test.ts +14 -0
  404. package/tests/skill-registry.test.ts +902 -2
  405. package/tests/star-prompt.test.ts +470 -0
  406. package/tests/startup-banner.test.ts +209 -2
  407. package/tests/startup-home-repo.test.ts +2 -0
  408. package/tests/support/review-coordinator-runtime.ts +69 -0
  409. package/tests/task-size-routing-contract.test.ts +50 -4
  410. package/tests/verifier-admission.test.ts +49 -0
  411. package/tests/verifier-settle-reminder.test.ts +281 -0
  412. package/tests/verify-first-launch-contract.test.ts +134 -8
  413. package/tests/verify-installer-tap.test.ts +57 -0
  414. package/tests/vim-editor-adapter.test.ts +2 -2
  415. package/tests/visual-customization-policy.test.ts +95 -8
  416. package/tests/visual-customize-view.test.ts +818 -9
  417. package/tests/visual-layout-preview.test.ts +42 -0
  418. package/tests/visual-profiles.test.ts +11 -0
  419. package/tests/voice-worker.test.ts +73 -2
  420. package/tests/windows-session-bootstrap.test.ts +105 -2
  421. package/tests/windows-session-transport.test.ts +126 -0
  422. package/tests/work-continuity-contract.test.ts +114 -0
  423. package/tests/writer-feature-document-admission.test.ts +92 -0
  424. package/tests/writer-surfaces.test.ts +12 -10
  425. package/tests/yolo-customize.test.ts +57 -15
  426. package/tests/yolo-mode-runtime.test.ts +4 -2
  427. package/tests/yolo-mode.test.ts +39 -20
  428. package/tests/yolo-session-policy.test.ts +270 -1
@@ -0,0 +1,175 @@
1
+ import assert from "node:assert/strict";
2
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import test, { after } from "node:test";
6
+
7
+ import { bindSessionProfile } from "../lib/session-profile-binding.ts";
8
+ import {
9
+ ORCHESTRATOR_MODE_ENV,
10
+ resolveOrchestratorMode,
11
+ } from "../lib/orchestrator-mode-policy.ts";
12
+
13
+ // ---------------------------------------------------------------------------
14
+ // full-delegation-mode S2/S7: the effective mode follows the live profile.
15
+ //
16
+ // Every case here exists because the mode is read on the hot path of a prompt
17
+ // build: it must never throw, never read a frozen startup snapshot, and never
18
+ // let an unrecognized override pass for a decision.
19
+ // ---------------------------------------------------------------------------
20
+
21
+ const roots: string[] = [];
22
+ function configHomeWithProfiles(profiles: unknown): string {
23
+ const home = mkdtempSync(join(tmpdir(), "gp-orch-mode-"));
24
+ roots.push(home);
25
+ if (profiles !== undefined) {
26
+ writeFileSync(join(home, "profiles.json"), typeof profiles === "string" ? profiles : JSON.stringify(profiles));
27
+ }
28
+ return home;
29
+ }
30
+ after(() => {
31
+ for (const root of roots) rmSync(root, { recursive: true, force: true });
32
+ });
33
+
34
+ function storeWith(workflow?: Record<string, unknown>): unknown {
35
+ return {
36
+ kind: "gentle-pi.agent_model_profiles",
37
+ version: 1,
38
+ active: "normal",
39
+ profiles: {
40
+ normal: { orchestrator: { model: "gpt-5.4" } },
41
+ "frontier-local": { orchestrator: { model: "claude-opus-4-6" } },
42
+ },
43
+ ...(workflow === undefined ? {} : { workflow }),
44
+ };
45
+ }
46
+
47
+ function bind(sessionId: string, profile: string): void {
48
+ bindSessionProfile(sessionId, profile, { orchestrator: { model: "gpt-5.4" } });
49
+ }
50
+
51
+ test("a session with no profile anywhere resolves to the organic default", () => {
52
+ const storeWithoutActive = {
53
+ kind: "gentle-pi.agent_model_profiles",
54
+ version: 1,
55
+ profiles: { normal: { orchestrator: { model: "gpt-5.4" } } },
56
+ };
57
+ const resolution = resolveOrchestratorMode({
58
+ cwd: process.cwd(),
59
+ configHome: configHomeWithProfiles(storeWithoutActive),
60
+ sessionId: "mode-none",
61
+ env: {},
62
+ });
63
+ assert.equal(resolution.mode, "organic");
64
+ assert.equal(resolution.source, "default");
65
+ assert.equal(resolution.profileName, undefined);
66
+ });
67
+
68
+ test("a session that never bound a profile inherits the global active profile's mode", () => {
69
+ const resolution = resolveOrchestratorMode({
70
+ cwd: process.cwd(),
71
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
72
+ sessionId: "mode-fresh",
73
+ env: {},
74
+ });
75
+ // `active` is "normal" in the fixture, which carries no workflow entry.
76
+ assert.equal(resolution.profileName, "normal");
77
+ assert.equal(resolution.mode, "organic");
78
+ assert.equal(resolution.source, "session_profile");
79
+ });
80
+
81
+ test("a bound profile in full delegation mode wins, and names itself as the source", () => {
82
+ bind("mode-full", "frontier-local");
83
+ const resolution = resolveOrchestratorMode({
84
+ cwd: process.cwd(),
85
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
86
+ sessionId: "mode-full",
87
+ env: {},
88
+ });
89
+ assert.equal(resolution.mode, "full-delegation");
90
+ assert.equal(resolution.source, "session_profile");
91
+ assert.equal(resolution.profileName, "frontier-local");
92
+ });
93
+
94
+ test("a profile without a workflow entry still decides, as organic", () => {
95
+ bind("mode-organic", "normal");
96
+ const resolution = resolveOrchestratorMode({
97
+ cwd: process.cwd(),
98
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
99
+ sessionId: "mode-organic",
100
+ env: {},
101
+ });
102
+ assert.equal(resolution.mode, "organic");
103
+ assert.equal(resolution.source, "session_profile");
104
+ assert.equal(resolution.profileName, "normal");
105
+ });
106
+
107
+ test("the bound profile is re-read on every call, so a live switch flips the mode both ways", () => {
108
+ const home = configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } }));
109
+ bind("mode-switch", "frontier-local");
110
+ const options = { cwd: process.cwd(), configHome: home, sessionId: "mode-switch", env: {} };
111
+ assert.equal(resolveOrchestratorMode(options).mode, "full-delegation");
112
+
113
+ // Switching to the organic profile restores today's rules on the next read.
114
+ bind("mode-switch", "normal");
115
+ assert.equal(resolveOrchestratorMode(options).mode, "organic");
116
+
117
+ // And back again, without any process restart.
118
+ bind("mode-switch", "frontier-local");
119
+ assert.equal(resolveOrchestratorMode(options).mode, "full-delegation");
120
+ });
121
+
122
+ test("the env override wins over the profile and says so", () => {
123
+ bind("mode-env", "normal");
124
+ const resolution = resolveOrchestratorMode({
125
+ cwd: process.cwd(),
126
+ configHome: configHomeWithProfiles(storeWith()),
127
+ sessionId: "mode-env",
128
+ env: { [ORCHESTRATOR_MODE_ENV]: "full-delegation" },
129
+ });
130
+ assert.equal(resolution.mode, "full-delegation");
131
+ assert.equal(resolution.source, "environment");
132
+ assert.equal(resolution.envValue, "full-delegation");
133
+ });
134
+
135
+ test("an unrecognized env value is reported but never honoured", () => {
136
+ bind("mode-env-bad", "frontier-local");
137
+ const resolution = resolveOrchestratorMode({
138
+ cwd: process.cwd(),
139
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
140
+ sessionId: "mode-env-bad",
141
+ env: { [ORCHESTRATOR_MODE_ENV]: "super-delegation" },
142
+ });
143
+ assert.equal(resolution.mode, "full-delegation");
144
+ assert.equal(resolution.source, "session_profile");
145
+ assert.equal(resolution.envValue, "super-delegation");
146
+ });
147
+
148
+ test("a missing, malformed or unreadable profiles store fails closed to organic", () => {
149
+ for (const store of [undefined, "{not json", { kind: "wrong" }]) {
150
+ bind("mode-broken", "frontier-local");
151
+ const resolution = resolveOrchestratorMode({
152
+ cwd: process.cwd(),
153
+ configHome: configHomeWithProfiles(store),
154
+ sessionId: "mode-broken",
155
+ env: {},
156
+ });
157
+ assert.equal(resolution.mode, "organic", `store=${JSON.stringify(store)}`);
158
+ // The profile layer was consulted and could not answer: that is a
159
+ // different situation from having no profile at all, and the report says so.
160
+ assert.equal(resolution.source, "session_profile");
161
+ assert.equal(resolution.profileName, "frontier-local");
162
+ }
163
+ });
164
+
165
+ test("a bound profile the store no longer defines resolves to organic instead of throwing", () => {
166
+ bind("mode-ghost", "deleted-profile");
167
+ const resolution = resolveOrchestratorMode({
168
+ cwd: process.cwd(),
169
+ configHome: configHomeWithProfiles(storeWith({ "frontier-local": { orchestratorMode: "full-delegation" } })),
170
+ sessionId: "mode-ghost",
171
+ env: {},
172
+ });
173
+ assert.equal(resolution.mode, "organic");
174
+ assert.equal(resolution.profileName, "deleted-profile");
175
+ });
@@ -0,0 +1,133 @@
1
+ import assert from "node:assert/strict";
2
+ import { createHash } from "node:crypto";
3
+ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
4
+ import { tmpdir } from "node:os";
5
+ import { dirname, join } from "node:path";
6
+ import { fileURLToPath, pathToFileURL } from "node:url";
7
+ import test, { after } from "node:test";
8
+ import {
9
+ createBashToolDefinition, createEditToolDefinition, createReadToolDefinition, createWriteToolDefinition,
10
+ getDocsPath, getExamplesPath, getReadmePath, loadSkillsFromDir,
11
+ } from "@earendil-works/pi-coding-agent";
12
+ import gentleAgents from "../extensions/gentle-agents.ts";
13
+ import { __testing } from "../extensions/gentle-ai.ts";
14
+ import { BACKGROUND_SUBAGENTS_FILE, BACKGROUND_SUBAGENTS_SCHEMA } from "../lib/background-subagents-policy.ts";
15
+ import { appendSystemPromptOnce } from "../lib/append-system-prompt.ts";
16
+
17
+ const root = join(import.meta.dirname, "..");
18
+ const assets = join(root, "assets");
19
+ const fixture = mkdtempSync(join(tmpdir(), "prompt-budget-"));
20
+ const policyDirectory = join(fixture, ".pi", "gentle-ai");
21
+ mkdirSync(policyDirectory, { recursive: true });
22
+ writeFileSync(join(policyDirectory, BACKGROUND_SUBAGENTS_FILE), JSON.stringify({ schema: BACKGROUND_SUBAGENTS_SCHEMA, policy: "off" }));
23
+ after(() => rmSync(fixture, { recursive: true, force: true }));
24
+ const core = __testing.renderOrchestratorPrompt(assets).replaceAll(assets, "/fixture/assets");
25
+
26
+ type Declaration = { name: string; description: string; parameters: unknown; promptSnippet?: string; promptGuidelines?: string[] };
27
+ const tools = new Map<string, Declaration>();
28
+ const pi = {
29
+ on() {}, registerCommand() {}, registerShortcut() {}, registerMessageRenderer() {}, registerEntryRenderer() {},
30
+ events: { on() {}, emit() {} },
31
+ registerTool(tool: Declaration) { tools.set(tool.name, tool); },
32
+ };
33
+ gentleAgents(pi as never, { GENTLE_PI_CONFIG_HOME: fixture }, { home: fixture, agentHome: fixture });
34
+ const names = ["orchestrator_session_id", "orchestrator_list", "subagent_run"];
35
+ const selected = names.map(name => {
36
+ const tool = tools.get(name);
37
+ assert.ok(tool, `missing registered tool ${name}`);
38
+ return { name: tool.name, description: tool.description, parameters: tool.parameters };
39
+ });
40
+ const declarationBytes = Buffer.byteLength(JSON.stringify(selected), "utf8");
41
+
42
+ function withoutDescriptions(value: unknown): unknown {
43
+ if (Array.isArray(value)) return value.map(withoutDescriptions);
44
+ if (value && typeof value === "object") {
45
+ return Object.fromEntries(Object.entries(value).filter(([key]) => key !== "description")
46
+ .map(([key, entry]) => [key, withoutDescriptions(entry)]));
47
+ }
48
+ return value;
49
+ }
50
+
51
+ test("rendered orchestrator core and selected declarations fit the byte budget", t => {
52
+ const prompt = Buffer.byteLength(core, "utf8");
53
+ const total = prompt + declarationBytes;
54
+ t.diagnostic(`rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
55
+ // Issue #2935 (user decision): 16,600 -> 16,700 B with the canonical core budget raise to 9,350 B,
56
+ // so the resolved-skill-read exception keeps the full confinement wording.
57
+ assert.ok(total <= 16700, `rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
58
+ });
59
+
60
+ // Pi 1.4 does not export its pure system assembler from the package root.
61
+ // Deliberately use its installed internal module for this test; a missing or
62
+ // changed seam must fail rather than silently falling back to a proxy.
63
+ test("fixed primary host system assembly fits the byte budget", async t => {
64
+ const dist = dirname(fileURLToPath(import.meta.resolve("@earendil-works/pi-coding-agent")));
65
+ const assembler = await import(pathToFileURL(join(dist, "core", "system-prompt.js")).href);
66
+ assert.equal(typeof assembler.buildSystemPrompt, "function", "Pi system assembler unavailable");
67
+ const activeTools = ["read", "bash", "edit", "write", ...names];
68
+ const harness = __testing.buildGentlePrompt("gentleman", fixture, activeTools, undefined, "tui");
69
+ assert.match(harness, /Background subagent policy: off/);
70
+ assert.match(harness, /Receipt-driven development: unknown \(native status unavailable\)/);
71
+ const review = __testing.readMirroredReviewContractFragment();
72
+ assert.ok(review, "verified mirrored review fragment must be present");
73
+ const { skills, diagnostics } = loadSkillsFromDir({ dir: join(root, "skills", "work-unit-commits"), source: "fixture" });
74
+ assert.equal(diagnostics.length, 0);
75
+ assert.equal(skills.length, 1);
76
+ const builtins = [createReadToolDefinition(fixture), createBashToolDefinition(fixture), createEditToolDefinition(fixture), createWriteToolDefinition(fixture)];
77
+ const registered = [...builtins, ...names.map(name => tools.get(name)!)];
78
+ const toolSnippets = Object.fromEntries(registered.filter(tool => tool.promptSnippet).map(tool => [tool.name, tool.promptSnippet]));
79
+ const toolGuidelines = Object.fromEntries(registered.filter(tool => tool.promptGuidelines).map(tool => [tool.name, tool.promptGuidelines]));
80
+ const options = { appendSystemPrompt: "" };
81
+ appendSystemPromptOnce(options, `\n\n${harness}`);
82
+ appendSystemPromptOnce(options, `\n\n${review}`);
83
+ const system: string = assembler.buildSystemPrompt({
84
+ cwd: fixture, selectedTools: activeTools, toolSnippets, toolGuidelines,
85
+ ...options, skills,
86
+ });
87
+ for (const [label, fragment] of [["harness", harness], ["review contract", review]]) {
88
+ assert.equal(system.split(fragment.replace(/^\n+/, "")).length - 1, 1, `complete ${label} must appear exactly once`);
89
+ }
90
+ const replacements: Array<[string, string]> = [
91
+ [getReadmePath(), "/fixture/pi/README.md"], [getDocsPath(), "/fixture/pi/docs"],
92
+ [getExamplesPath(), "/fixture/pi/examples"], [assets, "/fixture/assets"],
93
+ [join(root, "skills"), "/fixture/skills"], [fixture, "/fixture/cwd"],
94
+ [dirname(dist), "/fixture/pi"],
95
+ ];
96
+ let normalized = system;
97
+ for (const [path, replacement] of replacements) {
98
+ normalized = normalized.replaceAll(path, replacement).replaceAll(path.replaceAll("\\", "/"), replacement);
99
+ }
100
+ const bytes = Buffer.byteLength(normalized, "utf8");
101
+ t.diagnostic(`assembled system ${bytes} B; selected declarations ${declarationBytes} B`);
102
+ assert.ok(bytes <= 40000, `assembled system: ${bytes} B`);
103
+ });
104
+
105
+ test("fixed harness is independent of ambient background policy", () => {
106
+ const previous = process.env.GENTLE_PI_BACKGROUND_SUBAGENTS;
107
+ const activeTools = ["read", "bash", "edit", "write", ...names];
108
+ const rendered: string[] = [];
109
+ try {
110
+ for (const policy of ["off", "on"]) {
111
+ process.env.GENTLE_PI_BACKGROUND_SUBAGENTS = policy;
112
+ const harness = __testing.buildGentlePrompt("gentleman", fixture, activeTools, undefined, "tui");
113
+ assert.match(harness, /Background subagent policy: off/);
114
+ rendered.push(harness);
115
+ }
116
+ assert.equal(rendered[0], rendered[1]);
117
+ } finally {
118
+ if (previous === undefined) delete process.env.GENTLE_PI_BACKGROUND_SUBAGENTS;
119
+ else process.env.GENTLE_PI_BACKGROUND_SUBAGENTS = previous;
120
+ }
121
+ });
122
+
123
+ const schemaDigests: Record<string, string> = {
124
+ orchestrator_session_id: "5fb49381808a8dc1146d89409ba6237380b62c871282a99104770b24902589e0",
125
+ orchestrator_list: "fe50d306a023bfaf20fddeb8696a3e62b84534b02efb6d699f9991b129a709fa",
126
+ subagent_run: "02e15acc80fde692b0e7ceab434c248b733f33783b176606119969952cd16036",
127
+ };
128
+ for (const tool of selected) {
129
+ test(`${tool.name} schema retains its non-description contract`, () => {
130
+ const digest = createHash("sha256").update(JSON.stringify(withoutDescriptions(tool.parameters))).digest("hex");
131
+ assert.equal(digest, schemaDigests[tool.name]);
132
+ });
133
+ }
@@ -67,12 +67,12 @@ test("rendered parent prompt keeps the RDD boundary while omitting lifecycle mir
67
67
  // budget below must cover, not a smaller placeholder production later
68
68
  // exceeds. gentle-shell#1731 T10 (user decision): budget 8,192 -> 8,400 B.
69
69
  // Verification by named risk and the writer-rule fix: 8,400 -> 9,100 B; weak-model economy: 9,100 -> 9,250 B
70
- // (the canonical budget in orchestrator-budget.test.ts).
70
+ // issue #2935 (user decision): 9,250 -> 9,350 B (the canonical budget in orchestrator-budget.test.ts).
71
71
  assert.ok(
72
72
  rendered.includes("Receipt-driven development: unknown (native status unavailable)"),
73
73
  "the default render must include the worst-case RDD status line",
74
74
  );
75
- assert.ok(Buffer.byteLength(rendered, "utf8") <= 9250, "the rendered parent prompt must stay within the 9,250 B core budget");
75
+ assert.ok(Buffer.byteLength(rendered, "utf8") <= 9350, "the rendered parent prompt must stay within the 9,350 B core budget");
76
76
  });
77
77
 
78
78
  test("static prompts retain ODD and delegated-work guidance without SDD", () => {
@@ -1,6 +1,5 @@
1
1
  import assert from "node:assert/strict";
2
2
  import { parseNpmPackResult } from "../scripts/npm-pack-result.mjs";
3
- import { execFileSync } from "node:child_process";
4
3
  import { createHash } from "node:crypto";
5
4
  import {
6
5
  existsSync,
@@ -18,9 +17,10 @@ import ts from "typescript";
18
17
  import { fileURLToPath } from "node:url";
19
18
  import { applyModelConfig } from "../extensions/gentle-ai.ts";
20
19
  import { resolveGentlePiAgentHome } from "../lib/agent-home.ts";
21
- import { getPackageAssetOwner, installPackageAssets, type PackageAssetOwner } from "../lib/agent-assets.ts";
20
+ import { agentBody, getPackageAssetOwner, installPackageAssets, readAgentBodyHistory, type PackageAssetOwner } from "../lib/agent-assets.ts";
21
+ import { discoverAgents } from "../lib/agents-config.ts";
22
22
  import { AUDITED_PI_EDITOR_VERSIONS } from "../lib/vim-editor-adapter.ts";
23
- import { resolveProjectPiSdkVersion } from "../scripts/test-packed-runner.mjs";
23
+ import { resolveProjectPiSdkVersion, runNpmWithEnv } from "../scripts/test-packed-runner.mjs";
24
24
  // Package installation is owned by lib/agent-assets.ts, not the retired SDD preflight.
25
25
 
26
26
  const PACKAGE_ROOT = dirname(dirname(fileURLToPath(import.meta.url)));
@@ -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"];
64
+ const MANAGED_EXEMPLAR_TOOLS = ["read", "grep", "find", "codegraph", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content", "mcp__codegraph__codegraph_explore"];
65
65
  const RETIRED_ADVERSARIAL_AGENTS = ["review-refuter.md", "review-validator.md"];
66
66
 
67
67
  interface ManagedAssetsManifest {
@@ -431,20 +431,20 @@ 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.3.1 runtime pin", () => {
434
+ test("package verification binds the published Gentle AI v4.4.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\.3\.1"/);
439
+ assert.match(installer, /INSTALLER_VERSION = "4\.4\.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:00p8dnjJrhYFq1Qikk2oY6K\/UXIty9A\/IBUUOUiX9XA="/);
441
+ assert.match(installer, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM = "h1:cAQAzIsbocYcQfOzA1CmgGpGgiCivUNcPjdfJE8RJ6g="/);
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/);
445
445
  assert.match(binary, /GO_SUMDB_SOURCE_BUILD/);
446
446
  assert.match(binary, /GENTLE_AI_WINDOWS_SOURCE_MODULE_CHECKSUM/);
447
- assert.match(verifier, /v4\.3\.1/);
447
+ assert.match(verifier, /v4\.4\.0/);
448
448
  });
449
449
 
450
450
 
@@ -630,7 +630,7 @@ test("packaged agents use YAML list syntax for tool allowlists", () => {
630
630
  assert.doesNotMatch(
631
631
  frontmatter,
632
632
  /^tools:\s*[^\n,]+(?:,\s*[^\n,]+)+$/m,
633
- `${file} must not use comma-separated inline tools; pi-subagents expects a YAML list`,
633
+ `${file} must not use comma-separated inline tools; the agent runtime expects a YAML list`,
634
634
  );
635
635
  assert.match(
636
636
  frontmatter,
@@ -667,6 +667,46 @@ test("packaged agents declare only tool names a Pi child session can resolve", (
667
667
  }
668
668
  });
669
669
 
670
+ // The tool-allowlist marker that denies everything else. An allowlist already
671
+ // denies unlisted tools, so the runtime tolerates this entry by design: it is
672
+ // not a tool name and Pi drops it from --tools.
673
+ const DENY_ALL_TOOLS_MARKER = '"*": false';
674
+
675
+ // gentle-shell#62: the declared YAML list once collapsed into one malformed
676
+ // token on its way to the child, which then started without its filesystem
677
+ // tools. This walks the real path every packaged agent takes at runtime:
678
+ // install into an agent home, then discover and parse with the agent runtime,
679
+ // and compares what the runtime yields against what the file declares.
680
+ test("packaged agents reach the agent runtime with their declared tool allowlists", () => {
681
+ const agentsDir = join(PACKAGE_ROOT, "assets", "agents");
682
+ const agentFiles = readdirSync(agentsDir).flatMap((entry) =>
683
+ entry.endsWith(".md") ? [join(agentsDir, entry)] : [],
684
+ );
685
+ assert.ok(agentFiles.length > 0, "gentle-pi must ship packaged agents");
686
+
687
+ withIsolatedAssetHome((agentHome) => {
688
+ installPackageAssets(agentHome, false);
689
+ const empty = mkdtempSync(join(tmpdir(), "gentle-agent-roots-"));
690
+ try {
691
+ const { agents, errors } = discoverAgents({ cwd: empty, home: empty, agentHome });
692
+ assert.deepEqual(errors, [], "every packaged agent must parse through the agent runtime");
693
+ for (const file of agentFiles) {
694
+ const { name, tools: declared } = readAgentDefinition(file);
695
+ const agent = agents.find((candidate) => candidate.name === name);
696
+ assert.ok(agent, `${file} must be discovered by the agent runtime after installation`);
697
+ assert.deepEqual(
698
+ agent.tools.filter((tool) => tool !== DENY_ALL_TOOLS_MARKER),
699
+ declared,
700
+ `${file} must reach the runtime with exactly its declared tool allowlist`,
701
+ );
702
+ assert.ok(agent.tools.includes("read"), `${file} must keep read so the child can inspect files`);
703
+ }
704
+ } finally {
705
+ rmSync(empty, { recursive: true, force: true });
706
+ }
707
+ });
708
+ });
709
+
670
710
  function withIsolatedAssetHome(run: (agentHome: string) => void): void {
671
711
  const temporary = mkdtempSync(join(tmpdir(), "gentle-asset-owners-"));
672
712
  const previous = process.env.GENTLE_PI_AGENT_HOME;
@@ -704,6 +744,102 @@ test("ODD delegation assets retain applicable test-first checks and independent
704
744
  assert.match(worker, /review lifecycle.*parent/i);
705
745
  });
706
746
 
747
+ // A package agent whose frontmatter another tool rewrote (inline tools, model
748
+ // routing) once fell out of the manifest and froze on an outdated contract,
749
+ // such as the retired Strict TDD mode prompt.
750
+ test("forced refresh updates a frozen package agent with a shipped body and keeps its routing", () => {
751
+ withIsolatedAssetHome((agentHome) => {
752
+ const key = "agents/gentle-ai-worker.md";
753
+ const installedPath = join(agentHome, key);
754
+ const packaged = readFileSync(join(PACKAGE_ROOT, "assets", key), "utf8");
755
+ const stale = readFileSync(join(PACKAGE_ROOT, "tests/fixtures/agent-assets/gentle-ai-worker.strict-tdd-era.md"), "utf8");
756
+ const foreignFrontmatter = "---\nname: gentle-ai-worker\ndescription: Old description.\nmodel: openai/test-model\nthinking: max\ntools: read, grep, find, edit, write, bash, mem_save, mcp";
757
+ installPackageAssets(agentHome, false, ["delegation"]);
758
+ writeFileSync(installedPath, `${foreignFrontmatter}${agentBody(stale)}`);
759
+ const manifestPath = join(agentHome, "gentle-ai", "managed-assets.json");
760
+ const manifest = installedAssetManifest(agentHome);
761
+ delete manifest.assets[key];
762
+ writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
763
+
764
+ installPackageAssets(agentHome, true, ["delegation"]);
765
+ const refreshed = readFileSync(installedPath, "utf8");
766
+ assert.doesNotMatch(refreshed, /effective TDD mode/);
767
+ assert.equal(
768
+ refreshed,
769
+ packaged.replace(/^(description:.*)$/m, "$1\nmodel: openai/test-model\nthinking: max"),
770
+ );
771
+ assert.equal(installedAssetManifest(agentHome).assets[key], undefined, "a locally routed copy stays unmanaged");
772
+
773
+ installPackageAssets(agentHome, true, ["delegation"]);
774
+ assert.equal(readFileSync(installedPath, "utf8"), refreshed, "a second refresh must keep the routing");
775
+ });
776
+ });
777
+
778
+ test("forced refresh restores an old shipped agent without routing to the managed copy", () => {
779
+ withIsolatedAssetHome((agentHome) => {
780
+ const key = "agents/gentle-ai-worker.md";
781
+ const installedPath = join(agentHome, key);
782
+ const packaged = readFileSync(join(PACKAGE_ROOT, "assets", key), "utf8");
783
+ const stale = readFileSync(join(PACKAGE_ROOT, "tests/fixtures/agent-assets/gentle-ai-worker.strict-tdd-era.md"), "utf8");
784
+ installPackageAssets(agentHome, false, ["delegation"]);
785
+ writeFileSync(installedPath, stale.replace(/\ntools:\n(?: - .*\n)+/, "\ntools: read, grep, find, edit, write, bash, mem_save\n"));
786
+ const manifestPath = join(agentHome, "gentle-ai", "managed-assets.json");
787
+ const manifest = installedAssetManifest(agentHome);
788
+ manifest.assets[key] = sha256("stale");
789
+ writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
790
+
791
+ const result = installPackageAssets(agentHome, true, ["delegation"]);
792
+ assert.equal(readFileSync(installedPath, "utf8"), packaged);
793
+ assert.equal(installedAssetManifest(agentHome).assets[key], sha256(packaged));
794
+ assert.equal(result.skipped, 0);
795
+ });
796
+ });
797
+
798
+ // Only outdated instructions are refreshed: a frontmatter edit on the current
799
+ // agent (here a restricted tool allowlist) stays a user override.
800
+ test("forced refresh keeps a frontmatter edit on an agent with current instructions", () => {
801
+ withIsolatedAssetHome((agentHome) => {
802
+ const key = "agents/gentle-ai-worker.md";
803
+ const installedPath = join(agentHome, key);
804
+ installPackageAssets(agentHome, false, ["delegation"]);
805
+ const restricted = readFileSync(installedPath, "utf8").replace(" - bash\n", "");
806
+ writeFileSync(installedPath, restricted);
807
+
808
+ const result = installPackageAssets(agentHome, true, ["delegation"]);
809
+ assert.equal(readFileSync(installedPath, "utf8"), restricted);
810
+ assert.equal(installedAssetManifest(agentHome).assets[key], undefined);
811
+ assert.equal(result.skipped, 1);
812
+ });
813
+ });
814
+
815
+ test("agent body history records the body of every packaged agent", () => {
816
+ const history = readAgentBodyHistory();
817
+ const agentsDir = join(PACKAGE_ROOT, "assets", "agents");
818
+ for (const file of readdirSync(agentsDir).filter((name) => name.endsWith(".md"))) {
819
+ assert.ok(
820
+ history[`agents/${file}`]?.includes(sha256(agentBody(readFileSync(join(agentsDir, file), "utf8")))),
821
+ `assets/agents/${file} changed: run node scripts/update-agent-body-history.mjs`,
822
+ );
823
+ }
824
+ });
825
+
826
+ test("forced refresh still leaves agents with user-edited bodies in place", () => {
827
+ withIsolatedAssetHome((agentHome) => {
828
+ const key = "agents/gentle-ai-worker.md";
829
+ const installedPath = join(agentHome, key);
830
+ installPackageAssets(agentHome, false, ["delegation"]);
831
+ const edited = readFileSync(installedPath, "utf8")
832
+ .replace(/^(description:.*)$/m, "$1\nmodel: openai/test-model")
833
+ .concat("\nUser-authored instruction.\n");
834
+ writeFileSync(installedPath, edited);
835
+
836
+ const result = installPackageAssets(agentHome, true, ["delegation"]);
837
+ assert.equal(readFileSync(installedPath, "utf8"), edited);
838
+ assert.equal(installedAssetManifest(agentHome).assets[key], undefined);
839
+ assert.equal(result.skipped, 1);
840
+ });
841
+ });
842
+
707
843
  test("delegation installation retains strict TDD support without installing SDD assets", () => {
708
844
  withIsolatedAssetHome((agentHome) => {
709
845
  installPackageAssets(agentHome, false, ["delegation"]);
@@ -903,12 +1039,29 @@ test("native windows audio ships an owned encoded-command adapter without script
903
1039
  assert.doesNotMatch(source, /postinstall|installer|download/i, path);
904
1040
  });
905
1041
 
1042
+ test("shell-free npm helper preserves packed tarball arguments and options", () => {
1043
+ const source = readFileSync(join(PACKAGE_ROOT, "tests", "package-manifest.test.ts"), "utf8");
1044
+ const runner = readFileSync(join(PACKAGE_ROOT, "scripts", "test-packed-runner.mjs"), "utf8");
1045
+ const tarball = source.split('\ntest("packed tarball excludes retired workflow paths')[1]?.split('\n});')[0] ?? "";
1046
+ assert.match(source, /import \{[^}]*runNpmWithEnv[^}]*\} from "\.\.\/scripts\/test-packed-runner\.mjs"/);
1047
+ assert.match(tarball, /runNpmWithEnv\(\["pack", "--ignore-scripts", "--offline", "--json", "--pack-destination", destination\], process\.env, \{/);
1048
+ assert.match(tarball, /cwd: PACKAGE_ROOT/);
1049
+ assert.match(tarball, /encoding: "utf8"/);
1050
+ assert.match(tarball, /maxBuffer: 8 \* 1024 \* 1024/);
1051
+ assert.doesNotMatch(tarball, /execFileSync|shell\s*:\s*true/);
1052
+ assert.match(runner, /export function runNpmWithEnv\(/);
1053
+ const helper = readNamedFunction(runner, "runNpmWithEnv");
1054
+ assert.match(helper, /process\.platform === "win32" \? windowsNpmInvocation\(\) : \{ file: "npm", prefix: \[\] \}/);
1055
+ assert.match(helper, /execFileSync\(invocation\.file, \[\.\.\.invocation\.prefix, \.\.\.arguments_\], \{ \.\.\.options, env \}\)/);
1056
+ assert.doesNotMatch(helper, /shell\s*:\s*true|cmd\.exe|npm\.cmd/);
1057
+ });
1058
+
906
1059
  test("packed tarball excludes retired workflow paths while source retains legacy migration proof", () => {
907
1060
  const fixture = "tests/fixtures/legacy/sdd-research-v2.5.0.md";
908
1061
  assert.ok(existsSync(join(PACKAGE_ROOT, fixture)), "the historical source fixture must remain available to migration tests");
909
1062
  const destination = mkdtempSync(join(tmpdir(), "gentle-pi-pack-manifest-"));
910
1063
  try {
911
- const output = execFileSync("npm", ["pack", "--ignore-scripts", "--offline", "--json", "--pack-destination", destination], {
1064
+ const output = runNpmWithEnv(["pack", "--ignore-scripts", "--offline", "--json", "--pack-destination", destination], process.env, {
912
1065
  cwd: PACKAGE_ROOT,
913
1066
  encoding: "utf8",
914
1067
  maxBuffer: 8 * 1024 * 1024,
@@ -1431,6 +1584,7 @@ test("gentle-ai-worker packages the exact scoped writer contract", () => {
1431
1584
  "write",
1432
1585
  "bash",
1433
1586
  "mem_save",
1587
+ "mcp__codegraph__codegraph_explore",
1434
1588
  ]);
1435
1589
  assert.ok(
1436
1590
  tools.every((tool) => !tool.startsWith("subagent_")),
@@ -1550,6 +1704,7 @@ test("package installation gives gentle-ai-worker a loader-compatible scoped ide
1550
1704
  "write",
1551
1705
  "bash",
1552
1706
  "mem_save",
1707
+ "mcp__codegraph__codegraph_explore",
1553
1708
  ]);
1554
1709
  assert.doesNotMatch(
1555
1710
  readAgentFrontmatter(installedAgentPath),
@@ -1673,8 +1828,8 @@ test("global model routing uses PI_CODING_AGENT_DIR for package-installed agents
1673
1828
  test("normal and forced installation copy generic agents with complete role contracts", () => {
1674
1829
  const previousAgentHome = process.env.GENTLE_PI_AGENT_HOME;
1675
1830
  const expectedTools = {
1676
- "gentle-ai-explore": ["read", "grep", "find", "codegraph", "web_enable", "web_search", "source_check", "fetch_content", "get_search_content"],
1677
- "gentle-ai-verify": ["read", "grep", "find", "bash"],
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"],
1678
1833
  } as const;
1679
1834
 
1680
1835
  try {
@@ -1793,9 +1948,9 @@ test("pi-pretty wrapper uses cached ESM loading for compiled and pnpm symlink in
1793
1948
  assert.match(wrapper, /quietToolsEnabled/);
1794
1949
  });
1795
1950
 
1796
- test("Gentle Shell v4.5.1 package manifest declares the release version", () => {
1951
+ test("Gentle Shell v4.7.0 package manifest declares the release version", () => {
1797
1952
  const packageJson = readPackageJson();
1798
- assert.equal(packageJson.version, "4.5.1", "the release manifest must be explicitly pinned to v4.5.1");
1953
+ assert.equal(packageJson.version, "4.7.0", "the release manifest must be explicitly pinned to v4.7.0");
1799
1954
  assert.equal(packageJson.scripts?.test, "node scripts/run-test-suite.mjs");
1800
1955
  assert.ok(packageJson.files?.includes("assets/"));
1801
1956
  assert.ok(packageJson.files?.includes("contracts/"));