gsd-pi 2.64.0 → 2.65.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 (255) hide show
  1. package/dist/headless.js +3 -1
  2. package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.js +22 -7
  3. package/dist/resources/extensions/bg-shell/process-manager.js +6 -1
  4. package/dist/resources/extensions/gsd/auto-dashboard.js +5 -5
  5. package/dist/resources/extensions/gsd/auto-post-unit.js +98 -1
  6. package/dist/resources/extensions/gsd/auto-verification.js +138 -1
  7. package/dist/resources/extensions/gsd/auto.js +5 -0
  8. package/dist/resources/extensions/gsd/bootstrap/db-tools.js +24 -13
  9. package/dist/resources/extensions/gsd/bootstrap/notify-interceptor.js +28 -0
  10. package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +8 -0
  11. package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +16 -0
  12. package/dist/resources/extensions/gsd/bootstrap/system-context.js +20 -0
  13. package/dist/resources/extensions/gsd/commands/catalog.js +7 -1
  14. package/dist/resources/extensions/gsd/commands/handlers/core.js +1 -0
  15. package/dist/resources/extensions/gsd/commands/handlers/notifications-handler.js +104 -0
  16. package/dist/resources/extensions/gsd/commands/handlers/ops.js +5 -0
  17. package/dist/resources/extensions/gsd/notification-overlay.js +256 -0
  18. package/dist/resources/extensions/gsd/notification-store.js +273 -0
  19. package/dist/resources/extensions/gsd/notification-widget.js +56 -0
  20. package/dist/resources/extensions/gsd/post-execution-checks.js +407 -0
  21. package/dist/resources/extensions/gsd/pre-execution-checks.js +464 -0
  22. package/dist/resources/extensions/gsd/preferences-types.js +4 -0
  23. package/dist/resources/extensions/gsd/preferences-validation.js +33 -0
  24. package/dist/resources/extensions/gsd/preferences.js +4 -0
  25. package/dist/resources/extensions/gsd/verification-evidence.js +18 -0
  26. package/dist/resources/extensions/gsd/workflow-logger.js +8 -0
  27. package/dist/web/standalone/.next/BUILD_ID +1 -1
  28. package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -6
  29. package/dist/web/standalone/.next/build-manifest.json +2 -2
  30. package/dist/web/standalone/.next/prerender-manifest.json +3 -3
  31. package/dist/web/standalone/.next/required-server-files.json +1 -1
  32. package/dist/web/standalone/.next/routes-manifest.json +6 -0
  33. package/dist/web/standalone/.next/server/app/_global-error.html +2 -2
  34. package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
  35. package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  36. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  37. package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  38. package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  39. package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  40. package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  41. package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
  42. package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
  43. package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  44. package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  45. package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  46. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  47. package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  48. package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  49. package/dist/web/standalone/.next/server/app/api/notifications/route.js +3 -0
  50. package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -0
  51. package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -0
  52. package/dist/web/standalone/.next/server/app/index.html +1 -1
  53. package/dist/web/standalone/.next/server/app/index.rsc +1 -1
  54. package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  55. package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
  56. package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  57. package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
  58. package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  59. package/dist/web/standalone/.next/server/app-paths-manifest.json +7 -6
  60. package/dist/web/standalone/.next/server/functions-config-manifest.json +1 -0
  61. package/dist/web/standalone/.next/server/pages/404.html +1 -1
  62. package/dist/web/standalone/.next/server/pages/500.html +2 -2
  63. package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
  64. package/dist/web/standalone/.next/static/MRM3OSYIAa4HMDqVGQ9nt/_buildManifest.js +1 -0
  65. package/dist/web/standalone/.next/static/chunks/app/_global-error/page-8805a20e15762c3c.js +1 -0
  66. package/dist/web/standalone/.next/static/chunks/app/api/boot/route-8805a20e15762c3c.js +1 -0
  67. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/input/route-8805a20e15762c3c.js +1 -0
  68. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/resize/route-8805a20e15762c3c.js +1 -0
  69. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/stream/route-8805a20e15762c3c.js +1 -0
  70. package/dist/web/standalone/.next/static/chunks/app/api/browse-directories/route-8805a20e15762c3c.js +1 -0
  71. package/dist/web/standalone/.next/static/chunks/app/api/captures/route-8805a20e15762c3c.js +1 -0
  72. package/dist/web/standalone/.next/static/chunks/app/api/cleanup/route-8805a20e15762c3c.js +1 -0
  73. package/dist/web/standalone/.next/static/chunks/app/api/dev-mode/route-8805a20e15762c3c.js +1 -0
  74. package/dist/web/standalone/.next/static/chunks/app/api/doctor/route-8805a20e15762c3c.js +1 -0
  75. package/dist/web/standalone/.next/static/chunks/app/api/experimental/route-8805a20e15762c3c.js +1 -0
  76. package/dist/web/standalone/.next/static/chunks/app/api/export-data/route-8805a20e15762c3c.js +1 -0
  77. package/dist/web/standalone/.next/static/chunks/app/api/files/route-8805a20e15762c3c.js +1 -0
  78. package/dist/web/standalone/.next/static/chunks/app/api/forensics/route-8805a20e15762c3c.js +1 -0
  79. package/dist/web/standalone/.next/static/chunks/app/api/git/route-8805a20e15762c3c.js +1 -0
  80. package/dist/web/standalone/.next/static/chunks/app/api/history/route-8805a20e15762c3c.js +1 -0
  81. package/dist/web/standalone/.next/static/chunks/app/api/hooks/route-8805a20e15762c3c.js +1 -0
  82. package/dist/web/standalone/.next/static/chunks/app/api/inspect/route-8805a20e15762c3c.js +1 -0
  83. package/dist/web/standalone/.next/static/chunks/app/api/knowledge/route-8805a20e15762c3c.js +1 -0
  84. package/dist/web/standalone/.next/static/chunks/app/api/live-state/route-8805a20e15762c3c.js +1 -0
  85. package/dist/web/standalone/.next/static/chunks/app/api/notifications/route-8805a20e15762c3c.js +1 -0
  86. package/dist/web/standalone/.next/static/chunks/app/api/onboarding/route-8805a20e15762c3c.js +1 -0
  87. package/dist/web/standalone/.next/static/chunks/app/api/preferences/route-8805a20e15762c3c.js +1 -0
  88. package/dist/web/standalone/.next/static/chunks/app/api/projects/route-8805a20e15762c3c.js +1 -0
  89. package/dist/web/standalone/.next/static/chunks/app/api/recovery/route-8805a20e15762c3c.js +1 -0
  90. package/dist/web/standalone/.next/static/chunks/app/api/remote-questions/route-8805a20e15762c3c.js +1 -0
  91. package/dist/web/standalone/.next/static/chunks/app/api/session/browser/route-8805a20e15762c3c.js +1 -0
  92. package/dist/web/standalone/.next/static/chunks/app/api/session/command/route-8805a20e15762c3c.js +1 -0
  93. package/dist/web/standalone/.next/static/chunks/app/api/session/events/route-8805a20e15762c3c.js +1 -0
  94. package/dist/web/standalone/.next/static/chunks/app/api/session/manage/route-8805a20e15762c3c.js +1 -0
  95. package/dist/web/standalone/.next/static/chunks/app/api/settings-data/route-8805a20e15762c3c.js +1 -0
  96. package/dist/web/standalone/.next/static/chunks/app/api/shutdown/route-8805a20e15762c3c.js +1 -0
  97. package/dist/web/standalone/.next/static/chunks/app/api/skill-health/route-8805a20e15762c3c.js +1 -0
  98. package/dist/web/standalone/.next/static/chunks/app/api/steer/route-8805a20e15762c3c.js +1 -0
  99. package/dist/web/standalone/.next/static/chunks/app/api/switch-root/route-8805a20e15762c3c.js +1 -0
  100. package/dist/web/standalone/.next/static/chunks/app/api/terminal/input/route-8805a20e15762c3c.js +1 -0
  101. package/dist/web/standalone/.next/static/chunks/app/api/terminal/resize/route-8805a20e15762c3c.js +1 -0
  102. package/dist/web/standalone/.next/static/chunks/app/api/terminal/sessions/route-8805a20e15762c3c.js +1 -0
  103. package/dist/web/standalone/.next/static/chunks/app/api/terminal/stream/route-8805a20e15762c3c.js +1 -0
  104. package/dist/web/standalone/.next/static/chunks/app/api/terminal/upload/route-8805a20e15762c3c.js +1 -0
  105. package/dist/web/standalone/.next/static/chunks/app/api/undo/route-8805a20e15762c3c.js +1 -0
  106. package/dist/web/standalone/.next/static/chunks/app/api/update/route-8805a20e15762c3c.js +1 -0
  107. package/dist/web/standalone/.next/static/chunks/app/api/visualizer/route-8805a20e15762c3c.js +1 -0
  108. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-8805a20e15762c3c.js +1 -0
  109. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-8805a20e15762c3c.js +1 -0
  110. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-8805a20e15762c3c.js +1 -0
  111. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8805a20e15762c3c.js +1 -0
  112. package/dist/web/standalone/server.js +1 -1
  113. package/package.json +1 -1
  114. package/packages/pi-agent-core/dist/agent-loop.js +26 -9
  115. package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
  116. package/packages/pi-agent-core/src/agent-loop.test.ts +100 -4
  117. package/packages/pi-agent-core/src/agent-loop.ts +43 -12
  118. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.d.ts +2 -0
  119. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.d.ts.map +1 -0
  120. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js +38 -0
  121. package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js.map +1 -0
  122. package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
  123. package/packages/pi-coding-agent/dist/core/agent-session.js +11 -0
  124. package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
  125. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.d.ts +2 -0
  126. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.d.ts.map +1 -0
  127. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js +24 -0
  128. package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js.map +1 -0
  129. package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
  130. package/packages/pi-coding-agent/dist/core/resource-loader.js +4 -1
  131. package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
  132. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +1 -0
  133. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  134. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +8 -0
  135. package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
  136. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +6 -0
  137. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  138. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +36 -0
  139. package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  140. package/packages/pi-coding-agent/package.json +1 -1
  141. package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +64 -0
  142. package/packages/pi-coding-agent/src/core/agent-session.ts +10 -0
  143. package/packages/pi-coding-agent/src/core/resource-loader-cache-reset.test.ts +42 -0
  144. package/packages/pi-coding-agent/src/core/resource-loader.ts +5 -1
  145. package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +9 -0
  146. package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +33 -0
  147. package/packages/pi-tui/dist/__tests__/overlay-layout.test.d.ts +2 -0
  148. package/packages/pi-tui/dist/__tests__/overlay-layout.test.d.ts.map +1 -0
  149. package/packages/pi-tui/dist/__tests__/overlay-layout.test.js +66 -0
  150. package/packages/pi-tui/dist/__tests__/overlay-layout.test.js.map +1 -0
  151. package/packages/pi-tui/dist/components/loader.d.ts +4 -2
  152. package/packages/pi-tui/dist/components/loader.d.ts.map +1 -1
  153. package/packages/pi-tui/dist/components/loader.js +27 -9
  154. package/packages/pi-tui/dist/components/loader.js.map +1 -1
  155. package/packages/pi-tui/dist/components/text.d.ts.map +1 -1
  156. package/packages/pi-tui/dist/components/text.js +2 -0
  157. package/packages/pi-tui/dist/components/text.js.map +1 -1
  158. package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -1
  159. package/packages/pi-tui/dist/overlay-layout.js +12 -1
  160. package/packages/pi-tui/dist/overlay-layout.js.map +1 -1
  161. package/packages/pi-tui/dist/tui.d.ts +4 -0
  162. package/packages/pi-tui/dist/tui.d.ts.map +1 -1
  163. package/packages/pi-tui/dist/tui.js +35 -0
  164. package/packages/pi-tui/dist/tui.js.map +1 -1
  165. package/packages/pi-tui/src/__tests__/overlay-layout.test.ts +82 -0
  166. package/packages/pi-tui/src/components/loader.ts +27 -10
  167. package/packages/pi-tui/src/components/text.ts +1 -0
  168. package/packages/pi-tui/src/overlay-layout.ts +13 -1
  169. package/packages/pi-tui/src/tui.ts +34 -0
  170. package/pkg/package.json +1 -1
  171. package/src/resources/extensions/bg-shell/bg-shell-lifecycle.ts +19 -7
  172. package/src/resources/extensions/bg-shell/process-manager.ts +8 -2
  173. package/src/resources/extensions/gsd/auto-dashboard.ts +5 -4
  174. package/src/resources/extensions/gsd/auto-post-unit.ts +122 -0
  175. package/src/resources/extensions/gsd/auto-verification.ts +190 -2
  176. package/src/resources/extensions/gsd/auto.ts +4 -0
  177. package/src/resources/extensions/gsd/bootstrap/db-tools.ts +25 -13
  178. package/src/resources/extensions/gsd/bootstrap/notify-interceptor.ts +34 -0
  179. package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +8 -0
  180. package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +20 -0
  181. package/src/resources/extensions/gsd/bootstrap/system-context.ts +28 -0
  182. package/src/resources/extensions/gsd/commands/catalog.ts +7 -1
  183. package/src/resources/extensions/gsd/commands/handlers/core.ts +1 -0
  184. package/src/resources/extensions/gsd/commands/handlers/notifications-handler.ts +140 -0
  185. package/src/resources/extensions/gsd/commands/handlers/ops.ts +5 -0
  186. package/src/resources/extensions/gsd/notification-overlay.ts +295 -0
  187. package/src/resources/extensions/gsd/notification-store.ts +293 -0
  188. package/src/resources/extensions/gsd/notification-widget.ts +68 -0
  189. package/src/resources/extensions/gsd/post-execution-checks.ts +539 -0
  190. package/src/resources/extensions/gsd/pre-execution-checks.ts +573 -0
  191. package/src/resources/extensions/gsd/preferences-types.ts +28 -0
  192. package/src/resources/extensions/gsd/preferences-validation.ts +33 -0
  193. package/src/resources/extensions/gsd/preferences.ts +4 -0
  194. package/src/resources/extensions/gsd/tests/auto-start-time-persistence.test.ts +50 -0
  195. package/src/resources/extensions/gsd/tests/complete-slice-string-coercion.test.ts +36 -0
  196. package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +76 -0
  197. package/src/resources/extensions/gsd/tests/enhanced-verification-integration.test.ts +526 -0
  198. package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +73 -0
  199. package/src/resources/extensions/gsd/tests/notification-store.test.ts +282 -0
  200. package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +312 -0
  201. package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +813 -0
  202. package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +999 -0
  203. package/src/resources/extensions/gsd/tests/pre-execution-fail-closed.test.ts +266 -0
  204. package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +457 -0
  205. package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +163 -0
  206. package/src/resources/extensions/gsd/verification-evidence.ts +68 -0
  207. package/src/resources/extensions/gsd/workflow-logger.ts +13 -0
  208. package/dist/web/standalone/.next/static/chunks/app/_global-error/page-c4cc189e7b117ea2.js +0 -1
  209. package/dist/web/standalone/.next/static/chunks/app/api/boot/route-c4cc189e7b117ea2.js +0 -1
  210. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/input/route-c4cc189e7b117ea2.js +0 -1
  211. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/resize/route-c4cc189e7b117ea2.js +0 -1
  212. package/dist/web/standalone/.next/static/chunks/app/api/bridge-terminal/stream/route-c4cc189e7b117ea2.js +0 -1
  213. package/dist/web/standalone/.next/static/chunks/app/api/browse-directories/route-c4cc189e7b117ea2.js +0 -1
  214. package/dist/web/standalone/.next/static/chunks/app/api/captures/route-c4cc189e7b117ea2.js +0 -1
  215. package/dist/web/standalone/.next/static/chunks/app/api/cleanup/route-c4cc189e7b117ea2.js +0 -1
  216. package/dist/web/standalone/.next/static/chunks/app/api/dev-mode/route-c4cc189e7b117ea2.js +0 -1
  217. package/dist/web/standalone/.next/static/chunks/app/api/doctor/route-c4cc189e7b117ea2.js +0 -1
  218. package/dist/web/standalone/.next/static/chunks/app/api/experimental/route-c4cc189e7b117ea2.js +0 -1
  219. package/dist/web/standalone/.next/static/chunks/app/api/export-data/route-c4cc189e7b117ea2.js +0 -1
  220. package/dist/web/standalone/.next/static/chunks/app/api/files/route-c4cc189e7b117ea2.js +0 -1
  221. package/dist/web/standalone/.next/static/chunks/app/api/forensics/route-c4cc189e7b117ea2.js +0 -1
  222. package/dist/web/standalone/.next/static/chunks/app/api/git/route-c4cc189e7b117ea2.js +0 -1
  223. package/dist/web/standalone/.next/static/chunks/app/api/history/route-c4cc189e7b117ea2.js +0 -1
  224. package/dist/web/standalone/.next/static/chunks/app/api/hooks/route-c4cc189e7b117ea2.js +0 -1
  225. package/dist/web/standalone/.next/static/chunks/app/api/inspect/route-c4cc189e7b117ea2.js +0 -1
  226. package/dist/web/standalone/.next/static/chunks/app/api/knowledge/route-c4cc189e7b117ea2.js +0 -1
  227. package/dist/web/standalone/.next/static/chunks/app/api/live-state/route-c4cc189e7b117ea2.js +0 -1
  228. package/dist/web/standalone/.next/static/chunks/app/api/onboarding/route-c4cc189e7b117ea2.js +0 -1
  229. package/dist/web/standalone/.next/static/chunks/app/api/preferences/route-c4cc189e7b117ea2.js +0 -1
  230. package/dist/web/standalone/.next/static/chunks/app/api/projects/route-c4cc189e7b117ea2.js +0 -1
  231. package/dist/web/standalone/.next/static/chunks/app/api/recovery/route-c4cc189e7b117ea2.js +0 -1
  232. package/dist/web/standalone/.next/static/chunks/app/api/remote-questions/route-c4cc189e7b117ea2.js +0 -1
  233. package/dist/web/standalone/.next/static/chunks/app/api/session/browser/route-c4cc189e7b117ea2.js +0 -1
  234. package/dist/web/standalone/.next/static/chunks/app/api/session/command/route-c4cc189e7b117ea2.js +0 -1
  235. package/dist/web/standalone/.next/static/chunks/app/api/session/events/route-c4cc189e7b117ea2.js +0 -1
  236. package/dist/web/standalone/.next/static/chunks/app/api/session/manage/route-c4cc189e7b117ea2.js +0 -1
  237. package/dist/web/standalone/.next/static/chunks/app/api/settings-data/route-c4cc189e7b117ea2.js +0 -1
  238. package/dist/web/standalone/.next/static/chunks/app/api/shutdown/route-c4cc189e7b117ea2.js +0 -1
  239. package/dist/web/standalone/.next/static/chunks/app/api/skill-health/route-c4cc189e7b117ea2.js +0 -1
  240. package/dist/web/standalone/.next/static/chunks/app/api/steer/route-c4cc189e7b117ea2.js +0 -1
  241. package/dist/web/standalone/.next/static/chunks/app/api/switch-root/route-c4cc189e7b117ea2.js +0 -1
  242. package/dist/web/standalone/.next/static/chunks/app/api/terminal/input/route-c4cc189e7b117ea2.js +0 -1
  243. package/dist/web/standalone/.next/static/chunks/app/api/terminal/resize/route-c4cc189e7b117ea2.js +0 -1
  244. package/dist/web/standalone/.next/static/chunks/app/api/terminal/sessions/route-c4cc189e7b117ea2.js +0 -1
  245. package/dist/web/standalone/.next/static/chunks/app/api/terminal/stream/route-c4cc189e7b117ea2.js +0 -1
  246. package/dist/web/standalone/.next/static/chunks/app/api/terminal/upload/route-c4cc189e7b117ea2.js +0 -1
  247. package/dist/web/standalone/.next/static/chunks/app/api/undo/route-c4cc189e7b117ea2.js +0 -1
  248. package/dist/web/standalone/.next/static/chunks/app/api/update/route-c4cc189e7b117ea2.js +0 -1
  249. package/dist/web/standalone/.next/static/chunks/app/api/visualizer/route-c4cc189e7b117ea2.js +0 -1
  250. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/app-error-c4cc189e7b117ea2.js +0 -1
  251. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/forbidden-c4cc189e7b117ea2.js +0 -1
  252. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/not-found-c4cc189e7b117ea2.js +0 -1
  253. package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/unauthorized-c4cc189e7b117ea2.js +0 -1
  254. package/dist/web/standalone/.next/static/eebXKteM9EaWyseHKTjqp/_buildManifest.js +0 -1
  255. /package/dist/web/standalone/.next/static/{eebXKteM9EaWyseHKTjqp → MRM3OSYIAa4HMDqVGQ9nt}/_ssgManifest.js +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gsd/pi-coding-agent",
