@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,47 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The order one agent notification is routed in.
8
+ *
9
+ * The order IS the rule: the idle clock and the silence ceiling must see every
10
+ * frame (that is the only evidence a turn is alive), `$/cancel_request` must be
11
+ * answered before the frame is folded, a `session/load` replay belongs to the
12
+ * background probe, and the raw panel reads the ORIGINAL payload — so the frame
13
+ * log is fed before the mapper folds it and before the turn gate can drop one.
14
+ */
15
+
16
+ import { handleAcpCancelRequest } from '@/server/lib/harness/acp/session-requests';
17
+ import { handleSessionNotification, type AcpNotificationHost } from '@/server/lib/harness/acp/session-notifications';
18
+ import type { RawNotificationSink } from '@/server/lib/harness/acp/raw-listeners';
19
+
20
+ /** What one routed notification reads. */
21
+ export interface AcpNotifyHost extends AcpNotificationHost {
22
+ readonly rawSink: RawNotificationSink;
23
+ readonly background: { consume(method: string, params: Record<string, unknown>): boolean };
24
+ readonly turns: { noteActivity(): void };
25
+ readonly idle: { reset(): void };
26
+ /** The approval queue, for a withdrawn `$/cancel_request`. */
27
+ respond(id: string | number, result: unknown): void;
28
+ readonly permissions: import('@/server/lib/harness/acp/permissions').PendingPermissions;
29
+ }
30
+
31
+ export function handleAcpNotification(
32
+ host: AcpNotifyHost,
33
+ method: string,
34
+ params: Record<string, unknown>,
35
+ ): void {
36
+ // A long turn emits no commands but plenty of `session/update` frames.
37
+ host.idle.reset();
38
+ // The same frames are the only evidence a turn is still alive: ACP has no
39
+ // probe, so the silence ceiling is what bounds a wedged agent.
40
+ host.turns.noteActivity();
41
+ // The agent withdrawing a request it made; the approval it parks is answered.
42
+ if (handleAcpCancelRequest(host, method, params)) return;
43
+ // A `session/load` probe's replay repeats the whole chat; it is the probe's.
44
+ if (host.background.consume(method, params)) return;
45
+ if (method === 'session/update') host.rawSink.emit(method, params);
46
+ handleSessionNotification(host, method, params);
47
+ }
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
18
18
  import { isolateDb, releaseDb } from '@/test-support/isolated-db';
19
- import { mountSession, notify } from '@/server/lib/harness/acp/session.test-util';
19
+ import { flushTicks, mountSession, notify } from '@/server/lib/harness/acp/session.test-util';
20
20
  import { loadAcpSessions, saveHarnessSession } from '@/server/lib/harness/session-store.server';
21
21
  import { onRealtimeSignal } from '@/server/lib/realtime/signals.server';
22
22
 
@@ -43,7 +43,7 @@ describe('ACP silent turn', () => {
43
43
  await turn.started;
44
44
  if (say) notify(session, { sessionUpdate: 'agent_message_chunk', content: { type: 'text', text: say } });
45
45
  turn.finish({ stopReason: 'end_turn' });
46
- for (let i = 0; i < 5; i += 1) await Promise.resolve();
46
+ await flushTicks();
47
47
  return events;
48
48
  };
49
49
 
@@ -88,7 +88,7 @@ describe('ACP stream marker', () => {
88
88
  expect(streamMarks()).toEqual(['stream']);
89
89
 
90
90
  turn.finish({ stopReason: 'end_turn' });
91
- for (let i = 0; i < 4; i += 1) await Promise.resolve();
91
+ await flushTicks();
92
92
  expect(streamMarks()).toEqual(['stream', 'finish']);
93
93
  });
94
94
 
@@ -107,7 +107,7 @@ describe('ACP stream marker', () => {
107
107
  // No answer at all is the ACP silent-turn verdict, and the only reason the
108
108
  // notification has to show.
109
109
  turn.finish({ stopReason: 'end_turn' });
110
- for (let i = 0; i < 4; i += 1) await Promise.resolve();
110
+ await flushTicks();
111
111
  expect(streamMarks()).toEqual(['stream', 'finish']);
112
112
  expect(streamMarkFailures()).toEqual([null, 'The agent ended the turn without sending an answer']);
113
113
  });
@@ -104,6 +104,70 @@ describe('ACP permission gating', () => {
104
104
  });
105
105
  });
