@kabmo-labs/kabmo 0.49.0 → 0.50.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 (386) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +601 -557
  3. package/dist/client/static/js/{Body-9h5hd351.js → Body-pd3nt4xa.js} +3 -3
  4. package/dist/client/static/js/{CsvGrid-s05k1q18.js → CsvGrid-eksmqv8f.js} +2 -2
  5. package/dist/client/static/js/{DocxView-x6sjw5ht.js → DocxView-xfx1kt8x.js} +3 -3
  6. package/dist/client/static/js/{DrawioView-jashn8sf.js → DrawioView-2xyqg9bv.js} +2 -2
  7. package/dist/client/static/js/{HtmlPreview-eygzgtyc.js → HtmlPreview-ps3f0aa5.js} +1 -1
  8. package/dist/client/static/js/ImageView-7vse3k6x.js +1 -0
  9. package/dist/client/static/js/{LayoutWrapper-tag0qpts.js → LayoutWrapper-qdp83fps.js} +2 -2
  10. package/dist/client/static/js/MergeDiffView-hzsccppq.js +1 -0
  11. package/dist/client/static/js/Modal-zw9x5b6f.js +60 -0
  12. package/dist/client/static/js/{PdfView-syhjmyqf.js → PdfView-8fp08jym.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-2r1grxxs.js → SessionsView-qmgg03fv.js} +1 -1
  14. package/dist/client/static/js/{SheetView-26r0e506.js → SheetView-g7mstjdp.js} +22 -22
  15. package/dist/client/static/js/{SvgPreview-2fk85jzz.js → SvgPreview-wsv4h6c6.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-fdka7pxr.js → abnfDiagram-O67JEVCF-1kgm1049.js} +1 -1
  17. package/dist/client/static/js/architecture-7GRP2DOG-g7b64973.js +1 -0
  18. package/dist/client/static/js/architectureDiagram-NJMV4G6O-mtm210rw.js +36 -0
  19. package/dist/client/static/js/{astro-rn2bvwpm.js → astro-dszrfwwn.js} +1 -1
  20. package/dist/client/static/js/bash-z5pe89pt.js +1 -0
  21. package/dist/client/static/js/{blockDiagram-BEXU5L5S-vpcmd3vx.js → blockDiagram-BEXU5L5S-s474vn2w.js} +8 -8
  22. package/dist/client/static/js/c-fy0fysfw.js +1 -0
  23. package/dist/client/static/js/{c4Diagram-YGBWAQC7-1rgpdnbq.js → c4Diagram-YGBWAQC7-s68v6tc8.js} +3 -3
  24. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-fbsejvb9.js → classDiagram-v2-NBCMYWYE-291va3yk.js} +10 -10
  25. package/dist/client/static/js/cose-bilkent-JH36ORCC-0zg7crdw.js +1 -0
  26. package/dist/client/static/js/cpp-wam8dze6.js +1 -0
  27. package/dist/client/static/js/css-ke51m4kc.js +1 -0
  28. package/dist/client/static/js/css-yryw442h.js +1 -0
  29. package/dist/client/static/js/cynefin-OW5HDTMX-8bscrcct.js +1 -0
  30. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-7ta5vbrw.js → cynefinDiagram-VND7K2PF-4gnmn3yc.js} +2 -2
  31. package/dist/client/static/js/{dagre-6A5THRUB-b8gtt32x.js → dagre-6A5THRUB-nxmj6bkg.js} +2 -2
  32. package/dist/client/static/js/{diagram-22UHCM2B-7emepy7h.js → diagram-22UHCM2B-3171dabw.js} +25 -25
  33. package/dist/client/static/js/{diagram-3UASUU5V-06nptkzc.js → diagram-3UASUU5V-9h1pd6h8.js} +2 -2
  34. package/dist/client/static/js/{diagram-ATOU4E4O-t113exk3.js → diagram-ATOU4E4O-ywfrbd6m.js} +3 -3
  35. package/dist/client/static/js/{diagram-CDSNMT55-pyj3x97y.js → diagram-CDSNMT55-t87b4wbk.js} +3 -3
  36. package/dist/client/static/js/{diagram-MLGK6HIB-183sgpjh.js → diagram-MLGK6HIB-bzv52p97.js} +2 -2
  37. package/dist/client/static/js/{diagram-MPIPVDR6-fmbj4hcx.js → diagram-MPIPVDR6-8f66rp0a.js} +2 -2
  38. package/dist/client/static/js/{dockerfile-qay672za.js → dockerfile-z3v0km9v.js} +1 -1
  39. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-eafvfws2.js → ebnfDiagram-ZINNZB2B-3y4w2j6t.js} +1 -1
  40. package/dist/client/static/js/{elixir-t8bep87c.js → elixir-c701n0qg.js} +1 -1
  41. package/dist/client/static/js/{elk-276RUBZZ-573f1vfs.js → elk-276RUBZZ-d9d23jch.js} +1 -1
  42. package/dist/client/static/js/{erDiagram-OPXOYQCR-4z1r88ej.js → erDiagram-OPXOYQCR-w4z3501c.js} +12 -12
  43. package/dist/client/static/js/{erlang-261km7r1.js → erlang-cpw5s1f9.js} +1 -1
  44. package/dist/client/static/js/eventmodeling-NTZA5JFV-pj22bng1.js +1 -0
  45. package/dist/client/static/js/flowDiagram-KWPJA3E3-9h6g160j.js +1 -0
  46. package/dist/client/static/js/ganttDiagram-FUAMR5RP-7wcxk4bm.js +292 -0
  47. package/dist/client/static/js/gitGraph-4MIJSDKK-hgw4jcvk.js +1 -0
  48. package/dist/client/static/js/gitGraphDiagram-X574FWY7-sdh1hsb1.js +106 -0
  49. package/dist/client/static/js/graphql-0yv8dc1v.js +1 -0
  50. package/dist/client/static/js/html-zk3m0az9.js +1 -0
  51. package/dist/client/static/js/{index-c3whkrwa.js → index-09ap9ncj.js} +30 -30
  52. package/dist/client/static/js/index-0ff2x5g9.js +1 -0
  53. package/dist/client/static/js/{index-gg910gpv.js → index-0q39ajgh.js} +2 -2
  54. package/dist/client/static/js/{index-tb35a328.js → index-144aknp3.js} +2 -2
  55. package/dist/client/static/js/index-17jy16v3.js +314 -0
  56. package/dist/client/static/js/{index-j37m7pn9.js → index-1adfks1n.js} +1 -1
  57. package/dist/client/static/js/{index-4dnc1kys.js → index-1d8v3bvm.js} +2 -2
  58. package/dist/client/static/js/index-1dx4dqzy.js +4 -0
  59. package/dist/client/static/js/{index-a4636gt1.js → index-1ec33b1j.js} +2 -2
  60. package/dist/client/static/js/{index-gr8sqjpz.js → index-1jx4nt2f.js} +1 -1
  61. package/dist/client/static/js/{index-80fjn77c.js → index-1kjgdyfk.js} +2 -2
  62. package/dist/client/static/js/{index-h8hjcdj1.js → index-1vfej0gk.js} +2 -2
  63. package/dist/client/static/js/{index-wbsvg1d9.js → index-2g1ey1c9.js} +2 -2
  64. package/dist/client/static/js/{index-bmaktvm2.js → index-3rhk4apq.js} +1 -1
  65. package/dist/client/static/js/{index-2yzt8h3d.js → index-4vaxdt8a.js} +2 -2
  66. package/dist/client/static/js/{index-fbg5vhhw.js → index-4z3qtazf.js} +2 -2
  67. package/dist/client/static/js/{index-taev57jw.js → index-56319bht.js} +2 -2
  68. package/dist/client/static/js/{index-yg083mk0.js → index-5qwgexg6.js} +6 -6
  69. package/dist/client/static/js/index-779rptb2.js +1 -0
  70. package/dist/client/static/js/{index-4z5ram7g.js → index-7jdz4jr4.js} +2 -2
  71. package/dist/client/static/js/{index-2bf0txsp.js → index-7xn7gxgw.js} +2 -2
  72. package/dist/client/static/js/{index-ykc14gez.js → index-8fk7h2me.js} +5 -5
  73. package/dist/client/static/js/{index-dh060b7r.js → index-971stdh4.js} +2 -2
  74. package/dist/client/static/js/{index-t522tpxt.js → index-9jrej3ht.js} +3 -3
  75. package/dist/client/static/js/index-9ydvkxz1.css +1 -0
  76. package/dist/client/static/js/{index-473hk8nb.js → index-ajdzvegm.js} +9 -9
  77. package/dist/client/static/js/{index-nzvte8s5.js → index-ajqmcds5.js} +2 -2
  78. package/dist/client/static/js/{index-5p8dwr4y.js → index-ap6hv7s7.js} +1 -1
  79. package/dist/client/static/js/{index-0857zpr0.js → index-aqqj4xxy.js} +2 -2
  80. package/dist/client/static/js/index-bczhbk01.js +2 -0
  81. package/dist/client/static/js/{index-z6y8j93w.js → index-bggz63br.js} +7 -7
  82. package/dist/client/static/js/{index-qwxawph7.js → index-c2mqr5fh.js} +2 -2
  83. package/dist/client/static/js/{index-4ccs971z.js → index-cm8pa783.js} +2 -2
  84. package/dist/client/static/js/{index-7rmps91t.js → index-dgkpbrdr.js} +2 -2
  85. package/dist/client/static/js/{index-epzvftkq.js → index-e471eprg.js} +1 -1
  86. package/dist/client/static/js/{index-14dgbjsm.js → index-evvmkk2f.js} +1 -1
  87. package/dist/client/static/js/{index-rz0tz4hg.js → index-frhxbqhg.js} +1 -1
  88. package/dist/client/static/js/{index-1p880x6e.js → index-gcgsjd3c.js} +2 -2
  89. package/dist/client/static/js/{index-s5vegk6q.js → index-grkacfv3.js} +2 -2
  90. package/dist/client/static/js/{index-7ff9scbm.js → index-gws4prmg.js} +2 -2
  91. package/dist/client/static/js/index-hqhz4eam.js +1 -0
  92. package/dist/client/static/js/{index-pv4z2mp2.js → index-jr6q69r3.js} +181 -179
  93. package/dist/client/static/js/{index-dmc82cxb.js → index-jxxewcat.js} +2 -2
  94. package/dist/client/static/js/{index-gz7kvpnm.js → index-k3vvk28c.js} +1 -1
  95. package/dist/client/static/js/{index-yyjw1ty9.js → index-k66w6d9b.js} +2 -2
  96. package/dist/client/static/js/{index-1yq96wpa.js → index-kce86cnw.js} +2 -2
  97. package/dist/client/static/js/{index-zp40g8ah.js → index-n54jd3aw.js} +12 -12
  98. package/dist/client/static/js/{index-pygy21w5.js → index-nnqyew8n.js} +2 -2
  99. package/dist/client/static/js/index-qaxjp73x.js +2 -0
  100. package/dist/client/static/js/{index-5dn4159w.js → index-qxzyvye9.js} +2 -2
  101. package/dist/client/static/js/{index-5ztdqm1w.js → index-r2z0a118.js} +2 -2
  102. package/dist/client/static/js/{index-7dqq7cjp.js → index-r6bm9sth.js} +7 -7
  103. package/dist/client/static/js/{index-e8mt8rag.js → index-ratbr10x.js} +2 -2
  104. package/dist/client/static/js/{index-xw1bptp5.js → index-rgneq3zt.js} +2 -2
  105. package/dist/client/static/js/{index-nbm5r9g1.js → index-svx6rnfs.js} +2 -2
  106. package/dist/client/static/js/{index-3v8k8ms3.js → index-tew3rd6t.js} +1 -1
  107. package/dist/client/static/js/index-tfwsch7a.js +4 -0
  108. package/dist/client/static/js/{index-qs4n116g.js → index-vgwjn4de.js} +2 -2
  109. package/dist/client/static/js/{index-mbtenbyc.js → index-vn495w82.js} +6 -6
  110. package/dist/client/static/js/{index-tcfpzqb9.js → index-wbma8kqw.js} +33 -33
  111. package/dist/client/static/js/{index-gaqjrzdb.js → index-xgbcn89g.js} +2 -2
  112. package/dist/client/static/js/{index-tc6k8qt7.js → index-xrn2reb5.js} +2 -2
  113. package/dist/client/static/js/{index-0w4jqzqk.js → index-zhnfq8br.js} +2 -2
  114. package/dist/client/static/js/index-zsx5vs3j.js +2 -0
  115. package/dist/client/static/js/info-A6RAGUB7-k0kv05ny.js +1 -0
  116. package/dist/client/static/js/{infoDiagram-VRGFBTTK-xsar9j6v.js → infoDiagram-VRGFBTTK-gtdp0z6p.js} +1 -1
  117. package/dist/client/static/js/ini-apj95p59.js +1 -0
  118. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-g2rvt9jp.js → ishikawaDiagram-OU5B5YK6-c05m0sqq.js} +3 -3
  119. package/dist/client/static/js/java-khk2v3g4.js +1 -0
  120. package/dist/client/static/js/javascript-gez6yppm.js +1 -0
  121. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-q95v18zc.js → journeyDiagram-ZHPQQLJL-kgk5ygm2.js} +6 -6
  122. package/dist/client/static/js/json-r78y6e80.js +1 -0
  123. package/dist/client/static/js/jsx-h7hfj8cz.js +1 -0
  124. package/dist/client/static/js/{julia-pe5vpc2m.js → julia-w13bz4s1.js} +1 -1
  125. package/dist/client/static/js/{kanban-definition-PNTS6WVX-2e7m7ds3.js → kanban-definition-PNTS6WVX-q1w9w68s.js} +6 -6
  126. package/dist/client/static/js/lua-pat2bzg3.js +1 -0
  127. package/dist/client/static/js/markdown-545zn05v.js +1 -0
  128. package/dist/client/static/js/{mermaid.core-dzajkp0g.js → mermaid.core-1rz62j9g.js} +7 -7
  129. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-banecvf8.js → mindmap-definition-NLK3R4M7-3m3w6bnb.js} +8 -8
  130. package/dist/client/static/js/one-dark-pro-7c942tnw.js +1 -0
  131. package/dist/client/static/js/one-light-tp8y6c5g.js +1 -0
  132. package/dist/client/static/js/packet-AYTQ26CC-ne66q5h9.js +1 -0
  133. package/dist/client/static/js/{pegDiagram-GJSIUBJH-6erykm1c.js → pegDiagram-GJSIUBJH-svd3ex4e.js} +1 -1
  134. package/dist/client/static/js/{perl-cc2eqye8.js → perl-hcg3hacf.js} +1 -1
  135. package/dist/client/static/js/{php-p9bvnpsv.js → php-q6hhp84p.js} +1 -1
  136. package/dist/client/static/js/pie-WAS4IAKB-ej9aysvz.js +1 -0
  137. package/dist/client/static/js/{pieDiagram-5QR66LMP-jn1d905q.js → pieDiagram-5QR66LMP-2nrkw034.js} +3 -3
  138. package/dist/client/static/js/properties-9f76xngb.js +1 -0
  139. package/dist/client/static/js/python-nwerpkfq.js +1 -0
  140. package/dist/client/static/js/quadrantDiagram-O4NWA36T-4895d1aq.js +7 -0
  141. package/dist/client/static/js/r-39k5dr2p.js +1 -0
  142. package/dist/client/static/js/radar-RG4KPBEZ-375pe46t.js +1 -0
  143. package/dist/client/static/js/railroad-74A4TZTK-hdgdfsc1.js +1 -0
  144. package/dist/client/static/js/railroad-abnf-HS5TGJTU-2p5ynn4a.js +1 -0
  145. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-2p1fxxen.js +1 -0
  146. package/dist/client/static/js/railroad-peg-WCYAUIDC-g131pt42.js +1 -0
  147. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-ewzhhth2.js → railroadDiagram-XR7U4H2S-zj3g9yne.js} +1 -1
  148. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-fcs3xd42.js → requirementDiagram-PLB6GJNP-727yjvs8.js} +6 -6
  149. package/dist/client/static/js/{ruby-65s2ca5d.js → ruby-wzqz8vw6.js} +1 -1
  150. package/dist/client/static/js/{rust-ec1j2hwy.js → rust-r94pgqvf.js} +1 -1
  151. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2r829rjf.js → sankeyDiagram-IPEJSGJF-17c7p2pe.js} +5 -5
  152. package/dist/client/static/js/{sass-p6cssgq8.js → sass-xb3van7h.js} +1 -1
  153. package/dist/client/static/js/{scss-qfx8wt3b.js → scss-ddg6t3x4.js} +1 -1
  154. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-3mnte9tv.js → sequenceDiagram-PO4LG4MO-wcmbpckr.js} +21 -21
  155. package/dist/client/static/js/{sizeCapture-INFHLROL-r6hf9265.js → sizeCapture-INFHLROL-nkr57cd6.js} +1 -1
  156. package/dist/client/static/js/sql-4dcrp3sw.js +1 -0
  157. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-hm2f0wdb.js → stateDiagram-v2-GCMORJYK-vd7r8s78.js} +6 -6
  158. package/dist/client/static/js/{svelte-jz3a190v.js → svelte-wzaxz546.js} +1 -1
  159. package/dist/client/static/js/{swimlanes-2SLR337P-s58xzqhw.js → swimlanes-2SLR337P-zhxm05ak.js} +1 -1
  160. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-myzk2rg0.js +8 -0
  161. package/dist/client/static/js/timeline-definition-EJHVYXUP-n7gbzhzd.js +120 -0
  162. package/dist/client/static/js/treeView-Q6P3EWNA-gfztfha9.js +1 -0
  163. package/dist/client/static/js/treemap-WGGIJYW6-kwtrwq1f.js +1 -0
  164. package/dist/client/static/js/tsx-dk8rpgtw.js +1 -0
  165. package/dist/client/static/js/typescript-q0493nmw.js +1 -0
  166. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-ryvgs5ac.js → usecaseDiagram-POWQR4AR-davsnwkf.js} +82 -82
  167. package/dist/client/static/js/vennDiagram-UO4OBE2U-gb54bh5k.js +34 -0
  168. package/dist/client/static/js/{vue-rv4pea8r.js → vue-6zhfw7zx.js} +1 -1
  169. package/dist/client/static/js/wardley-WFR3VGLG-30dnzvww.js +1 -0
  170. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-1kt8q8a4.js → wardleyDiagram-VNRHLVJA-sf98cg9t.js} +4 -4
  171. package/dist/client/static/js/xml-91sb3gt9.js +1 -0
  172. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-q39bbgq4.js → xychartDiagram-PMCCYNJV-9nn09k40.js} +4 -4
  173. package/dist/client/static/js/yaml-ghx4mjw1.js +1 -0
  174. package/package.json +1 -1
  175. package/src/client/components/common/header-button/index.tsx +10 -2
  176. package/src/client/components/settings/apply-side-effects.test.ts +16 -0
  177. package/src/client/components/settings/apply-side-effects.ts +8 -0
  178. package/src/client/components/settings/categories/AppearanceSettings.test.tsx +1 -0
  179. package/src/client/components/settings/categories/AppearanceSettings.tsx +2 -0
  180. package/src/client/components/settings/categories/HarnessSettings.tsx +8 -0
  181. package/src/client/components/settings/categories/TokenUsageSettings.tsx +26 -3
  182. package/src/client/components/settings/categories/appearance-settings/RightSideSection.test.tsx +97 -0
  183. package/src/client/components/settings/categories/appearance-settings/RightSideSection.tsx +94 -0
  184. package/src/client/components/settings/categories/appearance-settings/groups.ts +4 -3
  185. package/src/client/components/settings/categories/harness-settings/AccountLoginPanel.tsx +224 -0
  186. package/src/client/components/settings/categories/harness-settings/AccountsPanel.test.tsx +139 -0
  187. package/src/client/components/settings/categories/harness-settings/AccountsPanel.tsx +349 -0
  188. package/src/client/components/settings/categories/harness-settings/AddAccountForm.tsx +58 -0
  189. package/src/client/components/settings/categories/harness-settings/HarnessCard.tsx +33 -0
  190. package/src/client/components/settings/categories/token-usage-settings/HarnessFilter.tsx +59 -0
  191. package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +37 -0
  192. package/src/client/components/settings/categories/usage-settings/limit-groups.test.ts +10 -0
  193. package/src/client/components/settings/categories/usage-settings/limit-groups.ts +4 -1
  194. package/src/client/components/settings/categories/usage-settings/providers.ts +28 -0
  195. package/src/client/components/settings/categories/usage-settings/usage-visibility.test.ts +60 -0
  196. package/src/client/components/settings/categories/voice-settings/SpeechSettings.test.tsx +40 -0
  197. package/src/client/components/settings/categories/voice-settings/speech/EndpointSection.tsx +8 -2
  198. package/src/client/components/settings/categories/voice-settings/speech/VoiceSection.tsx +52 -21
  199. package/src/client/components/workspace/usage-panel/index.test.tsx +92 -12
  200. package/src/client/components/workspace/usage-panel/index.tsx +48 -12
  201. package/src/client/data/mock/token-usage.ts +53 -10
  202. package/src/client/hooks/chat/timeline/reader-input.ts +53 -1
  203. package/src/client/hooks/chat/timeline/scroll-activity.test.ts +103 -0
  204. package/src/client/hooks/chat/timeline/scroll-geometry.ts +9 -4
  205. package/src/client/hooks/chat/timeline/scroll.ts +19 -2
  206. package/src/client/hooks/models/harness-accounts.ts +143 -0
  207. package/src/client/hooks/models/harness-catalog.ts +9 -2
  208. package/src/client/hooks/models/use-harnesses-controller.ts +12 -0
  209. package/src/client/hooks/models/use-harnesses.ts +14 -0
  210. package/src/client/hooks/settings/hide-empty-providers.test.ts +132 -0
  211. package/src/client/hooks/settings/hide-empty-providers.ts +49 -0
  212. package/src/client/hooks/settings/useTokenUsage.ts +7 -2
  213. package/src/client/hooks/workspace/panel-tabs.ts +1 -1
  214. package/src/client/hooks/workspace/right-side.test.ts +75 -1
  215. package/src/client/hooks/workspace/right-side.ts +71 -10
  216. package/src/server/lib/antigravity/home.server.ts +27 -0
  217. package/src/server/lib/db/schema.ts +5 -1
  218. package/src/server/lib/harness/account-identity.server.ts +163 -0
  219. package/src/server/lib/harness/account-login.server.test.ts +151 -0
  220. package/src/server/lib/harness/account-login.server.ts +232 -0
  221. package/src/server/lib/harness/accounts.server.ts +339 -0
  222. package/src/server/lib/harness/accounts.test.ts +147 -0
  223. package/src/server/lib/harness/acp/background-probe.test.ts +314 -0
  224. package/src/server/lib/harness/acp/background-probe.ts +288 -0
  225. package/src/server/lib/harness/acp/background-replay.test.ts +1 -1
  226. package/src/server/lib/harness/acp/background-work.test.ts +4 -194
  227. package/src/server/lib/harness/acp/background-work.ts +4 -207
  228. package/src/server/lib/harness/acp/client.ts +3 -0
  229. package/src/server/lib/harness/acp/commands.ts +2 -2
  230. package/src/server/lib/harness/acp/one-shot.server.ts +4 -2
  231. package/src/server/lib/harness/acp/prewarm.server.ts +21 -16
  232. package/src/server/lib/harness/acp/session-background.test.ts +2 -1
  233. package/src/server/lib/harness/acp/session-intake.test.ts +8 -0
  234. package/src/server/lib/harness/acp/session-intake.ts +12 -3
  235. package/src/server/lib/harness/acp/session-options.ts +2 -0
  236. package/src/server/lib/harness/acp/session-process.ts +1 -0
  237. package/src/server/lib/harness/acp/session-wiring.test.ts +2 -0
  238. package/src/server/lib/harness/acp/session-wiring.ts +22 -0
  239. package/src/server/lib/harness/acp/session.ts +3 -3
  240. package/src/server/lib/harness/acp/stdio.test.ts +52 -0
  241. package/src/server/lib/harness/acp/stdio.ts +7 -1
  242. package/src/server/lib/harness/auto-probe.server.ts +2 -2
  243. package/src/server/lib/harness/launch-table.ts +6 -1
  244. package/src/server/lib/harness/launch.ts +1 -0
  245. package/src/server/lib/harness/schema.server.ts +37 -0
  246. package/src/server/lib/harness/session-delete.server.ts +4 -2
  247. package/src/server/lib/harness/session-import.server.ts +21 -7
  248. package/src/server/lib/harness/session-store.server.test.ts +12 -0
  249. package/src/server/lib/harness/session-store.server.ts +21 -6
  250. package/src/server/lib/harness/session-transcript.server.ts +2 -1
  251. package/src/server/lib/harness/spawn.server.ts +27 -6
  252. package/src/server/lib/models/provider-icon-fetch.test.ts +57 -3
  253. package/src/server/lib/models/provider-icon-fetch.ts +9 -1
  254. package/src/server/lib/models/provider-icon-store.server.ts +61 -0
  255. package/src/server/lib/models/provider-icon-store.test.ts +55 -0
  256. package/src/server/lib/models/provider-icon-svg.ts +57 -0
  257. package/src/server/lib/schedule/runtime.server.ts +4 -1
  258. package/src/server/lib/sessions/dispatch.server.ts +4 -1
  259. package/src/server/lib/sessions/fork.server.ts +2 -0
  260. package/src/server/lib/sessions/resolve.server.ts +4 -0
  261. package/src/server/lib/sessions/spawn.server.ts +4 -2
  262. package/src/server/lib/tts/engines/adapters.test.ts +33 -0
  263. package/src/server/lib/tts/engines/elevenlabs.ts +6 -0
  264. package/src/server/lib/tts/engines/gemini.ts +116 -0
  265. package/src/server/lib/tts/engines/index.ts +3 -0
  266. package/src/server/lib/tts/engines/openai.ts +21 -4
  267. package/src/server/lib/usage/antigravity-quota.test.ts +249 -0
  268. package/src/server/lib/usage/antigravity-quota.ts +197 -0
  269. package/src/server/lib/usage/antigravity.test.ts +20 -0
  270. package/src/server/lib/usage/antigravity.ts +267 -0
  271. package/src/server/lib/usage/index-harness.test.ts +162 -0
  272. package/src/server/lib/usage/index-parse.test.ts +1 -0
  273. package/src/server/lib/usage/index-parse.ts +12 -4
  274. package/src/server/lib/usage/index-query.server.ts +64 -2
  275. package/src/server/lib/usage/index-scan.server.ts +68 -152
  276. package/src/server/lib/usage/index-schema.server.ts +24 -8
  277. package/src/server/lib/usage/index-schema.test.ts +54 -0
  278. package/src/server/lib/usage/index-sources.server.ts +54 -0
  279. package/src/server/lib/usage/providers.server.test.ts +67 -1
  280. package/src/server/lib/usage/providers.server.ts +82 -3
  281. package/src/server/lib/usage/sources/claude.server.ts +187 -0
  282. package/src/server/lib/usage/sources/claude.test.ts +86 -0
  283. package/src/server/lib/usage/sources/codex.server.ts +155 -0
  284. package/src/server/lib/usage/sources/codex.test.ts +53 -0
  285. package/src/server/lib/usage/sources/dsh.server.ts +120 -0
  286. package/src/server/lib/usage/sources/dsh.test.ts +49 -0
  287. package/src/server/lib/usage/sources/helpers.ts +191 -0
  288. package/src/server/lib/usage/sources/jsonl.server.ts +78 -0
  289. package/src/server/lib/usage/sources/jsonl.test.ts +72 -0
  290. package/src/server/lib/usage/sources/omp.server.ts +124 -0
  291. package/src/server/lib/usage/sources/opencode.server.ts +203 -0
  292. package/src/server/lib/usage/sources/opencode.test.ts +104 -0
  293. package/src/server/lib/usage/sources/qwen.server.ts +122 -0
  294. package/src/server/lib/usage/sources/qwen.test.ts +62 -0
  295. package/src/server/lib/usage/sources/types.ts +53 -0
  296. package/src/server/lib/usage/sources/zcode.server.ts +131 -0
  297. package/src/server/lib/usage/sources/zcode.test.ts +87 -0
  298. package/src/server/routes/agent/harness-command.ts +2 -0
  299. package/src/server/routes/agent/prewarm.ts +7 -2
  300. package/src/server/routes/harness/accounts.test.ts +99 -0
  301. package/src/server/routes/harness/accounts.ts +106 -0
  302. package/src/server/routes/harness/root.ts +13 -1
  303. package/src/server/routes/sessions/local-image.ts +2 -2
  304. package/src/server/routes/telemetry/tokens.test.ts +20 -0
  305. package/src/server/routes/telemetry/tokens.ts +12 -3
  306. package/src/server/routes/tts/speak.test.ts +40 -0
  307. package/src/shared/lib/harness/accounts.test.ts +41 -0
  308. package/src/shared/lib/harness/accounts.ts +175 -0
  309. package/src/shared/lib/icons/tint-hues.generated.ts +26 -25
  310. package/src/shared/lib/markdown/ascii-art.test.ts +154 -0
  311. package/src/shared/lib/markdown/ascii-art.ts +158 -0
  312. package/src/shared/lib/markdown/marked.ts +24 -2
  313. package/src/shared/lib/models/provider/identity.test.ts +34 -0
  314. package/src/shared/lib/models/provider/identity.ts +28 -0
  315. package/src/shared/lib/settings/defaults.ts +2 -0
  316. package/src/shared/lib/tts/engines.test.ts +12 -0
  317. package/src/shared/lib/tts/engines.ts +58 -57
  318. package/src/shared/lib/tts/settings.ts +1 -1
  319. package/src/shared/lib/tts/voices.ts +98 -0
  320. package/src/shared/lib/workspace/right-side-hidden.ts +57 -0
  321. package/src/shared/lib/workspace/session-state/store.ts +7 -5
  322. package/src/shared/types/harness.ts +5 -0
  323. package/src/shared/types/settings/state.ts +12 -0
  324. package/src/shared/types/tokenUsage.ts +21 -0
  325. package/src/test-support/preload.ts +9 -0
  326. package/dist/client/static/js/ImageView-g50pk5pt.js +0 -1
  327. package/dist/client/static/js/MergeDiffView-c4mb8m1w.js +0 -1
  328. package/dist/client/static/js/Modal-pf9p6m1k.js +0 -59
  329. package/dist/client/static/js/architecture-7GRP2DOG-ee9wjsht.js +0 -1
  330. package/dist/client/static/js/architectureDiagram-NJMV4G6O-278nx8rt.js +0 -36
  331. package/dist/client/static/js/bash-36shcpcw.js +0 -1
  332. package/dist/client/static/js/c-kxeqssf9.js +0 -1
  333. package/dist/client/static/js/cose-bilkent-JH36ORCC-ydq7mvy0.js +0 -1
  334. package/dist/client/static/js/cpp-wtk1s3d7.js +0 -1
  335. package/dist/client/static/js/css-0a0r6rp3.js +0 -1
  336. package/dist/client/static/js/css-xhnrhg4e.js +0 -1
  337. package/dist/client/static/js/cynefin-OW5HDTMX-gs16zjqa.js +0 -1
  338. package/dist/client/static/js/eventmodeling-NTZA5JFV-ftz7zrz5.js +0 -1
  339. package/dist/client/static/js/flowDiagram-KWPJA3E3-ax0qfmp3.js +0 -1
  340. package/dist/client/static/js/ganttDiagram-FUAMR5RP-49jd7msz.js +0 -292
  341. package/dist/client/static/js/gitGraph-4MIJSDKK-3rtkds4s.js +0 -1
  342. package/dist/client/static/js/gitGraphDiagram-X574FWY7-5p9mgq7n.js +0 -106
  343. package/dist/client/static/js/graphql-w9ajhndp.js +0 -1
  344. package/dist/client/static/js/html-krfbq5wp.js +0 -1
  345. package/dist/client/static/js/index-05n22cg9.js +0 -4
  346. package/dist/client/static/js/index-2jgx68m0.js +0 -1
  347. package/dist/client/static/js/index-333rq9yy.js +0 -1
  348. package/dist/client/static/js/index-38g2eevc.js +0 -314
  349. package/dist/client/static/js/index-9wc36am3.css +0 -1
  350. package/dist/client/static/js/index-bvpzzhn2.js +0 -4
  351. package/dist/client/static/js/index-e19dbqd3.js +0 -2
  352. package/dist/client/static/js/index-yr3exz70.js +0 -2
  353. package/dist/client/static/js/index-zdw8bd5t.js +0 -2
  354. package/dist/client/static/js/index-zyefab6q.js +0 -1
  355. package/dist/client/static/js/info-A6RAGUB7-vr5mxm6f.js +0 -1
  356. package/dist/client/static/js/ini-zx7x1jj1.js +0 -1
  357. package/dist/client/static/js/java-bbw6kdcr.js +0 -1
  358. package/dist/client/static/js/javascript-p2a8rbpw.js +0 -1
  359. package/dist/client/static/js/json-zh7m2fyg.js +0 -1
  360. package/dist/client/static/js/jsx-3zyyt0eh.js +0 -1
  361. package/dist/client/static/js/lua-d656k76a.js +0 -1
  362. package/dist/client/static/js/markdown-b5w681mm.js +0 -1
  363. package/dist/client/static/js/one-dark-pro-z965dedc.js +0 -1
  364. package/dist/client/static/js/one-light-capdx801.js +0 -1
  365. package/dist/client/static/js/packet-AYTQ26CC-ncb5xxtn.js +0 -1
  366. package/dist/client/static/js/pie-WAS4IAKB-ff8fpvc4.js +0 -1
  367. package/dist/client/static/js/properties-3c6rmnqp.js +0 -1
  368. package/dist/client/static/js/python-a3x3zpv1.js +0 -1
  369. package/dist/client/static/js/quadrantDiagram-O4NWA36T-sz4afnp1.js +0 -7
  370. package/dist/client/static/js/r-7h3gwype.js +0 -1
  371. package/dist/client/static/js/radar-RG4KPBEZ-gbj4b1hf.js +0 -1
  372. package/dist/client/static/js/railroad-74A4TZTK-ndv5tqgr.js +0 -1
  373. package/dist/client/static/js/railroad-abnf-HS5TGJTU-yjzj09s1.js +0 -1
  374. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-e6pw7e5z.js +0 -1
  375. package/dist/client/static/js/railroad-peg-WCYAUIDC-9734dxy4.js +0 -1
  376. package/dist/client/static/js/sql-7a5vavm0.js +0 -1
  377. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-z4pt2kn1.js +0 -8
  378. package/dist/client/static/js/timeline-definition-EJHVYXUP-ezm1c4pz.js +0 -120
  379. package/dist/client/static/js/treeView-Q6P3EWNA-rs10d4p5.js +0 -1
  380. package/dist/client/static/js/treemap-WGGIJYW6-ey6c5x9f.js +0 -1
  381. package/dist/client/static/js/tsx-4a9b8tqf.js +0 -1
  382. package/dist/client/static/js/typescript-kas107wb.js +0 -1
  383. package/dist/client/static/js/vennDiagram-UO4OBE2U-rd5prsf1.js +0 -34
  384. package/dist/client/static/js/wardley-WFR3VGLG-kd9swrdr.js +0 -1
  385. package/dist/client/static/js/xml-3g4bdtpa.js +0 -1
  386. package/dist/client/static/js/yaml-ktxjn917.js +0 -1