3
- "version": "2.64.0",
3
+ "version": "2.65.0",
4
4
  "description": "Coding agent CLI (vendored from pi-mono)",
5
5
  "type": "module",
6
6
  "piConfig": {
@@ -0,0 +1,64 @@
1
+ // GSD-2 — Regression tests for #3616: tool list persistence across newSession() calls
2
+ // Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
3
+
4
+ import test, { describe } from "node:test";
5
+ import assert from "node:assert/strict";
6
+ import { readFileSync } from "node:fs";
7
+ import { join } from "node:path";
8
+
9
+ const source = readFileSync(
10
+ join(process.cwd(), "packages/pi-coding-agent/src/core/agent-session.ts"),
11
+ "utf-8",
12
+ );
13
+
14
+ describe("#3616 — newSession() must restore full tool set", () => {
15
+ test("newSession() calls _refreshToolRegistry with includeAllExtensionTools when cwd is unchanged", () => {
16
+ // Find the newSession method
17
+ const newSessionStart = source.indexOf("async newSession(options?:");
18
+ assert.ok(newSessionStart >= 0, "should find newSession method");
19
+
20
+ // Get the method body (up to the next top-level method)
21
+ const methodBody = source.slice(newSessionStart, newSessionStart + 3000);
22
+
23
+ // Verify the cwd-changed branch rebuilds tools
24
+ assert.ok(
25
+ methodBody.includes("if (this._cwd !== previousCwd)"),
26
+ "should have cwd-change guard",
27
+ );
28
+
29
+ // Verify the else branch exists and refreshes tools with includeAllExtensionTools
30
+ const elseIdx = methodBody.indexOf("} else {");
31
+ assert.ok(elseIdx >= 0, "should have else branch for cwd-unchanged case");
32
+
33
+ const elseBranch = methodBody.slice(elseIdx, elseIdx + 800);
34
+ assert.ok(
35
+ elseBranch.includes("_refreshToolRegistry"),
36
+ "else branch should call _refreshToolRegistry",
37
+ );
38
+ assert.ok(
39
+ elseBranch.includes("includeAllExtensionTools: true"),
40
+ "else branch should pass includeAllExtensionTools: true to restore narrowed tools",
41
+ );
42
+ });
43
+
44
+ test("newSession() references #3616 in the else-branch comment", () => {
45
+ const idx = source.indexOf("#3616");
46
+ assert.ok(idx >= 0, "source should reference issue #3616 for the tool restore fix");
47
+ });
48
+
49
+ test("agent.reset() does not clear _state.tools (tools persist across reset)", () => {
50
+ // This is a structural invariant — if reset() starts clearing tools,
51
+ // the newSession() refresh becomes the only defense against tool loss.
52
+ const agentSource = readFileSync(
53
+ join(process.cwd(), "packages/pi-agent-core/src/agent.ts"),
54
+ "utf-8",
55
+ );
56
+ const resetStart = agentSource.indexOf("reset()");
57
+ assert.ok(resetStart >= 0, "should find reset() method");
58
+ const resetBody = agentSource.slice(resetStart, resetStart + 400);
59
+ assert.ok(
60
+ !resetBody.includes("tools"),
61
+ "reset() should NOT touch _state.tools — tools are managed by agent-session",
62
+ );
63
+ });
64
+ });
@@ -1577,6 +1577,16 @@ export class AgentSession {
1577
1577
  activeToolNames: this.getActiveToolNames(),
1578
1578
  includeAllExtensionTools: true,
1579
1579
  });
