@kenkaiiii/ggcoder 4.3.231 → 4.3.233

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 (406) hide show
  1. package/README.md +1 -2
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +10 -89
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config.d.ts +1 -0
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +7 -1
  8. package/dist/config.js.map +1 -1
  9. package/dist/config.test.d.ts +2 -0
  10. package/dist/config.test.d.ts.map +1 -0
  11. package/dist/config.test.js +29 -0
  12. package/dist/config.test.js.map +1 -0
  13. package/dist/core/agent-session.d.ts.map +1 -1
  14. package/dist/core/agent-session.js +2 -2
  15. package/dist/core/agent-session.js.map +1 -1
  16. package/dist/core/ideal-review.d.ts +20 -0
  17. package/dist/core/ideal-review.d.ts.map +1 -0
  18. package/dist/core/ideal-review.js +55 -0
  19. package/dist/core/ideal-review.js.map +1 -0
  20. package/dist/core/ideal-review.test.d.ts +2 -0
  21. package/dist/core/ideal-review.test.d.ts.map +1 -0
  22. package/dist/core/ideal-review.test.js +59 -0
  23. package/dist/core/ideal-review.test.js.map +1 -0
  24. package/dist/core/prompt-commands.d.ts.map +1 -1
  25. package/dist/core/prompt-commands.js +8 -16
  26. package/dist/core/prompt-commands.js.map +1 -1
  27. package/dist/core/prompt-commands.test.js +14 -44
  28. package/dist/core/prompt-commands.test.js.map +1 -1
  29. package/dist/core/runtime-mode.d.ts +0 -11
  30. package/dist/core/runtime-mode.d.ts.map +1 -1
  31. package/dist/core/runtime-mode.js +0 -9
  32. package/dist/core/runtime-mode.js.map +1 -1
  33. package/dist/core/session-restore-display.test.js +4 -110
  34. package/dist/core/session-restore-display.test.js.map +1 -1
  35. package/dist/core/settings-manager.d.ts +1 -0
  36. package/dist/core/settings-manager.d.ts.map +1 -1
  37. package/dist/core/settings-manager.js +2 -0
  38. package/dist/core/settings-manager.js.map +1 -1
  39. package/dist/interactive.d.ts.map +1 -1
  40. package/dist/interactive.js +1 -1
  41. package/dist/interactive.js.map +1 -1
  42. package/dist/system-prompt.d.ts +1 -2
  43. package/dist/system-prompt.d.ts.map +1 -1
  44. package/dist/system-prompt.js +11 -58
  45. package/dist/system-prompt.js.map +1 -1
  46. package/dist/system-prompt.test.js +3 -158
  47. package/dist/system-prompt.test.js.map +1 -1
  48. package/dist/tools/bash.d.ts +1 -4
  49. package/dist/tools/bash.d.ts.map +1 -1
  50. package/dist/tools/bash.js +3 -12
  51. package/dist/tools/bash.js.map +1 -1
  52. package/dist/tools/checkpoint-hook.test.js +3 -3
  53. package/dist/tools/checkpoint-hook.test.js.map +1 -1
  54. package/dist/tools/edit.d.ts +1 -4
  55. package/dist/tools/edit.d.ts.map +1 -1
  56. package/dist/tools/edit.js +5 -13
  57. package/dist/tools/edit.js.map +1 -1
  58. package/dist/tools/enter-plan.js +1 -1
  59. package/dist/tools/enter-plan.js.map +1 -1
  60. package/dist/tools/html-extract.d.ts +58 -0
  61. package/dist/tools/html-extract.d.ts.map +1 -0
  62. package/dist/tools/html-extract.js +130 -0
  63. package/dist/tools/html-extract.js.map +1 -0
  64. package/dist/tools/html-extract.test.d.ts +2 -0
  65. package/dist/tools/html-extract.test.d.ts.map +1 -0
  66. package/dist/tools/html-extract.test.js +60 -0
  67. package/dist/tools/html-extract.test.js.map +1 -0
  68. package/dist/tools/index.d.ts +0 -9
  69. package/dist/tools/index.d.ts.map +1 -1
  70. package/dist/tools/index.js +4 -8
  71. package/dist/tools/index.js.map +1 -1
  72. package/dist/tools/pdf-extract.d.ts +18 -0
  73. package/dist/tools/pdf-extract.d.ts.map +1 -0
  74. package/dist/tools/pdf-extract.js +43 -0
  75. package/dist/tools/pdf-extract.js.map +1 -0
  76. package/dist/tools/pdf-extract.test.d.ts +2 -0
  77. package/dist/tools/pdf-extract.test.d.ts.map +1 -0
  78. package/dist/tools/pdf-extract.test.js +15 -0
  79. package/dist/tools/pdf-extract.test.js.map +1 -0
  80. package/dist/tools/prompt-hints.d.ts.map +1 -1
  81. package/dist/tools/prompt-hints.js +2 -3
  82. package/dist/tools/prompt-hints.js.map +1 -1
  83. package/dist/tools/screenshot.d.ts +1 -1
  84. package/dist/tools/subagent.d.ts +1 -4
  85. package/dist/tools/subagent.d.ts.map +1 -1
  86. package/dist/tools/subagent.js +2 -5
  87. package/dist/tools/subagent.js.map +1 -1
  88. package/dist/tools/web-fetch.d.ts +16 -1
  89. package/dist/tools/web-fetch.d.ts.map +1 -1
  90. package/dist/tools/web-fetch.js +357 -45
  91. package/dist/tools/web-fetch.js.map +1 -1
  92. package/dist/tools/web-fetch.test.js +263 -2
  93. package/dist/tools/web-fetch.test.js.map +1 -1
  94. package/dist/tools/web-search.d.ts +14 -0
  95. package/dist/tools/web-search.d.ts.map +1 -1
  96. package/dist/tools/web-search.js +321 -35
  97. package/dist/tools/web-search.js.map +1 -1
  98. package/dist/tools/web-search.test.js +144 -1
  99. package/dist/tools/web-search.test.js.map +1 -1
  100. package/dist/tools/write.d.ts +1 -4
  101. package/dist/tools/write.d.ts.map +1 -1
  102. package/dist/tools/write.js +5 -13
  103. package/dist/tools/write.js.map +1 -1
  104. package/dist/ui/App.d.ts +7 -20
  105. package/dist/ui/App.d.ts.map +1 -1
  106. package/dist/ui/App.js +124 -309
  107. package/dist/ui/App.js.map +1 -1
  108. package/dist/ui/app-items.d.ts +36 -25
  109. package/dist/ui/app-items.d.ts.map +1 -1
  110. package/dist/ui/app-items.js +39 -0
  111. package/dist/ui/app-items.js.map +1 -1
  112. package/dist/ui/app-items.test.d.ts +2 -0
  113. package/dist/ui/app-items.test.d.ts.map +1 -0
  114. package/dist/ui/app-items.test.js +38 -0
  115. package/dist/ui/app-items.test.js.map +1 -0
  116. package/dist/ui/app-state-persistence.test.js +14 -318
  117. package/dist/ui/app-state-persistence.test.js.map +1 -1
  118. package/dist/ui/chat-layout-pinning.test.js +74 -4
  119. package/dist/ui/chat-layout-pinning.test.js.map +1 -1
  120. package/dist/ui/components/AssistantMessage.test.js +6 -9
  121. package/dist/ui/components/AssistantMessage.test.js.map +1 -1
  122. package/dist/ui/components/Banner.js +1 -1
  123. package/dist/ui/components/Banner.js.map +1 -1
  124. package/dist/ui/components/ChatFooterPane.d.ts +1 -5
  125. package/dist/ui/components/ChatFooterPane.d.ts.map +1 -1
  126. package/dist/ui/components/ChatFooterPane.js +3 -4
  127. package/dist/ui/components/ChatFooterPane.js.map +1 -1
  128. package/dist/ui/components/ChatInputStack.d.ts +3 -1
  129. package/dist/ui/components/ChatInputStack.d.ts.map +1 -1
  130. package/dist/ui/components/ChatInputStack.js +4 -3
  131. package/dist/ui/components/ChatInputStack.js.map +1 -1
  132. package/dist/ui/components/ChatScreen.d.ts +3 -16
  133. package/dist/ui/components/ChatScreen.d.ts.map +1 -1
  134. package/dist/ui/components/ChatScreen.js +2 -3
  135. package/dist/ui/components/ChatScreen.js.map +1 -1
  136. package/dist/ui/components/Footer.d.ts +3 -8
  137. package/dist/ui/components/Footer.d.ts.map +1 -1
  138. package/dist/ui/components/Footer.js +5 -25
  139. package/dist/ui/components/Footer.js.map +1 -1
  140. package/dist/ui/components/IdealHookMessage.d.ts +12 -0
  141. package/dist/ui/components/IdealHookMessage.d.ts.map +1 -0
  142. package/dist/ui/components/IdealHookMessage.js +24 -0
  143. package/dist/ui/components/IdealHookMessage.js.map +1 -0
  144. package/dist/ui/components/InputArea.d.ts +1 -9
  145. package/dist/ui/components/InputArea.d.ts.map +1 -1
  146. package/dist/ui/components/InputArea.js +2 -44
  147. package/dist/ui/components/InputArea.js.map +1 -1
  148. package/dist/ui/components/LiveToolPanel.d.ts +30 -0
  149. package/dist/ui/components/LiveToolPanel.d.ts.map +1 -0
  150. package/dist/ui/components/LiveToolPanel.js +66 -0
  151. package/dist/ui/components/LiveToolPanel.js.map +1 -0
  152. package/dist/ui/components/ToolExecution.js +0 -2
  153. package/dist/ui/components/ToolExecution.js.map +1 -1
  154. package/dist/ui/components/TranscriptViewport.d.ts +1 -1
  155. package/dist/ui/components/TranscriptViewport.js +1 -1
  156. package/dist/ui/footer-jump-regression.test.js +12 -2
  157. package/dist/ui/footer-jump-regression.test.js.map +1 -1
  158. package/dist/ui/footer-status-layout.test.js +4 -12
  159. package/dist/ui/footer-status-layout.test.js.map +1 -1
  160. package/dist/ui/hooks/useAgentLoop.d.ts +2 -0
  161. package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -1
  162. package/dist/ui/hooks/useAgentLoop.js +45 -1
  163. package/dist/ui/hooks/useAgentLoop.js.map +1 -1
  164. package/dist/ui/hooks/useChatLayoutMeasurements.d.ts +3 -4
  165. package/dist/ui/hooks/useChatLayoutMeasurements.d.ts.map +1 -1
  166. package/dist/ui/hooks/useChatLayoutMeasurements.js +26 -4
  167. package/dist/ui/hooks/useChatLayoutMeasurements.js.map +1 -1
  168. package/dist/ui/hooks/useModeState.d.ts +4 -19
  169. package/dist/ui/hooks/useModeState.d.ts.map +1 -1
  170. package/dist/ui/hooks/useModeState.js +5 -45
  171. package/dist/ui/hooks/useModeState.js.map +1 -1
  172. package/dist/ui/hooks/usePixelFixFlow.js +2 -2
  173. package/dist/ui/layout-decisions.d.ts +11 -34
  174. package/dist/ui/layout-decisions.d.ts.map +1 -1
  175. package/dist/ui/layout-decisions.js +15 -42
  176. package/dist/ui/layout-decisions.js.map +1 -1
  177. package/dist/ui/live-area-height.d.ts.map +1 -1
  178. package/dist/ui/live-area-height.js +6 -1
  179. package/dist/ui/live-area-height.js.map +1 -1
  180. package/dist/ui/live-frame-height.test.js +26 -1
  181. package/dist/ui/live-frame-height.test.js.map +1 -1
  182. package/dist/ui/plan-overlay.test.js +1 -1
  183. package/dist/ui/plan-overlay.test.js.map +1 -1
  184. package/dist/ui/prompt-routing.d.ts +1 -19
  185. package/dist/ui/prompt-routing.d.ts.map +1 -1
  186. package/dist/ui/prompt-routing.js +1 -79
  187. package/dist/ui/prompt-routing.js.map +1 -1
  188. package/dist/ui/render.d.ts +6 -18
  189. package/dist/ui/render.d.ts.map +1 -1
  190. package/dist/ui/render.js +2 -10
  191. package/dist/ui/render.js.map +1 -1
  192. package/dist/ui/scroll-stabilization.test.js +1 -7
  193. package/dist/ui/scroll-stabilization.test.js.map +1 -1
  194. package/dist/ui/slash-command-images.test.js +11 -86
  195. package/dist/ui/slash-command-images.test.js.map +1 -1
  196. package/dist/ui/streaming-flush-bounce.test.d.ts +2 -0
  197. package/dist/ui/streaming-flush-bounce.test.d.ts.map +1 -0
  198. package/dist/ui/streaming-flush-bounce.test.js +156 -0
  199. package/dist/ui/streaming-flush-bounce.test.js.map +1 -0
  200. package/dist/ui/submit-prompt-command.d.ts +1 -16
  201. package/dist/ui/submit-prompt-command.d.ts.map +1 -1
  202. package/dist/ui/submit-prompt-command.js +4 -54
  203. package/dist/ui/submit-prompt-command.js.map +1 -1
  204. package/dist/ui/submit-slash-commands.d.ts +0 -1
  205. package/dist/ui/submit-slash-commands.d.ts.map +1 -1
  206. package/dist/ui/submit-slash-commands.js +0 -4
  207. package/dist/ui/submit-slash-commands.js.map +1 -1
  208. package/dist/ui/terminal-history-status-renderers.d.ts +0 -1
  209. package/dist/ui/terminal-history-status-renderers.d.ts.map +1 -1
  210. package/dist/ui/terminal-history-status-renderers.js +0 -3
  211. package/dist/ui/terminal-history-status-renderers.js.map +1 -1
  212. package/dist/ui/terminal-history.d.ts.map +1 -1
  213. package/dist/ui/terminal-history.js +19 -56
  214. package/dist/ui/terminal-history.js.map +1 -1
  215. package/dist/ui/terminal-history.test.js +6 -33
  216. package/dist/ui/terminal-history.test.js.map +1 -1
  217. package/dist/ui/tool-line-summary.d.ts +29 -0
  218. package/dist/ui/tool-line-summary.d.ts.map +1 -0
  219. package/dist/ui/tool-line-summary.js +153 -0
  220. package/dist/ui/tool-line-summary.js.map +1 -0
  221. package/dist/ui/transcript/TranscriptRenderer.d.ts +1 -1
  222. package/dist/ui/transcript/TranscriptRenderer.d.ts.map +1 -1
  223. package/dist/ui/transcript/TranscriptRenderer.js +21 -12
  224. package/dist/ui/transcript/TranscriptRenderer.js.map +1 -1
  225. package/dist/ui/transcript/presentation.d.ts +1 -17
  226. package/dist/ui/transcript/presentation.d.ts.map +1 -1
  227. package/dist/ui/transcript/presentation.js +0 -26
  228. package/dist/ui/transcript/presentation.js.map +1 -1
  229. package/dist/ui/transcript/spacing.d.ts +2 -2
  230. package/dist/ui/transcript/spacing.d.ts.map +1 -1
  231. package/dist/ui/transcript/spacing.js +15 -9
  232. package/dist/ui/transcript/spacing.js.map +1 -1
  233. package/dist/ui/transcript/spacing.test.js +7 -8
  234. package/dist/ui/transcript/spacing.test.js.map +1 -1
  235. package/dist/ui/transcript/tool-presentation.js +1 -1
  236. package/dist/ui/transcript/tool-presentation.js.map +1 -1
  237. package/dist/ui/transcript/transcript-lines.d.ts.map +1 -1
  238. package/dist/ui/transcript/transcript-lines.js +4 -0
  239. package/dist/ui/transcript/transcript-lines.js.map +1 -1
  240. package/dist/ui/tui-history-parity.test.js +8 -47
  241. package/dist/ui/tui-history-parity.test.js.map +1 -1
  242. package/dist/ui/tui-simulation.test.js +2 -1
  243. package/dist/ui/tui-simulation.test.js.map +1 -1
  244. package/dist/utils/format.js +7 -0
  245. package/dist/utils/format.js.map +1 -1
  246. package/package.json +11 -5
  247. package/dist/core/goal-controller.d.ts +0 -82
  248. package/dist/core/goal-controller.d.ts.map +0 -1
  249. package/dist/core/goal-controller.js +0 -838
  250. package/dist/core/goal-controller.js.map +0 -1
  251. package/dist/core/goal-controller.test.d.ts +0 -2
  252. package/dist/core/goal-controller.test.d.ts.map +0 -1
  253. package/dist/core/goal-controller.test.js +0 -1279
  254. package/dist/core/goal-controller.test.js.map +0 -1
  255. package/dist/core/goal-engine.d.ts +0 -61
  256. package/dist/core/goal-engine.d.ts.map +0 -1
  257. package/dist/core/goal-engine.js +0 -123
  258. package/dist/core/goal-engine.js.map +0 -1
  259. package/dist/core/goal-engine.test.d.ts +0 -2
  260. package/dist/core/goal-engine.test.d.ts.map +0 -1
  261. package/dist/core/goal-engine.test.js +0 -295
  262. package/dist/core/goal-engine.test.js.map +0 -1
  263. package/dist/core/goal-integration.d.ts +0 -80
  264. package/dist/core/goal-integration.d.ts.map +0 -1
  265. package/dist/core/goal-integration.js +0 -296
  266. package/dist/core/goal-integration.js.map +0 -1
  267. package/dist/core/goal-integration.test.d.ts +0 -2
  268. package/dist/core/goal-integration.test.d.ts.map +0 -1
  269. package/dist/core/goal-integration.test.js +0 -369
  270. package/dist/core/goal-integration.test.js.map +0 -1
  271. package/dist/core/goal-lifecycle-smoke.test.d.ts +0 -2
  272. package/dist/core/goal-lifecycle-smoke.test.d.ts.map +0 -1
  273. package/dist/core/goal-lifecycle-smoke.test.js +0 -248
  274. package/dist/core/goal-lifecycle-smoke.test.js.map +0 -1
  275. package/dist/core/goal-overhead-harness.d.ts +0 -33
  276. package/dist/core/goal-overhead-harness.d.ts.map +0 -1
  277. package/dist/core/goal-overhead-harness.js +0 -268
  278. package/dist/core/goal-overhead-harness.js.map +0 -1
  279. package/dist/core/goal-prerequisites.d.ts +0 -23
  280. package/dist/core/goal-prerequisites.d.ts.map +0 -1
  281. package/dist/core/goal-prerequisites.js +0 -114
  282. package/dist/core/goal-prerequisites.js.map +0 -1
  283. package/dist/core/goal-prerequisites.test.d.ts +0 -2
  284. package/dist/core/goal-prerequisites.test.d.ts.map +0 -1
  285. package/dist/core/goal-prerequisites.test.js +0 -154
  286. package/dist/core/goal-prerequisites.test.js.map +0 -1
  287. package/dist/core/goal-references.d.ts +0 -14
  288. package/dist/core/goal-references.d.ts.map +0 -1
  289. package/dist/core/goal-references.js +0 -153
  290. package/dist/core/goal-references.js.map +0 -1
  291. package/dist/core/goal-references.test.d.ts +0 -2
  292. package/dist/core/goal-references.test.d.ts.map +0 -1
  293. package/dist/core/goal-references.test.js +0 -77
  294. package/dist/core/goal-references.test.js.map +0 -1
  295. package/dist/core/goal-store.d.ts +0 -289
  296. package/dist/core/goal-store.d.ts.map +0 -1
  297. package/dist/core/goal-store.js +0 -1156
  298. package/dist/core/goal-store.js.map +0 -1
  299. package/dist/core/goal-store.test.d.ts +0 -2
  300. package/dist/core/goal-store.test.d.ts.map +0 -1
  301. package/dist/core/goal-store.test.js +0 -530
  302. package/dist/core/goal-store.test.js.map +0 -1
  303. package/dist/core/goal-verifier.d.ts +0 -17
  304. package/dist/core/goal-verifier.d.ts.map +0 -1
  305. package/dist/core/goal-verifier.js +0 -87
  306. package/dist/core/goal-verifier.js.map +0 -1
  307. package/dist/core/goal-verifier.test.d.ts +0 -2
  308. package/dist/core/goal-verifier.test.d.ts.map +0 -1
  309. package/dist/core/goal-verifier.test.js +0 -131
  310. package/dist/core/goal-verifier.test.js.map +0 -1
  311. package/dist/core/goal-worker-dev-server-lifecycle.test.d.ts +0 -2
  312. package/dist/core/goal-worker-dev-server-lifecycle.test.d.ts.map +0 -1
  313. package/dist/core/goal-worker-dev-server-lifecycle.test.js +0 -68
  314. package/dist/core/goal-worker-dev-server-lifecycle.test.js.map +0 -1
  315. package/dist/core/goal-worker.d.ts +0 -61
  316. package/dist/core/goal-worker.d.ts.map +0 -1
  317. package/dist/core/goal-worker.js +0 -467
  318. package/dist/core/goal-worker.js.map +0 -1
  319. package/dist/core/goal-worker.test.d.ts +0 -2
  320. package/dist/core/goal-worker.test.d.ts.map +0 -1
  321. package/dist/core/goal-worker.test.js +0 -493
  322. package/dist/core/goal-worker.test.js.map +0 -1
  323. package/dist/core/goal-worktree.d.ts +0 -108
  324. package/dist/core/goal-worktree.d.ts.map +0 -1
  325. package/dist/core/goal-worktree.js +0 -300
  326. package/dist/core/goal-worktree.js.map +0 -1
  327. package/dist/core/goal-worktree.test.d.ts +0 -2
  328. package/dist/core/goal-worktree.test.d.ts.map +0 -1
  329. package/dist/core/goal-worktree.test.js +0 -448
  330. package/dist/core/goal-worktree.test.js.map +0 -1
  331. package/dist/tools/goal-mode.test.d.ts +0 -2
  332. package/dist/tools/goal-mode.test.d.ts.map +0 -1
  333. package/dist/tools/goal-mode.test.js +0 -121
  334. package/dist/tools/goal-mode.test.js.map +0 -1
  335. package/dist/tools/goals.d.ts +0 -143
  336. package/dist/tools/goals.d.ts.map +0 -1
  337. package/dist/tools/goals.js +0 -1038
  338. package/dist/tools/goals.js.map +0 -1
  339. package/dist/tools/goals.test.d.ts +0 -2
  340. package/dist/tools/goals.test.d.ts.map +0 -1
  341. package/dist/tools/goals.test.js +0 -1444
  342. package/dist/tools/goals.test.js.map +0 -1
  343. package/dist/ui/components/GoalOverlay.d.ts +0 -83
  344. package/dist/ui/components/GoalOverlay.d.ts.map +0 -1
  345. package/dist/ui/components/GoalOverlay.js +0 -710
  346. package/dist/ui/components/GoalOverlay.js.map +0 -1
  347. package/dist/ui/components/GoalPickerMenu.d.ts +0 -9
  348. package/dist/ui/components/GoalPickerMenu.d.ts.map +0 -1
  349. package/dist/ui/components/GoalPickerMenu.js +0 -37
  350. package/dist/ui/components/GoalPickerMenu.js.map +0 -1
  351. package/dist/ui/components/GoalStatusBar.d.ts +0 -26
  352. package/dist/ui/components/GoalStatusBar.d.ts.map +0 -1
  353. package/dist/ui/components/GoalStatusBar.js +0 -130
  354. package/dist/ui/components/GoalStatusBar.js.map +0 -1
  355. package/dist/ui/components/GoalStatusBar.test.d.ts +0 -2
  356. package/dist/ui/components/GoalStatusBar.test.d.ts.map +0 -1
  357. package/dist/ui/components/GoalStatusBar.test.js +0 -17
  358. package/dist/ui/components/GoalStatusBar.test.js.map +0 -1
  359. package/dist/ui/goal-events.d.ts +0 -125
  360. package/dist/ui/goal-events.d.ts.map +0 -1
  361. package/dist/ui/goal-events.js +0 -407
  362. package/dist/ui/goal-events.js.map +0 -1
  363. package/dist/ui/goal-events.test.d.ts +0 -2
  364. package/dist/ui/goal-events.test.d.ts.map +0 -1
  365. package/dist/ui/goal-events.test.js +0 -416
  366. package/dist/ui/goal-events.test.js.map +0 -1
  367. package/dist/ui/goal-lifecycle-orchestration.test.d.ts +0 -2
  368. package/dist/ui/goal-lifecycle-orchestration.test.d.ts.map +0 -1
  369. package/dist/ui/goal-lifecycle-orchestration.test.js +0 -555
  370. package/dist/ui/goal-lifecycle-orchestration.test.js.map +0 -1
  371. package/dist/ui/goal-overlay.test.d.ts +0 -2
  372. package/dist/ui/goal-overlay.test.d.ts.map +0 -1
  373. package/dist/ui/goal-overlay.test.js +0 -384
  374. package/dist/ui/goal-overlay.test.js.map +0 -1
  375. package/dist/ui/goal-progress.d.ts +0 -31
  376. package/dist/ui/goal-progress.d.ts.map +0 -1
  377. package/dist/ui/goal-progress.js +0 -149
  378. package/dist/ui/goal-progress.js.map +0 -1
  379. package/dist/ui/goal-run-helpers.d.ts +0 -12
  380. package/dist/ui/goal-run-helpers.d.ts.map +0 -1
  381. package/dist/ui/goal-run-helpers.js +0 -42
  382. package/dist/ui/goal-run-helpers.js.map +0 -1
  383. package/dist/ui/goal-status-bar.test.d.ts +0 -2
  384. package/dist/ui/goal-status-bar.test.d.ts.map +0 -1
  385. package/dist/ui/goal-status-bar.test.js +0 -174
  386. package/dist/ui/goal-status-bar.test.js.map +0 -1
  387. package/dist/ui/goal-summary.d.ts +0 -14
  388. package/dist/ui/goal-summary.d.ts.map +0 -1
  389. package/dist/ui/goal-summary.js +0 -194
  390. package/dist/ui/goal-summary.js.map +0 -1
  391. package/dist/ui/hooks/useGoalOrchestration.d.ts +0 -82
  392. package/dist/ui/hooks/useGoalOrchestration.d.ts.map +0 -1
  393. package/dist/ui/hooks/useGoalOrchestration.js +0 -863
  394. package/dist/ui/hooks/useGoalOrchestration.js.map +0 -1
  395. package/dist/ui/hooks/useGoalPickerController.d.ts +0 -22
  396. package/dist/ui/hooks/useGoalPickerController.d.ts.map +0 -1
  397. package/dist/ui/hooks/useGoalPickerController.js +0 -35
  398. package/dist/ui/hooks/useGoalPickerController.js.map +0 -1
  399. package/dist/ui/prompt-routing.test.d.ts +0 -2
  400. package/dist/ui/prompt-routing.test.d.ts.map +0 -1
  401. package/dist/ui/prompt-routing.test.js +0 -48
  402. package/dist/ui/prompt-routing.test.js.map +0 -1
  403. package/dist/ui/transcript/GoalRows.d.ts +0 -10
  404. package/dist/ui/transcript/GoalRows.d.ts.map +0 -1
  405. package/dist/ui/transcript/GoalRows.js +0 -35
  406. package/dist/ui/transcript/GoalRows.js.map +0 -1
