gentle-pi 4.6.0 → 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 (290) hide show
  1. package/README.md +10 -11
  2. package/assets/agents/gentle-ai-explore.md +1 -0
  3. package/assets/agents/gentle-ai-verify.md +5 -2
  4. package/assets/agents/gentle-ai-worker.md +3 -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 +16 -1
  12. package/assets/orchestrator-delegation-reference.md +4 -4
  13. package/assets/orchestrator-delegation.md +1 -1
  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 +7 -5
  20. package/assets/orchestrator.md +3 -3
  21. package/bin/gentle-shell.mjs +164 -56
  22. package/docs/agent-status.md +61 -0
  23. package/docs/bundled-install.md +7 -5
  24. package/docs/delegated-verification.md +29 -7
  25. package/docs/gentle-agents-activity.md +14 -0
  26. package/docs/gentle-shell.md +54 -16
  27. package/docs/install-wizard.md +1 -1
  28. package/docs/permission-modes.md +9 -4
  29. package/docs/readme-reference.md +75 -30
  30. package/docs/render-cache-performance.md +11 -1
  31. package/docs/review-coordinator.md +33 -0
  32. package/docs/review-request-context.md +19 -0
  33. package/docs/review-windows-acl.md +18 -0
  34. package/docs/voice.md +6 -3
  35. package/docs/yolo-mode.md +5 -5
  36. package/extensions/ask-user-choice.ts +1 -0
  37. package/extensions/ask-user-question.ts +1 -0
  38. package/extensions/child-safety.ts +3 -0
  39. package/extensions/gentle-agent-status.ts +99 -0
  40. package/extensions/gentle-agents.ts +326 -34
  41. package/extensions/gentle-ai.ts +1496 -454
  42. package/extensions/gentle-shell.ts +293 -63
  43. package/extensions/gentle-todo.ts +18 -2
  44. package/extensions/gentle-tps.ts +48 -0
  45. package/extensions/quiet-tools.ts +38 -8
  46. package/extensions/skill-registry.ts +175 -18
  47. package/extensions/startup-banner.ts +30 -3
  48. package/lib/agent-profile-pin.ts +3 -3
  49. package/lib/agent-profiles.ts +160 -2
  50. package/lib/agent-status.ts +105 -0
  51. package/lib/agents-config.ts +46 -0
  52. package/lib/agents-history.ts +24 -5
  53. package/lib/agents-messaging.ts +47 -5
  54. package/lib/agents-runner.ts +183 -12
  55. package/lib/auto-permission-runtime.ts +1 -1
  56. package/lib/bounded-writer-admission.ts +13 -1
  57. package/lib/card-content-policy.ts +8 -6
  58. package/lib/command-palette.ts +133 -17
  59. package/lib/context-backstop.ts +14 -5
  60. package/lib/destructive-command-guard.ts +48 -4
  61. package/lib/execution-surface-guard.ts +20 -0
  62. package/lib/exploration-budget.ts +4 -2
  63. package/lib/gentle-ai-binary.ts +1 -1
  64. package/lib/gentle-design.ts +3 -0
  65. package/lib/gentle-shell-bundled.ts +6 -19
  66. package/lib/gentle-shell-launcher.ts +43 -8
  67. package/lib/herdr-activity.ts +14 -2
  68. package/lib/herdr-busy.ts +45 -0
  69. package/lib/image-attachments.ts +33 -0
  70. package/lib/image-disk-cache.ts +137 -0
  71. package/lib/inprocess-reviewer.ts +270 -140
  72. package/lib/jobs-view.ts +198 -11
  73. package/lib/model-routing-authority.ts +22 -4
  74. package/lib/native-choice-list.ts +20 -2
  75. package/lib/native-review-cli.ts +96 -19
  76. package/lib/orchestrator-mode-policy.ts +105 -0
  77. package/lib/questionnaire/questionnaire-view.ts +105 -12
  78. package/lib/rdd-mode-control.ts +32 -0
  79. package/lib/reply-language-anchor.ts +104 -0
  80. package/lib/review-blocker.ts +92 -0
  81. package/lib/review-candidate-symlink-scan.ts +136 -0
  82. package/lib/review-candidate-view-owner.ts +81 -44
  83. package/lib/review-continuation-registry.ts +99 -0
  84. package/lib/review-coordinator.ts +163 -0
  85. package/lib/review-failure-facts.ts +49 -0
  86. package/lib/review-host-relay.ts +46 -10
  87. package/lib/review-integration-v2.ts +7 -1
  88. package/lib/review-relay-phase-timing.ts +45 -0
  89. package/lib/review-start-context.ts +17 -0
  90. package/lib/session-profile-freeze.ts +4 -2
  91. package/lib/shell-bar.ts +140 -58
  92. package/lib/shell-changes.ts +2 -0
  93. package/lib/shell-panel.ts +17 -3
  94. package/lib/shell-sidebar-layout.ts +112 -40
  95. package/lib/shell-sidebar.ts +7 -0
  96. package/lib/shell-todo.ts +10 -3
  97. package/lib/verifier-admission.ts +1 -1
  98. package/lib/visual-customization-policy.ts +36 -16
  99. package/lib/visual-customize-view.ts +216 -21
  100. package/lib/visual-layout-preview.ts +9 -5
  101. package/lib/visual-profiles.ts +2 -2
  102. package/lib/windows-session-transport.ts +53 -2
  103. package/lib/yolo-session-policy.ts +40 -15
  104. package/package.json +2 -1
  105. package/runtime/gentle-ai-binary.mjs +1 -1
  106. package/runtime/gentle-shell-bundled.mjs +6 -19
  107. package/runtime/gentle-shell-launcher.mjs +42 -7
  108. package/runtime/native-review-cli.mjs +93 -16
  109. package/runtime/review-integration-v2.mjs +7 -1
  110. package/scripts/build-full-delegation-card.mjs +175 -0
  111. package/scripts/bundled-install.mjs +38 -8
  112. package/scripts/download-progress.mjs +68 -0
  113. package/scripts/gentle-ai-installer.mjs +41 -18
  114. package/scripts/gentle-ai-proxy.mjs +294 -0
  115. package/scripts/install-gentle-ai.mjs +14 -1
  116. package/scripts/installer-preflight.mjs +5 -5
  117. package/scripts/installer-runner.mjs +27 -12
  118. package/scripts/installer-server.mjs +8 -7
  119. package/scripts/render-cache-host.mjs +72 -0
  120. package/scripts/render-cache-performance-worker.mjs +5 -4
  121. package/scripts/render-cache-performance.mjs +6 -1
  122. package/scripts/run-test-suite.mjs +40 -28
  123. package/scripts/verify-package-files.mjs +12 -2
  124. package/scripts/voice-worker.cjs +32 -6
  125. package/skills/design/SKILL.md +11 -8
  126. package/skills/gentle-ai/SKILL.md +2 -2
  127. package/skills/gentle-ui-design/SKILL.md +46 -0
  128. package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
  129. package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
  130. package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
  131. package/skills/gentle-ui-design/references/task-and-content.md +60 -0
  132. package/skills/skill-registry/SKILL.md +4 -2
  133. package/skills/work-unit-commits/SKILL.md +6 -7
  134. package/tests/agent-home.test.ts +28 -9
  135. package/tests/agent-profiles-workflow.test.ts +163 -0
  136. package/tests/agent-risk-escalation.test.ts +1 -1
  137. package/tests/agent-status.test.ts +143 -0
  138. package/tests/agents-config.test.ts +96 -0
  139. package/tests/agents-history.test.ts +31 -0
  140. package/tests/agents-jobs-frames.test.ts +93 -0
  141. package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
  142. package/tests/agents-runner-drain.test.ts +193 -0
  143. package/tests/agents-runner.test.ts +178 -2
  144. package/tests/append-system-prompt-route.test.ts +4 -1
  145. package/tests/ask-user-choice.test.ts +4 -3
  146. package/tests/ask-user-question.test.ts +97 -0
  147. package/tests/auto-permission-runtime.test.ts +1 -1
  148. package/tests/autonomous-guard.test.ts +346 -10
  149. package/tests/bounded-stop-contract.test.ts +43 -3
  150. package/tests/bridge-cost.test.ts +19 -4
  151. package/tests/bundled-install.test.ts +30 -5
  152. package/tests/card-content-policy.test.ts +3 -3
  153. package/tests/chained-pr-skill.test.ts +8 -6
  154. package/tests/child-safety.test.ts +11 -0
  155. package/tests/codegraph-tools.test.ts +11 -5
  156. package/tests/command-palette.test.ts +284 -1
  157. package/tests/delegate-for-reason-contract.test.ts +3 -3
  158. package/tests/design-canvas-assets.test.ts +185 -2
  159. package/tests/destructive-command-guard.test.ts +52 -0
  160. package/tests/download-progress.test.ts +71 -0
  161. package/tests/execution-surface-guard.test.ts +55 -0
  162. package/tests/fixtures/primary-session-prompt/gentleman.golden.md +9 -5
  163. package/tests/fixtures/proxy-tls/proxy.crt +19 -0
  164. package/tests/fixtures/proxy-tls/proxy.key +28 -0
  165. package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
  166. package/tests/fixtures/session-profile-v1/replay.ts +53 -6
  167. package/tests/full-delegation-closure.test.ts +131 -0
  168. package/tests/full-delegation-notices.test.ts +76 -0
  169. package/tests/generic-agent-tools.test.ts +3 -3
  170. package/tests/gentle-agent-status.test.ts +74 -0
  171. package/tests/gentle-agents-child-jobs.test.ts +237 -0
  172. package/tests/gentle-agents.test.ts +1070 -12
  173. package/tests/gentle-ai-binary.test.ts +3 -1
  174. package/tests/gentle-ai-elapsed-store.test.ts +19 -0
  175. package/tests/gentle-ai-exploration-budget.test.ts +18 -2
  176. package/tests/gentle-ai-installer.test.ts +134 -51
  177. package/tests/gentle-ai-proxy.test.ts +434 -0
  178. package/tests/gentle-ai.test.ts +113 -38
  179. package/tests/gentle-design.test.ts +21 -0
  180. package/tests/gentle-herdr-activity.test.ts +9 -6
  181. package/tests/gentle-shell-bin.test.ts +123 -0
  182. package/tests/gentle-shell-bundled.test.ts +207 -31
  183. package/tests/gentle-shell-launcher.test.ts +77 -10
  184. package/tests/gentle-shell.test.ts +899 -59
  185. package/tests/gentle-todo.test.ts +19 -2
  186. package/tests/gentle-tps.test.ts +123 -0
  187. package/tests/gentle-ui-design-skill.test.ts +59 -0
  188. package/tests/herdr-busy.test.ts +59 -0
  189. package/tests/herdr-task-summary-policy.test.ts +8 -4
  190. package/tests/image-disk-cache.test.ts +163 -0
  191. package/tests/independent-recovery-delivery.test.ts +83 -0
  192. package/tests/inprocess-reviewer.test.ts +176 -4
  193. package/tests/installer-posix-bootstrap.test.ts +1 -1
  194. package/tests/installer-preflight.test.ts +5 -4
  195. package/tests/installer-runner.test.ts +79 -44
  196. package/tests/installer-server.test.ts +14 -11
  197. package/tests/jobs-view.test.ts +260 -6
  198. package/tests/modal-mouse-boundaries.test.ts +136 -0
  199. package/tests/model-routing-authority.test.ts +178 -2
  200. package/tests/native-choice-list.test.ts +77 -2
  201. package/tests/native-review-capability-contract.test.ts +7 -1
  202. package/tests/native-review-cli.test.ts +269 -1
  203. package/tests/no-self-pause-contract.test.ts +4 -1
  204. package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
  205. package/tests/orchestrator-budget.test.ts +7 -2
  206. package/tests/orchestrator-delegation-mode.test.ts +153 -0
  207. package/tests/orchestrator-mode-policy.test.ts +175 -0
  208. package/tests/orchestrator-prompt-budget.test.ts +3 -1
  209. package/tests/orchestrator-rdd-ownership.test.ts +2 -2
  210. package/tests/package-manifest.test.ts +11 -9
  211. package/tests/permission-allowlist.test.ts +202 -0
  212. package/tests/pi-update-launcher.test.ts +8 -0
  213. package/tests/pnpm-workspace-config.test.ts +58 -0
  214. package/tests/primary-session-prompt.test.ts +13 -0
  215. package/tests/profile-pin.test.ts +29 -2
  216. package/tests/profile-tier-footer.test.ts +5 -0
  217. package/tests/profiles-panel-delegation-mode.test.ts +422 -0
  218. package/tests/questionnaire-view.test.ts +115 -0
  219. package/tests/quiet-bash-runtime.test.ts +1 -1
  220. package/tests/quiet-tool-rendering.test.ts +48 -0
  221. package/tests/rdd-aware-verification-contract.test.ts +16 -11
  222. package/tests/rdd-customize.test.ts +287 -0
  223. package/tests/rdd-mode-cache.test.ts +450 -0
  224. package/tests/rdd-mode-control.test.ts +407 -0
  225. package/tests/rdd-mode-scope-regression.test.ts +137 -0
  226. package/tests/rdd-off-independent-regression.test.ts +69 -0
  227. package/tests/rdd-status-line.test.ts +18 -0
  228. package/tests/render-cache-performance.test.ts +171 -2
  229. package/tests/reply-language-anchor.test.ts +173 -0
  230. package/tests/review-agent-end-preflight.test.ts +1 -1
  231. package/tests/review-blocker.test.ts +193 -0
  232. package/tests/review-candidate-owner-retry.test.ts +1 -1
  233. package/tests/review-candidate-symlink-scan.test.ts +157 -0
  234. package/tests/review-candidate-view.test.ts +1 -1
  235. package/tests/review-candidate-windows-boundary.test.ts +131 -0
  236. package/tests/review-candidate-windows-probe.test.ts +63 -0
  237. package/tests/review-committed-restart-ack.test.ts +129 -0
  238. package/tests/review-continuation-registry.test.ts +76 -0
  239. package/tests/review-controller-native-routing.test.ts +261 -5
  240. package/tests/review-controller-workspace-root.test.ts +230 -3
  241. package/tests/review-controller.test.ts +96 -11
  242. package/tests/review-coordinator-runtime.test.ts +117 -0
  243. package/tests/review-coordinator.test.ts +195 -0
  244. package/tests/review-failure-facts.test.ts +87 -0
  245. package/tests/review-host-relay-routing.test.ts +258 -4
  246. package/tests/review-host-relay.test.ts +39 -0
  247. package/tests/review-integration-v2.test.ts +46 -3
  248. package/tests/review-json-arguments.test.ts +65 -10
  249. package/tests/review-last-event-closure.test.ts +68 -0
  250. package/tests/review-loadout-rdd-off-sdk.test.ts +65 -31
  251. package/tests/review-owner-identity.test.ts +60 -24
  252. package/tests/review-relay-phase-timing.test.ts +128 -0
  253. package/tests/review-relay-transport-agent.test.ts +12 -2
  254. package/tests/review-reviewer-evidence.test.ts +183 -0
  255. package/tests/review-risk-assessment.test.ts +74 -3
  256. package/tests/review-session-standing-permission-controller.test.ts +21 -1
  257. package/tests/review-start-context.test.ts +19 -0
  258. package/tests/review-tool-prose-budget.test.ts +121 -0
  259. package/tests/run-test-suite.test.ts +122 -1
  260. package/tests/runtime-harness.mjs +4 -1
  261. package/tests/sensitive-path-tools.test.ts +181 -5
  262. package/tests/session-profile-append-controller-pi.test.ts +60 -31
  263. package/tests/session-profile-binding.test.ts +19 -1
  264. package/tests/session-profile-disk-reader-pi.test.ts +58 -16
  265. package/tests/session-profile-v1-compat.test.ts +35 -1
  266. package/tests/shell-bar.test.ts +186 -42
  267. package/tests/shell-panel.test.ts +50 -22
  268. package/tests/shell-sidebar-fullscreen.test.ts +5 -5
  269. package/tests/shell-sidebar-layout.test.ts +294 -23
  270. package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
  271. package/tests/shell-surface-transparent.test.ts +89 -0
  272. package/tests/shell-todo.test.ts +12 -0
  273. package/tests/skill-registry.test.ts +838 -5
  274. package/tests/startup-banner.test.ts +152 -1
  275. package/tests/startup-home-repo.test.ts +2 -0
  276. package/tests/support/review-coordinator-runtime.ts +69 -0
  277. package/tests/task-size-routing-contract.test.ts +5 -3
  278. package/tests/verifier-admission.test.ts +49 -0
  279. package/tests/verify-first-launch-contract.test.ts +78 -3
  280. package/tests/visual-customization-policy.test.ts +39 -6
  281. package/tests/visual-customize-view.test.ts +573 -9
  282. package/tests/visual-layout-preview.test.ts +15 -1
  283. package/tests/visual-profiles.test.ts +11 -0
  284. package/tests/voice-worker.test.ts +73 -2
  285. package/tests/windows-session-transport.test.ts +126 -0
  286. package/tests/work-continuity-contract.test.ts +28 -0
  287. package/tests/writer-feature-document-admission.test.ts +92 -0
  288. package/tests/yolo-customize.test.ts +27 -4
  289. package/tests/yolo-mode.test.ts +23 -18
  290. package/tests/yolo-session-policy.test.ts +270 -1
