@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.
- package/README.md +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +721 -675
- package/dist/client/static/js/{CsvGrid-g6rek8y9.js → CsvGrid-g67pk2zy.js} +2 -2
- package/dist/client/static/js/{DocxView-41t9ryws.js → DocxView-pyh6p2kb.js} +4 -4
- package/dist/client/static/js/{DrawioView-mfxhfz1h.js → DrawioView-g48r6y2m.js} +2 -2
- package/dist/client/static/js/ImageView-rnzf5tve.js +1 -0
- package/dist/client/static/js/LayoutWrapper-rekrgth6.js +2 -0
- package/dist/client/static/js/Modal-edw446r8.js +59 -0
- package/dist/client/static/js/{PdfView-bek8k888.js → PdfView-6z3cgj37.js} +1 -1
- package/dist/client/static/js/SessionsView-e84tjbcr.js +1 -0
- package/dist/client/static/js/{SheetView-vezssf6b.js → SheetView-64076z1j.js} +13 -13
- package/dist/client/static/js/{SvgPreview-f1qaw73k.js → SvgPreview-dmpgavgd.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-4qn94h52.js → abnfDiagram-O67JEVCF-nfz5z1vw.js} +1 -1
- package/dist/client/static/js/architecture-7GRP2DOG-7j23x20s.js +1 -0
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-tbewzdya.js → architectureDiagram-NJMV4G6O-jra2jyzw.js} +11 -11
- package/dist/client/static/js/{astro-nn7xg0we.js → astro-dpfdhc5e.js} +1 -1
- package/dist/client/static/js/bash-vv2ysp0a.js +1 -0
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-njgnwckz.js → blockDiagram-BEXU5L5S-3szktxam.js} +7 -7
- package/dist/client/static/js/c-8jf64j6h.js +1 -0
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-f58pcvbk.js → c4Diagram-YGBWAQC7-xe9vbppt.js} +6 -6
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-52g73vyw.js → classDiagram-v2-NBCMYWYE-egzhj1xn.js} +6 -6
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-ptdnshzh.js → cose-bilkent-JH36ORCC-dfrk1wnr.js} +1 -1
- package/dist/client/static/js/cpp-vh94zee0.js +1 -0
- package/dist/client/static/js/css-p57h1fme.js +1 -0
- package/dist/client/static/js/cynefin-OW5HDTMX-me5xnx6a.js +1 -0
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-qabfdkzr.js → cynefinDiagram-VND7K2PF-xefpcmpg.js} +2 -2
- package/dist/client/static/js/{dagre-6A5THRUB-kyf5jetf.js → dagre-6A5THRUB-vtzjnrt9.js} +2 -2
- package/dist/client/static/js/{diagram-22UHCM2B-bxrsjtv9.js → diagram-22UHCM2B-4vvn790v.js} +16 -16
- package/dist/client/static/js/{diagram-3UASUU5V-0f41s00j.js → diagram-3UASUU5V-tmht3bew.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-0z1zx9h1.js → diagram-ATOU4E4O-p5wa5ztx.js} +3 -3
- package/dist/client/static/js/{diagram-CDSNMT55-znrmr6bk.js → diagram-CDSNMT55-8myesjfc.js} +5 -5
- package/dist/client/static/js/{diagram-MLGK6HIB-jfe2jhk0.js → diagram-MLGK6HIB-9t3x2d5f.js} +2 -2
- package/dist/client/static/js/{diagram-MPIPVDR6-2kaawmwa.js → diagram-MPIPVDR6-8ahgnmhy.js} +3 -3
- package/dist/client/static/js/{dockerfile-12exatm9.js → dockerfile-x8aa0543.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-s5n37rfp.js → ebnfDiagram-ZINNZB2B-5semw111.js} +1 -1
- package/dist/client/static/js/{elixir-szk51ehr.js → elixir-5ewfhvfh.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-433rd9fp.js → elk-276RUBZZ-jmhs58ww.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-key6ah0b.js → erDiagram-OPXOYQCR-31wvbpdr.js} +8 -8
- package/dist/client/static/js/{erlang-zwy7cqdk.js → erlang-jqqa3ehb.js} +1 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-5zbvjj84.js +1 -0
- package/dist/client/static/js/flowDiagram-KWPJA3E3-36ygrbvm.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-4efkhmca.js → ganttDiagram-FUAMR5RP-c2dycjrf.js} +6 -6
- package/dist/client/static/js/gitGraph-4MIJSDKK-tjhkv71w.js +1 -0
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ac376y2k.js → gitGraphDiagram-X574FWY7-y4k4pdd8.js} +14 -14
- package/dist/client/static/js/graphql-kesh8gk0.js +1 -0
- package/dist/client/static/js/html-sxpfydga.js +1 -0
- package/dist/client/static/js/{index-e1yz59fa.js → index-0c6vpk89.js} +2 -2
- package/dist/client/static/js/{index-0pabfaac.js → index-0q2qfcjn.js} +1 -1
- package/dist/client/static/js/{index-p0ez6hqd.js → index-181p91hf.js} +1 -1
- package/dist/client/static/js/{index-zs73zwjz.js → index-2b46dzw8.js} +4 -4
- package/dist/client/static/js/{index-02543wk3.js → index-2cbnjc32.js} +2 -2
- package/dist/client/static/js/{index-7a2efrbj.js → index-3588r3wg.js} +2 -2
- package/dist/client/static/js/{index-4cncqz8j.js → index-38v0781h.js} +2 -2
- package/dist/client/static/js/{index-z78bzryw.js → index-48gh56ka.js} +3 -3
- package/dist/client/static/js/{index-0e9nkc0g.js → index-48pb18zj.js} +2 -2
- package/dist/client/static/js/{index-77t0nvt1.js → index-4rv388z7.js} +2 -2
- package/dist/client/static/js/index-52xmdeh2.js +1 -0
- package/dist/client/static/js/{index-5jnvz9hw.js → index-6fpd55cq.js} +2 -2
- package/dist/client/static/js/{index-nh29fkk9.js → index-7dp90ad1.js} +2 -2
- package/dist/client/static/js/{index-yzda8j2d.js → index-8kqepehd.js} +12 -12
- package/dist/client/static/js/{index-raca8tsh.js → index-aar68x31.js} +4 -4
- package/dist/client/static/js/{index-pxtff3ez.js → index-bvjct7sp.js} +2 -2
- package/dist/client/static/js/{index-cz50ha6x.js → index-cgzw43bc.js} +78 -78
- package/dist/client/static/js/{index-50mdqev0.js → index-cje5gg45.js} +1 -1
- package/dist/client/static/js/{index-zndbhb9w.js → index-cjhvtzdd.js} +2 -2
- package/dist/client/static/js/{index-8b3t2y77.js → index-cqnpsw2m.js} +2 -2
- package/dist/client/static/js/{index-r9db1gsf.js → index-dkwhs38j.js} +2 -2
- package/dist/client/static/js/{index-pkes9492.js → index-e7yf273s.js} +2 -2
- package/dist/client/static/js/{index-8kbp24xg.js → index-efra065v.js} +1 -1
- package/dist/client/static/js/index-f77c3ag0.js +479 -0
- package/dist/client/static/js/{index-yjmm73jm.js → index-f7djda1g.js} +2 -2
- package/dist/client/static/js/{index-8k7vjp8b.js → index-fbcg8y95.js} +1 -1
- package/dist/client/static/js/{index-pysqpc5n.js → index-fg965t62.js} +2 -2
- package/dist/client/static/js/{index-qsw5edtk.js → index-fjnkzk12.js} +5 -5
- package/dist/client/static/js/{index-s4gv0rpk.js → index-g3shdymf.js} +1 -1
- package/dist/client/static/js/{index-qx6x4z0y.js → index-gmnmnfm0.js} +2 -2
- package/dist/client/static/js/{index-gp57dx2v.js → index-h5n1btqy.js} +1 -1
- package/dist/client/static/js/{index-r8cc80w5.js → index-jz93j0at.js} +2 -2
- package/dist/client/static/js/{index-dtj73vs1.js → index-kc5znr75.js} +2 -2
- package/dist/client/static/js/index-m1n4v0z7.js +9 -0
- package/dist/client/static/js/{index-1t5ybx9v.js → index-m94f4ngb.js} +3 -3
- package/dist/client/static/js/{index-dfqmwm7j.js → index-m9s9rg5k.js} +2 -2
- package/dist/client/static/js/{index-gsxebrq9.js → index-n9scbxy5.js} +2 -2
- package/dist/client/static/js/{index-zs7sjv6x.js → index-nt7nhchn.js} +1 -1
- package/dist/client/static/js/{index-v3f7we4n.js → index-pt8440xh.js} +22 -22
- package/dist/client/static/js/{index-b42t14wk.js → index-q81rxwh7.js} +35 -35
- package/dist/client/static/js/{index-ktbrmp29.js → index-qhytrsyb.js} +2 -2
- package/dist/client/static/js/index-rn8w29pv.js +2 -0
- package/dist/client/static/js/{index-1y3rzw6b.js → index-s00j9042.js} +1 -1
- package/dist/client/static/js/{index-hga3e13s.js → index-s78n0dtv.js} +2 -2
- package/dist/client/static/js/index-s7rfbydk.js +4 -0
- package/dist/client/static/js/{index-03pyvmcz.js → index-sesghshh.js} +2 -2
- package/dist/client/static/js/{index-ykfd2fyj.js → index-sg6sz3g8.js} +1 -1
- package/dist/client/static/js/index-vcrh95gf.css +1 -0
- package/dist/client/static/js/{index-82vk27q1.js → index-vyw4tbn8.js} +2 -2
- package/dist/client/static/js/{index-dzmar8jr.js → index-w5rw8f7w.js} +1 -1
- package/dist/client/static/js/{index-f33c4paw.js → index-x6v37h3j.js} +1 -1
- package/dist/client/static/js/{index-b0v6gwym.js → index-ycks7gyg.js} +2 -2
- package/dist/client/static/js/{index-hw14rhen.js → index-ynaxep06.js} +2 -2
- package/dist/client/static/js/{index-rab39785.js → index-ys0xpw3q.js} +2 -2
- package/dist/client/static/js/{index-feffxxss.js → index-yvgbr7ek.js} +2 -2
- package/dist/client/static/js/info-A6RAGUB7-m6qz24p8.js +1 -0
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-4e7ej63f.js → infoDiagram-VRGFBTTK-z3pqx7w8.js} +1 -1
- package/dist/client/static/js/ini-1x0ad976.js +1 -0
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-k3yet1ec.js → ishikawaDiagram-OU5B5YK6-f5v6z8yr.js} +4 -4
- package/dist/client/static/js/java-3944nq02.js +1 -0
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-qe352kyd.js → journeyDiagram-ZHPQQLJL-js1yxatk.js} +5 -5
- package/dist/client/static/js/json-g5ggnd94.js +1 -0
- package/dist/client/static/js/jsx-f6p72qpc.js +1 -0
- package/dist/client/static/js/{julia-2eekpjq8.js → julia-0h9krgsd.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-58hag75n.js → kanban-definition-PNTS6WVX-m0a6069c.js} +5 -5
- package/dist/client/static/js/lua-edn2b3wn.js +1 -0
- package/dist/client/static/js/markdown-9dhg1fax.js +1 -0
- package/dist/client/static/js/{mermaid.core-6e89h6vm.js → mermaid.core-6xvbnm63.js} +6 -6
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-ncsam2fm.js → mindmap-definition-NLK3R4M7-a9f9yzc0.js} +4 -4
- package/dist/client/static/js/one-dark-pro-hteqzfb0.js +1 -0
- package/dist/client/static/js/one-light-dapnh0rs.js +1 -0
- package/dist/client/static/js/packet-AYTQ26CC-ng6wq5xj.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-b5ckc39d.js → pegDiagram-GJSIUBJH-4v4pf1h1.js} +1 -1
- package/dist/client/static/js/{perl-dtn1fccw.js → perl-rptyx23q.js} +1 -1
- package/dist/client/static/js/{php-7av78hch.js → php-sagvq3wz.js} +1 -1
- package/dist/client/static/js/pie-WAS4IAKB-rf6jhxf6.js +1 -0
- package/dist/client/static/js/{pieDiagram-5QR66LMP-s4d47ve8.js → pieDiagram-5QR66LMP-a54yrmfm.js} +3 -3
- package/dist/client/static/js/properties-fcmj08pv.js +1 -0
- package/dist/client/static/js/python-532d8ezm.js +1 -0
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-zm0ekvjz.js → quadrantDiagram-O4NWA36T-1twhvnp2.js} +6 -6
- package/dist/client/static/js/r-ptmdxs2a.js +1 -0
- package/dist/client/static/js/radar-RG4KPBEZ-ygp6hxq4.js +1 -0
- package/dist/client/static/js/railroad-74A4TZTK-rxgnrb2g.js +1 -0
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-xkv52a2p.js +1 -0
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-bvcktbqh.js +1 -0
- package/dist/client/static/js/railroad-peg-WCYAUIDC-9c3v7jsq.js +1 -0
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-52vdqf53.js → railroadDiagram-XR7U4H2S-83tqfdcy.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-7kf8bmk9.js → requirementDiagram-PLB6GJNP-73e3pzw6.js} +4 -4
- package/dist/client/static/js/{ruby-s2bqr910.js → ruby-9qyx7knh.js} +1 -1
- package/dist/client/static/js/{rust-q98kssv3.js → rust-jds4e4r7.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-bcb9f54a.js → sankeyDiagram-IPEJSGJF-1bzwj6sb.js} +6 -6
- package/dist/client/static/js/{sass-bm32bb5k.js → sass-07rteya0.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-76ywvj7g.js → sequenceDiagram-PO4LG4MO-yh3h988k.js} +19 -19
- package/dist/client/static/js/{sizeCapture-INFHLROL-p9bsf5dc.js → sizeCapture-INFHLROL-1n121yp6.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-1ecfb3fs.js → stateDiagram-v2-GCMORJYK-0tdrzn06.js} +6 -6
- package/dist/client/static/js/{svelte-ztkaww47.js → svelte-w365cpwa.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-2pyjr946.js → swimlanes-2SLR337P-77n1ttdw.js} +1 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-akjqm31r.js +8 -0
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-4csxwmn2.js → timeline-definition-EJHVYXUP-b6r0k3e8.js} +2 -2
- package/dist/client/static/js/treeView-Q6P3EWNA-fb58a7z1.js +1 -0
- package/dist/client/static/js/treemap-WGGIJYW6-ej4qhksx.js +1 -0
- package/dist/client/static/js/typescript-683kkkaw.js +1 -0
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-0p1jnbsn.js → usecaseDiagram-POWQR4AR-efq58m3m.js} +43 -43
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-y1hgdet4.js → vennDiagram-UO4OBE2U-ad4gvd5r.js} +5 -5
- package/dist/client/static/js/{vue-cbqm4bed.js → vue-d6cesny1.js} +1 -1
- package/dist/client/static/js/wardley-WFR3VGLG-mkp0kanv.js +1 -0
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-p578yrgm.js → wardleyDiagram-VNRHLVJA-v89tys2p.js} +4 -4
- package/dist/client/static/js/xml-6ct32gys.js +1 -0
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-b08b4ah0.js → xychartDiagram-PMCCYNJV-xtgzmknw.js} +5 -5
- package/dist/client/static/js/yaml-1d5m3bfj.js +1 -0
- package/marketplace/plugins/command-runner/package.json +2 -2
- package/marketplace/plugins/command-runner/src/app.test.tsx +161 -0
- package/marketplace/plugins/command-runner/src/app.tsx +37 -3
- package/marketplace/plugins/command-runner/src/panel/Glyph.tsx +22 -4
- package/marketplace/plugins/git-forge/package.json +2 -2
- package/marketplace/plugins/git-forge/src/panel/Glyph.tsx +22 -3
- package/marketplace/plugins/git-forge/src/panel/index.tsx +21 -3
- package/marketplace/plugins/git-forge/src/panel/refresh.test.tsx +192 -0
- package/marketplace/plugins/git-forge/src/panel/use-forge.ts +4 -2
- package/marketplace/plugins/git-forge/src/panel/write.test.tsx +21 -0
- package/marketplace/plugins/stats/package.json +2 -2
- package/marketplace/plugins/stats/src/RefreshButton.tsx +9 -7
- package/marketplace/plugins/stats/src/app.tsx +15 -1
- package/marketplace/plugins/stats/src/refresh.test.tsx +166 -0
- package/package.json +1 -1
- package/src/client/components/common/anchored-menu/index.tsx +26 -8
- package/src/client/components/common/context-usage-button/McpSection.test.tsx +34 -5
- package/src/client/components/common/context-usage-button/McpSection.tsx +25 -3
- package/src/client/components/common/harness-glyph/brands.ts +3 -0
- package/src/client/components/common/harness-glyph/omo.ts +22 -0
- package/src/client/components/common/server-control/Panel.tsx +24 -86
- package/src/client/components/common/server-control/Row.tsx +98 -0
- package/src/client/components/common/server-control/index.test.tsx +69 -9
- package/src/client/components/layout/VisibilityMenu.tsx +18 -6
- package/src/client/components/layout/new-workspace-host/index.test.tsx +84 -0
- package/src/client/components/layout/new-workspace-host/index.tsx +35 -0
- package/src/client/components/mobile/header-titlebar.test.tsx +38 -3
- package/src/client/components/settings/Sidebar.tsx +2 -1
- package/src/client/components/settings/categories/GitSettings.tsx +31 -0
- package/src/client/components/settings/categories/git-settings/CommitMessageSection.tsx +292 -0
- package/src/client/components/settings/categories/git-settings/IdentitySection.tsx +215 -0
- package/src/client/components/settings/category-content.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +8 -0
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +55 -2
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +13 -1
- package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +56 -50
- package/src/client/components/workspace/chat-timeline/ThinkingSection.test.tsx +38 -2
- package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +13 -1
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +50 -0
- package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +20 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +21 -9
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +1 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +18 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +3 -2
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/task-rows.ts +47 -0
- package/src/client/components/workspace/git-panel/CommitBox.test.tsx +98 -0
- package/src/client/components/workspace/git-panel/CommitBox.tsx +68 -3
- package/src/client/components/workspace/git-panel/index.test.ts +12 -0
- package/src/client/components/workspace/git-panel/index.tsx +20 -1
- package/src/client/components/workspace/repo-picker/index.test.tsx +20 -0
- package/src/client/components/workspace/repo-picker/index.tsx +5 -6
- package/src/client/data/settings/omp-schema.json +134 -8
- package/src/client/hooks/chat/context/mcp.ts +19 -1
- package/src/client/hooks/chat/omp/index.ts +2 -6
- package/src/client/hooks/chat/timeline/jump-rail.ts +1 -0
- package/src/client/hooks/chat/timeline/row-window.test.ts +38 -3
- package/src/client/hooks/chat/timeline/row-window.ts +33 -9
- package/src/client/hooks/chat/timeline/scroll-geometry.ts +19 -1
- package/src/client/hooks/chat/timeline/scroll.ts +15 -0
- package/src/client/hooks/chat/timeline/thinking-open.ts +10 -4
- package/src/client/hooks/workspace/commit-box.test.ts +62 -1
- package/src/client/hooks/workspace/commit-box.ts +94 -2
- package/src/client/hooks/workspace/git-panel-data.ts +15 -7
- package/src/client/hooks/workspace/repo-scope/index.test.ts +10 -3
- package/src/client/hooks/workspace/repo-scope/index.ts +21 -9
- package/src/client/lib/plugins/repo-scope-service.ts +7 -25
- package/src/server/lib/changes/capture-client-write.server.ts +45 -0
- package/src/server/lib/changes/capture.server.ts +20 -5
- package/src/server/lib/chat/session-store.server.ts +22 -1
- package/src/server/lib/db/schema.ts +3 -0
- package/src/server/lib/fs/git-commit-context.test.ts +111 -0
- package/src/server/lib/fs/git-commit-context.ts +85 -0
- package/src/server/lib/fs/git-commit-message.server.ts +251 -0
- package/src/server/lib/fs/git-commit-message.test.ts +211 -0
- package/src/server/lib/fs/git-commit-prompt.test.ts +69 -0
- package/src/server/lib/fs/git-commit-prompt.ts +57 -0
- package/src/server/lib/fs/git-commit-settings.server.ts +42 -0
- package/src/server/lib/fs/git-identity.server.test.ts +129 -0
- package/src/server/lib/fs/git-identity.server.ts +130 -0
- package/src/server/lib/harness/acp/acp-audit.server.ts +13 -62
- package/src/server/lib/harness/acp/acp-frames.server.test.ts +105 -0
- package/src/server/lib/harness/acp/acp-frames.server.ts +217 -0
- package/src/server/lib/harness/acp/acp-raw-messages.server.test.ts +69 -0
- package/src/server/lib/harness/acp/acp-raw-messages.server.ts +129 -0
- package/src/server/lib/harness/acp/acp-telemetry.server.ts +19 -0
- package/src/server/lib/harness/acp/auth.test.ts +69 -0
- package/src/server/lib/harness/acp/auth.ts +71 -0
- package/src/server/lib/harness/acp/background-replay.test.ts +139 -0
- package/src/server/lib/harness/acp/background-replay.ts +87 -0
- package/src/server/lib/harness/acp/background-work.ts +50 -33
- package/src/server/lib/harness/acp/calls.test.ts +68 -0
- package/src/server/lib/harness/acp/calls.ts +13 -0
- package/src/server/lib/harness/acp/client-capabilities.ts +5 -2
- package/src/server/lib/harness/acp/client-fs.test.ts +13 -0
- package/src/server/lib/harness/acp/client-fs.ts +16 -2
- package/src/server/lib/harness/acp/client.ts +22 -23
- package/src/server/lib/harness/acp/commands.test.ts +19 -0
- package/src/server/lib/harness/acp/commands.ts +26 -8
- package/src/server/lib/harness/acp/frames.ts +16 -1
- package/src/server/lib/harness/acp/grants.server.ts +75 -0
- package/src/server/lib/harness/acp/grants.test.ts +65 -0
- package/src/server/lib/harness/acp/grants.ts +79 -0
- package/src/server/lib/harness/acp/one-shot.server.ts +141 -0
- package/src/server/lib/harness/acp/permissions.test.ts +9 -0
- package/src/server/lib/harness/acp/permissions.ts +56 -36
- package/src/server/lib/harness/acp/prompt-files.test.ts +69 -0
- package/src/server/lib/harness/acp/prompt-files.ts +58 -0
- package/src/server/lib/harness/acp/prompt.ts +50 -11
- package/src/server/lib/harness/acp/protocol.ts +20 -1
- package/src/server/lib/harness/acp/raw-listeners.ts +30 -0
- package/src/server/lib/harness/acp/session-approvals.ts +45 -0
- package/src/server/lib/harness/acp/session-config-view.ts +81 -0
- package/src/server/lib/harness/acp/session-config.ts +48 -9
- package/src/server/lib/harness/acp/session-handshake.test.ts +71 -2
- package/src/server/lib/harness/acp/session-handshake.ts +139 -56
- package/src/server/lib/harness/acp/session-intake.test.ts +93 -0
- package/src/server/lib/harness/acp/session-intake.ts +75 -0
- package/src/server/lib/harness/acp/session-lifecycle.ts +50 -0
- package/src/server/lib/harness/acp/session-lost.test.ts +44 -0
- package/src/server/lib/harness/acp/session-lost.ts +34 -0
- package/src/server/lib/harness/acp/session-notify.ts +47 -0
- package/src/server/lib/harness/acp/session-observers.test.ts +4 -4
- package/src/server/lib/harness/acp/session-permissions.test.ts +64 -0
- package/src/server/lib/harness/acp/session-permissions.ts +9 -4
- package/src/server/lib/harness/acp/session-requests.ts +6 -0
- package/src/server/lib/harness/acp/session-roots.server.ts +47 -0
- package/src/server/lib/harness/acp/session-roots.test.ts +31 -0
- package/src/server/lib/harness/acp/session-start.ts +7 -0
- package/src/server/lib/harness/acp/session-turns.ts +11 -0
- package/src/server/lib/harness/acp/session-wiring.ts +100 -0
- package/src/server/lib/harness/acp/session.test-util.ts +36 -2
- package/src/server/lib/harness/acp/session.test.ts +10 -10
- package/src/server/lib/harness/acp/session.ts +149 -139
- package/src/server/lib/harness/acp/tool-calls.ts +27 -15
- package/src/server/lib/harness/acp/tool-identity.test.ts +136 -0
- package/src/server/lib/harness/acp/tool-identity.ts +121 -0
- package/src/server/lib/harness/acp/turn-cancel.test.ts +79 -0
- package/src/server/lib/harness/acp/turn-cancel.ts +61 -0
- package/src/server/lib/harness/acp/turn-dispatch.test.ts +103 -0
- package/src/server/lib/harness/acp/turn-dispatch.ts +61 -0
- package/src/server/lib/harness/acp/turn-queue.ts +43 -0
- package/src/server/lib/harness/acp/turn-verdict.ts +102 -0
- package/src/server/lib/harness/acp/turn.ts +86 -88
- package/src/server/lib/harness/acp/v2.test.ts +9 -0
- package/src/server/lib/harness/acp/v2.ts +13 -0
- package/src/server/lib/harness/acp/verbs.ts +35 -4
- package/src/server/lib/harness/capabilities.ts +11 -0
- package/src/server/lib/harness/launch-table.ts +19 -0
- package/src/server/lib/harness/launch.ts +4 -0
- package/src/server/lib/harness/schema.server.ts +23 -0
- package/src/server/lib/harness/spawn.server.ts +18 -2
- package/src/server/lib/mcp/agent-config.server.test.ts +111 -0
- package/src/server/lib/mcp/agent-config.server.ts +205 -0
- package/src/server/lib/mcp/probe.server.ts +7 -1
- package/src/server/lib/mcp/registry.server.ts +4 -3
- package/src/server/lib/mcp/secrets.server.test.ts +85 -0
- package/src/server/lib/mcp/secrets.server.ts +108 -0
- package/src/server/lib/omp/core/print.server.ts +100 -0
- package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
- package/src/server/lib/omp/session/artifacts.server.test.ts +15 -5
- package/src/server/lib/omp/session/artifacts.server.ts +41 -26
- package/src/server/lib/omp/session/delete.server.ts +5 -0
- package/src/server/lib/omp/session/goal-auditor.server.ts +10 -48
- package/src/server/lib/realtime/topics/session-data.server.ts +6 -14
- package/src/server/routes/fs/git-message.test.ts +101 -0
- package/src/server/routes/fs/git-message.ts +60 -0
- package/src/server/routes/fs/index.ts +2 -0
- package/src/server/routes/omp/artifact.ts +4 -3
- package/src/server/routes/sessions/mcp.test.ts +65 -1
- package/src/server/routes/sessions/mcp.ts +77 -5
- package/src/server/routes/settings/git-identity.test.ts +77 -0
- package/src/server/routes/settings/git-identity.ts +47 -0
- package/src/server/routes/settings/index.ts +2 -0
- package/src/server/routes/telemetry/acp-telemetry.test.ts +149 -0
- package/src/server/routes/telemetry/context.ts +31 -0
- package/src/server/routes/telemetry/raw-messages.ts +34 -0
- package/src/shared/lib/chat/tool/artifact.test.ts +4 -2
- package/src/shared/lib/chat/tool/artifact.ts +6 -1
- package/src/shared/lib/chat/tool/proc-facts.ts +2 -1
- package/src/shared/lib/fs/paths.test.ts +2 -0
- package/src/shared/lib/fs/repo-label.test.ts +22 -1
- package/src/shared/lib/fs/repo-label.ts +29 -0
- package/src/shared/lib/git/commit-prompt.test.ts +47 -0
- package/src/shared/lib/git/commit-prompt.ts +72 -0
- package/src/shared/lib/git/identity.test.ts +46 -0
- package/src/shared/lib/git/identity.ts +70 -0
- package/src/shared/lib/harness/brand-color.ts +3 -0
- package/src/shared/lib/harness/catalog.test.ts +14 -0
- package/src/shared/lib/harness/catalog.ts +9 -1
- package/src/shared/lib/harness/mcp-facts.ts +4 -0
- package/src/shared/lib/harness/provider-facts.test.ts +11 -0
- package/src/shared/lib/harness/provider-facts.ts +14 -0
- package/src/shared/lib/harness/providers.ts +2 -2
- package/src/shared/lib/harness/updates.test.ts +8 -0
- package/src/shared/lib/harness/updates.ts +9 -0
- package/src/shared/lib/omp/session/proc-daemon.ts +124 -0
- package/src/shared/lib/omp/session/proc.test.ts +30 -3
- package/src/shared/lib/omp/session/proc.ts +6 -82
- package/src/shared/lib/omp/session/wait-idle.test.ts +15 -4
- package/src/shared/lib/omp/session/wait-idle.ts +11 -4
- package/src/shared/lib/settings/defaults.ts +5 -0
- package/src/shared/lib/workspace/new-workspace.ts +20 -0
- package/src/shared/types/omp/agent.ts +14 -5
- package/src/shared/types/settings/mcp.ts +2 -2
- package/src/shared/types/settings/state.ts +16 -0
- package/src/test-support/preload.ts +1 -0
- package/dist/client/static/js/ImageView-bxqw3t4k.js +0 -1
- package/dist/client/static/js/LayoutWrapper-zt14rv9m.js +0 -2
- package/dist/client/static/js/Modal-cm35g20x.js +0 -38
- package/dist/client/static/js/SessionsView-gn53zyn7.js +0 -1
- package/dist/client/static/js/architecture-7GRP2DOG-cagtcfhk.js +0 -1
- package/dist/client/static/js/bash-fjzhxy10.js +0 -1
- package/dist/client/static/js/c-wqtyezvw.js +0 -1
- package/dist/client/static/js/cpp-y0nzwner.js +0 -1
- package/dist/client/static/js/css-n2waj098.js +0 -1
- package/dist/client/static/js/cynefin-OW5HDTMX-6g2ydrss.js +0 -1
- package/dist/client/static/js/eventmodeling-NTZA5JFV-b774qbn2.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-nznq0n36.js +0 -1
- package/dist/client/static/js/gitGraph-4MIJSDKK-b047d6vk.js +0 -1
- package/dist/client/static/js/graphql-gvb7e2eb.js +0 -1
- package/dist/client/static/js/html-tbz83eke.js +0 -1
- package/dist/client/static/js/index-0gbj4270.js +0 -2
- package/dist/client/static/js/index-38xv8h4t.js +0 -1
- package/dist/client/static/js/index-f4vr1c6e.css +0 -1
- package/dist/client/static/js/index-fb6pw9xb.js +0 -2
- package/dist/client/static/js/index-pzvr1699.js +0 -478
- package/dist/client/static/js/index-rf29f3fq.js +0 -9
- package/dist/client/static/js/index-zw621xez.js +0 -4
- package/dist/client/static/js/info-A6RAGUB7-n495k952.js +0 -1
- package/dist/client/static/js/ini-2gvjwh83.js +0 -1
- package/dist/client/static/js/java-1xwcq79s.js +0 -1
- package/dist/client/static/js/json-4pqjabgq.js +0 -1
- package/dist/client/static/js/jsx-wcsss15s.js +0 -1
- package/dist/client/static/js/lua-h7vjcn0h.js +0 -1
- package/dist/client/static/js/markdown-f30jjjh9.js +0 -1
- package/dist/client/static/js/one-dark-pro-qmyne0tn.js +0 -1
- package/dist/client/static/js/one-light-dj0ecjcj.js +0 -1
- package/dist/client/static/js/packet-AYTQ26CC-zajj62z6.js +0 -1
- package/dist/client/static/js/pie-WAS4IAKB-1ve78y5f.js +0 -1
- package/dist/client/static/js/properties-ymexza6q.js +0 -1
- package/dist/client/static/js/python-31ycwa66.js +0 -1
- package/dist/client/static/js/r-t2nne4xp.js +0 -1
- package/dist/client/static/js/radar-RG4KPBEZ-8rqadb58.js +0 -1
- package/dist/client/static/js/railroad-74A4TZTK-v6ppm8dy.js +0 -1
- package/dist/client/static/js/railroad-abnf-HS5TGJTU-9j6bae14.js +0 -1
- package/dist/client/static/js/railroad-ebnf-LZEXJU2U-56cpyt0g.js +0 -1
- package/dist/client/static/js/railroad-peg-WCYAUIDC-yfdmspf4.js +0 -1
- package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-qr5hdxm4.js +0 -8
- package/dist/client/static/js/treeView-Q6P3EWNA-vwpg3wp8.js +0 -1
- package/dist/client/static/js/treemap-WGGIJYW6-htfxwd32.js +0 -1
- package/dist/client/static/js/typescript-p3syh43m.js +0 -1
- package/dist/client/static/js/wardley-WFR3VGLG-hapfjkzq.js +0 -1
- package/dist/client/static/js/xml-4enq788a.js +0 -1
- package/dist/client/static/js/yaml-pjtt3jsc.js +0 -1
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
* script (no component), so the two cannot disagree about which tree they mean.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
import type { RepoScope,
|
|
31
|
+
import type { RepoScope, UiKitServices } from '@kabmo-labs/kabmo-ui';
|
|
32
32
|
import { getSessionValue, setSessionKey } from '@/shared/lib/workspace/session-state/store';
|
|
33
33
|
import { subscribeSessionKey } from '@/shared/lib/workspace/session-state/listeners';
|
|
34
34
|
import { pluginContext, subscribePluginContext } from '@/client/lib/plugins/context';
|
|
35
35
|
import { repoStore, UNKNOWN_LIST } from '@/client/hooks/workspace/repo-scope/store';
|
|
36
36
|
import { REPO_SCOPE_STATE_KEY } from '@/client/hooks/workspace/repo-scope';
|
|
37
|
-
import {
|
|
37
|
+
import { repoRows } from '@/shared/lib/fs/repo-label';
|
|
38
38
|
|
|
39
39
|
/** A repo choice, kept next to the workspace root it was made under. */
|
|
40
40
|
interface RepoPick {
|
|
@@ -42,28 +42,6 @@ interface RepoPick {
|
|
|
42
42
|
repo: string;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
/**
|
|
46
|
-
* The choices, as rows.
|
|
47
|
-
*
|
|
48
|
-
* The labels are computed HERE because the naming rule is the host's: the root
|
|
49
|
-
* reads as its folder's name, a list row keeps its whole root-relative path so
|
|
50
|
-
* `jns6_5/token` and `jns7/token` are distinguishable, and a trigger truncates
|
|
51
|
-
* to the last segment. The kit is a published package that cannot import
|
|
52
|
-
* `repo-label`, and a second copy of those rules is how one repo comes to be
|
|
53
|
-
* labelled two ways in two places.
|
|
54
|
-
*
|
|
55
|
-
* `'.'` always leads: the root is a legitimate choice even when it is not itself
|
|
56
|
-
* a repository, because a folder of nested repos is a normal workspace.
|
|
57
|
-
*/
|
|
58
|
-
function rowsFor(root: string, repos: readonly string[]): RepoScopeRow[] {
|
|
59
|
-
const rest = repos.filter((repo) => repo !== '.');
|
|
60
|
-
return ['.', ...rest].map((repo) => ({
|
|
61
|
-
repo,
|
|
62
|
-
label: repoLabel(repo, root),
|
|
63
|
-
short: repoShortLabel(repo, root),
|
|
64
|
-
}));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
45
|
/**
|
|
68
46
|
* The scope as it stands.
|
|
69
47
|
*
|
|
@@ -90,6 +68,10 @@ function readRepoScope(): RepoScope {
|
|
|
90
68
|
* - **A pick from another root is not this root's pick.** The slot is per
|
|
91
69
|
* session, so a session that picked a repo and was then pointed at another
|
|
92
70
|
* workspace still holds the old pair; the fallback is the workspace root.
|
|
71
|
+
*
|
|
72
|
+
* The rows come from `repoRows`, which always leads with `'.'`: the root is a
|
|
73
|
+
* legitimate choice even when it is not itself a repository, because a folder of
|
|
74
|
+
* nested repos is a normal workspace.
|
|
93
75
|
*/
|
|
94
76
|
export function resolveRepoScope(
|
|
95
77
|
root: string | null,
|
|
@@ -104,7 +86,7 @@ export function resolveRepoScope(
|
|
|
104
86
|
pick && typeof pick === 'object' && pick.root === root && typeof pick.repo === 'string' && pick.repo
|
|
105
87
|
? pick.repo
|
|
106
88
|
: '.';
|
|
107
|
-
return { root, repo, rows:
|
|
89
|
+
return { root, repo, rows: repoRows(root, repos), scanning, ready: true };
|
|
108
90
|
}
|
|
109
91
|
|
|
110
92
|
/**
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A write the AGENT performed through this client (`fs/write_text_file`).
|
|
8
|
+
*
|
|
9
|
+
* It runs no tool of its own, so there is no `tool_execution_start`/end pair to
|
|
10
|
+
* journal: the write event carries both sides, and that is the whole record. The
|
|
11
|
+
* journal's start-frame snapshot never ran either, which is why the before side
|
|
12
|
+
* must travel with the event — reading the file after the write would report no
|
|
13
|
+
* change at all.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { AgentEvent } from '@/server/lib/omp/rpc/constants';
|
|
17
|
+
import type { PendingCall } from '@/server/lib/changes/capture-types';
|
|
18
|
+
|
|
19
|
+
/** The pending call a client-side write journals as. */
|
|
20
|
+
export function clientWriteCall(event: AgentEvent, run: { runId: string | null; runAt: number }): PendingCall {
|
|
21
|
+
const target = typeof event.path === 'string' ? event.path : '';
|
|
22
|
+
return {
|
|
23
|
+
toolCallId: typeof event.toolCallId === 'string' ? event.toolCallId : `fs-${Bun.randomUUIDv7()}`,
|
|
24
|
+
...(run.runId !== null ? { runId: run.runId, runAt: run.runAt } : {}),
|
|
25
|
+
tool: typeof event.toolName === 'string' && event.toolName ? event.toolName : 'write',
|
|
26
|
+
agent: 'Main',
|
|
27
|
+
startedAt: Date.now(),
|
|
28
|
+
args: { path: target },
|
|
29
|
+
before: new Map(),
|
|
30
|
+
ready: Promise.resolve(),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Both sides of the write, as the journal records them. */
|
|
35
|
+
export function clientWriteSides(event: AgentEvent): { before: string | null; after: string | null } {
|
|
36
|
+
return {
|
|
37
|
+
before: typeof event.before === 'string' ? event.before : null,
|
|
38
|
+
after: typeof event.after === 'string' ? event.after : null,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Whether the event names a path at all. */
|
|
43
|
+
export function clientWriteTarget(event: AgentEvent): string {
|
|
44
|
+
return typeof event.path === 'string' ? event.path : '';
|
|
45
|
+
}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* already on disk is left alone rather than journaled as a no-op.
|
|
26
26
|
*
|
|
27
27
|
* The trace is read BEFORE the first `await` in `#end`: `EventFanout` strips it
|
|
28
|
-
* from the frame
|
|
28
|
+
* from the frame right after the raw listeners return.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import { isRecord } from '@/shared/lib/util/guards';
|
|
@@ -51,6 +51,7 @@ import { isBuildPath, isExcludedTempPath, isInside } from '@/server/lib/changes/
|
|
|
51
51
|
import { captureTargets } from '@/server/lib/changes/capture-targets';
|
|
52
52
|
import { reconstructEdit, resolveRacedWrite } from '@/server/lib/changes/capture-write.server';
|
|
53
53
|
import { MAX_BLOB_BYTES } from '@/server/lib/changes/blobs.server';
|
|
54
|
+
import { clientWriteCall, clientWriteSides, clientWriteTarget } from '@/server/lib/changes/capture-client-write.server';
|
|
54
55
|
|
|
55
56
|
export class ChangeCapture {
|
|
56
57
|
readonly #pending = new Map<string, PendingCall>();
|
|
@@ -88,9 +89,24 @@ export class ChangeCapture {
|
|
|
88
89
|
case 'subagent_event':
|
|
89
90
|
this.#subagent(event);
|
|
90
91
|
break;
|
|
92
|
+
case 'fs_write':
|
|
93
|
+
// An ACP agent that writes through the CLIENT (`fs/write_text_file`)
|
|
94
|
+
// runs no tool of its own, so there is no start/end pair to journal. The
|
|
95
|
+
// write carries both sides, which is the whole record.
|
|
96
|
+
this.#track(this.#clientWrite(event));
|
|
97
|
+
break;
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
100
|
|
|
101
|
+
/** Journal one write the AGENT performed through this client. */
|
|
102
|
+
async #clientWrite(event: AgentEvent): Promise<void> {
|
|
103
|
+
const target = clientWriteTarget(event);
|
|
104
|
+
if (!target) return;
|
|
105
|
+
const call = clientWriteCall(event, { runId: this.#runId, runAt: this.#runAt });
|
|
106
|
+
const { before, after } = clientWriteSides(event);
|
|
107
|
+
await this.#writeChange(call, target, before, after, 'tool');
|
|
108
|
+
}
|
|
109
|
+
|
|
94
110
|
/** Await every in-flight capture and the journal's own append chain. */
|
|
95
111
|
async flush(): Promise<void> {
|
|
96
112
|
await Promise.all([...this.#tasks]);
|
|
@@ -194,8 +210,7 @@ export class ChangeCapture {
|
|
|
194
210
|
if (!pending) return;
|
|
195
211
|
this.#pending.delete(toolCallId);
|
|
196
212
|
// Read the trace BEFORE the first await: `EventFanout` strips it from the
|
|
197
|
-
// frame
|
|
198
|
-
// resumes later.
|
|
213
|
+
// frame right after the raw listeners return, and this resumes later.
|
|
199
214
|
const trace = extractTrace(event);
|
|
200
215
|
await pending.ready;
|
|
201
216
|
const isShell = pending.tool === 'bash' || typeof pending.args.command === 'string';
|
|
@@ -206,8 +221,8 @@ export class ChangeCapture {
|
|
|
206
221
|
async #endFileTool(pending: PendingCall): Promise<void> {
|
|
207
222
|
const targets = captureTargets(pending, this.deps.cwd);
|
|
208
223
|
if (targets.length === 0) {
|
|
209
|
-
// A read-only tool
|
|
210
|
-
//
|
|
224
|
+
// A read-only tool has no adapter and no mutation; only a tool whose NAME
|
|
225
|
+
// promises a write is worth a note.
|
|
211
226
|
if (MUTATING_TOOL.test(pending.tool)) {
|
|
212
227
|
await this.deps.journal.recordNote({
|
|
213
228
|
at: Date.now(),
|
|
@@ -14,6 +14,8 @@ import { getDb } from '@/server/db.server';
|
|
|
14
14
|
import { isMockMode } from '@/server/mock.server';
|
|
15
15
|
import { getSessionData } from '@/client/data/mock/chat';
|
|
16
16
|
import { findSessionFileById } from '@/server/lib/omp/session/locator';
|
|
17
|
+
import { loadAcpTranscript } from '@/server/lib/harness/acp/session-transcript.server';
|
|
18
|
+
import { hasAssistantRow } from '@/shared/lib/chat/transcript-rows';
|
|
17
19
|
|
|
18
20
|
export interface JsonlSessionSource {
|
|
19
21
|
kind: 'jsonl';
|
|
@@ -47,14 +49,33 @@ export async function loadSessionSource(sessionId: string | null): Promise<Sessi
|
|
|
47
49
|
|
|
48
50
|
// Chat-created sessions have no JSONL on disk — fall back to the DB copy.
|
|
49
51
|
const existing = await db.get('SELECT * FROM chat_sessions WHERE session_id = ?', [sessionId]);
|
|
52
|
+
let parsedMessages: unknown[] = [];
|
|
50
53
|
if (existing) {
|
|
51
|
-
let parsedMessages: unknown[] = [];
|
|
52
54
|
try {
|
|
53
55
|
const parsed: unknown = JSON.parse(existing.messages);
|
|
54
56
|
if (Array.isArray(parsed)) parsedMessages = parsed;
|
|
55
57
|
} catch {
|
|
56
58
|
parsedMessages = [];
|
|
57
59
|
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// An ACP chat's server-side recorder writes `acp_transcripts`; `chat_sessions`
|
|
63
|
+
// is the client's copy and can hold only the prompt a closed tab wrote. The
|
|
64
|
+
// chat loader already prefers the recorder when the client copy has no
|
|
65
|
+
// answer, so the telemetry endpoints must read the same source or the raw
|
|
66
|
+
// panel shows a different conversation from the timeline.
|
|
67
|
+
if (!hasAssistantRow(parsedMessages)) {
|
|
68
|
+
const recorded = await loadAcpTranscript(sessionId).catch(() => []);
|
|
69
|
+
if (recorded.length > 0) {
|
|
70
|
+
return {
|
|
71
|
+
kind: 'messages',
|
|
72
|
+
title: existing?.title || `Session ${sessionId}`,
|
|
73
|
+
messages: recorded,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (existing) {
|
|
58
79
|
return { kind: 'messages', title: existing.title || `Session ${sessionId}`, messages: parsedMessages };
|
|
59
80
|
}
|
|
60
81
|
return null;
|
|
@@ -28,6 +28,7 @@ import { ensurePromptHistorySchema } from '@/server/lib/chat/schema.server';
|
|
|
28
28
|
import { ensureSessionMcpSchema } from '@/server/lib/mcp/schema.server';
|
|
29
29
|
import { ensureNotificationSchema } from '@/server/lib/notifications/schema.server';
|
|
30
30
|
import { ensureConnectSchema } from '@/server/lib/connect/devices.server';
|
|
31
|
+
import { ensureAcpGrantSchema } from '@/server/lib/harness/acp/grants.server';
|
|
31
32
|
import { migrateWorkspaceFolderColumns } from '@/shared/lib/workspace/schema-migrations';
|
|
32
33
|
import { migrateSessionStreamStateColumns } from '@/shared/lib/omp/session/schema-migrations';
|
|
33
34
|
|
|
@@ -170,6 +171,8 @@ export async function initSchema(db: DbClient): Promise<void> {
|
|
|
170
171
|
// Paired devices and their token hashes: the Connect page's list, and the
|
|
171
172
|
// credential the auth gate verifies on every request from a phone.
|
|
172
173
|
await ensureConnectSchema(db);
|
|
174
|
+
// An ACP "always allow" decision survives the child it was made to.
|
|
175
|
+
await ensureAcpGrantSchema(db);
|
|
173
176
|
await db.exec(`
|
|
174
177
|
CREATE TABLE IF NOT EXISTS files (
|
|
175
178
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { afterAll, describe, expect, test } from 'bun:test';
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { limitCommitContext, readCommitContext } from '@/server/lib/fs/git-commit-context';
|
|
11
|
+
import { removeDir } from '@/test-support/remove-dir';
|
|
12
|
+
|
|
13
|
+
const dirs: string[] = [];
|
|
14
|
+
|
|
15
|
+
function git(cwd: string, ...args: string[]): string {
|
|
16
|
+
const result = Bun.spawnSync({ cmd: ['git', ...args], cwd });
|
|
17
|
+
if (result.exitCode !== 0) {
|
|
18
|
+
throw new Error(`git ${args.join(' ')} failed: ${result.stderr.toString()}`);
|
|
19
|
+
}
|
|
20
|
+
return result.stdout.toString().trim();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function makeRepo(): string {
|
|
24
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kabmo-commit-context-'));
|
|
25
|
+
dirs.push(dir);
|
|
26
|
+
git(dir, 'init', '-q', '-b', 'main');
|
|
27
|
+
git(dir, 'config', 'core.autocrlf', 'false');
|
|
28
|
+
git(dir, 'config', 'user.email', 'test@example.invalid');
|
|
29
|
+
git(dir, 'config', 'user.name', 'Test');
|
|
30
|
+
fs.writeFileSync(path.join(dir, 'base.txt'), 'base\n');
|
|
31
|
+
git(dir, 'add', '-A');
|
|
32
|
+
git(dir, 'commit', '-q', '-m', 'base');
|
|
33
|
+
return dir;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
afterAll(() => {
|
|
37
|
+
for (const dir of dirs) removeDir(dir);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('readCommitContext', () => {
|
|
41
|
+
test('reads the staged set only, never the unstaged or untracked work', async () => {
|
|
42
|
+
const dir = makeRepo();
|
|
43
|
+
fs.writeFileSync(path.join(dir, 'staged.txt'), 'staged\n');
|
|
44
|
+
git(dir, 'add', 'staged.txt');
|
|
45
|
+
fs.writeFileSync(path.join(dir, 'unstaged.txt'), 'unstaged\n');
|
|
46
|
+
|
|
47
|
+
const context = await readCommitContext(dir, false);
|
|
48
|
+
|
|
49
|
+
expect(context.files).toEqual(['staged.txt']);
|
|
50
|
+
expect(context.diff).toContain('+staged');
|
|
51
|
+
expect(context.diff).not.toContain('unstaged');
|
|
52
|
+
expect(context.recentCommits).toEqual(['base']);
|
|
53
|
+
expect(context.branch).toBe('main');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('an amend with nothing staged describes the commit being rewritten', async () => {
|
|
57
|
+
const dir = makeRepo();
|
|
58
|
+
|
|
59
|
+
const plain = await readCommitContext(dir, false);
|
|
60
|
+
expect(plain.files).toEqual([]);
|
|
61
|
+
expect(plain.diff).toBe('');
|
|
62
|
+
|
|
63
|
+
const amend = await readCommitContext(dir, true);
|
|
64
|
+
expect(amend.files).toEqual(['base.txt']);
|
|
65
|
+
expect(amend.diff).toContain('+base');
|
|
66
|
+
expect(amend.amend).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('a staged change wins over the amend fallback', async () => {
|
|
70
|
+
const dir = makeRepo();
|
|
71
|
+
fs.writeFileSync(path.join(dir, 'next.txt'), 'next\n');
|
|
72
|
+
git(dir, 'add', 'next.txt');
|
|
73
|
+
|
|
74
|
+
const context = await readCommitContext(dir, true);
|
|
75
|
+
expect(context.files).toEqual(['next.txt']);
|
|
76
|
+
expect(context.diff).toContain('+next');
|
|
77
|
+
expect(context.diff).not.toContain('+base');
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('limitCommitContext', () => {
|
|
82
|
+
test('caps the file list and the diff, and says so', () => {
|
|
83
|
+
const context = {
|
|
84
|
+
branch: 'main',
|
|
85
|
+
files: Array.from({ length: 31 }, (_, index) => `file-${index}.ts`),
|
|
86
|
+
diff: 'x'.repeat(130_000),
|
|
87
|
+
recentCommits: [],
|
|
88
|
+
truncated: false,
|
|
89
|
+
amend: false,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const limited = limitCommitContext(context);
|
|
93
|
+
|
|
94
|
+
expect(limited.files).toHaveLength(30);
|
|
95
|
+
expect(limited.diff.length).toBeLessThan(130_000);
|
|
96
|
+
expect(limited.diff).toContain('[remaining diff truncated]');
|
|
97
|
+
expect(limited.truncated).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('leaves a small context untouched', () => {
|
|
101
|
+
const context = {
|
|
102
|
+
branch: 'main',
|
|
103
|
+
files: ['a.ts'],
|
|
104
|
+
diff: '+a',
|
|
105
|
+
recentCommits: ['base'],
|
|
106
|
+
truncated: false,
|
|
107
|
+
amend: false,
|
|
108
|
+
};
|
|
109
|
+
expect(limitCommitContext(context)).toEqual(context);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What a commit message is written FROM: the staged change set, the branch, and
|
|
8
|
+
* the recent subjects that carry the repository's own style.
|
|
9
|
+
*
|
|
10
|
+
* Staged only, because `git commit` writes the index. A prompt built from
|
|
11
|
+
* `git diff` would describe changes the commit does not contain — the failure
|
|
12
|
+
* Orca's #20112 reports from the other direction (a template that ignored the
|
|
13
|
+
* staged diff entirely). The one exception is an amend with nothing staged:
|
|
14
|
+
* `git commit --amend` then rewrites the previous commit's message, so the
|
|
15
|
+
* commit being rewritten is the change set.
|
|
16
|
+
*
|
|
17
|
+
* The caps are the model's context, not the repository's size: 30 files and
|
|
18
|
+
* 120k characters, with a visible truncation marker. A silent cut is how a
|
|
19
|
+
* generated message describes half a change and reads as complete.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { runGit } from '@/server/lib/fs/git-run';
|
|
23
|
+
|
|
24
|
+
export interface CommitContext {
|
|
25
|
+
branch: string;
|
|
26
|
+
files: string[];
|
|
27
|
+
diff: string;
|
|
28
|
+
recentCommits: string[];
|
|
29
|
+
/** True when the file list or the diff was cut to fit the model. */
|
|
30
|
+
truncated: boolean;
|
|
31
|
+
/** True when the diff is the commit being amended, not the index. */
|
|
32
|
+
amend: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const MAX_FILES = 30;
|
|
36
|
+
const MAX_DIFF_CHARS = 120_000;
|
|
37
|
+
const RECENT_COMMITS = 10;
|
|
38
|
+
|
|
39
|
+
async function gitOut(
|
|
40
|
+
args: string[],
|
|
41
|
+
cwd: string,
|
|
42
|
+
timeout = 10_000,
|
|
43
|
+
maxBuffer = 4 * 1024 * 1024,
|
|
44
|
+
): Promise<string> {
|
|
45
|
+
const result = await runGit(args, { cwd, timeout, maxBuffer });
|
|
46
|
+
return result.exitCode === 0 && !result.error ? result.stdout : '';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function lines(value: string): string[] {
|
|
50
|
+
return value
|
|
51
|
+
.split('\n')
|
|
52
|
+
.map((line) => line.trim())
|
|
53
|
+
.filter(Boolean);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export async function readCommitContext(targetDir: string, amend: boolean): Promise<CommitContext> {
|
|
57
|
+
const branch = (await gitOut(['rev-parse', '--abbrev-ref', 'HEAD'], targetDir, 5_000)).trim() || 'HEAD';
|
|
58
|
+
const recentCommits = lines(await gitOut(['log', '-n', String(RECENT_COMMITS), '--format=%s'], targetDir, 5_000));
|
|
59
|
+
|
|
60
|
+
const stagedFiles = lines(await gitOut(['diff', '--cached', '--name-only'], targetDir));
|
|
61
|
+
const stagedDiff = await gitOut(['diff', '--cached', '--no-color'], targetDir, 15_000, 8 * 1024 * 1024);
|
|
62
|
+
if (stagedFiles.length > 0 || stagedDiff.trim().length > 0) {
|
|
63
|
+
return { branch, files: stagedFiles, diff: stagedDiff, recentCommits, truncated: false, amend };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!amend) {
|
|
67
|
+
return { branch, files: [], diff: '', recentCommits, truncated: false, amend };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Amend with nothing staged: the commit being rewritten is the change set.
|
|
71
|
+
const headFiles = lines(await gitOut(['show', '--name-only', '--format=', 'HEAD'], targetDir));
|
|
72
|
+
const headDiff = await gitOut(['show', '--format=', '--patch', '--no-color', 'HEAD'], targetDir, 15_000, 8 * 1024 * 1024);
|
|
73
|
+
return { branch, files: headFiles, diff: headDiff, recentCommits, truncated: false, amend: true };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function limitCommitContext(context: CommitContext): CommitContext {
|
|
77
|
+
const files = context.files.slice(0, MAX_FILES);
|
|
78
|
+
let diff = context.diff;
|
|
79
|
+
let truncated = context.files.length > MAX_FILES;
|
|
80
|
+
if (diff.length > MAX_DIFF_CHARS) {
|
|
81
|
+
diff = `${diff.slice(0, MAX_DIFF_CHARS)}\n[remaining diff truncated]`;
|
|
82
|
+
truncated = true;
|
|
83
|
+
}
|
|
84
|
+
return { ...context, files, diff, truncated };
|
|
85
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generate a commit message from the staged change set, through the agent the
|
|
8
|
+
* user actually runs.
|
|
9
|
+
*
|
|
10
|
+
* The target is a HARNESS, not a provider. An ACP user (Claude Code, Codex,
|
|
11
|
+
* opencode) authenticates through the agent's own CLI or subscription; Kabmo
|
|
12
|
+
* holds no API key for it, and a direct provider call would answer 401. The
|
|
13
|
+
* one-shot helpers already used by the goal auditor are the transport:
|
|
14
|
+
* `omp -p --no-session --no-tools` for omp, a disposable ACP session for every
|
|
15
|
+
* other harness.
|
|
16
|
+
*
|
|
17
|
+
* `auto` follows the active chat's harness and falls back to omp when there is
|
|
18
|
+
* no chat. It is deterministic, not a fallback chain: a chosen harness that
|
|
19
|
+
* cannot start reports its own failure instead of silently answering from a
|
|
20
|
+
* different model.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { readModelRoles } from '@/server/lib/omp/config/roles';
|
|
24
|
+
import { loadHarnessSession } from '@/server/lib/harness/session-store.server';
|
|
25
|
+
import { loadHarnessConfig } from '@/server/lib/harness/config.server';
|
|
26
|
+
import { harnessProbeModels } from '@/server/lib/harness/probe-cache.server';
|
|
27
|
+
import { modelProvider, resolveDefaultModel } from '@/shared/lib/harness/config';
|
|
28
|
+
import { harnessDescriptor, type HarnessId } from '@/shared/lib/harness/catalog';
|
|
29
|
+
import { validateCommitPrompt } from '@/shared/lib/git/commit-prompt';
|
|
30
|
+
import { runOmpPrint, type OmpPrintOutcome } from '@/server/lib/omp/core/print.server';
|
|
31
|
+
import { runAcpOneShot, type AcpOneShotOutcome } from '@/server/lib/harness/acp/one-shot.server';
|
|
32
|
+
import { limitCommitContext, readCommitContext } from '@/server/lib/fs/git-commit-context';
|
|
33
|
+
import { buildCommitMessagePrompt, cleanCommitMessage } from '@/server/lib/fs/git-commit-prompt';
|
|
34
|
+
|
|
35
|
+
export type CommitMessageMode = 'auto' | 'omp' | 'harness' | 'off';
|
|
36
|
+
|
|
37
|
+
export interface CommitMessageSettings {
|
|
38
|
+
mode: CommitMessageMode;
|
|
39
|
+
/** Harness id for `harness` mode; empty means none. */
|
|
40
|
+
harness: string;
|
|
41
|
+
/** `provider/model` override; empty means the target's default. */
|
|
42
|
+
model: string;
|
|
43
|
+
/** Custom prompt template; empty means the built-in one. */
|
|
44
|
+
prompt: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface CommitMessageTarget {
|
|
48
|
+
kind: 'omp' | 'acp';
|
|
49
|
+
harness: HarnessId;
|
|
50
|
+
/** The omp selector or the ACP `provider/model` value, when one is pinned. */
|
|
51
|
+
model: string | null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type CommitMessageResult =
|
|
55
|
+
| { ok: true; message: string; target: CommitMessageTarget }
|
|
56
|
+
| { ok: false; status: number; error: string; code?: string };
|
|
57
|
+
|
|
58
|
+
export interface GenerateCommitMessageRequest {
|
|
59
|
+
targetDir: string;
|
|
60
|
+
sessionId?: string | null;
|
|
61
|
+
amend?: boolean;
|
|
62
|
+
settings: CommitMessageSettings;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Test seams: the target lookup and the two transports. */
|
|
66
|
+
export interface CommitMessageDeps {
|
|
67
|
+
loadHarnessSession?: typeof loadHarnessSession;
|
|
68
|
+
readModelRoles?: typeof readModelRoles;
|
|
69
|
+
loadHarnessConfig?: typeof loadHarnessConfig;
|
|
70
|
+
harnessProbeModels?: typeof harnessProbeModels;
|
|
71
|
+
readContext?: typeof readCommitContext;
|
|
72
|
+
runOmp?: typeof runOmpPrint;
|
|
73
|
+
runAcp?: typeof runAcpOneShot;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function ompModel(deps: CommitMessageDeps): Promise<string | null> {
|
|
77
|
+
const { roles } = await (deps.readModelRoles ?? readModelRoles)();
|
|
78
|
+
return roles.commit?.trim() || roles.tiny?.trim() || roles.default?.trim() || null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function acpModel(
|
|
82
|
+
harness: HarnessId,
|
|
83
|
+
override: string,
|
|
84
|
+
deps: CommitMessageDeps,
|
|
85
|
+
): Promise<{ provider: string; modelId: string } | null> {
|
|
86
|
+
const value = override.trim()
|
|
87
|
+
|| resolveDefaultModel(
|
|
88
|
+
await (deps.loadHarnessConfig ?? loadHarnessConfig)(harness),
|
|
89
|
+
await (deps.harnessProbeModels ?? harnessProbeModels)(harness),
|
|
90
|
+
);
|
|
91
|
+
if (!value) return null;
|
|
92
|
+
return { provider: modelProvider(value), modelId: value };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export async function resolveCommitMessageTarget(
|
|
96
|
+
settings: CommitMessageSettings,
|
|
97
|
+
sessionId?: string | null,
|
|
98
|
+
deps: CommitMessageDeps = {},
|
|
99
|
+
): Promise<CommitMessageTarget | null> {
|
|
100
|
+
if (settings.mode === 'off') return null;
|
|
101
|
+
|
|
102
|
+
if (settings.mode === 'omp') {
|
|
103
|
+
return { kind: 'omp', harness: 'omp-rpc', model: settings.model.trim() || await ompModel(deps) };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (settings.mode === 'harness') {
|
|
107
|
+
const harness = settings.harness.trim();
|
|
108
|
+
if (!harness || !harnessDescriptor(harness)) return null;
|
|
109
|
+
if (harness === 'omp-rpc') {
|
|
110
|
+
return { kind: 'omp', harness: 'omp-rpc', model: settings.model.trim() || await ompModel(deps) };
|
|
111
|
+
}
|
|
112
|
+
return { kind: 'acp', harness, model: settings.model.trim() || null };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// auto: the chat the user is in decides the agent; no chat means omp.
|
|
116
|
+
if (sessionId) {
|
|
117
|
+
const row = await (deps.loadHarnessSession ?? loadHarnessSession)(sessionId);
|
|
118
|
+
const harness = row?.harness && harnessDescriptor(row.harness) ? row.harness as HarnessId : null;
|
|
119
|
+
if (harness && harness !== 'omp-rpc') {
|
|
120
|
+
return { kind: 'acp', harness, model: settings.model.trim() || null };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { kind: 'omp', harness: 'omp-rpc', model: settings.model.trim() || await ompModel(deps) };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function ompFailure(outcome: Extract<OmpPrintOutcome, { ok: false }>): CommitMessageResult {
|
|
127
|
+
switch (outcome.reason) {
|
|
128
|
+
case 'no-binary':
|
|
129
|
+
return {
|
|
130
|
+
ok: false,
|
|
131
|
+
status: 409,
|
|
132
|
+
error: 'omp is not installed. Pick a harness in Settings → Chats → Commit messages.',
|
|
133
|
+
code: 'omp_missing',
|
|
134
|
+
};
|
|
135
|
+
case 'timeout':
|
|
136
|
+
return { ok: false, status: 504, error: 'The commit message model timed out.', code: 'timeout' };
|
|
137
|
+
case 'exit':
|
|
138
|
+
return {
|
|
139
|
+
ok: false,
|
|
140
|
+
status: 502,
|
|
141
|
+
error: `omp could not generate a commit message${outcome.detail ? `: ${outcome.detail}` : '.'}`,
|
|
142
|
+
code: 'model_failed',
|
|
143
|
+
};
|
|
144
|
+
default:
|
|
145
|
+
return { ok: false, status: 500, error: 'Could not start omp.', code: 'spawn_failed' };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function acpFailure(
|
|
150
|
+
harness: HarnessId,
|
|
151
|
+
outcome: Extract<AcpOneShotOutcome, { ok: false }>,
|
|
152
|
+
): CommitMessageResult {
|
|
153
|
+
const label = harnessDescriptor(harness)?.label ?? harness;
|
|
154
|
+
switch (outcome.reason) {
|
|
155
|
+
case 'launch':
|
|
156
|
+
return {
|
|
157
|
+
ok: false,
|
|
158
|
+
status: 409,
|
|
159
|
+
error: `${label} cannot start. Check Settings → Harnesses.`,
|
|
160
|
+
code: 'harness_unavailable',
|
|
161
|
+
};
|
|
162
|
+
case 'timeout':
|
|
163
|
+
return {
|
|
164
|
+
ok: false,
|
|
165
|
+
status: 504,
|
|
166
|
+
error: `${label} timed out while writing the commit message.`,
|
|
167
|
+
code: 'timeout',
|
|
168
|
+
};
|
|
169
|
+
case 'no-reply':
|
|
170
|
+
return {
|
|
171
|
+
ok: false,
|
|
172
|
+
status: 502,
|
|
173
|
+
error: `${label} did not return a commit message.`,
|
|
174
|
+
code: 'empty_reply',
|
|
175
|
+
};
|
|
176
|
+
default:
|
|
177
|
+
return {
|
|
178
|
+
ok: false,
|
|
179
|
+
status: 502,
|
|
180
|
+
error: `${label} could not generate a commit message.`,
|
|
181
|
+
code: 'model_failed',
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export async function generateCommitMessage(
|
|
187
|
+
request: GenerateCommitMessageRequest,
|
|
188
|
+
deps: CommitMessageDeps = {},
|
|
189
|
+
): Promise<CommitMessageResult> {
|
|
190
|
+
const target = await resolveCommitMessageTarget(request.settings, request.sessionId, deps);
|
|
191
|
+
if (!target) {
|
|
192
|
+
const off = request.settings.mode === 'off';
|
|
193
|
+
return {
|
|
194
|
+
ok: false,
|
|
195
|
+
status: 409,
|
|
196
|
+
error: off
|
|
197
|
+
? 'Commit message generation is off. Choose a model in Settings → Chats → Commit messages.'
|
|
198
|
+
: 'Choose a harness in Settings → Chats → Commit messages.',
|
|
199
|
+
code: off ? 'commit_message_off' : 'commit_harness_missing',
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const context = limitCommitContext(
|
|
204
|
+
await (deps.readContext ?? readCommitContext)(request.targetDir, request.amend === true),
|
|
205
|
+
);
|
|
206
|
+
if (context.files.length === 0 && !context.diff.trim()) {
|
|
207
|
+
return {
|
|
208
|
+
ok: false,
|
|
209
|
+
status: 409,
|
|
210
|
+
error: request.amend ? 'There is no commit to amend.' : 'Stage changes first.',
|
|
211
|
+
code: 'nothing_staged',
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const customPrompt = request.settings.prompt.trim();
|
|
216
|
+
if (customPrompt) {
|
|
217
|
+
const validation = validateCommitPrompt(customPrompt);
|
|
218
|
+
if (!validation.ok) {
|
|
219
|
+
return { ok: false, status: 409, error: validation.error, code: 'prompt_missing_diff' };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const prompt = buildCommitMessagePrompt(context, customPrompt);
|
|
224
|
+
|
|
225
|
+
if (target.kind === 'omp') {
|
|
226
|
+
const outcome = await (deps.runOmp ?? runOmpPrint)({
|
|
227
|
+
prompt,
|
|
228
|
+
cwd: request.targetDir,
|
|
229
|
+
...(target.model ? { model: target.model } : {}),
|
|
230
|
+
});
|
|
231
|
+
if (!outcome.ok) return ompFailure(outcome);
|
|
232
|
+
const message = cleanCommitMessage(outcome.text);
|
|
233
|
+
if (!message) {
|
|
234
|
+
return { ok: false, status: 502, error: 'The model returned an empty commit message.', code: 'empty_reply' };
|
|
235
|
+
}
|
|
236
|
+
return { ok: true, message, target };
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const outcome = await (deps.runAcp ?? runAcpOneShot)({
|
|
240
|
+
harness: target.harness,
|
|
241
|
+
cwd: request.targetDir,
|
|
242
|
+
model: await acpModel(target.harness, target.model ?? '', deps),
|
|
243
|
+
prompt,
|
|
244
|
+
});
|
|
245
|
+
if (!outcome.ok) return acpFailure(target.harness, outcome);
|
|
246
|
+
const message = cleanCommitMessage(outcome.text);
|
|
247
|
+
if (!message) {
|
|
248
|
+
return { ok: false, status: 502, error: 'The agent returned an empty commit message.', code: 'empty_reply' };
|
|
249
|
+
}
|
|
250
|
+
return { ok: true, message, target };
|
|
251
|
+
}
|