kaizen-agent 1.86.0 → 1.87.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 (541) hide show
  1. package/README.md +1 -1
  2. package/cli/annotate-proxy.ts +6 -3
  3. package/cli/build-web.ts +46 -16
  4. package/cli/dev.ts +67 -0
  5. package/cli/docs.ts +1 -1
  6. package/cli/notes.ts +9 -3
  7. package/cli/ports.ts +121 -0
  8. package/cli/settings.ts +16 -17
  9. package/cli/state.ts +15 -29
  10. package/cli/task-service.ts +44 -14
  11. package/cli/tasks.ts +1 -1
  12. package/cli/term-image.ts +18 -0
  13. package/cli/ui-audit.allow.json +0 -1
  14. package/cli/ui-audit.ts +12 -12
  15. package/cli/web.ts +182 -58
  16. package/package.json +21 -4
  17. package/skills/kaizen/spec.md +10 -3
  18. package/tsconfig.json +16 -0
  19. package/web/README.md +105 -0
  20. package/web/{annotate.js → annotate/annotate.ts} +51 -50
  21. package/web/boot/boot.ts +7 -0
  22. package/web/components/annotate/annotate-bar.tsx +78 -0
  23. package/web/components/annotate/annotate-panel.tsx +20 -0
  24. package/web/components/annotate/annotate-settings.tsx +60 -0
  25. package/web/components/annotate/index.ts +1 -0
  26. package/web/components/annotate/notes-list.tsx +75 -0
  27. package/web/components/board/board-card.tsx +177 -0
  28. package/web/components/board/board-column.tsx +212 -0
  29. package/web/components/board/board-mode-switch.tsx +21 -0
  30. package/web/components/board/board-popups.tsx +45 -0
  31. package/web/components/board/card-footer.tsx +58 -0
  32. package/web/components/board/card-form.tsx +168 -0
  33. package/web/components/board/card-kids.tsx +53 -0
  34. package/web/components/board/clear-menu.tsx +36 -0
  35. package/web/components/board/filter-box.tsx +42 -0
  36. package/web/components/board/index.ts +6 -0
  37. package/web/components/board/run-form.tsx +129 -0
  38. package/web/components/board/severity-menu.tsx +44 -0
  39. package/web/components/board/status-strip.tsx +75 -0
  40. package/web/components/board/task-form.tsx +140 -0
  41. package/web/components/board/ws-card.tsx +38 -0
  42. package/web/components/context/context-panel.tsx +244 -0
  43. package/web/components/context/index.ts +1 -0
  44. package/web/components/decision/decision-bar.tsx +422 -0
  45. package/web/components/decision/index.ts +1 -0
  46. package/web/components/decision/inline-form.tsx +47 -0
  47. package/web/components/decision/plan-answers-form.tsx +78 -0
  48. package/web/components/decision/revise-form.tsx +65 -0
  49. package/web/components/decision/task-reply-form.tsx +48 -0
  50. package/web/components/footer/foot-bar.tsx +67 -0
  51. package/web/components/footer/index.ts +1 -0
  52. package/web/components/git/git-ask.tsx +88 -0
  53. package/web/components/git/git-commits.tsx +53 -0
  54. package/web/components/git/git-confirm.tsx +78 -0
  55. package/web/components/git/git-counts.tsx +10 -0
  56. package/web/components/git/git-files.tsx +113 -0
  57. package/web/components/git/git-head.tsx +70 -0
  58. package/web/components/git/git-icon.tsx +25 -0
  59. package/web/components/git/git-message.tsx +44 -0
  60. package/web/components/git/git-split.tsx +64 -0
  61. package/web/components/git/git-tab.tsx +55 -0
  62. package/web/components/git/index.ts +1 -0
  63. package/web/components/home/chat-list.tsx +57 -0
  64. package/web/components/home/home-composer.tsx +169 -0
  65. package/web/components/home/home-message.tsx +120 -0
  66. package/web/components/home/home-window.tsx +253 -0
  67. package/web/components/home/home-ws-add.tsx +47 -0
  68. package/web/components/home/index.ts +6 -0
  69. package/web/components/home/onboarding-dialog.tsx +371 -0
  70. package/web/components/icebox/board-chip.tsx +27 -0
  71. package/web/components/icebox/board-menu.tsx +41 -0
  72. package/web/components/icebox/bulk-bar.tsx +41 -0
  73. package/web/components/icebox/capture-box.tsx +155 -0
  74. package/web/components/icebox/choice-menu.tsx +39 -0
  75. package/web/components/icebox/collection-dialog.tsx +60 -0
  76. package/web/components/icebox/favicon.tsx +39 -0
  77. package/web/components/icebox/index.ts +10 -0
  78. package/web/components/icebox/kind-label.tsx +22 -0
  79. package/web/components/icebox/kind-menu.tsx +20 -0
  80. package/web/components/icebox/promote-form.tsx +93 -0
  81. package/web/components/icebox/reply-box.tsx +88 -0
  82. package/web/components/icebox/request-actions.tsx +141 -0
  83. package/web/components/icebox/request-badges.tsx +13 -0
  84. package/web/components/icebox/request-card.tsx +99 -0
  85. package/web/components/icebox/request-detail.tsx +43 -0
  86. package/web/components/icebox/request-images.tsx +33 -0
  87. package/web/components/icebox/request-phone-row.tsx +181 -0
  88. package/web/components/icebox/request-row.tsx +120 -0
  89. package/web/components/icebox/service-chip.tsx +58 -0
  90. package/web/components/icebox/snooze-menu.tsx +83 -0
  91. package/web/components/icebox/source-card.tsx +225 -0
  92. package/web/components/icebox/source-drawer.tsx +112 -0
  93. package/web/components/icebox/source-form.tsx +147 -0
  94. package/web/components/icebox/swipe-deck.tsx +242 -0
  95. package/web/components/layout/index.ts +1 -0
  96. package/web/components/layout/page-frame.tsx +44 -0
  97. package/web/components/markdown/index.ts +1 -0
  98. package/web/components/markdown/markdown.tsx +156 -0
  99. package/web/components/notebook/editor-pane.tsx +23 -0
  100. package/web/components/notebook/index.ts +5 -0
  101. package/web/components/notebook/note-body.tsx +172 -0
  102. package/web/components/notebook/note-tree.tsx +99 -0
  103. package/web/components/notebook/notes-head.tsx +37 -0
  104. package/web/components/notebook/notes-side.tsx +46 -0
  105. package/web/components/notes/index.ts +1 -0
  106. package/web/components/notes/note-composer.tsx +90 -0
  107. package/web/components/notes/notes-chat.tsx +58 -0
  108. package/web/components/panes/browser-pane.tsx +281 -0
  109. package/web/components/panes/index.ts +3 -0
  110. package/web/components/panes/preview-pane.tsx +91 -0
  111. package/web/components/panes/terminal-pane.tsx +52 -0
  112. package/web/components/phone/haptic.tsx +29 -0
  113. package/web/components/phone/index.ts +6 -0
  114. package/web/components/phone/phone-card.tsx +118 -0
  115. package/web/components/phone/phone-home.tsx +304 -0
  116. package/web/components/phone/phone-sheets.tsx +103 -0
  117. package/web/components/phone/qr-code.tsx +6 -0
  118. package/web/components/phone/usage-chips.tsx +85 -0
  119. package/web/components/phone/whatsapp-card.tsx +85 -0
  120. package/web/components/project/add-project-dialog.tsx +435 -0
  121. package/web/components/project/index.ts +3 -0
  122. package/web/components/project/project-bar.tsx +101 -0
  123. package/web/components/project/ws-menu.tsx +21 -0
  124. package/web/components/rail/agent-chips.tsx +110 -0
  125. package/web/components/rail/index.ts +4 -0
  126. package/web/components/rail/rail-filter.tsx +118 -0
  127. package/web/components/rail/rail-list.tsx +259 -0
  128. package/web/components/rail/source-marks.tsx +21 -0
  129. package/web/components/resources/index.ts +1 -0
  130. package/web/components/resources/resources-popup.tsx +490 -0
  131. package/web/components/run/doc-body.tsx +123 -0
  132. package/web/components/run/file-viewer.tsx +53 -0
  133. package/web/components/run/fix-form.tsx +88 -0
  134. package/web/components/run/index.ts +16 -0
  135. package/web/components/run/inline-md.tsx +30 -0
  136. package/web/components/run/key-hint.tsx +29 -0
  137. package/web/components/run/pane-gutter.tsx +52 -0
  138. package/web/components/run/pane-header.tsx +35 -0
  139. package/web/components/run/pane.tsx +140 -0
  140. package/web/components/run/panel-grip.tsx +49 -0
  141. package/web/components/run/panel-head.tsx +56 -0
  142. package/web/components/run/panel-tabs.tsx +35 -0
  143. package/web/components/run/phase-steps.tsx +37 -0
  144. package/web/components/run/project-notes.tsx +49 -0
  145. package/web/components/run/run-add-menu.tsx +80 -0
  146. package/web/components/run/run-bar.tsx +40 -0
  147. package/web/components/run/run-empty.tsx +10 -0
  148. package/web/components/run/run-footer.tsx +53 -0
  149. package/web/components/run/run-history.tsx +24 -0
  150. package/web/components/run/run-panes.tsx +78 -0
  151. package/web/components/run/run-picker.tsx +51 -0
  152. package/web/components/run/run-progress.tsx +30 -0
  153. package/web/components/run/run-tabs.tsx +147 -0
  154. package/web/components/run/run-wait.tsx +18 -0
  155. package/web/components/search/index.ts +1 -0
  156. package/web/components/search/search-palette.tsx +159 -0
  157. package/web/components/settings/account-rows.tsx +128 -0
  158. package/web/components/settings/agent-rows.tsx +249 -0
  159. package/web/components/settings/automation-rows.tsx +211 -0
  160. package/web/components/settings/browser-row.tsx +111 -0
  161. package/web/components/settings/cleanup-row.tsx +32 -0
  162. package/web/components/settings/commit-input.tsx +39 -0
  163. package/web/components/settings/index.ts +4 -0
  164. package/web/components/settings/integration-row.tsx +158 -0
  165. package/web/components/settings/mic-row.tsx +48 -0
  166. package/web/components/settings/orchestration-flow.tsx +87 -0
  167. package/web/components/settings/setting-row.tsx +131 -0
  168. package/web/components/settings/settings-item.tsx +78 -0
  169. package/web/components/settings/settings-loading.tsx +41 -0
  170. package/web/components/settings/settings-nav.tsx +119 -0
  171. package/web/components/settings/settings-scope.tsx +66 -0
  172. package/web/components/settings/settings-section.tsx +33 -0
  173. package/web/components/settings/skill-card.tsx +131 -0
  174. package/web/components/settings/stepper.tsx +74 -0
  175. package/web/components/settings/update-bar.tsx +167 -0
  176. package/web/components/shared/action-menu.tsx +76 -0
  177. package/web/components/shared/ask-host.tsx +18 -0
  178. package/web/components/shared/attach-button.tsx +23 -0
  179. package/web/components/shared/chip.tsx +19 -0
  180. package/web/components/shared/client-mark.tsx +15 -0
  181. package/web/components/shared/confirm-dialog.tsx +35 -0
  182. package/web/components/shared/empty-state.tsx +29 -0
  183. package/web/components/shared/field.tsx +77 -0
  184. package/web/components/shared/filter-popover.tsx +29 -0
  185. package/web/components/shared/form-frame.tsx +19 -0
  186. package/web/components/shared/icon-button.tsx +50 -0
  187. package/web/components/shared/index.ts +18 -0
  188. package/web/components/shared/mic-button.tsx +75 -0
  189. package/web/components/shared/pager.tsx +49 -0
  190. package/web/components/shared/picker.tsx +108 -0
  191. package/web/components/shared/project-mark.tsx +38 -0
  192. package/web/components/shared/segmented.tsx +43 -0
  193. package/web/components/shared/state-dot.tsx +4 -0
  194. package/web/components/shared/status-mark.tsx +26 -0
  195. package/web/components/shell/index.ts +3 -0
  196. package/web/components/shell/rail.tsx +259 -0
  197. package/web/components/shell/sprite.tsx +124 -0
  198. package/web/components/shell/wordmark.tsx +13 -0
  199. package/web/components/task/artifact-view.tsx +148 -0
  200. package/web/components/task/chat-bubble.tsx +43 -0
  201. package/web/components/task/filter-menu.tsx +38 -0
  202. package/web/components/task/index.ts +7 -0
  203. package/web/components/task/result-checks.tsx +34 -0
  204. package/web/components/task/result-view.tsx +103 -0
  205. package/web/components/task/status-badge.tsx +24 -0
  206. package/web/components/task/task-row.tsx +34 -0
  207. package/web/components/task/typing-dots.tsx +16 -0
  208. package/web/components/terminal/index.ts +3 -0
  209. package/web/components/terminal/terminal-bar.tsx +91 -0
  210. package/web/components/terminal/terminal-grid.tsx +149 -0
  211. package/web/components/terminal/terminal-modes.tsx +23 -0
  212. package/web/components/terminal/terminal-tile.tsx +139 -0
  213. package/web/dist/annotate.js +24 -0
  214. package/web/dist/board.css +718 -0
  215. package/web/dist/board.js +115 -0
  216. package/web/dist/boot.js +2 -0
  217. package/web/dist/notebook.css +319 -0
  218. package/web/dist/notebook.js +89 -0
  219. package/web/dist/popup.css +41 -0
  220. package/web/dist/popup.js +13 -0
  221. package/web/{term.js → dist/term.js} +48 -48
  222. package/web/dist/ui.css +3 -0
  223. package/web/dist/video.js +108 -0
  224. package/web/html/board.html +17 -0
  225. package/web/html/notes.html +14 -0
  226. package/web/html/popup.html +13 -0
  227. package/web/{video.html → html/video.html} +14 -15
  228. package/web/lib/annotate/index.ts +2 -0
  229. package/web/lib/annotate/notes.ts +105 -0
  230. package/web/lib/annotate/page.ts +121 -0
  231. package/web/lib/annotate/rules.ts +37 -0
  232. package/web/lib/annotate/session.ts +336 -0
  233. package/web/lib/board/board-actions.ts +119 -0
  234. package/web/lib/board/board-open.ts +12 -0
  235. package/web/lib/board/board-store.ts +159 -0
  236. package/web/lib/board/filter-box.ts +7 -0
  237. package/web/lib/board/index.ts +10 -0
  238. package/web/lib/board/nav.ts +29 -0
  239. package/web/lib/board/on-state.ts +90 -0
  240. package/web/lib/board/popups.ts +22 -0
  241. package/web/lib/board/snapshot.ts +105 -0
  242. package/web/lib/board/strip.ts +43 -0
  243. package/web/{board → lib/board}/ws-board.ts +1 -1
  244. package/web/lib/context/context-rules.ts +27 -0
  245. package/web/lib/context/context-store.ts +95 -0
  246. package/web/lib/context/feed.ts +28 -0
  247. package/web/lib/context/index.ts +3 -0
  248. package/web/lib/core/api.ts +86 -0
  249. package/web/lib/core/ask.ts +24 -0
  250. package/web/lib/core/board.ts +290 -0
  251. package/web/lib/core/brief.ts +31 -0
  252. package/web/lib/core/format.ts +8 -0
  253. package/web/lib/core/host.ts +107 -0
  254. package/web/lib/core/index.ts +16 -0
  255. package/web/{board → lib/core}/labels.ts +6 -5
  256. package/web/lib/core/layers.ts +7 -0
  257. package/web/lib/core/leave.ts +7 -0
  258. package/web/lib/core/motion.ts +10 -0
  259. package/web/{board/toast.ts → lib/core/notices.ts} +2 -20
  260. package/web/lib/core/notifier.ts +15 -0
  261. package/web/lib/core/store.ts +39 -0
  262. package/web/lib/core/term-handle.ts +8 -0
  263. package/web/lib/core/toast.ts +29 -0
  264. package/web/lib/core/utils.ts +15 -0
  265. package/web/lib/decision/index.ts +1 -0
  266. package/web/lib/decision/plan-questions.ts +39 -0
  267. package/web/lib/dictation/chunks.ts +93 -0
  268. package/web/lib/dictation/dictation-store.ts +22 -0
  269. package/web/lib/dictation/engine.ts +265 -0
  270. package/web/lib/dictation/index.ts +5 -0
  271. package/web/lib/dictation/mic.ts +42 -0
  272. package/web/lib/dictation/terminal-dictation.ts +50 -0
  273. package/web/lib/footer/footer-rules.ts +13 -0
  274. package/web/lib/footer/footer-store.ts +42 -0
  275. package/web/lib/footer/index.ts +2 -0
  276. package/web/lib/git/git-actions.ts +110 -0
  277. package/web/lib/git/git-panel.ts +43 -0
  278. package/web/lib/git/git-store.ts +47 -0
  279. package/web/lib/git/git.ts +170 -0
  280. package/web/lib/git/index.ts +4 -0
  281. package/web/lib/home/home-engine.ts +16 -0
  282. package/web/lib/home/home-events.ts +9 -0
  283. package/web/lib/home/home-store.ts +247 -0
  284. package/web/lib/home/home-window.ts +193 -0
  285. package/web/lib/home/home.ts +85 -0
  286. package/web/lib/home/index.ts +7 -0
  287. package/web/lib/home/onboarding.ts +199 -0
  288. package/web/lib/home/use-float-drag.ts +62 -0
  289. package/web/lib/icebox/icebox-actions.ts +518 -0
  290. package/web/lib/icebox/icebox-store.ts +112 -0
  291. package/web/lib/icebox/icebox-view.ts +48 -0
  292. package/web/lib/icebox/icebox.ts +273 -0
  293. package/web/lib/icebox/index.ts +8 -0
  294. package/web/lib/icebox/use-card-drag.ts +82 -0
  295. package/web/lib/icebox/use-ice-keys.ts +75 -0
  296. package/web/lib/icebox/use-icebox.ts +41 -0
  297. package/web/lib/icebox/use-row-swipe.ts +107 -0
  298. package/web/lib/markdown/index.ts +1 -0
  299. package/web/lib/markdown/markdown.ts +136 -0
  300. package/web/lib/notebook/autosave.ts +131 -0
  301. package/web/lib/notebook/deal.ts +58 -0
  302. package/web/lib/notebook/engine-complete.ts +128 -0
  303. package/web/lib/notebook/engine-preview.ts +287 -0
  304. package/web/lib/notebook/engine-types.ts +26 -0
  305. package/web/lib/notebook/engine-widgets.ts +218 -0
  306. package/web/lib/notebook/engine.ts +74 -0
  307. package/web/lib/notebook/index.ts +9 -0
  308. package/web/lib/notebook/kit-loader.ts +16 -0
  309. package/web/lib/notebook/kit.ts +12 -0
  310. package/web/{notes-lib.ts → lib/notebook/text.ts} +11 -10
  311. package/web/lib/notebook/vault-actions.ts +239 -0
  312. package/web/lib/notebook/vault-rules.ts +74 -0
  313. package/web/lib/notebook/vault-session.ts +73 -0
  314. package/web/lib/notebook/vault-store.ts +63 -0
  315. package/web/lib/notes/index.ts +4 -0
  316. package/web/lib/notes/md-html.ts +115 -0
  317. package/web/lib/notes/notes-actions.ts +32 -0
  318. package/web/lib/notes/notes-store.ts +22 -0
  319. package/web/lib/notes/notes.ts +58 -0
  320. package/web/{board → lib/notes}/rich.ts +1 -2
  321. package/web/lib/phone/index.ts +7 -0
  322. package/web/lib/phone/phone-actions.ts +77 -0
  323. package/web/lib/phone/phone-home.ts +102 -0
  324. package/web/lib/phone/phone-setup.ts +59 -0
  325. package/web/lib/phone/phone-sheet.ts +25 -0
  326. package/web/lib/phone/phone-store.ts +32 -0
  327. package/web/lib/phone/sheet-swipe.ts +55 -0
  328. package/web/lib/phone/use-phone-setup.ts +89 -0
  329. package/web/lib/project/add-project.ts +37 -0
  330. package/web/lib/project/branch.ts +14 -0
  331. package/web/lib/project/index.ts +5 -0
  332. package/web/lib/project/project-bar.ts +76 -0
  333. package/web/lib/project/project-pick.ts +36 -0
  334. package/web/lib/project/ws-menu.ts +8 -0
  335. package/web/lib/rail/agents.ts +63 -0
  336. package/web/lib/rail/card-links.ts +20 -0
  337. package/web/lib/rail/index.ts +7 -0
  338. package/web/lib/rail/rail-actions.ts +74 -0
  339. package/web/lib/rail/rail-boot.ts +99 -0
  340. package/web/lib/rail/rail-store.ts +85 -0
  341. package/web/lib/rail/rules.ts +241 -0
  342. package/web/lib/rail/source-marks.ts +17 -0
  343. package/web/lib/rail/use-rank-drag.ts +108 -0
  344. package/web/lib/resources/index.ts +3 -0
  345. package/web/lib/resources/resources-actions.ts +59 -0
  346. package/web/lib/resources/resources-store.ts +48 -0
  347. package/web/lib/resources/rules.ts +56 -0
  348. package/web/lib/router/index.ts +3 -0
  349. package/web/lib/router/route-rules.ts +96 -0
  350. package/web/lib/router/route-store.ts +115 -0
  351. package/web/lib/router/use-route-classes.ts +15 -0
  352. package/web/lib/run/browser.ts +53 -0
  353. package/web/lib/run/card-terminal.ts +32 -0
  354. package/web/lib/run/doc.ts +42 -0
  355. package/web/lib/run/grip.ts +8 -0
  356. package/web/lib/run/index.ts +19 -0
  357. package/web/lib/run/kept.ts +58 -0
  358. package/web/lib/run/layout-store.ts +156 -0
  359. package/web/lib/run/layout.ts +195 -0
  360. package/web/lib/run/panel-actions.ts +104 -0
  361. package/web/lib/run/panel-derive.ts +148 -0
  362. package/web/lib/run/panel-store.ts +125 -0
  363. package/web/lib/run/preview.ts +105 -0
  364. package/web/lib/run/run-actions.ts +118 -0
  365. package/web/lib/run/run-view-store.ts +134 -0
  366. package/web/lib/run/term-loader.ts +19 -0
  367. package/web/lib/run/use-panel-run.ts +125 -0
  368. package/web/lib/run/use-run-lifecycle.ts +70 -0
  369. package/web/lib/run/viewer.ts +12 -0
  370. package/web/lib/run/workspace.ts +281 -0
  371. package/web/lib/run/ws-actions.ts +293 -0
  372. package/web/lib/run/ws-derive.ts +50 -0
  373. package/web/lib/run/ws-draw.ts +102 -0
  374. package/web/lib/run/ws-store.ts +21 -0
  375. package/web/lib/run/ws-tabs.ts +125 -0
  376. package/web/lib/search/index.ts +3 -0
  377. package/web/lib/search/search-match.ts +48 -0
  378. package/web/lib/search/search-rows.ts +228 -0
  379. package/web/lib/search/search.ts +30 -0
  380. package/web/lib/search/use-search-rows.ts +22 -0
  381. package/web/lib/server/attention.ts +29 -0
  382. package/web/lib/server/index.ts +6 -0
  383. package/web/lib/server/poll-rules.ts +57 -0
  384. package/web/lib/server/poller.ts +210 -0
  385. package/web/lib/server/server-store.ts +39 -0
  386. package/web/lib/server/types.ts +31 -0
  387. package/web/lib/server/use-server.ts +19 -0
  388. package/web/lib/settings/agent-favicons.ts +14 -0
  389. package/web/lib/settings/index.ts +7 -0
  390. package/web/lib/settings/panel-settings.ts +29 -0
  391. package/web/lib/settings/settings-actions.ts +357 -0
  392. package/web/lib/settings/settings-store.ts +114 -0
  393. package/web/lib/settings/settings.ts +413 -0
  394. package/web/lib/settings/skill-icons.ts +24 -0
  395. package/web/lib/settings/update.ts +70 -0
  396. package/web/lib/shared/data-urls.ts +32 -0
  397. package/web/lib/shared/index.ts +4 -0
  398. package/web/lib/shared/use-draft.ts +38 -0
  399. package/web/lib/shared/use-narrow.ts +11 -0
  400. package/web/lib/shared/use-pager.ts +24 -0
  401. package/web/lib/shell/appearance.ts +97 -0
  402. package/web/lib/shell/help-store.ts +4 -0
  403. package/web/lib/shell/index.ts +4 -0
  404. package/web/lib/shell/shell-store.ts +23 -0
  405. package/web/lib/shell/stored-look.ts +47 -0
  406. package/web/lib/task/index.ts +7 -0
  407. package/web/lib/task/task-results.ts +92 -0
  408. package/web/lib/task/tasks.ts +132 -0
  409. package/web/lib/task/use-live-frame.ts +85 -0
  410. package/web/lib/task/use-saved-text.ts +25 -0
  411. package/web/lib/task/use-task.ts +161 -0
  412. package/web/lib/task/use-tasks.ts +50 -0
  413. package/web/{board → lib/task}/zoom.ts +25 -12
  414. package/web/lib/terminal/hidden-badge.ts +15 -0
  415. package/web/lib/terminal/index.ts +8 -0
  416. package/web/lib/terminal/layout.ts +138 -0
  417. package/web/{term-font.ts → lib/terminal/term-font.ts} +3 -2
  418. package/web/lib/terminal/terminal-store.ts +65 -0
  419. package/web/lib/terminal/terms-feed.ts +37 -0
  420. package/web/lib/terminal/use-arranged.ts +15 -0
  421. package/web/lib/terminal/use-terminal-keys.ts +37 -0
  422. package/web/lib/url/index.ts +1 -0
  423. package/web/lib/url/safe-url.ts +9 -0
  424. package/web/notebook/notebook.ts +27 -0
  425. package/web/notebook/notes-lib.ts +3 -0
  426. package/web/pages/board/App.tsx +76 -0
  427. package/web/pages/board/header.tsx +83 -0
  428. package/web/pages/board/help.tsx +59 -0
  429. package/web/pages/board/host-bridge.ts +94 -0
  430. package/web/pages/board/host.tsx +19 -0
  431. package/web/pages/board/keys.ts +112 -0
  432. package/web/pages/board/live.ts +39 -0
  433. package/web/pages/board/main.ts +32 -0
  434. package/web/pages/board/pages.tsx +86 -0
  435. package/web/pages/board/panel.tsx +157 -0
  436. package/web/pages/board/portal.tsx +39 -0
  437. package/web/pages/board/use-boot.ts +13 -0
  438. package/web/pages/board/views.ts +63 -0
  439. package/web/pages/board-page.tsx +62 -0
  440. package/web/pages/home-page.tsx +127 -0
  441. package/web/pages/icebox-page.tsx +440 -0
  442. package/web/pages/notebook/App.tsx +35 -0
  443. package/web/pages/notebook-page.tsx +50 -0
  444. package/web/pages/popup/App.tsx +207 -0
  445. package/web/pages/settings-page.tsx +111 -0
  446. package/web/pages/task-page.tsx +383 -0
  447. package/web/pages/tasks-page.tsx +151 -0
  448. package/web/pages/terminal-page.tsx +15 -0
  449. package/web/popup/popup.ts +7 -0
  450. package/web/{term.ts → term/term.ts} +48 -20
  451. package/web/ui/alert-dialog.tsx +39 -0
  452. package/web/ui/badge.tsx +20 -0
  453. package/web/ui/button.tsx +37 -0
  454. package/web/ui/checkbox.tsx +20 -0
  455. package/web/ui/command.tsx +41 -0
  456. package/web/ui/dialog.tsx +28 -0
  457. package/web/ui/dropdown-menu.tsx +54 -0
  458. package/web/ui/icon.tsx +17 -0
  459. package/web/ui/index.ts +21 -0
  460. package/web/ui/input.tsx +9 -0
  461. package/web/ui/label.tsx +7 -0
  462. package/web/ui/legacy/board.css +715 -0
  463. package/web/{notes.html → ui/legacy/notes.css} +23 -157
  464. package/web/ui/legacy/popup.css +40 -0
  465. package/web/ui/popover.tsx +28 -0
  466. package/web/ui/select.tsx +61 -0
  467. package/web/ui/sheet.tsx +43 -0
  468. package/web/ui/skeleton.tsx +6 -0
  469. package/web/ui/sonner.tsx +25 -0
  470. package/web/ui/spinner.tsx +12 -0
  471. package/web/ui/switch.tsx +18 -0
  472. package/web/ui/tabs.tsx +18 -0
  473. package/web/ui/textarea.tsx +14 -0
  474. package/web/ui/theme.css +125 -0
  475. package/web/ui/toggle.tsx +8 -0
  476. package/web/ui/tooltip.tsx +26 -0
  477. package/web/{video.ts → video/video.ts} +5 -5
  478. package/web/board/add-project.ts +0 -147
  479. package/web/board/agent-favicons.ts +0 -9
  480. package/web/board/agent-term.ts +0 -51
  481. package/web/board/annotate-lib.ts +0 -19
  482. package/web/board/annotate.ts +0 -221
  483. package/web/board/api.ts +0 -180
  484. package/web/board/approvals.ts +0 -109
  485. package/web/board/badge.ts +0 -115
  486. package/web/board/cards.ts +0 -1080
  487. package/web/board/chat.ts +0 -128
  488. package/web/board/context.ts +0 -248
  489. package/web/board/dictation.ts +0 -343
  490. package/web/board/dom.ts +0 -132
  491. package/web/board/drafts.ts +0 -21
  492. package/web/board/fixes.ts +0 -89
  493. package/web/board/git.ts +0 -416
  494. package/web/board/home-ws.ts +0 -266
  495. package/web/board/home.ts +0 -421
  496. package/web/board/icebox.ts +0 -1788
  497. package/web/board/keys.ts +0 -121
  498. package/web/board/live.ts +0 -87
  499. package/web/board/main.ts +0 -94
  500. package/web/board/markdown.ts +0 -210
  501. package/web/board/onboarding.ts +0 -227
  502. package/web/board/panel.ts +0 -437
  503. package/web/board/phone-setup.ts +0 -79
  504. package/web/board/phone.ts +0 -219
  505. package/web/board/projects.ts +0 -277
  506. package/web/board/resources.ts +0 -170
  507. package/web/board/run-pick.ts +0 -41
  508. package/web/board/run-view.ts +0 -1316
  509. package/web/board/search-match.ts +0 -20
  510. package/web/board/search.ts +0 -330
  511. package/web/board/settings-accounts.ts +0 -76
  512. package/web/board/settings-agents.ts +0 -102
  513. package/web/board/settings-automations.ts +0 -71
  514. package/web/board/settings-cleanup.ts +0 -42
  515. package/web/board/settings-orchestration.ts +0 -32
  516. package/web/board/settings-pages.ts +0 -62
  517. package/web/board/settings-skills.ts +0 -103
  518. package/web/board/settings-voice.ts +0 -28
  519. package/web/board/settings.ts +0 -490
  520. package/web/board/store.ts +0 -47
  521. package/web/board/task-page.ts +0 -628
  522. package/web/board/task-results.ts +0 -234
  523. package/web/board/tasks.ts +0 -242
  524. package/web/board/terms.ts +0 -390
  525. package/web/board/update.ts +0 -171
  526. package/web/board/viewer.ts +0 -47
  527. package/web/board/views.ts +0 -164
  528. package/web/board/whatsapp-setup.ts +0 -149
  529. package/web/board/workspace.ts +0 -650
  530. package/web/board/ws-board-ui.ts +0 -95
  531. package/web/board/ws-tabs.ts +0 -227
  532. package/web/board.html +0 -1563
  533. package/web/board.js +0 -505
  534. package/web/notebook.js +0 -519
  535. package/web/notebook.ts +0 -1254
  536. package/web/popup.html +0 -141
  537. package/web/video.js +0 -575
  538. /package/web/{term.css → dist/term.css} +0 -0
  539. /package/web/{board/term-sessions.ts → lib/terminal/sessions.ts} +0 -0
  540. /package/web/{board/terminal-viewport.ts → lib/terminal/viewport.ts} +0 -0
  541. /package/web/{term-paste.ts → term/term-paste.ts} +0 -0