@@ -13,6 +13,13 @@
13
13
  * finger, a pointer or a key is the only signal that separates the two, so the
14
14
  * scroller records when one arrived.
15
15
  *
16
+ * POINTER TRAVEL is tracked separately, as ACTIVITY rather than intent. While
17
+ * the reader's hand is on the transcript — moving the pointer to select text,
18
+ * reach a row, hover a control — the stream's follow writes stand down; a tail
19
+ * that keeps moving under the selection is the bug. It is deliberately absent
20
+ * from the input stamp: a layout clamp that moves `scrollTop` while the pointer
21
+ * happens to pass over the transcript is still not the reader scrolling back.
22
+ *
16
23
  * Wired on the scroller NODE (state, not the ref — the surface is swapped in a
17
24
  * commit late), because the event only ever arrives there.
18
25
  */
@@ -20,20 +27,65 @@
20
27
  import type { RefObject } from 'preact/compat';
21
28
  import { useEffect } from 'preact/hooks';
22
29
 
30
+ /** Scroll intent: a rising `scrollTop` that follows one of these is the reader's. */
23
31
  const READER_INPUT_TYPES = ['wheel', 'touchstart', 'touchmove', 'pointerdown', 'keydown'] as const;
32
+ /** Reader presence without scroll intent; see the module header. */
33
+ const READER_ACTIVITY_TYPES = ['pointermove'] as const;
34
+ /** How long after the last input the reader counts as idle again. */
35
+ export const READER_ACTIVITY_IDLE_MS = 600;
24
36
 