1580
+ } else {
1581
+ // Even when cwd hasn't changed, restore the full tool set (#3616).
1582
+ // Extensions (e.g., discuss flows) may narrow the active tool list
1583
+ // via setActiveTools() during a session. Without this refresh, the
1584
+ // narrowed set persists into the next session — causing tools like
1585
+ // gsd_plan_slice to be missing from auto-mode subagent sessions.
1586
+ this._refreshToolRegistry({
1587
+ activeToolNames: this.getActiveToolNames(),
1588
+ includeAllExtensionTools: true,
1589
+ });
1580
1590
  }
1581
1591
 
1582
1592
  // Run setup callback if provided (e.g., to append initial messages)
@@ -0,0 +1,42 @@
1
+ // GSD-2 — Regression test for #3616: reload() must reset jiti extension loader cache
2
+ // Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
3
+
4
+ import test, { describe } from "node:test";
5
+ import assert from "node:assert/strict";
6
+ import { readFileSync } from "node:fs";
7
+ import { join } from "node:path";
8
+
9
+ const source = readFileSync(
10
+ join(process.cwd(), "packages/pi-coding-agent/src/core/resource-loader.ts"),
11
+ "utf-8",
12
+ );
13
+
14
+ describe("#3616 — reload() must invalidate jiti module cache", () => {
15
+ test("resource-loader imports resetExtensionLoaderCache from loader.js", () => {
16
+ assert.ok(
17
+ source.includes("resetExtensionLoaderCache"),
18
+ "resource-loader.ts should import resetExtensionLoaderCache",
19
+ );
20
+ assert.ok(
21
+ source.includes('from "./extensions/loader.js"'),
22
+ "resetExtensionLoaderCache should be imported from extensions/loader.js",
23
+ );
24
+ });
25
+
26
+ test("reload() calls resetExtensionLoaderCache before loadExtensions", () => {
27
+ const reloadStart = source.indexOf("async reload(): Promise<void>");
28
+ assert.ok(reloadStart >= 0, "should find reload() method");
29
+ const reloadBody = source.slice(reloadStart, reloadStart + 4000);
30
+
31
+ const resetIdx = reloadBody.indexOf("resetExtensionLoaderCache()");
32
+ assert.ok(resetIdx >= 0, "reload() should call resetExtensionLoaderCache()");
33
+
34
+ const loadIdx = reloadBody.indexOf("loadExtensions(");
35
+ assert.ok(loadIdx >= 0, "reload() should call loadExtensions");
36
+
37
+ assert.ok(
38
+ resetIdx < loadIdx,
39
+ "resetExtensionLoaderCache() must be called BEFORE loadExtensions to ensure fresh modules",
40
+ );
41
+ });
42
+ });
@@ -9,7 +9,7 @@ import type { ResourceCollision, ResourceDiagnostic } from "./diagnostics.js";
9
9
  export type { ResourceCollision, ResourceDiagnostic } from "./diagnostics.js";
