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
@@ -2,6 +2,7 @@ import assert from "node:assert/strict";
2
2
  import test, { after, before, type TestContext } from "node:test";
3
3
  import { visibleWidth } from "@earendil-works/pi-tui";
4
4
  import { DEFAULT_VISUAL_SETTINGS } from "../lib/visual-customization-policy.ts";
5
+ import { collectSessionStats } from "../lib/shell-stats.ts";
5
6
  import {
6
7
  buildShellHeaderModel,
7
8
  formatCost,
@@ -11,6 +12,9 @@ import {
11
12
  renderShellBar,
12
13
  renderShellBottomOnlyBar,
13
14
  renderShellBelowInputFloat,
15
+ renderShellChromeBar,
16
+ renderShellStatusBar,
17
+ renderShellTitleRow,
14
18
  renderShellHeaderBar,
15
19
  renderShellHeaderChrome,
16
20
  renderShellHeaderRule,
@@ -103,11 +107,11 @@ test("visual visibility hides only selected optional status segments", () => {
103
107
  const settings = { ...DEFAULT_VISUAL_SETTINGS, visibility: { ...DEFAULT_VISUAL_SETTINGS.visibility, changes: false, modelDetails: false, usageCost: false } };
104
108
  const data = model({ changes: { files: 2, added: 1, deleted: 1 } });
105
109
  assert.doesNotMatch(renderShellBar(data, plainTheme, 160, settings).join(""), /gpt-5\.5|ctx|\$9\.49/);
106
- assert.doesNotMatch(renderShellSidebarBar(data, plainTheme, 50, settings).join(""), /Changes|2 files/);
110
+ assert.doesNotMatch(renderShellSidebarBar(data, plainTheme, 50, settings).join(""), /CHANGES|2 files/);
107
111
  assert.doesNotMatch(renderShellHeaderBar(buildShellHeaderModel(data), plainTheme, 160, undefined, settings).text, /gpt-5\.5|ctx|\$9\.49|usage/);
108
112
  });
109
113
 
110
- test("Status keeps RDD beside structured groups while running jobs moved to their own card", () => {
114
+ test("Status keeps the Review section beside Changes while running jobs live in their own section", () => {
111
115
  const data = model({ jobs: [
112
116
  { id: "job-2", label: "CI for PR 1860", startedAt: 2 },
113
117
  { id: "job-1", label: "Build runtime", startedAt: 1 },
@@ -115,10 +119,10 @@ test("Status keeps RDD beside structured groups while running jobs moved to thei
115
119
  for (const width of [30, 60]) {
116
120
  const lines = renderShellSidebarBar(data, plainTheme, width);
117
121
  const text = lines.join("\n");
118
- // Running jobs live in their own sidebar card; the Status card never
119
- // prints them, so the two surfaces cannot duplicate one job.
120
- assert.doesNotMatch(text, /Jobs|CI for PR 1860|Build runtime/);
121
- assert.match(text, /🌹 RDD/);
122
+ // Running jobs live in their own rail section; Status never prints
123
+ // them, so the two surfaces cannot duplicate one job.
124
+ assert.doesNotMatch(text, /JOBS|CI for PR 1860|Build runtime/);
125
+ assert.match(text, /▾ REVIEW/);
122
126
  assert.ok(lines.every((line) => visibleWidth(line) <= width));
123
127
  }
124
128
  });
@@ -147,33 +151,33 @@ test("bottom-only and hidden below-input chrome retain a compact jobs count", (t
147
151
  assert.ok(rows.every((line) => visibleWidth(line) <= 80));
148
152
  });
149
153
 
150
- test("Status title stays plain without an active review", () => {
154
+ test("Status opens with Changes and shows no Review section without an active review", () => {
151
155
  const lines = renderShellSidebarBar(model(), plainTheme, 60);
152
- assert.match(lines[0], /^╭─ ✿ Status ─+╮$/);
153
- assert.doesNotMatch(lines.slice(1).join("\n"), /🌹 RDD/);
156
+ assert.match(lines[0], /^▾ CHANGES/);
157
+ assert.doesNotMatch(lines.slice(1).join("\n"), /REVIEW/);
154
158
  });
155
159
 
156
- test("Status title stays plain above the review lifecycle block", () => {
160
+ test("the Review section lists the lifecycle state and the candidate scope", () => {
157
161
  const lines = renderShellSidebarBar(model({ review: { state: "reviewing", scope: "first.ts +2 files" } }), plainTheme, 60);
158
- assert.match(lines[0], /^╭─ ✿ Status ─+╮$/);
159
- assert.match(lines.slice(1).join("\n"), /🌹 RDD[\s\S]*Reviewers running…[\s\S]*first\.ts \+2 files/);
162
+ assert.match(lines[0], /^▾ CHANGES/);
163
+ assert.match(lines.slice(1).join("\n"), /▾ REVIEW[\s\S]*Reviewers running…[\s\S]*first\.ts \+2 files/);
160
164
  });
161
165
 
162
166
  test("review lifecycle block omits the scope line when the candidate scope is unknown", () => {
163
167
  const known = renderShellSidebarBar(model({ review: { state: "checking", scope: "first.ts" } }), plainTheme, 60);
164
168
  const unknown = renderShellSidebarBar(model({ review: { state: "checking", scope: REVIEW_SCOPE_UNAVAILABLE } }), plainTheme, 60);
165
169
  const text = unknown.join("\n");
166
- assert.match(text, /🌹 RDD[\s\S]*Updating…/);
170
+ assert.match(text, /▾ REVIEW[\s\S]*Updating…/);
167
171
  assert.doesNotMatch(text, /Candidate scope unavailable/);
168
172
  assert.equal(unknown.length, known.length - 1);
169
173
  });
170
174
 
171
175
  test("rdd visibility hides only the review lifecycle block", () => {
172
176
  const data = model({ review: { state: "reviewing", scope: "first.ts +2" }, changes: { files: 2, added: 1, deleted: 1 } });
173
- assert.match(renderShellSidebarBar(data, plainTheme, 60, DEFAULT_VISUAL_SETTINGS).join("\n"), /🌹 RDD[\s\S]*Reviewers running…/);
177
+ assert.match(renderShellSidebarBar(data, plainTheme, 60, DEFAULT_VISUAL_SETTINGS).join("\n"), /▾ REVIEW[\s\S]*Reviewers running…/);
174
178
  const hidden = renderShellSidebarBar(data, plainTheme, 60, { ...DEFAULT_VISUAL_SETTINGS, visibility: { ...DEFAULT_VISUAL_SETTINGS.visibility, rdd: false } }).join("\n");
175
- assert.doesNotMatch(hidden, /🌹 RDD|Reviewers running|first\.ts \+2 files/);
176
- assert.match(hidden, /Changes[\s\S]*2 files/);
179
+ assert.doesNotMatch(hidden, /REVIEW|Reviewers running|first\.ts \+2 files/);
180
+ assert.match(hidden, /CHANGES[\s\S]*2 files/);
177
181
  });
178
182
 
179
183
  test("Status and review lifecycle block respect terminal width", () => {
@@ -181,7 +185,7 @@ test("Status and review lifecycle block respect terminal width", () => {
181
185
  for (const review of [undefined, { state: "reviewing" as const, scope: "first.ts +2 files" }, { state: "approved" as const, scope: REVIEW_SCOPE_UNAVAILABLE }]) {
182
186
  const lines = renderShellSidebarBar(model({ review }), plainTheme, width);
183
187
  for (const line of lines) assert.ok(visibleWidth(line) <= width, `${width}: ${line}`);
184
- if (width >= 20) assert.match(lines[0], /^╭─ ✿ Status ─+╮$/);
188
+ if (width >= 20) assert.match(lines[0], /^▾ CHANGES/);
185
189
  }
186
190
  }
187
191
  });
@@ -347,47 +351,86 @@ test("shellEnabled honors GENTLE_PI_SHELL=0", () => {
347
351
  assert.equal(shellEnabled({ GENTLE_PI_SHELL: "false" }), false);
348
352
  });
349
353
 
350
- test("renderShellSidebarBar paints the Status card frame with border and the title with accent", () => {
351
- const lines = renderShellSidebarBar(model(), taggedTheme, 46);
352
- assert.match(lines[0], /^<border>╭<\/border>/);
353
- assert.match(lines[0], /<accent>✿ Status<\/accent>/);
354
- assert.match(lines[lines.length - 1], /^<border>╰<\/border>/);
354
+ test("renderShellSidebarBar draws panel section headers, never a card frame", () => {
355
+ const lines = renderShellSidebarBar(model(), taggedTheme, 160);
356
+ assert.match(lines[0], /^<muted>▾<\/muted> <text>.*CHANGES.*<\/text>/);
357
+ assert.doesNotMatch(lines.join("\n"), /[╭╮╰╯│]/u);
355
358
  });
356
359
 
357
- test("sidebar unifies project, captured changes and integrations in one frame", () => {
360
+ test("the rail Status orders Changes before Integrations and keeps the location out", () => {
358
361
  const data = model({ changes: { files: 2, added: 7, deleted: 3 }, statuses: ["MCP connected"] });
359
362
  const lines = renderShellSidebarBar(data, plainTheme, 46);
360
363
  const text = lines.join("\n");
361
- assert.equal(lines.filter((line) => line.startsWith("╭")).length, 1);
362
364
  let previous = -1;
363
- for (const heading of ["Status", "Project", "Changes", "Integrations"]) {
365
+ for (const heading of ["CHANGES", "INTEGRATIONS"]) {
364
366
  const index = text.indexOf(heading);
365
367
  assert.ok(index > previous, heading);
366
368
  previous = index;
367
369
  }
368
- assert.match(text, /2 files.*\+7.*−3/);
370
+ assert.match(text, /2 files/);
371
+ assert.match(text, /\+7 −3/);
369
372
  assert.match(text, /\/gentle:changes/);
370
- assert.match(text, /main/);
373
+ assert.match(text, /MCP connected/);
374
+ assert.doesNotMatch(text, /main|Branch|Project/, "location lives in the header row, once");
371
375
  for (const width of [1, 8, 24, 46]) assert.ok(renderShellSidebarBar(data, plainTheme, width).every((line) => visibleWidth(line) <= width));
372
376
  const empty = renderShellSidebarBar(model(), plainTheme, 46).join("\n");
373
- assert.match(empty, /No captured changes/);
374
- assert.match(empty, /Integrations/);
377
+ assert.match(empty, /no captured changes/);
378
+ assert.match(empty, /INTEGRATIONS/);
375
379
  });
376
380
 
377
- test("sidebar profile wraps long names without changing the compact bar", () => {
378
- const profile = "team-" + "x".repeat(59);
381
+ test("the agent profile opens Stats and never touches Integrations' rows, count or order", () => {
382
+ const stats = collectSessionStats([]);
383
+ const data = model({
384
+ profile: "alpha (session)",
385
+ permission: { mode: "AUTO", detail: "confirm before action" },
386
+ statuses: ["compact status"],
387
+ integrations: ["MCP connected", "Engram ready"],
388
+ stats,
389
+ });
390
+ const rows = () => renderShellSidebarBar(data, plainTheme, 60).map((line) => line.trimEnd());
391
+ const section = (lines: string[], title: string) => {
392
+ const at = lines.findIndex((line) => line.startsWith(`▾ ${title}`));
393
+ const end = lines.findIndex((line, index) => index > at && line.startsWith("▾ "));
394
+ return lines.slice(at, end < 0 ? undefined : end).filter((line) => line.trim() !== "");
395
+ };
396
+ const initial = rows();
397
+ assert.match(section(initial, "INTEGRATIONS")[0]!, /INTEGRATIONS\s+3$/);
398
+ assert.deepEqual(section(initial, "INTEGRATIONS").slice(1), [" - permissions confirm before action", " - MCP connected", " - Engram ready"]);
399
+ assert.equal(section(initial, "STATS")[1], " profile alpha (session)", "Stats opens with the profile");
400
+ data.profile = "beta (repo)";
401
+ assert.equal(section(rows(), "STATS")[1], " profile beta (repo)");
402
+ assert.doesNotMatch(rows().join("\n"), /alpha \(session\)/);
403
+ data.profile = undefined;
404
+ const absent = rows();
405
+ assert.doesNotMatch(section(absent, "STATS").join("\n"), /profile/);
406
+ for (const profile of ["", " \t\n", "\x1b[31m\x1b[0m"]) {
407
+ data.profile = profile;
408
+ assert.deepEqual(rows(), absent, "an empty sanitized profile leaves prior output unchanged");
409
+ }
410
+ const onlyProfile = renderShellSidebarBar(model({ profile: "solo (local)" }), plainTheme, 60).map((line) => line.trimEnd());
411
+ assert.deepEqual(section(onlyProfile, "INTEGRATIONS").slice(1), [" no status reported"], "Integrations never lists the profile");
412
+ });
413
+
414
+ test("Stats clips and sanitizes a long agent profile on one row, leaving the compact bar unchanged", () => {
415
+ const profile = `team-${"x".repeat(59)}\x1b[31m\nops\t界unit\x07\x1b[0m (repo)`;
379
416
  const base = model();
380
- const active = model({ profile });
381
- for (const width of [24, 46]) {
382
- const lines = renderShellSidebarBar(active, plainTheme, width);
417
+ const active = model({ profile, stats: collectSessionStats([]) });
418
+ const settings = { ...DEFAULT_VISUAL_SETTINGS, visibility: { ...DEFAULT_VISUAL_SETTINGS.visibility, changes: false } };
419
+ for (const width of [16, 24, 46]) {
420
+ const lines = renderShellSidebarBar(active, plainTheme, width, settings);
383
421
  assert.ok(lines.every((line) => visibleWidth(line) <= width));
384
- assert.match(lines.join("\n"), /Profile/);
385
- assert.ok(lines.join("").replace(/[│\s]/g, "").includes(profile));
422
+ assert.ok(lines.every((line) => !/[\x00-\x1f\x7f-\x9f]/.test(line)), "profile controls must not reach the terminal");
423
+ const row = lines.find((line) => line.includes("profile"))!;
424
+ assert.match(row, /profile team-x*…/, "the profile clips with an ellipsis on its one row");
386
425
  }
426
+ const ansiTheme = { ...plainTheme, fg: (role: string, value: string) => `\x1b[${role === "muted" ? 90 : 37}m${value}\x1b[0m` };
427
+ const colored = renderShellSidebarBar(active, ansiTheme, 24, settings);
428
+ assert.ok(colored.every((line) => visibleWidth(line) <= 24));
429
+ assert.match(colored.join(""), /\x1b\[90mprofile\x1b\[0m/, "the label is muted like the other Stats labels");
387
430
  assert.deepEqual(renderShellBar(active, plainTheme, 120), renderShellBar(base, plainTheme, 120));
388
431
  });
389
432
 
390
- test("sidebar Status card drops Model, Effort, Context, Cost and Usage, keeping Project, Changes and Integrations", () => {
433
+ test("the rail Status drops model, usage and session identity, keeping Changes and Integrations", () => {
391
434
  const usage = {
392
435
  provider: "openai-codex",
393
436
  plan: "pro",
@@ -396,17 +439,8 @@ test("sidebar Status card drops Model, Effort, Context, Cost and Usage, keeping
396
439
  };
397
440
  const data = model({ profile: "team", sessionName: "session", usage, changes: { files: 1, added: 2, deleted: 1 }, statuses: ["MCP connected"] });
398
441
  const text = renderShellSidebarBar(data, plainTheme, 60).join("\n");
399
- assert.doesNotMatch(text, /Usage/);
400
- assert.doesNotMatch(text, /Model/);
401
- assert.doesNotMatch(text, /Effort/);
402
- assert.doesNotMatch(text, /Context/);
403
- assert.doesNotMatch(text, /Cost/);
404
- assert.doesNotMatch(text, /\$9\.49/);
405
- assert.doesNotMatch(text, /codex 5h/);
406
- for (const heading of ["Status", "Project", "Changes", "Integrations"]) assert.match(text, new RegExp(heading));
407
- assert.match(text, /Branch.*main/);
408
- assert.match(text, /Session.*session/);
409
- assert.match(text, /Profile.*team/);
442
+ for (const absent of [/Usage/, /Model/, /Effort/, /Context/, /Cost/, /\$9\.49/, /codex 5h/, /Branch/, /Session/]) assert.doesNotMatch(text, absent);
443
+ for (const heading of ["CHANGES", "INTEGRATIONS"]) assert.match(text, new RegExp(heading));
410
444
  });
411
445
 
412
446
  // The live header row above the fullscreen rail: identity on the left (brand,
@@ -521,6 +555,160 @@ test("renderShellHeaderBar shows every usage window with its gauge and the short
521
555
  assert.equal(text.slice(usageSpan.start, usageSpan.end), "usage 5h ▰▰▱▱▱▱▱▱ 26% · week ▰▱▱▱▱▱▱▱ 12% · alt+u");
522
556
  });
523
557
 
558
+ test("header retains effort without location when it fits beside full usage windows", () => {
559
+ const header = buildShellHeaderModel(model({ cwd: "~/work/" + "x".repeat(80), profile: "current", usage: USAGE_TWO_WINDOWS }));
560
+ for (const density of ["minimal", "compact", "comfortable"] as const) {
561
+ const settings = { ...DEFAULT_VISUAL_SETTINGS, density };
562
+ const right = density === "minimal"
563
+ ? "ctx 45% ⟡ $9.49 sub ⟡ usage 5h 26% · week 12%"
564
+ : "ctx ▰▰▰▰▱▱▱▱ 45% ⟡ $9.49 sub ⟡ usage 5h ▰▰▱▱▱▱▱▱ 26% · week ▰▱▱▱▱▱▱▱ 12% · alt+u";
565
+ const left = density === "minimal" ? "gpt-5.5 · medium" : "✿ Gentle Shell ⟡ gpt-5.5 · medium";
566
+ const width = visibleWidth(left) + 2 + visibleWidth(right);
567
+ const result = renderShellHeaderBar(header, plainTheme, width, "alt+u", settings);
568
+ assert.equal(result.text, left + " " + right, density);
569
+ assert.ok(result.usageSpan);
570
+ assert.equal(result.text.slice(result.usageSpan.start, result.usageSpan.end), right.slice(right.indexOf("usage")));
571
+
572
+ const narrower = renderShellHeaderBar(header, plainTheme, width - 1, "alt+u", settings).text;
573
+ assert.match(narrower, /gpt-5\.5/);
574
+ assert.doesNotMatch(narrower, /medium|current|~\/work/);
575
+ assert.ok(narrower.endsWith(right), "model-only fallback preserves full usage");
576
+ assert.equal(visibleWidth(narrower), width - 1);
577
+
578
+ const withoutEffort = renderShellHeaderBar({ ...header, effort: undefined }, plainTheme, width, "alt+u", settings).text;
579
+ assert.doesNotMatch(withoutEffort, /medium|current|~\/work/);
580
+ assert.ok(withoutEffort.endsWith(right));
581
+ assert.equal(visibleWidth(withoutEffort), width);
582
+ }
583
+ });
584
+
585
+ test("single top and below-input chrome includes the project identity without duplicating split", () => {
586
+ const cwd = "~/work/gentle-pi/.worktrees/庫-shell-ui-feedback";
587
+ const data = model({ cwd, branch: "feature/main", dirty: 3, permission: { mode: "SUPER-YOLO" }, profile: "current", profileTier: "fast", usage: USAGE_TWO_WINDOWS, jobs: [{ id: "one", label: "job", startedAt: 1 }] });
588
+ for (const headerPlacement of ["top", "below-input"] as const) for (const density of ["comfortable", "compact", "minimal"] as const) {
589
+ const settings = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement, density };
590
+ const chrome = renderShellChromeBar(data, plainTheme, 240, "alt+u", settings, undefined, { jobs: true });
591
+ const row = chrome.rows[chrome.headerRow]!;
592
+ assert.match(row, /✿ 庫-shell-ui-feedback ~\/work\/gentle-pi\/\.worktrees\/庫-shell-ui-feedback/, `${headerPlacement}/${density}: folder and abbreviated path`);
593
+ assert.match(row, /feature\/main ±3/);
594
+ assert.match(row, /💥 SUPER-YOLO/);
595
+ assert.match(row, /⧗ 1 job/);
596
+ assert.match(row, /gpt-5\.5 · medium · Fast · current/);
597
+ assert.match(row, /45%/);
598
+ assert.match(row, /\$9\.49 sub/);
599
+ assert.match(row, /usage.*5h.*26%.*week.*12%/);
600
+ if (density === "minimal") assert.doesNotMatch(row, /[▰▱]|alt\+u/);
601
+ else assert.match(row, /[▰▱].*alt\+u/);
602
+ assert.equal(visibleWidth(row), 240);
603
+ const start = visibleWidth(row.slice(0, row.indexOf("usage")));
604
+ assert.deepEqual(chrome.usageSpan, { start, end: 239 }, `${headerPlacement}/${density}: wide glyphs do not shift the target`);
605
+ assert.equal(shellHeaderUsageHit(chrome, start, chrome.headerRow), true);
606
+ assert.equal(shellHeaderUsageHit(chrome, start - 1, chrome.headerRow), false);
607
+ assert.equal(shellHeaderUsageHit(chrome, 239, chrome.headerRow), false);
608
+ if (density === "comfortable") assert.equal(shellHeaderUsageHit(chrome, start, 0), false);
609
+ }
610
+ const split = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "split" as const };
611
+ const title = renderShellTitleRow(data, plainTheme, 240);
612
+ const bar = renderShellChromeBar(data, plainTheme, 240, "alt+u", split, undefined).rows.join("\n");
613
+ assert.match(title, /✿ 庫-shell-ui-feedback ~\/work\/gentle-pi\/\.worktrees\/庫-shell-ui-feedback/);
614
+ assert.doesNotMatch(bar, /庫-shell-ui-feedback|~\/work/);
615
+ assert.match(bar, /gpt-5\.5 · medium · Fast · current/);
616
+ });
617
+
618
+ test("project identity yields before live values, and folder text is terminal-safe", () => {
619
+ const data = model({ cwd: "~/work/\x1b[31mproject\x1b[0m\nname", branch: "feature/" + "long-".repeat(20), dirty: 3, permission: { mode: "YOLO" }, profileTier: "fast", usage: USAGE_TWO_WINDOWS });
620
+ const settings = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "top" as const, density: "minimal" as const };
621
+ const wide = renderShellChromeBar(data, plainTheme, 300, "alt+u", settings, undefined);
622
+ assert.match(wide.rows[0]!, /✿ project name ~\/work\/project name/);
623
+ assert.doesNotMatch(wide.rows[0]!, /\x1b|\n/);
624
+ const narrow = renderShellChromeBar(data, plainTheme, 105, "alt+u", settings, undefined);
625
+ const row = narrow.rows[0]!;
626
+ assert.doesNotMatch(row, /~\/work/);
627
+ assert.match(row, /feature\/.*… ±3/);
628
+ assert.match(row, /🔥 YOLO/);
629
+ assert.match(row, /gpt-5\.5 · medium · Fast/);
630
+ assert.match(row, /ctx 45%/);
631
+ assert.match(row, /\$9\.49 sub/);
632
+ assert.equal(visibleWidth(row), 105);
633
+ });
634
+
635
+ test("project path then name yield without displacing existing live values at any width", () => {
636
+ const data = model({ cwd: "~/work/gentle-pi/.worktrees/folder", branch: "feature/main", dirty: 3, permission: { mode: "YOLO" }, profile: "current", profileTier: "fast", usage: USAGE_TWO_WINDOWS });
637
+ for (const headerPlacement of ["top", "below-input"] as const) for (const density of ["comfortable", "compact", "minimal"] as const) {
638
+ let full = false, nameOnly = false, noIdentity = false;
639
+ for (let width = 1; width <= 240; width++) {
640
+ const settings = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement, density };
641
+ const chrome = renderShellChromeBar(data, plainTheme, width, "alt+u", settings, undefined);
642
+ const row = chrome.rows[chrome.headerRow]!;
643
+ const prior = renderShellChromeBar(data, plainTheme, width, "alt+u", { ...settings, headerPlacement: "split" }, undefined).rows[chrome.headerRow]!;
644
+ assert.equal(visibleWidth(row), width, `${headerPlacement}/${density}/${width}`);
645
+ for (const value of ["feature/main", "±3", "🔥 YOLO", "gpt-5.5", "medium", "Fast", "current", "45%", "$9.49 sub", "usage", "26%", "12%"]) {
646
+ if (prior.includes(value)) assert.ok(row.includes(value), `${headerPlacement}/${density}/${width}: identity must not displace ${value}`);
647
+ }
648
+ if (row.includes("✿ folder ~/work/gentle-pi/.worktrees/folder")) full = true;
649
+ else if (row.includes("✿ folder")) nameOnly = true;
650
+ else noIdentity = true;
651
+ }
652
+ assert.ok(full && nameOnly && noIdentity, `${headerPlacement}/${density}: full → name → absent as the available space falls`);
653
+ }
654
+ const mobile = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "top" as const };
655
+ const title = renderShellTitleRow(data, plainTheme, 120, { model: true });
656
+ const bottom = renderShellStatusBar(data, plainTheme, 120, "alt+u", mobile, undefined, { jobs: true }).rows[0]!;
657
+ assert.match(title, /✿ folder ~\/work\/gentle-pi\/\.worktrees\/folder/);
658
+ assert.doesNotMatch(bottom, /folder|~\/work/, "the narrow mobile title already owns the identity");
659
+ });
660
+
661
+ test("project identity respects model and usage visibility", () => {
662
+ const data = model({ cwd: "~/work/project", profileTier: "fast", usage: USAGE_TWO_WINDOWS });
663
+ for (const headerPlacement of ["top", "below-input"] as const) {
664
+ const hiddenModel = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement, visibility: { ...DEFAULT_VISUAL_SETTINGS.visibility, modelDetails: false } };
665
+ const row = renderShellChromeBar(data, plainTheme, 160, "alt+u", hiddenModel, undefined).rows[1]!;
666
+ assert.match(row, /✿ project ~\/work\/project/);
667
+ assert.doesNotMatch(row, /gpt-5\.5|medium|Fast/);
668
+ assert.match(row, /ctx.*45%.*\$9\.49 sub.*usage/);
669
+ const hiddenUsage = { ...hiddenModel, visibility: { ...hiddenModel.visibility, modelDetails: true, usageCost: false } };
670
+ const chrome = renderShellChromeBar(data, plainTheme, 160, "alt+u", hiddenUsage, undefined);
671
+ assert.match(chrome.rows[chrome.headerRow]!, /✿ project ~\/work\/project.*gpt-5\.5 · medium · Fast/);
672
+ assert.doesNotMatch(chrome.rows[chrome.headerRow]!, /ctx|\$9\.49|usage|alt\+u/);
673
+ assert.equal(chrome.usageSpan, undefined);
674
+ }
675
+ });
676
+
677
+ test("below-input float and narrow fallback keep the same folder and path identity", (t) => {
678
+ const settings = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "below-input" as const };
679
+ const data = model({ cwd: "~/work/gentle-pi/.worktrees/shell-ui-feedback", usage: USAGE_TWO_WINDOWS });
680
+ useCardStyle(t, CARD_STYLE.FLOAT);
681
+ const chrome = renderShellBelowInputFloat(data, withBackground(plainTheme), 240, "alt+u", settings);
682
+ assert.ok(chrome);
683
+ const row = stripAnsi(chrome.rows[chrome.headerRow]!);
684
+ assert.match(row, /✿ shell-ui-feedback ~\/work\/gentle-pi\/\.worktrees\/shell-ui-feedback/);
685
+ assert.match(row, /main/);
686
+ assert.match(row, /gpt-5\.5 · medium/);
687
+ assert.ok(chrome.usageSpan);
688
+ assert.match(row.slice(chrome.usageSpan.start, chrome.usageSpan.end), /^usage/);
689
+ assert.equal(shellHeaderUsageHit(chrome, chrome.usageSpan.start, chrome.headerRow), true);
690
+ assert.equal(shellHeaderUsageHit(chrome, chrome.usageSpan.start, chrome.headerRow - 1), false);
691
+ const neon = renderShellBottomOnlyBar(data, plainTheme, 240, "alt+u", settings);
692
+ assert.equal(neon.length, 1);
693
+ assert.match(neon[0]!, /✿ shell-ui-feedback ~\/work\/gentle-pi\/\.worktrees\/shell-ui-feedback/);
694
+ assert.match(neon[0]!, /main.*gpt-5\.5 · medium/);
695
+ });
696
+
697
+ test("long branches shorten before model, counters, badges and usage give way", () => {
698
+ const data = model({ branch: "feature/" + "long-".repeat(25), dirty: 3, permission: { mode: "SUPER-YOLO" }, profile: "current", profileTier: "fast", usage: USAGE_TWO_WINDOWS, jobs: [{ id: "one", label: "job", startedAt: 1 }] });
699
+ const settings = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "split" as const, density: "minimal" as const };
700
+ const chrome = renderShellChromeBar(data, plainTheme, 150, "alt+u", settings, undefined, { jobs: true });
701
+ const row = chrome.rows[chrome.headerRow]!;
702
+ assert.match(row, /feature\/.*… ±3/);
703
+ assert.match(row, /💥 SUPER-YOLO.*⧗ 1 job/);
704
+ assert.match(row, /gpt-5\.5 · medium · Fast · current/);
705
+ assert.match(row, /ctx 45%.*\$9\.49 sub.*usage 5h 26% · week 12%/);
706
+ assert.doesNotMatch(row, /[▰▱]|alt\+u/);
707
+ assert.equal(visibleWidth(row), 150);
708
+ assert.ok(chrome.usageSpan);
709
+ assert.equal(shellHeaderUsageHit(chrome, chrome.usageSpan.start, chrome.headerRow), true);
710
+ });
711
+
524
712
  test("renderShellHeaderBar shows 'usage · <shortcut>' with no data, and drops the hint when the shortcut is disabled", () => {
525
713
  const withHint = renderShellHeaderBar(buildShellHeaderModel(model({ usage: undefined })), plainTheme, 140, "alt+u");
526
714
  assert.match(withHint.text, /usage · alt\+u$/);
@@ -573,16 +761,14 @@ test("renderShellHeaderRule paints one full-width line in the editor frame color
573
761
  assert.equal(renderShellHeaderRule(plainTheme, -3), "", "negative widths clamp to an empty rule");
574
762
  });
575
763
 
576
- test("the sidebar Status card in the float style is a float panel two rows taller than neon, with a separator row after the header", (t) => {
764
+ test("the rail Status is the same panel in the neon and float card styles", (t) => {
765
+ // Card styles dress transcript cards; the rail panel has its own surface.
577
766
  const theme = withBackground(plainTheme);
578
- const neon = renderShellSidebarBar(model({ review: { state: "reviewing", scope: "first.ts +2 files" } }), theme, 60);
767
+ const data = model({ review: { state: "reviewing", scope: "first.ts +2 files" } });
768
+ const neon = renderShellSidebarBar(data, theme, 60);
579
769
  useCardStyle(t, CARD_STYLE.FLOAT);
580
- const float = renderShellSidebarBar(model({ review: { state: "reviewing", scope: "first.ts +2 files" } }), theme, 60);
581
- assert.equal(float.length, neon.length + 2);
582
- assert.equal(stripAnsi(float[1]!), ` ▎ ✿ Status${" ".repeat(49)}`);
583
- assert.equal(stripAnsi(float[2]!), ` ▎${" ".repeat(57)} `, "a blank separator row follows the header");
584
- assertFloatRows(float, 60);
585
- assert.deepEqual(float.slice(3, -1).map(bodyText), neon.slice(1, -1).map(bodyText));
770
+ assert.deepEqual(renderShellSidebarBar(data, theme, 60), neon);
771
+ assert.match(stripAnsi(neon[0]!), /^▾ CHANGES/);
586
772
  });
587
773
 
588
774
  // The float top bar has full-width painted padding above and below its
@@ -752,9 +938,10 @@ test("below-input float chrome mirrors only the edge and moves usage clicks to r
752
938
  for (const width of [10, 40, 90, 100, 140, 140.9]) {
753
939
  const above = renderShellHeaderChrome(header, theme, width, "alt+u");
754
940
  const below = renderShellHeaderChrome(header, theme, width, "alt+u", presentation);
755
- assert.deepEqual(below.rows, ["▁".repeat(Math.floor(width)), ...above.rows.slice(0, 3)]);
941
+ const belowBar = renderShellHeaderBar(header, theme, width, "alt+u", presentation);
942
+ assert.deepEqual(below.rows, ["▁".repeat(Math.floor(width)), above.rows[0], belowBar.text, above.rows[2]], "the edge and padding stay unchanged around the below-input identity");
756
943
  assert.equal(below.headerRow, 2);
757
- assert.deepEqual(below.usageSpan, above.usageSpan);
944
+ assert.deepEqual(below.usageSpan, belowBar.usageSpan);
758
945
  if (!below.usageSpan) {
759
946
  assert.equal(shellHeaderUsageHit(below, 0, 2), false);
760
947
  continue;
@@ -768,17 +955,18 @@ test("below-input float chrome mirrors only the edge and moves usage clicks to r
768
955
  }
769
956
  });
770
957
 
771
- test("below-input placement preserves neon and float fallback bytes", (t) => {
958
+ test("below-input placement preserves neon and float fallback geometry with its project identity", (t) => {
772
959
  const header = buildShellHeaderModel(model());
773
960
  const presentation = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "below-input" as const };
774
961
  useCardStyle(t, CARD_STYLE.NEON);
775
962
  for (const width of [0, 9, 10, 100, 140]) {
776
963
  const theme = withBackground(plainTheme);
777
- const neon = renderShellHeaderChrome(header, theme, width, "alt+u");
964
+ const neon = renderShellHeaderChrome(header, theme, width, "alt+u", presentation);
778
965
  const data = model({ statuses: ["mcp ok"] });
779
- const bottom = renderShellBottomOnlyBar(data, theme, width, "alt+u");
780
- assert.deepEqual(renderShellHeaderChrome(header, theme, width, "alt+u", presentation), neon);
781
- assert.deepEqual(renderShellBottomOnlyBar(data, theme, width, "alt+u", presentation), bottom);
966
+ const bottom = renderShellBottomOnlyBar(data, theme, width, "alt+u", presentation);
967
+ assert.deepEqual(neon.rows, [renderShellHeaderBar(header, theme, width, "alt+u", presentation).text, renderShellHeaderRule(theme, width)]);
968
+ assert.equal(neon.headerRow, 0);
969
+ assert.deepEqual(bottom, [neon.rows[0]]);
782
970
  setCardStyle(CARD_STYLE.FLOAT);
783
971
  assert.deepEqual(renderShellHeaderChrome(header, plainTheme, width, "alt+u", presentation), neon);
784
972
  assert.deepEqual(renderShellBottomOnlyBar(data, plainTheme, width, "alt+u", presentation), bottom);
@@ -790,7 +978,7 @@ test("below-input placement preserves neon and float fallback bytes", (t) => {
790
978
  }
791
979
  });
792
980
 
793
- test("below-input bottom-only float bar retains mirrored padding and extension statuses", (t) => {
981
+ test("below-input bottom-only float bar retains mirrored padding and leaves extension statuses to the rail", (t) => {
794
982
  useCardStyle(t, CARD_STYLE.FLOAT);
795
983
  const theme = withBackground(plainTheme);
796
984
  const presentation = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "below-input" as const };
@@ -800,18 +988,15 @@ test("below-input bottom-only float bar retains mirrored padding and extension s
800
988
  const rows = renderShellBottomOnlyBar(data, theme, width, "alt+u", presentation);
801
989
  const chrome = renderShellHeaderChrome(buildShellHeaderModel(data), theme, width, "alt+u", presentation);
802
990
  assert.deepEqual(rows.slice(0, 3), chrome.rows.slice(0, 3));
803
- assert.equal(rows.length, statuses.length ? 5 : 4);
991
+ assert.equal(rows.length, 4, "integrations live only in the rail, so no statuses row");
804
992
  assert.equal(rows.at(-1), chrome.rows.at(-1), "padding closes the entire group");
805
- if (statuses.length) {
806
- assert.match(stripAnsi(rows[3]!), width === 10 ? /^ mcp o…/ : /^ mcp ok/);
807
- assert.ok(rows[3]!.startsWith(BG_OPEN), "statuses share the full-width background");
808
- }
993
+ assert.doesNotMatch(rows.map(stripAnsi).join("\n"), /mcp ok|notice/);
809
994
  assert.ok(rows.every((row) => visibleWidth(row) <= width));
810
995
  }
811
996
  }
812
997
  });
813
998
 
814
- test("unified below-input float includes optional Changes and sanitized statuses inside one painted group", (t) => {
999
+ test("unified below-input float includes optional Changes inside one painted group and leaves statuses to the rail", (t) => {
815
1000
  useCardStyle(t, CARD_STYLE.FLOAT);
816
1001
  const theme = withBackground({ ...plainTheme, fg: (_role: string, text: string) => `\x1b[31m${text}\x1b[0m` });
817
1002
  const presentation = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "below-input" as const };
@@ -822,7 +1007,7 @@ test("unified below-input float includes optional Changes and sanitized statuses
822
1007
  const chrome = renderShellBelowInputFloat(model({ statuses }), theme, width, "alt+u", presentation, captured)!;
823
1008
  const hasChanges = Boolean(captured?.files.length);
824
1009
  assert.equal(chrome.headerRow, hasChanges ? 3 : 2);
825
- assert.equal(chrome.rows.length, 4 + Number(hasChanges) + Number(statuses.length > 0));
1010
+ assert.equal(chrome.rows.length, 4 + Number(hasChanges), "integrations live only in the rail");
826
1011
  assert.equal(stripAnsi(chrome.rows[0]!), "▁".repeat(width));
827
1012
  for (const row of chrome.rows.slice(1)) {
828
1013
  let painted = false;
@@ -834,7 +1019,7 @@ test("unified below-input float includes optional Changes and sanitized statuses
834
1019
  assert.equal(visibleWidth(row), width);
835
1020
  }
836
1021
  if (width === 240 && hasChanges) assert.match(stripAnsi(chrome.rows[2]!), /^ .*lib\/live.ts/);
837
- if (width >= 40 && statuses.length) assert.match(stripAnsi(chrome.rows.at(-2)!), /^ MCP ready now ⟡ notice/);
1022
+ assert.doesNotMatch(chrome.rows.map(stripAnsi).join("\n"), /MCP ready|notice/);
838
1023
  if (chrome.usageSpan) {
839
1024
  assert.equal(shellHeaderUsageHit(chrome, chrome.usageSpan.start, chrome.headerRow), true);
840
1025
  for (let y = 0; y < chrome.rows.length; y++) if (y !== chrome.headerRow) assert.equal(shellHeaderUsageHit(chrome, chrome.usageSpan.start, y), false);
@@ -875,3 +1060,20 @@ test("the narrow-layout bottom-only bar stays unchanged in the float style", (t)
875
1060
  useCardStyle(t, CARD_STYLE.FLOAT);
876
1061
  assert.deepEqual(renderShellBottomOnlyBar(data, theme, 100, "alt+u"), neon);
877
1062
  });
1063
+
1064
+ test("fullscreen bars outside the rail never list the integrations: they live only in the rail", (t) => {
1065
+ const previous = cardStyle();
1066
+ t.after(() => setCardStyle(previous));
1067
+ const painted = { ...plainTheme, bg: (_role: string, text: string) => `\x1b[48;5;22m${text}\x1b[49m` };
1068
+ const data = model({ statuses: ["🧠 gentle-pi · ready", "MCP connected"] });
1069
+ const presentation = { ...DEFAULT_VISUAL_SETTINGS, headerPlacement: "below-input" as const };
1070
+ for (const style of [CARD_STYLE.NEON, CARD_STYLE.FLOAT]) {
1071
+ setCardStyle(style);
1072
+ const rows = renderShellBottomOnlyBar(data, painted as never, 120, "alt+u", presentation).map(stripAnsi).join("\n");
1073
+ assert.doesNotMatch(rows, /gentle-pi · ready|MCP connected/, `${style}: no integrations in the bottom bar`);
1074
+ assert.match(rows, /ctx/, `${style}: the bar itself stays`);
1075
+ }
1076
+ setCardStyle(CARD_STYLE.FLOAT);
1077
+ const float = renderShellBelowInputFloat(data, painted as never, 120, "alt+u", presentation)!;
1078
+ assert.doesNotMatch(float.rows.map(stripAnsi).join("\n"), /gentle-pi · ready|MCP connected/, "no integrations under the input");
1079
+ });
@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
2
2
  import test from "node:test";
3
3
  import { visibleWidth } from "@earendil-works/pi-tui";
4
4
  import {
5
- CARD_STYLE, CARD_TONE, cardAwaitingResult, cardRunningLine, cardStyle, cardTopRows, markCardResult, panelExtraRows, panelHeaderRow, renderCard, setCardStyle,
5
+ CARD_STYLE, CARD_TONE, cardAwaitingResult, cardRunningLine, cardStyle, cardTopRows, headingFits, markCardResult, panelExtraRows, panelHeaderRow, renderCard, setCardStyle,
6
6
  type Card, type CardStyle, type CardTone,
7
7
  } from "../lib/shell-card.ts";
8
8
  import { stripAnsi } from "../lib/terminal-theme.ts";
@@ -493,3 +493,15 @@ test("a call card awaits its result until pi finishes the row or a result render
493
493
  assert.equal(cardRunningLine(CARD_TONE.WARNING, plainTheme, 20), `│ running…${" ".repeat(8)} │`);
494
494
  for (const width of [0, 1, 2, 3, 4, 5, 6, 7, 8]) assert.ok(visibleWidth(cardRunningLine(CARD_TONE.WARNING, plainTheme, width)) <= width);
495
495
  });
496
+
497
+ test("headingFits says whether a composed subtitle still leaves room for the key hint", () => {
498
+ const card: Card = { title: "Agent status", subtitle: "explore", body: [], tone: CARD_TONE.INFO, glyph: "◎" };
499
+ const hint = "expand";
500
+ // cardTop needs title + glyph, the separator and subtitle, the frame columns and the hinted tail.
501
+ const needed = visibleWidth("◎ Agent status") + 3 + visibleWidth("explore") + 5 + visibleWidth(hint) + 2;
502
+ assert.equal(headingFits(card, hint, needed), true, "exactly enough columns still shows the hint");
503
+ assert.equal(headingFits(card, hint, needed - 1), false, "one column short is a no");
504
+ assert.equal(headingFits(card, undefined, needed - (visibleWidth(hint) + 2)), true, "without a hint exactly the head columns are enough");
505
+ assert.equal(headingFits(card, undefined, needed - (visibleWidth(hint) + 3)), false, "and one column less is still a no");
506
+ assert.equal(headingFits({ ...card, subtitle: undefined }, hint, needed - 9), true, "no subtitle frees its separator and columns");
507
+ });