@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
@@ -7,14 +7,11 @@
7
7
  * One live ACP session: the bridge between `AcpProcess` + `AcpFrameMapper` and
8
8
  * the `HarnessSession` contract every route already speaks.
9
9
  *
10
- * It owns the session's own state — the id, the config selectors, the resolved
11
- * model, the run flags the sidebar spinner and the queue delivery gate read, the
12
- * agent's commands and the approval queue a reloaded tab replays. The RULES live
13
- * beside it, one module per concern: `session-handshake.ts` (initialize/new/load
14
- * + the picks), `session-turns.ts` (the ACK contract and turn-end bookkeeping),
15
- * `session-config.ts` (config answers, parked dialogs), `session-permissions.ts`
16
- * (the tier that answers before a dialog exists), `session-facts.ts` (what an
17
- * agent publishes between turns) and `session-web-state.ts` (`get_state`).
10
+ * It owns the session's state — the id, the selectors, the model, the run flags,
11
+ * the commands and the approval queue. The RULES live beside it, one module per
12
+ * concern: `session-handshake.ts` (setup), `session-intake.ts` (what a prompt
13
+ * sends), `turn.ts` (the turn), `session-config.ts`, `session-permissions.ts`,
14
+ * `session-lifecycle.ts` and `session-web-state.ts`.
18
15
  *
19
16
  * `send()` takes the SAME command vocabulary the routes already send omp, so
20
17
  * `routes/agent/command.ts` needs no second dispatch table.
@@ -23,26 +20,36 @@
23
20
  import { AcpProcess } from '@/server/lib/harness/acp/client';
24
21
  import { openSessionProcess } from '@/server/lib/harness/acp/session-process';
25
22
  import { AcpTurns, type AcpTurnEndInfo } from '@/server/lib/harness/acp/turn';
23
+ import { acpBackgroundProbe, acpTurns, acpWiringFor } from '@/server/lib/harness/acp/session-wiring';
26
24
  import { AcpFrameMapper } from '@/server/lib/harness/acp/frames';
27
25
  import { AcpReplay } from '@/server/lib/harness/acp/replay';
28
26
  import { startAcpSession } from '@/server/lib/harness/acp/session-start';
29
- import type { AcpConfigOption, AcpId, AcpProtocolVersion, AcpSessionModeState } from '@/server/lib/harness/acp/protocol';
30
- import { promptBlocks } from '@/server/lib/harness/acp/prompt';
31
- import { setAcpConfig, setAcpMode, settlePermissionDialog, stampMessageModel } from '@/server/lib/harness/acp/session-config';
27
+ import type { AcpHandshakeSelections } from '@/server/lib/harness/acp/session-handshake';
28
+ import type {
29
+ AcpConfigOption,
30
+ AcpId,
31
+ AcpProtocolVersion,
32
+ AcpSessionModeState,
33
+ AcpSessionModels,
34
+ } from '@/server/lib/harness/acp/protocol';
35
+ import { promptContent, startAcpPrompt } from '@/server/lib/harness/acp/session-intake';
36
+ import { LOST_SESSION_NOTICE } from '@/server/lib/harness/acp/session-lost';
37
+ import { setAcpConfig, setAcpMode, type AcpConfigWriter } from '@/server/lib/harness/acp/session-config';
38
+ import { acpConfigView, type AcpConfigProcess } from '@/server/lib/harness/acp/session-config-view';
39
+ import * as verbs from '@/server/lib/harness/acp/verbs';
40
+ import { acpPendingDialogs, answerAcpDialog } from '@/server/lib/harness/acp/session-approvals';
32
41
  import { beginAcpTurn, endAcpTurn } from '@/server/lib/harness/acp/session-turns';
33
42
  import { capabilitiesFrom } from '@/server/lib/harness/launch';
34
43
  import { PendingPermissions } from '@/server/lib/harness/acp/permissions';
35
44
  import { cancelAllAcpPermissions } from '@/server/lib/harness/acp/session-permissions';