package/cli/web.ts CHANGED
@@ -7,13 +7,13 @@ import { join, dirname, resolve, sep, basename } from "node:path";
7
7
  import {
8
8
  home, type Item, type Card, knownProjects, remember, reorderProjects, canonPath, locate, label, tilde, searchRoots, findProjects,
9
9
  readInbox, writeInbox, replaceTask, moveTask, abandonRun, runToTask, launchRun, parseItem, agentChoices, onPath, projectOf, KNOWN_AGENTS, plainModel, short, setArchived, writeNotes,
10
- appendNote, saveAttachment, pidOnPort, readText, cmdExe, sysExe, powershellExe, runGit, readCommit, commitPush, commitStaged, stageFiles, suggestMessage, notice, notifier, LOGO,
10
+ appendNote, saveAttachment, pidOnPort, readText, cmdExe, sysExe, powershellExe, runGit, readCommit, commitPush, commitStaged, stageFiles, suggestMessage, notice, LOGO,
11
11
  reviewFindings, pickFindings, backlogItem, startedBacklog, closeBacklog, markBacklogDone, fixPrompt, approvalPrompt, canApproveAwaiting, gateOf, recordAcceptance, healRuns, finishRun, nativePath, closeSessions, sweepSessions, issueUrl,
12
- launchMode, pruneRuns, pruneSessions, readSessions, ownerOf, runIndex, resumePrompt, runAgent, firstSession, webHosts,
12
+ pruneRuns, pruneSessions, readSessions, ownerOf, runIndex, resumePrompt, runAgent, firstSession, webHosts,
13
13
  } from "./state.ts";