25
37
  export function useReaderInputStamp(
26
38
  scrollNode: HTMLDivElement | null,
27
39
  readerInputAtRef: RefObject<number>,
40
+ readerActiveRef: RefObject<boolean>,
28
41
  ): void {
29
42
  useEffect(() => {
30
43
  if (!scrollNode) return;
44
+ // Activity is a window, not a latch: the next chunk after the reader stops
45
+ // moving catches the tail up. A latch would leave a stray pointer pass
46
+ // suppressing the stream for the rest of the run.
47
+ let idle: ReturnType<typeof setTimeout> | undefined;
48
+ // A press keeps the window alive until it is released. A text selection can
49
+ // be dragged past the transcript's edge, where no more `pointermove`
50
+ // reaches this node — an idle timer alone would let the tail jump under the
51
+ // drag after 600 ms.
52
+ let held = false;
53
+ const arm = (): void => {
54
+ clearTimeout(idle);
55
+ idle = setTimeout(() => {
56
+ idle = undefined;
57
+ if (!held) readerActiveRef.current = false;
58
+ }, READER_ACTIVITY_IDLE_MS);
59
+ };
60
+ const active = (): void => {
61
+ readerActiveRef.current = true;
62
+ arm();
63
+ };
64
+ const press = (): void => {
65
+ held = true;
66
+ active();
67
+ };
68
+ const release = (): void => {
69
+ held = false;
70
+ arm();
71
+ };
31
72
  const note = (): void => {
32
73
  readerInputAtRef.current = performance.now();
74
+ active();
33
75
  };
34
76
  for (const type of READER_INPUT_TYPES) scrollNode.addEventListener(type, note, { passive: true });
77
+ for (const type of READER_ACTIVITY_TYPES) scrollNode.addEventListener(type, active, { passive: true });
78
+ scrollNode.addEventListener('pointerdown', press, { passive: true });
79
+ window.addEventListener('pointerup', release);
80
+ window.addEventListener('pointercancel', release);
35
81
  return () => {
36
82
  for (const type of READER_INPUT_TYPES) scrollNode.removeEventListener(type, note);
83
+ for (const type of READER_ACTIVITY_TYPES) scrollNode.removeEventListener(type, active);
84
+ scrollNode.removeEventListener('pointerdown', press);
85
+ window.removeEventListener('pointerup', release);
86
+ window.removeEventListener('pointercancel', release);
87
+ clearTimeout(idle);
88
+ readerActiveRef.current = false;
37
89
  };
38
- }, [scrollNode, readerInputAtRef]);
90
+ }, [scrollNode, readerInputAtRef, readerActiveRef]);
39
91
  }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Auto-follow while the reader is USING the transcript.