36
- import { handleSessionNotification } from '@/server/lib/harness/acp/session-notifications';
45
+ import { handleAcpNotification } from '@/server/lib/harness/acp/session-notify';
46
+ import { RawNotificationSink, type RawNotificationListener } from '@/server/lib/harness/acp/raw-listeners';
37
47
  import { AcpUsageMeter, type AcpContextUsage } from '@/server/lib/harness/acp/session-usage';
38
- import { handleAcpClientRequest, handleAcpCancelRequest, type AcpClientRequestAnswer } from '@/server/lib/harness/acp/session-requests';
39
- import { reportAcpExit } from '@/server/lib/harness/acp/session-exit';
48
+ import { handleAcpClientRequest, type AcpClientRequestAnswer } from '@/server/lib/harness/acp/session-requests';
49
+ import { reportAcpExit, type AcpExitInfo } from '@/server/lib/harness/acp/session-exit';
50
+ import { acpExited, destroyAcp } from '@/server/lib/harness/acp/session-lifecycle';
40
51
  import { SessionListeners } from '@/server/lib/harness/acp/session-listeners';
41
- import {
42
- AcpBackgroundProbe,
43
- BACKGROUND_LOAD_TIMEOUT_MS,
44
- deliverBackgroundNotice,
45
- } from '@/server/lib/harness/acp/background-work';
52
+ import type { AcpBackgroundProbe } from '@/server/lib/harness/acp/background-work';
46
53
  import { acpWebState } from '@/server/lib/harness/acp/session-web-state';
47
54
  import { acpIdleReaper } from '@/server/lib/harness/acp/session-idle';
48
55
  import { DEFAULT_APPROVAL_MODE, isApprovalMode, type ApprovalMode } from '@/shared/lib/omp/config/access-mode';
@@ -56,13 +63,27 @@ import type { HarnessId } from '@/shared/lib/harness/catalog';
56
63
  import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
57
64
  import type { IdleReaper } from '@/server/lib/omp/rpc/idle-reaper';
58
65
 