14
14
  import { ACCOUNT_EXTRA, ACCOUNT_VAR, accountDir, agyLogin, addAccount, loginStatus, readAccounts, renameAccount, removeAccount, resolveAccount, setDefaultAccount, type Login, type Tool } from "./accounts.ts";
15
15
  import { readReport, signalOf } from "./report.ts";
16
- import { MAX_IMAGE, saveImage } from "./term-image.ts";
16
+ import { MAX_FILE, MAX_IMAGE, saveFile, saveImage } from "./term-image.ts";
17
17
  import { shellHistory } from "./term-history.ts";
18
18
  import { bundledSkills, repairSkill, setSkill, skillsHeld, skillsOff, skillStatus } from "./skills.ts";
19
19
  import * as rea from "./rea.ts";
@@ -22,6 +22,7 @@ import { agentLine, failStart, handoffModel, markRunning, readWorkers, requested
22
22
  import { childDied, childQuiet, markWoken, move, requestOpen, readHandoff, refused, started, wakeAction, wakeLine, type Handoff } from "./handoff.ts";
23
23
  import { processTable, storage, systemMemory, treeRss, type Root } from "./resources.ts";
24
24
  import { attachPty, frames, writePty, submitPty, resizePty, exitPty, killPty, panePid, ptyState, ptyKeys, adoptLoginEnv, startPty, ptySupported, detachPty, ptyTail, ptyTmux, tmuxAlive, RESUMED } from "./pty.ts";
25
+ import { conflictPort, holders, inProjects, isKaizenProcess, listeners, stopPort } from "./ports.ts";
25
26
  import { snapshot, snapWorker } from "./state-snap.ts";
26
27
  import { claudeUsage, claudeUsageAt, codexUsage, codexUsageAt, phonePeers, type Usage } from "./usage.ts";
27
28
  import { readSources, addSource, removeSource, moveSource, setCategory, setWriteback, setPaused, readIcebox, applySort, promote, dismiss, restore, capture, editItem, setKind, setTags, setBoard, saveBoard, removeBoard, snooze, unsnooze, readBoards, kindOf, isSnoozed, markDone, markReplied, gatherSource, freshImages, gatherAll, gatherDirs, due, socialUrl, socialOf } from "./sources.ts";
@@ -46,24 +47,31 @@ import * as taskService from "./task-service.ts";
46
47
  import { artifactResponse as taskArtifactResponse } from "./task-results.ts";
47
48
  import { gitUrl, destDir, winBad, cloneInto, branchesOf, ignoreKaizen } from "./add-project.ts";
48
49
 
49
- const PAGE = join(dirname(import.meta.dir), "web", "board.html");
50
- // The board's script: web/board/*.ts, bundled into one file by `bun run build:web`.
51
- const BOARD_JS = join(dirname(import.meta.dir), "web", "board.js");
50
+ const PAGE = join(dirname(import.meta.dir), "web", "html", "board.html");
51
+ // The board's script: web/pages/board/main.ts with web/lib and web/components, bundled into one file by `bun run build:web`.
52
+ const BOARD_JS = join(dirname(import.meta.dir), "web", "dist", "board.js");
52
53
  const SOUNDS_DIR = join(dirname(import.meta.dir), "web", "sounds");
53
- // The notebook: its page, and the CodeMirror bundle `bun run build:web` commits beside it.
54
- const NOTES_PAGE = join(dirname(import.meta.dir), "web", "notes.html");
54
+ // The notebook: its page, and the CodeMirror bundle `bun run build:web` commits to web/dist.
55
+ const NOTES_PAGE = join(dirname(import.meta.dir), "web", "html", "notes.html");
55
56
  const ICO = join(dirname(import.meta.dir), "assets", "kaizen.ico");
56
- const NOTES_JS = join(dirname(import.meta.dir), "web", "notebook.js");
57
+ const UI_CSS = join(dirname(import.meta.dir), "web", "dist", "ui.css");
58
+ const NOTES_JS = join(dirname(import.meta.dir), "web", "dist", "notebook.js");
57
59
  // The in-card terminal (agent.launch: card): xterm.js, bundled the same way.
58
- const TERM_JS = join(dirname(import.meta.dir), "web", "term.js");
59
- const ANNOTATE_JS = join(dirname(import.meta.dir), "web", "annotate.js");
60
- const TERM_CSS = join(dirname(import.meta.dir), "web", "term.css");
60
+ const TERM_JS = join(dirname(import.meta.dir), "web", "dist", "term.js");
61
+ const ANNOTATE_JS = join(dirname(import.meta.dir), "web", "dist", "annotate.js");
62
+ const TERM_CSS = join(dirname(import.meta.dir), "web", "dist", "term.css");
61
63
  // The Video page (kaizen-video's library, editor and renders) and its bundle.
62
- const VIDEO_PAGE = join(dirname(import.meta.dir), "web", "video.html");
63
- const POPUP_PAGE = join(dirname(import.meta.dir), "web", "popup.html");
64
+ const VIDEO_PAGE = join(dirname(import.meta.dir), "web", "html", "video.html");
65
+ const POPUP_PAGE = join(dirname(import.meta.dir), "web", "html", "popup.html");
66
+ // Each page's one stylesheet (the kit's Tailwind and the page's own styles) and the chat popup's script.
67
+ const dist = (f: string) => join(dirname(import.meta.dir), "web", "dist", f);
68
+ const STYLES: Record<string, string> = { "/board.css": dist("board.css"), "/notebook.css": dist("notebook.css"), "/popup.css": dist("popup.css") };
69
+ const POPUP_JS = dist("popup.js");
70
+ // The blocking head script of the board and the Notebook: the stored theme is on <html> before the first paint.
71
+ const BOOT_JS = dist("boot.js");
64
72
  // The chat the popup was on when its Back button was pressed, until Home takes it.
65
73
  let popupChat: string | null = null;
66
- const VIDEO_JS = join(dirname(import.meta.dir), "web", "video.js");
74
+ const VIDEO_JS = join(dirname(import.meta.dir), "web", "dist", "video.js");
67
75
  const DEFAULT_PORT = 7420;
68
76
  // Gathered posts a reply is going out to right now: one send per item at a time.
69
77
  const replying = new Set<string>();
@@ -87,8 +95,15 @@ delete process.env.KAIZEN_DESKTOP_BUNDLED;
87
95
  // page newer than its server sends ops the server does not know ("unknown op").
88
96
  // So the pages are kept as they were at start, and read live (dev edits) only while
89
97
  // the installed version is still the one this board runs.
90
- const AT_START = new Map([PAGE, BOARD_JS, NOTES_PAGE, NOTES_JS, TERM_JS, TERM_CSS, VIDEO_PAGE, VIDEO_JS, ANNOTATE_JS].map((f) => [f, existsSync(f) ? readText(f) : null]));
91
- const served = (f: string) => installed() === VERSION && existsSync(f) ? readText(f) : AT_START.get(f) ?? null;
98
+ const AT_START = new Map([PAGE, BOARD_JS, NOTES_PAGE, NOTES_JS, TERM_JS, TERM_CSS, VIDEO_PAGE, VIDEO_JS, ANNOTATE_JS, UI_CSS, POPUP_PAGE, POPUP_JS, BOOT_JS, ...Object.values(STYLES)].map((f) => [f, existsSync(f) ? readText(f) : null]));
99
+ // `bun run dev` (cli/dev.ts) sets KAIZEN_DEV: every page file is read from disk on each request, and pages get a small
100
+ // script that reloads them when the dev script has rebuilt the bundles (GET /__dev/stream, POST /__dev/reload).
101
+ const DEV = process.env.KAIZEN_DEV === "1";
102
+ const DEV_TAG = `<script>new EventSource("/__dev/stream").onmessage=(e)=>{if(e.data==="reload")location.reload()}</script>`;
103
+ const served = (f: string) => {
104
+ const body = DEV ? (existsSync(f) ? readText(f) : null) : installed() === VERSION && existsSync(f) ? readText(f) : AT_START.get(f) ?? null;
105
+ return DEV && body !== null && f.endsWith(".html") ? body.replace("</head>", DEV_TAG + "</head>") : body;
106
+ };
92
107
 
93
108
  // A board answers at url and runs the installed version. A board from before the
94
109
  // version header sends none, so it counts as stale too.
@@ -282,11 +297,34 @@ export async function web(repoDir: string, opts: Opts = {}) {
282
297
  : [cur]
283
298
  ).filter((d, i, arr) => arr.indexOf(d) === i && existsSync(d));
284
299
 
300
+ // A run's decision sent to its agent: the agent already open in this run's card takes it
301
+ // there, as it takes a fix: no second tab of the same conversation. With none, the run's
302
+ // conversation continues in one new window, and then the idle one ends. A failed launch
303
+ // leaves it open, since the decision went nowhere.
304
+ const sendDecision = (dir: string, id: string, awaiting: string, why?: string, answers?: string[]) => {
305
+ const text = approvalPrompt(id, awaiting, why, answers);
306
+ const live = liveAgent(dir, id);
307
+ const before = Date.now();
308
+ const r = live ? { ok: true as const, pty: live.key, agent: live.cmd, reused: true } : launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard);
309
+ if (live) submitPty(live.key, text);
310
+ else if (r.ok) closeSessions(dir, id, { before });
311
+ // The plan's approval starts the build; fixing open findings is the review stage again.
312
+ if (r.ok) markStage(dir, id, awaiting === "approvals.plan" ? "impl" : awaiting === "findings" ? "review" : "", r.pty);
313
+ // Approving the review as-is is the user's acceptance, on record before the
314
+ // agent marks the run done; a revise is not.
315
+ if (r.ok && why === undefined && (awaiting === "approvals.review" || awaiting === "findings")) recordAcceptance(dir, id, "board");
316
+ return { r, live };
317
+ };
318
+ // A task whose run was just approved picks the approval up as its Looks good.
319
+ const syncTask = (dir: string, taskId: string) => {
320
+ try { const found = tasks.resolveTask(dir, taskId); if (found) taskService.reconcile(found.state, found.task, taskHooks); } catch { /* the next read reconciles */ }
321
+ };
285
322
  const taskHooks = {
323
+ approve: (dir: string, id: string, awaiting: string) => { const { r } = sendDecision(dir, id, awaiting); return r.ok ? null : (r.why || "The run's agent could not be reached"); },
286
324
  launch: (dir: string, id: string, text: string, task: tasks.Task, pick?: any) => {
287
325
  const live = liveAgent(dir, id);
288
326
  if (live) { submitPty(live.key, text); return { ok: true, pty: live.key }; }
289
- return launchRun({ severity: null, where: null, text, raw: text }, dir, id, { ...inCard(dir), ...(pick ? { agent: KNOWN_AGENTS.some((a) => a.cmd === pick.agent) ? pick.agent : undefined, account: typeof pick.account === "string" ? pick.account : undefined, explore: typeof pick.explore === "boolean" ? pick.explore : undefined, yolo: pick.yolo === true } : {}), task: { id: task.id, requirePlanConfirmation: !task.initialConfirmed } });
327
+ return launchRun({ severity: null, where: null, text, raw: text }, dir, id, { ...inCard, ...(pick ? { agent: KNOWN_AGENTS.some((a) => a.cmd === pick.agent) ? pick.agent : undefined, account: typeof pick.account === "string" ? pick.account : undefined, explore: typeof pick.explore === "boolean" ? pick.explore : undefined, yolo: pick.yolo === true } : {}), task: { id: task.id, requirePlanConfirmation: !task.initialConfirmed } });
290
328
  },
291
329
  alive: (key: string) => ptyState(key)?.alive === true,
292
330
  stop: (key: string) => killPty(key),
@@ -295,7 +333,8 @@ export async function web(repoDir: string, opts: Opts = {}) {
295
333
  const taskPump = setInterval(() => {
296
334
  for (const dir of states(true)) for (const task of tasks.listTasks(dir)) {
297
335
  // A stopping task is asked to stop again until its terminal is gone, not only when someone opens it.
298
- if (task.status === "stopping" && !task.archived) { try { if (taskService.reconcile(dir, task, taskHooks).revision !== task.revision) changed(); } catch { /* next pass */ } continue; }
336
+ // A ready task also picks up its run's acceptance given in the agent terminal (kaizen done --user-approved).
337
+ if ((task.status === "stopping" || task.status === "ready") && !task.archived) { try { if (taskService.reconcile(dir, task, taskHooks).revision !== task.revision) changed(); } catch { /* next pass */ } if (task.status === "stopping") continue; }
299
338
  if (!task.safe || task.queuePaused || task.pendingDecision || !task.inputs.some(i => i.state === "queued")) continue;
300
339
  try { taskService.dispatchReady(dir, task.id, taskHooks); changed(); } catch { /* CAS conflict: next pass reads the new state */ }
301
340
  }
@@ -361,6 +400,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
361
400
  // Change notification: one SSE stream per open board, fed by fs.watch where it
362
401
  // works and a slow poll where it does not.
363
402
  const clients = new Set<ReadableStreamDefaultController>();
403
+ const devClients = new Set<ReadableStreamDefaultController>();
364
404
  // Shells the board started (POST /shell), by /pty key; dead ones drop on the next /shells.
365
405
  const shells = new Map<string, { key: string; dir: string; title: string; agent: string; run: string; ws?: string; pid?: number }>();
366
406
  const SHELL_CAP = 8;
@@ -398,8 +438,8 @@ export async function web(repoDir: string, opts: Opts = {}) {
398
438
  for (const c of clients) { try { c.enqueue("data: changed\n\n"); } catch { clients.delete(c); } }
399
439
  }, 200);
400
440
  };
401
- // agent.launch: card runs what this board launches inside the board, shown on the card.
402
- const inCard = (dir: string) => ({ card: launchMode(projectOf(dir)) === "card", onChange: changed });
441
+ // What this board launches runs inside the board, shown on the card.
442
+ const inCard = { card: true, onChange: changed };
403
443
 
404
444
  // The agent open in a run's card, the newest when there are several: what the user sees
405
445
  // working. Everything sent to a run goes here before any new agent is started.
@@ -434,7 +474,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
434
474
  const prev = readSessions(dir).filter((s) => ownerOf(dir, s, idx) === id && existsSync(tailOf(s.key))).pop();
435
475
  let seed: string | undefined;
436
476
  try { if (prev) seed = readText(tailOf(prev.key)) + RESUMED; } catch { /* shown without it */ }
437
- const r = launchRun({ severity: null, where: null, text, raw: text }, dir, id, { ...inCard(dir), seed });
477
+ const r = launchRun({ severity: null, where: null, text, raw: text }, dir, id, { ...inCard, seed });
438
478
  if (r.ok) closeSessions(dir, id, { before });
439
479
  if (r.ok && prev) rmSync(tailOf(prev.key), { force: true });
440
480
  changed();
@@ -801,9 +841,8 @@ export async function web(repoDir: string, opts: Opts = {}) {
801
841
 
802
842
  if (req.method === "GET" && path === "/") {
803
843
  const page = served(PAGE);
804
- if (page === null) return new Response("web/board.html missing", { status: 500 });
805
- // The page gets the notify rule from state.ts rather than keeping its own copy.
806
- return new Response(page.replace("/*notifier*/", () => notifier.toString()), {
844
+ if (page === null) return new Response("web/html/board.html missing", { status: 500 });
845
+ return new Response(page, {
807
846
  headers: { "content-type": "text/html; charset=utf-8", "cache-control": "no-store", "x-kaizen-version": VERSION },
808
847
  });
809
848
  }
@@ -814,6 +853,19 @@ export async function web(repoDir: string, opts: Opts = {}) {
814
853
  return new Response(body, { headers: { "content-type": "application/javascript; charset=utf-8", "cache-control": "no-store" } });
815
854
  }
816
855
 
856
+ // The React pages' Tailwind (web/ui/theme.css compiled by bun run build:web).
857
+ if (req.method === "GET" && path === "/ui.css") {
858
+ const body = served(UI_CSS);
859
+ if (body === null) return new Response(`${path} missing; run bun run build:web`, { status: 500 });
860
+ return new Response(body, { headers: { "content-type": "text/css; charset=utf-8", "cache-control": "no-store" } });
861
+ }
862
+
863
+ if (req.method === "GET" && STYLES[path]) {
864
+ const body = served(STYLES[path]);
865
+ if (body === null) return new Response(`${path} missing; run bun run build:web`, { status: 500 });
866
+ return new Response(body, { headers: { "content-type": "text/css; charset=utf-8", "cache-control": "no-store" } });
867
+ }
868
+
817
869
  if (req.method === "GET" && path.startsWith("/sounds/")) {
818
870
  const name = /^\/sounds\/([A-Za-z]+)\.mp3$/.exec(path)?.[1];
819
871
  const file = name && join(SOUNDS_DIR, `${name}.mp3`);
@@ -828,11 +880,17 @@ export async function web(repoDir: string, opts: Opts = {}) {
828
880
  return new Response(body, { headers: { "content-type": type, "cache-control": "no-store" } });
829
881
  }
830
882
 
883
+ if (req.method === "GET" && path === "/boot.js") {
884
+ const body = served(BOOT_JS);
885
+ if (body === null) return new Response(`${path} missing; run bun run build:web`, { status: 500 });
886
+ return new Response(body, { headers: { "content-type": "application/javascript; charset=utf-8", "cache-control": "no-store" } });
887
+ }
888
+
831
889
  // `kaizen chat`: the small chat window over the desktop.
832
- if (req.method === "GET" && path === "/popup") {
833
- const body = served(POPUP_PAGE);
834
- if (body === null) return new Response("web/popup.html missing", { status: 500 });
835
- return new Response(body, { headers: { "content-type": "text/html; charset=utf-8", "cache-control": "no-store" } });
890
+ if (req.method === "GET" && (path === "/popup" || path === "/popup.js")) {
891
+ const body = served(path === "/popup" ? POPUP_PAGE : POPUP_JS);
892
+ if (body === null) return new Response(`${path} missing; run bun run build:web`, { status: 500 });
893
+ return new Response(body, { headers: { "content-type": path === "/popup" ? "text/html; charset=utf-8" : "application/javascript; charset=utf-8", "cache-control": "no-store" } });
836
894
  }
837
895
 
838
896
  // Handing the chat between Home and the popup (`kaizen chat`). /popup/open:
@@ -1012,6 +1070,16 @@ export async function web(repoDir: string, opts: Opts = {}) {
1012
1070
  const saved = saveImage(bytes);
1013
1071
  return saved ? json({ path: saved }) : bad("not an image", 415);
1014
1072
  }
1073
+ // The phone's Attach key: any file, saved on this computer under its own name, and its path typed into the terminal.
1074
+ if (req.method === "POST" && path === "/term-file") {
1075
+ if (!sameOrigin(req)) return bad("cross-origin request refused", 403);
1076
+ if (Number(req.headers.get("content-length") ?? 0) > MAX_FILE) return bad("file too large (25 MB at most)", 413);
1077
+ let name = "file";
1078
+ try { name = decodeURIComponent(req.headers.get("x-file-name") ?? "file"); } catch {}
1079
+ const bytes = new Uint8Array(await req.arrayBuffer());
1080
+ const saved = saveFile(bytes, name);
1081
+ return saved ? json({ path: saved }) : bad(bytes.length ? "file too large (25 MB at most)" : "empty file", bytes.length ? 413 : 400);
1082
+ }
1015
1083
  if (req.method === "POST" && path === "/shell") {
1016
1084
  const refused = strict(req);
1017
1085
  if (refused) return refused;
@@ -1281,6 +1349,35 @@ export async function web(repoDir: string, opts: Opts = {}) {
1281
1349
  // Never the board itself: `kaizen web` started inside the workspace listens there too.
1282
1350
  return json(devPorts(out, (pid) => { try { return readlinkSync(`/proc/${pid}/cwd`); } catch { return ""; } }, ws, [...KNOWN_AGENTS.map((a) => a.cmd), "cursor-agent"]).filter((p) => p !== port));
1283
1351
  }
1352
+ // A dev server (POST /shell with dev) whose terminal says its port is taken: that port and who holds it, for the Run app
1353
+ // button's "Stop it and run the app" question. Read from the terminal's own output, so nothing is guessed.
1354
+ if (req.method === "GET" && path === "/shell/conflict") {
1355
+ if (!local(req)) return bad("cross-origin request refused", 403);
1356
+ const key = url.searchParams.get("key") ?? "";
1357
+ // The shell may already have left /shells (dead ones drop there); its output is kept a little longer.
1358
+ const p = /^sh-[\w-]+$/.test(key) ? conflictPort(ptyTail(key) ?? "") : null;
1359
+ return json(p ? { port: p, holders: await holders(p), board: p === port } : { port: null });
1360
+ }
1361
+ // The ports this user's processes listen on, inside the board's projects (the Resources popup's Ports). Not the board's own,
1362
+ // not the agents (Claude Code listens on a local port of its own). Linux only; elsewhere the list is empty.
1363
+ if (req.method === "GET" && path === "/ports") {
1364
+ if (!local(req)) return bad("cross-origin request refused", 403);
1365
+ const dirs = states(true).filter((d) => d !== join(home, ".kaizen")).map((d) => dirname(d));
1366
+ const agents = [...KNOWN_AGENTS.map((a) => a.cmd), "cursor-agent"];
1367
+ const list = inProjects(await listeners(), dirs).filter((l) => l.pid !== process.pid && l.port !== port && !agents.includes(l.name) && !isKaizenProcess(l.cmd));
1368
+ return json(list.map((l) => ({ port: l.port, pid: l.pid, name: l.name, cmd: l.cmd, cwd: l.cwd, project: label(join(l.project, ".kaizen")) })));
1369
+ }
1370
+ // Stops what listens on a port (the question above, answered yes): a process of this user, never the board itself.
1371
+ if (req.method === "POST" && path === "/port/stop") {
1372
+ const refused = strict(req);
1373
+ if (refused) return refused;
1374
+ let body: any;
1375
+ try { body = await req.json(); } catch { return bad("json body expected"); }
1376
+ const n = Number(body?.port);
1377
+ if (n === port) return bad("that is the board itself");
1378
+ const r = await stopPort(n, [process.pid]);
1379
+ return r.ok ? json(r) : bad(r.error ?? "could not stop it");
1380
+ }
1284
1381
  // A phone on the tailnet cannot reach this computer's localhost. Serves that loopback port
1285
1382
  // to the tailnet (`tailscale serve --https=<port>`, never funnel) and answers the address
1286
1383
  // the phone opens instead. Loopback http only, one argv, never a shell string.
@@ -1349,7 +1446,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
1349
1446
  // Not the board itself: a proxy to it would forward /pty with an Origin rewritten to the board's own.
1350
1447
  if (u.port === (new URL(req.url).port || "80")) return bad("that is the board's own port", 400);
1351
1448
  try {
1352
- const px = openProxy(u);
1449
+ const px = openProxy(u, () => served(ANNOTATE_JS));
1353
1450
  return json({ ok: true, origin: px.origin, token: px.token, url: px.origin + u.pathname + u.search + u.hash });
1354
1451
  } catch (e) { return bad((e as Error).message, 500); }
1355
1452
  }
@@ -1548,6 +1645,17 @@ export async function web(repoDir: string, opts: Opts = {}) {
1548
1645
  // Off this thread: it also relays every terminal, and a rebuild here froze their typing.
1549
1646
  const { cards, extra, backlog } = await buildSnap(dirs, gitGen).catch(() => snapshot(dirs, gitGen));
1550
1647
  const pty = ptyOf(cards), beat = heartbeatMinutes();
1648
+ // A task's decisions shown on its run too: the open question, and Looks good when it may be given.
1649
+ const taskByRun = new Map<string, { id: string; dir: string; revision: number; result: string | null; question?: { id: string; text: string; options: string[] }; accept: boolean }>();
1650
+ for (const d of new Set(cards.filter((c) => c.kind === "run").map((c) => c.state))) {
1651
+ try {
1652
+ for (const t of tasks.listTasks(d)) {
1653
+ if (t.archived || !t.activeRun) continue;
1654
+ const q = t.pendingDecision?.kind === "question" && t.pendingDecision.run === t.activeRun ? t.pendingDecision : null;
1655
+ taskByRun.set(d + "\0" + t.activeRun, { id: t.id, dir: d, revision: t.revision, result: t.currentResult, ...(q ? { question: { id: q.id, text: q.text, options: q.options ?? [] } } : {}), accept: t.status !== "accepted" && taskService.allowedActions(d, t, taskHooks).accept });
1656
+ }
1657
+ } catch { /* a task file mid-write: the next refresh has it */ }
1658
+ }
1551
1659
  // The agents open now, for the sidebar cards: one list per tick, from the cards' sessions and the board's agent
1552
1660
  // shells. ws is as the card or shell has it; the page resolves it to a listed workspace. Ended agents are left out.
1553
1661
  const agents: any[] = [], seenKey = new Set<string>(), ptys = cards.map(pty);
@@ -1572,9 +1680,12 @@ export async function web(repoDir: string, opts: Opts = {}) {
1572
1680
  // Dirs with a card the picker leaves out (the global queue, a project outside the
1573
1681
  // Projects folder): the rail still needs their workspaces so a waiting run shows.
1574
1682
  rail: [...new Set(cards.map((c) => c.state))].filter((d) => !picker.includes(d)).map(entry),
1683
+ // Every known project, the Projects folder ignored: the Notes tab lists these (#86).
1684
+ known: states(true).map((d) => ({ dir: d, label: label(d) })),
1575
1685
  fresh: unset.map((d) => ({ dir: join(d, ".kaizen"), label: tilde(d) })),
1576
1686
  agents,
1577
1687
  cards: cards.map((c, i) => {
1688
+ const task = c.kind === "run" && c.id ? taskByRun.get(c.state + "\0" + c.id) : undefined;
1578
1689
  const rep = c.kind === "run" && c.id && c.status !== "done" && c.status !== "abandoned" ? readReport(c.state, c.id) : null;
1579
1690
  const signal = signalOf(c, rep, ptys[i] as any, Date.now(), beat);
1580
1691
  // Only a run that has workers.json carries `workers`: any other card is as it was.
@@ -1582,7 +1693,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
1582
1693
  // No terminal left to wake: the card says so, and approval works here as for any run.
1583
1694
  const hand = c.kind === "run" && c.id ? readHandoff(c.state, c.id) : null, parentPty = hand ? ptyState(hand.parent_terminal) : null;
1584
1695
  const unwoken = wakeAction(hand, parentPty ? { ...parentPty, typedAt: parentPty.typedAt ?? 0 } : null, Date.now()), orphan = unwoken === "gone" || unwoken === "held";
1585
- return { ...c, notice: notice(orphan ? { ...c, handoff: hand!.status } : c), ...extra[i], pty: ptys[i], signal, ...(ws ? { workers: ws.workers.map((x) => ({ id: x.id, title: x.title, status: workerStale(x, x.key ? ptyState(x.key) : null, Date.now(), beat) ? "stale" : x.status, bypass: x.bypass })), ...(ws.merge && ws.merge.status !== "merged" ? { workersMerge: ws.merge.status } : {}) } : {}), ...(rep?.phase ? { phase: rep.phase } : {}), ...(signal === "blocked" ? { blocked: rep!.blocked } : {}) };
1696
+ return { ...c, notice: notice(orphan ? { ...c, handoff: hand!.status } : c), ...extra[i], pty: ptys[i], signal, ...(ws ? { workers: ws.workers.map((x) => ({ id: x.id, title: x.title, status: workerStale(x, x.key ? ptyState(x.key) : null, Date.now(), beat) ? "stale" : x.status, bypass: x.bypass })), ...(ws.merge && ws.merge.status !== "merged" ? { workersMerge: ws.merge.status } : {}) } : {}), ...(rep?.phase ? { phase: rep.phase } : {}), ...(signal === "blocked" ? { blocked: rep!.blocked } : {}), ...(task ? { task } : {}) };
1586
1697
  }),
1587
1698
  backlog: backlog.map((b) => ({ ...b, starting: backlogLaunched.has(`${b.state}\0${b.source}#${b.n}`) || undefined })),
1588
1699
  now: Date.now(),
@@ -2085,6 +2196,16 @@ export async function web(repoDir: string, opts: Opts = {}) {
2085
2196
  return new Response(null, { status: 302, headers: { location: u, "cache-control": "no-store", "referrer-policy": "no-referrer" } });
2086
2197
  }
2087
2198
 
2199
+ if (DEV && path === "/__dev/stream" && req.method === "GET") {
2200
+ let c: ReadableStreamDefaultController;
2201
+ return new Response(new ReadableStream({ start(x) { c = x; devClients.add(x); x.enqueue("data: hello\n\n"); }, cancel() { devClients.delete(c); } }),
2202
+ { headers: { "content-type": "text/event-stream", "cache-control": "no-store", "connection": "keep-alive" } });
2203
+ }
2204
+ if (DEV && path === "/__dev/reload" && req.method === "POST" && local(req)) {
2205
+ for (const c of devClients) { try { c.enqueue("data: reload\n\n"); } catch { devClients.delete(c); } }
2206
+ return json({ ok: true, clients: devClients.size });
2207
+ }
2208
+
2088
2209
  if (req.method === "GET" && path === "/events") {
2089
2210
  let ctrl: ReadableStreamDefaultController;
2090
2211
  const stream = new ReadableStream({
@@ -2138,7 +2259,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
2138
2259
  agents: KNOWN_AGENTS.filter((a) => agentUsable(a.cmd)).map((a) => a.cmd),
2139
2260
  // As POST /run starts a task, without one on the inbox.
2140
2261
  run: async (d: string, runner: "lite" | "full", agent: string, text: string) => {
2141
- const r = launchRun(parseItem(`${runner} ${text}`), d, undefined, { agent, ...inCard(d) });
2262
+ const r = launchRun(parseItem(`${runner} ${text}`), d, undefined, { agent, ...inCard });
2142
2263
  changed();
2143
2264
  return r.ok ? { agent: r.agent.cmd } : { error: r.why };
2144
2265
  },
@@ -2496,7 +2617,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
2496
2617
  const p = parseItem(line.text);
2497
2618
  const it: Item = { ...p, text: kind ? `${kind} ${p.text}` : p.text };
2498
2619
  it.notes = [source !== "orphan" ? `Parent: ${source}` : "", `Backlog: ${source}#${n}`, p.text !== line.text ? `Backlog item: ${line.text}` : ""].filter(Boolean).join("\n");
2499
- const r = launchRun(it, dir, undefined, { agent, account: typeof body.account === "string" ? body.account : undefined, model: model || undefined, explore: typeof body.explore === "boolean" ? body.explore : undefined, yolo: body.yolo === true, ...inCard(dir) });
2620
+ const r = launchRun(it, dir, undefined, { agent, account: typeof body.account === "string" ? body.account : undefined, model: model || undefined, explore: typeof body.explore === "boolean" ? body.explore : undefined, yolo: body.yolo === true, ...inCard });
2500
2621
  if (r.ok) backlogLaunched.add(`${dir}\0${source}#${n}`);
2501
2622
  changed();
2502
2623
  return json(r.ok
@@ -2507,7 +2628,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
2507
2628
  // A `started` task may be run again: the terminal the first launch opened
2508
2629
  // can come up empty, and nothing else tells the board a run never began.
2509
2630
  it.notes = readInbox(dir).find((l) => (l.status === "open" || l.status === "started") && l.text === text)?.notes;
2510
- const r = launchRun(it, dir, undefined, { agent, account: typeof body.account === "string" ? body.account : undefined, model: model || undefined, explore: typeof body.explore === "boolean" ? body.explore : undefined, yolo: body.yolo === true, ...inCard(dir) });
2631
+ const r = launchRun(it, dir, undefined, { agent, account: typeof body.account === "string" ? body.account : undefined, model: model || undefined, explore: typeof body.explore === "boolean" ? body.explore : undefined, yolo: body.yolo === true, ...inCard });
2511
2632
  if (r.ok) replaceTask(dir, text, { status: "started", text });
2512
2633
  if (r.ok && r.pty) {
2513
2634
  for (const [k, v] of taskPty) if (!ptyState(v)) taskPty.delete(k); // sessions already dropped
@@ -2686,7 +2807,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
2686
2807
  // The run's conversation picks the fix up, and once that window is open the
2687
2808
  // waiting one ends. A failed launch leaves it: the decision has nowhere else.
2688
2809
  const before = Date.now();
2689
- const r = launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard(dir));
2810
+ const r = launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard);
2690
2811
  if (r.ok) (closeSessions(dir, id, { before }), markStage(dir, id, "review", r.pty));
2691
2812
  changed();
2692
2813
  return json(r.ok
@@ -2706,7 +2827,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
2706
2827
  const text = `run ${id}: the user chose Skip Explore for this run only. Stop exploration, preserve partial findings and unanswered questions in 00-explore.md, record that the user skipped it, run kaizen report unblock --run ${id}, set explore_status=skipped stage=plan awaiting=null with kaizen state, and prepare the plan. Do not change explore.enabled or skip the plan approval.`;
2707
2828
  const live = liveAgent(dir, id), before = Date.now();
2708
2829
  const r = live ? { ok: true as const, agent: live.agent, pty: live.key }
2709
- : launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard(dir));
2830
+ : launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard);
2710
2831
  if (live) submitPty(live.key, text);
2711
2832
  else if (r.ok) closeSessions(dir, id, { before });
2712
2833
  changed();
@@ -2729,31 +2850,37 @@ export async function web(repoDir: string, opts: Opts = {}) {
2729
2850
  const why = recordAcceptance(dir, id, "board");
2730
2851
  if (why) return bad(why, 409);
2731
2852
  finishRun(dir, id);
2853
+ if (run.task_id) syncTask(dir, String(run.task_id));
2732
2854
  changed();
2733
2855
  return json({ ok: true });
2734
2856
  }
2735
- if (run.task_id && run.awaiting === "approvals.plan") return bad("Confirm the current proposal on the task page so its version is checked.", 409);
2857
+ // A task's plan approval is the task's proposal confirmation: route it through the
2858
+ // task so the same version check and receipts apply. A revise is a change message.
2859
+ if (run.task_id && run.awaiting === "approvals.plan" && body.awaiting === "approvals.plan") {
2860
+ const found = tasks.resolveTask(dir, String(run.task_id));
2861
+ const d = found?.task.pendingDecision;
2862
+ if (!found || !d || d.kind !== "proposal" || d.run !== id) return bad("This task has no plan waiting. Refresh and try again.", 409);
2863
+ const why = body.why === undefined ? "" : String(body.why).trim();
2864
+ if (body.why !== undefined && !why) return bad("a revise needs a comment");
2865
+ const answers = Array.isArray(body.answers) ? body.answers.filter((a: unknown) => typeof a === "string" && a.trim()).slice(0, 20) : [];
2866
+ try {
2867
+ const op = why ? { op: "message", text: why } : { op: "confirm", decisionId: d.id };
2868
+ const done = taskService.taskAction(found.state, { ...op, id: found.task.id, revision: found.task.revision, operationId: `decide:${id}:${d.id}:${why ? "revise" : "confirm"}` }, taskHooks);
2869
+ // The plan's questions answered with the approval reach the agent as one message.
2870
+ if (!why && answers.length) taskService.taskAction(found.state, { op: "message", text: "Answers to the plan's questions:\n" + answers.join("\n"), id: found.task.id, revision: done.task.revision, operationId: `decide:${id}:${d.id}:answers` }, taskHooks);
2871
+ } catch (e) { return bad((e as Error).message, e instanceof tasks.TaskError ? e.status : 400); }
2872
+ changed();
2873
+ return json({ ok: true, task: true });
2874
+ }
2736
2875
  if (!canApproveAwaiting(run.awaiting) || run.awaiting !== body.awaiting) return bad("this run is not waiting on that approval", 409);
2737
2876
  if (run.awaiting === "findings" && body.why !== undefined) return bad("open findings can only be approved as-is or fixed individually", 409);
2738
2877
  if (body.why !== undefined && !String(body.why).trim()) return bad("a revise needs a comment");
2739
2878
  const answers = body.answers;
2740
2879
  if (answers !== undefined && (run.awaiting !== "approvals.plan" || body.why !== undefined || !Array.isArray(answers)
2741
2880
  || !answers.length || answers.length > 20 || answers.some((a: unknown) => typeof a !== "string" || !a.trim()))) return bad("bad answers");
2742
- const text = approvalPrompt(id, run.awaiting, body.why === undefined ? undefined : String(body.why), answers);
2743
- // The agent already open in this run's card takes the decision there, as it takes
2744
- // a fix: no second tab of the same conversation. With none, the run's conversation
2745
- // continues in one new window, and then the idle one ends. A failed launch leaves
2746
- // it open, since the decision went nowhere.
2747
- const live = liveAgent(dir, id);
2748
- const before = Date.now();
2749
- const r = live ? { ok: true as const, pty: live.key, agent: live.cmd, reused: true } : launchRun({ severity: null, where: null, text, raw: text }, dir, id, inCard(dir));
2750
- if (live) submitPty(live.key, text);
2751
- else if (r.ok) closeSessions(dir, id, { before });
2752
- // The plan's approval starts the build; fixing open findings is the review stage again.
2753
- if (r.ok) markStage(dir, id, run.awaiting === "approvals.plan" ? "impl" : run.awaiting === "findings" ? "review" : "", r.pty);
2754
- // Approving the review as-is is the user's acceptance, on record before the
2755
- // agent marks the run done; a revise is not.
2756
- if (r.ok && body.why === undefined && (run.awaiting === "approvals.review" || run.awaiting === "findings")) recordAcceptance(dir, id, "board");
2881
+ const { r, live } = sendDecision(dir, id, run.awaiting, body.why === undefined ? undefined : String(body.why), answers);
2882
+ // A task's run approved here is the task's Looks good too.
2883
+ if (r.ok && run.task_id) syncTask(dir, String(run.task_id));
2757
2884
  changed();
2758
2885
  return json(r.ok
2759
2886
  ? { ok: true, agent: r.agent, pty: r.pty, ...(live ? { reused: true } : {}) }
@@ -2773,6 +2900,7 @@ export async function web(repoDir: string, opts: Opts = {}) {
2773
2900
  const why = recordAcceptance(dir, id, "board");
2774
2901
  if (why) return bad(why, 409);
2775
2902
  finishRun(dir, id);
2903
+ if (st.task_id) syncTask(dir, String(st.task_id));
2776
2904
  changed();
2777
2905
  return json({ ok: true });
2778
2906
  }
@@ -2838,7 +2966,6 @@ export async function web(repoDir: string, opts: Opts = {}) {
2838
2966
  done.add(`${dir}\0${id}`);
2839
2967
  viaRun.add(key);
2840
2968
  if (saved.crash && resumed && Date.now() - resumed < CRASH_AGAIN_MS) { console.log(` not resuming ${id}: the board died again right after resuming it`); continue; }
2841
- if (launchMode(projectOf(dir)) !== "card") continue;
2842
2969
  const r = resumeRun(dir, id);
2843
2970
  if (saved.crash && "pty" in r && r.pty) autoResumed.set(r.pty, Date.now());
2844
2971
  console.log(` ${"error" in r || !r.ok ? "could not resume" : "resumed"} ${id}${"error" in r ? ` (${r.error})` : !r.ok ? ` (${r.why})` : ""}`);
@@ -2995,11 +3122,8 @@ export function shellHosts(root: number, id: string): boolean {
2995
3122
  }
2996
3123
 
2997
3124
  export async function openApp(url: string, profile?: string) {
2998
- // Kaizen Bot's window (a profile) is always an app; the board asks the setting.
2999
- if (!profile) {
3000
- const { listSettings } = await import("./settings.ts");
3001
- if (listSettings(join(import.meta.dir, "..")).rows.find((r) => r.key === "board.open")?.value !== "app") return openDefault(url);
3002
- }
3125
+ // Kaizen Bot's window (a profile) is an app window; the board opens in a browser tab.
3126
+ if (!profile) return openDefault(url);
3003
3127
  const args = [`--app=${url}`, ...(profile ? [`--user-data-dir=${profile}`] : [])];
3004
3128
  const chromes = process.platform === "darwin"
3005
3129
  ? ["Google Chrome", "Chromium", "Microsoft Edge", "Brave Browser"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaizen-agent",
3
- "version": "1.86.0",
3
+ "version": "1.87.0",
4
4
  "description": "Staged workflow for AI agents — code, writing, research, operations: plan, human approval, build, independent review, bounded fix loop.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,6 +13,7 @@
13
13
  "agents",
14
14
  "commands",
15
15
  "web",
16
+ "tsconfig.json",
16
17
  "assets/kaizen-logo.png",
17
18
  "assets/kaizen.ico",
18
19
  "README.md",
@@ -24,9 +25,10 @@
24
25
  "install-links": "bun run cli/install.ts",
25
26
  "check": "bun run cli/install.ts --check",
26
27
  "build:web": "bun run cli/build-web.ts",
28
+ "dev": "bun cli/dev.ts",
27
29
  "audit:ui": "bun run cli/ui-audit.ts",
28
- "format": "prettier --write web/*.ts web/board bot/web/app",
29
- "format:check": "prettier --check web/*.ts web/board bot/web/app",
30
+ "format": "prettier --write web/notebook web/term web/video web/ui web/components web/pages web/lib bot/web/app",
31
+ "format:check": "prettier --check web/notebook web/term web/video web/ui web/components web/pages web/lib bot/web/app",
30
32
  "test": "bun test",
31
33
  "prepublishOnly": "bun test",
32
34
  "postpublish": "sh cli/release.sh",
@@ -57,12 +59,27 @@
57
59
  "@codemirror/state": "6.7.6",
58
60
  "@codemirror/view": "6.43.13",
59
61
  "@lezer/highlight": "1.2.5",
62
+ "@tailwindcss/cli": "4.3.5",
63
+ "@types/bun": "1.4.4",
64
+ "@types/react": "19.3.0",
65
+ "@types/react-dom": "19.3.0",
60
66
  "@xterm/addon-fit": "0.11.0",
61
67
  "@xterm/addon-search": "0.16.0",
62
68
  "@xterm/addon-unicode11": "0.9.0",
63
69
  "@xterm/addon-web-links": "0.12.0",
64
70
  "@xterm/addon-webgl": "0.19.0",
65
71
  "@xterm/xterm": "6.0.0",
66
- "prettier": "3.9.10"
72
+ "class-variance-authority": "0.7.1",
73
+ "clsx": "2.1.1",
74
+ "cmdk": "1.1.1",
75
+ "prettier": "3.9.10",
76
+ "radix-ui": "1.8.1",
77
+ "react": "19.3.1",
78
+ "react-dom": "19.3.1",
79
+ "sonner": "2.0.8",
80
+ "tailwind-merge": "3.7.0",
81
+ "tailwindcss": "4.3.5",
82
+ "tw-animate-css": "1.4.0",
83
+ "zustand": "5.1.0"
67
84
  }
68
85
  }
@@ -213,9 +213,12 @@ switch agents. Both full and lite runners honor the persisted task policy before
213
213
  reading global auto/approval defaults.
214
214
 
215
215
  Task intake/planning may ask questions and propose an outcome, but must not produce
216
- until the current proposal is explicitly confirmed. Use the sanctioned state command;
217
- it rejects build/review/done before that confirmation. Do not overwrite task_policy,
218
- task_id or task_confirmed by hand. The task page owns the versioned decision.
216
+ until the current plan is explicitly approved. Use the sanctioned state command;
217
+ it rejects build/review/done before that approval. Do not overwrite task_policy,
218
+ task_id or task_confirmed by hand. The user may decide in any of three places: the task
219
+ page, the run panel, or by typing to you. The board records the first two; record a
220
+ decision typed to you with the `approved` or `answered` event below. The final yes on
221
+ the result is `kaizen done <run> --user-approved`; it also accepts the task.
219
222
 
220
223
  Read context with `kaizen task show --task <uuid>`. Publish structured events with
221
224
  `kaizen task event --task <uuid> --run <run-id> --operation <stable-event-id> --json '<event>'`.
@@ -227,6 +230,10 @@ input ids; acknowledge the launch before doing anything else:
227
230
  - `{"type":"question","text":"...","options":["..."]}` requests material input.
228
231
  - `{"type":"proposal","text":"outcome, constraints and checks","details":"full plan"}`
229
232
  requests explicit confirmation of this run/iteration/result. Stop production here.
233
+ - `{"type":"approved"}` records that the user approved the current plan by typing to
234
+ you in the agent terminal. Send it only on a clear yes, then continue the build.
235
+ - `{"type":"answered","text":"..."}` records the user's answer to your open question (or
236
+ their plan changes) given in the agent terminal, so the task and run pages stop asking.
230
237
  - `{"type":"work","text":"..."}` reports genuine production after confirmation.
231
238
  - `{"type":"receipt","inputIds":["..."],"outcome":"applied"}` acknowledges only
232
239
  dispatched input ids. Use `failed` and `error` for requests not applied.
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "jsx": "react-jsx",
7
+ "allowImportingTsExtensions": true,
8
+ "paths": { "@web/*": ["./web/*"], "@lib/*": ["./web/lib/*"], "@components/*": ["./web/components/*"] },
9
+ "types": ["bun"],
10
+ "noEmit": true,
11
+ "strict": false,
12
+ "skipLibCheck": true,
13
+ "lib": ["ESNext", "DOM", "DOM.Iterable"]
14
+ },
15
+ "include": ["web", "test"]
16
+ }