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,47 @@
1
+ import type { VISUAL_SECTION_KEYS, VisualSettings } from "./visual-customization-policy.ts";
2
+
3
+ // A four-line schematic of the fullscreen layout for the Customize preview:
4
+ // where the header and the input go, whether Status is a rail, a bottom bar
5
+ // or hidden, and which rail sections the settings show.
6
+
7
+ const MAIN = 26;
8
+ const RAIL = 22;
9
+ /** Rail sections in rail order, named as the rail labels them. */
10
+ const RAIL_SECTIONS: ReadonlyArray<[(typeof VISUAL_SECTION_KEYS)[number], string]> = [["todo", "todos"], ["agents", "agents"], ["changes", "changes"], ["rdd", "review"], ["stats", "stats"]];
11
+
12
+ const fill = (text: string, width: number) => (text.length > width ? text.slice(0, width - 1) + "…" : text + " ".repeat(width - text.length));
13
+ const rule = (label: string, width: number) => (label ? `─ ${label} ` : "").padEnd(width, "─").slice(0, width);
14
+
15
+ export function layoutSchematic(settings: VisualSettings): string {
16
+ const rail = settings.statusPlacement === "right" || settings.statusPlacement === "auto";
17
+ // A split header draws its title row on top and its counters in a bottom status bar.
18
+ const split = settings.headerPlacement === "split";
19
+ const top = settings.headerPlacement === "top" || split;
20
+ // Two rail rows, filled word by word in rail order.
21
+ const railRows = ["", ""];
22
+ let row = 0;
23
+ for (const [key, name] of RAIL_SECTIONS) {
24
+ if (!settings.visibility[key]) continue;
25
+ const next = railRows[row] ? `${railRows[row]} ${name}` : name;
26
+ if (next.length > RAIL - 1 && row === 0) { row = 1; railRows[1] = name; }
27
+ else railRows[row] = next;
28
+ }
29
+ // With a rail, below-input places the bar below both columns, like split.
30
+ const input = top || rail ? "› input" : "› input · header";
31
+ const main = ["conversation", input];
32
+ const width = MAIN + (rail ? RAIL + 1 : 0);
33
+ const railBottomBar = rail && (split || !top);
34
+ const bottom = settings.statusPlacement === "bottom" || railBottomBar ? "status bar" : settings.statusPlacement === "auto" ? "bar under 140 cols" : "";
35
+ if (rail) {
36
+ return [
37
+ top ? `┌${rule(split ? "title" : "header", width)}┐` : `┌${rule("", MAIN)}┬${rule("Status", RAIL)}┐`,
38
+ ...main.map((text, line) => `│ ${fill(text, MAIN - 1)}│ ${fill(railRows[line] ?? "", RAIL - 1)}│`),
39
+ railBottomBar ? `└${rule(bottom, width)}┘` : `└${rule(bottom, MAIN)}┴${"─".repeat(RAIL)}┘`,
40
+ ].join("\n");
41
+ }
42
+ return [
43
+ `┌${rule(top ? "header" : "", width)}┐`,
44
+ ...main.map((text) => `│ ${fill(text, width - 1)}│`),
45
+ `└${rule(bottom, width)}┘`,
46
+ ].join("\n");
47
+ }
@@ -3,7 +3,7 @@ import { constants as fsConstants, closeSync, fstatSync, lstatSync, mkdirSync, o
3
3
  import { join } from "node:path";
4
4
  import { gentlePiConfigHome } from "./agent-home.ts";
5
5
  import { ANIMATION_POLICY, type AnimationPolicy } from "./animation-policy.ts";
6
- import { isVisualSettings, normalizeVisualSettings, type VisualSettings } from "./visual-customization-policy.ts";
6
+ import { isVisualSettings, normalizeVisualSettings, storedVisualSettings, type VisualSettings } from "./visual-customization-policy.ts";
7
7
  import type { BannerConfig } from "../extensions/startup-banner.ts";
8
8
 
9
9
  export const VISUAL_PROFILES_SCHEMA = "gentle-pi.visual-profiles/v1";
@@ -155,7 +155,7 @@ function existing(options: Options): VisualProfile[] {
155
155
  function write(profiles: VisualProfile[], options: Options): string {
156
156
  const home = options.gentlePiConfigHome ?? gentlePiConfigHome();
157
157
  const path = join(home, "visual-profiles.json");
158
- const data = `${JSON.stringify({ schema: VISUAL_PROFILES_SCHEMA, profiles })}\n`;
158
+ const data = `${JSON.stringify({ schema: VISUAL_PROFILES_SCHEMA, profiles: profiles.map((profile) => ({ ...profile, visual: storedVisualSettings(profile.visual) })) })}\n`;
159
159
  if (Buffer.byteLength(data) > MAX_BYTES) {
160
160
  throw new RangeError("Visual profiles exceed 256 KB.");
161
161
  }
@@ -47,6 +47,7 @@ export type WindowsSessionTransportHostOptions = Readonly<{
47
47
  callback?: WindowsHostCallback;
48
48
  rpcDeadlineMs?: number;
49
49
  startupDeadlineMs?: number;
50
+ onBootstrapDiagnostic?: WindowsSessionBootstrapDiagnosticObserver;
50
51
  }>;
51
52
  export type WindowsSessionRegistryPhase = "start" | "initialize" | "cleanup";
52
53
  export type WindowsSessionStartupMarker = "script-entered" | "native-ready";
@@ -55,6 +56,24 @@ export type WindowsSessionRegistryPhaseError = Readonly<{ class: "timed-out" | "
55
56
  /** Receives one fixed, synchronous result event for an operation on this registry's own host. */
56
57
  export type WindowsSessionRegistryPhaseEvent = Readonly<{ phase: WindowsSessionRegistryPhase; status: "succeeded" | "failed"; error: WindowsSessionRegistryPhaseError | null; lastStartupMarker: WindowsSessionStartupMarker | null }>;
57
58
  export type WindowsSessionRegistryPhaseObserver = (event: WindowsSessionRegistryPhaseEvent) => undefined;
59
+ const bootstrapDiagnosticCategories = ["compiler", "argument", "invalid-operation", "not-supported", "security", "assembly-load", "type-load", "other"] as const;
60
+ const bootstrapRejectionStages = ["volume-open", "ancestor-open", "routing-open", "transport-create-or-open", "transport-assert-owned", "presence-create-or-open", "presence-assert-owned", "unknown"] as const;
61
+ /** A fixed code derived from the helper's known bootstrap stderr markers; no stderr text, path, SID, or status crosses it. */
62
+ export type WindowsSessionBootstrapDiagnosticCode = `diagnostic-${typeof bootstrapDiagnosticCategories[number]}` | `rejection-${typeof bootstrapRejectionStages[number]}`;
63
+ export type WindowsSessionBootstrapDiagnosticObserver = (code: WindowsSessionBootstrapDiagnosticCode) => undefined;
64
+ const bootstrapDiagnosticCodes: ReadonlySet<string> = new Set([...bootstrapDiagnosticCategories.map((category) => `diagnostic-${category}`), ...bootstrapRejectionStages.map((stage) => `rejection-${stage}`)]);
65
+ export const isWindowsSessionBootstrapDiagnosticCode = (value: unknown): value is WindowsSessionBootstrapDiagnosticCode => typeof value === "string" && bootstrapDiagnosticCodes.has(value);
66
+ /** Classify one helper stderr line. Anything but an exact known marker is dropped. */
67
+ function classifyBootstrapStderr(line: string): WindowsSessionBootstrapDiagnosticCode | undefined {
68
+ let value: unknown;
69
+ try { value = JSON.parse(line); } catch { return undefined; }
70
+ if (!plainRecord(value) || Object.getPrototypeOf(value) !== Object.prototype) return undefined;
71
+ const keys = Object.keys(value).sort().join(",");
72
+ let code: string | undefined;
73
+ if (value.kind === "windows-session-bootstrap-diagnostic" && keys === "category,compilerCodes,kind,languageMode,reason") code = `diagnostic-${String(value.category)}`;
74
+ else if (value.kind === "windows-session-bootstrap-rejection" && keys === "kind,ntstatus,stage") code = `rejection-${String(value.stage)}`;
75
+ return isWindowsSessionBootstrapDiagnosticCode(code) ? code : undefined;
76
+ }
58
77
  export type WindowsSessionRegistryObservation = Readonly<{
59
78
  availability: "unavailable" | "observed";
60
79
  provenance: "unavailable" | "ambiguous" | "owned-instance";
@@ -253,6 +272,10 @@ export class WindowsSessionTransportHost {
253
272
  private started?: Promise<void>;
254
273
  private startupMarker: WindowsSessionStartupMarker | null = null;
255
274
  private startupReplyObserved = false;
275
+ private readonly onBootstrapDiagnostic?: WindowsSessionBootstrapDiagnosticObserver;
276
+ private bootstrapDiagnosticCode: WindowsSessionBootstrapDiagnosticCode | null = null;
277
+ private diagnosticOutput = Buffer.alloc(0);
278
+ private diagnosticOverflow = false;
256
279
  private sequence = 0;
257
280
  private output = Buffer.alloc(0);
258
281
  private readonly pending = new Map<string, Pending>();
@@ -279,6 +302,7 @@ export class WindowsSessionTransportHost {
279
302
  private readonly onStdoutError = () => this.abort("Windows transport host unavailable", true, "stream");
280
303
  private readonly onStdinError = () => this.abort("Windows transport host unavailable", true, "stream");
281
304
  private readonly onStderrError = () => this.abort("Windows transport host unavailable", true, "stream");
305
+ private readonly onStderrData = (chunk: Buffer) => this.onDiagnosticOutput(chunk);
282
306
  private readonly onChildError = () => this.abort("Windows transport host unavailable", true, "process");
283
307
  private readonly onChildExit = () => this.abort("Windows transport host exited", false, "exit");
284
308
  private readonly onChildClose = () => this.handleChildClose();
@@ -291,11 +315,14 @@ export class WindowsSessionTransportHost {
291
315
  this.callback = options.callback;
292
316
  this.deadline = options.rpcDeadlineMs ?? RPC_DEADLINE_MS;
293
317
  this.startupDeadline = options.startupDeadlineMs ?? STARTUP_DEADLINE_MS;
318
+ this.onBootstrapDiagnostic = options.onBootstrapDiagnostic;
294
319
  if (!Number.isInteger(this.deadline) || this.deadline < 1 || this.deadline > RPC_DEADLINE_MS) throw new RangeError("invalid Windows transport deadline");
295
320
  if (!Number.isInteger(this.startupDeadline) || this.startupDeadline < 1 || this.startupDeadline > STARTUP_DEADLINE_MS) throw new RangeError("invalid Windows transport startup deadline");
296
321
  }
297
322
 
298
323
  get lastStartupMarker() { return this.startupMarker; }
324
+ /** The first classified bootstrap stderr marker of this host, or null. */
325
+ get bootstrapDiagnostic() { return this.bootstrapDiagnosticCode; }
299
326
 
300
327
  start(): Promise<void> {
301
328
  if (this.started) return this.started;
@@ -307,6 +334,7 @@ export class WindowsSessionTransportHost {
307
334
  this.child.stdout.on("error", this.onStdoutError);
308
335
  this.child.stdin.on("error", this.onStdinError);
309
336
  this.child.stderr.on("error", this.onStderrError);
337
+ this.child.stderr.on("data", this.onStderrData);
310
338
  this.child.stderr.resume?.();
311
339
  this.child.once("error", this.onChildError);
312
340
  this.child.once("exit", this.onChildExit);
@@ -401,6 +429,27 @@ export class WindowsSessionTransportHost {
401
429
  this.startupMarker = marker;
402
430
  return true;
403
431
  }
432
+ // stderr is always consumed. Only the first exact known bootstrap marker becomes a
433
+ // fixed code; unknown, malformed, or oversized lines are dropped unread.
434
+ private onDiagnosticOutput(chunk: Buffer) {
435
+ if (!Buffer.isBuffer(chunk)) return;
436
+ const output = this.diagnosticOutput.length === 0 ? chunk : Buffer.concat([this.diagnosticOutput, chunk]);
437
+ let offset = 0;
438
+ for (let newline = output.indexOf(10, offset); newline >= 0; newline = output.indexOf(10, offset)) {
439
+ const bytes = output.subarray(offset, newline);
440
+ offset = newline + 1;
441
+ const overflowed = this.diagnosticOverflow;
442
+ this.diagnosticOverflow = false;
443
+ if (overflowed || this.bootstrapDiagnosticCode !== null || bytes.length > MAX_CONTROL_BYTES) continue;
444
+ const code = classifyBootstrapStderr(bytes.toString("utf8").replace(/\r$/, ""));
445
+ if (!code) continue;
446
+ this.bootstrapDiagnosticCode = code;
447
+ try { this.onBootstrapDiagnostic?.(code); } catch { /* an observer never disturbs the helper */ }
448
+ }
449
+ const partial = output.subarray(offset);
450
+ if (partial.length > MAX_CONTROL_BYTES) { this.diagnosticOverflow = true; this.diagnosticOutput = Buffer.alloc(0); }
451
+ else this.diagnosticOutput = Buffer.from(partial);
452
+ }
404
453
  private onOutput(chunk: Buffer) {
405
454
  if (!Buffer.isBuffer(chunk)) { this.abort("Windows transport host unavailable", true, "protocol"); return; }
406
455
  const output = this.output.length === 0 ? chunk : Buffer.concat([this.output, chunk]);
@@ -487,6 +536,7 @@ export class WindowsSessionTransportHost {
487
536
  child.stdout.removeListener("error", this.onStdoutError);
488
537
  child.stdin.removeListener("error", this.onStdinError);
489
538
  child.stderr.removeListener("error", this.onStderrError);
539
+ child.stderr.removeListener("data", this.onStderrData);
490
540
  child.removeListener("error", this.onChildError);
491
541
  child.removeListener("exit", this.onChildExit);
492
542
  if (!keepClose) child.removeListener("close", this.onChildClose);
@@ -511,6 +561,7 @@ export class WindowsSessionTransportHost {
511
561
  this.rejectCleanup = undefined;
512
562
  this.cleanup = undefined;
513
563
  this.output = Buffer.alloc(0);
564
+ this.diagnosticOutput = Buffer.alloc(0);
514
565
  this.child = undefined;
515
566
  resolve?.();
516
567
  }
@@ -643,11 +694,11 @@ export class WindowsSessionPresenceRegistry {
643
694
  this.observer = observer;
644
695
  this.host.setListenerFailure((generation) => this.listenerFailure?.(generation));
645
696
  }
646
- static async create(agentHome: string, observePhase?: WindowsSessionRegistryPhaseObserver) {
697
+ static async create(agentHome: string, observePhase?: WindowsSessionRegistryPhaseObserver, observeBootstrap?: WindowsSessionBootstrapDiagnosticObserver) {
647
698
  if (process.platform !== "win32") throw new SessionPresenceError("io_error", "transport I/O failed");
648
699
  if (typeof agentHome !== "string" || !/^[A-Za-z]:\\/.test(agentHome)) throw new SessionPresenceError("unsafe_path", "unsafe transport path");
649
700
  let registry: WindowsSessionPresenceRegistry | undefined;
650
- const host = new WindowsSessionTransportHost({ callback: async (notification) => registry?.notification?.(notification) ?? false });
701
+ const host = new WindowsSessionTransportHost({ callback: async (notification) => registry?.notification?.(notification) ?? false, onBootstrapDiagnostic: observeBootstrap });
651
702
  const observer = observePhase === undefined ? undefined : new WindowsSessionRegistryObserver(observePhase, () => host.lastStartupMarker);
652
703
  const run = <T>(phase: WindowsSessionRegistryPhase, operation: () => Promise<T>) => observer ? observer.run(phase, operation) : operation();
653
704
  try {
@@ -1,4 +1,6 @@
1
1
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
2
+ import { Text, type TUI } from "@earendil-works/pi-tui";
3
+ import { sidebarState } from "./shell-sidebar.ts";
2
4
  import { appendSystemPromptOnce, type AppendableSystemPromptOptions } from "./append-system-prompt.ts";
3
5
  import { sameReviewSessionIdentity, resolveCanonicalGitRepositoryIdentity, type ReviewSessionIdentity } from "./review-session-standing-permission.ts";
4
6
  import { realpath } from "node:fs/promises";
@@ -14,11 +16,12 @@ export const SUPER_YOLO_STATUS_TEXT = "💥 SUPER YOLO ON — no permission prom
14
16
  export const SUPER_YOLO_DIRECTIVE = `<gentle-super-yolo-session>
15
17
  SUPER YOLO session standing permission is ON, authorized by the human for this live primary session and canonical workspace. No permission questions are asked in this mode: proceed through ordinary and destructive shell work (including rm, resets, force operations and configured-guard confirmations) without confirmation dialogs, and make implementation and delivery choices directly.
16
18
  The ONLY hard line is private material: never read, print, copy, transmit or commit secrets or private credentials — .env files, .ssh, keychains, *.pem/*.key/*.p12/*.pfx, secrets/ directories, cloud credential files. If a task seems to need them, stop and ask the human.
17
- This does NOT override explicit human restrictions in the live conversation, and never auto-answers ask_user tools, provider consent, maintenance/recovery authorization or opaque-token decisions. Children remain bounded by their delegated task; they receive no independent delivery grant or Super Yolo inheritance.
19
+ This does NOT override explicit human restrictions in the live conversation, and never auto-answers permission-mode selections, ask_user tools, provider consent, maintenance/recovery authorization or opaque-token decisions. Children remain bounded by their delegated task; they receive no independent delivery grant or Super Yolo inheritance.
18
20
  </gentle-super-yolo-session>`;
19
21
  export const YOLO_DIRECTIVE = `<gentle-yolo-session>
20
22
  YOLO session standing permission is ON, authorized by the human for this live primary session and canonical workspace (directly or through a trusted global default).
21
23
  Qualify the default commit, push and PR confirmation clauses: for ordinary already-scoped implementation, checks, commits, non-force pushes and PR creation, this activation supplies standing permission instead of repeated permission questions. Make ordinary reversible implementation choices without needless interviews.
24
+ Quoted, cited, logged or analyzed destructive text is not an execution: the mandatory destructive confirmations apply only to commands this session actually runs, never to destructive commands appearing inside issue bodies, file contents, documentation, transcripts or command output. Reading and listing non-sensitive material outside the workspace — including Gentle AI's own skills, docs and configuration — is covered by this standing permission; do not ask permission for those reads. Sensitive-path and private-credential blocks still win.
22
25
  This does NOT override explicit human restrictions, repository policy, project trust, configured confirmations or blocks, or the authorized task scope. Ask before scope expansion, privacy-sensitive disclosure, genuinely unresolved consequential product choices, or ambiguous destinations or credentials. Never invent destinations or credentials.
23
26
  Destructive/data-loss confirmations remain mandatory and independent. Never auto-answer ask_user tools, provider consent, maintenance/recovery authorization or opaque-token decisions. Review standing permission and RDD are unchanged. Children remain bounded by their delegated task; they receive no independent delivery grant or YOLO inheritance.
24
27
  </gentle-yolo-session>`;
@@ -55,6 +58,12 @@ export function updateYoloPrompt(options: AppendableSystemPromptOptions | null |
55
58
  if (superActive) appendSystemPromptOnce(options, SUPER_YOLO_DIRECTIVE);
56
59
  else if (active) appendSystemPromptOnce(options, YOLO_DIRECTIVE);
57
60
  }
61
+ const MODE_CHOICES: ReadonlyArray<{ mode: PermissionMode; label: string }> = [
62
+ { mode: "normal", label: "normal — standard permission prompts" },
63
+ { mode: "auto", label: "auto — independent checks; extra model calls" },
64
+ { mode: "yolo", label: "yolo — scoped work; destructive actions ask" },
65
+ { mode: "super-yolo", label: "super-yolo — no permission prompts; private paths blocked; consent remains" },
66
+ ];
58
67
  const HUMAN_ACTION = { on: "on", off: "off", toggle: "" } as const;
59
68
  type HumanAction = (typeof HUMAN_ACTION)[keyof typeof HUMAN_ACTION];
60
69
  export const YOLO_DISPLAY = { on: "ON", off: "OFF", unavailable: "UNAVAILABLE" } as const;
@@ -92,6 +101,27 @@ export function discoverYoloUiAdapter(pi: ExtensionAPI, context: ExtensionContex
92
101
  catch { settled = true; clearTimeout(timer); resolve(undefined); }
93
102
  });
94
103
  }
104
+ /**
105
+ * The above-editor YOLO banner: the same padded text Pi draws for a string
106
+ * widget, painted nothing while the IDE chrome's status bar already shows the
107
+ * permission mode (sidebarState(tui).statusBarShowsMode).
108
+ */
109
+ /**
110
+ * The banner as a widget: the terminal UI gets the component that steps aside
111
+ * behind the status bar; every other host (RPC forwards only string widgets,
112
+ * e.g. the desktop app) keeps the plain string widget.
113
+ */
114
+ export function yoloBannerContent(mode: string | undefined, text: string): string[] | ReturnType<typeof yoloBanner> {
115
+ return mode === "tui" ? yoloBanner(text) : [text];
116
+ }
117
+
118
+ function yoloBanner(text: string) {
119
+ return (tui: TUI) => {
120
+ const banner = new Text(text, 1, 0);
121
+ const quiet = () => Boolean((tui as { terminal?: unknown }).terminal && sidebarState(tui).statusBarShowsMode?.());
122
+ return { render: (width: number) => (quiet() ? [] : banner.render(width)), invalidate: () => banner.invalidate() };
123
+ };
124
+ }
95
125
  export interface YoloSessionController {
96
126
  active(context: ExtensionContext): Promise<boolean>;
97
127
  superActive(context: ExtensionContext): Promise<boolean>;
@@ -108,6 +138,8 @@ interface ModeIdentity {
108
138
  id: string;
109
139
  workspace: string;
110
140
  }
141
+ const sameModeIdentity = (left: ModeIdentity, right: ModeIdentity): boolean =>
142
+ left.manager === right.manager && left.id === right.id && left.workspace === right.workspace;
111
143
  /** UI/slash authoring only. Defaults are read from the dedicated trusted user store. */
112
144
  export function registerYoloSessionPolicy(pi: ExtensionAPI, env: NodeJS.ProcessEnv,
113
145
  options: { onChange?: () => void; resolveIdentity?: typeof resolveCanonicalGitRepositoryIdentity } = {}): YoloSessionController {
@@ -153,7 +185,11 @@ export function registerYoloSessionPolicy(pi: ExtensionAPI, env: NodeJS.ProcessE
153
185
  if (previous && previous.yolo === yolo && previous.modeText === modeText) return;
154
186
  let painted = true;
155
187
  try { ctx.ui.setStatus(YOLO_STATUS_KEY, yolo); } catch { painted = false; /* display only */ }
156
- try { ctx.ui.setWidget(YOLO_STATUS_KEY, yolo ? [yolo] : undefined); } catch { painted = false; /* display only */ }
188
+ try {
189
+ const banner = yolo ? yoloBannerContent(ctx.mode, yolo) : undefined;
190
+ if (typeof banner === "function") ctx.ui.setWidget(YOLO_STATUS_KEY, banner);
191
+ else ctx.ui.setWidget(YOLO_STATUS_KEY, banner);
192
+ } catch { painted = false; /* display only */ }
157
193
  try { ctx.ui.setStatus(MODE_STATUS_KEY, modeText); } catch { painted = false; /* display only */ }
158
194
  if (painted) published.set(ctx, { yolo, modeText });
159
195
  };
@@ -192,6 +228,9 @@ export function registerYoloSessionPolicy(pi: ExtensionAPI, env: NodeJS.ProcessE
192
228
  finally { pendingCaptures.delete(scope); }
193
229
  };
194
230
  const defaultMode = (): PermissionMode => resolvePermissionModePolicy(store).mode;
231
+ // Preview and initialization share the same fresh-session default rule.
232
+ const initialMode = (identity: ModeIdentity): PermissionMode =>
233
+ seen.get(identity.manager)?.has(identity.id) ? "normal" : defaultMode();
195
234
  const mode = async (ctx: ExtensionContext, admission?: { toolCallId: string }): Promise<PermissionMode> => {
196
235
  const scope = session(ctx);
197
236
  const admissionId = admission?.toolCallId;
@@ -210,8 +249,9 @@ export function registerYoloSessionPolicy(pi: ExtensionAPI, env: NodeJS.ProcessE
210
249
  }
211
250
  if (!binding && identity) {
212
251
  const fresh = !seen.get(identity.manager)?.has(identity.id);
252
+ const initial = fresh ? initialMode(identity) : "normal";
213
253
  remember(identity); binding = identity;
214
- if (fresh) { liveMode = defaultMode(); interactiveGrant = false; changed(ctx); }
254
+ if (fresh) { liveMode = initial; interactiveGrant = false; changed(ctx); }
215
255
  }
216
256
  // Record after the binding pass: internal changed() bumps above must not strand
217
257
  // a cache entry stamped with a superseded generation. Only admission-keyed
@@ -231,7 +271,7 @@ export function registerYoloSessionPolicy(pi: ExtensionAPI, env: NodeJS.ProcessE
231
271
  binding = undefined; liveMode = "normal"; interactiveGrant = false;
232
272
  changed(ctx); observers.clear();
233
273
  };
234
- const setMode = async (requested: PermissionMode, ctx: ExtensionContext, lifetime = () => true): Promise<boolean> => {
274
+ const setMode = async (requested: PermissionMode, ctx: ExtensionContext, lifetime = () => true, expectedIdentity?: ModeIdentity): Promise<boolean> => {
235
275
  if (!isPermissionMode(requested) || !interactive(ctx) || !lifetime()) return false;
236
276
  const current = bindCurrent(ctx, () => !lifetime());
237
277
  // Revoke immediately, including off versus a pending activation race.
@@ -239,7 +279,7 @@ export function registerYoloSessionPolicy(pi: ExtensionAPI, env: NodeJS.ProcessE
239
279
  binding = undefined; liveMode = "normal"; interactiveGrant = false; changed(ctx);
240
280
  const epoch = generation;
241
281
  const identity = await capture(ctx);
242
- if (!current() || epoch !== generation || !identity) return false;
282
+ if (!current() || epoch !== generation || !identity || (expectedIdentity && !sameModeIdentity(expectedIdentity, identity))) return false;
243
283
  binding = identity; remember(identity); liveMode = requested; interactiveGrant = true; changed(ctx);
244
284
  if (requested === "auto") notify(ctx, AUTO_MODE_NOTICE);
245
285
  return true;
@@ -330,23 +370,35 @@ export function registerYoloSessionPolicy(pi: ExtensionAPI, env: NodeJS.ProcessE
330
370
  },
331
371
  });
332
372
  pi.registerCommand("gentle:yolo", {
333
- description: "Ordinary development/delivery permission (enable|disable|status); no argument opens a menu. Destructive confirmations remain.",
373
+ description: "Choose a session permission mode; enable|disable|status remain available as explicit shortcuts.",
334
374
  handler: async (args, ctx) => {
335
- let action = args.trim() || "status";
336
- let current = () => true;
337
- if (!args.trim() && ctx.hasUI && typeof ctx.ui.select === "function") {
338
- current = bindCurrent(ctx);
339
- const state = await active(ctx) ? YOLO_DISPLAY.on : YOLO_DISPLAY.off;
340
- const selected = await ctx.ui.select(`🚀 Gentle YOLO 🔥 — standing permission (current: ${state})`, ["enable", "disable", "status"]);
375
+ const action = args.trim() || "status";
376
+ if (!args.trim() && interactive(ctx) && typeof ctx.ui.select === "function") {
377
+ const current = bindCurrent(ctx), epoch = generation;
378
+ const stale = () => notify(ctx, "YOLO unchanged — the session changed while the menu was open.", true);
379
+ const identity = await capture(ctx);
380
+ if (!current() || epoch !== generation || !identity) { stale(); return; }
381
+ // Preview the effective default without initializing authority merely by opening a dialog.
382
+ const state = binding && sameModeIdentity(binding, identity) ? liveMode : initialMode(identity);
383
+ const selected = await ctx.ui.select(`Permissions for this session (current: ${state.toUpperCase()})`, MODE_CHOICES.map(choice => choice.label));
341
384
  if (selected === undefined) return;
342
- action = selected;
385
+ if (!current() || epoch !== generation) { stale(); return; }
386
+ const choice = MODE_CHOICES.find(item => item.label === selected);
387
+ if (!choice) { notify(ctx, "YOLO unchanged — invalid menu selection.", true); return; }
388
+ const fresh = await capture(ctx);
389
+ if (!current() || epoch !== generation || !fresh || !sameModeIdentity(identity, fresh)) { stale(); return; }
390
+ if (await setMode(choice.mode, ctx, current, identity)) notify(ctx, `Permissions: ${choice.mode.toUpperCase()}`);
391
+ else stale();
392
+ return;
343
393
  }
344
394
  if (action !== "enable" && action !== "disable" && action !== "status") {
345
395
  notify(ctx, "Use /gentle:yolo enable|disable|status. State unchanged.", true); return;
346
396
  }
347
- if (action === "status") { notify(ctx, await active(ctx) ? YOLO_STATUS_TEXT : "YOLO OFF"); return; }
348
- if (await humanAction(action === "enable" ? HUMAN_ACTION.on : HUMAN_ACTION.off, ctx, current)) return;
349
- notify(ctx, "YOLO unchanged — the session changed while the menu was open.", true);
397
+ if (action === "status") {
398
+ const state = await mode(ctx);
399
+ notify(ctx, state === "super-yolo" ? SUPER_YOLO_STATUS_TEXT : state === "yolo" ? YOLO_STATUS_TEXT : "YOLO OFF"); return;
400
+ }
401
+ await humanAction(action === "enable" ? HUMAN_ACTION.on : HUMAN_ACTION.off, ctx);
350
402
  },
351
403
  });
352
404
  return { active, superActive, mode, setMode, defaultMode, saveDefault, epoch: () => generation, humanAction, reset };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gentle-pi",
3
- "version": "4.5.1",
3
+ "version": "4.7.0",
4
4
  "description": "Turn Pi into el Gentleman: an ODD development harness with focused subagents, configured TDD evidence, native review, and skill discovery.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -51,6 +51,7 @@
51
51
  "build:runtime-modules": "node scripts/build-runtime-modules.mjs --write",
52
52
  "check:runtime-modules": "node scripts/build-runtime-modules.mjs --check",
53
53
  "test:packed-package": "node scripts/test-packed-runner.mjs",
54
+ "perf:render-cache": "node scripts/render-cache-performance.mjs",
54
55
  "prepack": "pnpm test && pnpm run check:runtime-modules && node scripts/verify-package-files.mjs",
55
56
  "prepublishOnly": "pnpm test && pnpm run check:runtime-modules && node scripts/verify-package-files.mjs && pnpm run test:packed-package",
56
57
  "typecheck": "node scripts/check-types.mjs"
@@ -383,7 +383,7 @@ function binaryIdentity(path ) {
383
383
  return [details.dev, details.ino, details.size, details.mtimeNs, details.ctimeNs].join(":");
384
384
  }
385
385
 
386
- function binaryDigest(path , readBinary ) {
386
+ export function binaryDigest(path , readBinary = readFileSync) {
387
387
  let entries = binaryDigestCache.get(readBinary);
388
388
  if (entries === undefined) binaryDigestCache.set(readBinary, entries = new Map());
389
389
  const identity = binaryIdentity(path);
@@ -267,8 +267,8 @@ export function bundledPi(install , input
267
267
  // given explicitly, and its npm through the home's npmCommand setting), plus
268
268
  // only no Pi override, subagents on the same node and Pi (the subagent runner
269
269
  // splits GENTLE_PI_AGENTS_PI on whitespace, so a spaced path is left to its
270
- // default, the running node and cli.js), and no Pi update check, since Pi only
271
- // updates with Gentle Shell (S5). S9: the prefix (GENTLE_SHELL_PREFIX, from
270
+ // default, the running node and cli.js), and no separate Pi update check, since
271
+ // Shell handles Pi updates. S9: the prefix (GENTLE_SHELL_PREFIX, from
272
272
  // which gentle-pi derives its config folder and gives its own gentle-ai runs
273
273
  // Gentle AI's variables, never set here because the agent's shell would pass
274
274
  // them to a gentle-ai the user runs), and the published Engram as
@@ -276,7 +276,7 @@ export function bundledPi(install , input
276
276
  // (S2, S6): the startup policy, and ENGRAM_BIN is the Shell-owned guard, so no
277
277
  // provider, whatever loaded it, runs an Engram binary against a store; allowed
278
278
  // memory reaches the shared server through ENGRAM_URL only.
279
- export const ENGRAM_COMPANION_SOURCE = "npm:gentle-engram@0.4.2";
279
+ export const ENGRAM_COMPANION_SOURCE = "npm:gentle-engram";
280
280
  export const ENGRAM_RECOVERY_NOTICE = "Engram memory disabled: Shell could not verify safe server reuse. Matching versions or updating alone do not prove compatibility. Reuse requires a server on 127.0.0.1:7437 with verified /compatibility evidence; Shell never stops or replaces a server already listening there. Back up existing Engram data before manual changes; do not delete it or bypass the safety check. Shell rechecks on every launch and remains usable without memory.";
281
281
  export const ENGRAM_START_FAILED_NOTICE = "Engram memory disabled for this launch: Shell could not start the shared Engram server, or it did not report ready in time. Restart Shell to retry; if another program holds 127.0.0.1:7437, stop it first. Shell remains usable without memory.";
282
282
  export const ENGRAM_NEWER_SCHEMA_NOTICE = "Engram memory disabled: ~/.engram was migrated by a newer Engram than Shell's bundled core, so Shell will not start a server on it. Start that newer Engram's server yourself (engram serve); Shell reuses a running server with verified /compatibility evidence. Back up the store; do not delete or downgrade it. Shell remains usable without memory.";
@@ -614,29 +614,16 @@ export function bundledUpdatePlan(passthrough ) {
614
614
  return { self: true, ...marked };
615
615
  }
616
616
 
617
- // What `gentle-shell update` does after the redirected upgrade or the
618
- // `--latest` Pi update (`upgradeCode` is undefined when it did not run): with
619
- // nothing left for Pi it exits with that code; otherwise Pi still runs, so
620
- // `update --all` updates the extensions even when that step could not complete.
617
+ // Forward extension updates even when the latest Pi update failed; the caller
618
+ // retains that failure code while Pi handles the remaining arguments.
621
619
  export function bundledUpdateNext(plan , upgradeCode ) {
622
620
  if (plan.piArgs === undefined) return { exitCode: upgradeCode ?? 0 };
623
621
  if (plan.self && upgradeCode !== undefined && upgradeCode !== 0) {
624
- const step = plan.latest ? "latest Pi update" : "Gentle Shell upgrade";
625
- return { piArgs: plan.piArgs, note: `gentle-shell: the ${step} did not complete; updating the extensions anyway.` };
622
+ return { piArgs: plan.piArgs, note: "gentle-shell: the latest Pi update did not complete; updating the extensions anyway." };
626
623
  }
627
624
  return { piArgs: plan.piArgs };
628
625
  }
629
626
 
630
- export function bundledUpdateNotice(input ) {
631
- return [
632
- `Pi ships pinned with Gentle Shell (Pi ${input.piVersion}): a newer Pi arrives with a Gentle Shell release.`,
633
- input.interactive
634
- ? "Running 'gentle-shell upgrade'..."
635
- : "Run 'gentle-shell upgrade' to install the latest Gentle Shell release and its Pi.",
636
- "Run 'gentle-shell update --latest' to install the newest published Pi now, without the release's verified lockfile.",
637
- ];
638
- }
639
-
640
627
 
641
628
 
642
629
  export const BUNDLED_UPGRADE_USAGE = "usage: gentle-shell upgrade [--channel release] | gentle-shell upgrade --rollback";
@@ -215,11 +215,40 @@ function linkDir(env , homedir )
215
215
  // launched from inside a Gentle Shell session sees the outer isolated home as
216
216
  // PI_CODING_AGENT_DIR, so `--link` must not re-select it (#2015).
217
217
  export const USER_PI_HOME_ENV = "GENTLE_SHELL_USER_PI_HOME";
218
+ // Set by bin/gentle-shell.mjs only when Gentle Shell, not Herdr's Pi bridge,
219
+ // owns the pane's Herdr agent reports (extensions/gentle-herdr-agent.ts).
220
+ export const HERDR_REPORTER_ENV = "GENTLE_SHELL_HERDR_REPORTER";
218
221
 
219
222
  export function userPiHome(env , homedir ) {
220
223
  return env[USER_PI_HOME_ENV] || linkDir(env, homedir);
221
224
  }
222
225
 
226
+ // Nobody can see or type into an editor git opens from Pi's bash tool, so
227
+ // `git rebase --continue` or a bare `git commit` would wait on it forever.
228
+ // `true` makes git keep the prepared message (or abort an empty one) instead.
229
+ // A value the user already set is kept; on Windows env names ignore case, so a
230
+ // user's `git_editor` counts too.
231
+ export const NON_INTERACTIVE_GIT_ENV = { GIT_EDITOR: "true", GIT_SEQUENCE_EDITOR: "true" } ;
232
+
233
+ export function nonInteractiveGitEnv(env , platform = process.platform) {
234
+ const isSet = (key ) => platform === "win32"
235
+ ? Object.entries(env).some(([name, value]) => value !== undefined && name.toUpperCase() === key)
236
+ : env[key] !== undefined;
237
+ return Object.fromEntries(Object.entries(NON_INTERACTIVE_GIT_ENV).filter(([key]) => !isSet(key)));
238
+ }
239
+
240
+ // On Windows, Node keeps only the first of a set of case variants (in sorted
241
+ // order) and then skips it if it is undefined, so `{ GIT_EDITOR: undefined,
242
+ // git_editor: "vim" }` would reach the child with neither. Drop the undefined
243
+ // variants so the defined one is what gets spawned.
244
+ export function dropUndefinedCaseVariants(env , platform = process.platform) {
245
+ if (platform !== "win32") return;
246
+ const defined = new Set(Object.entries(env).filter(([, value]) => value !== undefined).map(([name]) => name.toUpperCase()));
247
+ for (const [name, value] of Object.entries(env)) {
248
+ if (value === undefined && defined.has(name.toUpperCase())) delete env[name];
249
+ }
250
+ }
251
+
223
252
  export function isolatedDir(env , homedir ) {
224
253
  return env.GENTLE_SHELL_HOME || join(homedir, ".gentle-shell", "agent");
225
254
  }
@@ -460,13 +489,18 @@ export function recordProvisioned(config , homeDir , pi
460
489
 
461
490
 
462
491
 
492
+
493
+
494
+
495
+
496
+
463
497
 
464
498
  export function resolvePiRuntime(deps ) {
465
499
  const envOverride = deps.env.GENTLE_SHELL_PI;
466
500
  if (envOverride !== undefined && envOverride.length > 0) return { kind: "env", command: envOverride, args: [] };
467
501
 
468
- const bundledCliPath = deps.resolveBundledCli();
469
- if (bundledCliPath !== undefined) return { kind: "bundled", command: deps.nodeExecPath, args: [bundledCliPath] };
502
+ const bundledCli = deps.resolveBundledCli();
503
+ if (bundledCli !== undefined) return { kind: "bundled", command: deps.nodeExecPath, args: [bundledCli.path], version: bundledCli.version };
470
504
 
471
505
  const onPath = deps.findOnPath("pi");
472
506
  if (onPath !== undefined) return { kind: "path", command: onPath, args: [] };
@@ -1001,6 +1035,8 @@ export function discoverLooseExtensionEntries(dir , fs )
1001
1035
 
1002
1036
 
1003
1037
 
1038
+
1039
+
1004
1040
 
1005
1041
 
1006
1042
 
@@ -1083,7 +1119,9 @@ export function buildPiInvocation(input ) {
1083
1119
 
1084
1120
  const env = {
1085
1121
  ...input.baseEnv,
1122
+ ...nonInteractiveGitEnv(input.baseEnv, input.platform),
1086
1123
  PI_CODING_AGENT_DIR: input.home.dir,
1124
+ PI_PROGRAM_STATUS_APP: "gentle-shell",
1087
1125
  GENTLE_PI_AGENT_HOME: input.home.dir,
1088
1126
  [USER_PI_HOME_ENV]: userPiHome(input.baseEnv, input.homedir),
1089
1127
  };
@@ -1095,6 +1133,7 @@ export function buildPiInvocation(input ) {
1095
1133
  else env[GENTLE_SHELL_CONFIG_HOME_ENV] = configHome;
1096
1134
  if (childInjection === undefined) delete env[CHILD_PACKAGE_INJECTION_ENV];
1097
1135
  else env[CHILD_PACKAGE_INJECTION_ENV] = encodeChildPackageInjection(childInjection);
1136
+ dropUndefinedCaseVariants(env, input.platform);
1098
1137
 
1099
1138
  return { command: input.runtime.command, args, env };
1100
1139
  }
@@ -1349,11 +1388,11 @@ export function helpText() {
1349
1388
  " gentle-shell install npm:<pkg> Run pi's own 'install' against the resolved home.",
1350
1389
  " gentle-shell remove <source> Run pi's own 'remove' against the resolved home.",
1351
1390
  " gentle-shell list Run pi's own 'list' against the resolved home.",
1352
- " gentle-shell update [target] Run pi's own 'update' against the resolved home.",
1353
- " In a bundled install Pi ships pinned: 'update' without a package",
1354
- " runs 'gentle-shell upgrade' instead of updating Pi.",
1355
- " 'update --latest' installs the newest published Pi instead,",
1356
- " without the release's verified lockfile.",
1391
+ " gentle-shell update [target] Update Pi through its supported owner, or packages in the resolved home.",
1392
+ " In a bundled install 'update' installs the newest stable Pi",
1393
+ " without the release's verified lockfile; --latest is an alias.",
1394
+ " --all also updates extensions; explicit package pins remain pinned.",
1395
+ " --force is not supported for managed Pi self updates.",
1357
1396
  " gentle-shell config Run pi's own 'config' against the resolved home.",
1358
1397
  " gentle-shell auth <command> Run pi's own 'auth' against the resolved home.",
1359
1398
  " gentle-shell mcp <command> Run pi's own 'mcp' (add, list, login, logout) against the",