@@ -1,710 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useCallback, useEffect, useRef, useState } from "react";
3
- import { Box, Static, Text, useInput, useStdout } from "ink";
4
- import { basename } from "node:path";
5
- import { formatGoalPrerequisiteInstruction, goalHasBlockingPrerequisites, isBlockingGoalPrerequisite, loadGoalRuns, saveGoalRuns, summarizeGoalCountsFromRuns, } from "../../core/goal-store.js";
6
- import { useTerminalSize } from "../hooks/useTerminalSize.js";
7
- import { buildGoalFinalSummarySections } from "../goal-summary.js";
8
- import { Markdown } from "./Markdown.js";
9
- import { useTheme } from "../theme/theme.js";
10
- const GOAL_LOGO = [" ▄▀▀▀ ▄▀▀▀", " █ ▀█ █ ▀█", " ▀▄▄▀ ▀▄▄▀"];
11
- const GRADIENT = [
12
- "#4ade80",
13
- "#5ad89a",
14
- "#6fd2b4",
15
- "#85ccce",
16
- "#60a5fa",
17
- "#85ccce",
18
- "#6fd2b4",
19
- "#5ad89a",
20
- ];
21
- const GOAL_SUCCESS = "#4ade80";
22
- const GOAL_ACTIVE = "#fbbf24";
23
- const GAP = " ";
24
- const LOGO_WIDTH = 9;
25
- const SIDE_BY_SIDE_MIN = LOGO_WIDTH + GAP.length + 20;
26
- const PREFIX_WIDTH = 2;
27
- export function clampGoalSelectedIndex(index, length) {
28
- if (length <= 0)
29
- return 0;
30
- return Math.min(Math.max(0, index), length - 1);
31
- }
32
- export function formatGoalPrerequisiteSummary(run) {
33
- if (run.prerequisites.length === 0)
34
- return "no prereqs";
35
- const met = run.prerequisites.filter((item) => item.status === "met").length;
36
- const missing = run.prerequisites.filter((item) => item.status === "missing").length;
37
- const unknown = run.prerequisites.filter((item) => item.status === "unknown").length;
38
- const suffix = [missing > 0 ? `${missing} missing` : "", unknown > 0 ? `${unknown} unknown` : ""]
39
- .filter(Boolean)
40
- .join(", ");
41
- return `${met}/${run.prerequisites.length} prereqs met${suffix ? ` (${suffix})` : ""}`;
42
- }
43
- export function formatGoalTaskSummary(run) {
44
- if (run.tasks.length === 0)
45
- return "no tasks";
46
- const done = run.tasks.filter((item) => item.status === "done").length;
47
- const running = run.tasks.filter((item) => item.status === "running" || item.status === "verifying").length;
48
- const failed = run.tasks.filter((item) => item.status === "failed").length;
49
- const blocked = run.tasks.filter((item) => item.status === "blocked").length;
50
- const suffix = [
51
- running > 0 ? `${running} running` : "",
52
- failed > 0 ? `${failed} failed` : "",
53
- blocked > 0 ? `${blocked} blocked` : "",
54
- ]
55
- .filter(Boolean)
56
- .join(", ");
57
- return `${done}/${run.tasks.length} tasks done${suffix ? ` (${suffix})` : ""}`;
58
- }
59
- export function formatGoalVerifierSummary(run) {
60
- if (run.verifier?.lastResult)
61
- return `verifier ${run.verifier.lastResult.status}`;
62
- if (run.verifier?.command)
63
- return "verifier command ready";
64
- if (run.verifier?.description)
65
- return "verifier described";
66
- return "no verifier";
67
- }
68
- export function getGoalReadinessText(run) {
69
- if (goalHasBlockingPrerequisites(run))
70
- return "needs user input";
71
- if (run.status === "running" || run.status === "verifying")
72
- return "work in progress";
73
- if (run.status === "passed")
74
- return "verified";
75
- if (run.verifier?.command)
76
- return "ready to verify";
77
- if (run.tasks.length > 0)
78
- return "ready to run";
79
- return "drafting plan";
80
- }
81
- export function formatGoalProgressText(run) {
82
- const prereqTotal = run.prerequisites.length;
83
- const prereqMet = run.prerequisites.filter((item) => item.status === "met").length;
84
- const taskTotal = run.tasks.length;
85
- const taskDone = run.tasks.filter((item) => item.status === "done").length;
86
- const prereq = prereqTotal > 0 ? `prereqs ${prereqMet}/${prereqTotal}` : "no prereqs";
87
- const tasks = taskTotal > 0 ? `tasks ${taskDone}/${taskTotal}` : "no tasks";
88
- return `${prereq} · ${tasks}`;
89
- }
90
- export function getGoalStatusCountsText(runs) {
91
- const counts = summarizeGoalCountsFromRuns(runs);
92
- return `${counts.passed} passed · ${counts.running} running · ${counts.pending} pending · ${counts.blocked} blocked`;
93
- }
94
- export function clampGoalScrollOffset(offset, itemCount, viewportRows) {
95
- const visibleRows = Math.max(1, Math.floor(viewportRows));
96
- const maxOffset = Math.max(0, itemCount - visibleRows);
97
- if (!Number.isFinite(offset))
98
- return 0;
99
- return Math.min(Math.max(0, Math.floor(offset)), maxOffset);
100
- }
101
- export function getGoalOverlayViewportRows(terminalRows, reservedRows = 8) {
102
- if (!Number.isFinite(terminalRows))
103
- return 8;
104
- return Math.max(4, Math.floor(terminalRows) - reservedRows);
105
- }
106
- export function getGoalScrollOffsetForSelection({ selectedIndex, currentOffset, itemCount, viewportRows, }) {
107
- const selected = clampGoalSelectedIndex(selectedIndex, itemCount);
108
- const offset = clampGoalScrollOffset(currentOffset, itemCount, viewportRows);
109
- const rows = Math.max(1, Math.floor(viewportRows));
110
- if (selected < offset)
111
- return selected;
112
- if (selected >= offset + rows)
113
- return clampGoalScrollOffset(selected - rows + 1, itemCount, rows);
114
- return offset;
115
- }
116
- export function getGoalCardExtraRowCount(run) {
117
- let count = 0;
118
- if (goalHasBlockingPrerequisites(run))
119
- count += 1;
120
- else if (run.status === "running" || run.status === "verifying")
121
- count += 1;
122
- if (run.blockers.length > 0)
123
- count += 1;
124
- return count;
125
- }
126
- export function getGoalListCardRowCount({ run }) {
127
- const compactCardRows = 1 + // title/status row
128
- 2 + // compact summary rows
129
- getGoalCardExtraRowCount(run);
130
- const marginRows = 1;
131
- return compactCardRows + marginRows;
132
- }
133
- function compareGoalListWindows({ candidate, current, selectedIndex, }) {
134
- if (!current)
135
- return candidate;
136
- const candidateCount = candidate.end - candidate.start;
137
- const currentCount = current.end - current.start;
138
- if (candidateCount !== currentCount)
139
- return candidateCount > currentCount ? candidate : current;
140
- if (candidate.rowsUsed !== current.rowsUsed)
141
- return candidate.rowsUsed > current.rowsUsed ? candidate : current;
142
- const candidateBalance = Math.abs(selectedIndex - candidate.start - (candidate.end - selectedIndex - 1));
143
- const currentBalance = Math.abs(selectedIndex - current.start - (current.end - selectedIndex - 1));
144
- if (candidateBalance !== currentBalance)
145
- return candidateBalance < currentBalance ? candidate : current;
146
- return candidate.start > current.start ? candidate : current;
147
- }
148
- export function getGoalListWindow({ runs, selectedIndex, viewportRows, }) {
149
- const rows = Number.isFinite(viewportRows) ? Math.max(1, Math.floor(viewportRows)) : 8;
150
- const fixedRows = 1;
151
- if (runs.length === 0) {
152
- return { start: 0, end: 0, hiddenBefore: 0, hiddenAfter: 0, rowsUsed: fixedRows };
153
- }
154
- const selected = clampGoalSelectedIndex(selectedIndex, runs.length);
155
- let best = null;
156
- for (let start = 0; start <= selected; start++) {
157
- let cardRows = 0;
158
- for (let end = start + 1; end <= runs.length; end++) {
159
- const index = end - 1;
160
- const run = runs[index];
161
- if (!run)
162
- continue;
163
- cardRows += getGoalListCardRowCount({ run });
164
- if (end <= selected)
165
- continue;
166
- const hiddenBefore = start;
167
- const hiddenAfter = runs.length - end;
168
- const indicatorRows = (hiddenBefore > 0 ? 1 : 0) + (hiddenAfter > 0 ? 1 : 0);
169
- const rowsUsed = fixedRows + indicatorRows + cardRows;
170
- if (rowsUsed > rows)
171
- continue;
172
- best = compareGoalListWindows({
173
- candidate: { start, end, hiddenBefore, hiddenAfter, rowsUsed },
174
- current: best,
175
- selectedIndex: selected,
176
- });
177
- }
178
- }
179
- if (best)
180
- return best;
181
- const start = selected;
182
- const end = selected + 1;
183
- const hiddenBefore = start;
184
- const hiddenAfter = runs.length - end;
185
- const indicatorRows = (hiddenBefore > 0 ? 1 : 0) + (hiddenAfter > 0 ? 1 : 0);
186
- const run = runs[selected];
187
- const cardRows = run ? getGoalListCardRowCount({ run }) : 0;
188
- return {
189
- start,
190
- end,
191
- hiddenBefore,
192
- hiddenAfter,
193
- rowsUsed: fixedRows + indicatorRows + cardRows,
194
- };
195
- }
196
- export function sortGoalRunsForOverlay(runs) {
197
- return [...runs].sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
198
- }
199
- export function getGoalAutoExpandedState({ autoExpandNewest, loaded, runs, alreadyExpanded, }) {
200
- if (!autoExpandNewest || !loaded || runs.length === 0 || alreadyExpanded)
201
- return null;
202
- const newestRun = runs[0];
203
- if (!newestRun)
204
- return null;
205
- return { selectedIndex: 0, expandedRunId: newestRun.id };
206
- }
207
- export function shouldPersistGoalOverlayRuns(previousRuns, nextRuns) {
208
- if (nextRuns.length > 0)
209
- return true;
210
- if (previousRuns.length === 0)
211
- return true;
212
- return !previousRuns.some((run) => run.status === "running" ||
213
- run.status === "verifying" ||
214
- run.activeWorkerId !== undefined ||
215
- run.tasks.some((task) => task.status === "running" || task.status === "verifying"));
216
- }
217
- function GoalGradientText({ text }) {
218
- const chars = [];
219
- let colorIdx = 0;
220
- for (let i = 0; i < text.length; i++) {
221
- const ch = text[i];
222
- if (ch === " ") {
223
- chars.push(ch);
224
- }
225
- else {
226
- const color = GRADIENT[colorIdx % GRADIENT.length];
227
- chars.push(_jsx(Text, { color: color, children: ch }, i));
228
- colorIdx++;
229
- }
230
- }
231
- return _jsx(Text, { children: chars });
232
- }
233
- function formatDisplayPath(cwd) {
234
- const home = process.env.HOME ?? "";
235
- return home && cwd.startsWith(home) ? `~${cwd.slice(home.length)}` : cwd;
236
- }
237
- function statusColor(status) {
238
- switch (status) {
239
- case "passed":
240
- return GOAL_SUCCESS;
241
- case "running":
242
- case "verifying":
243
- case "blocked":
244
- return GOAL_ACTIVE;
245
- case "failed":
246
- return "red";
247
- case "paused":
248
- case "draft":
249
- case "ready":
250
- return "";
251
- }
252
- }
253
- export function getGoalCardStatusColor({ status, selected, primaryColor, textColor, }) {
254
- return statusColor(status) || (selected ? primaryColor : textColor);
255
- }
256
- export function getGoalCardTitleColor({ selected, primaryColor, textColor, }) {
257
- return selected ? primaryColor : textColor;
258
- }
259
- function verifierSummaryColor(run, fallbackColor) {
260
- if (run.verifier?.lastResult)
261
- return verifierStatusColor(run.verifier.lastResult.status);
262
- if (run.verifier?.command)
263
- return "cyan";
264
- if (run.verifier?.description)
265
- return "magenta";
266
- return fallbackColor;
267
- }
268
- function verifierStatusColor(status) {
269
- switch (status) {
270
- case "pass":
271
- return "green";
272
- case "fail":
273
- return "red";
274
- case "unknown":
275
- return "yellow";
276
- }
277
- }
278
- function normalizeGoalPlanText(text) {
279
- return text.replace(/\s+/g, " ").trim();
280
- }
281
- function markdownListItem(text) {
282
- const normalized = normalizeGoalPlanText(text);
283
- return `- ${normalized || "not recorded"}`;
284
- }
285
- function markdownCode(value) {
286
- return `\`${value.replace(/`/g, "\\`")}\``;
287
- }
288
- function appendGoalMetadataLine(lines, label, value) {
289
- if (!value)
290
- return;
291
- lines.push(` - ${label}: ${value}`);
292
- }
293
- export function formatGoalPlanMarkdown(run) {
294
- const lines = [
295
- `# ${run.title}`,
296
- "",
297
- `**Status:** ${run.status}`,
298
- `**Readiness:** ${getGoalReadinessText(run)}`,
299
- `**Progress:** ${formatGoalProgressText(run)}`,
300
- `**Verifier:** ${formatGoalVerifierSummary(run)}`,
301
- `**Goal ID:** ${run.id}`,
302
- `**Project:** ${run.projectPath}`,
303
- `**Updated:** ${run.updatedAt}`,
304
- "",
305
- "## Goal",
306
- "",
307
- run.goal || run.title,
308
- "",
309
- "## Success criteria",
310
- "",
311
- ];
312
- if (run.successCriteria.length === 0) {
313
- lines.push("- none recorded");
314
- }
315
- else {
316
- lines.push(...run.successCriteria.map(markdownListItem));
317
- }
318
- const finalSummarySections = buildGoalFinalSummarySections(run);
319
- if (finalSummarySections.length > 0) {
320
- lines.push("", "## Final summary", "");
321
- for (const section of finalSummarySections) {
322
- lines.push(`### ${section.title}`, "", ...section.lines.map(markdownListItem), "");
323
- }
324
- }
325
- lines.push("", "## User prerequisites", "");
326
- if (run.prerequisites.length === 0) {
327
- lines.push("- none recorded");
328
- }
329
- else {
330
- for (const prerequisite of run.prerequisites) {
331
- lines.push(`- **${prerequisite.status}** ${prerequisite.label}`);
332
- appendGoalMetadataLine(lines, "ID", markdownCode(prerequisite.id));
333
- appendGoalMetadataLine(lines, "Check", prerequisite.checkCommand ? markdownCode(prerequisite.checkCommand) : undefined);
334
- appendGoalMetadataLine(lines, "Instructions", prerequisite.instructions);
335
- appendGoalMetadataLine(lines, "Evidence", prerequisite.evidence);
336
- if (isBlockingGoalPrerequisite(prerequisite)) {
337
- appendGoalMetadataLine(lines, "User action required", formatGoalPrerequisiteInstruction(prerequisite));
338
- }
339
- }
340
- }
341
- lines.push("", "## Worker tasks", "");
342
- if (run.tasks.length === 0) {
343
- lines.push(goalHasBlockingPrerequisites(run)
344
- ? "- Waiting for prerequisites before workers can start."
345
- : "- No worker tasks yet — run the goal to generate focused work.");
346
- }
347
- else {
348
- for (const task of run.tasks) {
349
- lines.push(`- **${task.status}** ${task.title}`);
350
- appendGoalMetadataLine(lines, "ID", markdownCode(task.id));
351
- appendGoalMetadataLine(lines, "Attempts", String(task.attempts));
352
- appendGoalMetadataLine(lines, "Worker", task.workerId ? markdownCode(task.workerId) : undefined);
353
- appendGoalMetadataLine(lines, "Prompt", task.prompt);
354
- if (task.verification) {
355
- appendGoalMetadataLine(lines, "Verification", task.verification.status);
356
- appendGoalMetadataLine(lines, "Verification summary", task.verification.summary);
357
- appendGoalMetadataLine(lines, "Verification command", task.verification.command ? markdownCode(task.verification.command) : undefined);
358
- appendGoalMetadataLine(lines, "Verification output", task.verification.outputPath);
359
- }
360
- appendGoalMetadataLine(lines, "Last summary", task.lastSummary);
361
- }
362
- }
363
- lines.push("", "## Harness", "");
364
- if (run.harness.length === 0) {
365
- lines.push("- none recorded");
366
- }
367
- else {
368
- for (const item of run.harness) {
369
- lines.push(`- ${item.label}`);
370
- appendGoalMetadataLine(lines, "ID", markdownCode(item.id));
371
- appendGoalMetadataLine(lines, "Command", item.command ? markdownCode(item.command) : undefined);
372
- appendGoalMetadataLine(lines, "Path", item.path ? markdownCode(item.path) : undefined);
373
- appendGoalMetadataLine(lines, "Description", item.description);
374
- }
375
- }
376
- lines.push("", "## Evidence plan", "");
377
- if (run.evidencePlan.length === 0) {
378
- lines.push("- none recorded");
379
- }
380
- else {
381
- for (const item of run.evidencePlan) {
382
- lines.push(`- **${item.status}** ${item.label} (${item.mechanism})`);
383
- appendGoalMetadataLine(lines, "ID", markdownCode(item.id));
384
- appendGoalMetadataLine(lines, "Description", item.description);
385
- appendGoalMetadataLine(lines, "Command", item.command ? markdownCode(item.command) : undefined);
386
- appendGoalMetadataLine(lines, "Path", item.path ? markdownCode(item.path) : undefined);
387
- appendGoalMetadataLine(lines, "Instructions", item.instructions);
388
- appendGoalMetadataLine(lines, "Evidence", item.evidence);
389
- }
390
- }
391
- lines.push("", "## Verifier", "");
392
- if (!run.verifier) {
393
- lines.push("- none recorded");
394
- }
395
- else {
396
- lines.push(markdownListItem(run.verifier.description));
397
- appendGoalMetadataLine(lines, "Command", run.verifier.command ? markdownCode(run.verifier.command) : undefined);
398
- if (run.verifier.lastResult) {
399
- appendGoalMetadataLine(lines, "Last result", run.verifier.lastResult.status);
400
- appendGoalMetadataLine(lines, "Summary", run.verifier.lastResult.summary);
401
- appendGoalMetadataLine(lines, "Exit code", run.verifier.lastResult.exitCode?.toString());
402
- appendGoalMetadataLine(lines, "Output", run.verifier.lastResult.outputPath);
403
- appendGoalMetadataLine(lines, "Checked at", run.verifier.lastResult.checkedAt);
404
- }
405
- }
406
- lines.push("", "## Final audit", "");
407
- if (!run.completionAudit) {
408
- lines.push("- none recorded");
409
- }
410
- else {
411
- lines.push(`- **${run.completionAudit.status}** ${run.completionAudit.summary}`);
412
- appendGoalMetadataLine(lines, "Checked at", run.completionAudit.checkedAt);
413
- appendGoalMetadataLine(lines, "Verifier checked at", run.completionAudit.verifierCheckedAt);
414
- appendGoalMetadataLine(lines, "Output", run.completionAudit.outputPath);
415
- }
416
- lines.push("", "## Evidence", "");
417
- if (run.evidence.length === 0) {
418
- lines.push("- none recorded");
419
- }
420
- else {
421
- for (const item of run.evidence) {
422
- lines.push(`- **${item.kind}** ${item.label}`);
423
- appendGoalMetadataLine(lines, "ID", markdownCode(item.id));
424
- appendGoalMetadataLine(lines, "Path", item.path ? markdownCode(item.path) : undefined);
425
- appendGoalMetadataLine(lines, "Content", item.content);
426
- appendGoalMetadataLine(lines, "Created", item.createdAt);
427
- }
428
- }
429
- lines.push("", "## Blockers", "");
430
- if (run.blockers.length === 0) {
431
- lines.push("- none recorded");
432
- }
433
- else {
434
- lines.push(...run.blockers.map(markdownListItem));
435
- }
436
- return lines
437
- .join("\n")
438
- .replace(/\n{3,}/g, "\n\n")
439
- .trim();
440
- }
441
- function GoalHeader({ cwd, runs, agentRunning, }) {
442
- const theme = useTheme();
443
- const { columns } = useTerminalSize();
444
- const displayPath = formatDisplayPath(cwd);
445
- const counts = summarizeGoalCountsFromRuns(runs);
446
- if (columns < SIDE_BY_SIDE_MIN) {
447
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, width: columns, children: [_jsx(GoalGradientText, { text: GOAL_LOGO[0] }), _jsx(GoalGradientText, { text: GOAL_LOGO[1] }), _jsx(GoalGradientText, { text: GOAL_LOGO[2] }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: GOAL_SUCCESS, bold: true, children: "Goal Pane" }), agentRunning && _jsx(Text, { color: GOAL_ACTIVE, children: " (agent running)" }), _jsxs(Text, { color: theme.textDim, children: [" \u00B7 ", basename(cwd)] })] }), _jsx(Text, { color: theme.textDim, wrap: "truncate", children: displayPath }), _jsxs(Text, { children: [_jsxs(Text, { color: GOAL_SUCCESS, children: [counts.passed, " passed"] }), _jsx(Text, { color: theme.textDim, children: " \u00B7 " }), _jsxs(Text, { color: GOAL_ACTIVE, children: [counts.running, " active"] }), _jsx(Text, { color: theme.textDim, children: " \u00B7 " }), _jsxs(Text, { color: theme.text, children: [counts.pending, " pending"] }), _jsx(Text, { color: theme.textDim, children: " \u00B7 " }), _jsxs(Text, { color: GOAL_ACTIVE, children: [counts.blocked, " blocked"] })] })] }));
448
- }
449
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, width: columns, children: [_jsxs(Box, { children: [_jsx(GoalGradientText, { text: GOAL_LOGO[0] }), _jsx(Text, { children: GAP }), _jsx(Text, { color: GOAL_SUCCESS, bold: true, children: "Goal Pane" }), agentRunning && _jsx(Text, { color: GOAL_ACTIVE, children: " (agent running)" })] }), _jsxs(Box, { children: [_jsx(GoalGradientText, { text: GOAL_LOGO[1] }), _jsx(Text, { children: GAP }), _jsx(Text, { color: theme.textDim, wrap: "truncate", children: displayPath })] }), _jsxs(Box, { children: [_jsx(GoalGradientText, { text: GOAL_LOGO[2] }), _jsx(Text, { children: GAP }), _jsxs(Text, { children: [_jsxs(Text, { color: GOAL_SUCCESS, children: [counts.passed, " passed"] }), _jsx(Text, { color: theme.textDim, children: " \u00B7 " }), _jsxs(Text, { color: GOAL_ACTIVE, children: [counts.running, " active"] }), _jsx(Text, { color: theme.textDim, children: " \u00B7 " }), _jsxs(Text, { color: theme.text, children: [counts.pending, " pending"] }), _jsx(Text, { color: theme.textDim, children: " \u00B7 " }), _jsxs(Text, { color: GOAL_ACTIVE, children: [counts.blocked, " blocked"] })] })] })] }));
450
- }
451
- function StatusChip({ label, color }) {
452
- return (_jsxs(Text, { color: color, bold: true, children: ["\u25D6 ", label, " \u25D7"] }));
453
- }
454
- export function createGoalReviewSnapshot({ run, markdownWidth, }) {
455
- const safeMarkdownWidth = Number.isFinite(markdownWidth)
456
- ? Math.max(40, Math.floor(markdownWidth))
457
- : 80;
458
- return {
459
- id: `${run.id}:${run.updatedAt}:${safeMarkdownWidth}`,
460
- run,
461
- content: formatGoalPlanMarkdown(run),
462
- markdownWidth: safeMarkdownWidth,
463
- };
464
- }
465
- export function getGoalExpandedDetailViewModel({ run, markdownWidth, }) {
466
- return createGoalReviewSnapshot({ run, markdownWidth });
467
- }
468
- function GoalReviewDocument({ snapshot }) {
469
- const theme = useTheme();
470
- return (_jsxs(Box, { flexDirection: "column", paddingRight: 1, children: [_jsx(GoalHeader, { cwd: snapshot.run.projectPath, runs: [snapshot.run], agentRunning: false }), _jsxs(Box, { marginBottom: 1, children: [_jsxs(Text, { color: GOAL_SUCCESS, bold: true, children: ["◆ ", snapshot.run.title] }), _jsxs(Text, { color: theme.textDim, children: [" \u00B7 ", snapshot.run.status] })] }), _jsxs(Box, { flexDirection: "row", marginTop: 1, paddingRight: 1, children: [_jsx(Box, { width: PREFIX_WIDTH, flexShrink: 0, children: _jsx(Text, { color: GOAL_SUCCESS, children: "◇ " }) }), _jsx(Box, { flexDirection: "column", flexGrow: 1, width: snapshot.markdownWidth, children: _jsx(Markdown, { width: snapshot.markdownWidth, children: snapshot.content }) })] }), _jsx(Box, { marginTop: 1, marginBottom: 1, children: _jsx(Text, { color: theme.textDim, children: "Mouse-wheel scroll this terminal output to review the full Goal plan." }) })] }));
471
- }
472
- export function GoalOverlay({ cwd, onClose, onRunGoal, onVerifyGoal, onPauseGoal, onDeleteGoal, onRefineGoal, agentRunning, autoExpandNewest, }) {
473
- const theme = useTheme();
474
- const [runs, setRuns] = useState([]);
475
- const [selectedIndex, setSelectedIndex] = useState(0);
476
- const [loaded, setLoaded] = useState(false);
477
- const [expandedRunId, setExpandedRunId] = useState(null);
478
- const [reviewSnapshot, setReviewSnapshot] = useState(null);
479
- const [mode, setMode] = useState("normal");
480
- const [refineFeedback, setRefineFeedback] = useState("");
481
- const [status, setStatus] = useState("");
482
- const autoExpandedRef = useRef(false);
483
- const statusTimer = useRef(null);
484
- const saveTimer = useRef(null);
485
- const lastPersistedRunsRef = useRef([]);
486
- const { stdout } = useStdout();
487
- const { rows, columns } = useTerminalSize();
488
- const markdownWidth = Math.max(40, columns - PREFIX_WIDTH);
489
- function expandGoal(run) {
490
- setExpandedRunId(run.id);
491
- setReviewSnapshot(createGoalReviewSnapshot({ run, markdownWidth }));
492
- }
493
- function collapseGoal() {
494
- stdout?.write("\x1b[2J\x1b[3J\x1b[H");
495
- setExpandedRunId(null);
496
- setReviewSnapshot(null);
497
- setMode("normal");
498
- setRefineFeedback("");
499
- autoExpandedRef.current = true;
500
- }
501
- const showStatus = useCallback((message) => {
502
- setStatus(message);
503
- if (statusTimer.current)
504
- clearTimeout(statusTimer.current);
505
- statusTimer.current = setTimeout(() => setStatus(""), 2500);
506
- }, []);
507
- useEffect(() => {
508
- let cancelled = false;
509
- const load = () => {
510
- void loadGoalRuns(cwd).then((nextRuns) => {
511
- if (cancelled)
512
- return;
513
- setRuns((previousRuns) => {
514
- const sorted = sortGoalRunsForOverlay(nextRuns);
515
- if (!shouldPersistGoalOverlayRuns(previousRuns, sorted)) {
516
- showStatus("Goal store reload looked empty while work is active; preserving local state.");
517
- return previousRuns;
518
- }
519
- return JSON.stringify(previousRuns) === JSON.stringify(sorted) ? previousRuns : sorted;
520
- });
521
- setLoaded(true);
522
- });
523
- };
524
- load();
525
- const interval = setInterval(load, 1000);
526
- return () => {
527
- cancelled = true;
528
- clearInterval(interval);
529
- if (statusTimer.current)
530
- clearTimeout(statusTimer.current);
531
- if (saveTimer.current)
532
- clearTimeout(saveTimer.current);
533
- };
534
- }, [cwd]);
535
- useEffect(() => {
536
- setSelectedIndex((index) => clampGoalSelectedIndex(index, runs.length));
537
- if (expandedRunId && !runs.some((run) => run.id === expandedRunId)) {
538
- setExpandedRunId(null);
539
- setReviewSnapshot(null);
540
- }
541
- }, [expandedRunId, runs]);
542
- useEffect(() => {
543
- const nextState = getGoalAutoExpandedState({
544
- autoExpandNewest,
545
- loaded,
546
- runs,
547
- alreadyExpanded: autoExpandedRef.current,
548
- });
549
- if (!nextState)
550
- return;
551
- const run = runs[nextState.selectedIndex];
552
- if (!run)
553
- return;
554
- autoExpandedRef.current = true;
555
- setSelectedIndex(nextState.selectedIndex);
556
- expandGoal(run);
557
- }, [autoExpandNewest, loaded, runs, markdownWidth]);
558
- useEffect(() => {
559
- if (!loaded)
560
- return;
561
- if (saveTimer.current)
562
- clearTimeout(saveTimer.current);
563
- saveTimer.current = setTimeout(() => {
564
- if (!shouldPersistGoalOverlayRuns(lastPersistedRunsRef.current, runs)) {
565
- showStatus("Refusing to save an empty Goal list while work is active.");
566
- return;
567
- }
568
- lastPersistedRunsRef.current = runs;
569
- void saveGoalRuns(cwd, runs);
570
- }, 100);
571
- }, [cwd, loaded, runs]);
572
- const viewportRows = getGoalOverlayViewportRows(rows);
573
- const selectedRun = runs[selectedIndex];
574
- const expandedRun = runs.find((run) => run.id === expandedRunId) ?? reviewSnapshot?.run ?? null;
575
- const listWindow = getGoalListWindow({
576
- runs,
577
- selectedIndex,
578
- viewportRows,
579
- });
580
- const scrollOffset = listWindow.start;
581
- const visibleRuns = runs.slice(listWindow.start, listWindow.end);
582
- const hiddenBefore = listWindow.hiddenBefore;
583
- const hiddenAfter = listWindow.hiddenAfter;
584
- useInput((input, key) => {
585
- if (mode === "refine") {
586
- if (key.return) {
587
- if (expandedRun) {
588
- onRefineGoal?.(expandedRun, refineFeedback || "Please refine this Goal setup.");
589
- }
590
- setMode("normal");
591
- setRefineFeedback("");
592
- return;
593
- }
594
- if (key.escape) {
595
- setMode("normal");
596
- setRefineFeedback("");
597
- return;
598
- }
599
- if (key.backspace || key.delete) {
600
- setRefineFeedback((previous) => previous.slice(0, -1));
601
- return;
602
- }
603
- if (input && !key.ctrl && !key.meta) {
604
- setRefineFeedback((previous) => previous + input);
605
- }
606
- return;
607
- }
608
- if (mode === "confirmDelete") {
609
- if (key.escape || input === "n") {
610
- setMode("normal");
611
- showStatus("Archive cancelled");
612
- return;
613
- }
614
- if (input === "y" && selectedRun) {
615
- onDeleteGoal?.(selectedRun);
616
- setRuns((previousRuns) => previousRuns.filter((run) => run.id !== selectedRun.id));
617
- setExpandedRunId(null);
618
- setReviewSnapshot(null);
619
- setMode("normal");
620
- showStatus("Goal archived");
621
- }
622
- return;
623
- }
624
- if (key.escape) {
625
- if (expandedRun) {
626
- collapseGoal();
627
- }
628
- else {
629
- onClose();
630
- }
631
- return;
632
- }
633
- if (expandedRun && (key.return || input === "a")) {
634
- onRunGoal(expandedRun);
635
- return;
636
- }
637
- if (expandedRun && input === "r") {
638
- setMode("refine");
639
- setRefineFeedback("");
640
- return;
641
- }
642
- if (expandedRun && input === "q") {
643
- collapseGoal();
644
- return;
645
- }
646
- if (expandedRun)
647
- return;
648
- if (key.upArrow || input === "k") {
649
- setSelectedIndex((index) => clampGoalSelectedIndex(index - 1, runs.length));
650
- return;
651
- }
652
- if (key.downArrow || input === "j") {
653
- setSelectedIndex((index) => clampGoalSelectedIndex(index + 1, runs.length));
654
- return;
655
- }
656
- if (key.return && selectedRun) {
657
- onRunGoal(selectedRun);
658
- return;
659
- }
660
- if (input === "d" && selectedRun) {
661
- expandGoal(selectedRun);
662
- return;
663
- }
664
- if (input === "a" && selectedRun) {
665
- onRunGoal(selectedRun);
666
- return;
667
- }
668
- if (input === "r" && selectedRun) {
669
- if (expandedRun) {
670
- setMode("refine");
671
- setRefineFeedback("");
672
- }
673
- else {
674
- expandGoal(selectedRun);
675
- }
676
- return;
677
- }
678
- if (input === "v" && selectedRun) {
679
- onVerifyGoal(selectedRun);
680
- return;
681
- }
682
- if (input === "p" && selectedRun) {
683
- onPauseGoal(selectedRun);
684
- return;
685
- }
686
- if (input === "x" && selectedRun) {
687
- setMode("confirmDelete");
688
- showStatus("Archive goal? y/n");
689
- }
690
- });
691
- if (expandedRun && reviewSnapshot) {
692
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: [reviewSnapshot], style: { width: "100%" }, children: (snapshot) => _jsx(GoalReviewDocument, { snapshot: snapshot }, snapshot.id) }, reviewSnapshot.id), _jsx(Box, { marginTop: 1, children: mode === "confirmDelete" ? (_jsx(Text, { color: theme.warning, children: "Confirm archive selected goal: y/n" })) : mode === "refine" ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: theme.primary, children: "Feedback (Enter to submit, Esc to cancel):" }), _jsxs(Text, { color: theme.text, children: ["> ", refineFeedback, "▍"] })] })) : (_jsxs(Text, { color: theme.textDim, children: [_jsx(Text, { color: theme.success, children: "Enter/a" }), " approve/run · ", _jsx(Text, { color: theme.error, children: "r" }), " refine · ", _jsx(Text, { color: theme.primary, children: "q" }), " back · ", _jsx(Text, { color: theme.primary, children: "ESC" }), " close"] })) }), status ? (_jsx(Box, { children: _jsx(Text, { color: theme.secondary, children: status }) })) : null] }));
693
- }
694
- return (_jsxs(Box, { flexDirection: "column", height: rows, overflow: "hidden", children: [_jsx(GoalHeader, { cwd: cwd, runs: runs, agentRunning: agentRunning }), agentRunning ? (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: theme.textDim, children: "Agent is running; Goal pane stays available without resetting chat." }) })) : null, !loaded ? (_jsx(Box, { borderStyle: "round", borderColor: theme.textDim, paddingX: 1, children: _jsx(Text, { color: theme.textDim, children: "Loading goals\u2026" }) })) : runs.length === 0 ? (_jsxs(Box, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: theme.primary, paddingX: 1, paddingY: 1, children: [_jsx(Text, { color: theme.primary, bold: true, children: "Start a durable Goal run" }), _jsx(Text, { color: theme.textDim, children: "No goals yet. Ask the agent to start a durable Goal." }), _jsx(Text, { color: theme.textDim, children: "Prerequisites, worker tasks, evidence, and verifier results will appear in this pane." })] })) : (_jsxs(Box, { flexDirection: "column", height: viewportRows, overflowY: "hidden", children: [_jsx(Text, { color: theme.textDim, bold: true, children: "Goals" }), hiddenBefore > 0 ? (_jsxs(Text, { color: theme.textDim, children: ["\u2191 ", hiddenBefore, " earlier goal", hiddenBefore === 1 ? "" : "s"] })) : null, visibleRuns.map((run, visibleIndex) => {
695
- const index = scrollOffset + visibleIndex;
696
- const selected = index === selectedIndex;
697
- const blocked = goalHasBlockingPrerequisites(run);
698
- return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { wrap: "truncate", children: [_jsx(Text, { color: selected ? theme.primary : theme.textDim, children: selected ? "❯ " : " " }), _jsx(StatusChip, { label: run.status, color: getGoalCardStatusColor({
699
- status: run.status,
700
- selected,
701
- primaryColor: theme.primary,
702
- textColor: theme.text,
703
- }) }), _jsxs(Text, { color: getGoalCardTitleColor({
704
- selected,
705
- primaryColor: theme.primary,
706
- textColor: theme.text,
707
- }), bold: selected, children: [" ", run.title] }), _jsxs(Text, { color: theme.textDim, children: [" \u00B7 ", run.id.slice(0, 8)] })] }), _jsxs(Text, { wrap: "truncate", children: [_jsx(Text, { color: theme.textDim, children: selected ? " " : " " }), _jsx(Text, { color: statusColor(run.status) || theme.secondary, children: getGoalReadinessText(run) }), _jsx(Text, { color: theme.textDim, children: " \u00B7 " }), _jsx(Text, { color: theme.text, children: formatGoalProgressText(run) }), _jsx(Text, { color: theme.textDim, children: " \u00B7 " }), _jsx(Text, { color: verifierSummaryColor(run, theme.textDim), children: formatGoalVerifierSummary(run) })] }), _jsxs(Text, { wrap: "truncate", children: [_jsx(Text, { color: theme.textDim, children: selected ? " " : " " }), _jsx(Text, { color: goalHasBlockingPrerequisites(run) ? theme.warning : GOAL_SUCCESS, children: formatGoalPrerequisiteSummary(run) }), _jsx(Text, { color: theme.textDim, children: " \u00B7 " }), _jsx(Text, { color: run.tasks.length > 0 ? GOAL_SUCCESS : theme.text, children: formatGoalTaskSummary(run) })] }), blocked ? (_jsxs(Text, { color: theme.warning, wrap: "truncate", children: [selected ? " " : " ", "\u26A0 prerequisite needed before workers continue"] })) : run.status === "running" || run.status === "verifying" ? (_jsxs(Text, { color: GOAL_ACTIVE, wrap: "truncate", children: [selected ? " " : " ", "\u25CF active \u2014 watching worker/verifier progress"] })) : null, run.blockers.length > 0 ? (_jsxs(Text, { color: theme.warning, wrap: "truncate", children: [selected ? " " : " ", "blocker: ", run.blockers[0]] })) : null] }, run.id));
708
- }), hiddenAfter > 0 ? (_jsxs(Text, { color: theme.textDim, children: ["\u2193 ", hiddenAfter, " later goal", hiddenAfter === 1 ? "" : "s"] })) : null] })), _jsx(Box, { marginTop: 1, children: mode === "confirmDelete" ? (_jsx(Text, { color: theme.warning, children: "Confirm archive selected goal: y/n" })) : mode === "refine" ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: theme.primary, children: "Feedback (Enter to submit, Esc to cancel):" }), _jsxs(Text, { color: theme.text, children: ["> ", refineFeedback, "▍"] })] })) : (_jsxs(Text, { color: theme.textDim, children: [_jsx(Text, { color: theme.primary, children: "\u2191\u2193/jk" }), " select · ", _jsx(Text, { color: theme.primary, children: "Enter/a" }), " run · ", _jsx(Text, { color: theme.primary, children: "d" }), " detail · ", _jsx(Text, { color: theme.primary, children: "v" }), " verify · ", _jsx(Text, { color: theme.primary, children: "p" }), " pause · ", _jsx(Text, { color: theme.primary, children: "x" }), " archive · ", _jsx(Text, { color: theme.primary, children: "Esc" }), " close"] })) }), status ? (_jsx(Box, { children: _jsx(Text, { color: theme.secondary, children: status }) })) : null] }));
709
- }
710
- //# sourceMappingURL=GoalOverlay.js.map