66
+ /** The process verbs the config view calls, bound to the CURRENT session id. */
67
+ function configProcess(proc: AcpProcess): AcpConfigProcess {
68
+ return {
69
+ setConfigOption: (session, id, value) => proc.setConfigOption(session, id, value),
70
+ setMode: (session, modeId) => proc.setMode(session, modeId),
71
+ setModel: (session, modelId) => verbs.setModel(proc.call, session, modelId),
72
+ };
73
+ }
74
+
59
75
  export class AcpSession implements HarnessSession, AcpCommandHost {
60
76
  readonly harness: HarnessId;
61
77
  readonly cwd: string;
62
78
  readonly sessionFile = '';
79
+ /** The launch line, so a refused handshake can name the sign-in command. */
80
+ readonly command: string[];
81
+ /** The environment the agent sees, read to satisfy a headless auth method. */
82
+ readonly authEnv?: Record<string, string | undefined>;
63
83
  sessionId = '';
64
- /** The turn in flight — the only one whose frames are accepted. */
65
- private readonly turns: AcpTurns;
84
+ /** The turn in flight — the only one whose frames are accepted. Public so the
85
+ * notification router can note activity on it. */
86
+ readonly turns: AcpTurns;
66
87
  runModel: { provider: string; modelId: string } | null = null;
67
88
  /** The agent's own slash-command list; the composer's `/` pool reads it. */
68
89
  agentCommands: { name: string; description?: string; inputHint?: string }[] = [];
@@ -86,6 +107,9 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
86
107
  configOptions: AcpConfigOption[] = [];
87
108
  /** The older Session Modes API, adopted when the agent publishes one. */
88
109
  modes: AcpSessionModeState | null = null;
110
+ /** The `models` block the agent published, when it published one instead of
111
+ * a `model` selector (measured on grok). */
112
+ models: AcpSessionModels | null = null;
89
113
  /** Whether the agent advertised `promptCapabilities.image`. */
90
114
  acceptsImages = false;
91
115
  /** MCP servers every session request carries; empty when none are configured. */
@@ -97,63 +121,48 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
97
121
  readonly background: AcpBackgroundProbe;
98
122
  private readonly mapper = new AcpFrameMapper();
99
123
  private readonly events = new SessionListeners();
124
+ /** Raw `session/update` sinks: the frame log the raw panel reads. Public so
125
+ * `session-notify.ts` can feed it before the mapper folds a frame. */
126
+ readonly rawSink = new RawNotificationSink();
100
127
  readonly permissions = new PendingPermissions();
101
128
  private destroyHook: (() => void) | null = null;
102
- private destroyed = false;
129
+ destroyed = false;
103
130
  /** True only for a restore: replay frames are accepted and collected. */
104
131
  private readonly wantsReplay: boolean;
105
132
  readonly replay = new AcpReplay();
106
133
  /** Set when Kabmo ends the process, so a requested stop is not reported as a failure. */
107
- private closing = false;
134
+ closing = false;
108
135
 
109
136
  constructor(options: AcpSessionOptions, cwd: string) {
110
137
  this.harness = options.harness;
111
138
  this.cwd = cwd;
139
+ this.command = options.command;
140
+ if (options.env) this.authEnv = options.env;
112
141
  this.proc = openSessionProcess(options, cwd, {
113
142
  onNotification: (method, params) => this.onNotification(method, params),
114
143
  onClientRequest: (id, method, params) => this.onClientRequest(id, method, params),
115
144
  onExit: (info) => this.onExit(info),
116
145
  });
117
146
  this.idle = acpIdleReaper(this, options.idleDestroyMs);
118
- // ACP holds updates produced while idle until the next request, so a turn
119
- // that spawned a subagent is followed by a `session/load` probe. The replay
120
- // is swallowed by the probe; only the text past the answer already shown is
121
- // emitted, as the agent's continuation.
122
- this.background = new AcpBackgroundProbe({
123
- load: () => this.proc.loadSession(this.sessionId, this.cwd, BACKGROUND_LOAD_TIMEOUT_MS),
124
- resetIdle: () => this.idle.reset(),
125
- emit: (text) => deliverBackgroundNotice(this, text),
126
- });
127
- this.turns = new AcpTurns({
128
- emit: (event) => this.emit(event),
129
- prompt: (message, images) =>
130
- this.proc.prompt(this.sessionId, promptBlocks(message, images), 0) as Promise<{ stopReason?: string } | undefined>,
131
- cancelAgent: () => this.proc.cancel(this.sessionId),
132
- abandonPrompt: () => this.proc.abandonPrompt(this.sessionId),
133
- resetMapper: () => this.mapper.reset(),
134
- closeMessage: () => this.mapper.closeMessage().map((event) => stampMessageModel(event, this.runModel)),
135
- openCalls: () => this.mapper.openCalls(),
136
- // The follow-up queue is armed from the turn's END, exactly as the omp
137
- // wrapper arms it from its own terminal settle. Without this an ACP chat's
138
- // queued follow-up stayed in `queued_messages` forever: nothing on this
139
- // transport scheduled a delivery, and the client's nudge route only knew
140
- // omp's wrapper.
141
- onTurnEnd: (info) => this.onTurnEnded(info),
142
- });
147
+ // `sessionId`/`runModel` start empty and are read LIVE: the handshake sets
148
+ // them, and a closed message must carry the model it actually ran on.
149
+ const wiring = acpWiringFor(this, { proc: this.proc, mapper: this.mapper, idle: this.idle });
150
+ this.background = acpBackgroundProbe(wiring);
151
+ this.turns = acpTurns(wiring);
143
152
  this.mcpServers = options.mcpServers ?? [];
144
153
  this.wantsReplay = options.replay === true;
145
- this.requestedModel = options.model ?? null;
146
- this.requestedThinking = options.thinkingLevel ?? null;
147
- this.requestedMode = options.mode ?? null;
154
+ this.requested = { model: options.model ?? null, thinking: options.thinkingLevel ?? null, mode: options.mode ?? null };
148
155
  this.accessMode = isApprovalMode(options.accessMode) ? options.accessMode : DEFAULT_APPROVAL_MODE;
156
+ this.config = acpConfigView(this, configProcess(this.proc));
149
157
  }
150
158
 
151
- private readonly requestedModel: { provider: string; modelId: string } | null;
152
- private readonly requestedThinking: string | null;
153
- private readonly requestedMode: string | null;
159
+ /** The selector view the config rules write through. */
160
+ private readonly config: AcpConfigWriter;
161
+ /** The picks the spawn carried, applied after setup. */
162
+ private readonly requested: AcpHandshakeSelections;
154
163
  /** `initialize` + `session/new|load|resume`, then the requested selections. */
155
164
  async start(sessionIdToLoad?: string, forkFromSessionId?: string, forkMeta?: Record<string, unknown>): Promise<{ sessionId: string }> {
156
- return startAcpSession(this, this.proc, this.mapper, this.replay, this.wantsReplay, { model: this.requestedModel, thinking: this.requestedThinking, mode: this.requestedMode }, sessionIdToLoad, forkFromSessionId, forkMeta);
165
+ return startAcpSession(this, this.proc, this.mapper, this.replay, this.wantsReplay, this.requested, sessionIdToLoad, forkFromSessionId, forkMeta);
157
166
  }
158
167
 
159
168
  get protocol(): AcpProtocolVersion { return this.proc.protocolVersion === 2 ? 2 : 1; }
@@ -167,12 +176,32 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
167
176
  isRunning(): boolean { return this.isAlive() && (this.turns.isPromptRunning || this.turns.isStreaming); }
168
177
  isBusy(): boolean { return this.isRunning() || this.permissions.size() > 0; }
169
178
  onEvent(listener: (event: AgentEvent) => void): () => void { return this.events.add(listener); }
179
+ /** Subscribe to the raw `session/update` payloads, before the mapper folds them. */
180
+ onRawNotification(listener: RawNotificationListener): () => void { return this.rawSink.add(listener); }
170
181
  emit(event: AgentEvent): void { this.replay.push(event); this.events.emit(event); }
182
+ /** Run the single destroy callback the registry installed. */
183
+ runDestroyHook(): void { this.destroyHook?.(); }
184
+
185
+ /** The teardown seams `session-lifecycle.ts` drives: methods, not class
186
+ * fields, because a test mounts the class on its prototype and a field
187
+ * initializer never runs there. */
188
+ disposeProcess(): Promise<void> {
189
+ return this.proc.dispose();
190
+ }
191
+
192
+ reportExit(info: AcpExitInfo): Promise<void> {
193
+ return reportAcpExit(this, info);
194
+ }
195
+
196
+ /** The dispatcher's command surface — see `commands.ts` for the rules. */
197
+ dispatch(command: Record<string, unknown>): Promise<unknown> {
198
+ // A command is the clearest sign the session is still wanted.
199
+ this.idle.reset();
200
+ return dispatchCommand(this, command);
201
+ }
171
202
 
172
203
  getPendingUiDialogs(): Record<string, unknown>[] {
173
- // Widened for the shared `HarnessSession` contract, which predates the
174
- // dialog shape; every field the client reads is present.
175
- return this.permissions.pendingDialogs() as unknown as Record<string, unknown>[];
204
+ return acpPendingDialogs(this.permissions);
176
205
  }
177
206
 
178
207
  resolvePendingUiDialog(id: string): void {
@@ -184,10 +213,8 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
184
213
  this.destroyHook = callback;
185
214
  }
186
215
 
187
- async send(command: Record<string, unknown>): Promise<unknown> {
188
- // A command is the clearest sign the session is still wanted.
189
- this.idle.reset();
190
- return dispatchCommand(this, command);
216
+ send(command: Record<string, unknown>): Promise<unknown> {
217
+ return this.dispatch(command);
191
218
  }
192
219
 
193
220
  /** Dispatcher seam: one steering send. */
@@ -195,22 +222,50 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
195
222
  return this.proc.steer(this.sessionId, blocks, queue);
196
223
  }
197
224
 
198
- /** Record a mid-turn user message; the ACP mapper drops live user frames. */
225
+ /** The blocks one prompt sends (text, images, `@path` links). */
226
+ blocksFor(message: string, images: unknown): Promise<unknown[]> {
227
+ return promptContent(this, message, images);
228
+ }
229
+
230
+ /** Dispatcher seam: hold an input the agent has no mid-turn channel for, so
231
+ * it is dispatched as the next turn instead of refused or lost. */
232
+ queueTurnInput(message: string, images: unknown): void {
233
+ this.turns.queue(message, images);
234
+ }
235
+
236
+ /** Record a mid-turn user message; the mapper drops live user frames. */
199
237
  recordUserTurn(message: string, images: unknown): void { this.emit({ type: 'user_turn', message, images }); }
200
- /**
201
- * The durable run marker (`session_stream_state`), the row the sidebar's
202
- * spinner and a reattaching tab's "still running" answer read. A field so a
203
- * unit test can stub it: the default writes the same row omp's dispatch writes.
204
- */
238
+
239
+ /** The durable run marker the sidebar's spinner and a reattaching tab read. A
240
+ * field so a unit test can stub it. */
205
241
  markStream: (status: 'stream' | 'finish' | 'abort', failure?: string | null) => void = (status, failure) => {
206
242
  if (!this.sessionId) return;
207
243
  void markStreamStatus(this.sessionId, status, status === 'stream' ? this.runModel : undefined, failure).catch(() => {});
208
244
  };
209
245
 
210
- /** Turn-end bookkeeping the panels read — see `endAcpTurn`. Returns the
211
- * child-outcome write, so a caller that must observe it can await it. */
246
+ /** Turn-end bookkeeping the panels read — see `endAcpTurn`, plus the held
247
+ * input that becomes the next turn. */
212
248
  onTurnEnded(info: AcpTurnEndInfo): Promise<void> {
213
- return endAcpTurn(this, info);
249
+ const reported = endAcpTurn(this, info);
250
+ // A held input is the NEXT turn: the queue lives in the turn machine, and a
251
+ // session that never drains it loses the message silently.
252
+ const next = this.turns.takeQueued();
253
+ if (next) {
254
+ try {
255
+ this.startTurn(next.message, next.images);
256
+ } catch {
257
+ // A turn that reopened first (a background interval) wins; the input is
258
+ // dropped rather than re-queued behind an indefinite run.
259
+ }
260
+ }
261
+ return reported;
262
+ }
263
+
264
+ /** Drop this session so the next command respawns it and resumes the agent's
265
+ * own history. Called when the agent reports the session is gone. */
266
+ dropLostSession(): void {
267
+ this.emit({ type: 'notice', level: 'warning', message: LOST_SESSION_NOTICE });
268
+ void this.destroyAndWait();
214
269
  }
215
270
 
216
271
  /** Dispatcher seam: stop the turn and answer every parked approval. */
@@ -226,68 +281,37 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
226
281
  this.accessMode = mode;
227
282
  }
