kaizen-agent 1.86.0 → 1.87.1

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 +79 -17
  11. package/cli/tasks.ts +2 -2
  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 +188 -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 +113 -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 +134 -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 +397 -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
@@ -1,650 +0,0 @@
1
- // The side menu's live parts on every page (board, notebook, video): the Icebox count,
2
- // the Tasks entry's source icons and the Projects list; and the board's flat footer
3
- // (agent usage, terminal count, phone). Stands alone, so the notebook and video
4
- // bundles can carry it without the board.
5
- import { onBoardCards, attentionTasks, setTaskAttention, taskForCard } from "./badge.ts";
6
- import { store } from "./store.ts";
7
- import { $, html, modal, raw } from "./dom.ts";
8
- import { initResources } from "./resources.ts";
9
- import { age, need } from "./labels.ts";
10
- import { openAdd } from "./add-project.ts";
11
- import { initSearch } from "./search.ts";
12
- import { agentsHtml, dueWord, forgetAgents, gitDue, moveTo, settleIn, toggleOpen, wsAgents, type Agent } from "./ws-tabs.ts";
13
- import { toast } from "./toast.ts";
14
-
15
- const DAY = 864e5;
16
- const STAGE = ["idea", "planning", "building", "reviewing", "done"];
17
- // A card's state icon (.si) and the word under its title.
18
- export function stateOf(c) {
19
- const task = taskForCard(c);
20
- // Only a task that is really working spins; a saved goal is idle, a finished run keeps its own state.
21
- // An abandoned run waits on nobody, and a done one only on its own approval or commit (below), so
22
- // a linked task's "needs you" never paints a finished run orange.
23
- if (task && !(c.kind === "run" && (c.status === "done" || c.status === "abandoned"))) return task.attention.category === "needs-you" ? "wait" : task.attention.category === "completed" ? "done" : ["interrupted", "failed"].includes(task.status ?? "") ? "stalled" : task.status === "draft" ? "idle" : "build";
24
- // A task whose agent is working is a run being born: show it as planning.
25
- if (c.kind === "idea") return !c.pty?.alive ? "idle" : c.pty.asking ? "wait" : c.pty.busy ? "plan" : "idle";
26
- if (c.status === "waiting" || (c.pty?.alive && c.pty.asking)) return "wait";
27
- if (c.status === "done") return c.accept === "needs" || gitDue(c) ? "wait" : "done";
28
- if (c.status === "abandoned") return "aband";
29
- if (c.status === "stalled") return "stalled";
30
- return c.column >= 3 ? "review" : c.column === 2 ? "build" : "plan";
31
- }
32
- export function subline(c, now) {
33
- const task = taskForCard(c);
34
- if (task) return task.attention.reason + " · " + task.attention.action;
35
- // An idle agent and no run yet: it answered, or waits for the user.
36
- if (c.kind === "idea") return !c.pty?.alive ? "idea" : c.pty.asking ? "waiting on you" : c.pty.busy ? "planning · starting" : "agent · open";
37
- const t = c.moved ?? now;
38
- if (c.stage === "explore") return c.awaiting ? `exploring · ${need(c.awaiting)}` : `exploring · ${age(c.moved ?? now, now)}`;
39
- if (c.status === "waiting") return c.awaiting ? `${STAGE[c.column] ?? "waiting"} · ${need(c.awaiting)}` : "waiting on you";
40
- if (c.accept === "needs") return "done, not approved";
41
- if (gitDue(c)) return `waiting on you · ${dueWord(c)}`;
42
- if (c.accept === "auto") return `auto-accepted · ${age(t, now)} ago`;
43
- if (c.status === "done" || c.status === "abandoned") return `${c.status} · ${age(t, now)} ago`;
44
- if (c.status === "stalled") return `stalled · ${age(t, now)}`;
45
- return `${STAGE[c.column] ?? c.status} · ${age(t, now)}`;
46
- }
47
- export const titleOf = (c) => (c.title || c.text || "").split("\n")[0];
48
- // Shown in the list: runs not archived, a finished one only for a day. Tasks not started yet
49
- // live on the Tasks page; one whose agent is starting (it has a terminal) shows here.
50
- export const listed = (c, now) =>
51
- !c.archived && (c.kind === "idea" ? !!c.pty : !["done", "abandoned"].includes(c.status) || now - (c.moved ?? 0) < DAY);
52
- export const projName = (dir, projects) => {
53
- const l = projects?.find((p) => p.dir === dir)?.label || dir.replace(/[\\/]\.kaizen$/, "");
54
- return l.split(/[\\/]/).pop() || l;
55
- };
56
- export const logo = (dir, name, projects) => {
57
- const ini = html`<span class="plogo" aria-hidden="true">${(name || "?").charAt(0).toUpperCase()}</span>`;
58
- return projects?.some((p) => p.dir === dir && p.logo)
59
- ? html`<img class="plogo" src="/project-logo?dir=${encodeURIComponent(dir)}" alt="" loading="lazy" onerror="this.outerHTML=this.dataset.f" data-f="${String(ini)}">`
60
- : ini;
61
- };
62
- // A card's address: its run workspace (?view=run&dir=&id=, or &idea= for a task).
63
- export const cardHref = (c) =>
64
- `/?view=run&dir=${encodeURIComponent(c.state)}&` + (c.kind === "run" ? "id=" + encodeURIComponent(c.id) : "idea=" + encodeURIComponent(c.text));
65
-
66
- // The Projects filter: projects ticked (none = all) and which kinds of card show. Kept per browser.
67
- // Running: tasks and agents that started and are not done. Done: the finished ones. Saved tasks that never started show in neither.
68
- type Filt = { dirs: string[]; running: boolean; done: boolean };
69
- const ALLF: Filt = { dirs: [], running: true, done: false };
70
- let filt: Filt = (() => {
71
- try {
72
- return { ...ALLF, ...JSON.parse(localStorage.getItem("kz-rail-filter2") || "{}") };
73
- } catch {
74
- return { ...ALLF };
75
- }
76
- })();
77
- const keepFilt = () => {
78
- try {
79
- localStorage.setItem("kz-rail-filter2", JSON.stringify(filt));
80
- } catch {}
81
- };
82
- let last: { cards: any[]; projects?: any[]; agents?: Agent[] } = { cards: [] };
83
- // Projects that are git repositories (the main checkout has a branch): where a workspace can be made.
84
- export const gitProjects = () =>
85
- (last.projects ?? []).filter((p) => p.workspaces?.some((w) => w.branch)).map((p) => ({ dir: p.dir as string, name: projName(p.dir, last.projects) }));
86
- // Project groups folded shut in the side menu, kept per browser.
87
- const folded: Set<string> = (() => {
88
- try {
89
- return new Set(JSON.parse(localStorage.getItem("kz-rail-folded") || "[]"));
90
- } catch {
91
- return new Set();
92
- }
93
- })();
94
- // Pinned worktrees (dir\0ws), kept per browser.
95
- const pins: Set<string> = (() => {
96
- try {
97
- return new Set(JSON.parse(localStorage.getItem("kz-ws-pins") || "[]"));
98
- } catch {
99
- return new Set();
100
- }
101
- })();
102
- // The right-click menu on a worktree row: update, copy path, copy name, pin, delete.
103
- function wsMenu(e: MouseEvent, a: HTMLElement) {
104
- e.preventDefault();
105
- document.getElementById("wsmenu")?.remove();
106
- const dir = a.dataset.dir!, ws = a.dataset.ws!, key = dir + "\0" + ws;
107
- const w = last.projects?.find((p) => p.dir === dir)?.workspaces?.find((x) => x.path === ws);
108
- if (!w) return;
109
- const name = wsLabel(w);
110
- const say = (m: string) => {
111
- const t = $("toast");
112
- t.textContent = m;
113
- t.classList.add("on");
114
- setTimeout(() => t.classList.remove("on"), 4000);
115
- };
116
- const copy = (text: string) => navigator.clipboard.writeText(text).then(() => say("Copied"), () => say("Could not copy"));
117
- const op = async (o: string) => {
118
- say(o === "update" ? "Updating…" : "Deleting…");
119
- const r = await fetch("/workspace", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ dir, ws, op: o }) }).catch(() => null);
120
- const j = await r?.json().catch(() => ({}));
121
- say(r?.ok ? (o === "update" ? j.out || "Updated" : "Deleted") : j?.error || j?.why || "Failed");
122
- };
123
- const items: [string, () => void][] = [
124
- ...(w.main ? [] : ([["Update", () => op("update")]] as [string, () => void][])),
125
- ["Copy path", () => copy(ws)],
126
- ["Copy worktree name", () => copy(name)],
127
- [pins.has(key) ? "Unpin" : "Pin", () => {
128
- pins.has(key) ? pins.delete(key) : pins.add(key);
129
- try {
130
- localStorage.setItem("kz-ws-pins", JSON.stringify([...pins]));
131
- } catch {}
132
- drawList();
133
- }],
134
- ...(w.main ? [] : ([["Delete", async () => {
135
- const dl = modal(html`<div class="gdis" style="display:flex;flex-direction:column;gap:12px">
136
- <b>Delete worktree "${name}"?</b>
137
- <p>Removes the folder. Refused while it has uncommitted changes. The branch stays.</p>
138
- <div class="gpath" style="font:12px monospace;overflow-wrap:anywhere">${ws}</div>
139
- <div class="row"><button class="btn" value="no">Cancel</button><button class="btn danger" value="yes">Delete</button></div>
140
- </div>`);
141
- dl.addEventListener("close", () => dl.returnValue === "yes" && op("delete"));
142
- }]] as [string, () => void][])),
143
- ];
144
- const m = document.createElement("div");
145
- m.id = "wsmenu";
146
- m.style.cssText = `position:fixed;left:${Math.min(e.clientX, innerWidth - 190)}px;top:${Math.min(e.clientY, innerHeight - items.length * 34 - 16)}px;z-index:50;min-width:170px;padding:6px;background:var(--bg-2);border:1px solid var(--line);border-radius:var(--r);box-shadow:0 8px 24px #0004;display:flex;flex-direction:column`;
147
- for (const [label, fn] of items) {
148
- const b = document.createElement("button");
149
- b.type = "button";
150
- b.textContent = label;
151
- b.style.cssText = "text-align:left;padding:7px 10px;font-size:13px;color:var(--ink);border-radius:var(--r-s)";
152
- b.onmouseenter = () => (b.style.background = "var(--hover)");
153
- b.onmouseleave = () => (b.style.background = "");
154
- b.onclick = () => (m.remove(), fn());
155
- m.append(b);
156
- }
157
- document.body.append(m);
158
- const off = () => (m.remove(), removeEventListener("click", off), removeEventListener("keydown", off));
159
- setTimeout(() => (addEventListener("click", off), addEventListener("keydown", off)));
160
- }
161
- // Workspace cards with their agent list open (dir\0ws -> true), kept per browser.
162
- const wsOpen: Record<string, true> = (() => {
163
- try {
164
- return JSON.parse(localStorage.getItem("kz-wsopen") || "{}");
165
- } catch {
166
- return {};
167
- }
168
- })();
169
- function toggleList(dir: string, ws: string) {
170
- toggleOpen(wsOpen, dir, ws);
171
- try {
172
- localStorage.setItem("kz-wsopen", JSON.stringify(wsOpen));
173
- } catch {}
174
- drawList();
175
- }
176
- function fold(dir: string) {
177
- folded.has(dir) ? folded.delete(dir) : folded.add(dir);
178
- try {
179
- localStorage.setItem("kz-rail-folded", JSON.stringify([...folded]));
180
- } catch {}
181
- drawList();
182
- }
183
- const svg = (d: string) => `<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
184
- const FA_OPEN = svg("M4 3l4 3 4-3M4 13l4-3 4 3");
185
- const FA_SHUT = svg("M4 6l4-3 4 3M4 10l4 3 4-3");
186
- const foldAll = (shut: boolean) => {
187
- for (const d of last.projects?.map((p) => p.dir) ?? []) shut ? folded.add(d) : folded.delete(d);
188
- try {
189
- localStorage.setItem("kz-rail-folded", JSON.stringify([...folded]));
190
- } catch {}
191
- drawList();
192
- };
193
- // A card's workspace row: its own (a run's worktree) when the project lists it, else the
194
- // main checkout's, so a run whose worktree is gone, a task or an old run never vanishes.
195
- export function wsOfCard(c, projects = last.projects) {
196
- const ws = projects?.find((p) => p.dir === c.state)?.workspaces ?? [];
197
- return ws.find((w) => w.path === c.ws)?.path ?? ws.find((w) => w.main)?.path ?? c.ws ?? "";
198
- }
199
- // The floating Home workspace's folder (~/.kaizen/home): never a project's `.kaizen` state dir, and it has no workspace view.
200
- export const isHomeDir = (d: unknown) => typeof d === "string" && /[\\/]\.kaizen[\\/]home$/.test(d);
201
- // A Home terminal's address opens the board with its panel (web/board/home-ws.ts), from any page.
202
- export const wsHref = (dir, ws) => (isHomeDir(dir) ? "/?view=board&homews=1" : `/?view=ws&dir=${encodeURIComponent(dir)}&ws=${encodeURIComponent(ws)}`);
203
- export const RANK = { wait: 0, plan: 1, build: 2, review: 3, stalled: 4, idle: 5, done: 6, aband: 7 };
204
- export const folderOf = (w) => w.path.split(/[\\/]/).pop() || w.path;
205
- // A worktree's mark on line 2 of its card.
206
- const PIN = html`<svg viewBox="0 0 24 24" aria-label="Pinned" style="width:12px;height:12px;flex:none;margin-left:4px;color:var(--accent)"><path d="M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z" fill="currentColor" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>`;
207
- const WT = html`<svg viewBox="0 0 24 24" aria-hidden="true"><g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="6" r="2"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="8" r="2"/><path d="M6 8v8M18 10c0 4-6 3-12 6"/></g></svg>`;
208
- let settleT: ReturnType<typeof setTimeout> | undefined;
209
- let drawn = "";
210
- let tasksReadAt = 0, tasksReading = false;
211
- async function readTaskAttention() {
212
- if (tasksReading || Date.now() - tasksReadAt < 2000) return;
213
- tasksReading = true; tasksReadAt = Date.now();
214
- try { const r = await fetch("/tasks?all=1"); if (r.ok) { const body = await r.json(); setTaskAttention(body.tasks ?? []); } } catch { /* retain the latest persisted projection */ }
215
- finally { tasksReading = false; }
216
- }
217
- const taskLinks = (dir: string, w: any, cards: any[]) => (attentionTasks ?? []).filter((t) => t.dir === dir && !t.legacy && t.attention.category !== "completed" && filt.running && t.status !== "draft" && (cards.some((c) => taskForCard(c)?.id === t.id) || (w.main && !(t.runs ?? t.runIds ?? []).length))).sort((a: any, b: any) => (a.created ?? 0) - (b.created ?? 0)).map((t) => html`<a class="rtask" href="/?view=task&task=${encodeURIComponent(t.id)}&dir=${encodeURIComponent(t.dir)}" data-task-id="${t.id}" data-task-dir="${t.dir}" title="${t.attention.reason} · ${t.attention.action}"><span class="si ${t.attention.category === "needs-you" ? "wait" : t.attention.category === "completed" ? "done" : ["interrupted", "failed"].includes(t.status ?? "") ? "stalled" : t.status === "draft" ? "idle" : "build"}"></span><span><b>${t.title}</b><small>${t.attention.reason}</small></span></a>`);
218
-
219
- // ---- ranking projects: press a project's bar and drag it up or down (pointer events, so a mouse
220
- // and a finger work alike). A mouse starts after 5 px of movement; a finger after a 300 ms hold
221
- // without moving, so a quick swipe still scrolls the sidebar. A line shows where it will land;
222
- // letting go saves the order for every device (POST /projects/order rewrites ~/.kaizen/projects).
223
- // Escape or a cancelled pointer puts it back. The click that ends a drag does not fold.
224
- let ranking = false, rankDirty = false, rankClick = false;
225
- function rankDrag(box: HTMLElement) {
226
- let d: { dir: string; bar: HTMLElement; id: number; x: number; y: number; hold?: ReturnType<typeof setTimeout>; to: number } | null = null;
227
- const groups = () => [...box.querySelectorAll<HTMLElement>(":scope > .pgrp")];
228
- const clear = () => {
229
- groups().forEach((g) => g.classList.remove("rank-before"));
230
- box.classList.remove("rank-end");
231
- d?.bar.classList.remove("rank-lift");
232
- };
233
- const end = (save: boolean) => {
234
- if (!d) return;
235
- clearTimeout(d.hold);
236
- const was = ranking, { dir, to } = d;
237
- clear();
238
- d = null;
239
- ranking = false;
240
- if (was) rankClick = true; // the click that follows this pointerup
241
- if (was && save) {
242
- const dirs = groups().map((g) => g.querySelector<HTMLElement>(".proj")!.dataset.proj!);
243
- const from = dirs.indexOf(dir);
244
- if (from >= 0 && to !== from && to !== from + 1) {
245
- const next = moveTo(dirs, from, to);
246
- const rank = new Map(next.map((x, i) => [x, i]));
247
- last.projects = [...(last.projects ?? [])].sort((a, b) => (rank.get(a.dir) ?? 1e9) - (rank.get(b.dir) ?? 1e9));
248
- void fetch("/projects/order", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ dirs: next }) })
249
- .then((r) => { if (!r.ok) toast("Could not save the project order"); })
250
- .catch(() => toast("Could not save the project order"));
251
- }
252
- }
253
- if (was || rankDirty) (rankDirty = false), drawList();
254
- if (was) setTimeout(() => (rankClick = false), 0);
255
- };
256
- const start = () => {
257
- if (!d) return;
258
- ranking = true;
259
- d.bar.classList.add("rank-lift");
260
- try { d.bar.setPointerCapture(d.id); } catch {}
261
- navigator.vibrate?.(8);
262
- };
263
- box.addEventListener("pointerdown", (e) => {
264
- const bar = (e.target as HTMLElement).closest<HTMLElement>(".pgrp > .proj");
265
- if (!bar || e.button !== 0 || bar.parentElement?.parentElement !== box) return;
266
- d = { dir: bar.dataset.proj!, bar, id: e.pointerId, x: e.clientX, y: e.clientY, to: -1 };
267
- if (e.pointerType !== "mouse") d.hold = setTimeout(start, 300);
268
- });
269
- box.addEventListener("pointermove", (e) => {
270
- if (!d || e.pointerId !== d.id) return;
271
- const far = Math.hypot(e.clientX - d.x, e.clientY - d.y);
272
- if (!ranking) {
273
- if (e.pointerType === "mouse" ? far > 5 : far > 8) e.pointerType === "mouse" ? start() : end(false);
274
- if (!ranking) return;
275
- }
276
- e.preventDefault();
277
- // The landing slot: before the first project whose bar's middle is below the pointer, else the end.
278
- const gs = groups();
279
- const i = gs.findIndex((g) => { const r = g.getBoundingClientRect(); return e.clientY < r.top + r.height / 2; });
280
- d.to = i < 0 ? gs.length : i;
281
- gs.forEach((g, k) => g.classList.toggle("rank-before", k === d!.to));
282
- box.classList.toggle("rank-end", d.to === gs.length);
283
- });
284
- box.addEventListener("pointerup", (e) => d && e.pointerId === d.id && end(true));
285
- box.addEventListener("pointercancel", () => end(false));
286
- // A held finger: no page scroll and no long-press menu while it drags.
287
- box.addEventListener("touchmove", (e) => { if (ranking) e.preventDefault(); }, { passive: false });
288
- box.addEventListener("contextmenu", (e) => { if (d) e.preventDefault(); }, true);
289
- addEventListener("keydown", (e) => { if (ranking && e.key === "Escape") (e.preventDefault(), end(false)); });
290
- }
291
-
292
- export const wsLabel = (w) => w.branch || (w.main ? "workspace" : w.path.split(/[\\/]/).pop());
293
- function drawList() {
294
- const box = $("plist");
295
- if (!box) return;
296
- // A drag in progress owns the list: a redraw would pull the bar out from under the pointer.
297
- if (ranking) return void (rankDirty = true);
298
- const now = Date.now();
299
- const projects = (last.projects ?? []).filter((p) => p.workspaces?.length);
300
- const all = new Set(projects.map((p) => p.dir));
301
- // Cards by project and workspace: each lands on a row, the main checkout when its own is not listed.
302
- const by = new Map<string, any[]>();
303
- const shownAgents = (rs) => rs.filter((r) => (r.st === "done" ? filt.done : filt.running));
304
- const shown = (c) => {
305
- const st = stateOf(c);
306
- return (filt.running && ["wait", "plan", "build", "review", "stalled"].includes(st)) || (filt.done && (st === "done" || st === "aband"));
307
- };
308
- for (const c of last.cards.filter((c) => listed(c, now) && shown(c))) {
309
- const k = c.state + "\0" + wsOfCard(c);
310
- if (!by.has(k)) by.set(k, []);
311
- by.get(k)!.push(c);
312
- }
313
- const top = (cs) => (cs.length ? Math.min(...cs.map((c) => RANK[stateOf(c)])) : 9);
314
- const groups = projects
315
- .filter((p) => !filt.dirs.length || filt.dirs.includes(p.dir))
316
- .map((p) => {
317
- const rows = p.workspaces
318
- .map((w) => {
319
- const cs = by.get(p.dir + "\0" + w.path) ?? [];
320
- const allCs = (last.cards ?? []).filter((c) => c.state === p.dir && wsOfCard(c) === w.path && listed(c, now));
321
- const onlyDone = allCs.length > 0 && allCs.every((c) => ["done", "abandoned"].includes(stateOf(c)));
322
- const ags = shownAgents(wsAgents(last.agents ?? [], p.dir, w.path, wsOfCard, now)).length;
323
- // An empty workspace or one with a run going is active; one holding only finished runs is done.
324
- const keep = cs.length > 0 || ags > 0 || (filt.running && (w.main || !onlyDone));
325
- return { w, cs, keep };
326
- })
327
- .filter((r) => r.keep)
328
- // Pinned worktrees first (a stable sort keeps the rest in git's order).
329
- .sort((a, b) => +pins.has(p.dir + "\0" + b.w.path) - +pins.has(p.dir + "\0" + a.w.path));
330
- return { p, rows, top: Math.min(9, ...rows.map((r) => top(r.cs))) };
331
- })
332
- // Running only keeps every project listed, so an idle one reads "Nothing running" rather than vanishing.
333
- // In the registry's order, which the user ranks by dragging a project's bar (rankDrag below).
334
- .filter((g) => g.rows.length || filt.running);
335
-
336
- const f = $("pfilter");
337
- const on = filt.dirs.some((d) => all.has(d)) || !filt.running || filt.done;
338
- f.setAttribute("aria-pressed", String(on));
339
- f.title = on ? "Filter on: choose projects and kinds" : "Filter projects and kinds";
340
- if ($("pfpop")) drawPop(all);
341
- // Agents are read from this tick's payload; one held at "working" through the 3 s settle redraws when it ends.
342
- forgetAgents(last.agents ?? []);
343
- clearTimeout(settleT);
344
- const wait = settleIn(last.agents ?? [], now);
345
- if (wait < Infinity) settleT = setTimeout(drawList, wait + 20);
346
- const out =
347
- groups
348
- .map(({ p, rows }) => {
349
- const dir = p.dir,
350
- name = projName(dir, last.projects),
351
- // A project with nothing to list stays as a collapsed header.
352
- shut = folded.has(dir) || !rows.length;
353
- // A + for a new worktree on git projects (the main checkout has a branch).
354
- const git = p.workspaces.some((w) => w.branch);
355
- const mainWs = p.workspaces?.find((w) => w.main)?.path ?? p.workspaces?.[0]?.path ?? dir;
356
- return html`<div class="pgrp"><button type="button" class="proj${shut ? " shut" : ""}" data-proj="${dir}" data-ws="${mainWs}" data-fold="${dir}"${rows.length ? "" : " data-empty"} title="${dir}" aria-expanded="${String(!shut)}">${logo(dir, name, last.projects)}<span class="pname">${name}</span><svg class="fchev" viewBox="0 0 24 24" aria-hidden="true"><path d="M9 6l6 6-6 6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>${git ? html`<button type="button" class="wadd" data-wadd="${dir}" title="New workspace in ${name}" aria-label="New workspace in ${name}"><svg aria-hidden="true"><use href="#i-plus"/></svg></button>` : ""}</div>${shut ? "" : raw('<div class="pws">')}${shut ? "" : rows.map(({ w, cs }) => {
357
- // The dot: the most urgent run there, or an agent asking (amber) or working (spinner).
358
- const rows = shownAgents(wsAgents(last.agents ?? [], dir, w.path, wsOfCard, now));
359
- const st0 = cs.length ? stateOf([...cs].sort((a, b) => RANK[stateOf(a)] - RANK[stateOf(b)])[0]) : "";
360
- const st = st0 === "wait" || rows[0]?.st === "asking" ? "wait" : rows.some((r) => r.st === "working") ? "build" : st0 || (rows.length ? "done" : "");
361
- // The agent buttons are siblings of the link (a button inside a link is invalid).
362
- return html`<div class="wsr wsc"><a class="row ws" href="${wsHref(dir, w.path)}" data-dir="${dir}" data-ws="${w.path}" title="${w.path}"><span class="si ${st || "none"}"></span><div class="wl"><span class="l1"><b>${wsLabel(w)}</b>${pins.has(dir + "\0" + w.path) ? PIN : ""}</span><span class="l2"><span>${folderOf(w)}</span>${w.main ? "" : WT}</span></div></a>${agentsHtml(rows, now, !!wsOpen[dir + "\0" + w.path], dir, w.path)}</div>${taskLinks(dir, w, cs)}`;
363
- })}${shut ? "" : raw("</div>")}`;
364
- })
365
- .join("") || `<div class="none">No projects</div>`;
366
- // The same markup is not written again: hover and focus stay, and a tick that changed nothing costs no layout.
367
- if (out !== drawn) box.innerHTML = drawn = out;
368
- markCurrent();
369
- box.oncontextmenu = (e) => {
370
- const a = (e.target as HTMLElement).closest<HTMLElement>("a.row.ws");
371
- if (a) wsMenu(e, a);
372
- };
373
- box.onclick = (e) => {
374
- if (rankClick) return void ((rankClick = false), e.preventDefault(), e.stopPropagation());
375
- const t = e.target as HTMLElement;
376
- const task = t.closest<HTMLElement>("[data-task-id]");
377
- if (task) {
378
- if (e.ctrlKey || e.metaKey || e.shiftKey) return;
379
- if (ask("kz-open-task", { id: task.dataset.taskId, dir: task.dataset.taskDir })) e.preventDefault();
380
- return;
381
- }
382
- const term = t.closest<HTMLElement>("[data-term]");
383
- if (term) return void (e.preventDefault(), openTerm(term.dataset.dir!, term.dataset.ws!, term.dataset.term!));
384
- const tog = t.closest<HTMLElement>("[data-wopen]");
385
- if (tog) return void (e.preventDefault(), toggleList(tog.dataset.dir!, tog.dataset.ws!));
386
- const add = t.closest<HTMLElement>("[data-wadd]")?.dataset.wadd;
387
- if (add) return void (e.preventDefault(), openAdd({ dir: add, start: "ws" }));
388
- const chev = t.closest<HTMLElement>(".fchev");
389
- if (chev) {
390
- const d = t.closest<HTMLElement>("[data-fold]")?.dataset.fold;
391
- if (d) return void (e.preventDefault(), fold(d));
392
- }
393
- // A project bar folds and unfolds, like a folder. One that lists nothing has no rows to click,
394
- // so it opens its main workspace instead.
395
- const proj = t.closest<HTMLElement>("[data-proj][data-empty]");
396
- if (proj) {
397
- e.preventDefault();
398
- const dir = proj.dataset.proj!, ws = proj.dataset.ws || dir;
399
- if (ask("kz-open-ws", { dir, ws })) return;
400
- }
401
- const d = t.closest<HTMLElement>("[data-fold]")?.dataset.fold;
402
- if (d) (e.preventDefault(), fold(d));
403
- };
404
- }
405
- // An agent's mark: the board opens that terminal tab in its workspace; the notebook and video pages open the workspace.
406
- const openTerm = (dir: string, ws: string, key: string) => {
407
- if (!ask("kz-open-term", { dir, ws, key })) location.href = wsHref(dir, ws);
408
- };
409
- // Moves the side menu's highlight to the card the address names: opening a card in place
410
- // changes the address without redrawing the list.
411
- export function markCurrent() {
412
- const cur = new URLSearchParams(location.search);
413
- // A run's address (old links, notifications) lights its workspace.
414
- const c = cur.get("id") && last.cards.find((x) => x.kind === "run" && x.state === cur.get("dir") && x.id === cur.get("id"));
415
- const ws = cur.get("ws") ?? (c ? wsOfCard(c) : null);
416
- for (const a of document.querySelectorAll<HTMLElement>("#plist a.row")) {
417
- if (cur.get("dir") === a.dataset.dir && ws === a.dataset.ws) a.setAttribute("aria-current", "true");
418
- else a.removeAttribute("aria-current");
419
- }
420
- }
421
- addEventListener("popstate", markCurrent);
422
- // The pages that can open a card in place (the board) answer this event and cancel it.
423
- const ask = (name, detail) => !dispatchEvent(new CustomEvent(name, { cancelable: true, detail }));
424
-
425
- // What the Tasks page reads too: the cards, and /sources (sources plus every icebox signal).
426
- let srcs: any = null;
427
- export const railData = () => ({ ...last, srcs });
428
- const told = () => dispatchEvent(new Event("kz-rail"));
429
- let srcAt = 0;
430
- export async function drawSources(force = false) {
431
- if (!force && Date.now() - srcAt < 30_000) return;
432
- srcAt = Date.now();
433
- try {
434
- const r = await fetch("/sources");
435
- if (!r.ok) return;
436
- const d = (srcs = await r.json());
437
- told();
438
- const n = (d.icebox ?? []).filter((s) => s.status === "new" && !s.asleep).length;
439
- $("ice-n").textContent = n ? String(n) : "";
440
- $("rail-srcs").innerHTML = (d.sources ?? [])
441
- .slice(0, 3)
442
- .map((s) => String(srcIcon(s)))
443
- .join("");
444
- } catch {
445
- /* offline: keep what shows */
446
- }
447
- }
448
- // A source's mark: a social platform's sprite, a sheet's grid, else the site's favicon.
449
- export const srcIcon = (s) => {
450
- if (s.social) return html`<svg aria-hidden="true"><use href="#i-b-${s.social}"/></svg>`;
451
- if (/docs\.google\.com\/spreadsheets|\.(csv|tsv)$/.test(s.url)) return raw(`<svg aria-hidden="true"><use href="#i-sheet"/></svg>`);
452
- try {
453
- return html`<img src="${new URL(s.url).origin}/favicon.ico" alt="" loading="lazy" referrerpolicy="no-referrer" onerror="this.remove()">`;
454
- } catch {
455
- return raw("");
456
- }
457
- };
458
-
459
- // The filter popover: every project listed (search when there are many), All projects, and
460
- // the kinds of card. Each tick applies at once.
461
- let pq = "";
462
- function drawPop(all: Set<string>) {
463
- const p = $("pfpop");
464
- const dirs = [...all];
465
- const shown = dirs.filter((d) => projName(d, last.projects).toLowerCase().includes(pq.toLowerCase()));
466
- const box = (on: boolean, attrs: string, label) => html`<label class="pfrow"><input type="checkbox" ${raw(attrs)}${on ? raw(" checked") : ""}>${label}</label>`;
467
- const allShut = dirs.length > 0 && dirs.every((d) => folded.has(d));
468
- const had = document.activeElement?.id;
469
- const top = p.querySelector(".pfl")?.scrollTop ?? 0;
470
- p.innerHTML = String(
471
- html`<input class="sel" id="pfq" placeholder="Search projects…" aria-label="Search projects" value="${pq}" autocomplete="off" spellcheck="false"><div class="pfall">${box(!filt.dirs.length, 'data-all="1"', "All projects")}<button type="button" class="pfb" data-fa="${allShut ? "0" : "1"}" title="${allShut ? "Expand all" : "Collapse all"}" aria-label="${allShut ? "Expand all projects" : "Collapse all projects"}">${raw(allShut ? FA_OPEN : FA_SHUT)}</button></div><div class="pfl">${shown.map((d) => box(filt.dirs.includes(d), `data-dir="${encodeURIComponent(d)}"`, html`${logo(d, projName(d, last.projects), last.projects)}<span>${projName(d, last.projects)}</span>`))}</div><div class="pff"><div class="pfh">Show</div>${(["running", "done"] as const).map((k) => box(filt[k], `data-k="${k}"`, { running: "Running", done: "Done" }[k]))}</div>`,
472
- );
473
- const pl = p.querySelector(".pfl");
474
- if (pl) pl.scrollTop = top;
475
- if (had === "pfq") {
476
- const q = $("pfq") as HTMLInputElement;
477
- q.focus();
478
- q.setSelectionRange(pq.length, pq.length);
479
- }
480
- p.onclick = (e) => {
481
- const b = (e.target as HTMLElement).closest("[data-fa]") as HTMLElement | null;
482
- if (b) foldAll(b.dataset.fa === "1");
483
- };
484
- p.oninput = (e) => {
485
- const t = e.target as HTMLInputElement;
486
- if (t.id === "pfq") pq = t.value;
487
- else if (t.dataset.all) filt.dirs = [];
488
- else if (t.dataset.dir) {
489
- const d = decodeURIComponent(t.dataset.dir);
490
- filt.dirs = t.checked ? [...new Set([...filt.dirs, d])] : filt.dirs.filter((x) => x !== d);
491
- } else if (t.dataset.k) filt[t.dataset.k] = t.checked;
492
- keepFilt();
493
- drawList();
494
- };
495
- }
496
- function closePop() {
497
- $("pfpop")?.remove();
498
- $("pfilter").setAttribute("aria-expanded", "false");
499
- }
500
-
501
- // Rows are redrawn on every refresh, which restarts a CSS animation from 0deg: the state
502
- // icons jumped back mid-turn. Pinning each to the page clock's origin keeps them in phase
503
- // (the si-* animations have no delay for this to cancel).
504
- const syncSpin = () =>
505
- document.getAnimations().forEach((a: any) => {
506
- if (a.animationName?.startsWith("si-") && a.startTime !== 0) a.startTime = 0;
507
- });
508
- export function initRail() {
509
- initSearch();
510
- let queued = false;
511
- const hasSi = (n: any) => n.nodeType === 1 && (n.classList.contains("si") || n.querySelector(".si"));
512
- new MutationObserver((rs) => {
513
- if (queued || !rs.some((r) => [...r.addedNodes].some(hasSi))) return;
514
- queued = true;
515
- requestAnimationFrame(() => {
516
- queued = false;
517
- syncSpin();
518
- });
519
- }).observe(document.body, { childList: true, subtree: true });
520
- if (!$("plist")) return;
521
- rankDrag($("plist"));
522
- addEventListener("kz-task-attention", drawList);
523
- void readTaskAttention();
524
- onBoardCards((cards, projects, agents) => {
525
- last = { cards, projects: projects ?? last.projects, agents: agents ?? [] };
526
- drawList();
527
- void drawSources();
528
- void readTaskAttention();
529
- onCount?.(cards);
530
- dispatchEvent(new Event("kz-cards"));
531
- told();
532
- });
533
- $("pfilter").onclick = (e) => {
534
- e.stopPropagation();
535
- if ($("pfpop")) return closePop();
536
- const p = document.createElement("div");
537
- p.id = "pfpop";
538
- p.className = "pfpop";
539
- p.setAttribute("role", "dialog");
540
- p.setAttribute("aria-label", "Filter the Projects list");
541
- const r = $("pfilter").getBoundingClientRect();
542
- p.style.left = r.left + "px";
543
- p.style.top = r.bottom + 4 + "px";
544
- document.body.append(p);
545
- $("pfilter").setAttribute("aria-expanded", "true");
546
- drawList();
547
- (p.querySelector("input") as HTMLElement)?.focus();
548
- };
549
- addEventListener("pointerdown", (e) => {
550
- const p = $("pfpop");
551
- if (p && !p.contains(e.target as Node) && !$("pfilter").contains(e.target as Node)) closePop();
552
- });
553
- addEventListener("keydown", (e) => {
554
- if (e.key === "Escape" && $("pfpop")) {
555
- closePop();
556
- $("pfilter").focus();
557
- }
558
- });
559
- // The sheet: add a folder, clone, create, or start a workspace; the current project is preselected.
560
- $("padd").onclick = () => {
561
- const p = new URLSearchParams(location.search);
562
- openAdd({ dir: ["run", "ws"].includes(p.get("view")) ? p.get("dir") : filt.dirs.length === 1 ? filt.dirs[0] : null });
563
- };
564
- $("plist").addEventListener("click", (e) => {
565
- const a = (e.target as Element).closest?.("a.row") as HTMLAnchorElement;
566
- if (!a || e.ctrlKey || e.metaKey || e.shiftKey || (e as MouseEvent).button) return;
567
- if (ask("kz-open-ws", { dir: a.dataset.dir, ws: a.dataset.ws })) e.preventDefault();
568
- });
569
- }
570
-
571
- // ---- footer (board page)
572
- const meter = (p) => html`<span class="umtr"><i class="${p >= 85 ? "hi" : p >= 50 ? "mid" : ""}" style="width:${Math.min(100, p)}%"></i></span>`;
573
- const when = (t) => (t ? new Date(t).toLocaleString([], { weekday: "short", hour: "2-digit", minute: "2-digit" }) : "unknown");
574
- const NAME = { claude: "Claude", codex: "Codex" };
575
- export function usageChips(list) {
576
- // The agent's mark and its 5-hour %, coloured as it fills; the full figures on hover/focus.
577
- const lvl = (p) => (p >= 95 ? " hi" : p >= 80 ? " mid" : "");
578
- return list
579
- .filter((u) => NAME[u.agent])
580
- .map((u) => {
581
- const mark = html`<svg aria-hidden="true"><use href="#i-${u.agent}"/></svg>`;
582
- if (u.error) return html`<span class="uchip na" tabindex="0">${mark}<b>–</b><span class="utip" role="tooltip"><b>${NAME[u.agent]}</b>Usage unavailable: ${u.error}</span></span>`;
583
- const head = u.five ?? u.week;
584
- const row = (label, w) => (w ? html`<span class="urow"><span>${label}</span><b class="${lvl(w.pct).trim()}">${w.pct}%</b><i><i style="width:${Math.min(100, w.pct)}%" class="${lvl(w.pct).trim()}"></i></i><small>resets ${when(w.resetsAt)}</small></span>` : "");
585
- return html`<span class="uchip" tabindex="0" aria-label="${NAME[u.agent]} usage">${mark}<b class="${lvl(head?.pct ?? 0).trim()}">${head ? head.pct + "%" : ""}</b><span class="utip" role="tooltip"><b>${NAME[u.agent]}</b>${row("5-hour window", u.five)}${row("Week", u.week)}</span></span>`;
586
- })
587
- .join("");
588
- }
589
- async function usage(refresh = false) {
590
- try {
591
- const r = await fetch("/usage" + (refresh ? "?refresh=1" : ""));
592
- if (!r.ok) return;
593
- const list = await r.json();
594
- $("usage").innerHTML = usageChips(list);
595
- // Nothing to refresh: only Claude and Codex report usage.
596
- $("usage-r").style.display = list.length ? "" : "none";
597
- } catch {}
598
- }
599
- async function phone() {
600
- try {
601
- const d = await (await fetch("/phone")).json();
602
- const el = $("phone");
603
- el.hidden = false;
604
- const [txt, on, tip] = !d.tailscale
605
- ? ["Tailscale off", false, "Tailscale is not running on this computer"]
606
- : d.online
607
- ? ["Phone connected", true, "A phone is online on your tailnet"]
608
- : ["Phone offline", false, d.phones ? "Your phone is not online on the tailnet" : "No phone on your tailnet"];
609
- el.title = tip;
610
- el.innerHTML = String(html`<svg aria-hidden="true"><use href="#i-phone"/></svg><span class="ptxt">${txt}</span><span class="dot${on ? "" : " off"}"></span>`);
611
- } catch {}
612
- }
613
- // Live terminals: the board's agent sessions plus the shells /shell started.
614
- let agentPtys = 0;
615
- let onCount: ((cards: any[]) => void) | null = null;
616
- async function terms() {
617
- let shells = 0;
618
- try {
619
- store.shells = await (await fetch("/shells")).json();
620
- shells = store.shells.length;
621
- dispatchEvent(new Event("kz-shells"));
622
- } catch {}
623
- const n = agentPtys + shells,
624
- a = $("tcount");
625
- a.hidden = !n;
626
- a.querySelector("span").textContent = String(n);
627
- a.title = `${n} live terminal${n === 1 ? "" : "s"}: show them all`;
628
- }
629
- export function initFooter(goTerminal: () => void) {
630
- if (!$("foot")) return;
631
- // The Board drawer is position:fixed; it stops above the footer, whose height varies.
632
- const fh = () => document.documentElement.style.setProperty("--foot-h", $("foot").offsetHeight + "px");
633
- new ResizeObserver(fh).observe($("foot"));
634
- fh();
635
- initResources();
636
- void usage();
637
- void phone();
638
- setInterval(() => void usage(), 5 * 60_000);
639
- setInterval(() => void phone(), 60_000);
640
- $("usage-r").onclick = () => void usage(true);
641
- $("tcount").onclick = (e) => {
642
- if (e.ctrlKey || e.metaKey || e.shiftKey || e.button) return;
643
- e.preventDefault();
644
- goTerminal();
645
- };
646
- onCount = (cards) => {
647
- agentPtys = cards.filter((c) => c.pty?.alive).length;
648
- void terms();
649
- };
650
- }