@kabmo-labs/kabmo 0.42.2 → 0.43.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 (412) hide show
  1. package/README.md +1 -1
  2. package/dist/client/index.html +1 -1
  3. package/dist/client/index.js +721 -675
  4. package/dist/client/static/js/{CsvGrid-g6rek8y9.js → CsvGrid-g67pk2zy.js} +2 -2
  5. package/dist/client/static/js/{DocxView-41t9ryws.js → DocxView-pyh6p2kb.js} +4 -4
  6. package/dist/client/static/js/{DrawioView-mfxhfz1h.js → DrawioView-g48r6y2m.js} +2 -2
  7. package/dist/client/static/js/ImageView-rnzf5tve.js +1 -0
  8. package/dist/client/static/js/LayoutWrapper-rekrgth6.js +2 -0
  9. package/dist/client/static/js/Modal-edw446r8.js +59 -0
  10. package/dist/client/static/js/{PdfView-bek8k888.js → PdfView-6z3cgj37.js} +1 -1
  11. package/dist/client/static/js/SessionsView-e84tjbcr.js +1 -0
  12. package/dist/client/static/js/{SheetView-vezssf6b.js → SheetView-64076z1j.js} +13 -13
  13. package/dist/client/static/js/{SvgPreview-f1qaw73k.js → SvgPreview-dmpgavgd.js} +1 -1
  14. package/dist/client/static/js/{abnfDiagram-O67JEVCF-4qn94h52.js → abnfDiagram-O67JEVCF-nfz5z1vw.js} +1 -1
  15. package/dist/client/static/js/architecture-7GRP2DOG-7j23x20s.js +1 -0
  16. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-tbewzdya.js → architectureDiagram-NJMV4G6O-jra2jyzw.js} +11 -11
  17. package/dist/client/static/js/{astro-nn7xg0we.js → astro-dpfdhc5e.js} +1 -1
  18. package/dist/client/static/js/bash-vv2ysp0a.js +1 -0
  19. package/dist/client/static/js/{blockDiagram-BEXU5L5S-njgnwckz.js → blockDiagram-BEXU5L5S-3szktxam.js} +7 -7
  20. package/dist/client/static/js/c-8jf64j6h.js +1 -0
  21. package/dist/client/static/js/{c4Diagram-YGBWAQC7-f58pcvbk.js → c4Diagram-YGBWAQC7-xe9vbppt.js} +6 -6
  22. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-52g73vyw.js → classDiagram-v2-NBCMYWYE-egzhj1xn.js} +6 -6
  23. package/dist/client/static/js/{cose-bilkent-JH36ORCC-ptdnshzh.js → cose-bilkent-JH36ORCC-dfrk1wnr.js} +1 -1
  24. package/dist/client/static/js/cpp-vh94zee0.js +1 -0
  25. package/dist/client/static/js/css-p57h1fme.js +1 -0
  26. package/dist/client/static/js/cynefin-OW5HDTMX-me5xnx6a.js +1 -0
  27. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-qabfdkzr.js → cynefinDiagram-VND7K2PF-xefpcmpg.js} +2 -2
  28. package/dist/client/static/js/{dagre-6A5THRUB-kyf5jetf.js → dagre-6A5THRUB-vtzjnrt9.js} +2 -2
  29. package/dist/client/static/js/{diagram-22UHCM2B-bxrsjtv9.js → diagram-22UHCM2B-4vvn790v.js} +16 -16
  30. package/dist/client/static/js/{diagram-3UASUU5V-0f41s00j.js → diagram-3UASUU5V-tmht3bew.js} +1 -1
  31. package/dist/client/static/js/{diagram-ATOU4E4O-0z1zx9h1.js → diagram-ATOU4E4O-p5wa5ztx.js} +3 -3
  32. package/dist/client/static/js/{diagram-CDSNMT55-znrmr6bk.js → diagram-CDSNMT55-8myesjfc.js} +5 -5
  33. package/dist/client/static/js/{diagram-MLGK6HIB-jfe2jhk0.js → diagram-MLGK6HIB-9t3x2d5f.js} +2 -2
  34. package/dist/client/static/js/{diagram-MPIPVDR6-2kaawmwa.js → diagram-MPIPVDR6-8ahgnmhy.js} +3 -3
  35. package/dist/client/static/js/{dockerfile-12exatm9.js → dockerfile-x8aa0543.js} +1 -1
  36. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-s5n37rfp.js → ebnfDiagram-ZINNZB2B-5semw111.js} +1 -1
  37. package/dist/client/static/js/{elixir-szk51ehr.js → elixir-5ewfhvfh.js} +1 -1
  38. package/dist/client/static/js/{elk-276RUBZZ-433rd9fp.js → elk-276RUBZZ-jmhs58ww.js} +1 -1
  39. package/dist/client/static/js/{erDiagram-OPXOYQCR-key6ah0b.js → erDiagram-OPXOYQCR-31wvbpdr.js} +8 -8
  40. package/dist/client/static/js/{erlang-zwy7cqdk.js → erlang-jqqa3ehb.js} +1 -1
  41. package/dist/client/static/js/eventmodeling-NTZA5JFV-5zbvjj84.js +1 -0
  42. package/dist/client/static/js/flowDiagram-KWPJA3E3-36ygrbvm.js +1 -0
  43. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-4efkhmca.js → ganttDiagram-FUAMR5RP-c2dycjrf.js} +6 -6
  44. package/dist/client/static/js/gitGraph-4MIJSDKK-tjhkv71w.js +1 -0
  45. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ac376y2k.js → gitGraphDiagram-X574FWY7-y4k4pdd8.js} +14 -14
  46. package/dist/client/static/js/graphql-kesh8gk0.js +1 -0
  47. package/dist/client/static/js/html-sxpfydga.js +1 -0
  48. package/dist/client/static/js/{index-e1yz59fa.js → index-0c6vpk89.js} +2 -2
  49. package/dist/client/static/js/{index-0pabfaac.js → index-0q2qfcjn.js} +1 -1
  50. package/dist/client/static/js/{index-p0ez6hqd.js → index-181p91hf.js} +1 -1
  51. package/dist/client/static/js/{index-zs73zwjz.js → index-2b46dzw8.js} +4 -4
  52. package/dist/client/static/js/{index-02543wk3.js → index-2cbnjc32.js} +2 -2
  53. package/dist/client/static/js/{index-7a2efrbj.js → index-3588r3wg.js} +2 -2
  54. package/dist/client/static/js/{index-4cncqz8j.js → index-38v0781h.js} +2 -2
  55. package/dist/client/static/js/{index-z78bzryw.js → index-48gh56ka.js} +3 -3
  56. package/dist/client/static/js/{index-0e9nkc0g.js → index-48pb18zj.js} +2 -2
  57. package/dist/client/static/js/{index-77t0nvt1.js → index-4rv388z7.js} +2 -2
  58. package/dist/client/static/js/index-52xmdeh2.js +1 -0
  59. package/dist/client/static/js/{index-5jnvz9hw.js → index-6fpd55cq.js} +2 -2
  60. package/dist/client/static/js/{index-nh29fkk9.js → index-7dp90ad1.js} +2 -2
  61. package/dist/client/static/js/{index-yzda8j2d.js → index-8kqepehd.js} +12 -12
  62. package/dist/client/static/js/{index-raca8tsh.js → index-aar68x31.js} +4 -4
  63. package/dist/client/static/js/{index-pxtff3ez.js → index-bvjct7sp.js} +2 -2
  64. package/dist/client/static/js/{index-cz50ha6x.js → index-cgzw43bc.js} +78 -78
  65. package/dist/client/static/js/{index-50mdqev0.js → index-cje5gg45.js} +1 -1
  66. package/dist/client/static/js/{index-zndbhb9w.js → index-cjhvtzdd.js} +2 -2
  67. package/dist/client/static/js/{index-8b3t2y77.js → index-cqnpsw2m.js} +2 -2
  68. package/dist/client/static/js/{index-r9db1gsf.js → index-dkwhs38j.js} +2 -2
  69. package/dist/client/static/js/{index-pkes9492.js → index-e7yf273s.js} +2 -2
  70. package/dist/client/static/js/{index-8kbp24xg.js → index-efra065v.js} +1 -1
  71. package/dist/client/static/js/index-f77c3ag0.js +479 -0
  72. package/dist/client/static/js/{index-yjmm73jm.js → index-f7djda1g.js} +2 -2
  73. package/dist/client/static/js/{index-8k7vjp8b.js → index-fbcg8y95.js} +1 -1
  74. package/dist/client/static/js/{index-pysqpc5n.js → index-fg965t62.js} +2 -2
  75. package/dist/client/static/js/{index-qsw5edtk.js → index-fjnkzk12.js} +5 -5
  76. package/dist/client/static/js/{index-s4gv0rpk.js → index-g3shdymf.js} +1 -1
  77. package/dist/client/static/js/{index-qx6x4z0y.js → index-gmnmnfm0.js} +2 -2
  78. package/dist/client/static/js/{index-gp57dx2v.js → index-h5n1btqy.js} +1 -1
  79. package/dist/client/static/js/{index-r8cc80w5.js → index-jz93j0at.js} +2 -2
  80. package/dist/client/static/js/{index-dtj73vs1.js → index-kc5znr75.js} +2 -2
  81. package/dist/client/static/js/index-m1n4v0z7.js +9 -0
  82. package/dist/client/static/js/{index-1t5ybx9v.js → index-m94f4ngb.js} +3 -3
  83. package/dist/client/static/js/{index-dfqmwm7j.js → index-m9s9rg5k.js} +2 -2
  84. package/dist/client/static/js/{index-gsxebrq9.js → index-n9scbxy5.js} +2 -2
  85. package/dist/client/static/js/{index-zs7sjv6x.js → index-nt7nhchn.js} +1 -1
  86. package/dist/client/static/js/{index-v3f7we4n.js → index-pt8440xh.js} +22 -22
  87. package/dist/client/static/js/{index-b42t14wk.js → index-q81rxwh7.js} +35 -35
  88. package/dist/client/static/js/{index-ktbrmp29.js → index-qhytrsyb.js} +2 -2
  89. package/dist/client/static/js/index-rn8w29pv.js +2 -0
  90. package/dist/client/static/js/{index-1y3rzw6b.js → index-s00j9042.js} +1 -1
  91. package/dist/client/static/js/{index-hga3e13s.js → index-s78n0dtv.js} +2 -2
  92. package/dist/client/static/js/index-s7rfbydk.js +4 -0
  93. package/dist/client/static/js/{index-03pyvmcz.js → index-sesghshh.js} +2 -2
  94. package/dist/client/static/js/{index-ykfd2fyj.js → index-sg6sz3g8.js} +1 -1
  95. package/dist/client/static/js/index-vcrh95gf.css +1 -0
  96. package/dist/client/static/js/{index-82vk27q1.js → index-vyw4tbn8.js} +2 -2
  97. package/dist/client/static/js/{index-dzmar8jr.js → index-w5rw8f7w.js} +1 -1
  98. package/dist/client/static/js/{index-f33c4paw.js → index-x6v37h3j.js} +1 -1
  99. package/dist/client/static/js/{index-b0v6gwym.js → index-ycks7gyg.js} +2 -2
  100. package/dist/client/static/js/{index-hw14rhen.js → index-ynaxep06.js} +2 -2
  101. package/dist/client/static/js/{index-rab39785.js → index-ys0xpw3q.js} +2 -2
  102. package/dist/client/static/js/{index-feffxxss.js → index-yvgbr7ek.js} +2 -2
  103. package/dist/client/static/js/info-A6RAGUB7-m6qz24p8.js +1 -0
  104. package/dist/client/static/js/{infoDiagram-VRGFBTTK-4e7ej63f.js → infoDiagram-VRGFBTTK-z3pqx7w8.js} +1 -1
  105. package/dist/client/static/js/ini-1x0ad976.js +1 -0
  106. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-k3yet1ec.js → ishikawaDiagram-OU5B5YK6-f5v6z8yr.js} +4 -4
  107. package/dist/client/static/js/java-3944nq02.js +1 -0
  108. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-qe352kyd.js → journeyDiagram-ZHPQQLJL-js1yxatk.js} +5 -5
  109. package/dist/client/static/js/json-g5ggnd94.js +1 -0
  110. package/dist/client/static/js/jsx-f6p72qpc.js +1 -0
  111. package/dist/client/static/js/{julia-2eekpjq8.js → julia-0h9krgsd.js} +1 -1
  112. package/dist/client/static/js/{kanban-definition-PNTS6WVX-58hag75n.js → kanban-definition-PNTS6WVX-m0a6069c.js} +5 -5
  113. package/dist/client/static/js/lua-edn2b3wn.js +1 -0
  114. package/dist/client/static/js/markdown-9dhg1fax.js +1 -0
  115. package/dist/client/static/js/{mermaid.core-6e89h6vm.js → mermaid.core-6xvbnm63.js} +6 -6
  116. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-ncsam2fm.js → mindmap-definition-NLK3R4M7-a9f9yzc0.js} +4 -4
  117. package/dist/client/static/js/one-dark-pro-hteqzfb0.js +1 -0
  118. package/dist/client/static/js/one-light-dapnh0rs.js +1 -0
  119. package/dist/client/static/js/packet-AYTQ26CC-ng6wq5xj.js +1 -0
  120. package/dist/client/static/js/{pegDiagram-GJSIUBJH-b5ckc39d.js → pegDiagram-GJSIUBJH-4v4pf1h1.js} +1 -1
  121. package/dist/client/static/js/{perl-dtn1fccw.js → perl-rptyx23q.js} +1 -1
  122. package/dist/client/static/js/{php-7av78hch.js → php-sagvq3wz.js} +1 -1
  123. package/dist/client/static/js/pie-WAS4IAKB-rf6jhxf6.js +1 -0
  124. package/dist/client/static/js/{pieDiagram-5QR66LMP-s4d47ve8.js → pieDiagram-5QR66LMP-a54yrmfm.js} +3 -3
  125. package/dist/client/static/js/properties-fcmj08pv.js +1 -0
  126. package/dist/client/static/js/python-532d8ezm.js +1 -0
  127. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-zm0ekvjz.js → quadrantDiagram-O4NWA36T-1twhvnp2.js} +6 -6
  128. package/dist/client/static/js/r-ptmdxs2a.js +1 -0
  129. package/dist/client/static/js/radar-RG4KPBEZ-ygp6hxq4.js +1 -0
  130. package/dist/client/static/js/railroad-74A4TZTK-rxgnrb2g.js +1 -0
  131. package/dist/client/static/js/railroad-abnf-HS5TGJTU-xkv52a2p.js +1 -0
  132. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-bvcktbqh.js +1 -0
  133. package/dist/client/static/js/railroad-peg-WCYAUIDC-9c3v7jsq.js +1 -0
  134. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-52vdqf53.js → railroadDiagram-XR7U4H2S-83tqfdcy.js} +1 -1
  135. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-7kf8bmk9.js → requirementDiagram-PLB6GJNP-73e3pzw6.js} +4 -4
  136. package/dist/client/static/js/{ruby-s2bqr910.js → ruby-9qyx7knh.js} +1 -1
  137. package/dist/client/static/js/{rust-q98kssv3.js → rust-jds4e4r7.js} +1 -1
  138. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-bcb9f54a.js → sankeyDiagram-IPEJSGJF-1bzwj6sb.js} +6 -6
  139. package/dist/client/static/js/{sass-bm32bb5k.js → sass-07rteya0.js} +1 -1
  140. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-76ywvj7g.js → sequenceDiagram-PO4LG4MO-yh3h988k.js} +19 -19
  141. package/dist/client/static/js/{sizeCapture-INFHLROL-p9bsf5dc.js → sizeCapture-INFHLROL-1n121yp6.js} +1 -1
  142. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-1ecfb3fs.js → stateDiagram-v2-GCMORJYK-0tdrzn06.js} +6 -6
  143. package/dist/client/static/js/{svelte-ztkaww47.js → svelte-w365cpwa.js} +1 -1
  144. package/dist/client/static/js/{swimlanes-2SLR337P-2pyjr946.js → swimlanes-2SLR337P-77n1ttdw.js} +1 -1
  145. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-akjqm31r.js +8 -0
  146. package/dist/client/static/js/{timeline-definition-EJHVYXUP-4csxwmn2.js → timeline-definition-EJHVYXUP-b6r0k3e8.js} +2 -2
  147. package/dist/client/static/js/treeView-Q6P3EWNA-fb58a7z1.js +1 -0
  148. package/dist/client/static/js/treemap-WGGIJYW6-ej4qhksx.js +1 -0
  149. package/dist/client/static/js/typescript-683kkkaw.js +1 -0
  150. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-0p1jnbsn.js → usecaseDiagram-POWQR4AR-efq58m3m.js} +43 -43
  151. package/dist/client/static/js/{vennDiagram-UO4OBE2U-y1hgdet4.js → vennDiagram-UO4OBE2U-ad4gvd5r.js} +5 -5
  152. package/dist/client/static/js/{vue-cbqm4bed.js → vue-d6cesny1.js} +1 -1
  153. package/dist/client/static/js/wardley-WFR3VGLG-mkp0kanv.js +1 -0
  154. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-p578yrgm.js → wardleyDiagram-VNRHLVJA-v89tys2p.js} +4 -4
  155. package/dist/client/static/js/xml-6ct32gys.js +1 -0
  156. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-b08b4ah0.js → xychartDiagram-PMCCYNJV-xtgzmknw.js} +5 -5
  157. package/dist/client/static/js/yaml-1d5m3bfj.js +1 -0
  158. package/marketplace/plugins/command-runner/package.json +2 -2
  159. package/marketplace/plugins/command-runner/src/app.test.tsx +161 -0
  160. package/marketplace/plugins/command-runner/src/app.tsx +37 -3
  161. package/marketplace/plugins/command-runner/src/panel/Glyph.tsx +22 -4
  162. package/marketplace/plugins/git-forge/package.json +2 -2
  163. package/marketplace/plugins/git-forge/src/panel/Glyph.tsx +22 -3
  164. package/marketplace/plugins/git-forge/src/panel/index.tsx +21 -3
  165. package/marketplace/plugins/git-forge/src/panel/refresh.test.tsx +192 -0
  166. package/marketplace/plugins/git-forge/src/panel/use-forge.ts +4 -2
  167. package/marketplace/plugins/git-forge/src/panel/write.test.tsx +21 -0
  168. package/marketplace/plugins/stats/package.json +2 -2
  169. package/marketplace/plugins/stats/src/RefreshButton.tsx +9 -7
  170. package/marketplace/plugins/stats/src/app.tsx +15 -1
  171. package/marketplace/plugins/stats/src/refresh.test.tsx +166 -0
  172. package/package.json +1 -1
  173. package/src/client/components/common/anchored-menu/index.tsx +26 -8
  174. package/src/client/components/common/context-usage-button/McpSection.test.tsx +34 -5
  175. package/src/client/components/common/context-usage-button/McpSection.tsx +25 -3
  176. package/src/client/components/common/harness-glyph/brands.ts +3 -0
  177. package/src/client/components/common/harness-glyph/omo.ts +22 -0
  178. package/src/client/components/common/server-control/Panel.tsx +24 -86
  179. package/src/client/components/common/server-control/Row.tsx +98 -0
  180. package/src/client/components/common/server-control/index.test.tsx +69 -9
  181. package/src/client/components/layout/VisibilityMenu.tsx +18 -6
  182. package/src/client/components/layout/new-workspace-host/index.test.tsx +84 -0
  183. package/src/client/components/layout/new-workspace-host/index.tsx +35 -0
  184. package/src/client/components/mobile/header-titlebar.test.tsx +38 -3
  185. package/src/client/components/settings/Sidebar.tsx +2 -1
  186. package/src/client/components/settings/categories/GitSettings.tsx +31 -0
  187. package/src/client/components/settings/categories/git-settings/CommitMessageSection.tsx +292 -0
  188. package/src/client/components/settings/categories/git-settings/IdentitySection.tsx +215 -0
  189. package/src/client/components/settings/category-content.tsx +3 -0
  190. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +8 -0
  191. package/src/client/components/workspace/chat-timeline/MessageList.test.ts +55 -2
  192. package/src/client/components/workspace/chat-timeline/MessageList.tsx +13 -1
  193. package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +56 -50
  194. package/src/client/components/workspace/chat-timeline/ThinkingSection.test.tsx +38 -2
  195. package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +13 -1
  196. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +50 -0
  197. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +20 -1
  198. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +21 -9
  199. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +2 -1
  200. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +1 -4
  201. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +18 -4
  202. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +3 -2
  203. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +47 -0
  204. package/src/client/components/workspace/git-panel/CommitBox.test.tsx +98 -0
  205. package/src/client/components/workspace/git-panel/CommitBox.tsx +68 -3
  206. package/src/client/components/workspace/git-panel/index.test.ts +12 -0
  207. package/src/client/components/workspace/git-panel/index.tsx +20 -1
  208. package/src/client/components/workspace/repo-picker/index.test.tsx +20 -0
  209. package/src/client/components/workspace/repo-picker/index.tsx +5 -6
  210. package/src/client/data/settings/omp-schema.json +134 -8
  211. package/src/client/hooks/chat/context/mcp.ts +19 -1
  212. package/src/client/hooks/chat/omp/index.ts +2 -6
  213. package/src/client/hooks/chat/timeline/jump-rail.ts +1 -0
  214. package/src/client/hooks/chat/timeline/row-window.test.ts +38 -3
  215. package/src/client/hooks/chat/timeline/row-window.ts +33 -9
  216. package/src/client/hooks/chat/timeline/scroll-geometry.ts +19 -1
  217. package/src/client/hooks/chat/timeline/scroll.ts +15 -0
  218. package/src/client/hooks/chat/timeline/thinking-open.ts +10 -4
  219. package/src/client/hooks/workspace/commit-box.test.ts +62 -1
  220. package/src/client/hooks/workspace/commit-box.ts +94 -2
  221. package/src/client/hooks/workspace/git-panel-data.ts +15 -7
  222. package/src/client/hooks/workspace/repo-scope/index.test.ts +10 -3
  223. package/src/client/hooks/workspace/repo-scope/index.ts +21 -9
  224. package/src/client/lib/plugins/repo-scope-service.ts +7 -25
  225. package/src/server/lib/changes/capture-client-write.server.ts +45 -0
  226. package/src/server/lib/changes/capture.server.ts +20 -5
  227. package/src/server/lib/chat/session-store.server.ts +22 -1
  228. package/src/server/lib/db/schema.ts +3 -0
  229. package/src/server/lib/fs/git-commit-context.test.ts +111 -0
  230. package/src/server/lib/fs/git-commit-context.ts +85 -0
  231. package/src/server/lib/fs/git-commit-message.server.ts +251 -0
  232. package/src/server/lib/fs/git-commit-message.test.ts +211 -0
  233. package/src/server/lib/fs/git-commit-prompt.test.ts +69 -0
  234. package/src/server/lib/fs/git-commit-prompt.ts +57 -0
  235. package/src/server/lib/fs/git-commit-settings.server.ts +42 -0
  236. package/src/server/lib/fs/git-identity.server.test.ts +129 -0
  237. package/src/server/lib/fs/git-identity.server.ts +130 -0
  238. package/src/server/lib/harness/acp/acp-audit.server.ts +13 -62
  239. package/src/server/lib/harness/acp/acp-frames.server.test.ts +105 -0
  240. package/src/server/lib/harness/acp/acp-frames.server.ts +217 -0
  241. package/src/server/lib/harness/acp/acp-raw-messages.server.test.ts +69 -0
  242. package/src/server/lib/harness/acp/acp-raw-messages.server.ts +129 -0
  243. package/src/server/lib/harness/acp/acp-telemetry.server.ts +19 -0
  244. package/src/server/lib/harness/acp/auth.test.ts +69 -0
  245. package/src/server/lib/harness/acp/auth.ts +71 -0
  246. package/src/server/lib/harness/acp/background-replay.test.ts +139 -0
  247. package/src/server/lib/harness/acp/background-replay.ts +87 -0
  248. package/src/server/lib/harness/acp/background-work.ts +50 -33
  249. package/src/server/lib/harness/acp/calls.test.ts +68 -0
  250. package/src/server/lib/harness/acp/calls.ts +13 -0
  251. package/src/server/lib/harness/acp/client-capabilities.ts +5 -2
  252. package/src/server/lib/harness/acp/client-fs.test.ts +13 -0
  253. package/src/server/lib/harness/acp/client-fs.ts +16 -2
  254. package/src/server/lib/harness/acp/client.ts +22 -23
  255. package/src/server/lib/harness/acp/commands.test.ts +19 -0
  256. package/src/server/lib/harness/acp/commands.ts +26 -8
  257. package/src/server/lib/harness/acp/frames.ts +16 -1
  258. package/src/server/lib/harness/acp/grants.server.ts +75 -0
  259. package/src/server/lib/harness/acp/grants.test.ts +65 -0
  260. package/src/server/lib/harness/acp/grants.ts +79 -0
  261. package/src/server/lib/harness/acp/one-shot.server.ts +141 -0
  262. package/src/server/lib/harness/acp/permissions.test.ts +9 -0
  263. package/src/server/lib/harness/acp/permissions.ts +56 -36
  264. package/src/server/lib/harness/acp/prompt-files.test.ts +69 -0
  265. package/src/server/lib/harness/acp/prompt-files.ts +58 -0
  266. package/src/server/lib/harness/acp/prompt.ts +50 -11
  267. package/src/server/lib/harness/acp/protocol.ts +20 -1
  268. package/src/server/lib/harness/acp/raw-listeners.ts +30 -0
  269. package/src/server/lib/harness/acp/session-approvals.ts +45 -0
  270. package/src/server/lib/harness/acp/session-config-view.ts +81 -0
  271. package/src/server/lib/harness/acp/session-config.ts +48 -9
  272. package/src/server/lib/harness/acp/session-handshake.test.ts +71 -2
  273. package/src/server/lib/harness/acp/session-handshake.ts +139 -56
  274. package/src/server/lib/harness/acp/session-intake.test.ts +93 -0
  275. package/src/server/lib/harness/acp/session-intake.ts +75 -0
  276. package/src/server/lib/harness/acp/session-lifecycle.ts +50 -0
  277. package/src/server/lib/harness/acp/session-lost.test.ts +44 -0
  278. package/src/server/lib/harness/acp/session-lost.ts +34 -0
  279. package/src/server/lib/harness/acp/session-notify.ts +47 -0
  280. package/src/server/lib/harness/acp/session-observers.test.ts +4 -4
  281. package/src/server/lib/harness/acp/session-permissions.test.ts +64 -0
  282. package/src/server/lib/harness/acp/session-permissions.ts +9 -4
  283. package/src/server/lib/harness/acp/session-requests.ts +6 -0
  284. package/src/server/lib/harness/acp/session-roots.server.ts +47 -0
  285. package/src/server/lib/harness/acp/session-roots.test.ts +31 -0
  286. package/src/server/lib/harness/acp/session-start.ts +7 -0
  287. package/src/server/lib/harness/acp/session-turns.ts +11 -0
  288. package/src/server/lib/harness/acp/session-wiring.ts +100 -0
  289. package/src/server/lib/harness/acp/session.test-util.ts +36 -2
  290. package/src/server/lib/harness/acp/session.test.ts +10 -10
  291. package/src/server/lib/harness/acp/session.ts +149 -139
  292. package/src/server/lib/harness/acp/tool-calls.ts +27 -15
  293. package/src/server/lib/harness/acp/tool-identity.test.ts +136 -0
  294. package/src/server/lib/harness/acp/tool-identity.ts +121 -0
  295. package/src/server/lib/harness/acp/turn-cancel.test.ts +79 -0
  296. package/src/server/lib/harness/acp/turn-cancel.ts +61 -0
  297. package/src/server/lib/harness/acp/turn-dispatch.test.ts +103 -0
  298. package/src/server/lib/harness/acp/turn-dispatch.ts +61 -0
  299. package/src/server/lib/harness/acp/turn-queue.ts +43 -0
  300. package/src/server/lib/harness/acp/turn-verdict.ts +102 -0
  301. package/src/server/lib/harness/acp/turn.ts +86 -88
  302. package/src/server/lib/harness/acp/v2.test.ts +9 -0
  303. package/src/server/lib/harness/acp/v2.ts +13 -0
  304. package/src/server/lib/harness/acp/verbs.ts +35 -4
  305. package/src/server/lib/harness/capabilities.ts +11 -0
  306. package/src/server/lib/harness/launch-table.ts +19 -0
  307. package/src/server/lib/harness/launch.ts +4 -0
  308. package/src/server/lib/harness/schema.server.ts +23 -0
  309. package/src/server/lib/harness/spawn.server.ts +18 -2
  310. package/src/server/lib/mcp/agent-config.server.test.ts +111 -0
  311. package/src/server/lib/mcp/agent-config.server.ts +205 -0
  312. package/src/server/lib/mcp/probe.server.ts +7 -1
  313. package/src/server/lib/mcp/registry.server.ts +4 -3
  314. package/src/server/lib/mcp/secrets.server.test.ts +85 -0
  315. package/src/server/lib/mcp/secrets.server.ts +108 -0
  316. package/src/server/lib/omp/core/print.server.ts +100 -0
  317. package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
  318. package/src/server/lib/omp/session/artifacts.server.test.ts +15 -5
  319. package/src/server/lib/omp/session/artifacts.server.ts +41 -26
  320. package/src/server/lib/omp/session/delete.server.ts +5 -0
  321. package/src/server/lib/omp/session/goal-auditor.server.ts +10 -48
  322. package/src/server/lib/realtime/topics/session-data.server.ts +6 -14
  323. package/src/server/routes/fs/git-message.test.ts +101 -0
  324. package/src/server/routes/fs/git-message.ts +60 -0
  325. package/src/server/routes/fs/index.ts +2 -0
  326. package/src/server/routes/omp/artifact.ts +4 -3
  327. package/src/server/routes/sessions/mcp.test.ts +65 -1
  328. package/src/server/routes/sessions/mcp.ts +77 -5
  329. package/src/server/routes/settings/git-identity.test.ts +77 -0
  330. package/src/server/routes/settings/git-identity.ts +47 -0
  331. package/src/server/routes/settings/index.ts +2 -0
  332. package/src/server/routes/telemetry/acp-telemetry.test.ts +149 -0
  333. package/src/server/routes/telemetry/context.ts +31 -0
  334. package/src/server/routes/telemetry/raw-messages.ts +34 -0
  335. package/src/shared/lib/chat/tool/artifact.test.ts +4 -2
  336. package/src/shared/lib/chat/tool/artifact.ts +6 -1
  337. package/src/shared/lib/chat/tool/proc-facts.ts +2 -1
  338. package/src/shared/lib/fs/paths.test.ts +2 -0
  339. package/src/shared/lib/fs/repo-label.test.ts +22 -1
  340. package/src/shared/lib/fs/repo-label.ts +29 -0
  341. package/src/shared/lib/git/commit-prompt.test.ts +47 -0
  342. package/src/shared/lib/git/commit-prompt.ts +72 -0
  343. package/src/shared/lib/git/identity.test.ts +46 -0
  344. package/src/shared/lib/git/identity.ts +70 -0
  345. package/src/shared/lib/harness/brand-color.ts +3 -0
  346. package/src/shared/lib/harness/catalog.test.ts +14 -0
  347. package/src/shared/lib/harness/catalog.ts +9 -1
  348. package/src/shared/lib/harness/mcp-facts.ts +4 -0
  349. package/src/shared/lib/harness/provider-facts.test.ts +11 -0
  350. package/src/shared/lib/harness/provider-facts.ts +14 -0
  351. package/src/shared/lib/harness/providers.ts +2 -2
  352. package/src/shared/lib/harness/updates.test.ts +8 -0
  353. package/src/shared/lib/harness/updates.ts +9 -0
  354. package/src/shared/lib/omp/session/proc-daemon.ts +124 -0
  355. package/src/shared/lib/omp/session/proc.test.ts +30 -3
  356. package/src/shared/lib/omp/session/proc.ts +6 -82
  357. package/src/shared/lib/omp/session/wait-idle.test.ts +15 -4
  358. package/src/shared/lib/omp/session/wait-idle.ts +11 -4
  359. package/src/shared/lib/settings/defaults.ts +5 -0
  360. package/src/shared/lib/workspace/new-workspace.ts +20 -0
  361. package/src/shared/types/omp/agent.ts +14 -5
  362. package/src/shared/types/settings/mcp.ts +2 -2
  363. package/src/shared/types/settings/state.ts +16 -0
  364. package/src/test-support/preload.ts +1 -0
  365. package/dist/client/static/js/ImageView-bxqw3t4k.js +0 -1
  366. package/dist/client/static/js/LayoutWrapper-zt14rv9m.js +0 -2
  367. package/dist/client/static/js/Modal-cm35g20x.js +0 -38
  368. package/dist/client/static/js/SessionsView-gn53zyn7.js +0 -1
  369. package/dist/client/static/js/architecture-7GRP2DOG-cagtcfhk.js +0 -1
  370. package/dist/client/static/js/bash-fjzhxy10.js +0 -1
  371. package/dist/client/static/js/c-wqtyezvw.js +0 -1
  372. package/dist/client/static/js/cpp-y0nzwner.js +0 -1
  373. package/dist/client/static/js/css-n2waj098.js +0 -1
  374. package/dist/client/static/js/cynefin-OW5HDTMX-6g2ydrss.js +0 -1
  375. package/dist/client/static/js/eventmodeling-NTZA5JFV-b774qbn2.js +0 -1
  376. package/dist/client/static/js/flowDiagram-KWPJA3E3-nznq0n36.js +0 -1
  377. package/dist/client/static/js/gitGraph-4MIJSDKK-b047d6vk.js +0 -1
  378. package/dist/client/static/js/graphql-gvb7e2eb.js +0 -1
  379. package/dist/client/static/js/html-tbz83eke.js +0 -1
  380. package/dist/client/static/js/index-0gbj4270.js +0 -2
  381. package/dist/client/static/js/index-38xv8h4t.js +0 -1
  382. package/dist/client/static/js/index-f4vr1c6e.css +0 -1
  383. package/dist/client/static/js/index-fb6pw9xb.js +0 -2
  384. package/dist/client/static/js/index-pzvr1699.js +0 -478
  385. package/dist/client/static/js/index-rf29f3fq.js +0 -9
  386. package/dist/client/static/js/index-zw621xez.js +0 -4
  387. package/dist/client/static/js/info-A6RAGUB7-n495k952.js +0 -1
  388. package/dist/client/static/js/ini-2gvjwh83.js +0 -1
  389. package/dist/client/static/js/java-1xwcq79s.js +0 -1
  390. package/dist/client/static/js/json-4pqjabgq.js +0 -1
  391. package/dist/client/static/js/jsx-wcsss15s.js +0 -1
  392. package/dist/client/static/js/lua-h7vjcn0h.js +0 -1
  393. package/dist/client/static/js/markdown-f30jjjh9.js +0 -1
  394. package/dist/client/static/js/one-dark-pro-qmyne0tn.js +0 -1
  395. package/dist/client/static/js/one-light-dj0ecjcj.js +0 -1
  396. package/dist/client/static/js/packet-AYTQ26CC-zajj62z6.js +0 -1
  397. package/dist/client/static/js/pie-WAS4IAKB-1ve78y5f.js +0 -1
  398. package/dist/client/static/js/properties-ymexza6q.js +0 -1
  399. package/dist/client/static/js/python-31ycwa66.js +0 -1
  400. package/dist/client/static/js/r-t2nne4xp.js +0 -1
  401. package/dist/client/static/js/radar-RG4KPBEZ-8rqadb58.js +0 -1
  402. package/dist/client/static/js/railroad-74A4TZTK-v6ppm8dy.js +0 -1
  403. package/dist/client/static/js/railroad-abnf-HS5TGJTU-9j6bae14.js +0 -1
  404. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-56cpyt0g.js +0 -1
  405. package/dist/client/static/js/railroad-peg-WCYAUIDC-yfdmspf4.js +0 -1
  406. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-qr5hdxm4.js +0 -8
  407. package/dist/client/static/js/treeView-Q6P3EWNA-vwpg3wp8.js +0 -1
  408. package/dist/client/static/js/treemap-WGGIJYW6-htfxwd32.js +0 -1
  409. package/dist/client/static/js/typescript-p3syh43m.js +0 -1
  410. package/dist/client/static/js/wardley-WFR3VGLG-hapfjkzq.js +0 -1
  411. package/dist/client/static/js/xml-4enq788a.js +0 -1
  412. package/dist/client/static/js/yaml-pjtt3jsc.js +0 -1
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The `authenticate` step and the sentence a refused handshake shows.
8
+ *
9
+ * The failure this pins: an agent that advertises `cached_token` was asked for a
10
+ * session it refused with `-32000 Authentication required`, and the operator got
11
+ * that sentence with no command to run. Both halves matter — calling the method
12
+ * when one is usable, and naming the agent's own sign-in line when none is.
13
+ */
14
+
15
+ import { describe, expect, test } from 'bun:test';
16
+ import { authMethodsOf, describeSignIn, headlessAuthMethod, isAuthRequiredError } from '@/server/lib/harness/acp/auth';
17
+
18
+ describe('headlessAuthMethod', () => {
19
+ test('prefers the machine credential', () => {
20
+ expect(headlessAuthMethod([{ id: 'cursor_login', type: 'terminal' }, { id: 'cached_token' }], {})).toBe('cached_token');
21
+ });
22
+
23
+ test('adopts an env-keyed method only when that variable is set', () => {
24
+ const methods = [{ id: 'xai.api_key' }];
25
+ expect(headlessAuthMethod(methods, {})).toBeNull();
26
+ expect(headlessAuthMethod(methods, { XAI_API_KEY: 'k' })).toBe('xai.api_key');
27
+ });
28
+
29
+ test('a terminal-only agent yields no call at all', () => {
30
+ expect(headlessAuthMethod([{ id: 'cursor_login', type: 'terminal' }], {})).toBeNull();
31
+ });
32
+ });
33
+
34
+ describe('describeSignIn', () => {
35
+ test('prints the launch line plus the terminal method args and env', () => {
36
+ expect(
37
+ describeSignIn(
38
+ [{ id: 'login', type: 'terminal', args: ['--login'], env: { GROK_HOME: '/tmp/g' } }],
39
+ 'grok agent stdio',
40
+ ),
41
+ ).toBe('To sign in, run this in a terminal on this machine, then try again: GROK_HOME=/tmp/g grok agent stdio --login');
42
+ });
43
+
44
+ test('names the offered methods when none is a terminal command', () => {
45
+ expect(describeSignIn([{ id: 'a', name: 'Sign in A' }, { id: 'b', name: 'Sign in B' }], 'x acp')).toContain(
46
+ 'Sign in A, Sign in B',
47
+ );
48
+ });
49
+
50
+ test('nothing to say when the agent offered nothing', () => {
51
+ expect(describeSignIn([], 'x acp')).toBeNull();
52
+ });
53
+ });
54
+
55
+ describe('isAuthRequiredError', () => {
56
+ test('recognises the spec code and the agent’s own wording', () => {
57
+ expect(isAuthRequiredError(Object.assign(new Error('nope'), { code: -32000 }))).toBe(true);
58
+ expect(isAuthRequiredError(new Error('Authentication required: run grok login'))).toBe(true);
59
+ expect(isAuthRequiredError(new Error('session not found'))).toBe(false);
60
+ });
61
+ });
62
+
63
+ describe('authMethodsOf', () => {
64
+ test('drops entries without an id', () => {
65
+ expect(authMethodsOf({ protocolVersion: 1, authMethods: [{ id: 'a', name: 'A' }, { name: 'B' } as never] })).toEqual([
66
+ { id: 'a', name: 'A' },
67
+ ]);
68
+ });
69
+ });
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The `authenticate` step of an ACP handshake.
8
+ *
9
+ * `initialize` lists the ways in; a client that never calls `authenticate` makes
10
+ * every agent that requires a login refuse `session/new` with `-32000`, which
11
+ * surfaces to the operator as a raw spawn failure naming nothing actionable.
12
+ * Only a HEADLESS method is attempted — a `terminal` method wants a TTY Kabmo
13
+ * does not host, and asking for one parks the spawn instead of explaining it.
14
+ */
15
+
16
+ import type { AcpInitializeResult } from '@/server/lib/harness/acp/protocol';
17
+
18
+ export interface AcpAuthMethod {
19
+ id: string;
20
+ name?: string;
21
+ description?: string;
22
+ type?: string;
23
+ args?: string[];
24
+ env?: Record<string, string>;
25
+ }
26
+
27
+ /** The method a client may call without a terminal, or null. */
28
+ export function headlessAuthMethod(
29
+ methods: readonly AcpAuthMethod[],
30
+ env: Record<string, string | undefined>,
31
+ ): string | null {
32
+ // `cached_token` means "the credential this machine already stores", which is
33
+ // exactly what a headless client can rely on. A method whose id names an env
34
+ // var (`xai.api_key` ← `XAI_API_KEY`) is adopted only when that var is set.
35
+ if (methods.some((method) => method.id === 'cached_token')) return 'cached_token';
36
+ for (const method of methods) {
37
+ const fromEnv = method.id.toUpperCase().replace(/[.-]/g, '_');
38
+ const present = env[fromEnv] ?? env[method.id];
39
+ if (present) return method.id;
40
+ }
41
+ return null;
42
+ }
43
+
44
+ /** Every `authMethods` entry, narrowed from the raw initialize answer. */
45
+ export function authMethodsOf(init: AcpInitializeResult): AcpAuthMethod[] {
46
+ const raw = init.authMethods;
47
+ if (!Array.isArray(raw)) return [];
48
+ return raw.flatMap((entry) => (entry && typeof entry === 'object' && typeof entry.id === 'string' ? [entry] : []));
49
+ }
50
+
51
+ /** The sentence a failed spawn shows when the agent wants a login. */
52
+ export function describeSignIn(methods: readonly AcpAuthMethod[], command: string): string | null {
53
+ const terminal = methods.find((method) => method.type === 'terminal');
54
+ if (terminal) {
55
+ const parts = [...command.split(' ').filter(Boolean), ...(terminal.args ?? [])];
56
+ const env = Object.entries(terminal.env ?? {}).map(([name, value]) => `${name}=${value}`);
57
+ const line = [...env, parts.join(' ')].join(' ');
58
+ return `To sign in, run this in a terminal on this machine, then try again: ${line}`;
59
+ }
60
+ const names = methods.map((method) => method.name?.trim() || method.id).filter(Boolean);
61
+ if (names.length === 0) return null;
62
+ return `The agent offers these ways to sign in: ${names.slice(0, 4).join(', ')}${names.length > 4 ? ` and ${names.length - 4} more` : ''}. Sign in with the agent's own command on this machine, then try again.`;
63
+ }
64
+
65
+ /** Whether a thrown error is the agent asking for a login. */
66
+ export function isAuthRequiredError(error: unknown): boolean {
67
+ const code = (error as { code?: unknown } | null)?.code;
68
+ if (code === -32000) return true;
69
+ const message = error instanceof Error ? error.message : String(error);
70
+ return /authentication required|not authenticated|sign in/i.test(message);
71
+ }
@@ -0,0 +1,139 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * A held replay's WORK is a notice too.
8
+ *
9
+ * Measured on agy 1.5.3 against a real 155 s run: the replay carried
10
+ * `read_file` and a failed `run_command` after the holding sentence and NO new
11
+ * assistant text, so a probe that waited for prose delivered nothing until its
12
+ * ceiling. These cases pin the collection and the dedupe.
13
+ */
14
+
15
+ import { describe, expect, test } from 'bun:test';
16
+ import { collectReplayFrame, newToolNotice, type ReplaySegment } from '@/server/lib/harness/acp/background-replay';
17
+ import { AcpBackgroundProbe } from '@/server/lib/harness/acp/background-work';
18
+
19
+ const seg = (): ReplaySegment => ({ text: '', sawUser: false, tools: [] });
20
+
21
+ describe('replay collection', () => {
22
+ test('a tool_call and its update are ONE row, latest status kept', () => {
23
+ const s = seg();
24
+ collectReplayFrame(s, { sessionUpdate: 'tool_call', toolCallId: 't1', name: 'read_file', status: 'pending' });
25
+ collectReplayFrame(s, { sessionUpdate: 'tool_call_update', toolCallId: 't1', status: 'completed' });
26
+ expect(s.tools).toEqual([{ id: 't1', name: 'read_file', status: 'completed' }]);
27
+ });
28
+
29
+ test('a user chunk starts a new segment', () => {
30
+ const s = seg();
31
+ collectReplayFrame(s, { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text: 'old' } });
32
+ collectReplayFrame(s, { sessionUpdate: 'user_message_chunk', content: { type: 'text', text: 'q' } });
33
+ expect(s.text).toBe('');
34
+ expect(s.sawUser).toBe(true);
35
+ });
36
+
37
+ test('the notice marks status and is reported once per call', () => {
38
+ const s = seg();
39
+ s.tools.push({ id: 'a', name: 'read_file', status: 'completed' }, { id: 'b', name: 'run_command', status: 'failed' });
40
+ const reported = new Set<string>();
41
+ expect(newToolNotice(s, reported)).toBe('The subagent continued working:\n✓ read_file\n✗ run_command');
42
+ expect(newToolNotice(s, reported)).toBeNull();
43
+ });
44
+
45
+ test('a long list is summarized', () => {
46
+ const s = seg();
47
+ for (let i = 0; i < 7; i += 1) s.tools.push({ id: `t${i}`, name: 'run_command', status: 'completed' });
48
+ expect(newToolNotice(s, new Set())).toContain('… and 2 more');
49
+ });
50
+ });
51
+
52
+ describe('the probe against a textless replay', () => {
53
+ test('a replay that only ran tools still reaches the operator', async () => {
54
+ // A deterministic queue, not wall-clock sleeps: the probe's schedule is
55
+ // injected, so each tick runs exactly one callback.
56
+ const scheduled: Array<() => void> = [];
57
+ const emitted: string[] = [];
58
+ const run = async (ticks: number): Promise<void> => {
59
+ for (let i = 0; i < ticks; i += 1) {
60
+ const next = scheduled.shift();
61
+ next?.();
62
+ for (let hop = 0; hop < 8; hop += 1) await Promise.resolve();
63
+ }
64
+ };
65
+ let probe!: AcpBackgroundProbe;
66
+ probe = new AcpBackgroundProbe({
67
+ load: async () => {
68
+ probe.consume('session/update', { update: { sessionUpdate: 'user_message_chunk', content: { type: 'text', text: 'buat banner' } } });
69
+ probe.consume('session/update', { update: { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text: 'Siap, langsung saya buatkan.' } } });
70
+ probe.consume('session/update', { update: { sessionUpdate: 'tool_call', toolCallId: 'r1', name: 'read_file', status: 'completed' } });
71
+ probe.consume('session/update', { update: { sessionUpdate: 'tool_call', toolCallId: 'c1', name: 'run_command', status: 'failed' } });
72
+ return {};
73
+ },
74
+ resetIdle: () => {},
75
+ emit: (text) => emitted.push(text),
76
+ firstDelayMs: 1,
77
+ maxDelayMs: 2,
78
+ now: () => 0,
79
+ schedule: (fn) => {
80
+ scheduled.push(fn);
81
+ return scheduled.length;
82
+ },
83
+ cancel: () => {},
84
+ });
85
+ probe.start('Siap, langsung saya buatkan.');
86
+ await run(1);
87
+ expect(emitted).toHaveLength(1);
88
+ expect(emitted[0]).toContain('✓ read_file');
89
+ expect(emitted[0]).toContain('✗ run_command');
90
+ // Each new tool call re-arms the probe, so a repeated replay is silent.
91
+ await run(3);
92
+ expect(emitted).toHaveLength(1);
93
+ probe.stop();
94
+ });
95
+ });
96
+
97
+ describe('the absolute ceiling', () => {
98
+ test('new work re-arms the quiet window but never past the lifetime', async () => {
99
+ const scheduled: Array<() => void> = [];
100
+ const emitted: string[] = [];
101
+ let clock = 0;
102
+ let tool = 0;
103
+ let probe!: AcpBackgroundProbe;
104
+ const run = async (): Promise<void> => {
105
+ for (let i = 0; i < 12; i += 1) {
106
+ const next = scheduled.shift();
107
+ if (!next) return;
108
+ next();
109
+ for (let hop = 0; hop < 8; hop += 1) await Promise.resolve();
110
+ }
111
+ };
112
+ probe = new AcpBackgroundProbe({
113
+ load: async () => {
114
+ tool += 1;
115
+ probe.consume('session/update', { update: { sessionUpdate: 'user_message_chunk', content: { type: 'text', text: 'q' } } });
116
+ probe.consume('session/update', { update: { sessionUpdate: 'tool_call', toolCallId: `t${tool}`, name: 'run_command', status: 'pending' } });
117
+ return {};
118
+ },
119
+ resetIdle: () => {},
120
+ emit: (text) => emitted.push(text),
121
+ timeoutMs: 1_000,
122
+ firstDelayMs: 1,
123
+ maxDelayMs: 1,
124
+ // Each probe advances the clock by 20 minutes: past the hour after three.
125
+ now: () => clock,
126
+ schedule: (fn) => {
127
+ clock += 20 * 60_000;
128
+ scheduled.push(fn);
129
+ return scheduled.length;
130
+ },
131
+ cancel: () => {},
132
+ });
133
+ probe.start('');
134
+ await run();
135
+ expect(emitted.length).toBeGreaterThanOrEqual(2);
136
+ // The ceiling stops it; nothing is scheduled after it.
137
+ expect(scheduled).toHaveLength(0);
138
+ });
139
+ });
@@ -0,0 +1,87 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * What one `session/load` replay added, and the notice that says it.
8
+ *
9
+ * A replay repeats the WHOLE conversation, so the probe's job is to find the
10
+ * part past the answer the operator already has. Two kinds of evidence matter,
11
+ * and the second was missing until a real chat proved it was needed:
12
+ *
13
+ * - **prose** — an `agent_message_chunk` past the baseline. Already handled.
14
+ * - **work** — a `tool_call` past the baseline. Measured on agy 1.5.3 against a
15
+ * finished 155 s run: the held replay carried `read_file` and a failed
16
+ * `run_command` AFTER the holding sentence and no new assistant text at all,
17
+ * so a probe that waited for prose delivered nothing before its ceiling.
18
+ *
19
+ * Both are reported once per call id, so a probe that runs every few seconds
20
+ * does not repeat the same notice.
21
+ */
22
+
23
+ import { acpContentText } from '@/server/lib/harness/acp/mapper';
24
+
25
+ /** One tool call a replay added past the baseline. */
26
+ export interface ReplayTool {
27
+ id: string;
28
+ name: string;
29
+ status: string;
30
+ }
31
+
32
+ /** Replay chunks collected since the last `user_message_chunk`. */
33
+ export interface ReplaySegment {
34
+ text: string;
35
+ sawUser: boolean;
36
+ tools: ReplayTool[];
37
+ }
38
+
39
+ /** How many tool rows one notice lists before it summarizes. */
40
+ const MAX_LISTED = 5;
41
+
42
+ /** The notice for tool calls this probe has not reported yet, or null. */
43
+ export function newToolNotice(segment: ReplaySegment, reported: Set<string>): string | null {
44
+ const fresh = segment.tools.filter((tool) => !reported.has(tool.id));
45
+ if (fresh.length === 0) return null;
46
+ for (const tool of fresh) reported.add(tool.id);
47
+ const lines = fresh.map((tool) => {
48
+ const mark = tool.status === 'completed' ? '✓' : tool.status === 'failed' ? '✗' : '·';
49
+ return `${mark} ${tool.name}`;
50
+ });
51
+ const shown = lines.slice(0, MAX_LISTED);
52
+ const more = lines.length - shown.length;
53
+ return ['The subagent continued working:', ...shown, ...(more > 0 ? [`… and ${more} more`] : [])].join('\n');
54
+ }
55
+
56
+ /** Apply one `session/update` payload to the open segment. */
57
+ export function collectReplayFrame(segment: ReplaySegment, update: unknown): void {
58
+ if (!update || typeof update !== 'object') return;
59
+ const record = update as Record<string, unknown>;
60
+ const kind = typeof record.sessionUpdate === 'string' ? record.sessionUpdate : '';
61
+ if (kind === 'user_message_chunk') {
62
+ // A new user turn starts a new assistant segment; everything before it is
63
+ // history this probe does not need.
64
+ segment.text = '';
65
+ segment.sawUser = true;
66
+ return;
67
+ }
68
+ if (kind === 'agent_message_chunk') {
69
+ segment.text += acpContentText(record.content);
70
+ return;
71
+ }
72
+ if (kind !== 'tool_call' && kind !== 'tool_call_update') return;
73
+ const id = typeof record.toolCallId === 'string' ? record.toolCallId : '';
74
+ if (!id) return;
75
+ const name = typeof record.name === 'string' && record.name
76
+ ? record.name
77
+ : typeof record.title === 'string' && record.title ? record.title : 'tool';
78
+ const status = typeof record.status === 'string' ? record.status : 'pending';
79
+ const existing = segment.tools.find((tool) => tool.id === id);
80
+ // A `tool_call_update` patches the call: keep its first name and take the
81
+ // latest status, so one call is one row.
82
+ if (existing) {
83
+ existing.status = status;
84
+ return;
85
+ }
86
+ segment.tools.push({ id, name, status });
87
+ }
@@ -20,25 +20,51 @@
20
20
  * collected instead of folded (they repeat the whole chat), and the text past
