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,108 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { installPagePaint, pageColors, paintPageRow } from "../lib/shell-page.ts";
4
+
5
+ const FG = "\x1b[38;2;64;66;72m";
6
+ const light = { appearance: "light", getFgAnsi: (token: string) => (token === "text" ? FG : ""), getColorMode: () => "truecolor" };
7
+ const strip = (line: string) => line.replace(/\x1b\[[0-9;]*m/g, "");
8
+
9
+ test("only a light theme gets a painted page: dark themes keep the terminal background", () => {
10
+ assert.equal(pageColors({ ...light, appearance: "dark" }), undefined);
11
+ assert.equal(pageColors({}), undefined);
12
+ const page = pageColors(light)!;
13
+ assert.equal(page.fg, FG, "default-colored text takes the theme's text color");
14
+ assert.match(page.bg, /^\x1b\[48;2;\d+;\d+;\d+m$/);
15
+ assert.equal(pageColors({ ...light, getColorMode: () => "256color" })!.bg, "\x1b[48;5;255m");
16
+ });
17
+
18
+ test("a page row fills the width and re-arms only what each reset cleared", () => {
19
+ const page = pageColors(light)!;
20
+ const card = "\x1b[48;5;194m";
21
+ const row = paintPageRow(`plain ${card}card \x1b[31mred\x1b[39m still card\x1b[49m after`, 40, page);
22
+ assert.equal(strip(row).length, 40, "the row is padded to the full width");
23
+ assert.ok(row.startsWith(page.bg + page.fg), "the row opens on the page");
24
+ assert.ok(row.includes(`\x1b[39m${page.fg} still card`), "a foreground reset brings back the page text color");
25
+ assert.ok(!row.includes(`\x1b[39m${page.bg}`), "a foreground reset keeps the card background");
26
+ assert.ok(row.includes(`\x1b[49m${page.bg} after`), "a background reset brings back the page");
27
+ assert.ok(paintPageRow("a\x1b[0mb", 4, page).includes(`\x1b[0m${page.bg}${page.fg}b`), "a full reset re-arms both");
28
+ assert.ok(paintPageRow("a\x1b[mb", 4, page).includes(`\x1b[m${page.bg}${page.fg}b`));
29
+ // Color components equal to 0 are not resets.
30
+ assert.equal(paintPageRow("\x1b[38;2;0;0;0mx", 1, page), `${page.bg}${page.fg}\x1b[38;2;0;0;0mx\x1b[0m`);
31
+ assert.equal(paintPageRow("\x1b[48;5;0mx", 1, page), `${page.bg}${page.fg}\x1b[48;5;0mx\x1b[0m`);
32
+ assert.equal(paintPageRow("", 3, page), `${page.bg}${page.fg} \x1b[0m`, "an empty row is still painted");
33
+ });
34
+
35
+ test("the page paint wraps the fullscreen render only, follows theme changes and uninstalls", () => {
36
+ let theme: object = light;
37
+ const calls: string[][] = [];
38
+ const tui = {
39
+ applyLineResets: (lines: string[]) => lines.map((line) => `${line}\x1b[0m`),
40
+ doRender() { calls.push(this.applyLineResets(["hi"])); },
41
+ terminal: { columns: 6 },
42
+ };
43
+ const uninstall = installPagePaint(tui, () => theme);
44
+ assert.deepEqual(tui.applyLineResets(["doc"]), ["doc\x1b[0m"], "the scrollback document dump stays unpainted");
45
+ tui.doRender();
46
+ assert.equal(strip(calls[0]![0]!), "hi ");
47
+ assert.ok(calls[0]![0]!.startsWith("\x1b[48;2;"));
48
+ theme = { appearance: "dark" };
49
+ tui.doRender();
50
+ assert.deepEqual(calls[1], ["hi\x1b[0m"], "switching to a dark theme stops painting");
51
+ theme = light;
52
+ uninstall();
53
+ tui.doRender();
54
+ assert.deepEqual(calls[2], ["hi\x1b[0m"], "uninstall restores the render");
55
+ assert.equal(installPagePaint({}, () => light)(), undefined, "a host without the fullscreen renderer is left alone");
56
+ });
57
+
58
+ test("an old page-paint disposer cannot displace a replacement or read its stale theme", () => {
59
+ let oldLive = true;
60
+ let staleReads = 0;
61
+ let theme: object = light;
62
+ const frames: string[] = [];
63
+ const tui = {
64
+ applyLineResets: (lines: string[]) => lines.map((line) => `${line}\x1b[0m`),
65
+ doRender() { frames.push(this.applyLineResets(["hi"])[0]!); },
66
+ terminal: { columns: 4 },
67
+ };
68
+ const removeOld = installPagePaint(tui, () => {
69
+ if (!oldLive) { staleReads++; throw new Error("old theme is stale"); }
70
+ return light;
71
+ });
72
+ const oldRender = tui.doRender;
73
+ const removeNew = installPagePaint(tui, () => theme);
74
+ const newRender = tui.doRender;
75
+ const newResets = tui.applyLineResets;
76
+ removeOld();
77
+ oldLive = false;
78
+ removeOld();
79
+ assert.equal(tui.doRender, newRender);
80
+ assert.equal(tui.applyLineResets, newResets);
81
+ assert.doesNotThrow(() => tui.doRender(), "replacement can still call the old wrapper in its chain");
82
+ assert.ok(frames.at(-1)!.startsWith("\x1b[48;2;"));
83
+ theme = { appearance: "dark" };
84
+ tui.doRender();
85
+ assert.equal(frames.at(-1), "hi\x1b[0m", "the new owner's dark theme stops painting");
86
+ assert.doesNotThrow(() => oldRender.call(tui), "a queued old wrapper is inert after teardown");
87
+ assert.equal(staleReads, 0);
88
+ removeNew();
89
+ tui.doRender();
90
+ assert.equal(frames.at(-1), "hi\x1b[0m", "no page remains after both owners stop");
91
+ assert.equal(staleReads, 0);
92
+ });
93
+
94
+ test("the page follows a theme switch behind one stable theme object (Pi's theme is a proxy)", () => {
95
+ const state = { appearance: "light", name: "light" };
96
+ const proxy = { get appearance() { return state.appearance; }, get name() { return state.name; }, getFgAnsi: () => FG, getColorMode: () => "truecolor" };
97
+ const frames: string[] = [];
98
+ const tui = { applyLineResets: (lines: string[]) => lines, doRender() { frames.push(this.applyLineResets(["hi"])[0]!); }, terminal: { columns: 4 } };
99
+ installPagePaint(tui, () => proxy);
100
+ tui.doRender();
101
+ Object.assign(state, { appearance: "dark", name: "dark" });
102
+ tui.doRender();
103
+ Object.assign(state, { appearance: "light", name: "light" });
104
+ tui.doRender();
105
+ assert.ok(frames[0]!.startsWith("\x1b[48;2;"));
106
+ assert.equal(frames[1], "hi", "switching to a dark theme stops painting");
107
+ assert.ok(frames[2]!.startsWith("\x1b[48;2;"), "switching back paints again");
108
+ });
@@ -0,0 +1,360 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { visibleWidth } from "@earendil-works/pi-tui";
4
+ import { paintPanelSurface, PANEL_SURFACE_ROLE, panelSheetBackHit, renderPanelHeader, renderPanelRow, renderPanelSheet, renderWorkRow } from "../lib/shell-panel.ts";
5
+ import { renderTodoSection, todoWorkSummary, type TodoState } from "../lib/shell-todo.ts";
6
+ import { renderJobsSection } from "../lib/jobs-widget.ts";
7
+ import { JOB_GLYPH } from "../lib/background-jobs-tools.ts";
8
+ import { stripAnsi } from "../lib/terminal-theme.ts";
9
+ import { renderShellSidebarBar, renderShellStatusBar, renderShellStatusSections, renderShellTitleRow } from "../lib/shell-bar.ts";
10
+
11
+ // The fullscreen rail draws its sections as one panel (design/shell-rework/02-proposal.html):
12
+ // a one-row header `▾ NAME … count` and dense rows, no card chrome.
13
+
14
+ const theme = {
15
+ fg: (color: string, text: string) => `<${color}>${text}</${color}>`,
16
+ bold: (text: string) => `*${text}*`,
17
+ strikethrough: (text: string) => `~${text}~`,
18
+ };
19
+ const plain = { fg: (_color: string, text: string) => text, bold: (text: string) => text, strikethrough: (text: string) => text };
20
+
21
+ test("a panel header names the section in bold caps with its count right-aligned", () => {
22
+ assert.equal(visibleWidth(renderPanelHeader(plain, 40, { title: "Todos", count: "2/6", open: true })), 40);
23
+ const row = renderPanelHeader(theme, 80, { title: "Todos", count: "2/6", open: true });
24
+ assert.match(row, /<muted>▾<\/muted> <text>\*TODOS\*<\/text>/);
25
+ assert.match(row, /<muted>2\/6<\/muted>$/);
26
+ assert.match(renderPanelHeader(theme, 40, { title: "Todos", count: "2/6", open: false }), /<muted>▸<\/muted>/);
27
+ });
28
+
29
+ test("a hovered panel header paints its glyph with the shared hover role", () => {
30
+ assert.match(renderPanelHeader(theme, 40, { title: "Jobs", open: true, hovered: true }), /<warning>▾<\/warning>/);
31
+ });
32
+
33
+ test("a panel row keeps the right column and clips the left one to the width", () => {
34
+ const row = stripAnsi(renderPanelRow(30, "● job-1 a very long command line that does not fit", "2m03s"));
35
+ assert.equal(visibleWidth(row), 30);
36
+ assert.match(row, /^ ● job-1 .*…\s+2m03s$/);
37
+ assert.equal(stripAnsi(renderPanelRow(20, "short")), " short".padEnd(20));
38
+ });
39
+
40
+ test("the panel surface paints the rail role behind the row and re-arms it after resets", () => {
41
+ const bg = (color: string, text: string) => `[${color}]${text}\x1b[49m`;
42
+ const painted = paintPanelSurface({ fg: plain.fg, bg }, ["a\x1b[0mb"]);
43
+ assert.equal(PANEL_SURFACE_ROLE, "customMessageBg");
44
+ assert.deepEqual(painted, ["[customMessageBg]a\x1b[0m[customMessageBg]b\x1b[49m"]);
45
+ assert.deepEqual(paintPanelSurface(plain, ["row"]), ["row"], "a theme without bg keeps rows unpainted");
46
+ });
47
+
48
+ const state = (tasks: Array<[string, string, string?]>): TodoState => ({
49
+ tasks: tasks.map(([title, status, note], index) => ({ id: index + 1, title, status: status as never, ...(note ? { note } : {}) })),
50
+ nextId: tasks.length + 1,
51
+ updatedTurn: 0,
52
+ });
53
+
54
+ test("the Todos section folds finished work into one row and keeps open tasks one row each", () => {
55
+ const todos = state([["Rebuild the chain", "done"], ["Create the issue", "done"], ["Run the full suite", "in_progress", "job-1"], ["Push the tracker", "pending"], ["Drop it", "dropped"]]);
56
+ const section = renderTodoSection(todos, plain, 40, { collapsed: false, staleTurns: 0 });
57
+ assert.equal(stripAnsi(section.header).trim().replace(/\s+/g, " "), "▾ TODOS 2/4");
58
+ assert.deepEqual(section.body.map((row) => stripAnsi(row).trimEnd()), [
59
+ " ✓ 2 done",
60
+ " ✕ 1 dropped",
61
+ " ◐ Run the full suite",
62
+ " └ job-1",
63
+ " ○ Push the tracker",
64
+ ]);
65
+ for (const row of [section.header, ...section.body]) assert.equal(visibleWidth(stripAnsi(row)), 40);
66
+ });
67
+
68
+ test("the task in progress wraps its title and note so the current work is readable in full", () => {
69
+ const todos = state([["Run the focused tests, the typecheck and the full suite", "in_progress", "job-1 pnpm test in the worktree"], ["A pending task with a very long title that clips", "pending"]]);
70
+ const rows = renderTodoSection(todos, plain, 30, { collapsed: false, staleTurns: 0 }).body.map((row) => stripAnsi(row).trimEnd());
71
+ assert.deepEqual(rows, [
72
+ " ◐ Run the focused tests, the",
73
+ " typecheck and the full",
74
+ " suite",
75
+ " └ job-1 pnpm test in the",
76
+ " worktree",
77
+ " ○ A pending task with a ver…",
78
+ ]);
79
+ });
80
+
81
+ test("a collapsed Todos section keeps only the task in progress", () => {
82
+ const todos = state([["Done", "done"], ["Current", "in_progress"], ["Next", "pending"]]);
83
+ const section = renderTodoSection(todos, plain, 30, { collapsed: true, staleTurns: 0 });
84
+ assert.match(stripAnsi(section.header), /^▸ TODOS/);
85
+ assert.deepEqual(section.body.map((row) => stripAnsi(row).trimEnd()), [" ◐ Current"]);
86
+ });
87
+
88
+ test("a stale Todos section says so in its count, in the warning role", () => {
89
+ const section = renderTodoSection(state([["Current", "in_progress"]]), theme, 120, { collapsed: false, staleTurns: 3 });
90
+ assert.match(section.header, /<warning>stale · 3 turns · 0\/1<\/warning>/);
91
+ assert.deepEqual(renderTodoSection(state([]), plain, 40, { collapsed: false, staleTurns: 0 }), { header: "", body: [] });
92
+ });
93
+
94
+ test("the Jobs section lists each job with its id, label and elapsed time", () => {
95
+ const jobs = [{ id: "job-1", label: "pnpm test", startedAt: 0 }, { id: "job-2", label: "pnpm build", startedAt: 0, status: "exited" as const, exitCode: 0, endedAt: 1_000 }];
96
+ const shape = (row: string) => stripAnsi(row).trimEnd().replace(/(\S)\s{2,}/g, "$1 | ");
97
+ const lines = renderJobsSection(jobs as never, plain, 40, 30_000, { collapsed: false });
98
+ assert.deepEqual(lines.map(shape), ["▾ JOBS | 1 running · 1 finished", ` ${JOB_GLYPH} job-1 pnpm test | 30s`, " ✓ job-2 pnpm build | 1s"]);
99
+ for (const row of lines) assert.equal(visibleWidth(stripAnsi(row)), 40);
100
+ assert.deepEqual(renderJobsSection([], plain, 40, 0, { collapsed: false }), []);
101
+ const collapsed = renderJobsSection(jobs as never, plain, 40, 30_000, { collapsed: true }).map(shape);
102
+ assert.deepEqual(collapsed, ["▸ JOBS | 1 running · 1 finished", ` ${JOB_GLYPH} job-1 pnpm test | 30s`, " … 1 more"]);
103
+ assert.match(stripAnsi(renderJobsSection(jobs as never, plain, 40, 123_000, { collapsed: false })[1]!), /2m 3s$/, "a running job keeps ticking past the finished TTL");
104
+ });
105
+
106
+ /** `left` and `right` on one row of `width` columns, the way a panel row aligns them. */
107
+ const edge = (left: string, right: string, width: number) => left + " ".repeat(width - visibleWidth(left) - visibleWidth(right)) + right;
108
+
109
+ test("the rail Status draws Changes, Review and Integrations with the agent profile", () => {
110
+ const model = {
111
+ cwd: "/project", branch: "main", dirty: 2, sessionName: "my unique session", profile: "claude (session)",
112
+ modelId: "model", effort: "high", contextPercent: 45, contextWindow: 1000,
113
+ costTotal: 1, subscription: false, usage: undefined,
114
+ changes: { files: 22, added: 802, deleted: 352 },
115
+ review: { state: "consent" as const, scope: "app.ts +2 files" },
116
+ statuses: ["🧠 gentle-pi · ready", "💥 SUPER YOLO ON — no permission prompts; private paths stay blocked"],
117
+ };
118
+ const lines = renderShellSidebarBar(model, plain as never, 48, { density: "comfortable", visibility: { changes: true, rdd: true, agents: true, todo: true, usageCost: true, modelDetails: true, contextWarning: true, stats: false } }, "ctrl+shift+t todos · alt+u usage");
119
+ for (const line of lines) assert.equal(visibleWidth(line), 48, `row fills the rail: ${line}`);
120
+ const rows = lines.map((line) => line.trimEnd());
121
+ assert.deepEqual(rows, [
122
+ edge("▾ CHANGES", "22 files", 48),
123
+ edge(" +802 −352", "/gentle:changes", 48),
124
+ "",
125
+ edge("▾ REVIEW", "needs you", 48),
126
+ " Needs your consent",
127
+ " app.ts +2 files",
128
+ "",
129
+ edge("▾ INTEGRATIONS", "2", 48),
130
+ " - 🧠 gentle-pi · ready",
131
+ " - 💥 SUPER YOLO ON — no permission prompts;",
132
+ " private paths stay blocked",
133
+ "",
134
+ " ctrl+shift+t todos · alt+u usage",
135
+ ]);
136
+ assert.doesNotMatch(rows.join("\n"), /project|Branch|my unique session/, "location and session identity stay in the header");
137
+ });
138
+
139
+ test("the rail Status keeps an empty Changes row, hides Review without evidence and honors its toggles", () => {
140
+ const base = { cwd: "/p", branch: null, dirty: undefined, sessionName: undefined, modelId: "m", effort: undefined, contextPercent: null, contextWindow: 0, costTotal: 0, subscription: false, usage: undefined, statuses: [] };
141
+ const visibility = { changes: true, rdd: true, agents: true, todo: true, usageCost: true, modelDetails: true, contextWarning: true, stats: false };
142
+ const rows = renderShellSidebarBar(base, plain as never, 40, { density: "compact", visibility }).map((line) => line.trimEnd());
143
+ assert.deepEqual(rows, [edge("▾ CHANGES", "clean", 40), edge(" no captured changes", "/gentle:changes", 40), edge("▾ INTEGRATIONS", "none", 40), " no status reported"]);
144
+ const hidden = renderShellSidebarBar(base, plain as never, 40, { density: "compact", visibility: { ...visibility, changes: false } }).map((line) => line.trimEnd());
145
+ assert.doesNotMatch(hidden.join("\n"), /CHANGES/);
146
+ });
147
+
148
+ // The wide fullscreen chrome (design/shell-rework/02-proposal.html): a title row
149
+ // with the project identity above, one status bar row below.
150
+ const chromeModel = {
151
+ cwd: "~/work/gentle-pi", branch: "feat/shell-ide-rework", dirty: 3, sessionName: "fleet adopt", profile: "claude (session)",
152
+ modelId: "claude-opus-5-5", effort: "high", contextPercent: 27, contextWindow: 1000,
153
+ costTotal: 0, subscription: false, usage: undefined,
154
+ permission: { mode: "SUPER-YOLO", detail: "no permission prompts; private paths stay blocked" },
155
+ statuses: ["Permissions: SUPER-YOLO", "💥 SUPER YOLO ON — no permission prompts; private paths stay blocked", "🧠 gentle-pi · ready"],
156
+ integrations: ["🧠 gentle-pi · ready"],
157
+ };
158
+
159
+ test("the title row names the project once and always keeps the session; the profile rides the status bar", () => {
160
+ const row = stripAnsi(renderShellTitleRow(chromeModel, plain as never, 90));
161
+ assert.equal(visibleWidth(row), 90);
162
+ assert.match(row, /^ ✿ gentle-pi ~\/work\/gentle-pi +fleet adopt $/);
163
+ const narrow = stripAnsi(renderShellTitleRow(chromeModel, plain as never, 34));
164
+ assert.equal(visibleWidth(narrow), 34);
165
+ assert.match(narrow, /fleet adopt $/, "the path gives way before the session");
166
+ assert.doesNotMatch(stripAnsi(renderShellTitleRow({ ...chromeModel, sessionName: undefined, profile: undefined }, plain as never, 90)), /·/);
167
+ });
168
+
169
+ test("the status bar shows branch, permission mode, model, context, cost and usage in one row", () => {
170
+ const chrome = renderShellStatusBar(chromeModel, plain as never, 120, "alt+u");
171
+ assert.equal(chrome.rows.length, 1);
172
+ const row = stripAnsi(chrome.rows[0]!);
173
+ assert.equal(visibleWidth(row), 120);
174
+ assert.match(row, /^ feat\/shell-ide-rework ±3 │ 💥 SUPER-YOLO +claude-opus-5-5 · high │ ctx [▰▱]+ 27% │ \$0\.000 │ usage · alt\+u $/);
175
+ const yolo = stripAnsi(renderShellStatusBar({ ...chromeModel, permission: { mode: "YOLO" } }, plain as never, 120, "alt+u").rows[0]!);
176
+ assert.match(yolo, /│ 🔥 YOLO /, "YOLO keeps its fire icon (#2890)");
177
+ assert.equal(visibleWidth(yolo), 120);
178
+ assert.equal((row.match(/SUPER-YOLO/g) ?? []).length, 1, "the permission mode appears once");
179
+ assert.ok(chrome.usageSpan && row.slice(chrome.usageSpan.start, chrome.usageSpan.end).startsWith("usage"), "the usage segment is the click target");
180
+ const normal = stripAnsi(renderShellStatusBar({ ...chromeModel, permission: { mode: "NORMAL" } }, plain as never, 120, "alt+u").rows[0]!);
181
+ assert.doesNotMatch(normal, /NORMAL/, "the default permission mode stays quiet");
182
+ });
183
+
184
+ test("a narrow status bar drops usage before the model and keeps the branch", () => {
185
+ const row = stripAnsi(renderShellStatusBar(chromeModel, plain as never, 95, "alt+u").rows[0]!);
186
+ assert.equal(visibleWidth(row), 95);
187
+ assert.match(row, /feat\/shell-ide-rework/);
188
+ assert.match(row, /claude-opus-5-5/);
189
+ assert.doesNotMatch(row, /usage/, "usage gives way first");
190
+ const tighter = stripAnsi(renderShellStatusBar(chromeModel, plain as never, 70, "alt+u").rows[0]!);
191
+ assert.equal(visibleWidth(tighter), 70);
192
+ assert.doesNotMatch(tighter, /claude-opus/, "then the model");
193
+ assert.match(tighter, /feat\/shell-ide-rework ±3 │ 💥 SUPER-YOLO +ctx [▰▱]+ 27% │ \$0\.000 $/, "branch, mode, context and cost stay");
194
+ const hidden = stripAnsi(renderShellStatusBar(chromeModel, plain as never, 120, "alt+u", { density: "comfortable", visibility: { changes: true, rdd: true, agents: true, todo: true, usageCost: false, modelDetails: false, contextWarning: true, stats: false } }).rows[0]!);
195
+ assert.doesNotMatch(hidden, /claude-opus|ctx|\$0\.000|usage/, "the visibility toggles hide model, context, cost and usage");
196
+ });
197
+
198
+ test("Integrations bullets distinguish items from continuations without losing details or folding", () => {
199
+ const model = { ...chromeModel, integrations: ["🧠 gentle-pi · ready", "Fast requested; last response from server: Standard (default)"] };
200
+ const visibility = { changes: false, rdd: true, agents: true, todo: true, usageCost: true, modelDetails: true, contextWarning: true, stats: false };
201
+ for (const width of [28, 40, 72]) {
202
+ const result = renderShellStatusSections(model, plain, width, { density: "compact", visibility });
203
+ const [header, ...body] = result.lines.map(line => stripAnsi(line).trimEnd());
204
+ assert.match(header, /INTEGRATIONS\s+3$/);
205
+ const firstBullet = body.findIndex(line => line.startsWith(" - "));
206
+ assert.equal(firstBullet, 0, "the status bullets open the section; the profile lives in Stats and the bars");
207
+ const bullets = body.slice(firstBullet);
208
+ assert.equal(bullets.filter(line => line.startsWith(" - ")).length, 3);
209
+ assert.ok(bullets.every(line => line.startsWith(" - ") || line.startsWith(" ")), "wrapped lines align beneath the item's text");
210
+ const content = bullets.map(line => line.replace(/^ - /, "").trim()).join(" ");
211
+ assert.match(content, /no permission prompts; private paths stay blocked/);
212
+ assert.match(content, /Fast requested; last response from server: Standard \(default\)/);
213
+ for (const line of result.lines) assert.equal(visibleWidth(line), width);
214
+ assert.deepEqual(result.targets, [{ row: 0, kind: "toggle", section: "integrations" }]);
215
+ const folded = renderShellStatusSections(model, plain, width, { density: "compact", visibility }, undefined, { collapsed: new Set(["integrations"]) });
216
+ assert.equal(folded.lines.length, 1);
217
+ assert.match(stripAnsi(folded.lines[0]), /INTEGRATIONS\s+3$/);
218
+ }
219
+ });
220
+
221
+ test("Integrations explains the permission mode without repeating it", () => {
222
+ const rows = renderShellSidebarBar(chromeModel, plain as never, 48).map((line) => line.trimEnd());
223
+ const at = rows.findIndex((row) => row.startsWith("▾ INTEGRATIONS"));
224
+ assert.deepEqual(rows.slice(at + 1), [" - permissions no permission prompts; private", " paths stay blocked", " - 🧠 gentle-pi · ready"]);
225
+ assert.doesNotMatch(rows.join("\n"), /SUPER-YOLO|SUPER YOLO/);
226
+ });
227
+
228
+ // Mobile (design/shell-rework/05-mobile.html, 07-many-agents-mobile.html): below
229
+ // the rail breakpoint live work folds into one row above the editor, and
230
+ // /gentle:panel opens the rail's sections as a full-width sheet.
231
+ test("the work row shows the current todo, or the agents while they run, with the todo count", () => {
232
+ const todo = todoWorkSummary(state([["Done", "done"], ["Run the full suite", "in_progress"], ["Next", "pending"]]), plain);
233
+ assert.deepEqual(todo, { left: "◐ Run the full suite", right: "1/3", rightLabel: "todos" });
234
+ assert.equal(todoWorkSummary(state([]), plain), undefined);
235
+ const row = stripAnsi(renderWorkRow([todo!], plain, 40)!);
236
+ assert.equal(visibleWidth(row), 40);
237
+ assert.match(row, /^ ▸ ◐ Run the full suite +1\/3 $/);
238
+ const withAgents = stripAnsi(renderWorkRow([todo!, { left: "◐ 3 agents · ? 1 waiting", priority: 1 }], plain, 56)!);
239
+ assert.match(withAgents, /^ ▸ ◐ 3 agents · \? 1 waiting +1\/3 todos $/, "agents lead while they run; the todo count stays");
240
+ assert.equal(renderWorkRow([], plain, 40), undefined);
241
+ });
242
+
243
+ test("the panel sheet stacks the rail sections under a title row and scrolls within its rows", () => {
244
+ const parts = new Map<string, { render(width: number): string[]; invalidate(): void }>([
245
+ ["todo", { render: (width: number) => ["▾ TODOS".padEnd(width), " ○ one".padEnd(width)], invalidate() {} }],
246
+ ["agents", { render: (width: number) => ["▾ AGENTS".padEnd(width)], invalidate() {} }],
247
+ ["footer", { render: (width: number) => ["▾ CHANGES".padEnd(width), " clean".padEnd(width)], invalidate() {} }],
248
+ ]);
249
+ const sheet = renderPanelSheet(parts as never, plain, 30, { rows: 20, scrollTop: 0 });
250
+ const rows = sheet.lines.map((line) => stripAnsi(line).trimEnd());
251
+ assert.deepEqual(rows, [edge(" ✿ Panel", "esc back ", 30).trimEnd(), "", " ▾ TODOS", " ○ one", "", " ▾ AGENTS", "", " ▾ CHANGES", " clean", ...Array(11).fill("")]);
252
+ for (const line of sheet.lines) assert.equal(visibleWidth(stripAnsi(line)), 30);
253
+ const clipped = renderPanelSheet(parts as never, plain, 30, { rows: 5, scrollTop: 2 });
254
+ assert.equal(clipped.lines.length, 5, "title row plus four content rows");
255
+ assert.match(stripAnsi(clipped.lines[1]!), /○ one/, "the content scrolls under the fixed title row");
256
+ assert.equal(clipped.maxScroll, 4, "eight content rows in a four-row viewport");
257
+ assert.match(stripAnsi(clipped.lines.at(-1)!), /↓ 3 more · scroll/);
258
+ const end = renderPanelSheet(parts as never, plain, 30, { rows: 5, scrollTop: 4 }).lines.map((line) => stripAnsi(line).trimEnd());
259
+ assert.deepEqual(end.slice(1), [" ▾ AGENTS", "", " ▾ CHANGES", " clean"], "the last page shows the last rows without a more row");
260
+ });
261
+
262
+ test("the mobile sheet wraps and scrolls a long Integrations status", () => {
263
+ const model = { ...chromeModel, permission: undefined, integrations: ["mobile-integration-with-a-long-name (local)", "MCP connected"] };
264
+ const visibility = { changes: false, rdd: true, agents: true, todo: true, usageCost: true, modelDetails: true, contextWarning: true, stats: false };
265
+ const parts = new Map([["footer", { render: (width: number) => renderShellSidebarBar(model, plain, width, { density: "compact", visibility }) }]]);
266
+ const full = renderPanelSheet(parts, plain, 28, { rows: 15, scrollTop: 0 });
267
+ assert.match(full.lines.join("").replace(/\s/g, ""), /mobile-integration-with-a-long-name\(local\)/);
268
+ assert.match(full.lines.join("\n"), /INTEGRATIONS\s+2/);
269
+ const top = renderPanelSheet(parts, plain, 28, { rows: 5, scrollTop: 0 });
270
+ assert.ok(top.maxScroll > 0);
271
+ assert.match(top.lines.join("\n"), /INTEGRATIONS/);
272
+ assert.match(top.lines.join("\n"), /mobile-integration/);
273
+ const end = renderPanelSheet(parts, plain, 28, { rows: 5, scrollTop: top.maxScroll });
274
+ assert.match(end.lines.join("\n"), /MCP connected/);
275
+ for (const line of [...top.lines, ...end.lines]) assert.equal(visibleWidth(line), 28);
276
+ });
277
+
278
+ test("a short sheet fills the resized viewport with painted rows without adding scroll content", () => {
279
+ const painted = { ...plain, bg: (_color: string, text: string) => `\x1b[48;5;22m${text}\x1b[49m` };
280
+ const parts = new Map([["todo", { render: (width: number) => ["▾ TODOS".padEnd(width)] }]]);
281
+ for (const rows of [12, 6]) {
282
+ const sheet = renderPanelSheet(parts, painted, 30, { rows, scrollTop: 99 });
283
+ assert.equal(sheet.lines.length, rows);
284
+ assert.equal(sheet.maxScroll, 0, "padding does not extend the scroll range");
285
+ assert.ok(sheet.lines.every((line) => visibleWidth(line) === 30 && line.includes("\x1b[48;5;22m")), "every row fills and paints the surface");
286
+ assert.equal(stripAnsi(sheet.lines.at(-1)!), " ".repeat(30));
287
+ }
288
+ });
289
+
290
+ test("the mobile title row carries the model and the profile, since the narrow status bar leaves them out", () => {
291
+ const row = stripAnsi(renderShellTitleRow(chromeModel, plain as never, 72, { model: true }));
292
+ assert.equal(visibleWidth(row), 72);
293
+ assert.match(row, /^ ✿ gentle-pi .*claude-opus-5-5 · high · claude \(session\) $/);
294
+ });
295
+
296
+ test("a long branch gives way before the context and cost in a phone-width status bar", () => {
297
+ const longBranch = { ...chromeModel, branch: "feat/shell-ide-rework-07-mobile", dirty: undefined };
298
+ const narrowSettings = { density: "comfortable" as const, visibility: { changes: true, rdd: true, agents: true, todo: true, usageCost: true, modelDetails: false, contextWarning: true, stats: false } };
299
+ const row = stripAnsi(renderShellStatusBar(longBranch, plain as never, 56, "alt+u", narrowSettings).rows[0]!);
300
+ assert.equal(visibleWidth(row), 56);
301
+ assert.match(row, /ctx [▰▱]+ 27% │ \$0\.000 $/, "context and cost stay");
302
+ assert.match(row, /^ feat\/shell\S*… │ 💥 SUPER-YOLO /, "the branch is clipped and the permission mode stays");
303
+ });
304
+
305
+ test("the rail Status sections are click targets: headers collapse them and the Changes row opens /gentle:changes", () => {
306
+ const model = { ...chromeModel, changes: { files: 2, added: 7, deleted: 3 }, review: undefined };
307
+ const open = renderShellStatusSections(model, plain as never, 48, undefined, undefined, {});
308
+ const at = (pattern: RegExp) => open.lines.findIndex((line) => pattern.test(stripAnsi(line)));
309
+ assert.deepEqual(open.targets, [
310
+ { row: at(/^▾ CHANGES/), kind: "toggle", section: "changes" },
311
+ { row: at(/\+7 −3/), kind: "open-changes" },
312
+ { row: at(/^▾ INTEGRATIONS/), kind: "toggle", section: "integrations" },
313
+ ]);
314
+ const collapsed = renderShellStatusSections(model, plain as never, 48, undefined, undefined, { collapsed: new Set(["integrations"]) }).lines.map((line) => stripAnsi(line).trimEnd());
315
+ assert.ok(collapsed.some((line) => /^▸ INTEGRATIONS/.test(line)), "a collapsed section keeps its header with ▸");
316
+ assert.ok(!collapsed.some((line) => /gentle-pi · ready/.test(line)), "and hides its rows");
317
+ const hovered = renderShellStatusSections(model, theme as never, 120, undefined, undefined, { hovered: "changes" }).lines.join("\n");
318
+ assert.match(hovered, /<warning>▾<\/warning> <warning>\*CHANGES\*<\/warning>/, "a hovered header paints the shared hover role");
319
+ const hoveredOpen = renderShellStatusSections(model, theme as never, 120, undefined, undefined, { hovered: "open-changes" }).lines.join("\n");
320
+ assert.match(hoveredOpen, /<warning>\/gentle:changes<\/warning>/, "a hovered Changes row paints its command in the hover role");
321
+ assert.deepEqual(renderShellSidebarBar(model, plain as never, 48), open.lines, "renderShellSidebarBar stays the lines of the same render");
322
+ });
323
+
324
+ test("the work row and the sheet's esc back show they are clickable", () => {
325
+ const hovered = renderWorkRow([{ left: "◐ Run the suite", right: "1/3" }], theme as never, 80, true)!;
326
+ assert.match(hovered, /<warning>▸<\/warning>/, "a hovered work row paints its affordance in the hover role");
327
+ assert.doesNotMatch(renderWorkRow([{ left: "◐ Run the suite", right: "1/3" }], theme as never, 80)!, /<warning>/);
328
+ const parts = new Map([["todo", { render: (width: number) => ["▾ TODOS".padEnd(width)] }]]);
329
+ assert.match(renderPanelSheet(parts as never, theme as never, 80, { rows: 10, scrollTop: 0, backHovered: true }).lines[0]!, /<warning>esc back<\/warning>/);
330
+ assert.equal(panelSheetBackHit(30, 25, 0), true, "a click on esc back closes the sheet");
331
+ assert.equal(panelSheetBackHit(30, 5, 0), false);
332
+ assert.equal(panelSheetBackHit(30, 25, 1), false, "only the title row carries the control");
333
+ });
334
+
335
+ test("minimal density drops the rail's key hints row; compact keeps it", () => {
336
+ const visibility = { changes: true, rdd: true, agents: true, todo: true, usageCost: true, modelDetails: true, contextWarning: true, stats: false };
337
+ const hints = "alt+u usage · / commands";
338
+ const compact = renderShellStatusSections(chromeModel, plain as never, 48, { density: "compact", visibility }, hints, {}).lines.map(stripAnsi).join("\n");
339
+ const minimal = renderShellStatusSections(chromeModel, plain as never, 48, { density: "minimal", visibility }, hints, {}).lines.map(stripAnsi).join("\n");
340
+ assert.match(compact, /alt\+u usage/);
341
+ assert.doesNotMatch(minimal, /alt\+u usage/);
342
+ });
343
+
344
+ test("the agent profile lives next to the model in the bars and in Stats, never in Integrations", async () => {
345
+ const { collectSessionStats } = await import("../lib/shell-stats.ts");
346
+ const bar = stripAnsi(renderShellStatusBar(chromeModel, plain as never, 140, "alt+u").rows[0]!);
347
+ assert.match(bar, /claude-opus-5-5 · high · claude \(session\) │ ctx/, "the profile follows the model and effort");
348
+ const roomy = stripAnsi(renderShellStatusBar(chromeModel, plain as never, 120, "alt+u").rows[0]!);
349
+ assert.match(roomy, /claude-opus-5-5 · high │ ctx .*usage/, "the profile gives way before usage");
350
+ const tight = stripAnsi(renderShellStatusBar(chromeModel, plain as never, 70, "alt+u").rows[0]!);
351
+ assert.doesNotMatch(tight, /claude \(session\)/, "the profile gives way with the model");
352
+ const sections = renderShellStatusSections({ ...chromeModel, stats: collectSessionStats([]) }, plain as never, 48, undefined, undefined, {}).lines.map(stripAnsi);
353
+ const integrations = sections.slice(sections.findIndex((row) => /INTEGRATIONS/.test(row)));
354
+ assert.doesNotMatch(integrations.join("\n"), /profile/i, "Integrations no longer lists the profile");
355
+ const stats = sections.slice(sections.findIndex((row) => /STATS/.test(row)), sections.findIndex((row) => /INTEGRATIONS/.test(row)));
356
+ assert.match(stats.join("\n"), /profile +claude \(session\)/, "Stats names the profile");
357
+ const mobile = stripAnsi(renderShellTitleRow(chromeModel, plain as never, 90, { model: true }));
358
+ assert.match(mobile, /claude-opus-5-5 · high · claude \(session\) $/, "on a phone the title row carries model and profile");
359
+ assert.doesNotMatch(stripAnsi(renderShellTitleRow(chromeModel, plain as never, 90)), /claude \(session\)/, "the split title row leaves the profile to the bar");
360
+ });
@@ -4,6 +4,7 @@ import { visibleWidth } from "@earendil-works/pi-tui";
4
4
  import { stripAnsi } from "../lib/terminal-theme.ts";
5
5
  import {
6
6
  framePromptLines,
7
+ resolvePromptLayout,
7
8
  scanWorkingText,
8
9
  PROMPT_STATE,
9
10
  petalGlyph,
@@ -284,3 +285,56 @@ test("T2 float prompt rearms real SGR resets without altering inversion or marke
284
285
  assert.ok(rows[1].includes(`${marker}\x1b[7mx\x1b[0m${open}Y\x1b[0;7m${open}Z\x1b[27m`));
285
286
  }
286
287
  });
288
+
289
+ // The wide IDE chrome's editor (design/shell-rework/02-proposal.html): a titled
290
+ // rule carrying the agent state and the vim mode, the input behind a `›`
291
+ // prompt, no side rules, and the same row count as the framed editor.
292
+ test("the panel prompt layout gives the input a two-column prompt and no right border", () => {
293
+ const layout = resolvePromptLayout(60, "float", (_color, text) => `\x1b[44m${text}\x1b[49m`, true);
294
+ assert.deepEqual({ width: layout.width, nativeWidth: layout.nativeWidth, prefixWidth: layout.prefixWidth, background: layout.background, panel: layout.panel }, { width: 60, nativeWidth: 58, prefixWidth: 2, background: "", panel: true });
295
+ });
296
+
297
+ test("the panel rule reserves a distinct, hoverable Panel control with and without Vim", () => {
298
+ const colors: Record<string, number> = { accent: 30, warning: 208, muted: 245 };
299
+ const fg = (role: string, text: string) => `\x1b[38;5;${colors[role] ?? 255}m${text}\x1b[39m`;
300
+ for (const width of [24, 40, 80, 139, 180]) {
301
+ const layout = resolvePromptLayout(width, "neon", undefined, true);
302
+ for (const escHint of [undefined, "INSERT"]) {
303
+ const render = (panelHovered: boolean) => framePromptLines(editorLines(width), width, options({ fg, escHint, panelButton: true, panelHovered }), layout);
304
+ const idle = render(false);
305
+ const hovered = render(true);
306
+ assert.equal(idle.length, 3);
307
+ assert.ok(idle.every((line) => visibleWidth(line) === width));
308
+ assert.ok(idle[0]!.includes("\x1b[38;5;30m[ Panel ]\x1b[39m"), `accent control at width ${width}`);
309
+ assert.ok(hovered[0]!.includes("\x1b[38;5;208m[ Panel ]\x1b[39m"), "hover uses the shared warning role");
310
+ if (escHint) assert.match(stripAnsi(idle[0]!), /\[ Panel \].*INSERT/);
311
+ assert.deepEqual(render(false), idle, "leaving returns the idle appearance");
312
+ }
313
+ }
314
+ const layout = resolvePromptLayout(80, "neon", undefined, true);
315
+ const withHint = framePromptLines(editorLines(80), 80, options({ fg, panelButton: true, escHint: "INSERT · esc again to cancel", state: PROMPT_STATE.WORKING, workingLabel: "exploring…" }), layout);
316
+ assert.match(stripAnsi(withHint[0]!), /exploring….*\[ Panel \].*INSERT · esc again to cancel/);
317
+ const queued = framePromptLines(editorLines(80), 80, options({ fg, panelButton: true, state: PROMPT_STATE.QUEUED }), layout);
318
+ assert.match(stripAnsi(queued[0]!), /queued.*\[ Panel \]/);
319
+ for (const width of [9, 10, 12, 16, 20]) {
320
+ const narrow = framePromptLines(editorLines(24), width, options({ fg, panelButton: true, escHint: "INSERT" }), resolvePromptLayout(width, "neon", undefined, true));
321
+ assert.ok(narrow.every((line) => visibleWidth(line) <= width), `width ${width}: ${narrow.map(visibleWidth).join(", ")}`);
322
+ assert.ok(stripAnsi(narrow[0]!).includes("[ Panel ]"));
323
+ }
324
+ assert.doesNotMatch(framePromptLines(editorLines(80), 80, options({ fg, panelButton: true })).join("\n"), /\[ Panel \]/, "regular chrome never promises an inert control");
325
+ });
326
+
327
+ test("the panel prompt frame titles its rule with state and mode and keeps the row count", () => {
328
+ const plain = (_color: string, text: string) => text;
329
+ const layout = resolvePromptLayout(40, "neon", undefined, true);
330
+ const lines = framePromptLines(editorLines(40, ["first line", "second line"]), 40, options({ fg: plain, escHint: "INSERT" }), layout).map(stripAnsi);
331
+ assert.equal(lines.length, 4, "rule, two input rows, closing row");
332
+ for (const line of lines) assert.equal(visibleWidth(line), 40);
333
+ assert.match(lines[0]!, /^─ ✿ waiting for input ─+ INSERT ─$/);
334
+ assert.equal(lines[1], "› first line".padEnd(40));
335
+ assert.equal(lines[2], " second line".padEnd(40));
336
+ assert.equal(lines[3], " ".repeat(40));
337
+ const working = framePromptLines(editorLines(40), 40, options({ fg: plain, state: PROMPT_STATE.WORKING, workingLabel: "exploring…" }), layout).map(stripAnsi);
338
+ assert.match(working[0]!, /^─ \S exploring… ─+─$/);
339
+ assert.doesNotMatch(lines.join("\n"), /[╭╮╰╯│▎]/u);
340
+ });
@@ -165,10 +165,12 @@ function footerMemoFixture() {
165
165
  let style: unknown = "comfortable";
166
166
  const footerData = { getGitBranch: () => branch, getExtensionStatuses: () => statuses } as unknown as ShellFooterData;
167
167
  let profile: string | undefined = "team";
168
+ let profileTier: "standard" | "fast" | undefined;
168
169
  const memo = createFooterStatusMemo({
169
170
  pi, ctx: ctx as unknown as ExtensionContext, footerData,
170
171
  usage: () => usage,
171
172
  profile: () => profile,
173
+ profileTier: () => profileTier,
172
174
  jobs: () => jobs,
173
175
  review: () => review,
174
176
  tracker: () => ({ model: { files: [{ path: "a.ts", status: CHANGE_STATUS.MODIFIED, added, deleted }], added, deleted }, unbornRoots: Array.from({ length: unbornRoots }, () => "root") }),
@@ -183,6 +185,7 @@ function footerMemoFixture() {
183
185
  spend: () => { entries[0]!.message.usage.cost.total += 1; },
184
186
  setModelId: (value: string) => { model = { ...model, id: value }; },
185
187
  setProfile: (value: string | undefined) => { profile = value; },
188
+ setProfileTier: (value: "standard" | "fast") => { profileTier = value; },
186
189
  setBranch: (value: string | null) => { branch = value; },
187
190
  setStatuses: (value: Map<string, string>) => { statuses = value; },
188
191
  setUsage: (value: ProviderUsage | undefined) => { usage = value; },
@@ -211,6 +214,7 @@ test("the footer status digest key notices every live input the model reads", ()
211
214
  const mutations: Array<[string, () => void]> = [
212
215
  ["branch", () => f.setBranch("feature")],
213
216
  ["profile", () => f.setProfile("other (local)")],
217
+ ["profile tier", () => f.setProfileTier("fast")],
214
218
  ["statuses", () => f.setStatuses(new Map([["jobs", "1 running"]]))],
215
219
  ["usage", () => f.setUsage({ provider: "p", plan: undefined, limits: [], fetchedAt: 1 })],
216
220
  ["change counts", () => f.setChangeCounts(2, 1)],
@@ -234,6 +238,7 @@ test("the footer status digest key notices every live input the model reads", ()
234
238
  // A branch or profile move rebuilds the model without rescanning statistics:
235
239
  // the model object identity stays stable across those rebuilds.
236
240
  const settled = f.memo.model();
241
+ assert.equal(settled.profileTier, "fast", "the footer receives the configured tier after cache invalidation");
237
242
  const [reads, projections] = f.counts();
238
243
  f.setBranch("release");
239
244
  assert.notEqual(f.memo.model(), settled);
@@ -4,6 +4,7 @@ import { Container, Spacer, TuiAltScreen, type Component } from "@earendil-works
4
4
  import { createChatViewport } from "../node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/chat-viewport.js";
5
5
  import { installSidebar } from "../lib/shell-sidebar-layout.ts";
6
6
  import { sidebarHeader, sidebarPart } from "../lib/shell-sidebar.ts";
7
+ import { CARD_STYLE, cardStyle, setCardStyle } from "../lib/shell-card.ts";
7
8
 
8
9
  // End-to-end through pi-tui's real alt-screen renderer and Pi's real chat
9
10
  // viewport: the unit fixtures elsewhere hand-build layout nodes, which is how
@@ -46,12 +47,23 @@ async function renderViewport(columns: number, rows: number, sidebar: boolean):
46
47
 
47
48
  test("fullscreen with the sidebar leaves no blank row between the editor and the terminal edge", async () => {
48
49
  const screen = await renderViewport(140, 24, true);
49
- assert.equal(screen[0], "HEADER 138", "the header owns the first row");
50
+ assert.equal(screen[0], "HEADER 140", "the header owns the first row");
50
51
  assert.match(screen[screen.length - 1] ?? "", /^╰/, `the editor's bottom border sits on the last row, got ${JSON.stringify(screen.slice(-3))}`);
51
52
  assert.ok(screen.some((row) => row.startsWith("╭─ editor")), "the editor is still painted");
52
53
  assert.ok(screen.some((row) => row.includes("Status card")), "the rail is still painted");
53
54
  });
54
55
 
56
+ test("under a split header the rail keeps one spacer below the title block", async (t) => {
57
+ const previous = cardStyle();
58
+ t.after(() => setCardStyle(previous));
59
+ setCardStyle(CARD_STYLE.FLOAT);
60
+ const screen = await renderViewport(140, 24, true);
61
+ assert.equal(screen[0], "HEADER 140");
62
+ assert.match(screen[1]!, /^transcript /, "the transcript starts immediately below the header");
63
+ assert.doesNotMatch(screen[1]!, /Status card/, "the first rail row separates the header from its card");
64
+ assert.match(screen[2]!, /Status card/, "the first card starts after exactly one spacer row");
65
+ });
66
+
55
67
  test("fullscreen without the sidebar keeps Pi's bottom bar on the last row", async () => {
56
68
  const screen = await renderViewport(140, 24, false);
57
69
  assert.equal(screen[screen.length - 1], "BOTTOM BAR");