106
106
 
107
+ describe('ACP approval options', () => {
108
+ const withOptions = (session: AcpSession, id: number, options: Array<{ optionId: string; kind: string }>, action = 'execute') =>
109
+ (session as unknown as PermissionHost).onClientRequest(id, 'session/request_permission', {
110
+ sessionId: 'acp-1',
111
+ toolCall: { kind: action, title: 'Run the thing', rawInput: { command: 'rm -rf build' } },
112
+ options,
113
+ });
114
+
115
+ test('dismissing a dialog with only an allow option answers cancelled, never allow', async () => {
116
+ const { session, permissionAnswers } = mountSession();
117
+ await withOptions(session, 30, [{ optionId: 'allow', kind: 'allow_once' }]);
118
+ session.resolvePermission('30', false);
119
+ expect(permissionAnswers()).toEqual([
120
+ { id: 30, result: { outcome: { outcome: 'cancelled' } } },
121
+ ]);
122
+ });
123
+
124
+ test('Confirm picks the allow option even when the agent lists reject first', async () => {
125
+ const { session, permissionAnswers } = mountSession();
126
+ await withOptions(session, 31, [
127
+ { optionId: 'deny', kind: 'reject_once' },
128
+ { optionId: 'allow', kind: 'allow_once' },
129
+ ]);
130
+ session.resolvePermission('31', true);
131
+ expect(permissionAnswers()).toEqual([
132
+ { id: 31, result: { outcome: { outcome: 'selected', optionId: 'allow' } } },
133
+ ]);
134
+ });
135
+
136
+ test('an "always allow" choice answers that option and silences the next identical request', async () => {
137
+ const { session, events, permissionAnswers } = mountSession();
138
+ await withOptions(session, 32, [
139
+ { optionId: 'once', kind: 'allow_once' },
140
+ { optionId: 'always', kind: 'allow_always' },
141
+ { optionId: 'deny', kind: 'reject_once' },
142
+ ]);
143
+ session.resolvePermission('32', false, 'always');
144
+ expect(permissionAnswers()).toEqual([
145
+ { id: 32, result: { outcome: { outcome: 'selected', optionId: 'always' } } },
146
+ ]);
147
+ const before = dialogs(events);
148
+ expect(await withOptions(session, 33, [
149
+ { optionId: 'once', kind: 'allow_once' },
150
+ { optionId: 'always', kind: 'allow_always' },
151
+ ])).toEqual({
152
+ answered: true,
153
+ result: { outcome: { outcome: 'selected', optionId: 'always' } },
154
+ });
155
+ expect(dialogs(events)).toBe(before);
156
+ });
157
+
158
+ test('a choice id the dialog does not hold is never substituted', async () => {
159
+ const { session, permissionAnswers } = mountSession();
160
+ await withOptions(session, 34, [
161
+ { optionId: 'allow', kind: 'allow_once' },
162
+ { optionId: 'deny', kind: 'reject_once' },
163
+ ]);
164
+ session.resolvePermission('34', true, 'not-an-option');
165
+ expect(permissionAnswers()).toEqual([
166
+ { id: 34, result: { outcome: { outcome: 'selected', optionId: 'allow' } } },
167
+ ]);
168
+ });
169
+ });
170
+
107
171
  describe('ACP cancellation answers parked approvals', () => {
108
172
  test('Stop answers every parked request with the cancelled outcome', async () => {
109
173
  const { session, permissionAnswers } = mountSession();
@@ -19,11 +19,12 @@ import type { AcpId } from '@/server/lib/harness/acp/protocol';
19
19
  import type { PendingPermissions } from '@/server/lib/harness/acp/permissions';
20
20
  import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
21
21
  import { allowOption, autoApproval, type PermissionOption } from '@/server/lib/harness/acp/permissions';
22
+ import { permissionGrantKey } from '@/server/lib/harness/acp/grants';
22
23
  import { noteAwaitingInput } from '@/server/lib/notifications/feed.server';
23
24
 
24
25
  /**
25
- * The option id to select when the tier already allows this call, or null to
26
- * park it as a dialog.
26
+ * The option id to select when the tier (or a standing grant) already allows
27
+ * this call, or null to park it as a dialog.
27
28
  *
28
29
  * Answered HERE, before a dialog exists: parking it would ask a question the
29
30
  * operator's own selection already answered, and `isBusy()` would report a
@@ -32,12 +33,16 @@ import { noteAwaitingInput } from '@/server/lib/notifications/feed.server';
32
33
  export function preApprovedOption(
33
34
  accessMode: ApprovalMode,
34
35
  params: Record<string, unknown>,
36
+ permissions?: PendingPermissions,
35
37
  ): string | null {
36
38
  const toolCall = params.toolCall && typeof params.toolCall === 'object'
37
39
  ? Object.fromEntries(Object.entries(params.toolCall))
38
40
  : undefined;
39
- if (!autoApproval(accessMode, toolCall)) return null;
40
41
  const options = Array.isArray(params.options) ? (params.options as PermissionOption[]) : [];
42
+ // A standing "always allow" is the operator's own answer to this exact call;
43
+ // it wins over the tier, including one that would otherwise ask.
44
+ if (permissions?.grants.has(permissionGrantKey(toolCall))) return allowOption(options, 'always');
45
+ if (!autoApproval(accessMode, toolCall)) return null;
41
46
  return allowOption(options);
42
47
  }
43
48
 
@@ -99,7 +104,7 @@ export function answerPermissionRequest(
99
104
  id: AcpId,
100
105
  params: Record<string, unknown>,
101
106
  ): Promise<PermissionRequestAnswer> {
102
- const optionId = preApprovedOption(host.accessMode, params);
107
+ const optionId = preApprovedOption(host.accessMode, params, host.permissions);
103
108
  if (optionId) {
104
109
  return Promise.resolve({ answered: true, result: { outcome: { outcome: 'selected', optionId } } });
105
110
  }
@@ -54,6 +54,12 @@ export function handleAcpClientRequest(
54
54
  // The file surface the client advertised at `initialize`. Routed before the
55
55
  // refusal so an agent that took the advertisement at its word gets an answer.
56
56
  if (isAcpFsMethod(method)) return handleAcpFsRequest(host, method, params);
57
+ // Cursor asks the CLIENT to run a nested task (`cursor/task`, measured on
58
+ // cursor-agent 2026.08.11). Answering `-32601` made its adapter fall back with
59
+ // an error in the middle of a delegation the tool card had already drawn; an
60
+ // empty result is what the adapter expects from a client that does not run
61
+ // the child itself.
62
+ if (method === 'cursor/task') return Promise.resolve({ answered: true, result: {} });
57
63
  // `-32601`, not "internal error": the agent decides from the code whether this
58
64
  // client simply lacks the method (Spec §Errors).
59
65
  return Promise.resolve({
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The directories one ACP chat may work in.
8
+ *
9
+ * ACP carries `additionalDirectories` on `session/new|load|resume|fork` when the
10
+ * agent advertises `sessionCapabilities.additionalDirectories`. Kabmo never sent
11
+ * it, so an agent driving a WORKTREE chat could only write inside the worktree
12
+ * — and its `fs/*` calls for the repository the worktree belongs to were refused
13
+ * as "outside this session's workspace".
14
+ *
15
+ * The roots are computed from what Kabmo already knows: the session's cwd, plus
16
+ * the primary repository root when the cwd IS a worktree (the worktree registry
17
+ * holds that pair). Nothing else is invented — a root the client will not serve
18
+ * must not be advertised to the agent either.
19
+ */
20
+
21
+ import { getDb } from '@/server/db.server';
22
+ import { worktreeRowFor } from '@/server/lib/db/worktree-registry.server';
23
+
24
+ /** The session's own root plus any registered parent repository root. */
25
+ export async function sessionRoots(cwd: string): Promise<string[]> {
26
+ const roots = [cwd];
27
+ try {
28
+ const db = await getDb();
29
+ const row = await worktreeRowFor(db, cwd);
30
+ if (row?.primary_root && row.primary_root !== cwd) roots.push(row.primary_root);
31
+ } catch {
32
+ // no-excuse-ok: catch — an unreadable worktree registry leaves one root,
33
+ // which is the same behaviour as before this module existed.
34
+ }
35
+ return roots;
36
+ }
37
+
38
+ /** The `additionalDirectories` list to send, or nothing when the capability is
39
+ * absent or there is only one root. */
40
+ export function additionalDirectoriesFor(
41
+ roots: readonly string[],
42
+ cwd: string,
43
+ advertised: boolean,
44
+ ): { additionalDirectories?: string[] } {
45
+ const extra = roots.filter((root) => root !== cwd);
46
+ return advertised && extra.length > 0 ? { additionalDirectories: extra } : {};
47
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `additionalDirectories` is only sent when the agent advertised it.
8
+ *
9
+ * The gate is the point: the field is a v2 capability, and an agent that does
10
+ * not advertise it must not receive it — at best the key is ignored, at worst the
11
+ * whole setup request is refused and no chat starts at all.
12
+ */
13
+
14
+ import { describe, expect, test } from 'bun:test';
15
+ import { additionalDirectoriesFor } from '@/server/lib/harness/acp/session-roots.server';
16
+
17
+ describe('additionalDirectoriesFor', () => {
18
+ test('sends the extra roots when the agent advertised the capability', () => {
19
+ expect(additionalDirectoriesFor(['/work/repo', '/work/repo-a'], '/work/repo-a', true)).toEqual({
20
+ additionalDirectories: ['/work/repo'],
21
+ });
22
+ });
23
+
24
+ test('sends nothing when the capability is absent', () => {
25
+ expect(additionalDirectoriesFor(['/work/repo', '/work/repo-a'], '/work/repo-a', false)).toEqual({});
26
+ });
27
+
28
+ test('sends nothing when the session has only its own root', () => {
29
+ expect(additionalDirectoriesFor(['/work/repo'], '/work/repo', true)).toEqual({});
30
+ });
31
+ });
@@ -22,12 +22,16 @@ import type {
22
22
  AcpHandshakeTarget,
23
23
  } from '@/server/lib/harness/acp/session-handshake';
24
24
  import { handshakeAcpSession } from '@/server/lib/harness/acp/session-handshake';
25
+ import { loadAcpGrants } from '@/server/lib/harness/acp/grants.server';
25
26
  import type { IdleReaper } from '@/server/lib/omp/rpc/idle-reaper';
26
27
 
27
28
  /** The session slice a start drives: the handshake target, its clock and id. */
28
29
  export interface AcpStartTarget extends AcpHandshakeTarget {
29
30
  sessionId: string;
30
31
  idle: IdleReaper;
32
+ /** The approval queue, so the grants earned in an earlier process are
33
+ * hydrated before the first `session/request_permission` can arrive. */
34
+ permissions?: { grants: { hydrate(keys: readonly string[]): void } };
31
35
  }
32
36
 
33
37
  export async function startAcpSession(
@@ -56,6 +60,9 @@ export async function startAcpSession(
56
60
  );
57
61
  if (wantsReplay) await replay.run(mapper, handshake);
58
62
  else await handshake();
63
+ // "Always allow" is the operator's standing decision for this chat; a new
64
+ // child must not ask again. Read once, before the session can take a prompt.
65
+ target.permissions?.grants.hydrate(await loadAcpGrants(target.sessionId));
59
66
  // A slow handshake is not idleness: the window starts once it is usable.
60
67
  target.idle.reset(true);
61
68
  return { sessionId: target.sessionId };
@@ -46,6 +46,7 @@ import type { AcpTurns, AcpTurnEndInfo } from '@/server/lib/harness/acp/turn';
46
46
  import { driveAcpGoalAfterTurn } from '@/server/lib/harness/acp/acp-goal-driver.server';
47
47
  import type { AcpGoalHost } from '@/server/lib/harness/acp/acp-goal.server';
48
48
  import { assistantTextOf, spawnsBackgroundWork } from '@/server/lib/harness/acp/background-work';
49
+ import { isLostSession } from '@/server/lib/harness/acp/session-lost';
49
50
 
50
51
  /** What a turn reads and moves on the session. */
51
52
  export interface AcpTurnTarget {
@@ -62,6 +63,9 @@ export interface AcpTurnTarget {
62
63
  isAlive(): boolean;
63
64
  isBusy(): boolean;
64
65
  send(command: Record<string, unknown>): Promise<unknown>;
66
+ /** Drop this session when the agent says it no longer has it, so the next
67
+ * command respawns and resumes. */
68
+ dropLostSession?: () => void;
65
69
  }
66
70
 
67
71
  /** What the turn-end bookkeeping moves on the session. */
@@ -152,6 +156,13 @@ export async function settleAcpTurn(
152
156
  if (finalText && status === 'completed') {
153
157
  void saveSessionAnswer(target.sessionId, finalText).catch(() => {});
154
158
  }
159
+ // A lost agent session is not recoverable in THIS process: every later prompt
160
+ // answers the same refusal. Dropping the session lets the route respawn it and
161
+ // resume from the agent's own history — the alternative is a chat that can
162
+ // never send again.
163
+ if (isLostSession(info.failure) && target.dropLostSession) {
164
+ target.dropLostSession();
165
+ }
155
166
  const reported = noteChildOutcome({
156
167
  sessionId: target.sessionId,
157
168
  status,
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The seams an ACP session binds at construction: the turn machine and the
8
+ * background probe.
9
+ *
10
+ * Both are pure wiring over the process and the mapper, and both are the place a
11
+ * reader gets lost inside `session.ts` — the turn machine's `prompt` seam builds
12
+ * the blocks a prompt sends, and the probe's `load` is a `session/load` on the
13
+ * session's OWN id. Naming them here keeps the session class to the state it
14
+ * owns.
15
+ */
16
+
17
+ import {
18
+ AcpBackgroundProbe,
19
+ BACKGROUND_LOAD_TIMEOUT_MS,
20
+ deliverBackgroundNotice,
21
+ type BackgroundNoticeHost,
22
+ } from '@/server/lib/harness/acp/background-work';
23
+ import type { AcpProcess } from '@/server/lib/harness/acp/client';
24
+ import type { AcpFrameMapper } from '@/server/lib/harness/acp/frames';
25
+ import { promptBlocks } from '@/server/lib/harness/acp/prompt';
26
+ import { promptFileLinks } from '@/server/lib/harness/acp/prompt-files';
27
+ import { AcpTurns, type AcpTurnEndInfo } from '@/server/lib/harness/acp/turn';
28
+ import { stampMessageModel } from '@/server/lib/harness/acp/session-config';
29
+ import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
30
+ import type { IdleReaper } from '@/server/lib/omp/rpc/idle-reaper';
31
+
32
+ /** Everything the two seams read off the session. The counts are the background
33
+ * notice's alone: it emits one synthetic assistant row and has to move them. */
34
+ export interface AcpWiringHost extends BackgroundNoticeHost {
35
+ readonly cwd: string;
36
+ readonly proc: AcpProcess;
37
+ readonly mapper: AcpFrameMapper;
38
+ readonly idle: IdleReaper;
39
+ sessionId: string;
40
+ runModel: { provider: string; modelId: string } | null;
41
+ emit(event: AgentEvent): void;
42
+ onTurnEnded(info: AcpTurnEndInfo): void;
43
+ }
44
+
45
+ /** The wiring a session builds for itself: live getters, so the handshake's id
46
+ * and model reach the turn machine without a second assignment. */
47
+ export function acpWiringFor(session: {
48
+ cwd: string;
49
+ sessionId: string;
50
+ runModel: { provider: string; modelId: string } | null;
51
+ messageCount: number;
52
+ assistantCount: number;
53
+ emit(event: AgentEvent): void;
54
+ onTurnEnded(info: AcpTurnEndInfo): Promise<void>;
55
+ }, parts: { proc: AcpProcess; mapper: AcpFrameMapper; idle: IdleReaper }): AcpWiringHost {
56
+ return {
57
+ cwd: session.cwd,
58
+ proc: parts.proc,
59
+ mapper: parts.mapper,
60
+ idle: parts.idle,
61
+ get sessionId() { return session.sessionId; },
62
+ get runModel() { return session.runModel; },
63
+ get messageCount() { return session.messageCount; },
64
+ get assistantCount() { return session.assistantCount; },
65
+ emit: (event) => session.emit(event),
66
+ onTurnEnded: (info) => void session.onTurnEnded(info),
67
+ };
68
+ }
69
+
70
+ /** The background probe: ACP holds a subagent's completion until the next
71
+ * request, and `session/load` is the only request that surfaces it. */
72
+ export function acpBackgroundProbe(host: AcpWiringHost): AcpBackgroundProbe {
73
+ return new AcpBackgroundProbe({
74
+ load: () => host.proc.loadSession(host.sessionId, host.cwd, BACKGROUND_LOAD_TIMEOUT_MS),
75
+ resetIdle: () => host.idle.reset(),
76
+ emit: (text) => deliverBackgroundNotice(host, text),
77
+ });
78
+ }
79
+
80
+ /** The turn machine: one prompt, its frames, and how it ends. */
81
+ export function acpTurns(host: AcpWiringHost): AcpTurns {
82
+ return new AcpTurns({
83
+ emit: (event) => host.emit(event),
84
+ prompt: (message, images) =>
85
+ // `@path` mentions travel as `resource_link` blocks: no agent but omp
86
+ // expands them, and the file would otherwise reach the model as a path
87
+ // with no bytes behind it.
88
+ promptFileLinks(host.cwd, message).then(
89
+ (files) => host.proc.prompt(host.sessionId, promptBlocks(message, images, files), 0) as Promise<{ stopReason?: string } | undefined>,
90
+ ),
91
+ cancelAgent: () => host.proc.cancel(host.sessionId),
92
+ abandonPrompt: () => host.proc.abandonPrompt(host.sessionId),
93
+ resetMapper: () => host.mapper.reset(),
94
+ closeMessage: () => host.mapper.closeMessage().map((event) => stampMessageModel(event, host.runModel)),
95
+ openCalls: () => host.mapper.openCalls(),
96
+ // Armed from the turn's END, exactly as the omp wrapper arms it from its own
97
+ // terminal settle: without this a queued follow-up never left the table.
98
+ onTurnEnd: (info) => host.onTurnEnded(info),
99
+ });
100
+ }
@@ -24,7 +24,9 @@ import { AcpUsageMeter } from '@/server/lib/harness/acp/session-usage';
24
24
  import { AcpFrameMapper } from '@/server/lib/harness/acp/frames';
25
25
  import { AcpTurns } from '@/server/lib/harness/acp/turn';
26
26
  import { SessionListeners } from '@/server/lib/harness/acp/session-listeners';
27
+ import { RawNotificationSink } from '@/server/lib/harness/acp/raw-listeners';
27
28
  import { PendingPermissions } from '@/server/lib/harness/acp/permissions';
29
+ import { acpConfigView } from '@/server/lib/harness/acp/session-config-view';
28
30
  import { stampMessageModel } from '@/server/lib/harness/acp/session-config';
29
31
  import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
30
32
 
@@ -69,6 +71,16 @@ export interface BackgroundProbeStub {
69
71
  consume: (method: string, params: Record<string, unknown>) => boolean;
70
72
  }
71
73
 
74
+ /** Drain the microtask queue.
75
+ *
76
+ * `session/prompt` is chained: a settle resolves the stub, then the busy-retry
77
+ * wrapper, the turn's `settle`, `finish`, the end seams and the queue each take
78
+ * a hop. Four ticks stopped being enough the moment that wrapper existed; this
79
+ * is a fixed count of hops, not a wall-clock wait. */
80
+ export async function flushTicks(count = 24): Promise<void> {
81
+ for (let i = 0; i < count; i += 1) await Promise.resolve();
82
+ }
83
+
72
84
  /** One in-flight `session/prompt` the stub can settle. */
73
85
  interface PendingPrompt {
74
86
  promise: Promise<unknown>;
@@ -76,7 +88,7 @@ interface PendingPrompt {
76
88
  reject: (reason?: unknown) => void;
77
89
  }
78
90
 
79
- export function mountSession(): MountedSession {
91
+ export function mountSession(options: { busyWaitMs?: number } = {}): MountedSession {
80
92
  const events: AgentEvent[] = [];
81
93
  const dispatched = Promise.withResolvers<void>();
82
94
  const calls: PendingPrompt[] = [];
@@ -113,6 +125,8 @@ export function mountSession(): MountedSession {
113
125
  // A config write; the default reply omits the list, which is the shape a
114
126
  // harness that ignores the protocol's "complete list" rule returns.
115
127
  setConfigOption: async (_sessionId: string, _configId: string, _value: string | boolean) => ({}),
128
+ setMode: async (_sessionId: string, _modeId: string) => ({}),
129
+ setModel: async (_sessionId: string, _modelId: string) => ({}),
116
130
  deleteSession: async (sessionId: string) => {
117
131
  deletes.push(sessionId);
118
132
  return {};
@@ -134,7 +148,7 @@ export function mountSession(): MountedSession {
134
148
  .onTurnEnded(info);
135
149
  turnEndCount += 1;
136
150
  },
137
- });
151
+ }, options);
138
152
  const marks: string[] = [];
139
153
  const markFailures: Array<string | null> = [];
140
154
  const answers: { id: unknown; result: unknown }[] = [];
@@ -157,6 +171,25 @@ export function mountSession(): MountedSession {
157
171
  turns,
158
172
  mapper,
159
173
  permissions: new PendingPermissions(),
174
+ // The config view is a constructor field; a prototype mount has none, and
175
+ // `set_model` writes through it.
176
+ config: acpConfigView(
177
+ {
178
+ get harness() { return 'opencode'; },
179
+ get sessionId() { return 'acp-1'; },
180
+ get configOptions() { return session.configOptions; },
181
+ set configOptions(options) { session.configOptions = options; },
182
+ get runModel() { return session.runModel; },
183
+ set runModel(model) { session.runModel = model; },
184
+ get modes() { return session.modes; },
185
+ set modes(modes) { session.modes = modes; },
186
+ get models() { return session.models; },
187
+ set models(models) { session.models = models; },
188
+ get isStreaming() { return session.isStreaming; },
189
+ emit: (event) => session.emit(event),
190
+ },
191
+ proc,
192
+ ),
160
193
  accessMode: 'always-ask',
161
194
  capabilities: {},
162
195
  configOptions: [],
@@ -168,6 +201,7 @@ export function mountSession(): MountedSession {
168
201
  usage: new AcpUsageMeter(),
169
202
  runModel: null,
170
203
  events: eventSink,
204
+ rawSink: new RawNotificationSink(),
171
205
  proc,
172
206
  idle,
173
207
  destroyed: false,
@@ -13,7 +13,7 @@
13
13
 
14
14
  import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
15
15
  import { isolateDb, releaseDb } from '@/test-support/isolated-db';
16
- import { mountSession, notify } from '@/server/lib/harness/acp/session.test-util';
16
+ import { flushTicks, mountSession, notify } from '@/server/lib/harness/acp/session.test-util';
17
17
  import { createSessionRelation } from '@/server/lib/sessions/relations.server';
18
18
  import { materializeNotice } from '@/server/lib/sessions/notify.server';
19
19
  import {
@@ -50,7 +50,7 @@ describe('ACP prompt dispatch', () => {
50
50
  expect(events.some((event) => event.type === 'agent_end')).toBe(false);
51
51
 
52
52
  turn.finish({ stopReason: 'end_turn' });
53
- for (let i = 0; i < 4; i += 1) await Promise.resolve();
53
+ await flushTicks();
54
54
 
55
55
  expect(events.find((event) => event.type === 'agent_end')).toMatchObject({
56
56
  type: 'agent_end',
@@ -64,7 +64,7 @@ describe('ACP prompt dispatch', () => {
64
64
  await session.send({ type: 'prompt', message: 'hello' });
65
65
  await turn.started;
66
66
  turn.fail(new Error('agent exploded'));
67
- for (let i = 0; i < 4; i += 1) await Promise.resolve();
67
+ await flushTicks();
68
68
  const errors = events.filter((event) => event.type === 'prompt_error');
69
69
  // The generic "no answer" verdict must not land on top of the agent's own
70
70
  // reason: it was emitted SECOND, so the client kept the useless one.
@@ -82,7 +82,7 @@ describe('ACP prompt dispatch', () => {
82
82
  expect(turnEnds()).toBe(0);
83
83
 
84
84
  turn.finish({ stopReason: 'end_turn' });
85
- for (let i = 0; i < 4; i += 1) await Promise.resolve();
85
+ await flushTicks();
86
86
  expect(turnEnds()).toBe(1);
87
87
  });
88
88
  });
@@ -108,7 +108,7 @@ describe('ACP cancel', () => {
108
108
  // The agent's own reply to the cancel arrives late; it must not close a turn
109
109
  // that is already closed.
110
110
  turn.finish({ stopReason: 'cancelled' });
111
- for (let i = 0; i < 4; i += 1) await Promise.resolve();
111
+ await flushTicks();
112
112
  expect(session.isRunning()).toBe(false);
113
113
  });
114
114
 
@@ -118,7 +118,7 @@ describe('ACP cancel', () => {
118
118
  await session.send({ type: 'prompt', message: 'long job' });
119
119
  session.cancelTurn();
120
120
  turn.finish({ stopReason: 'cancelled' });
121
- for (let i = 0; i < 4; i += 1) await Promise.resolve();
121
+ await flushTicks();
122
122
 
123
123
  const ends = events.filter((event) => event.type === 'agent_end');
124
124
  expect(ends).toHaveLength(1);
@@ -141,7 +141,7 @@ describe('ACP turn serialization', () => {
141
141
  // it — never went out and every later send was refused as "already
142
142
  // processing". Settling it locally is what frees the chain.
143
143
  await session.send({ type: 'prompt', message: 'second' });
144
- for (let i = 0; i < 8; i += 1) await Promise.resolve();
144
+ await flushTicks();
145
145
  expect(turn.calls()).toBe(2);
146
146
  expect(session.isRunning()).toBe(true);
147
147
  });
@@ -171,10 +171,10 @@ describe('ACP turn serialization', () => {
171
171
  await turn.started;
172
172
  session.cancelTurn();
173
173
  await session.send({ type: 'prompt', message: 'second' });
174
- for (let i = 0; i < 8; i += 1) await Promise.resolve();
174
+ await flushTicks();
175
175
 
176
176
  turn.finish({ stopReason: 'end_turn' });
177
- for (let i = 0; i < 8; i += 1) await Promise.resolve();
177
+ await flushTicks();
178
178
  expect(events.filter((event) => event.type === 'agent_end')).toHaveLength(2);
179
179
  expect(session.isRunning()).toBe(false);
180
180
  });
@@ -230,7 +230,7 @@ describe('ACP model identity', () => {
230
230
  });
231
231
 
232
232
  turn.finish({ stopReason: 'end_turn' });
233
- for (let i = 0; i < 8; i += 1) await Promise.resolve();
233
+ await flushTicks();
234
234
  expect(events.find((event) => event.type === 'message_end')?.message).toMatchObject({
235
235
  model: 'qwen3-8-27b:free',
236
236
  provider: 'kenari',