228
283
 
229
- /** Dispatcher seam: write one config selector — see `session-config.ts`. */
284
+ /** Dispatcher seam: the selector writes this session accepts. */
230
285
  async setConfig(configId: string, value: string | boolean): Promise<unknown> {
231
- return setAcpConfig(this, configId, value);
286
+ return setAcpConfig(this.config, configId, value);
232
287
  }
233
288
 
234
289
  /** `session/set_mode`: the pre-config-options way to move a mode. */
235
290
  async setMode(modeId: string): Promise<unknown> {
236
- return setAcpMode(this, modeId);
291
+ return setAcpMode(this.config, modeId);
237
292
  }
238
293
 
239
- /** The process half of `setAcpConfig`/`setAcpMode`. */
240
- writeConfigOption(configId: string, value: string | boolean): Promise<unknown> {
241
- return this.proc.setConfigOption(this.sessionId, configId, value);
242
- }
243
-
244
- writeMode(modeId: string): Promise<unknown> {
245
- return this.proc.setMode(this.sessionId, modeId);
246
- }
247
-
248
- /** Dispatcher seam: answer a pending approval dialog. Every exit answers the
249
- * agent — a silent return would hang it (see `session-config.ts`). */
250
- resolvePermission(dialogId: string, confirmed: boolean): unknown {
251
- settlePermissionDialog(this.permissions, this.proc, dialogId, confirmed);
294
+ /** Answer a pending approval — every exit answers the agent, or it hangs. */
295
+ resolvePermission(dialogId: string, confirmed: boolean, optionId?: string): unknown {
296
+ answerAcpDialog(this.permissions, this.proc, dialogId, confirmed, optionId);
252
297
  return null;
253
298
  }
254
299
 
255
300
  webState(): Record<string, unknown> { return acpWebState(this); }
256
301
 
257
- /** Run one turn. The promise IS the turn: ACP resolves `session/prompt` when
258
- * the agent is done, so the reply is awaited for its whole duration. The ACK,
259
- * the refusal of a second prompt and the end bookkeeping are stated in
260
- * `session-turns.ts`.
261
- */
302
+ /** Run one turn — see `session-intake.ts` for the refusal and the ACK. */
262
303
  startTurn(message: string, images: unknown): unknown {
263
- // ACP's prompt capabilities are a MUST: an agent that did not advertise
264
- // `image` has to be told, not sent blocks its dispatcher rejects.
265
- if (!this.acceptsImages && Array.isArray(images) && images.length > 0) {
266
- throw new Error(`This harness does not accept image attachments (${this.harness})`);
267
- }
268
- // A new prompt is the next request, so the agent flushes any held update
269
- // itself; a probe would duplicate it.
270
- this.background.stop();
271
- this.promptCount += 1;
272
- this.usage.beginTurn();
273
- const ack = beginAcpTurn(this, this.turns, message, images);
274
- // Only a delivered turn is recorded: a refusal must not leave a user row.
275
- this.emit({ type: 'user_turn', message, images });
276
- return ack;
304
+ return startAcpPrompt(this, message, images);
305
+ }
306
+
307
+ /** The seam `startAcpPrompt` opens a turn through. */
308
+ beginTurn(message: string, images: unknown): unknown {
309
+ return beginAcpTurn(this, this.turns, message, images);
277
310
  }
278
311
 
312
+ /** One agent notification, routed — see `session-notify.ts`. */
279
313
  private onNotification(method: string, params: Record<string, unknown>): void {
280
- // A long turn emits no commands but plenty of `session/update` frames.
281
- this.idle.reset();
282
- // The same frames are the only evidence a turn is still alive: ACP has no
283
- // probe, so the silence ceiling is what bounds a wedged agent.
284
- this.turns.noteActivity();
285
- // `$/cancel_request` names an agent→client request the agent no longer
286
- // wants; the approval it parks is answered `cancelled`.
287
- if (handleAcpCancelRequest(this, method, params)) return;
288
- // A `session/load` replay repeats the whole chat; leave it to the probe.
289
- if (this.background.consume(method, params)) return;
290
- handleSessionNotification(this, method, params);
314
+ handleAcpNotification(this, method, params);
291
315
  }
292
316
 
293
317
  absorbUsage(update: Record<string, unknown>): void { this.usage.absorb(update); }
@@ -295,32 +319,25 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
295
319
  acceptingFrames(): boolean { return this.replay.isActive || this.turns.acceptingFrames(); }
296
320
  mapUpdate(update: Record<string, unknown>): AgentEvent[] { return this.mapper.mapUpdate(update); }
297
321
  onStateUpdate(update: Record<string, unknown>): void { this.turns.onStateUpdate(update); this.replay.markIdle(update.state); }
298
- /** Answer an agent→client request with a result (cancellation uses it). */
299
322
  respond(id: AcpId, result: unknown): void { this.proc.respond(id, result); }
300
- /** Agent→client requests: every branch answers or refuses — an unanswered call parks the turn. */
323
+ /** Agent→client requests: every branch answers or refuses. */
301
324
  private onClientRequest(id: AcpId, method: string, params: Record<string, unknown>): Promise<AcpClientRequestAnswer> {
302
325
  this.idle.reset();
303
326
  return handleAcpClientRequest(this, id, method, params);
304
327
  }
305
328
 
306
- /** The agent's process is gone — see `reportAcpExit`; returns its notice write. */
307
- private onExit(info: { code: number | null; stderrTail: string }): Promise<void> {
308
- this.destroyed = true;
309
- this.background.stop();
310
- this.idle.stop();
311
- const reported = this.closing ? Promise.resolve() : reportAcpExit(this, info);
312
- this.destroyHook?.();
313
- return reported;
329
+ /** The agent's process is gone — see `session-lifecycle.ts`. */
330
+ private onExit(info: AcpExitInfo): Promise<void> {
331
+ return acpExited(this, info);
314
332
  }
315
333
 
316
334
  destroy(): void { void this.destroyAndWait(); }
317
335
 
318
336
  /** Remove this chat from the agent's own history, when it offers the method.
319
337
  *
320
- * `false` means the agent advertises no `session/delete` (or this session has
321
- * no agent id yet) — the caller then falls back to the local store. A failure
322
- * is THROWN: the delete route refuses and shows the agent's words, because a
323
- * swallowed error here is a row that returns on the next import. */
338
+ * `false` (no `session/delete`, or no agent id yet) makes the caller fall back
339
+ * to the local store; a failure is THROWN so the delete route can refuse
340
+ * instead of leaving a row that returns on the next import. */
324
341
  async deleteAgentSession(): Promise<boolean> {
325
342
  if (!this.sessionId || !this.capabilities.deleteSession) return false;
326
343
  await this.proc.deleteSession(this.sessionId, 10_000);
@@ -328,13 +345,6 @@ export class AcpSession implements HarnessSession, AcpCommandHost {
328
345
  }
329
346
 
330
347
  async destroyAndWait(): Promise<void> {
331
- if (this.destroyed) return;
332
- this.destroyed = true;
333
- this.closing = true;
334
- this.background.stop();
335
- this.idle.stop();
336
- this.permissions.clear();
337
- await this.proc.dispose().catch(() => {});
338
- this.destroyHook?.();
348
+ await destroyAcp(this);
339
349
  }
340
350
  }
@@ -31,6 +31,7 @@ import {
31
31
  isKnownToolName,
32
32
  toolTypeFor,
33
33
  } from '@/server/lib/harness/acp/mapper';
34
+ import { delegationLabel, resolveToolIdentity } from '@/server/lib/harness/acp/tool-identity';
34
35
  import type { AcpToolKind, AcpToolStatus } from '@/server/lib/harness/acp/protocol';
35
36
 
36
37
  /** The message block a tool card renders from. */
@@ -41,6 +42,8 @@ export interface ToolCallBlock {
41
42
  arguments?: Record<string, unknown>;
42
43
  toolKind?: AcpToolKind;
43
44
  toolType?: string;
45
+ /** The adapter's own kind, when it is not one of the spec's ten. */
46
+ rawKind?: string;
44
47
  }
45
48
 
46
49
  interface OpenTool {
@@ -82,23 +85,30 @@ export class AcpToolCalls {
82
85
  open(update: Record<string, unknown>): AgentEvent[] {
83
86
  const toolCallId = typeof update.toolCallId === 'string' ? update.toolCallId : '';
84
87
  if (!toolCallId) return [];
85
- const name = typeof update.name === 'string' && update.name
86
- ? update.name
87
- : typeof update.title === 'string' && update.title
88
- ? update.title
89
- : 'tool';
90
- const kind = typeof update.kind === 'string' ? (update.kind as AcpToolKind) : undefined;
91
- const status = typeof update.status === 'string' ? (update.status as AcpToolStatus) : 'pending';
92
- // A specific kind is authoritative. `other`/absent is only an explicit type
93
- // when the name is one the renderers know; otherwise the shared parser's
94
- // own inference from the name is better informed than a forced `read`.
95
- const toolType = kind !== undefined && kind !== 'other'
96
- ? toolTypeFor(kind, name)
97
- : isKnownToolName(name) ? toolTypeFor(kind, name) : undefined;
88
+ // The identity is resolved, not read off the top level: grok names its tool
89
+ // in `_meta` and cursor names it in `rawInput._toolName`, and reading only
90
+ // `update.name` made a subagent a generic tool (or, with `kind` alone, a
91
+ // file read).
92
+ const identity = resolveToolIdentity(update);
98
93
  const rawInput = update.rawInput;
99
94
  const args = rawInput && typeof rawInput === 'object' && !Array.isArray(rawInput)
100
95
  ? Object.fromEntries(Object.entries(rawInput))
101
96
  : undefined;
97
+ const title = typeof update.title === 'string' ? update.title : undefined;
98
+ const name = identity.name ?? title ?? 'tool';
99
+ // A delegation IS a subagent: it gets the `task` panel, not the read/edit
100
+ // one, and its label is the child's task so the card says what it is doing.
101
+ const delegation = delegationLabel(name, args, title);
102
+ const kind = identity.kind;
103
+ const status = typeof update.status === 'string' ? (update.status as AcpToolStatus) : 'pending';
104
+ // A specific kind is authoritative. `other`/absent is only an explicit type
105
+ // when the name is one the renderers know; otherwise the shared parser's
106
+ // own inference from the name is better informed than a forced `read`.
107
+ const toolType = delegation
108
+ ? 'task'
109
+ : kind !== undefined && kind !== 'other'
110
+ ? toolTypeFor(kind, name)
111
+ : isKnownToolName(name) ? toolTypeFor(kind, name) : undefined;
102
112
 
103
113
  this.host.pushBlock({
104
114
  type: 'toolCall',
@@ -106,6 +116,7 @@ export class AcpToolCalls {
106
116
  name,
107
117
  ...(args ? { arguments: args } : {}),
108
118
  ...(kind ? { toolKind: kind } : {}),
119
+ ...(identity.rawKind ? { rawKind: identity.rawKind } : {}),
109
120
  ...(toolType ? { toolType } : {}),
110
121
  });
111
122
 
@@ -121,7 +132,8 @@ export class AcpToolCalls {
121
132
  toolName: name,
122
133
  ...(toolType ? { toolType } : {}),
123
134
  ...(args ? { args } : {}),
124
- ...(typeof update.title === 'string' ? { intent: update.title } : {}),
135
+ // The child's task for a delegation; the adapter's title otherwise.
136
+ ...(delegation ?? title ? { intent: delegation ?? title } : {}),
125
137
  ...(acpToolTarget(update.locations, rawInput) ? { target: acpToolTarget(update.locations, rawInput) } : {}),
126
138
  },
127
139
  ];
@@ -133,7 +145,7 @@ export class AcpToolCalls {
133
145
  id: toolCallId,
134
146
  name,
135
147
  kind,
136
- title: typeof update.title === 'string' ? update.title : undefined,
148
+ title,
137
149
  status,
138
150
  rawOutput: update.rawOutput,
139
151
  content: update.content,