@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,166 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The Stats panel's Refresh control, mounted the way the host mounts it.
8
+ *
9
+ * Two reads make up one press, and each covers something the other does not:
10
+ *
11
+ * - the forced sample MEASURES — the server takes a snapshot now instead of
12
+ * waiting for its loop's next tick;
13
+ * - the topic resync RE-DELIVERS it — the publish reaches a healthy socket by
14
+ * push, so a reader whose socket missed that frame would otherwise watch the
15
+ * button spin and the panel keep the numbers it already had.
16
+ *
17
+ * Kept out of `app.test.tsx` because it is one self-contained concern and that
18
+ * file is at the repo's per-file ceiling.
19
+ */
20
+
21
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
22
+ import { Window } from 'happy-dom';
23
+ import { h, render } from 'preact';
24
+ import { act } from 'preact/test-utils';
25
+ import { loadPluginApp, uninstallTestPluginRuntime } from '@kabmo-labs/kabmo-sdk/testing/app';
26
+ import type { FakeKabmoHarness } from '@kabmo-labs/kabmo-sdk/testing';
27
+ import {
28
+ PanelHostProvider,
29
+ PluginIdProvider,
30
+ configureUiKit,
31
+ uiKitServices,
32
+ type UiKitServices,
33
+ } from '@kabmo-labs/kabmo-ui';
34
+
35
+ import pluginDefinition from './app';
36
+ import type { StatsSnapshot } from './sampler';
37
+
38
+ const DOM_GLOBALS = ['window', 'document', 'navigator', 'HTMLElement', 'Node', 'Text', 'Element', 'SVGElement'] as const;
39
+ const saved = new Map<string, unknown>();
40
+
41
+ beforeAll(() => {
42
+ const win = new Window({ url: 'http://localhost/' });
43
+ for (const key of DOM_GLOBALS) {
44
+ saved.set(key, Reflect.get(globalThis, key));
45
+ Reflect.set(globalThis, key, (win as unknown as Record<string, unknown>)[key]);
46
+ }
47
+ });
48
+
49
+ afterEach(() => {
50
+ uninstallTestPluginRuntime();
51
+ });
52
+
53
+ afterAll(() => {
54
+ for (const key of DOM_GLOBALS) Reflect.set(globalThis, key, saved.get(key));
55
+ });
56
+
57
+ /** The id `loadPluginApp` registers under by default. */
58
+ const PLUGIN_ID = 'plugin-under-test';
59
+
60
+ function snapshot(): StatsSnapshot {
61
+ return {
62
+ sampledAt: Date.now(),
63
+ probe: { name: 'fake', supported: true },
64
+ rows: [
65
+ {
66
+ pid: 1,
67
+ ppid: 0,
68
+ title: 'Kabmo server',
69
+ detail: 'the server itself · 1m',
70
+ groupKey: 'kabmo',
71
+ depth: 0,
72
+ memory: 2 * 1024 * 1024,
73
+ memorySource: 'rss',
74
+ rss: 2 * 1024 * 1024,
75
+ cpuPercent: 1.5,
76
+ threads: 4,
77
+ },
78
+ ],
79
+ groups: [
80
+ {
81
+ key: 'kabmo',
82
+ kind: 'kabmo',
83
+ ownerPid: 1,
84
+ title: 'Kabmo server',
85
+ detail: 'the server itself · 1m',
86
+ processes: 1,
87
+ memory: 2 * 1024 * 1024,
88
+ cpuPercent: 1.5,
89
+ },
90
+ ],
91
+ total: { processes: 1, memory: 2 * 1024 * 1024, cpuPercent: 1.5 },
92
+ memorySource: 'rss',
93
+ machine: { totalMemBytes: 8 * 1024 ** 3, freeMemBytes: 1024 ** 3, cpuCount: 8, loadPerCore: 0.1 },
94
+ daemons: [],
95
+ serverPid: 1,
96
+ };
97
+ }
98
+
99
+ async function renderStatsPanel(harness: FakeKabmoHarness, services: UiKitServices): Promise<HTMLElement> {
100
+ const registration = harness.registrations.rightPanel;
101
+ if (!registration) throw new Error('the plugin registered no right panel');
102
+ configureUiKit(services);
103
+
104
+ const container = document.createElement('div');
105
+ document.body.appendChild(container);
106
+ await act(async () => {
107
+ render(
108
+ h(PanelHostProvider, {
109
+ value: { sessionId: null, enabled: true, active: true, refreshKey: 0 },
110
+ children: h(PluginIdProvider, {
111
+ pluginId: PLUGIN_ID,
112
+ children: h(registration.component, { sessionId: null, workspacePath: null }),
113
+ }),
114
+ }),
115
+ container,
116
+ );
117
+ });
118
+ // The arm call is a PROMISE: the mount effect starts it and the sampler's
119
+ // first snapshot lands on a later task, so the Refresh control exists only
120
+ // after the panel has settled.
121
+ await act(async () => {
122
+ const tick = Promise.withResolvers<void>();
123
+ setTimeout(tick.resolve, 0);
124
+ await tick.promise;
125
+ });
126
+ return container;
127
+ }
128
+
129
+ describe('StatsPanel refresh control', () => {
130
+ test('Refresh measures now AND asks the topic for its snapshot again', async () => {
131
+ const { harness } = loadPluginApp(pluginDefinition);
132
+ harness.services.rpc.stub('watch', { watching: 1 });
133
+ harness.services.rpc.stub('snapshot', snapshot());
134
+ harness.services.publishTopic(snapshot());
135
+ let topicRefreshes = 0;
136
+ const container = await renderStatsPanel(harness, {
137
+ ...harness.services,
138
+ refreshPluginTopic: () => {
139
+ topicRefreshes += 1;
140
+ },
141
+ });
142
+
143
+ const refresh = container.querySelector<HTMLButtonElement>('button[aria-label="Refresh stats"]');
144
+ expect(refresh).not.toBeNull();
145
+ await act(async () => {
146
+ refresh?.click();
147
+ const tick = Promise.withResolvers<void>();
148
+ setTimeout(tick.resolve, 0);
149
+ await tick.promise;
150
+ });
151
+
152
+ const calls = harness.services.rpc.calls;
153
+ expect(
154
+ calls.some(
155
+ (call) => call.method === 'snapshot' && (call.input as { force?: boolean } | undefined)?.force === true,
156
+ ),
157
+ ).toBe(true);
158
+ // Without this the press is a no-op on a socket that missed the publish.
159
+ expect(topicRefreshes).toBe(1);
160
+
161
+ act(() => render(null, container));
162
+ container.remove();
163
+ harness.dispose();
164
+ configureUiKit(uiKitServices() ?? harness.services);
165
+ });
166
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kabmo-labs/kabmo",
3
- "version": "0.42.2",
3
+ "version": "0.43.1",
4
4
  "description": "Web console and diagnostic workbench for AI coding agents: Elysia + Preact on Bun.",
5
5
  "license": "MIT",
6
6
  "author": "Wijanarko Putra Rajeb <wijanarko.rajeb@gmail.com>",
@@ -80,13 +80,22 @@ export function AnchoredMenu({
80
80
  // placement computed for the shorter menu put the longer one past the window
81
81
  // edge. The state is only written when a number actually moved, so this
82
82
  // settles in one extra render instead of looping.
83
+ //
84
+ // The viewport is read from the panel's OWN document, never the global: this
85
+ // component portals out of its host tree, so `panelRef.current.ownerDocument`
86
+ // is the document it actually paints into. A global read is a second opinion
87
+ // that can be absent — measured under `bun test` on Windows, where a deferred
88
+ // flush landed after the suite restored the globals and the menu died with
89
+ // `ReferenceError: document is not defined`.
83
90
  useLayoutEffect(() => {
84
- if (!anchor || !panelRef.current) return;
85
- const box = panelRef.current.getBoundingClientRect();
91
+ const el = panelRef.current;
92
+ const view = el?.ownerDocument.defaultView;
93
+ if (!anchor || !el || !view) return;
94
+ const box = el.getBoundingClientRect();
86
95
  const next = placeMenu(
87
96
  anchor,
88
97
  { width: box.width, height: box.height },
89
- { width: window.innerWidth, height: window.innerHeight },
98
+ { width: view.innerWidth, height: view.innerHeight },
90
99
  align,
91
100
  );
92
101
  setPlacement((prev) =>
@@ -94,17 +103,26 @@ export function AnchoredMenu({
94
103
  );
95
104
  });
96
105
 
106
+ const open = anchor !== null;
107
+
97
108
  useEffect(() => {
109
+ if (!open) return;
110
+ const doc = panelRef.current?.ownerDocument;
111
+ if (!doc) return;
98
112
  const onKeyDown = (event: globalThis.KeyboardEvent) => {
99
113
  if (event.key !== 'Escape') return;
100
114
  event.preventDefault();
101
115
  onClose();
102
116
  };
103
- document.addEventListener('keydown', onKeyDown);
104
- return () => document.removeEventListener('keydown', onKeyDown);
105
- }, [onClose]);
117
+ doc.addEventListener('keydown', onKeyDown);
118
+ return () => doc.removeEventListener('keydown', onKeyDown);
119
+ }, [open, onClose]);
106
120
 
107
- if (!anchor) return null;
121
+ // Nothing to portal into means nothing to draw. The global is read ONCE here
122
+ // rather than inside an effect, so a menu whose render was deferred until
123
+ // after the document went away reports the absence instead of throwing.
124
+ const host = typeof document === 'undefined' ? null : document.body;
125
+ if (!anchor || !host) return null;
108
126
 
109
127
  const style: CSSProperties = placement
110
128
  ? { top: `${placement.top}px`, left: `${placement.left}px`, maxHeight: `${placement.maxHeight}px` }
@@ -136,6 +154,6 @@ export function AnchoredMenu({
136
154
  {children}
137
155
  </div>
138
156
  </div>,
139
- document.body,
157
+ host,
140
158
  );
141
159
  }
@@ -25,20 +25,24 @@ import type { McpProbeResult, SessionMcpPayload } from '@/shared/types';
25
25
  const nativeFetch = Bun.fetch;
26
26
  let container: HTMLElement;
27
27
 
28
- function payload(probe: McpProbeResult | null): SessionMcpPayload {
28
+ function payload(probe: McpProbeResult | null, delivery: SessionMcpPayload['delivery'] = 'omp-config'): SessionMcpPayload {
29
29
  return {
30
30
  sessionId: 'session-mcp',
31
- harness: 'omp-rpc',
32
- delivery: 'omp-config',
31
+ harness: delivery === 'acp' ? 'claude' : 'omp-rpc',
32
+ delivery,
33
33
  live: false,
34
34
  servers: [{ name: 'obsidian', transport: 'http', source: 'user', enabled: true, probe }],
35
35
  overrides: {},
36
36
  };
37
37
  }
38
38
 
39
- async function mount(probe: McpProbeResult | null): Promise<void> {
39
+ async function mount(probe: McpProbeResult | null, delivery: SessionMcpPayload['delivery'] = 'omp-config'): Promise<void> {
40
+ await mountPayload(payload(probe, delivery));
41
+ }
42
+
43
+ async function mountPayload(data: SessionMcpPayload): Promise<void> {
40
44
  (globalThis as unknown as Record<string, unknown>).fetch = async () =>
41
- new Response(JSON.stringify(payload(probe)), {
45
+ new Response(JSON.stringify(data), {
42
46
  status: 200,
43
47
  headers: { 'content-type': 'application/json' },
44
48
  });
@@ -95,4 +99,29 @@ describe('McpSection status glyph', () => {
95
99
  expect(button.getAttribute('aria-label')).toBe('obsidian status: unknown');
96
100
  expect(button.classList.contains('text-warning-text')).toBe(true);
97
101
  });
102
+
103
+ test('an ACP list says the servers are injected on session/new', async () => {
104
+ await mount(null, 'acp');
105
+
106
+ expect(container.textContent).toContain('Injected on session/new');
107
+ expect(container.textContent).not.toContain('Applies to this session only.');
108
+ });
109
+
110
+ test('an agent-owned server is a read-only row, not a switch', async () => {
111
+ await mountPayload({
112
+ sessionId: 'session-mcp',
113
+ harness: 'opencode',
114
+ delivery: 'acp',
115
+ live: false,
116
+ servers: [
117
+ { name: 'needmcp', transport: 'http', source: 'agent', enabled: true, probe: null },
118
+ ],
119
+ overrides: {},
120
+ });
121
+
122
+ const checkbox = container.querySelector('input[type="checkbox"]') as HTMLInputElement;
123
+ expect(checkbox.disabled).toBe(true);
124
+ expect(checkbox.getAttribute('aria-label')).toBe('Configured by the agent: needmcp');
125
+ expect(container.textContent).toContain('agent');
126
+ });
98
127
  });
@@ -56,7 +56,7 @@ function statusDetail(server: SessionMcpServer, status: McpServerStatus): string
56
56
  }
57
57
 
58
58
  export function McpSection({ sessionId }: McpSectionProps) {
59
- const { servers, delivery, loading, error, pending, checking, toggle, probe } = useSessionMcp(sessionId);
59
+ const { servers, delivery, loading, error, pending, checking, lastChange, toggle, probe } = useSessionMcp(sessionId);
60
60
  const [expanded, setExpanded] = useState<string | null>(null);
61
61
  const enabledCount = servers.filter((server) => server.enabled).length;
62
62
 
@@ -85,6 +85,9 @@ export function McpSection({ sessionId }: McpSectionProps) {
85
85
  checking: checking === server.name,
86
86
  probe: server.probe,
87
87
  });
88
+ // The agent's own config is not Kabmo's to change: the row is a
89
+ // fact about the chat, not a switch. The probe still works.
90
+ const agentOwned = server.source === 'agent';
88
91
  return (
89
92
  <li key={server.name}>
90
93
  <div className="flex items-center gap-2 py-0.5 rounded hover:bg-ink/5">
@@ -95,9 +98,11 @@ export function McpSection({ sessionId }: McpSectionProps) {
95
98
  <input
96
99
  type="checkbox"
97
100
  checked={server.enabled}
98
- disabled={pending === server.name}
101
+ disabled={agentOwned || pending === server.name}
99
102
  onChange={(event) => void toggle(server.name, event.currentTarget.checked)}
100
- aria-label={`${server.enabled ? 'Disable' : 'Enable'} ${server.name} for this session`}
103
+ aria-label={agentOwned
104
+ ? `Configured by the agent: ${server.name}`
105
+ : `${server.enabled ? 'Disable' : 'Enable'} ${server.name} for this session`}
101
106
  className={`${CHECKBOX_CLASS} size-3.5 flex-shrink-0`}
102
107
  />
103
108
  <span
@@ -106,6 +111,9 @@ export function McpSection({ sessionId }: McpSectionProps) {
106
111
  {server.name}
107
112
  </span>
108
113
  </label>
114
+ {agentOwned && (
115
+ <span className="text-[9px] uppercase tracking-wide text-ink/40 flex-shrink-0">agent</span>
116
+ )}
109
117
  <span className="text-[9px] uppercase tracking-wide text-ink/40 flex-shrink-0">
110
118
  {server.transport}
111
119
  </span>
@@ -135,6 +143,20 @@ export function McpSection({ sessionId }: McpSectionProps) {
135
143
  {delivery === 'omp-config' && servers.length > 0 && (
136
144
  <div className="pt-1.5 text-[10px] text-ink/40 font-sans">Applies to this session only.</div>
137
145
  )}
146
+ {delivery === 'acp' && servers.length > 0 && (
147
+ <div className="pt-1.5 text-[10px] text-ink/40 font-sans">
148
+ Injected on session/new; a change applies to the next message.
149
+ </div>
150
+ )}
151
+ {lastChange && (
152
+ <div className="pt-1 text-[10px] text-ink/50 font-sans" role="status">
153
+ {lastChange.applied
154
+ ? 'Applied to the running session.'
155
+ : lastChange.appliesOnNextSpawn
156
+ ? 'Saved; applies on the next message.'
157
+ : 'Saved.'}
158
+ </div>
159
+ )}
138
160
  </div>
139
161
  );
140
162
  }
@@ -3,6 +3,8 @@
3
3
  * SPDX-License-Identifier: MIT
4
4
  */
5
5
 
6
+ import { OMO_GLYPH } from '@/client/components/common/harness-glyph/omo';
7
+
6
8
  /**
7
9
  * The official brand mark of every harness Kabmo can drive, one glyph per agent.
8
10
  *
@@ -76,4 +78,5 @@ grok: { ink: [0, 0, 24, 24], body: "<path d=\"M9.27 15.29l7.978-5.897c.391-.29.9
76
78
  // HOLE in the hair contour. Trademark of Nous Research, not covered by this
77
79
  // project's licence.
78
80
  hermes: { ink: [0, 0, 22.26, 24], body: "<path fill-rule=\"evenodd\" d=\"M11.42 0.00L10.00 0.14L8.30 0.52L5.77 1.54L3.39 3.12L2.54 3.98L1.99 4.78L1.14 6.85L0.98 8.79L1.33 9.89L1.96 10.68L2.64 11.11L3.30 11.31L2.81 10.82L2.45 9.93L2.88 10.57L3.57 11.15L3.08 15.96L2.79 17.48L2.32 18.32L2.01 18.47L1.50 18.47L0.88 18.00L0.66 16.98L0.93 16.03L0.27 16.99L0.18 18.26L0.40 18.90L0.76 19.37L1.30 19.70L1.89 19.79L2.42 19.69L3.08 19.33L4.04 18.16L3.84 18.90L3.38 19.61L2.79 20.08L2.07 20.23L1.34 20.05L0.63 19.57L0.23 18.99L0.01 18.09L0.18 19.54L0.91 20.55L2.34 21.24L2.58 21.98L3.21 22.50L3.85 22.61L4.50 22.50L5.06 22.10L5.52 21.47L5.05 22.97L4.23 24.00L6.99 24.00L7.66 23.66L7.46 24.00L7.98 23.67L7.88 24.00L8.28 24.00L9.29 22.81L8.39 24.00L9.05 24.00L10.30 22.70L10.22 23.07L13.47 21.21L10.99 24.00L11.58 24.00L12.27 22.66L12.96 21.91L13.93 21.33L15.32 20.92L14.40 21.30L13.35 22.14L12.77 22.88L12.27 24.00L12.83 24.00L13.40 22.88L14.57 21.83L15.51 21.36L16.28 21.26L17.59 21.46L18.42 21.88L19.28 22.82L19.67 24.00L19.95 24.00L19.66 22.95L19.00 21.99L18.06 21.31L16.62 20.90L18.01 21.06L18.92 21.58L19.75 22.61L20.14 24.00L20.36 24.00L20.45 23.32L21.47 22.39L21.89 21.65L22.19 20.48L22.24 19.01L21.81 16.37L19.30 6.11L18.08 3.45L17.30 2.46L16.37 1.62L15.35 0.97L14.15 0.47L12.57 0.08L11.42 0.00ZM9.44 0.47L10.37 0.55L11.37 0.91L12.20 1.45L12.99 2.22L13.83 3.41L14.48 4.81L14.94 6.50L14.65 6.97L15.65 7.67L14.60 7.11L14.50 6.74L14.78 6.54L14.77 6.32L14.69 6.14L14.50 6.12L13.60 6.36L13.61 6.68L13.91 6.78L13.90 7.17L13.32 7.90L13.81 7.06L13.44 6.74L12.82 4.52L11.99 3.05L10.73 1.83L9.79 1.27L8.95 1.01L8.01 0.95L6.84 1.12L8.33 0.60L9.44 0.47ZM6.80 1.12L6.80 1.12ZM17.19 2.53L18.04 3.54L18.60 4.57L19.19 6.07L19.60 7.71L18.66 4.87L17.69 3.25L17.84 3.56L17.87 4.40L17.63 4.17L18.27 5.61L17.53 4.33L17.62 4.75L17.42 4.50L17.40 4.67L17.99 6.33L17.39 5.10L16.94 4.54L17.74 6.53L16.78 4.56L16.44 4.83L15.48 4.47L16.64 7.12L18.21 12.16L18.63 14.04L18.85 15.92L18.20 12.56L16.37 6.66L15.50 4.90L15.61 5.35L15.08 4.77L14.55 4.68L14.43 4.40L15.08 4.44L14.95 3.60L15.37 4.25L16.21 4.41L16.49 4.11L16.05 3.40L16.51 3.91L16.56 3.72L16.95 3.75L16.38 2.85L17.29 3.75L16.83 2.99L17.44 3.79L17.45 3.08L17.19 2.53ZM11.26 2.93L11.84 3.54L12.27 4.32L12.58 4.27L12.83 4.86L12.44 4.68L12.40 4.82L11.63 3.62L11.51 4.00L11.69 4.54L11.43 4.30L11.62 4.96L11.32 4.51L11.27 4.64L11.05 4.58L11.06 4.93L10.86 4.62L10.34 4.60L10.10 4.19L10.42 3.77L10.17 3.29L10.41 3.58L10.74 3.51L10.61 3.00L11.02 3.46L11.41 3.19L11.26 2.93ZM9.27 3.31L9.94 4.13L10.47 5.22L10.59 5.61L10.27 5.30L10.35 6.18L10.01 5.26L9.98 5.97L9.55 5.29L9.65 6.10L9.42 5.48L9.13 5.61L9.15 5.92L8.97 5.64L8.29 5.38L8.20 4.96L8.77 4.69L8.77 4.44L8.93 4.81L9.24 4.53L9.11 3.94L9.51 4.59L9.27 3.31ZM16.04 3.36L16.04 3.36ZM3.60 3.43L3.60 3.43ZM5.51 3.50L4.45 6.18L4.38 5.44L4.00 5.61L3.86 5.89L3.51 5.88L4.45 4.19L3.91 5.35L4.18 5.26L5.51 3.50ZM3.53 3.50L3.53 3.50ZM3.50 3.53L2.46 4.94L1.53 6.97L1.93 5.70L1.77 5.82L1.84 5.55L1.74 5.59L2.03 4.94L3.50 3.53ZM6.68 3.93L6.76 5.81L6.54 5.37L6.54 5.74L6.35 5.39L5.80 5.56L5.72 5.81L5.69 5.55L5.03 5.62L4.84 5.38L5.07 4.70L5.75 4.99L6.04 4.05L5.85 5.05L6.32 4.92L6.68 3.93ZM6.06 3.96L6.06 3.96ZM3.55 4.03L3.09 4.78L3.30 4.83L3.90 4.05L3.28 5.12L3.70 5.07L3.86 4.90L3.20 6.46L3.24 5.96L3.00 6.19L2.89 5.55L2.26 7.13L2.64 5.76L2.13 5.81L2.26 5.43L2.66 4.72L2.99 4.73L3.55 4.03ZM7.87 4.28L8.22 5.76L7.98 5.41L7.09 5.28L7.06 5.54L6.85 4.95L6.82 4.49L7.82 4.61L7.87 4.28ZM3.92 4.74L3.92 4.74ZM3.89 4.79L3.89 4.79ZM12.43 4.84L12.43 4.84ZM11.65 4.97L11.65 4.97ZM18.28 5.64L18.28 5.64ZM18.31 5.72L18.31 5.72ZM6.94 5.94L6.94 5.94ZM6.96 6.02L7.44 7.36L8.15 8.75L7.81 8.78L7.48 8.13L6.96 6.02ZM18.00 6.36L18.00 6.36ZM17.75 6.56L17.75 6.56ZM19.62 7.75L19.63 7.85L19.62 7.75ZM19.65 7.92L19.65 7.92ZM4.69 8.00L4.69 8.00ZM4.71 8.04L5.82 9.27L6.82 9.08L6.44 9.70L8.22 8.87L8.57 9.24L10.35 9.22L10.42 8.64L10.61 9.23L11.53 9.43L11.51 11.61L10.65 16.98L10.73 18.54L10.14 19.08L9.41 17.99L8.80 17.44L6.64 17.62L5.82 17.43L4.61 15.42L4.04 13.77L4.10 12.44L4.26 12.83L4.80 13.46L4.63 14.15L5.12 15.43L5.40 15.63L5.31 15.47L5.76 15.29L5.13 15.30L5.03 15.05L5.19 14.89L6.23 14.89L6.32 14.95L6.06 15.10L6.67 14.90L6.61 14.72L6.32 14.71L5.55 14.31L5.02 14.30L4.79 14.00L4.91 13.47L4.23 12.56L4.24 12.27L4.81 11.75L5.17 10.99L5.11 10.50L4.72 10.06L4.29 9.92L4.96 10.40L4.45 10.26L4.07 10.37L4.97 10.44L5.11 10.81L4.52 10.42L3.97 10.50L3.74 10.01L4.09 9.82L4.60 9.84L4.34 9.59L5.29 9.33L4.71 8.04ZM7.99 9.40L7.13 9.61L6.87 9.98L7.35 9.78L7.02 10.09L7.14 10.09L6.94 10.24L7.14 10.17L6.98 10.44L7.15 10.35L7.16 10.56L7.69 9.98L7.58 10.39L7.75 10.59L7.66 10.68L8.11 11.10L8.39 11.08L8.68 10.85L8.81 10.25L9.30 10.53L9.28 10.64L8.99 11.00L8.43 11.22L7.11 11.09L7.40 11.21L7.39 11.35L8.05 11.36L8.14 11.47L8.22 11.36L8.99 11.34L8.91 11.21L9.25 11.22L9.11 11.08L9.39 11.02L9.24 10.94L9.65 10.81L9.43 10.74L9.78 10.62L9.60 10.57L10.08 10.35L9.72 10.31L9.93 10.18L9.46 10.21L9.47 10.10L8.61 9.67L7.82 9.50L8.35 9.50L9.12 9.79L7.99 9.40ZM7.21 9.60L7.21 9.60ZM7.39 9.63L7.39 9.63ZM7.17 9.64L7.17 9.64ZM7.32 9.66L7.32 9.66ZM7.24 9.69L6.96 9.92L7.24 9.69ZM9.17 9.80L9.17 9.80ZM14.89 10.12L15.37 10.26L15.66 10.56L13.94 10.48L14.33 10.19L14.89 10.12ZM7.16 10.71L7.18 10.84L7.16 10.71ZM4.34 10.75L4.71 11.67L4.55 11.78L4.38 11.79L4.23 11.47L4.20 10.89L4.34 10.75ZM4.20 11.90L4.43 11.96L4.15 12.21L4.20 11.90ZM4.97 12.83L5.39 13.18L5.29 12.94L4.97 12.83ZM17.31 13.98L17.39 15.20L17.28 16.17L17.31 13.98ZM4.77 14.10L4.95 14.40L4.77 14.10ZM5.26 14.29L5.66 14.46L5.19 14.46L5.09 14.37L5.26 14.29ZM5.20 14.53L5.20 14.53ZM5.37 14.60L5.25 14.71L5.37 14.60ZM13.33 14.68L13.48 16.54L12.48 17.18L13.33 14.68ZM19.82 14.70L20.30 17.62L20.06 19.91L20.20 17.88L19.82 14.70ZM5.36 14.93L5.31 15.21L5.36 14.93ZM17.26 16.22L17.26 16.22ZM16.60 16.33L16.60 16.33ZM16.58 16.45L16.34 17.30L16.58 16.45ZM13.57 17.24L13.74 18.19L13.14 18.67L12.64 18.65L12.36 18.03L13.57 17.24ZM16.32 17.32L16.32 17.32ZM16.29 17.41L16.29 17.41ZM5.05 19.04L4.80 20.37L4.23 21.35L3.60 21.71L3.07 21.70L2.74 21.49L2.60 21.27L3.58 21.18L4.21 20.77L4.69 20.04L5.05 19.04ZM10.93 19.12L11.48 20.01L12.81 20.92L11.68 21.67L9.94 22.47L8.83 20.47L9.72 20.25L10.93 19.12ZM20.05 19.98L20.03 20.07L20.05 19.98ZM20.02 20.15L20.02 20.15Z\"></path>" },
81
+ omo: OMO_GLYPH,
79
82
  };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * OmO's own mark: the vendor's face, from `https://omo.dev/icon.svg`.
8
+ *
9
+ * The source draws a light plate with a dark face on top; the plate is the app
10
+ * icon's background, not the mark, so only the face path is kept and painted in
11
+ * `currentColor`. Coordinates are the source's own 1024 box, transformed out of
12
+ * the SVG's nested `scale(0.5) translate(0,2048) scale(0.05,-0.05)` group.
13
+ *
14
+ * Trademark of the OmO project, not covered by this project's licence.
15
+ */
16
+
17
+ import type { HarnessBrandGlyph } from '@/client/components/common/harness-glyph/brands';
18
+
19
+ export const OMO_GLYPH: HarnessBrandGlyph = {
20
+ ink: [171.98, 212.57, 852.03, 795.5],
21
+ body: "<path fill-rule=\"evenodd\" d=\"M 231.750 219.825 C 224.025 221.425 220.350 223.625 216.225 229.150 C 202.175 247.850 196.825 296.375 202.550 353.750 C 205.500 383.425 210.675 418.750 216.800 451.000 C 220.375 469.825 220.600 467.325 213.600 485.500 C 203.525 511.625 197.525 532.325 193.300 555.500 C 171.975 672.725 242.775 755.150 389.750 784.200 C 418.250 789.825 452.600 794.125 469.800 794.200 L 478.825 794.250 L 480.800 792.875 C 487.400 788.325 486.050 776.825 478.025 769.325 C 468.350 760.275 454.275 756.025 408.000 748.200 C 332.900 735.525 301.775 724.075 270.000 697.450 C 236.050 669.000 219.700 625.500 224.775 577.200 C 238.400 447.325 390.200 359.050 563.000 380.550 C 700.650 397.650 800.000 486.925 800.000 593.500 C 800.000 658.675 763.450 706.550 696.075 729.700 C 672.900 737.650 657.725 741.175 616.000 748.200 C 569.725 756.025 555.650 760.275 545.975 769.325 C 537.950 776.825 536.600 788.325 543.200 792.875 L 545.175 794.250 L 554.200 794.200 C 571.400 794.125 605.750 789.825 634.250 784.200 C 781.225 755.150 852.025 672.725 830.700 555.500 C 826.475 532.325 820.475 511.625 810.400 485.500 C 803.400 467.325 803.625 469.825 807.200 451.000 C 813.325 418.750 818.500 383.425 821.450 353.750 C 828.225 285.750 819.525 232.225 800.075 222.275 C 781.125 212.575 742.325 228.225 674.550 272.875 C 652.850 287.150 655.450 286.800 637.325 278.150 C 555.550 239.200 468.450 239.200 386.675 278.150 C 368.550 286.800 371.150 287.150 349.450 272.875 C 290.175 233.825 250.475 215.925 231.750 219.825 Z M 335.050 303.450 C 339.425 307.825 338.150 310.150 324.825 321.925 C 299.125 344.675 274.950 373.250 257.000 402.150 C 254.575 406.050 252.000 410.100 251.300 411.125 C 245.775 419.150 235.150 413.025 239.575 404.375 C 243.400 396.850 261.650 371.025 274.275 355.250 C 288.725 337.175 310.925 314.900 325.000 304.375 C 329.775 300.825 332.200 300.600 335.050 303.450 Z M 697.725 303.475 C 710.125 312.000 734.775 336.550 749.725 355.250 C 762.350 371.025 780.600 396.850 784.425 404.375 C 788.850 413.025 778.225 419.150 772.700 411.125 C 772.000 410.100 769.425 406.050 767.000 402.150 C 749.050 373.250 724.875 344.675 699.175 321.925 C 685.800 310.100 684.550 307.825 689.000 303.375 C 691.500 300.875 693.975 300.900 697.725 303.475 Z M 497.750 391.300 C 396.775 396.425 317.450 432.950 270.600 495.900 C 224.600 557.725 226.775 640.750 275.500 684.400 C 304.525 710.400 336.675 722.350 411.000 734.775 C 445.350 740.500 460.950 744.275 472.400 749.550 C 491.250 758.250 501.475 774.550 498.225 790.800 C 497.975 792.025 498.200 792.600 499.400 793.900 L 500.900 795.500 L 512.000 795.500 L 523.100 795.500 L 524.600 793.900 C 525.800 792.600 526.025 792.025 525.775 790.800 C 522.525 774.550 532.750 758.250 551.600 749.550 C 563.050 744.275 578.650 740.500 613.000 734.775 C 687.325 722.350 719.475 710.400 748.500 684.400 C 800.600 637.750 799.150 550.050 745.225 485.500 C 693.650 423.775 595.350 386.350 497.750 391.300 Z M 381.650 500.650 C 415.550 509.650 438.450 548.375 431.600 585.100 C 420.950 642.050 360.200 663.700 321.000 624.500 C 283.575 587.100 297.900 519.050 346.775 502.025 C 356.600 498.600 371.675 498.000 381.650 500.650 Z M 668.650 499.775 C 705.925 506.300 731.250 547.800 722.500 588.075 C 710.325 644.250 644.800 663.675 609.375 621.600 C 566.400 570.550 606.150 488.850 668.650 499.775 Z M 494.950 574.275 C 499.250 575.275 503.475 577.600 507.325 581.100 C 509.700 583.250 510.900 584.000 512.000 584.000 C 513.100 584.000 514.300 583.250 516.675 581.100 C 534.625 564.850 559.575 576.400 563.025 602.600 C 563.900 609.275 563.475 626.800 562.400 628.800 C 559.425 634.275 553.650 635.075 550.125 630.500 C 548.425 628.275 548.300 627.400 548.000 613.750 C 547.675 598.175 547.375 596.875 543.000 592.800 C 537.700 587.850 530.100 587.825 524.625 592.750 C 520.125 596.775 519.825 598.050 519.500 613.750 C 519.200 627.400 519.075 628.275 517.375 630.500 C 514.325 634.475 509.675 634.475 506.625 630.500 C 504.925 628.275 504.800 627.400 504.500 613.750 C 504.175 598.050 503.875 596.775 499.375 592.750 C 493.900 587.825 486.300 587.850 481.000 592.800 C 476.625 596.875 476.325 598.175 476.000 613.750 C 475.700 627.400 475.575 628.275 473.875 630.500 C 470.350 635.075 464.575 634.275 461.600 628.800 C 459.750 625.400 460.250 602.825 462.350 595.500 C 466.600 580.650 481.300 571.050 494.950 574.275 Z M 358.500 516.750 C 312.050 526.050 302.750 597.450 344.850 621.525 C 376.850 639.825 414.500 613.075 414.500 572.000 C 414.500 537.225 387.800 510.875 358.500 516.750 Z M 649.750 516.725 C 606.425 525.300 594.550 591.250 631.450 618.450 C 663.625 642.175 705.975 615.750 706.000 571.950 C 706.000 537.150 679.250 510.875 649.750 516.725 Z\"/>",
22
+ };
@@ -4,22 +4,26 @@
4
4
  */
5
5
 
6
6
  /**
7
- * The server panel's own markup: one row per server, the empty state, and the
8
- * two footers a shell may or may not offer.
7
+ * The server panel: the two groups, the empty state, the error line and the
8
+ * footer a shell may or may not offer.
9
9
  *
10
10
  * Split from `ServerControl` so the trigger (a chip on a phone, a labelled
11
11
  * button in a desktop navbar) and the list can be read and tested apart. The
12
12
  * STORE is the control's, not the panel's: the old panel opened a second
13
13
  * `useShellServers`, which meant two copies of the list, two 4-second polls and
14
14
  * a trigger that could disagree with the rows directly under it.
15
+ *
16
+ * The ROW lives in `Row.tsx`: its action rules (Stop only for an owned server
17
+ * that answers, Remove for everything else) are the part a reader comes here
18
+ * for, and keeping them here pushed this file past the 350-line ceiling.
15
19
  */
16
20
 
17
21
  import { useState } from 'preact/hooks';
18
- import { Check, Loader2, Play, Plus, RefreshCw, Server, Square, Trash2, X } from 'lucide-preact';
22
+ import { Loader2, Play, Plus, RefreshCw, Server, X } from 'lucide-preact';
19
23
  import { AnchoredMenu } from '@/client/components/common/anchored-menu';
24
+ import { Row } from '@/client/components/common/server-control/Row';
20
25
  import { anchorRectOf } from '@/shared/lib/ui/menu-anchor';
21
26
  import type { ShellServersStore } from '@/client/hooks/shell/servers';
22
- import type { ShellServer } from '@/client/lib/shell/servers';
23
27
 
24
28
  export type ServerControlVariant = 'nav' | 'chip';
25
29
 
@@ -33,85 +37,6 @@ interface ServerPanelProps {
33
37
  triggerRef: { current: HTMLButtonElement | null };
34
38
  }
35
39
 
36
- function statusLine(server: ShellServer): string {
37
- if (!server.running) return 'Stopped';
38
- const parts: string[] = [];
39
- if (server.version) parts.push(`v${server.version}`);
40
- if (server.mode) parts.push(server.mode);
41
- if (server.pid) parts.push(`pid ${server.pid}`);
42
- return parts.length > 0 ? parts.join(' · ') : 'Running';
43
- }
44
-
45
- function Row({
46
- server,
47
- active,
48
- busy,
49
- onActivate,
50
- onStop,
51
- onRemove,
52
- }: {
53
- server: ShellServer;
54
- active: boolean;
55
- busy: boolean;
56
- onActivate: () => void;
57
- onStop?: () => void;
58
- onRemove?: () => void;
59
- }) {
60
- const canConnect = server.running && !active;
61
- return (
62
- <div
63
- className={`flex items-center gap-2 rounded-lg border px-2.5 py-2 ${
64
- active ? 'border-ink/30 bg-ink/[0.04]' : 'border-ink/10'
65
- }`}
66
- >
67
- <span
68
- className={`w-1.5 h-1.5 rounded-full flex-shrink-0 ${
69
- server.running ? 'bg-success' : 'bg-ink/25'
70
- }`}
71
- aria-hidden="true"
72
- />
73
- <button
74
- type="button"
75
- onClick={onActivate}
76
- disabled={busy || !canConnect}
77
- title={canConnect ? `Switch to ${server.label}` : statusLine(server)}
78
- className="flex-1 min-w-0 text-left cursor-pointer disabled:cursor-default group"
79
- >
80
- <span className="flex items-center gap-1.5">
81
- <span className="text-xs font-medium text-ink truncate">{server.label}</span>
82
- {active && <Check size={12} className="text-success flex-shrink-0" aria-label="Active" />}
83
- </span>
84
- <span className="block text-[10px] text-ink/50 truncate font-mono">{server.url}</span>
85
- <span className="block text-[10px] text-ink/40 truncate">{statusLine(server)}</span>
86
- </button>
87
- {onStop && server.owned && server.running && (
88
- <button
89
- type="button"
90
- onClick={onStop}
91
- disabled={busy}
92
- title="Stop this local server"
93
- aria-label={`Stop ${server.label}`}
94
- className="p-1 rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer disabled:opacity-40"
95
- >
96
- <Square size={12} />
97
- </button>
98
- )}
99
- {onRemove && !server.owned && (
100
- <button
101
- type="button"
102
- onClick={onRemove}
103
- disabled={busy}
104
- title="Remove from the list"
105
- aria-label={`Remove ${server.label}`}
106
- className="p-1 rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer disabled:opacity-40"
107
- >
108
- <Trash2 size={12} />
109
- </button>
110
- )}
111
- </div>
112
- );
113
- }
114
-
115
40
  /**
116
41
  * Which server this window is on, and how to change it.
117
42
  *
@@ -164,6 +89,10 @@ export function ServerPanel({ open, onClose, variant, store, triggerRef }: Serve
164
89
  const detected = state?.detected ?? [];
165
90
  const activeId = state?.activeId;
166
91
  const startable = state?.startable !== false;
92
+ // One local server per shell: the store refuses a second anyway, so the
93
+ // control must not offer one. A recorded server that died does not count —
94
+ // starting again is the restart.
95
+ const runningLocal = entries.find((server) => server.owned && server.running);
167
96
 
168
97
  const submit = async () => {
169
98
  if (!url.trim()) return;
@@ -272,8 +201,17 @@ export function ServerPanel({ open, onClose, variant, store, triggerRef }: Serve
272
201
  {/* A phone cannot spawn a server: there is no process to start and no
273
202
  terminal to own it. The control is ABSENT rather than disabled,
274
203
  because a disabled button would promise a capability the shell does
275
- not have. */}
276
- {startable && (
204
+ not have.
205
+
206
+ A desktop shell owns ONE local server. While it runs, the control is
207
+ replaced by the fact rather than disabled: the row above already
208
+ carries the Stop, and a dead grey button would leave the reader
209
+ wondering what would enable it. */}
210
+ {startable && (runningLocal ? (
211
+ <p className="px-1 text-[10px] text-ink/50">
212
+ {runningLocal.label} is running — stop it to start another.
213
+ </p>
214
+ ) : (
277
215
  <button
278
216
  type="button"
279
217
  onClick={() => void store.start()}
@@ -282,7 +220,7 @@ export function ServerPanel({ open, onClose, variant, store, triggerRef }: Serve
282
220
  >
283
221
  <Play size={12} /> Start a local server
284
222
  </button>
285
- )}
223
+ ))}
286
224
 
287
225
  {adding ? (
288
226
  <form
@@ -0,0 +1,98 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * One row of the server list: the status dot, the label and address, and the
8
+ * one action this row may offer.
9
+ *
10
+ * Split from `Panel.tsx` for the 350-line ceiling, and because the row's rules
11
+ * are its own: Stop belongs to a server this shell started and that still
12
+ * answers, Remove to everything else — a remote entry, a hand-started instance,
13
+ * or a server this shell started that has since died. The last case is why
14
+ * `!owned || !running`: a dead owned row used to have NO action at all and
15
+ * could not be cleared without reloading the page.
16
+ */
17
+
18
+ import { Check, Square, Trash2 } from 'lucide-preact';
19
+ import type { ShellServer } from '@/client/lib/shell/servers';
20
+
21
+ export function statusLine(server: ShellServer): string {
22
+ if (!server.running) return 'Stopped';
23
+ const parts: string[] = [];
24
+ if (server.version) parts.push(`v${server.version}`);
25
+ if (server.mode) parts.push(server.mode);
26
+ if (server.pid) parts.push(`pid ${server.pid}`);
27
+ return parts.length > 0 ? parts.join(' · ') : 'Running';
28
+ }
29
+
30
+ export function Row({
31
+ server,
32
+ active,
33
+ busy,
34
+ onActivate,
35
+ onStop,
36
+ onRemove,
37
+ }: {
38
+ server: ShellServer;
39
+ active: boolean;
40
+ busy: boolean;
41
+ onActivate: () => void;
42
+ onStop?: () => void;
43
+ onRemove?: () => void;
44
+ }) {
45
+ const canConnect = server.running && !active;
46
+ return (
47
+ <div
48
+ className={`flex items-center gap-2 rounded-lg border px-2.5 py-2 ${
49
+ active ? 'border-ink/30 bg-ink/[0.04]' : 'border-ink/10'
50
+ }`}
51
+ >
52
+ <span
53
+ className={`w-1.5 h-1.5 rounded-full flex-shrink-0 ${
54
+ server.running ? 'bg-success' : 'bg-ink/25'
55
+ }`}
56
+ aria-hidden="true"
57
+ />
58
+ <button
59
+ type="button"
60
+ onClick={onActivate}
61
+ disabled={busy || !canConnect}
62
+ title={canConnect ? `Switch to ${server.label}` : statusLine(server)}
63
+ className="flex-1 min-w-0 text-left cursor-pointer disabled:cursor-default group"
64
+ >
65
+ <span className="flex items-center gap-1.5">
66
+ <span className="text-xs font-medium text-ink truncate">{server.label}</span>
67
+ {active && <Check size={12} className="text-success flex-shrink-0" aria-label="Active" />}
68
+ </span>
69
+ <span className="block text-[10px] text-ink/50 truncate font-mono">{server.url}</span>
70
+ <span className="block text-[10px] text-ink/40 truncate">{statusLine(server)}</span>
71
+ </button>
72
+ {onStop && server.owned && server.running && (
73
+ <button
74
+ type="button"
75
+ onClick={onStop}
76
+ disabled={busy}
77
+ title="Stop this local server"
78
+ aria-label={`Stop ${server.label}`}
79
+ className="p-1 rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer disabled:opacity-40"
80
+ >
81
+ <Square size={12} />
82
+ </button>
83
+ )}
84
+ {onRemove && (!server.owned || !server.running) && (
85
+ <button
86
+ type="button"
87
+ onClick={onRemove}
88
+ disabled={busy}
89
+ title="Remove from the list"
90
+ aria-label={`Remove ${server.label}`}
91
+ className="p-1 rounded text-ink/40 hover:text-error hover:bg-error/10 cursor-pointer disabled:opacity-40"
92
+ >
93
+ <Trash2 size={12} />
94
+ </button>
95
+ )}
96
+ </div>
97
+ );
98
+ }