8
+ *
9
+ * The stream's tail pin is not allowed to move the viewport under a pointer
10
+ * that is selecting text, hovering a row or reaching for a control. Activity is
11
+ * a window: the first chunk after the pointer goes idle catches the tail up, so
12
+ * a stray pass cannot suppress the rest of the run. The two signals stay
13
+ * separate — pointer travel is ACTIVITY, never scroll intent, or every layout
14
+ * clamp that happened during a hover would read as the reader scrolling back.
15
+ *
16
+ * The follow gate and the idle re-pin live in `scroll.test.ts`; all three files
17
+ * share `scroll-probe.test-util.ts`.
18
+ */
19
+
20
+ import { afterAll, beforeAll, describe, expect, jest as fakeTimers, test } from 'bun:test';
21
+ import type { ScrollProbe } from '@/client/hooks/chat/timeline/scroll-probe.test-util';
22
+
23
+ let p: ScrollProbe;
24
+
25
+ beforeAll(async () => {
26
+ // Dynamic: the harness installs the DOM globals BEFORE Preact and the hooks
27
+ // evaluate, which a static import would pre-empt (see the harness header).
28
+ const { setupScrollProbe } = await import('@/client/hooks/chat/timeline/scroll-probe.test-util');
29
+ p = await setupScrollProbe();
30
+ });
31
+
32
+ afterAll(() => {
33
+ p.teardown();
34
+ });
35
+
36
+ describe('timeline reader activity', () => {
37
+ test('auto-follow waits while the pointer is on the transcript, then catches up', async () => {
38
+ fakeTimers.useFakeTimers();
39
+ try {
40
+ p.scrolled.length = 0;
41
+ p.geometry.top = 0;
42
+ p.geometry.height = 5000;
43
+ p.geometry.viewport = 500;
44
+ const probe = await p.mountProbe('a', [p.message('a1')]);
45
+ const scroll = () => probe.holder.current!;
46
+ await p.act(() => { scroll().jumpToBottom('instant'); });
47
+ await p.flushFrames(8);
48
+ expect(probe.el.scrollTop).toBe(p.geometry.height - p.geometry.viewport);
49
+
50
+ // The pointer moves over the transcript (picking text, hovering a row).
51
+ await p.act(() => { probe.el.dispatchEvent(new Event('pointermove')); });
52
+ p.scrolled.length = 0;
53
+
54
+ // A stream chunk must not pin the tail while the pointer is active.
55
+ p.geometry.height += 400;
56
+ await p.act(() => { scroll().scrollToBottom('instant'); });
57
+ expect(p.scrolled.length).toBe(0);
58
+ expect(probe.el.scrollTop).toBe(5000 - 500);
59
+
60
+ // Nor may content growth do it through the geometry observer.
61
+ p.StubResizeObserver.latest().fire();
62
+ await p.flushFrames(2);
63
+ expect(p.scrolled.length).toBe(0);
64
+ expect(scroll().followRef.current).toBe(true);
65
+
66
+ // A press keeps the gate up past the idle window: a drag that leaves the
67
+ // transcript still owns the viewport.
68
+ await p.act(() => { probe.el.dispatchEvent(new Event('pointerdown')); });
69
+ await p.act(() => { fakeTimers.advanceTimersByTime(700); });
70
+ await p.act(() => { scroll().scrollToBottom('instant'); });
71
+ expect(p.scrolled.length).toBe(0);
72
+
73
+ // Released, then idle: the next chunk catches the tail up.
74
+ await p.act(() => { window.dispatchEvent(new Event('pointerup')); });
75
+ await p.act(() => { fakeTimers.advanceTimersByTime(700); });
76
+ await p.act(() => { scroll().scrollToBottom('instant'); });
77
+ expect(p.scrolled.length).toBe(1);
78
+ expect(probe.el.scrollTop).toBe(p.geometry.height - p.geometry.viewport);
79
+ await p.unmountProbe(probe);
80
+ } finally {
81
+ fakeTimers.useRealTimers();
82
+ }
83
+ });
84
+
85
+ test('pointer travel is activity, never scroll intent', async () => {
86
+ p.scrolled.length = 0;
87
+ p.geometry.top = 0;
88
+ p.geometry.height = 5000;
89
+ p.geometry.viewport = 500;
90
+ const probe = await p.mountProbe('b', [p.message('b1')]);
91
+ const scroll = () => probe.holder.current!;
92
+ await p.act(() => { scroll().jumpToBottom('instant'); });
93
+ expect(scroll().followRef.current).toBe(true);
94
+
95
+ // A measurement replacing an estimate moves the viewport up while the
96
+ // pointer happens to be over the transcript. That is a CLAMP, not the
97
+ // reader taking the viewport back: follow must stay engaged.
98
+ await p.act(() => { probe.el.dispatchEvent(new Event('pointermove')); });
99
+ probe.el.scrollTop = p.geometry.height - p.geometry.viewport - 300;
100
+ expect(scroll().followRef.current).toBe(true);
101
+ await p.unmountProbe(probe);
102
+ });
103
+ });
@@ -49,6 +49,8 @@ export interface TimelineGeometryPinDeps {
49
49
  contentNode: HTMLDivElement | null;
50
50
  /** Pinned to the tail: growth is re-pinned, reading back is left alone. */
51
51
  followRef: RefObject<boolean>;
52
+ /** The reader's hand is on the transcript: automatic pins stand down. */
53
+ readerActiveRef: RefObject<boolean>;
52
54
  /** A jump in flight owns the position; its own watch re-aims. */
53
55
  jumpActiveRef: RefObject<boolean>;
54
56
  /**
@@ -67,6 +69,7 @@ export function useTimelineGeometryPin({
67
69
  scrollNode,
68
70
  contentNode,
69
71
  followRef,
72
+ readerActiveRef,
70
73
  jumpActiveRef,
71
74
  skipTailPinRef,
72
75
  pinToBottom,
@@ -89,7 +92,7 @@ export function useTimelineGeometryPin({
89
92
  syncFollowBottom();
90
93
  return;
91
94
  }
92
- if (containerResized && followRef.current && !jumpActiveRef.current) {
95
+ if (containerResized && followRef.current && !jumpActiveRef.current && !readerActiveRef.current) {
93
96
  pinToBottom('instant');
94
97
  syncFollowBottom();
95
98
  return;
@@ -98,8 +101,10 @@ export function useTimelineGeometryPin({
98
101
  frame = requestAnimationFrame(() => {
99
102
  frame = null;
100
103
  // A jump in flight owns the position: its pin would replace a smooth
101
- // landing with an instant snap on every measurement along the way.
102
- if (followRef.current && !jumpActiveRef.current) pinToBottom('instant');
104
+ // landing with an instant snap on every measurement along the way. The
105
+ // reader's own activity holds it off for the same reason: growth that
106
+ // lands while they select text must not move the text under them.
107
+ if (followRef.current && !jumpActiveRef.current && !readerActiveRef.current) pinToBottom('instant');
103
108
  syncFollowBottom();
104
109
  });
105
110
  });
@@ -109,5 +114,5 @@ export function useTimelineGeometryPin({
109
114
  observer.disconnect();
110
115
  if (frame !== null) cancelAnimationFrame(frame);
111
116
  };
112
- }, [contentNode, scrollNode, followRef, jumpActiveRef, skipTailPinRef, pinToBottom, syncFollowBottom]);
117
+ }, [contentNode, scrollNode, followRef, readerActiveRef, jumpActiveRef, skipTailPinRef, pinToBottom, syncFollowBottom]);
113
118
  }
@@ -23,6 +23,12 @@
23
23
  * the AI generates); scrolling back near the tail, or clicking the scroll-bottom
24
24
  * button, re-engages it. Programmatic jumps (`scrollTo`) never flip the mode.
25
25
  *
26
+ * While the reader's POINTER is on the transcript (moving, pressing, wheeling,
27
+ * touching) the automatic pins stand down for that window — follow resumes with
28
+ * the first chunk after they stop. A tail that keeps scrolling under a text
29
+ * selection or a hover is the bug this prevents; the activity is a window, not
30
+ * a latch, so a stray pointer pass cannot stop the run from following.
31
+ *
26
32
  * Only the READER'S OWN INPUT disengages it — a wheel, a finger, a pointer, a
27
33
  * key (see `reader-input.ts`). An upward `scrollTop` alone is not evidence: the
28
34
  * row window's anchor correction (a row above the viewport measured shorter
@@ -203,6 +209,12 @@ export function useChatTimelineScroll(options: ChatTimelineScrollOptions = {}):
203
209
  // which starts near zero, so a zero sentinel would read as input on the first
204
210
  // moments of a page load.
205
211
  const readerInputAtRef = useRef(Number.NEGATIVE_INFINITY);
212
+ // True while the reader's hand is ON the transcript (pointer travel, press,
213
+ // wheel, touch, key). Every automatic tail pin stands down meanwhile: a tail
214
+ // that keeps moving under a selection or a hover is the bug. It is a window,
215
+ // not a latch — released after `READER_ACTIVITY_IDLE_MS`, so the next chunk
216
+ // catches the tail up instead of suppressing the run to its end.
217
+ const readerActiveRef = useRef(false);
206
218
 
207
219
  const contentRef = useCallback((node: HTMLDivElement | null) => {
208
220
  setContentNode(node);
@@ -277,6 +289,9 @@ export function useChatTimelineScroll(options: ChatTimelineScrollOptions = {}):
277
289
  // Follow-gated: a stream chunk in read mode (user scrolled away) must not
278
290
  // yank the viewport down. jumpToBottom is the explicit bypass.
279
291
  if (!followRef.current) return;
292
+ // The reader is using the transcript right now. Auto-follow only runs while
293
+ // the pointer is idle; the chunk after `READER_ACTIVITY_IDLE_MS` catches up.
294
+ if (readerActiveRef.current) return;
280
295
  pinToBottom(behavior);
281
296
  }, [pinToBottom]);
282
297
 
@@ -298,6 +313,7 @@ export function useChatTimelineScroll(options: ChatTimelineScrollOptions = {}):
298
313
  scrollNode,
299
314
  contentNode,
300
315
  followRef,
316
+ readerActiveRef,
301
317
  jumpActiveRef,
302
318
  skipTailPinRef,
303
319
  pinToBottom,
@@ -305,8 +321,9 @@ export function useChatTimelineScroll(options: ChatTimelineScrollOptions = {}):
305
321
  });
306
322
 
307
323
  // What counts as the reader having taken the viewport back, for
308
- // `handleScroll`'s upward-scroll test (see `reader-input.ts`).
309
- useReaderInputStamp(scrollNode, readerInputAtRef);
324
+ // `handleScroll`'s upward-scroll test (see `reader-input.ts`), and what
325
+ // suspends auto-follow while their pointer is on the transcript.
326
+ useReaderInputStamp(scrollNode, readerInputAtRef, readerActiveRef);
310
327
 
311
328
  useEffect(() => () => {
312
329
  landingRef.current?.stop();
@@ -0,0 +1,143 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Saved-account writes, folded back from the server's answer.
8
+ *
9
+ * The server returns the WHOLE account state after every mutation, because a
10
+ * selection change can also clear a stale row. Patching the local list would
11
+ * let the panel and the next spawn disagree about which home is active.
12
+ */
13
+
14
+ import type { HarnessAccountView } from '@/shared/lib/harness/accounts';
15
+ import { emit, store } from '@/client/hooks/models/harness-catalog';
16
+
17
+ export interface AccountMutationResult {
18
+ error: string | null;
19
+ createdId?: string;
20
+ signedIn?: boolean;
21
+ detail?: string;
22
+ }
23
+
24
+ interface AccountResponse {
25
+ accounts?: HarnessAccountView[];
26
+ selected?: Record<string, string | null>;
27
+ createdId?: string;
28
+ signedIn?: boolean;
29
+ detail?: string;
30
+ error?: string;
31
+ }
32
+
33
+ async function mutate(body: Record<string, unknown>): Promise<AccountMutationResult> {
34
+ try {
35
+ const response = await fetch('/api/harness', {
36
+ method: 'POST',
37
+ headers: { 'Content-Type': 'application/json' },
38
+ body: JSON.stringify({ account: body }),
39
+ });
40
+ const payload = (await response.json()) as AccountResponse;
41
+ if (!response.ok || !payload.accounts) {
42
+ return { error: payload.error ?? `Account update failed (HTTP ${response.status})` };
43
+ }
44
+ const probeChanged = ['create', 'select', 'remove', 'verify'].includes(String(body.op));
45
+ const affected = new Set<string>();
46
+ const prior = typeof body.accountId === 'string'
47
+ ? store.accounts.find((account) => account.id === body.accountId)?.harness
48
+ : undefined;
49
+ if (prior) affected.add(prior);
50
+ if (typeof body.harness === 'string') affected.add(body.harness);
51
+ emit({
52
+ accounts: payload.accounts,
53
+ accountSelection: payload.selected ?? {},
54
+ // The server forgot this harness's probe: the old answer described the
55
+ // previous login. Clearing it here is what makes the card say "not probed"
56
+ // instead of keeping a ready chip beside "Not signed in".
57
+ harnesses: !probeChanged ? store.harnesses : store.harnesses.map((entry) => (
58
+ affected.has(entry.id) ? { ...entry, probe: null } : entry
59
+ )),
60
+ });
61
+ return {
62
+ error: null,
63
+ ...(payload.createdId ? { createdId: payload.createdId } : {}),
64
+ ...(typeof payload.signedIn === 'boolean' ? { signedIn: payload.signedIn } : {}),
65
+ ...(payload.detail ? { detail: payload.detail } : {}),
66
+ };
67
+ } catch (cause) {
68
+ return { error: cause instanceof Error ? cause.message : 'Account update failed' };
69
+ }
70
+ }
71
+
72
+ export function createHarnessAccount(
73
+ harness: string,
74
+ label: string,
75
+ ): Promise<AccountMutationResult> {
76
+ return mutate({ op: 'create', harness, label });
77
+ }
78
+
79
+ export function selectHarnessAccount(
80
+ harness: string,
81
+ accountId: string | null,
82
+ ): Promise<AccountMutationResult> {
83
+ return mutate({ op: 'select', harness, accountId });
84
+ }
85
+
86
+ export function renameHarnessAccount(accountId: string, label: string): Promise<AccountMutationResult> {
87
+ return mutate({ op: 'rename', accountId, label });
88
+ }
89
+
90
+ export function removeHarnessAccount(accountId: string): Promise<AccountMutationResult> {
91
+ return mutate({ op: 'remove', accountId });
92
+ }
93
+
94
+ export function verifyHarnessAccount(accountId: string): Promise<AccountMutationResult> {
95
+ return mutate({ op: 'verify', accountId });
96
+ }
97
+
98
+ export type AccountLoginPhase = 'running' | 'done' | 'error' | 'cancelled';
99
+
100
+ export interface AccountLoginView {
101
+ phase: AccountLoginPhase;
102
+ url: string | null;
103
+ lines: string[];
104
+ error: string | null;
105
+ }
106
+
107
+ export interface AccountLoginResult {
108
+ error: string | null;
109
+ login: AccountLoginView | null;
110
+ }
111
+
112
+ async function loginOp(body: Record<string, unknown>): Promise<AccountLoginResult> {
113
+ try {
114
+ const response = await fetch('/api/harness', {
115
+ method: 'POST',
116
+ headers: { 'Content-Type': 'application/json' },
117
+ body: JSON.stringify({ account: body }),
118
+ });
119
+ const payload = (await response.json()) as { login?: AccountLoginView | null; error?: string };
120
+ if (!response.ok) {
121
+ return { error: payload.error ?? `Sign-in failed (HTTP ${response.status})`, login: null };
122
+ }
123
+ return { error: null, login: payload.login ?? null };
124
+ } catch (cause) {
125
+ return { error: cause instanceof Error ? cause.message : 'Sign-in failed', login: null };
126
+ }
127
+ }
128
+
129
+ export function startAccountLogin(accountId: string): Promise<AccountLoginResult> {
130
+ return loginOp({ op: 'login-start', accountId });
131
+ }
132
+
133
+ export function accountLoginStatus(accountId: string): Promise<AccountLoginResult> {
134
+ return loginOp({ op: 'login-status', accountId });
135
+ }
136
+
137
+ export function submitAccountLoginInput(accountId: string, text: string): Promise<AccountLoginResult> {
138
+ return loginOp({ op: 'login-input', accountId, text });
139
+ }
140
+
141
+ export function cancelAccountLogin(accountId: string): Promise<AccountLoginResult> {
142
+ return loginOp({ op: 'login-cancel', accountId });
143
+ }
@@ -16,12 +16,15 @@
16
16
  import type {
17
17
  HarnessConfig, HarnessProviderSupport, HarnessesPayload, HarnessSummary, LiveHarnessModels,
18
18
  } from '@/shared/types/harness';
19
+ import type { HarnessAccountView } from '@/shared/lib/harness/accounts';
19
20
  import { registerHarnessDescriptors } from '@/shared/lib/harness/catalog';
20
21
 
21
22
  export interface HarnessStore {
22
23
  harnesses: HarnessSummary[];
23
24
  configs: Record<string, HarnessConfig>;
24
25
  providerSupport: Record<string, HarnessProviderSupport>;
26
+ accounts: HarnessAccountView[];
27
+ accountSelection: Record<string, string | null>;
25
28
  liveModels: Record<string, LiveHarnessModels>;
26
29
  isLoading: boolean;
27
30
  error: string | null;
@@ -31,7 +34,8 @@ export interface HarnessStore {
31
34
  }
32
35
 
33
36
  export const store: HarnessStore = {
34
- harnesses: [], configs: {}, providerSupport: {}, liveModels: {}, isLoading: true, error: null, version: 0,
37
+ harnesses: [], configs: {}, providerSupport: {}, accounts: [], accountSelection: {},
38
+ liveModels: {}, isLoading: true, error: null, version: 0,
35
39
  };
36
40
  /** Has the catalog been read at least once? A later mount must NOT re-fetch: the
37
41
  * answer is a property of the installed agents, and `reload()` is the explicit
@@ -94,6 +98,8 @@ export async function loadCatalog(): Promise<void> {
94
98
  // empty map is the honest reading, and every card then shows "not set".
95
99
  configs: payload.configs ?? {},
96
100
  providerSupport: payload.providerSupport ?? {},
101
+ accounts: payload.accounts ?? [],
102
+ accountSelection: payload.accountSelection ?? {},
97
103
  error: null,
98
104
  isLoading: false,
99
105
  });
@@ -123,7 +129,8 @@ export function resetHarnessesStore(): void {
123
129
  inflight = null;
124
130
  loaded = false;
125
131
  Object.assign(store, {
126
- harnesses: [], configs: {}, providerSupport: {}, liveModels: {}, isLoading: true, error: null, version: 0,
132
+ harnesses: [], configs: {}, providerSupport: {}, accounts: [], accountSelection: {},
133
+ liveModels: {}, isLoading: true, error: null, version: 0,
127
134
  });
128
135
  for (const listener of listeners) listener();
129
136
  }
@@ -13,6 +13,8 @@
13
13
  import type {
14
14
  HarnessConfig, HarnessImportOutcome, HarnessProviderSupport, HarnessSessionImport, HarnessSummary, LiveHarnessModels,
15
15
  } from '@/shared/types/harness';
16
+ import type { HarnessAccountView } from '@/shared/lib/harness/accounts';
17
+ import type { AccountMutationResult } from '@/client/hooks/models/harness-accounts';
16
18
  import type { AddProviderInput } from '@/client/components/settings/categories/harness-settings/AddProviderForm';
17
19
 
18
20
  export interface HarnessesController {
@@ -23,6 +25,16 @@ export interface HarnessesController {
23
25
  saveConfig: (id: string, config: HarnessConfig) => Promise<string | null>;
24
26
  /** What each harness can do about other providers, keyed by id. */
25
27
  providerSupport: Record<string, HarnessProviderSupport>;
28
+ /** Saved CLI homes for Codex, Claude and Antigravity. */
29
+ accounts: HarnessAccountView[];
30
+ /** harness id -> selected account id; null means the host login. */
31
+ accountSelection: Record<string, string | null>;
32
+ /** Create an isolated home and return its id, or the server's refusal. */
33
+ createAccount: (harness: string, label: string) => Promise<AccountMutationResult>;
34
+ selectAccount: (harness: string, accountId: string | null) => Promise<AccountMutationResult>;
35
+ renameAccount: (accountId: string, label: string) => Promise<AccountMutationResult>;
36
+ removeAccount: (accountId: string) => Promise<AccountMutationResult>;
37
+ verifyAccount: (accountId: string) => Promise<AccountMutationResult>;
26
38
  /**
27
39
  * The model/thinking selectors a harness's LIVE chat published, keyed by id.
28
40
  *
@@ -28,6 +28,13 @@ import {
28
28
  emit, invalidateCatalog, listeners, loadCatalog, store,
29
29
  } from '@/client/hooks/models/harness-catalog';
30
30
  import { addProvider, importProvider } from '@/client/hooks/models/provider-writes';
31
+ import {
32
+ createHarnessAccount,
33
+ removeHarnessAccount,
34
+ renameHarnessAccount,
35
+ selectHarnessAccount,
36
+ verifyHarnessAccount,
37
+ } from '@/client/hooks/models/harness-accounts';
31
38
  import { subscribeModelsUpdated } from '@/shared/lib/models/client';
32
39
 
33
40
  /**
@@ -279,6 +286,13 @@ export function useHarnesses({ enabled = true }: UseHarnessesOptions = {}): Harn
279
286
  configs: snapshot.configs,
280
287
  saveConfig: saveHarnessConfig,
281
288
  providerSupport: snapshot.providerSupport,
289
+ accounts: snapshot.accounts,
290
+ accountSelection: snapshot.accountSelection,
291
+ createAccount: createHarnessAccount,
292
+ selectAccount: selectHarnessAccount,
293
+ renameAccount: renameHarnessAccount,
294
+ removeAccount: removeHarnessAccount,
295
+ verifyAccount: verifyHarnessAccount,
282
296
  liveModels: snapshot.liveModels,
283
297
  importProvider: (id, sourceId, entry) => importProvider(id, sourceId, entry, announceProviderWrite),
284
298
  addProvider: (id, input) => addProvider(id, input, announceProviderWrite),
@@ -0,0 +1,132 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The Usage panel's "hide providers without quota" preference.
8
+ *
9
+ * Two things a wrong implementation gets silently:
10
+ *
11
+ * - Only the literal boolean `true` hides. `app_settings` stores a scalar as
12
+ * TEXT (`writeSettingsRaw` holds `String(value)`), and the reader JSON-parses
13
+ * it with the raw string as the fallback, so a truthiness test would hide the
14
+ * panel's empty rows for a hand-written `"yes"` no one ever toggled.
15
+ * - The write is the shared top-level patch (`writeSetting`), the route the
16
+ * sidebar's width takes. A blob write would republish keys this page only
17
+ * read, which is what drops a preference another tab changed meanwhile.
18
+ */
19
+
20
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
21
+ import { Window } from 'happy-dom';
22
+ import { h, render } from 'preact';
23
+ import { act } from 'preact/test-utils';
24
+ import {
25
+ HIDE_EMPTY_PROVIDERS_SETTING_KEY,
26
+ currentHideEmptyProviders,
27
+ useHideEmptyProviders,
28
+ } from '@/client/hooks/settings/hide-empty-providers';
29
+ import { primeKabmoSettings, readKabmoSetting } from '@/shared/lib/settings/client';
30
+
31
+ const DOM_GLOBALS = ['window', 'document', 'fetch'] as const;
32
+ const nativeGlobals: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
33
+ /** Every settings patch the hook POSTed, in order. */
34
+ let posts: Record<string, unknown>[] = [];
35
+
36
+ beforeAll(() => {
37
+ const win = new Window({ url: 'http://localhost' });
38
+ const target = globalThis as unknown as Record<string, unknown>;
39
+ for (const key of DOM_GLOBALS) {
40
+ if (!(key in nativeGlobals)) nativeGlobals[key] = target[key];
41
+ target[key] = (win as unknown as Record<string, unknown>)[key];
42
+ }
43
+ target.fetch = (async (_input: unknown, init?: RequestInit) => {
44
+ posts.push(JSON.parse(String(init?.body ?? '{}')));
45
+ return Response.json({ success: true });
46
+ }) as unknown as typeof fetch;
47
+ });
48
+
49
+ afterAll(() => {
50
+ const target = globalThis as unknown as Record<string, unknown>;
51
+ for (const key of DOM_GLOBALS) target[key] = nativeGlobals[key];
52
+ });
53
+
54
+ afterEach(() => {
55
+ posts = [];
56
+ primeKabmoSettings({});
57
+ });
58
+
59
+ /** The panel's own control, reduced to what this module owns. */
60
+ function Toggle() {
61
+ const [hide, setHide] = useHideEmptyProviders();
62
+ return h('button', { 'aria-pressed': String(hide), onClick: () => setHide(!hide) }, 'toggle');
63
+ }
64
+
65
+ async function mountToggle(): Promise<{ container: HTMLElement; button: HTMLButtonElement }> {
66
+ const container = document.createElement('div');
67
+ document.body.appendChild(container);
68
+ await act(async () => render(h(Toggle, {}), container));
69
+ const button = container.querySelector<HTMLButtonElement>('button');
70
+ if (!button) throw new Error('the toggle did not render');
71
+ return { container, button };
72
+ }
73
+
74
+ describe('currentHideEmptyProviders', () => {
75
+ test('nothing stored means the empty rows are hidden', () => {
76
+ expect(currentHideEmptyProviders()).toBe(true);
77
+ expect(currentHideEmptyProviders({})).toBe(true);
78
+ });
79
+
80
+ test('only the literal false shows them again', () => {
81
+ // The primed snapshot is what `readKabmoSetting` answers from at runtime, so
82
+ // the boot payload is how a stored value reaches this predicate.
83
+ primeKabmoSettings({ [HIDE_EMPTY_PROVIDERS_SETTING_KEY]: false });
84
+ expect(currentHideEmptyProviders()).toBe(false);
85
+ primeKabmoSettings({ [HIDE_EMPTY_PROVIDERS_SETTING_KEY]: true });
86
+ expect(currentHideEmptyProviders()).toBe(true);
87
+ // A stored scalar survives as the raw string when the row is not JSON, and
88
+ // it must not flip the panel's default either way.
89
+ primeKabmoSettings({ [HIDE_EMPTY_PROVIDERS_SETTING_KEY]: 'false' });
90
+ expect(currentHideEmptyProviders()).toBe(true);
91
+ primeKabmoSettings({ [HIDE_EMPTY_PROVIDERS_SETTING_KEY]: 'yes' });
92
+ expect(currentHideEmptyProviders()).toBe(true);
93
+ });
94
+ });
95
+
96
+ describe('useHideEmptyProviders', () => {
97
+ test('a fresh install renders the control already pressed', async () => {
98
+ const { container, button } = await mountToggle();
99
+ expect(button.getAttribute('aria-pressed')).toBe('true');
100
+
101
+ await act(async () => render(null, container));
102
+ container.remove();
103
+ });
104
+
105
+ test('a stored false is drawn on the first render, with no flash of the default', async () => {
106
+ primeKabmoSettings({ [HIDE_EMPTY_PROVIDERS_SETTING_KEY]: false });
107
+ const { container, button } = await mountToggle();
108
+ expect(button.getAttribute('aria-pressed')).toBe('false');
109
+
110
+ await act(async () => render(null, container));
111
+ container.remove();
112
+ });
113
+
114
+ test('showing the empty rows persists the literal false under the top-level key', async () => {
115
+ const { container, button } = await mountToggle();
116
+
117
+ await act(async () => button.click());
118
+ expect(button.getAttribute('aria-pressed')).toBe('false');
119
+ expect(posts).toEqual([{ [HIDE_EMPTY_PROVIDERS_SETTING_KEY]: false }]);
120
+ expect(readKabmoSetting(HIDE_EMPTY_PROVIDERS_SETTING_KEY)).toBe(false);
121
+
122
+ await act(async () => button.click());
123
+ expect(button.getAttribute('aria-pressed')).toBe('true');
124
+ expect(posts).toEqual([
125
+ { [HIDE_EMPTY_PROVIDERS_SETTING_KEY]: false },
126
+ { [HIDE_EMPTY_PROVIDERS_SETTING_KEY]: true },
127
+ ]);
128
+
129
+ await act(async () => render(null, container));
130
+ container.remove();
131
+ });
132
+ });