21
21
  * the answer the operator already has is emitted as the agent's continuation.
22
22
  *
23
- * The probe backs off (2s → 30s) and gives up after ten minutes; it never
24
- * substitutes a failure for an answer it did not see.
23
+ * **Text is not the only evidence.** Measured on agy 1.5.3 against a real chat
24
+ * (155 s of work): its replay carried `read_file` and a failed `run_command`
25
+ * AFTER the holding sentence and **no** new `agent_message_chunk` at all. A
26
+ * probe that waited for prose therefore sat on a finished run until the ten
27
+ * minute ceiling and the operator saw nothing. New TOOL calls are progress too,
28
+ * so they are surfaced as a notice — and each one that lands means the child is
29
+ * still working, which is what re-arms the ceiling.
30
+ *
31
+ * The probe backs off (2s → 30s) and gives up after ten minutes past the last
32
+ * evidence of work; it never substitutes a failure for an answer it did not see.
25
33
  */
26
34
 
27
- import { acpContentText } from '@/server/lib/harness/acp/mapper';
35
+ import { collectReplayFrame, newToolNotice, type ReplaySegment } from '@/server/lib/harness/acp/background-replay';
28
36
  import { stampMessageModel } from '@/server/lib/harness/acp/session-config';
29
37
  import { emitRealtimeSignal } from '@/server/lib/realtime/signals.server';