package/lib/shell-bar.ts CHANGED
@@ -4,8 +4,8 @@ import { renderUsageBar, selectUsageLimit, type ProviderUsage, type UsageWindow
4
4
  import { sanitizeTerminalText } from "./terminal-theme.ts";
5
5
  import { HOVER_ROLE } from "./shell-hover.ts";
6
6
  import { renderStatsRows, type SessionStats } from "./shell-stats.ts";
7
- import { CARD_TONE, floatRows, paintSurfaceRow, panelInnerWidth, renderCard, surfaceOpener } from "./shell-card.ts";
8
- import { clipPanelText, fitPanelLine, PANEL_ROW_INDENT, PANEL_SURFACE_ROLE, renderPanelHeader, renderPanelRow } from "./shell-panel.ts";
7
+ import { CARD_TONE, floatRows, paintSurfaceRow, panelInnerWidth, renderCard } from "./shell-card.ts";
8
+ import { chromeSurface, clipPanelText, fitPanelLine, PANEL_ROW_INDENT, panelSurfaceOpener, renderPanelHeader, renderPanelRow, sectionGap } from "./shell-panel.ts";
9
9
  import { REVIEW_SCOPE_UNAVAILABLE, REVIEW_SIDEBAR_LABELS, type ReviewSidebarSnapshot } from "./review-sidebar-state.ts";
10
10
  import type { VisualSettings } from "./visual-customization-policy.ts";
11
11
  import { renderChangesWidget, type ChangesModel } from "./shell-changes.ts";
@@ -170,9 +170,10 @@ function executionSegment(modelId: string, effort: string | undefined, theme: Sh
170
170
  : theme.fg(ROLE.MODEL, modelId);
171
171
  }
172
172
 
173
- function contextSegment(contextPercent: number | null, theme: ShellBarTheme, paint?: GaugePaint): string {
173
+ function contextSegment(contextPercent: number | null, theme: ShellBarTheme, paint?: GaugePaint, withGauge = true): string {
174
174
  const percentText = contextPercent === null ? "?%" : `${Math.round(contextPercent)}%`;
175
- return `${theme.fg(ROLE.LABEL, "ctx")} ${paintGauge(contextPercent, theme, GAUGE_CELLS, paint)} ${theme.fg(ROLE.VALUE, percentText)}`;
175
+ const gauge = withGauge ? `${paintGauge(contextPercent, theme, GAUGE_CELLS, paint)} ` : "";
176
+ return `${theme.fg(ROLE.LABEL, "ctx")} ${gauge}${theme.fg(ROLE.VALUE, percentText)}`;
176
177
  }
177
178
 
178
179
  function costSegment(costTotal: number, subscription: boolean, theme: ShellBarTheme): string {
@@ -224,9 +225,9 @@ function joinSegments(segments: string[], theme: ShellBarTheme): string {
224
225
  // or inferred meanings from opaque extension status strings.
225
226
  // The fullscreen rail's Status, drawn as panel sections (design/shell-rework/02-proposal.html):
226
227
  // Changes, Review (only with current-session RDD evidence) and Integrations.
227
- // Location and model live in the header row; Integrations also identifies the
228
- // effective agent profile. Opaque integration statuses wrap so none of their
229
- // meaning is clipped, and the optional key hints close the rail.
228
+ // Location and model live in the header row; the effective agent profile opens
229
+ // Stats when that section is enabled. Opaque integration statuses wrap so none
230
+ // of their meaning is clipped; callers can still supply optional legacy hints.
230
231
  export function renderShellSidebarBar(model: ShellBarModel, theme: ShellBarTheme, width: number, presentation?: Presentation, hints?: string, options: StatusSectionsOptions = {}): string[] {
231
232
  return renderShellStatusSections(model, theme, width, presentation, hints, options).lines;
232
233
  }
@@ -243,7 +244,7 @@ export interface StatusSectionsOptions {
243
244
  }
244
245
 
245
246
  /** The rail Status with its click targets: section headers collapse them and the Changes row opens /gentle:changes. */
246
- export function renderShellStatusSections(model: ShellBarModel, theme: ShellBarTheme, width: number, presentation?: Presentation, hints?: string, options: StatusSectionsOptions = {}): { lines: string[]; targets: StatusTarget[] } {
247
+ export function renderShellStatusSections(model: ShellBarModel, theme: ShellBarTheme, width: number, presentation?: Presentation, hints?: string, options: StatusSectionsOptions = {}): { lines: string[]; targets: StatusTarget[]; groups: Array<{ start: number; end: number }>; loose: number[] } {
247
248
  const label = (text: string) => theme.fg(ROLE.LABEL, text);
248
249
  const wrapped = (text: string, role: string) => wrapTextWithAnsi(text, Math.max(1, width - PANEL_ROW_INDENT)).map((line) => renderPanelRow(width, theme.fg(role, line)));
249
250
  type Section = { key?: StatusSection; header?: string; rows: string[]; openChangesRow?: number };
@@ -278,7 +279,10 @@ export function renderShellStatusSections(model: ShellBarModel, theme: ShellBarT
278
279
  }
279
280
  // Power user (compact density) adds what the session spent, per model.
280
281
  if (model.stats) {
281
- sections.push({ key: "stats", header: header("stats", "Stats", formatCost(model.stats.cost, model.subscription)), rows: renderStatsRows(model.stats, theme, width, model.subscription) });
282
+ // The agent profile opens Stats: it decides which models the session's spend went to.
283
+ const profile = model.profile ? sanitizeStatus(model.profile) : "";
284
+ const profileRow = profile ? [renderPanelRow(width, clipPanelText(`${label("profile")} ${theme.fg(ROLE.VALUE, profile)}`, Math.max(1, width - PANEL_ROW_INDENT)))] : [];
285
+ sections.push({ key: "stats", header: header("stats", "Stats", formatCost(model.stats.cost, model.subscription)), rows: [...profileRow, ...renderStatsRows(model.stats, theme, width, model.subscription)] });
282
286
  }
283
287
  // The status bar shows the permission mode once; Integrations only says
284
288
  // what it means, so neither the mode nor its banner repeats here.
@@ -286,94 +290,140 @@ export function renderShellStatusSections(model: ShellBarModel, theme: ShellBarT
286
290
  const integrationRows = (text: string) => wrapTextWithAnsi(text, Math.max(1, width - PANEL_ROW_INDENT - 2))
287
291
  .map((line, index) => renderPanelRow(width, `${label(index === 0 ? "- " : " ")}${line}`));
288
292
  const permission = model.permission?.detail ? integrationRows(`${label("permissions")} ${theme.fg(ROLE.STATUS, sanitizeStatus(model.permission.detail))}`) : [];
289
- const profile = model.profile ? sanitizeStatus(model.profile) : "";
290
- const profileRows = profile
291
- ? wrapTextWithAnsi(`${label("Agent profile:")} ${theme.fg(ROLE.VALUE, profile)}`, Math.max(1, width - PANEL_ROW_INDENT)).map((line) => renderPanelRow(width, line))
292
- : [];
293
293
  const count = integrations.length + (permission.length ? 1 : 0);
294
294
  sections.push({
295
295
  key: "integrations",
296
296
  header: header("integrations", "Integrations", count ? String(count) : "none"),
297
- rows: [...profileRows, ...permission, ...(integrations.length ? integrations.flatMap((status) => integrationRows(theme.fg(ROLE.STATUS, sanitizeStatus(status)))) : permission.length ? [] : [renderPanelRow(width, label("no status reported"))])],
297
+ rows: [...permission, ...(integrations.length ? integrations.flatMap((status) => integrationRows(theme.fg(ROLE.STATUS, sanitizeStatus(status)))) : permission.length ? [] : [renderPanelRow(width, label("no status reported"))])],
298
298
  });
299
- if (hints) sections.push({ rows: [renderPanelRow(width, label(hints))] });
300
- const gap = !presentation || presentation.density === "comfortable" ? [" ".repeat(Math.max(0, width))] : [];
299
+ // Minimal density keeps only the sections: the key hints row goes.
300
+ if (hints && presentation?.density !== "minimal") sections.push({ rows: [renderPanelRow(width, label(hints))] });
301
+ const gap = sectionGap(presentation?.density) ? [" ".repeat(Math.max(0, width))] : [];
301
302
  const lines: string[] = [];
302
303
  const targets: StatusTarget[] = [];
304
+ // Each headed section's row range, and the unheaded rows (key hints), so a
305
+ // transparent rail can draw every section as its own card.
306
+ const groups: Array<{ start: number; end: number }> = [];
307
+ const loose: number[] = [];
303
308
  sections.forEach((section, index) => {
304
309
  if (index) lines.push(...gap);
310
+ const start = lines.length;
305
311
  if (section.key && section.header) {
306
312
  targets.push({ row: lines.length, kind: "toggle", section: section.key });
307
313
  lines.push(section.header);
308
- if (options.collapsed?.has(section.key)) return;
314
+ if (options.collapsed?.has(section.key)) { groups.push({ start, end: lines.length }); return; }
309
315
  }
310
316
  if (section.openChangesRow !== undefined) targets.push({ row: lines.length + section.openChangesRow, kind: "open-changes" });
311
317
  lines.push(...section.rows);
318
+ if (section.key && section.header) groups.push({ start, end: lines.length });
319
+ else for (let row = start; row < lines.length; row++) loose.push(row);
312
320
  });
313
- return { lines, targets };
321
+ return { lines, targets, groups, loose };
314
322
  }
315
323
 
316
324
  // The wide fullscreen chrome (design/shell-rework/02-proposal.html): a title row
317
325
  // with the project identity above the transcript and the rail, and one status
318
326
  // bar row below them. Both sit on the rail's panel surface.
319
327
  const STATUS_BAR_DIVIDER = "│";
320
- const paintChromeRow = (theme: ShellBarTheme, row: string) => paintSurfaceRow(row, surfaceOpener(theme, PANEL_SURFACE_ROLE));
328
+ const paintChromeRow = (theme: ShellBarTheme, row: string) => paintSurfaceRow(row, panelSurfaceOpener(theme));
321
329
 
322
- /** `✿ name path` left, the session name and profile right; the path gives way first, so the profile always shows. */
330
+ // `cwd` is already abbreviated by the footer model; never consult the filesystem
331
+ // while rendering. Strip terminal controls before displaying either copy.
332
+ function projectIdentity(cwd: string, theme: ShellBarTheme): { name: string; full: string } {
333
+ const path = sanitizeStatus(cwd);
334
+ const name = path.split("/").filter((part) => part.length > 0).pop() ?? path;
335
+ const label = `${theme.fg(ROLE.BRAND, "✿")} ${theme.fg(ROLE.VALUE, theme.bold(name))}`;
336
+ return { name: label, full: `${label} ${theme.fg(ROLE.PATH, path)}` };
337
+ }
338
+
339
+ /** `✿ name path` left; the session name, or the model and profile on mobile, right. */
323
340
  export function renderShellTitleRow(model: ShellBarModel, theme: ShellBarTheme, width: number, options: { model?: boolean } = {}): string {
324
341
  const target = Math.max(0, Math.floor(width));
325
- const name = model.cwd.split("/").filter((part) => part.length > 0).pop() ?? model.cwd;
326
- const left = `${theme.fg(ROLE.BRAND, "✿")} ${theme.fg(ROLE.VALUE, theme.bold(name))} ${theme.fg(ROLE.PATH, model.cwd)}`;
327
- // Mobile: the narrow status bar leaves the model out, so the title row carries it.
342
+ const left = projectIdentity(model.cwd, theme).full;
343
+ // Mobile: the narrow status bar leaves the model out, so the title row carries
344
+ // it with the agent profile; wide, the status bar carries both and this row keeps the session.
345
+ const profileName = model.profile ? sanitizeStatus(model.profile) : "";
346
+ const profile = profileName ? ` ${theme.fg(ROLE.SEPARATOR, "·")} ${theme.fg(ROLE.LABEL, profileName)}` : "";
328
347
  const right = options.model
329
- ? executionSegment(model.modelId, model.effort, theme)
330
- : [model.sessionName ? theme.fg(ROLE.VALUE, sanitizeStatus(model.sessionName)) : "", model.profile ? theme.fg(ROLE.LABEL, sanitizeStatus(model.profile)) : ""]
331
- .filter(Boolean).join(theme.fg(ROLE.SEPARATOR, " · "));
348
+ ? `${executionSegment(model.modelId, model.effort, theme)}${profile}`
349
+ : model.sessionName ? theme.fg(ROLE.VALUE, sanitizeStatus(model.sessionName)) : "";
332
350
  return paintChromeRow(theme, ` ${fitPanelLine(left, right, Math.max(0, target - 2))} `);
333
351
  }
334
352
 
353
+ // The status bar replaces the YOLO banners, so it keeps their icons.
354
+ const MODE_GLYPHS: Record<string, string> = { YOLO: "🔥", "SUPER-YOLO": "💥" };
355
+ function modeBadge(mode: string): string {
356
+ const glyph = MODE_GLYPHS[mode];
357
+ return glyph ? `${glyph} ${mode}` : mode;
358
+ }
335
359
  /**
336
360
  * The status bar: branch, dirty count and a non-default permission mode on
337
- * the left; model · effort, context, cost and usage on the right. Usage gives
338
- * way first (gauges, secondary windows, the segment), then the model; the
339
- * usage segment stays the click target that opens the usage view.
361
+ * the left; model · effort, context, cost and usage on the right. A long
362
+ * branch shortens before the model and counters give way; usage and its
363
+ * click target degrade with the available space.
340
364
  */
341
- export function renderShellStatusBar(model: ShellBarModel, theme: ShellBarTheme, width: number, usageHint?: string, presentation?: Presentation, paint?: GaugePaint, extras: { jobs?: boolean } = {}): ShellHeaderChrome {
365
+ export function renderShellStatusBar(model: ShellBarModel, theme: ShellBarTheme, width: number, usageHint?: string, presentation?: Presentation, paint?: GaugePaint, extras: { jobs?: boolean; project?: boolean } = {}): ShellHeaderChrome {
342
366
  const target = Math.max(0, Math.floor(width));
367
+ if (target < 2) return { rows: [paintChromeRow(theme, " ".repeat(target))], headerRow: 0 };
368
+ const room = target - 2;
343
369
  const divider = ` ${theme.fg(ROLE.SEPARATOR, STATUS_BAR_DIVIDER)} `;
344
370
  const join = (segments: string[]) => segments.filter(Boolean).join(divider);
345
371
  const dirty = model.dirty ? theme.fg(ROLE.DIRTY, `±${model.dirty}`) : "";
346
372
  const branch = [model.branch ? theme.fg(ROLE.BRANCH, model.branch) : "", dirty].filter(Boolean).join(" ");
347
- const mode = model.permission && model.permission.mode !== "NORMAL" ? theme.fg("warning", theme.bold(sanitizeStatus(model.permission.mode))) : "";
373
+ const mode = model.permission && model.permission.mode !== "NORMAL" ? theme.fg("warning", theme.bold(modeBadge(sanitizeStatus(model.permission.mode)))) : "";
348
374
  // Without a rail (mobile) the running jobs keep their compact count here.
349
375
  const runningJobs = extras.jobs ? (model.jobs?.filter((job) => job.status === undefined).length ?? 0) : 0;
350
376
  const tail = join([mode, runningJobs ? theme.fg(ROLE.STATUS, shellJobsCount(runningJobs)) : ""]);
351
377
  const left = join([branch, tail]);
378
+ const minimal = presentation?.density === "minimal";
352
379
  const showCounters = presentation?.visibility.usageCost !== false;
380
+ // The configured tier stays beside the effort and yields only at the end; the
381
+ // agent profile follows it and gives way before the usage does.
353
382
  const tier = model.profileTier ? ` ${theme.fg(ROLE.LABEL, "·")} ${theme.fg(model.profileTier === "fast" ? "warning" : ROLE.LABEL, model.profileTier === "fast" ? "Fast" : "Standard")}` : "";
383
+ const profileName = model.profile ? sanitizeStatus(model.profile) : "";
384
+ const profile = profileName ? ` ${theme.fg(ROLE.LABEL, "·")} ${theme.fg(ROLE.LABEL, profileName)}` : "";
354
385
  const exec = presentation?.visibility.modelDetails === false ? "" : executionSegment(model.modelId, model.effort, theme);
355
- const counters = showCounters ? [contextSegment(model.contextPercent, theme, paint), costSegment(model.costTotal, model.subscription, theme)] : [];
386
+ const counters = showCounters ? [contextSegment(model.contextPercent, theme, paint, !minimal), costSegment(model.costTotal, model.subscription, theme)] : [];
356
387
  const windows = model.usage ? (selectUsageLimit(model.usage, model.modelId)?.windows ?? []) : [];
357
- const stages: Array<UsageStage | undefined> = showCounters ? ["full", "text", "primary", undefined] : [undefined];
358
- const attempts = [...stages.map((stage) => ({ stage, withExec: true, withTier: true })),
359
- ...(tier ? [{ stage: undefined, withExec: true, withTier: false }] : []), { stage: undefined, withExec: false, withTier: false }];
360
- for (const { stage, withExec, withTier } of attempts) {
361
- const usage = stage ? usageSegmentText(windows, theme, stage, usageHint, paint) : "";
362
- const right = join([withExec ? exec + (exec && withTier ? tier : "") : "", ...counters, usage]);
363
- const room = target - 2;
364
- if (visibleWidth(left) + (right ? RIGHT_PADDING : 0) + visibleWidth(right) > room) continue;
365
- const row = ` ${left}${" ".repeat(room - visibleWidth(left) - visibleWidth(right))}${right} `;
388
+ const stages: Array<UsageStage | undefined> = !showCounters ? [undefined] : minimal ? ["text", "primary", undefined] : ["full", "text", "primary", undefined];
389
+ const attempts = [...stages.flatMap((stage) => [{ stage, withExec: true, withTier: true, withProfile: true }, ...(profile ? [{ stage, withExec: true, withTier: true, withProfile: false }] : [])]),
390
+ ...(tier ? [{ stage: undefined, withExec: true, withTier: false, withProfile: false }] : []), { stage: undefined, withExec: false, withTier: false, withProfile: false }];
391
+ for (const { stage, withExec, withTier, withProfile } of attempts) {
392
+ const usage = stage ? usageSegmentText(windows, theme, stage, minimal ? undefined : usageHint, paint) : "";
393
+ const right = join([withExec ? exec + (exec && withTier ? tier : "") + (exec && withProfile ? profile : "") : "", ...counters, usage]);
394
+ let shownLeft = left;
395
+ if (visibleWidth(shownLeft) + (right ? RIGHT_PADDING : 0) + visibleWidth(right) > room) {
396
+ if (!model.branch || visibleWidth(model.branch) <= COMPACT_BRANCH_WIDTH) continue;
397
+ // Reserve the dirty count and the permission/job badges before clipping
398
+ // the branch itself. Keep a recognizable prefix while usage is present;
399
+ // after usage gives way, a shorter prefix can still save model and effort.
400
+ const protectedWidth = visibleWidth(join([dirty, tail])) + (dirty ? 1 : tail ? visibleWidth(divider) : 0);
401
+ const branchRoom = room - visibleWidth(right) - (right ? RIGHT_PADDING : 0) - protectedWidth;
402
+ if (branchRoom < (stage ? COMPACT_BRANCH_WIDTH : 4)) continue;
403
+ const shortened = theme.fg(ROLE.BRANCH, clipPanelText(model.branch, branchRoom));
404
+ shownLeft = join([[shortened, dirty].filter(Boolean).join(" "), tail]);
405
+ if (visibleWidth(shownLeft) + (right ? RIGHT_PADDING : 0) + visibleWidth(right) > room) continue;
406
+ }
407
+ if (extras.project) {
408
+ // Add identity only in spare cells, so path and name never displace
409
+ // model, effort, tier, badges or counters selected by the existing fit.
410
+ const identity = projectIdentity(model.cwd, theme);
411
+ const available = room - visibleWidth(shownLeft) - visibleWidth(right) - (right ? RIGHT_PADDING : 0) - (shownLeft ? visibleWidth(divider) : 0);
412
+ const project = [identity.full, identity.name].find((candidate) => visibleWidth(candidate) <= available);
413
+ if (project) shownLeft = join([project, shownLeft]);
414
+ }
415
+ const row = ` ${shownLeft}${" ".repeat(room - visibleWidth(shownLeft) - visibleWidth(right))}${right} `;
366
416
  const usageSpan = usage ? { start: target - 1 - visibleWidth(usage), end: target - 1 } : undefined;
367
417
  return { rows: [paintChromeRow(theme, row)], headerRow: 0, ...(usageSpan ? { usageSpan } : {}) };
368
418
  }
369
- // Still too wide (a phone, a long branch): the branch gives way before the
370
- // context and cost, which give way last, context after cost.
371
- const room = Math.max(0, target - 2);
419
+ // Still too wide: the branch gives way before context and cost, which give
420
+ // way last, context after cost. Keep the badges when only they fit.
372
421
  const tailWidth = tail ? visibleWidth(tail) + (branch ? visibleWidth(divider) : 0) : 0;
373
422
  for (const right of [join(counters), counters[0] ?? "", ""]) {
374
423
  const leftRoom = room - visibleWidth(right) - (right ? RIGHT_PADDING : 0);
375
424
  const branchRoom = leftRoom - tailWidth;
376
425
  if (branch && branchRoom < 4 && right) continue;
426
+ if (branch && branchRoom < 1 && !right && tail) return { rows: [paintChromeRow(theme, ` ${fitPanelLine(tail, "", room)} `)], headerRow: 0 };
377
427
  const fitted = join([branch ? clipPanelText(branch, Math.max(1, branchRoom)) : "", tail]);
378
428
  if (visibleWidth(fitted) > leftRoom && right) continue;
379
429
  return { rows: [paintChromeRow(theme, ` ${fitPanelLine(fitted, right, room)} `)], headerRow: 0 };
@@ -420,7 +470,7 @@ function usageWindowText(window: UsageWindow, theme: ShellBarTheme, withGauge: b
420
470
  // Three degrading shapes for the same windows, narrowest last: every window
421
471
  // with its gauge, every window as text only, or just the first window as
422
472
  // text only. A provider with no usage data at all has no windows to shape,
423
- // so all three collapse to the bare "usage" label plus the shortcut hint.
473
+ // so all three collapse to the "usage" label and an optional shortcut hint.
424
474
  type UsageStage = "full" | "text" | "primary";
425
475
  function usageSegmentText(windows: UsageWindow[], theme: ShellBarTheme, stage: UsageStage, hint: string | undefined, paint?: GaugePaint): string {
426
476
  const label = theme.fg(USAGE_LABEL_ROLE, "usage");
@@ -450,7 +500,7 @@ function fitHeaderContent(text: string, width: number): string {
450
500
  return clipped + " ".repeat(Math.max(0, width - visibleWidth(clipped)));
451
501
  }
452
502
 
453
- export function renderShellHeaderBar(model: ShellHeaderModel, theme: ShellBarTheme, width: number, usageHint?: string, presentation?: Presentation, paint?: GaugePaint): ShellHeaderResult {
503
+ export function renderShellHeaderBar(model: ShellHeaderModel, theme: ShellBarTheme, width: number, usageHint?: string, presentation?: HeaderPresentation, paint?: GaugePaint): ShellHeaderResult {
454
504
  const targetWidth = Math.max(0, Math.floor(width));
455
505
  let content: ShellHeaderResult | undefined;
456
506
  let contentWidth = targetWidth;
@@ -483,21 +533,49 @@ export function renderShellHeaderChrome(model: ShellHeaderModel, theme: ShellBar
483
533
  return { rows: [padding, text, padding, rule], headerRow: 1, usageSpan };
484
534
  }
485
535
 
536
+ /** One blank row on the chrome surface: the margin a chrome bar keeps toward the content in comfortable density. */
537
+ export function renderShellChromePad(theme: ShellBarTheme, width: number): string {
538
+ return paintChromeRow(theme, " ".repeat(Math.max(0, Math.floor(width))));
539
+ }
540
+
541
+ /**
542
+ * A chrome bar: the split status bar row (branch, permission mode, model,
543
+ * context, cost, usage). In comfortable density it is centered between two
544
+ * margin rows on the chrome surface; compact and minimal draw the bar row
545
+ * alone, with minimal omitting gauges and shortcut hints. The top, below-input
546
+ * and split bars share this design; a transparent surface leaves it unpainted.
547
+ */
548
+ export function renderShellChromeBar(model: ShellBarModel, theme: ShellBarTheme, width: number, usageHint: string | undefined, presentation: HeaderPresentation | undefined, paint: GaugePaint | undefined, extras: { jobs?: boolean } = {}): ShellHeaderChrome {
549
+ const project = presentation?.headerPlacement === "top" || presentation?.headerPlacement === "below-input";
550
+ const bar = renderShellStatusBar(model, theme, width, usageHint, presentation, paint, { ...extras, project });
551
+ if (presentation !== undefined && presentation.density !== "comfortable") return bar;
552
+ // Comfortable centers the text: one margin row on each side of the bar row.
553
+ const pad = renderShellChromePad(theme, width);
554
+ return { ...bar, rows: [pad, ...bar.rows, pad], headerRow: bar.headerRow + 1 };
555
+ }
556
+
486
557
  /** The usage segment is interactive only on the content row, never padding or the edge. */
487
558
  export function shellHeaderUsageHit(chrome: ShellHeaderChrome, x: number, y: number): boolean {
488
559
  const { usageSpan } = chrome;
489
560
  return y === chrome.headerRow && usageSpan !== undefined && x >= usageSpan.start && x < usageSpan.end;
490
561
  }
491
562
 
492
- function headerContent(model: ShellHeaderModel, theme: ShellBarTheme, width: number, usageHint?: string, presentation?: Presentation, paint?: GaugePaint): ShellHeaderResult {
563
+ function headerContent(model: ShellHeaderModel, theme: ShellBarTheme, width: number, usageHint?: string, presentation?: HeaderPresentation, paint?: GaugePaint): ShellHeaderResult {
493
564
  const targetWidth = Math.max(0, Math.floor(width));
494
565
  const jobs = model.jobs ? theme.fg(ROLE.STATUS, shellJobsCount(model.jobs)) : undefined;
566
+ const minimal = presentation?.density === "minimal";
495
567
  const ctxCost = joinSegments([
496
568
  ...(jobs ? [jobs] : []),
497
- ...(presentation?.visibility.usageCost === false ? [] : [contextSegment(model.contextPercent, theme, paint), costSegment(model.costTotal, model.subscription, theme)]),
569
+ ...(presentation?.visibility.usageCost === false ? [] : [contextSegment(model.contextPercent, theme, paint, !minimal), costSegment(model.costTotal, model.subscription, theme)]),
498
570
  ], theme);
499
571
  const windows = model.usage ? (selectUsageLimit(model.usage, model.modelId)?.windows ?? []) : [];
500
- const leftStages = headerLeftStages(model, theme, presentation?.visibility.modelDetails !== false)
572
+ const belowInput = presentation?.headerPlacement === "below-input";
573
+ const safeModel = belowInput ? { ...model, cwd: sanitizeStatus(model.cwd), branch: model.branch === null ? null : sanitizeStatus(model.branch) } : model;
574
+ const location = locationSegment(safeModel, theme);
575
+ const leftStages = headerLeftStages(safeModel, theme, presentation?.visibility.modelDetails !== false)
576
+ .flatMap((stage) => belowInput && stage[1] === location
577
+ ? [[stage[0]!, `${projectIdentity(safeModel.cwd, theme).name} ${location}`, ...stage.slice(2)], stage]
578
+ : [stage])
501
579
  .map((stage) => presentation?.density === "minimal" ? stage.slice(1) : stage);
502
580
  const minimalLeft = Math.max(0, leftStages.length - 2); // brand + bare model id, before dropping the model too
503
581
  // One flat, ordered cascade — never a per-stage nested search — so the
@@ -506,16 +584,16 @@ function headerContent(model: ShellHeaderModel, theme: ShellBarTheme, width: num
506
584
  // windows → the whole segment) before ctx/cost is touched: every window
507
585
  // with its gauge, then text-only, then the first window only, then gone.
508
586
  // Unlike the compact bar's usage meter (hidden with no data), this is a
509
- // standing, clickable affordance — even with nothing to report it still
510
- // reads "usage" plus the shortcut hint, unless disabled, width permitting.
511
- const usageStages: Array<UsageStage | undefined> = presentation?.visibility.usageCost === false ? [undefined] : ["full", "text", "primary", undefined];
587
+ // standing, clickable affordance: it reads "usage" even with no data, plus
588
+ // the shortcut hint outside minimal density, unless disabled or too narrow.
589
+ const usageStages: Array<UsageStage | undefined> = presentation?.visibility.usageCost === false ? [undefined] : minimal ? ["text", "primary", undefined] : ["full", "text", "primary", undefined];
512
590
  const attempts: Array<{ leftIndex: number; usageStage: UsageStage | undefined }> = [
513
591
  ...leftStages.slice(0, minimalLeft).map((_, leftIndex) => ({ leftIndex, usageStage: usageStages[0] })),
514
592
  ...usageStages.map((usageStage) => ({ leftIndex: minimalLeft, usageStage })),
515
593
  { leftIndex: leftStages.length - 1, usageStage: undefined },
516
594
  ];
517
595
  for (const { leftIndex, usageStage } of attempts) {
518
- const usageText = usageStage ? usageSegmentText(windows, theme, usageStage, usageHint, paint) : undefined;
596
+ const usageText = usageStage ? usageSegmentText(windows, theme, usageStage, minimal ? undefined : usageHint, paint) : undefined;
519
597
  const right = usageText ? joinSegments([ctxCost, usageText], theme) : ctxCost;
520
598
  const left = joinSegments(leftStages[leftIndex]!, theme);
521
599
  if (visibleWidth(left) + (right ? RIGHT_PADDING : 0) + visibleWidth(right) > targetWidth) continue;
@@ -544,9 +622,9 @@ export function renderShellBelowInputFloat(model: ShellBarModel, theme: ShellBar
544
622
  const changesRow = Boolean(changes && changes.files.length > 0) && presentation.visibility.changes !== false
545
623
  ? floatHeaderRow(theme, targetWidth, (inner) => renderChangesWidget(changes, theme, inner)[0] ?? "")
546
624
  : undefined;
625
+ // Integrations live only in the rail; this row keeps the running jobs count.
547
626
  const statuses = presentation.statusPlacement === "hidden" ? [] : [
548
627
  ...(model.jobs?.length ? [shellJobsCount(model.jobs.length)] : []),
549
- ...model.statuses.map(sanitizeStatus).filter(Boolean),
550
628
  ];
551
629
  const statusRow = statuses.length
552
630
  ? floatHeaderRow(theme, targetWidth, () => joinSegments(statuses.map((status) => theme.fg(ROLE.STATUS, status)), theme))
@@ -575,9 +653,8 @@ export function renderShellBottomOnlyBar(model: ShellBarModel, theme: ShellBarTh
575
653
  if (grouped) return grouped.rows;
576
654
  const headerModel = buildShellHeaderModel(model, true);
577
655
  // Neon, missing backgrounds and sub-minimum widths keep the old row count.
578
- const rows = [headerContent(headerModel, theme, width, usageHint, presentation, paint).text];
579
- const statuses = model.statuses.map(sanitizeStatus).filter((status) => status.length > 0).map((status) => theme.fg(ROLE.STATUS, status));
580
- return statuses.length ? [...rows, truncateToWidth(joinSegments(statuses, theme), Math.max(0, Math.floor(width)), "…")] : rows;
656
+ // Integrations live only in the rail (and the [ Panel ] sheet), never in this bar.
657
+ return [headerContent(headerModel, theme, width, usageHint, presentation, paint).text];
581
658
  }
582
659
 
583
660
  // The rule row painted directly under the header bar: one full-width horizontal
@@ -594,7 +671,8 @@ const BG_RESET = "\x1b[49m";
594
671
  // Paints the header content with floatRows and returns the row without its
595
672
  // transparent margins plus the background opener. The painted row is
596
673
  // `<open> <content> <reset>`; the opener has no spaces, so the first space ends
597
- // it. Undefined when the float style does not apply.
674
+ // it. Undefined when the float style does not apply. A transparent chrome
675
+ // surface keeps the same geometry with an empty opener and no background.
598
676
  function floatHeaderPaint(theme: ShellBarTheme, width: number, content: (width: number) => string): { inner: string; open: string } | undefined {
599
677
  let floated = false;
600
678
  const [row] = floatRows(CARD_TONE.INFO, theme, width, (inner) => {
@@ -603,8 +681,12 @@ function floatHeaderPaint(theme: ShellBarTheme, width: number, content: (width:
603
681
  });
604
682
  if (!floated || row === undefined) return undefined;
605
683
  const inner = row.slice(1, -1);
684
+ // Callers slice the trailing reset off `inner`, so the unpainted row keeps one.
685
+ if (chromeSurface() === "transparent") return { inner: `${inner.replace(BG_SGR, "")}${BG_RESET}`, open: "" };
606
686
  return { inner, open: inner.slice(0, inner.indexOf(" ")) };
607
687
  }
688
+ // Background openers (`48;…`) and resets (`49`), which a transparent surface drops.
689
+ const BG_SGR = /\x1b\[(?:48(?:;[0-9]+)*|49)m/g;
608
690
 
609
691
  // In the float style the rule closes the hanging header tab with an upper
610
692
  // one-eighth block line. Box-drawing lines sit mid-cell: a transparent `└──┘`
@@ -209,6 +209,8 @@ export interface GitResult {
209
209
  code: number;
210
210
  /** The runner stopped reading at its output bound; stdout is partial. */
211
211
  truncated?: boolean;
212
+ /** The Git deadline elapsed; stdout is diagnostic output, not a complete result. */
213
+ timedOut?: boolean;
212
214
  }
213
215
 
214
216
  export type GitRunner = (args: string[]) => Promise<GitResult>;
@@ -1,6 +1,7 @@
1
1
  import { visibleWidth } from "@earendil-works/pi-tui";
2
2
  import { paintSurfaceRow, surfaceOpener, type CardTheme } from "./shell-card.ts";
3
- import { paintHoverable } from "./shell-hover.ts";
3
+ import { HOVER_ROLE, paintHoverable } from "./shell-hover.ts";
4
+ import type { ChromeSurface } from "./visual-customization-policy.ts";
4
5
 
5
6
  // Fullscreen rail sections drawn as one IDE-like panel (design/shell-rework/02-proposal.html):
6
7
  // a one-row header `▾ NAME … count`, dense rows indented under it, and one
@@ -8,6 +9,18 @@ import { paintHoverable } from "./shell-hover.ts";
8
9
 
9
10
  /** The theme background the rail panel paints behind its sections. */
10
11
  export const PANEL_SURFACE_ROLE = "customMessageBg";
12
+ let surface: ChromeSurface = "tinted";
13
+ /** The live chrome surface (Layout → Surface); `transparent` leaves the panel rows unpainted. */
14
+ export function chromeSurface(): ChromeSurface { return surface; }
15
+ export function setChromeSurface(value: ChromeSurface): void { surface = value; }
16
+ /** The SGR that opens the panel surface, or "" when the chrome is transparent or the theme cannot paint it. */
17
+ export function panelSurfaceOpener(theme: CardTheme): string {
18
+ return surface === "transparent" ? "" : surfaceOpener(theme, PANEL_SURFACE_ROLE);
19
+ }
20
+ /** Rail sections keep a blank row between them in comfortable density, whatever the surface. */
21
+ export function sectionGap(density: string | undefined): boolean {
22
+ return density === undefined || density === "comfortable";
23
+ }
11
24
  /** Columns a panel row is indented under its header. */
12
25
  export const PANEL_ROW_INDENT = 2;
13
26
 
@@ -55,7 +68,8 @@ export function fitPanelLine(left: string, right: string, width: number): string
55
68
  export function renderPanelHeader(theme: PanelTheme, width: number, header: PanelHeader): string {
56
69
  const glyph = paintHoverable(theme, header.open ? "▾" : "▸", header.hovered ?? false, "muted");
57
70
  const name = header.title.toUpperCase();
58
- const title = theme.fg("text", theme.bold ? theme.bold(name) : name);
71
+ // The hover paints the name too: a lone glyph is too small a signal, and other rail controls paint their text.
72
+ const title = theme.fg(header.hovered ? HOVER_ROLE : "text", theme.bold ? theme.bold(name) : name);
59
73
  const count = header.count ? theme.fg(header.countRole ?? "muted", header.count) : "";
60
74
  return fitPanelLine(`${glyph} ${title}`, count, width);
61
75
  }
@@ -67,7 +81,7 @@ export function renderPanelRow(width: number, left: string, right = "", indent =
67
81
 
68
82
  /** Paints every row behind the rail surface; a theme that cannot paint it leaves rows as they are. */
69
83
  export function paintPanelSurface(theme: CardTheme, rows: readonly string[]): string[] {
70
- const open = surfaceOpener(theme, PANEL_SURFACE_ROLE);
84
+ const open = panelSurfaceOpener(theme);
71
85
  return rows.map((row) => paintSurfaceRow(row, open));
72
86
  }
73
87