10
10
 
11
11
  import { createEventBus, type EventBus } from "./event-bus.js";
12
- import { createExtensionRuntime, loadExtensionFromFactory, loadExtensions } from "./extensions/loader.js";
12
+ import { createExtensionRuntime, loadExtensionFromFactory, loadExtensions, resetExtensionLoaderCache } from "./extensions/loader.js";
13
13
  import type { Extension, ExtensionFactory, ExtensionRuntime, LoadExtensionsResult } from "./extensions/types.js";
14
14
  import { DefaultPackageManager, type PathMetadata } from "./package-manager.js";
15
15
  import type { PromptTemplate } from "./prompt-templates.js";
@@ -320,6 +320,10 @@ export class DefaultResourceLoader implements ResourceLoader {
320
320
  }
321
321
 
322
322
  async reload(): Promise<void> {
323
+ // Invalidate the shared jiti module cache so updated extension code
324
+ // on disk is re-compiled instead of served from the stale cache (#3616).
325
+ resetExtensionLoaderCache();
326
+
323
327
  const resolvedPaths = await this.packageManager.resolve();
324
328
  const cliExtensionPaths = await this.packageManager.resolveExtensionSources(this.additionalExtensionPaths, {
325
329
  temporary: true,
@@ -137,6 +137,15 @@ export class ToolExecutionComponent extends Container {
137
137
  return isBuiltInName && !hasCustomRenderers;
138
138
  }
139
139
 
140
+ dispose(): void {
141
+ this.convertedImages.clear();
142
+ this.imageComponents = [];
143
+ this.imageSpacers = [];
144
+ this.editDiffPreview = undefined;
145
+ this.writeHighlightCache = undefined;
146
+ this.result = undefined;
147
+ }
148
+
140
149
  updateArgs(args: any): void {
141
150
  this.args = args;
142
151
  if (this.toolName === "write" && this.isPartial) {
@@ -7,6 +7,7 @@ import * as crypto from "node:crypto";
7
7
  import * as fs from "node:fs";
8
8
  import * as os from "node:os";
9
9
  import * as path from "node:path";
10
+ import { listDescendants } from "@gsd/native";
10
11
  import type { AgentMessage } from "@gsd/pi-agent-core";
11
12
  import type { AssistantMessage, ImageContent, Message, Model, OAuthProviderId } from "@gsd/pi-ai";
12
13
  import type {
@@ -157,6 +158,10 @@ export interface InteractiveModeOptions {
157
158
  }
158
159
 
159
160
  export class InteractiveMode {
161
+ // Cap rendered chat components to prevent unbounded memory/CPU growth.
162
+ // Only render-components are removed — session transcript stays on disk.
163
+ private static readonly MAX_CHAT_COMPONENTS = 100;
164
+
160
165
  private session: AgentSession;
161
166
  private ui: TUI;
162
167
  private chatContainer: Container;
@@ -2138,6 +2143,18 @@ export class InteractiveMode {
2138
2143
  const _exhaustive: never = message;
2139
2144
  }
2140
2145
  }
2146
+ this.trimChatHistory();
2147
+ }
2148
+
2149
+ /**
2150
+ * Remove oldest components when chat exceeds MAX_CHAT_COMPONENTS.
2151
+ * Only render-components are removed — session data stays in SessionManager.
2152
+ */
2153
+ private trimChatHistory(): void {
2154
+ while (this.chatContainer.children.length > InteractiveMode.MAX_CHAT_COMPONENTS) {
2155
+ const oldest = this.chatContainer.children[0];
2156
+ this.chatContainer.removeChild(oldest);
2157
+ }
2141
2158
  }
2142
2159
 
2143
2160
  /**
@@ -2232,6 +2249,7 @@ export class InteractiveMode {
2232
2249
  }
2233
2250
 
2234
2251
  this.pendingTools.clear();
2252
+ this.trimChatHistory();
2235
2253
  this.ui.requestRender();
2236
2254
  }
2237
2255
 
@@ -2325,6 +2343,21 @@ export class InteractiveMode {
2325
2343
  if (shutdownBehavior === "stop_ui") {
2326
2344
  return;
2327
2345
  }
2346
+
2347
+ // Kill ALL descendant processes to prevent orphans (next-server, pnpm dev, etc.)
2348
+ try {
2349
+ const descendants = listDescendants(process.pid);
2350
+ for (const childPid of descendants) {
2351
+ try { process.kill(childPid, "SIGTERM"); } catch {}
2352
+ }
2353
+ if (descendants.length > 0) {
2354
+ await new Promise(resolve => setTimeout(resolve, 500));
2355
+ for (const childPid of descendants) {
2356
+ try { process.kill(childPid, "SIGKILL"); } catch {}
2357
+ }
2358
+ }
2359
+ } catch {}
2360
+
2328
2361
  process.exit(0);
2329
2362
  }
2330
2363
 
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=overlay-layout.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-layout.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/overlay-layout.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,66 @@
1
+ // pi-tui — Overlay Layout Tests (backdrop dimming)
2
+ import { describe, it } from "node:test";
3
+ import assert from "node:assert/strict";
4
+ import { compositeOverlays } from "../overlay-layout.js";
5
+ function makeEntry(lines, options) {
6
+ return {
7
+ component: { render: () => lines },
8
+ options,
9
+ hidden: false,
10
+ focusOrder: 1,
11
+ };
12
+ }
13
+ describe("compositeOverlays — backdrop", () => {
14
+ it("dims base lines when backdrop is true", () => {
15
+ const base = ["hello world", "second line"];
16
+ const overlay = makeEntry(["OVERLAY"], {
17
+ width: 7,
18
+ anchor: "top-left",
19
+ backdrop: true,
20
+ });
21
+ const result = compositeOverlays(base, [overlay], 20, 20, 2);
22
+ // All base lines in viewport should contain dim escape (\x1b[2m)
23
+ // The overlay line itself is composited on top, but underlying lines get dimmed
24
+ const dimmedLine = result.find((l) => l.includes("second line"));
25
+ assert.ok(dimmedLine, "should have a line containing 'second line'");
26
+ assert.ok(dimmedLine.includes("\x1b[2m"), "base line should be dimmed");
27
+ });
28
+ it("backdrop uses gray foreground for dimming", () => {
29
+ const base = ["hello world", "second line"];
30
+ const overlay = makeEntry(["OV"], {
31
+ width: 2,
32
+ anchor: "top-left",
33
+ backdrop: true,
34
+ });
35
+ const result = compositeOverlays(base, [overlay], 20, 20, 2);
36
+ // Check a non-overlay line for backdrop codes (dim + gray fg, no bg)
37
+ const line = result.find((l) => l.includes("second line"));
38
+ assert.ok(line, "should have a line containing 'second line'");
39
+ assert.ok(line.includes("\x1b[38;5;240m"), "backdrop should set gray foreground");
40
+ assert.ok(!line.includes("\x1b[48;"), "backdrop should not set background color");
41
+ });
42
+ it("does not dim when backdrop is false/absent", () => {
43
+ const base = ["hello world", "second line"];
44
+ const overlay = makeEntry(["OVERLAY"], {
45
+ width: 7,
46
+ anchor: "top-left",
47
+ });
48
+ const result = compositeOverlays(base, [overlay], 20, 20, 2);
49
+ // Lines not covered by overlay should remain undimmed
50
+ const secondLine = result.find((l) => l.includes("second line"));
51
+ assert.ok(secondLine, "should have a line containing 'second line'");
52
+ assert.ok(!secondLine.includes("\x1b[2m"), "base line should not be dimmed");
53
+ });
54
+ it("overlay content renders on top of dimmed background", () => {
55
+ const base = ["aaaaaaaaaa"];
56
+ const overlay = makeEntry(["XX"], {
57
+ width: 2,
58
+ anchor: "top-left",
59
+ backdrop: true,
60
+ });
61
+ const result = compositeOverlays(base, [overlay], 10, 10, 1);
62
+ // The first line should contain the overlay text
63
+ assert.ok(result[0].includes("XX"), "overlay text should be composited");
64
+ });
65
+ });
66
+ //# sourceMappingURL=overlay-layout.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-layout.test.js","sourceRoot":"","sources":["../../src/__tests__/overlay-layout.test.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAC;AAE5E,SAAS,SAAS,CACjB,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AM,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;QAC5B,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE;YACjC,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QAE7D,iDAAiD;QACjD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,mCAAmC,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["// pi-tui — Overlay Layout Tests (backdrop dimming)\n\nimport { describe, it } from \"node:test\";\nimport assert from \"node:assert/strict\";\nimport { compositeOverlays, type OverlayEntry } from \"../overlay-layout.js\";\n\nfunction makeEntry(\n\tlines: string[],\n\toptions?: OverlayEntry[\"options\"],\n): OverlayEntry {\n\treturn {\n\t\tcomponent: { render: () => lines },\n\t\toptions,\n\t\thidden: false,\n\t\tfocusOrder: 1,\n\t};\n}\n\ndescribe(\"compositeOverlays — backdrop\", () => {\n\tit(\"dims base lines when backdrop is true\", () => {\n\t\tconst base = [\"hello world\", \"second line\"];\n\t\tconst overlay = makeEntry([\"OVERLAY\"], {\n\t\t\twidth: 7,\n\t\t\tanchor: \"top-left\",\n\t\t\tbackdrop: true,\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 20, 20, 2);\n\n\t\t// All base lines in viewport should contain dim escape (\\x1b[2m)\n\t\t// The overlay line itself is composited on top, but underlying lines get dimmed\n\t\tconst dimmedLine = result.find((l) => l.includes(\"second line\"));\n\t\tassert.ok(dimmedLine, \"should have a line containing 'second line'\");\n\t\tassert.ok(dimmedLine.includes(\"\\x1b[2m\"), \"base line should be dimmed\");\n\t});\n\n\tit(\"backdrop uses gray foreground for dimming\", () => {\n\t\tconst base = [\"hello world\", \"second line\"];\n\t\tconst overlay = makeEntry([\"OV\"], {\n\t\t\twidth: 2,\n\t\t\tanchor: \"top-left\",\n\t\t\tbackdrop: true,\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 20, 20, 2);\n\n\t\t// Check a non-overlay line for backdrop codes (dim + gray fg, no bg)\n\t\tconst line = result.find((l) => l.includes(\"second line\"));\n\t\tassert.ok(line, \"should have a line containing 'second line'\");\n\t\tassert.ok(line.includes(\"\\x1b[38;5;240m\"), \"backdrop should set gray foreground\");\n\t\tassert.ok(!line.includes(\"\\x1b[48;\"), \"backdrop should not set background color\");\n\t});\n\n\tit(\"does not dim when backdrop is false/absent\", () => {\n\t\tconst base = [\"hello world\", \"second line\"];\n\t\tconst overlay = makeEntry([\"OVERLAY\"], {\n\t\t\twidth: 7,\n\t\t\tanchor: \"top-left\",\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 20, 20, 2);\n\n\t\t// Lines not covered by overlay should remain undimmed\n\t\tconst secondLine = result.find((l) => l.includes(\"second line\"));\n\t\tassert.ok(secondLine, \"should have a line containing 'second line'\");\n\t\tassert.ok(!secondLine.includes(\"\\x1b[2m\"), \"base line should not be dimmed\");\n\t});\n\n\tit(\"overlay content renders on top of dimmed background\", () => {\n\t\tconst base = [\"aaaaaaaaaa\"];\n\t\tconst overlay = makeEntry([\"XX\"], {\n\t\t\twidth: 2,\n\t\t\tanchor: \"top-left\",\n\t\t\tbackdrop: true,\n\t\t});\n\n\t\tconst result = compositeOverlays(base, [overlay], 10, 10, 1);\n\n\t\t// The first line should contain the overlay text\n\t\tassert.ok(result[0].includes(\"XX\"), \"overlay text should be composited\");\n\t});\n});\n"]}
@@ -1,7 +1,9 @@
1
1
  import type { TUI } from "../tui.js";
2
2
  import { Text } from "./text.js";
3
3
  /**
4
- * Loader component that updates every 80ms with spinning animation
4
+ * Loader component that updates every 80ms with spinning animation.
5
+ * Frame rotation is isolated from message text to avoid invalidating
6
+ * Text's render cache (wrapTextWithAnsi, visibleWidth) on every tick.
5
7
  */
6
8
  export declare class Loader extends Text {
7
9
  private spinnerColorFn;
@@ -11,12 +13,12 @@ export declare class Loader extends Text {
11
13
  private currentFrame;
12
14
  private intervalId;
13
15
  private ui;
16
+ private _lastMessage;
14
17
  constructor(ui: TUI, spinnerColorFn: (str: string) => string, messageColorFn: (str: string) => string, message?: string);
15
18
  render(width: number): string[];
16
19
  start(): void;
17
20
  stop(): void;
18
21
  dispose(): void;
19
22
  setMessage(message: string): void;
20
- private updateDisplay;
21
23
  }
22
24
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/components/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,qBAAa,MAAO,SAAQ,IAAI;IAQ9B,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,OAAO;IAThB,OAAO,CAAC,MAAM,CAAsD;IACpE,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,EAAE,CAAoB;gBAG7B,EAAE,EAAE,GAAG,EACC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EACvC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EACvC,OAAO,GAAE,MAAqB;IAOvC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAI/B,KAAK;IAWL,IAAI;IAOJ,OAAO;IAKP,UAAU,CAAC,OAAO,EAAE,MAAM;IAK1B,OAAO,CAAC,aAAa;CAOrB"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/components/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,IAAI;IAS9B,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,OAAO;IAVhB,OAAO,CAAC,MAAM,CAAsD;IACpE,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,EAAE,CAAoB;IAC9B,OAAO,CAAC,YAAY,CAAc;gBAGjC,EAAE,EAAE,GAAG,EACC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EACvC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EACvC,OAAO,GAAE,MAAqB;IAOvC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAkB/B,KAAK;IAiBL,IAAI;IAOJ,OAAO;IAKP,UAAU,CAAC,OAAO,EAAE,MAAM;CAM1B"}
@@ -1,6 +1,8 @@
1
1
  import { Text } from "./text.js";
2
2
  /**
3
- * Loader component that updates every 80ms with spinning animation
3
+ * Loader component that updates every 80ms with spinning animation.
4
+ * Frame rotation is isolated from message text to avoid invalidating
5
+ * Text's render cache (wrapTextWithAnsi, visibleWidth) on every tick.
4
6
  */
5
7
  export class Loader extends Text {
6
8
  constructor(ui, spinnerColorFn, messageColorFn, message = "Loading...") {
@@ -12,21 +14,42 @@ export class Loader extends Text {
12
14
  this.currentFrame = 0;
13
15
  this.intervalId = null;
14
16
  this.ui = null;
17
+ this._lastMessage = "";
15
18
  this.ui = ui;
16
19
  this.start();
17
20
  }
18
21
  render(width) {
19
- return ["", ...super.render(width)];
22
+ // Only update Text content when message actually changes —
23
+ // frame rotation is prepended below without touching the cache
24
+ if (this.message !== this._lastMessage) {
25
+ this.setText(this.messageColorFn(this.message));
26
+ this._lastMessage = this.message;
27
+ }
28
+ const messageLines = super.render(width);
29
+ // Shallow copy so we don't mutate cachedLines from Text
30
+ const result = ["", ...messageLines];
31
+ // Prepend spinner frame to first content line
32
+ if (result.length > 1) {
33
+ const frame = this.frames[this.currentFrame];
34
+ result[1] = this.spinnerColorFn(frame) + " " + result[1];
35
+ }
36
+ return result;
20
37
  }
21
38
  start() {
22
39
  if (this.intervalId) {
23
40
  clearInterval(this.intervalId);
24
41
  }
25
- this.updateDisplay();
42
+ this.currentFrame = 0;
26
43
  this.intervalId = setInterval(() => {
27
44
  this.currentFrame = (this.currentFrame + 1) % this.frames.length;
28
- this.updateDisplay();
45
+ if (this.ui) {
46
+ this.ui.requestRender();
47
+ }
29
48
  }, 80);
49
+ // Trigger initial render
50
+ if (this.ui) {
51
+ this.ui.requestRender();
52
+ }
30
53
  }
31
54
  stop() {
32
55
  if (this.intervalId) {
@@ -40,11 +63,6 @@ export class Loader extends Text {
40
63
  }
41
64
  setMessage(message) {
42
65
  this.message = message;
43
- this.updateDisplay();
44
- }
45
- updateDisplay() {
46
- const frame = this.frames[this.currentFrame];
47
- this.setText(`${this.spinnerColorFn(frame)} ${this.messageColorFn(this.message)}`);
48
66
  if (this.ui) {
49
67
  this.ui.requestRender();
50
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/components/loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,IAAI;IAM/B,YACC,EAAO,EACC,cAAuC,EACvC,cAAuC,EACvC,UAAkB,YAAY;QAEtC,KAAK,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAJR,mBAAc,GAAd,cAAc,CAAyB;QACvC,mBAAc,GAAd,cAAc,CAAyB;QACvC,YAAO,GAAP,OAAO,CAAuB;QAT/B,WAAM,GAAG,CAAC,GAAG,EAAE,GAAG,E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AC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACnF,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { TUI } from \"../tui.js\";\nimport { Text } from \"./text.js\";\n\n/**\n * Loader component that updates every 80ms with spinning animation\n */\nexport class Loader extends Text {\n\tprivate frames = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\tprivate currentFrame = 0;\n\tprivate intervalId: NodeJS.Timeout | null = null;\n\tprivate ui: TUI | null = null;\n\n\tconstructor(\n\t\tui: TUI,\n\t\tprivate spinnerColorFn: (str: string) => string,\n\t\tprivate messageColorFn: (str: string) => string,\n\t\tprivate message: string = \"Loading...\",\n\t) {\n\t\tsuper(\"\", 1, 0);\n\t\tthis.ui = ui;\n\t\tthis.start();\n\t}\n\n\trender(width: number): string[] {\n\t\treturn [\"\", ...super.render(width)];\n\t}\n\n\tstart() {\n\t\tif (this.intervalId) {\n\t\t\tclearInterval(this.intervalId);\n\t\t}\n\t\tthis.updateDisplay();\n\t\tthis.intervalId = setInterval(() => {\n\t\t\tthis.currentFrame = (this.currentFrame + 1) % this.frames.length;\n\t\t\tthis.updateDisplay();\n\t\t}, 80);\n\t}\n\n\tstop() {\n\t\tif (this.intervalId) {\n\t\t\tclearInterval(this.intervalId);\n\t\t\tthis.intervalId = null;\n\t\t}\n\t}\n\n\tdispose() {\n\t\tthis.stop();\n\t\tthis.ui = null;\n\t}\n\n\tsetMessage(message: string) {\n\t\tthis.message = message;\n\t\tthis.updateDisplay();\n\t}\n\n\tprivate updateDisplay() {\n\t\tconst frame = this.frames[this.currentFrame];\n\t\tthis.setText(`${this.spinnerColorFn(frame)} ${this.messageColorFn(this.message)}`);\n\t\tif (this.ui) {\n\t\t\tthis.ui.requestRender();\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/components/loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;GAIG;AACH,MAAM,OAAO,MAAO,SAAQ,IAAI;IAO/B,YACC,EAAO,EACC,cAAuC,EACvC,cAAuC,EACvC,UAAkB,YAAY;QAEtC,KAAK,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAJR,mBAAc,GAAd,cAAc,CAAyB;QACvC,mBAAc,GAAd,cAAc,CAAyB;QACvC,YAAO,GAAP,OAAO,CAAuB;QAV/B,WAAM,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5D,iBAAY,GAAG,CAAC,CAAC;QACjB,eAAU,GAA0B,IAAI,CAAC;QACzC,OAAE,GAAe,IAAI,CAAC;QACtB,iBAAY,GAAW,EAAE,CAAC;QASjC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAa;QACnB,2DAA2D;QAC3D,+DAA+D;QAC/D,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,YAAY,EAAE,CAAC;YACxC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAChD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC;QAClC,CAAC;QACD,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,K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E,GAAG,IAAI,CAAC;IAChB,CAAC;IAED,UAAU,CAAC,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { TUI } from \"../tui.js\";\nimport { Text } from \"./text.js\";\n\n/**\n * Loader component that updates every 80ms with spinning animation.\n * Frame rotation is isolated from message text to avoid invalidating\n * Text's render cache (wrapTextWithAnsi, visibleWidth) on every tick.\n */\nexport class Loader extends Text {\n\tprivate frames = [\"⠋\", \"⠙\", \"⠹\", \"⠸\", \"⠼\", \"⠴\", \"⠦\", \"⠧\", \"⠇\", \"⠏\"];\n\tprivate currentFrame = 0;\n\tprivate intervalId: NodeJS.Timeout | null = null;\n\tprivate ui: TUI | null = null;\n\tprivate _lastMessage: string = \"\";\n\n\tconstructor(\n\t\tui: TUI,\n\t\tprivate spinnerColorFn: (str: string) => string,\n\t\tprivate messageColorFn: (str: string) => string,\n\t\tprivate message: string = \"Loading...\",\n\t) {\n\t\tsuper(\"\", 1, 0);\n\t\tthis.ui = ui;\n\t\tthis.start();\n\t}\n\n\trender(width: number): string[] {\n\t\t// Only update Text content when message actually changes —\n\t\t// frame rotation is prepended below without touching the cache\n\t\tif (this.message !== this._lastMessage) {\n\t\t\tthis.setText(this.messageColorFn(this.message));\n\t\t\tthis._lastMessage = this.message;\n\t\t}\n\t\tconst messageLines = super.render(width);\n\t\t// Shallow copy so we don't mutate cachedLines from Text\n\t\tconst result = [\"\", ...messageLines];\n\t\t// Prepend spinner frame to first content line\n\t\tif (result.length > 1) {\n\t\t\tconst frame = this.frames[this.currentFrame];\n\t\t\tresult[1] = this.spinnerColorFn(frame) + \" \" + result[1];\n\t\t}\n\t\treturn result;\n\t}\n\n\tstart() {\n\t\tif (this.intervalId) {\n\t\t\tclearInterval(this.intervalId);\n\t\t}\n\t\tthis.currentFrame = 0;\n\t\tthis.intervalId = setInterval(() => {\n\t\t\tthis.currentFrame = (this.currentFrame + 1) % this.frames.length;\n\t\t\tif (this.ui) {\n\t\t\t\tthis.ui.requestRender();\n\t\t\t}\n\t\t}, 80);\n\t\t// Trigger initial render\n\t\tif (this.ui) {\n\t\t\tthis.ui.requestRender();\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this.intervalId) {\n\t\t\tclearInterval(this.intervalId);\n\t\t\tthis.intervalId = null;\n\t\t}\n\t}\n\n\tdispose() {\n\t\tthis.stop();\n\t\tthis.ui = null;\n\t}\n\n\tsetMessage(message: string) {\n\t\tthis.message = message;\n\t\tif (this.ui) {\n\t\t\tthis.ui.requestRender();\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;GAEG;AACH,qBAAa,IAAK,YAAW,SAAS;IACrC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAC,CAA2B;IAG9C,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAC,CAAW;gBAEnB,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,MAAU,EAAE,QAAQ,GAAE,MAAU,EAAE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM;IAOhH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAO3B,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI;IAO1D,UAAU,IAAI,IAAI;IAMlB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CA6D/B"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/components/text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;GAEG;AACH,qBAAa,IAAK,YAAW,SAAS;IACrC,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAC,CAA2B;IAG9C,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,WAAW,CAAC,CAAW;gBAEnB,IAAI,GAAE,MAAW,EAAE,QAAQ,GAAE,MAAU,EAAE,QAAQ,GAAE,MAAU,EAAE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM;IAOhH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAQ3B,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI;IAO1D,UAAU,IAAI,IAAI;IAMlB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CA6D/B"}
@@ -10,6 +10,8 @@ export class Text {
10
10
  this.customBgFn = customBgFn;
11
11
  }
12
12
  setText(text) {
13
+ if (this.text === text)
14
+ return;
13
15
  this.text = text;
14
16
  this.cachedText = undefined;
15
17
  this.cachedWidth = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/components/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpF;;GAEG;AACH,MAAM,OAAO,IAAI;IAWhB,YAAY,OAAe,EAAE,EAAE,WAAmB,CAAC,EAAE,WAAmB,CAAC,EAAE,UAAqC;QAC/G,IAAI,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,CAAC,CAAC;QACpC,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACpG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,YAAY,EAAE,GAAG,UAAU,CAAC,CAAC;QAE/D,eAAe;QACf,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAE1B,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;CACD","sourcesContent":["import type { Component } from \"../tui.js\";\nimport { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from \"../utils.js\";\n\n/**\n * Text component - displays multi-line text with word wrapping\n */\nexport class Text implements Component {\n\tprivate text: string;\n\tprivate paddingX: number; // Left/right padding\n\tprivate paddingY: number; // Top/bottom padding\n\tprivate customBgFn?: (text: string) => string;\n\n\t// Cache for rendered output\n\tprivate cachedText?: string;\n\tprivate cachedWidth?: number;\n\tprivate cachedLines?: string[];\n\n\tconstructor(text: string = \"\", paddingX: number = 1, paddingY: number = 1, customBgFn?: (text: string) => string) {\n\t\tthis.text = text;\n\t\tthis.paddingX = paddingX;\n\t\tthis.paddingY = paddingY;\n\t\tthis.customBgFn = customBgFn;\n\t}\n\n\tsetText(text: string): void {\n\t\tthis.text = text;\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\tsetCustomBgFn(customBgFn?: (text: string) => string): void {\n\t\tthis.customBgFn = customBgFn;\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\trender(width: number): string[] {\n\t\t// Check cache\n\t\tif (this.cachedLines && this.cachedText === this.text && this.cachedWidth === width) {\n\t\t\treturn this.cachedLines;\n\t\t}\n\n\t\t// Don't render anything if there's no actual text\n\t\tif (!this.text || this.text.trim() === \"\") {\n\t\t\tconst result: string[] = [];\n\t\t\tthis.cachedText = this.text;\n\t\t\tthis.cachedWidth = width;\n\t\t\tthis.cachedLines = result;\n\t\t\treturn result;\n\t\t}\n\n\t\t// Replace tabs with 3 spaces\n\t\tconst normalizedText = this.text.replace(/\\t/g, \" \");\n\n\t\t// Calculate content width (subtract left/right margins)\n\t\tconst contentWidth = Math.max(1, width - this.paddingX * 2);\n\n\t\t// Wrap text (this preserves ANSI codes but does NOT pad)\n\t\tconst wrappedLines = wrapTextWithAnsi(normalizedText, contentWidth);\n\n\t\t// Add margins and background to each line\n\t\tconst leftMargin = \" \".repeat(this.paddingX);\n\t\tconst rightMargin = \" \".repeat(this.paddingX);\n\t\tconst contentLines: string[] = [];\n\n\t\tfor (const line of wrappedLines) {\n\t\t\t// Add margins\n\t\t\tconst lineWithMargins = leftMargin + line + rightMargin;\n\n\t\t\t// Apply background if specified (this also pads to full width)\n\t\t\tif (this.customBgFn) {\n\t\t\t\tcontentLines.push(applyBackgroundToLine(lineWithMargins, width, this.customBgFn));\n\t\t\t} else {\n\t\t\t\t// No background - just pad to width with spaces\n\t\t\t\tconst visibleLen = visibleWidth(lineWithMargins);\n\t\t\t\tconst paddingNeeded = Math.max(0, width - visibleLen);\n\t\t\t\tcontentLines.push(lineWithMargins + \" \".repeat(paddingNeeded));\n\t\t\t}\n\t\t}\n\n\t\t// Add top/bottom padding (empty lines)\n\t\tconst emptyLine = \" \".repeat(width);\n\t\tconst emptyLines: string[] = [];\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tconst line = this.customBgFn ? applyBackgroundToLine(emptyLine, width, this.customBgFn) : emptyLine;\n\t\t\temptyLines.push(line);\n\t\t}\n\n\t\tconst result = [...emptyLines, ...contentLines, ...emptyLines];\n\n\t\t// Update cache\n\t\tthis.cachedText = this.text;\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = result;\n\n\t\treturn result.length > 0 ? result : [\"\"];\n\t}\n}\n"]}
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/components/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpF;;GAEG;AACH,MAAM,OAAO,IAAI;IAWhB,YAAY,OAAe,EAAE,EAAE,WAAmB,CAAC,EAAE,WAAmB,CAAC,EAAE,UAAqC;QAC/G,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,IAAY;QACnB,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC9B,CAAC;IAED,aAAa,CAAC,UAAqC;QAClD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC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AC;QAE/D,eAAe;QACf,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAE1B,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;CACD","sourcesContent":["import type { Component } from \"../tui.js\";\nimport { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from \"../utils.js\";\n\n/**\n * Text component - displays multi-line text with word wrapping\n */\nexport class Text implements Component {\n\tprivate text: string;\n\tprivate paddingX: number; // Left/right padding\n\tprivate paddingY: number; // Top/bottom padding\n\tprivate customBgFn?: (text: string) => string;\n\n\t// Cache for rendered output\n\tprivate cachedText?: string;\n\tprivate cachedWidth?: number;\n\tprivate cachedLines?: string[];\n\n\tconstructor(text: string = \"\", paddingX: number = 1, paddingY: number = 1, customBgFn?: (text: string) => string) {\n\t\tthis.text = text;\n\t\tthis.paddingX = paddingX;\n\t\tthis.paddingY = paddingY;\n\t\tthis.customBgFn = customBgFn;\n\t}\n\n\tsetText(text: string): void {\n\t\tif (this.text === text) return;\n\t\tthis.text = text;\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\tsetCustomBgFn(customBgFn?: (text: string) => string): void {\n\t\tthis.customBgFn = customBgFn;\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\tthis.cachedText = undefined;\n\t\tthis.cachedWidth = undefined;\n\t\tthis.cachedLines = undefined;\n\t}\n\n\trender(width: number): string[] {\n\t\t// Check cache\n\t\tif (this.cachedLines && this.cachedText === this.text && this.cachedWidth === width) {\n\t\t\treturn this.cachedLines;\n\t\t}\n\n\t\t// Don't render anything if there's no actual text\n\t\tif (!this.text || this.text.trim() === \"\") {\n\t\t\tconst result: string[] = [];\n\t\t\tthis.cachedText = this.text;\n\t\t\tthis.cachedWidth = width;\n\t\t\tthis.cachedLines = result;\n\t\t\treturn result;\n\t\t}\n\n\t\t// Replace tabs with 3 spaces\n\t\tconst normalizedText = this.text.replace(/\\t/g, \" \");\n\n\t\t// Calculate content width (subtract left/right margins)\n\t\tconst contentWidth = Math.max(1, width - this.paddingX * 2);\n\n\t\t// Wrap text (this preserves ANSI codes but does NOT pad)\n\t\tconst wrappedLines = wrapTextWithAnsi(normalizedText, contentWidth);\n\n\t\t// Add margins and background to each line\n\t\tconst leftMargin = \" \".repeat(this.paddingX);\n\t\tconst rightMargin = \" \".repeat(this.paddingX);\n\t\tconst contentLines: string[] = [];\n\n\t\tfor (const line of wrappedLines) {\n\t\t\t// Add margins\n\t\t\tconst lineWithMargins = leftMargin + line + rightMargin;\n\n\t\t\t// Apply background if specified (this also pads to full width)\n\t\t\tif (this.customBgFn) {\n\t\t\t\tcontentLines.push(applyBackgroundToLine(lineWithMargins, width, this.customBgFn));\n\t\t\t} else {\n\t\t\t\t// No background - just pad to width with spaces\n\t\t\t\tconst visibleLen = visibleWidth(lineWithMargins);\n\t\t\t\tconst paddingNeeded = Math.max(0, width - visibleLen);\n\t\t\t\tcontentLines.push(lineWithMargins + \" \".repeat(paddingNeeded));\n\t\t\t}\n\t\t}\n\n\t\t// Add top/bottom padding (empty lines)\n\t\tconst emptyLine = \" \".repeat(width);\n\t\tconst emptyLines: string[] = [];\n\t\tfor (let i = 0; i < this.paddingY; i++) {\n\t\t\tconst line = this.customBgFn ? applyBackgroundToLine(emptyLine, width, this.customBgFn) : emptyLine;\n\t\t\temptyLines.push(line);\n\t\t}\n\n\t\tconst result = [...emptyLines, ...contentLines, ...emptyLines];\n\n\t\t// Update cache\n\t\tthis.cachedText = this.text;\n\t\tthis.cachedWidth = width;\n\t\tthis.cachedLines = result;\n\n\t\treturn result.length > 0 ? result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,CAsEV;AAID;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkB1G"}
@@ -4,7 +4,7 @@
4
4
  * Extracted from tui.ts — these are pure functions that compute overlay
5
5
  * positions and composite overlay content onto base terminal lines.
6
6
  */
7
- import { extractSegments, sliceByColumn, sliceWithWidth, visibleWidth } from "./utils.js";
7
+ import { applyBackgroundToLine, extractSegments, sliceByColumn, sliceWithWidth, visibleWidth } from "./utils.js";
8
8
  import { isImageLine } from "./terminal-image.js";
9
9
  import { CURSOR_MARKER } from "./tui.js";
10
10
  // ─── Size parsing ───────────────────────────────────────────────────────────
@@ -245,6 +245,17 @@ export function compositeOverlays(lines, overlayStack, termWidth, termHeight, ma
245
245
  result.push("");
246
246
  }
247
247
  const viewportStart = Math.max(0, workingHeight - termHeight);
248
+ // Apply backdrop dimming if any visible overlay requests it.
249
+ // Uses dim + gray foreground so text fades without painting empty lines.
250
+ const hasBackdrop = visibleEntries.some((e) => e.options?.backdrop);
251
+ if (hasBackdrop) {
252
+ const dimFn = (text) => `\x1b[2m\x1b[38;5;240m${text}\x1b[39m\x1b[22m`;
253
+ for (let i = viewportStart; i < result.length; i++) {
254
+ if (!isImageLine(result[i]) && result[i].length > 0) {
255
+ result[i] = applyBackgroundToLine(result[i], termWidth, dimFn);
256
+ }
257
+ }
258
+ }
248
259
  // Composite each overlay
249
260
  for (const { overlayLines, row, col, w } of rendered) {
250
261
  for (let i = 0; i < overlayLines.length; i++) {