30
38
  import { extractTextFromContent } from '@/shared/lib/omp/session/mapper';
31
39
  import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
32
40
 
33
- /** Tool names that hand work to a process the turn does not await. */
41
+ /** Tool names that hand work to a process the turn does not await.
42
+ *
43
+ * `spawn_subagent` is grok's spelling and arrives only as `_meta["x.ai/tool"]`;
44
+ * `resolveToolIdentity` lifts it into the card's `name`, which is why this list
45
+ * still matches. Cursor's `task` is deliberately absent: its adapter runs the
46
+ * child inside the call and answers before `end_turn`, so there is nothing to
47
+ * probe for. */
34
48
  const BACKGROUND_TOOLS: Record<string, true> = {
35
49
  invoke_subagent: true,
36
50
  spawn_subagent: true,
37
51
  };
38
52
 
53
+ /** Whether a card names a call that outlives the turn. Reads the resolved
54
+ * `name`, so an adapter that hides it in `_meta` is detected too. */
55
+ export function isBackgroundToolName(name: string | undefined): boolean {
56
+ return typeof name === 'string' && BACKGROUND_TOOLS[name.toLowerCase()] === true;
57
+ }
58
+
39
59
  export const BACKGROUND_FIRST_DELAY_MS = 2_000;
40
60
  export const BACKGROUND_MAX_DELAY_MS = 30_000;
41
61
  export const BACKGROUND_TIMEOUT_MS = 10 * 60_000;
62
+ /** The absolute ceiling, independent of how often new work re-arms the quiet
63
+ * window. A probe holds the session out of the idle reclaim (`resetIdle`), so
64
+ * an agent that reports a tool every minute must not keep it alive forever.
65
+ * One hour is the repo's own precedent for "silence means a wedged turn"
66
+ * (`turn-silence.ts`). */
67
+ export const BACKGROUND_MAX_LIFETIME_MS = 60 * 60_000;
42
68
  export const BACKGROUND_LOAD_TIMEOUT_MS = 120_000;
43
69
 
44
70
  /** Did this turn hand work to a background worker? Read from the closed
@@ -50,7 +76,7 @@ export function spawnsBackgroundWork(message: unknown): boolean {
50
76
  return content.some((block) => {
51
77
  if (!block || typeof block !== 'object') return false;
52
78
  if (!('type' in block) || block.type !== 'toolCall') return false;
53
- return 'name' in block && typeof block.name === 'string' && BACKGROUND_TOOLS[block.name.toLowerCase()] === true;
79
+ return 'name' in block && isBackgroundToolName(typeof block.name === 'string' ? block.name : undefined);
54
80
  });
55
81
  }
56
82
 
@@ -134,19 +160,6 @@ export interface AcpBackgroundProbeOptions {
134
160
  cancel?: (handle: unknown) => void;
135
161
  }
136
162
 
137
- /** Replay chunks collected since the last `user_message_chunk`. */
138
- interface ReplaySegment {
139
- text: string;
140
- sawUser: boolean;
141
- }
142
-
143
- /**
144
- * The load probe for one background turn.
145
- *
146
- * `consume` must be called for every notification while a probe is in flight:
147
- * the replay repeats the whole transcript, and folding it into the live chat
148
- * would duplicate history.
149
- */
150
163
  export class AcpBackgroundProbe {
151
164
  private readonly load: () => Promise<unknown>;
152
165
  private readonly resetIdle: () => void;
@@ -164,12 +177,16 @@ export class AcpBackgroundProbe {
164
177
  private pendingNotice: string | null = null;
165
178
  private timer: unknown = null;
166
179
  private deadline = 0;
180
+ /** When this probe began, for the absolute ceiling. */
181
+ private beganAt = 0;
167
182
  private delay: number;
168
183
  private stopped = true;
169
184
  private inFlight = false;
170
185
  /** Consecutive `session/load` failures; a lost agent is not retried forever. */
171
186
  private failures = 0;
172
187
  private queued: string | null = null;
188
+ /** Tool calls already reported for this probe, so a notice is not repeated. */
189
+ private reportedTools = new Set<string>();
173
190
 
174
191
  constructor(options: AcpBackgroundProbeOptions) {
175
192
  this.load = options.load;
@@ -188,6 +205,7 @@ export class AcpBackgroundProbe {
188
205
  start(baseline: string): void {
189
206
  this.baseline = baseline.trim();
190
207
  this.pendingNotice = null;
208
+ this.reportedTools = new Set();
191
209
  // A previous probe's load can still be running. Queue this turn instead of
192
210
  // interleaving two replays; the queued baseline starts when that load ends.
193
211
  if (this.inFlight) {
@@ -195,6 +213,7 @@ export class AcpBackgroundProbe {
195
213
  return;
196
214
  }
197
215
  this.stopped = false;
216
+ this.beganAt = this.now();
198
217
  this.deadline = this.now() + this.timeoutMs;
199
218
  this.delay = this.firstDelayMs;
200
219
  this.failures = 0;
@@ -218,20 +237,7 @@ export class AcpBackgroundProbe {
218
237
  */
219
238
  consume(method: string, params: Record<string, unknown>): boolean {
220
239
  if (!this.collecting || method !== 'session/update') return false;
221
- const update = params.update;
222
- if (!update || typeof update !== 'object') return true;
223
- const record = update as Record<string, unknown>;
224
- const kind = typeof record.sessionUpdate === 'string' ? record.sessionUpdate : '';
225
- if (kind === 'user_message_chunk') {
226
- // A new user turn starts a new assistant segment. Everything before it is
227
- // history this probe does not need.
228
- this.collecting.text = '';
229
- this.collecting.sawUser = true;
230
- return true;
231
- }
232
- if (kind === 'agent_message_chunk') {
233
- this.collecting.text += acpContentText(record.content);
234
- }
240
+ collectReplayFrame(this.collecting, params.update);
235
241
  return true;
236
242
  }
237
243
 
@@ -246,7 +252,7 @@ export class AcpBackgroundProbe {
246
252
  private async probe(): Promise<void> {
247
253
  if (this.stopped || this.inFlight) return;
248
254
  this.inFlight = true;
249
- this.collecting = { text: '', sawUser: false };
255
+ this.collecting = { text: '', sawUser: false, tools: [] };
250
256
  this.resetIdle();
251
257
  let failed = false;
252
258
  try {
@@ -277,6 +283,7 @@ export class AcpBackgroundProbe {
277
283
  }
278
284
  } else {
279
285
  this.failures = 0;
286
+ let toolNotice: string | null = null;
280
287
  // A replay that never reached a user chunk cannot be placed in the
281
288
  // conversation, so it is not a notice.
282
289
  const notice = segment?.sawUser ? backgroundNotice(this.baseline, segment.text) : null;
@@ -293,6 +300,16 @@ export class AcpBackgroundProbe {
293
300
  this.delay = this.firstDelayMs;
294
301
  this.arm();
295
302
  }
303
+ } else if (segment?.sawUser && (toolNotice = newToolNotice(segment, this.reportedTools)) !== null) {
304
+ // No new prose, but the child RAN something: deliver that and keep
305
+ // watching — each new tool call is evidence the run is alive, so the
306
+ // ceiling is re-armed instead of expiring under it.
307
+ this.emitNotice(toolNotice);
308
+ // New work re-arms the QUIET window, never the absolute ceiling.
309
+ this.deadline = this.now() + this.timeoutMs;
310
+ this.delay = Math.min(this.delay * 2, this.maxDelayMs);
311
+ if (this.now() - this.beganAt >= BACKGROUND_MAX_LIFETIME_MS) this.stopped = true;
312
+ else this.arm();
296
313
  } else if (this.now() >= this.deadline) {
297
314
  this.stopped = true;
298
315
  } else {
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * A request the client gives up on must be withdrawn from the AGENT.
8
+ *
9
+ * The table's own timeout only freed the pending slot; the agent kept working on
10
+ * a request whose answer nobody would read, and its next prompt then arrived
11
+ * while it was still busy. ACP's `$/cancel_request` is the spec's words for
12
+ * "forget this", and the transport sends it on the request's own id.
13
+ */
14
+
15
+ import { describe, expect, test, vi } from 'bun:test';
16
+ import { PendingCalls } from '@/server/lib/harness/acp/calls';
17
+
18
+ describe('PendingCalls timeouts', () => {
19
+ test('the deadline notifies the agent and rejects the caller', async () => {
20
+ vi.useFakeTimers();
21
+ try {
22
+ const withdrawn: unknown[] = [];
23
+ const pending = new PendingCalls({
24
+ onTimeout: (id, method) => {
25
+ withdrawn.push([id, method]);
26
+ },
27
+ });
28
+ const call = pending.begin('k1', 'session/set_config_option', { sessionId: 's' }, 5);
29
+ vi.advanceTimersByTime(10);
30
+ await expect(call).rejects.toThrow('timed out after 5ms');
31
+ expect(withdrawn).toEqual([['k1', 'session/set_config_option']]);
32
+ } finally {
33
+ vi.useRealTimers();
34
+ }
35
+ });
36
+
37
+ test('a settled request is never reported as timed out', async () => {
38
+ vi.useFakeTimers();
39
+ try {
40
+ const withdrawn: unknown[] = [];
41
+ const pending = new PendingCalls({
42
+ onTimeout: (id) => {
43
+ withdrawn.push(id);
44
+ },
45
+ });
46
+ const call = pending.begin('k2', 'session/set_mode', {}, 5);
47
+ expect(pending.settle({ jsonrpc: '2.0', id: 'k2', result: {} })).toBe(true);
48
+ await expect(call).resolves.toEqual({});
49
+ vi.advanceTimersByTime(50);
50
+ expect(withdrawn).toEqual([]);
51
+ } finally {
52
+ vi.useRealTimers();
53
+ }
54
+ });
55
+
56
+ test('a prompt has no timer at all', async () => {
57
+ const withdrawn: unknown[] = [];
58
+ const pending = new PendingCalls({
59
+ onTimeout: (id) => {
60
+ withdrawn.push(id);
61
+ },
62
+ });
63
+ const call = pending.begin('k3', 'session/prompt', { sessionId: 's' }, 0);
64
+ pending.abandonPrompt('s');
65
+ await expect(call).resolves.toEqual({ stopReason: 'cancelled' });
66
+ expect(withdrawn).toEqual([]);
67
+ });
68
+ });
@@ -18,6 +18,13 @@
18
18
 
19
19
  import type { AcpId, AcpResponse } from '@/server/lib/harness/acp/protocol';
20
20
 
21
+ /** What the table does when a request's own deadline expires. A timeout is the
22
+ * client's verdict, not the agent's: without telling it, the agent keeps
23
+ * working on a request nobody will read. */
24
+ export interface PendingCallsOptions {
25
+ onTimeout?: (id: AcpId, method: string, params: Record<string, unknown>) => void;
26
+ }
27
+
21
28
  /** A JSON-RPC error answer, with the code the spec defines for it. */
22
29
  export class AcpRequestError extends Error {
23
30
  constructor(
@@ -43,6 +50,8 @@ export interface Pending {
43
50
  export class PendingCalls {
44
51
  private readonly map = new Map<AcpId, Pending>();
45
52
 
53
+ constructor(private readonly options: PendingCallsOptions = {}) {}
54
+
46
55
  /** Track one call. `budgetMs` of 0 means "no timer" — a whole turn. */
47
56
  begin<T>(id: AcpId, method: string, params: unknown, budgetMs: number): Promise<T> {
48
57
  const { promise, resolve, reject } = Promise.withResolvers<T>();
@@ -56,6 +65,10 @@ export class PendingCalls {
56
65
  entry.timer = setTimeout(() => {
57
66
  if (this.map.get(id) !== entry) return;
58
67
  this.map.delete(id);
68
+ // ACP's `$/cancel_request` is how a client withdraws a request it no
69
+ // longer wants. Keeping the pool consistent is not enough — the agent
70
+ // would run the abandoned request to completion.
71
+ this.options.onTimeout?.(id, method, entry.params);
59
72
  reject(new Error(`ACP ${method} timed out after ${budgetMs}ms`));
60
73
  }, budgetMs);
61
74
  entry.timer.unref?.();
@@ -33,11 +33,14 @@
33
33
  * - `auth.terminal` — Kabmo does not reproduce the agent's launch line in an
34
34
  * interactive terminal for login.
35
35
  * - `session.configOptions.boolean` — the selector UI is select-only.
36
- * - `session.compaction` — compaction updates have no renderer.
36
+ *
37
+ * `session.compaction` IS advertised: the frame mapper turns a compaction into a
38
+ * notice, which is the surface the timeline already has, so an agent may report
39
+ * one instead of falling back to modelling it as conversation text.
37
40
  */
38
41
  export const KABMO_CLIENT_CAPABILITIES = {
39
42
  fs: { readTextFile: true, writeTextFile: true },
40
- session: { notices: {} },
43
+ session: { notices: {}, compaction: {} },
41
44
  } as const;
42
45
 
43
46
  /** The latest protocol major this client sends; it also speaks v1. */
@@ -133,3 +133,16 @@ describe('fs/write_text_file', () => {
133
133
  expect(answer).toMatchObject({ answered: false, code: ACP_ERROR.invalidParams });
134
134
  });
135
135
  });
136
+
137
+ describe('ACP fs/write_text_file reporting', () => {
138
+ test('the write carries both sides so the change journal can record it', async () => {
139
+ const base = await workspace();
140
+ const target = join(base.cwd, 'note.txt');
141
+ await Bun.write(target, 'old');
142
+ const events: Array<Record<string, unknown> & { type: string }> = [];
143
+ const host: AcpFsHost = { ...base, emit: (event) => events.push(event) };
144
+ const answer = await handleAcpFsRequest(host, 'fs/write_text_file', { sessionId: 's1', path: target, content: 'new' });
145
+ expect(answer).toEqual({ answered: true, result: {} });
146
+ expect(events).toEqual([{ type: 'fs_write', path: target, before: 'old', after: 'new' }]);
147
+ });
148
+ });