@kabmo-labs/kabmo 0.32.0 → 0.33.0

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 (303) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +537 -530
  3. package/dist/client/static/js/{CsvGrid-amafmq3z.js → CsvGrid-fncjbg6j.js} +2 -2
  4. package/dist/client/static/js/{DocxView-851ps9t0.js → DocxView-c9v2vr3r.js} +5 -5
  5. package/dist/client/static/js/{DrawioView-kw1vy3r2.js → DrawioView-vxjksm12.js} +2 -2
  6. package/dist/client/static/js/ImageView-a3g5k226.js +1 -0
  7. package/dist/client/static/js/LayoutWrapper-hnjfwsjh.js +2 -0
  8. package/dist/client/static/js/Modal-qtftcp2t.js +38 -0
  9. package/dist/client/static/js/{PdfView-f5jkm0rs.js → PdfView-ksaes53y.js} +1 -1
  10. package/dist/client/static/js/SessionsView-30vcr95v.js +1 -0
  11. package/dist/client/static/js/{SheetView-23zxy30b.js → SheetView-vc484scg.js} +23 -23
  12. package/dist/client/static/js/{SvgPreview-c341y50e.js → SvgPreview-tph89jet.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-2dc3mpk6.js → abnfDiagram-O67JEVCF-xbar278c.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-tavtgb8a.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-7jmrr5ja.js → architectureDiagram-NJMV4G6O-s171n2z6.js} +3 -3
  16. package/dist/client/static/js/{astro-sjtf954j.js → astro-80bs6hvg.js} +1 -1
  17. package/dist/client/static/js/bash-b3rwyg5p.js +1 -0
  18. package/dist/client/static/js/{blockDiagram-BEXU5L5S-jrk2m0ea.js → blockDiagram-BEXU5L5S-gzx6rv9n.js} +3 -3
  19. package/dist/client/static/js/c-wkgxb1t1.js +1 -0
  20. package/dist/client/static/js/{c4Diagram-YGBWAQC7-48cyncjd.js → c4Diagram-YGBWAQC7-7f00skch.js} +2 -2
  21. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-gm7jt1cd.js → classDiagram-v2-NBCMYWYE-j79v95nc.js} +4 -4
  22. package/dist/client/static/js/{cose-bilkent-JH36ORCC-g0g3z0xp.js → cose-bilkent-JH36ORCC-5fkn7ee5.js} +1 -1
  23. package/dist/client/static/js/cpp-y0t6mynx.js +1 -0
  24. package/dist/client/static/js/css-6vj0d308.js +1 -0
  25. package/dist/client/static/js/cynefin-OW5HDTMX-cdh3n2z2.js +1 -0
  26. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-6vjde6am.js → cynefinDiagram-VND7K2PF-cfs1yvrd.js} +1 -1
  27. package/dist/client/static/js/{dagre-6A5THRUB-q6k8bx1j.js → dagre-6A5THRUB-44bgc48p.js} +2 -2
  28. package/dist/client/static/js/{diagram-22UHCM2B-87cmze2n.js → diagram-22UHCM2B-a4g4x83k.js} +19 -19
  29. package/dist/client/static/js/{diagram-3UASUU5V-1ejbr2p4.js → diagram-3UASUU5V-gm4rg5na.js} +1 -1
  30. package/dist/client/static/js/{diagram-ATOU4E4O-vaw1r6k2.js → diagram-ATOU4E4O-a95y41vk.js} +3 -3
  31. package/dist/client/static/js/{diagram-CDSNMT55-gxm9zv7d.js → diagram-CDSNMT55-t3j93mmc.js} +5 -5
  32. package/dist/client/static/js/{diagram-MLGK6HIB-x010xswm.js → diagram-MLGK6HIB-c2wdez02.js} +1 -1
  33. package/dist/client/static/js/{diagram-MPIPVDR6-qtcq7e6c.js → diagram-MPIPVDR6-gya9jhs5.js} +2 -2
  34. package/dist/client/static/js/{dockerfile-k5xbramm.js → dockerfile-a7q6174s.js} +1 -1
  35. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-nwwbasfh.js → ebnfDiagram-ZINNZB2B-jjhkza6t.js} +1 -1
  36. package/dist/client/static/js/{elk-276RUBZZ-xcp7thax.js → elk-276RUBZZ-f7re45mw.js} +1 -1
  37. package/dist/client/static/js/{erDiagram-OPXOYQCR-xj1tp716.js → erDiagram-OPXOYQCR-tpm9g5te.js} +6 -6
  38. package/dist/client/static/js/{erlang-rz1g9mxy.js → erlang-qt876zrq.js} +1 -1
  39. package/dist/client/static/js/eventmodeling-NTZA5JFV-as97tpyp.js +1 -0
  40. package/dist/client/static/js/flowDiagram-KWPJA3E3-ggm06d12.js +1 -0
  41. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-f7q96bea.js → ganttDiagram-FUAMR5RP-fz43n12d.js} +4 -4
  42. package/dist/client/static/js/gitGraph-4MIJSDKK-eqz7p9ng.js +1 -0
  43. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-1rydkyq9.js → gitGraphDiagram-X574FWY7-f61hgbn6.js} +9 -9
  44. package/dist/client/static/js/graphql-n43pd5fs.js +1 -0
  45. package/dist/client/static/js/{index-0g25yrc0.js → index-03h3bkcf.js} +1 -1
  46. package/dist/client/static/js/{index-8m3q2zpb.js → index-0e40xskg.js} +1 -1
  47. package/dist/client/static/js/{index-w5131mtt.js → index-0n5wwe60.js} +2 -2
  48. package/dist/client/static/js/{index-ynqnbvn2.js → index-0tf0arsp.js} +3 -3
  49. package/dist/client/static/js/{index-0a1ekhqf.js → index-14vndmcr.js} +2 -2
  50. package/dist/client/static/js/index-1a0zkj8h.js +2 -0
  51. package/dist/client/static/js/{index-zca66d5d.js → index-1xqs14fr.js} +3 -3
  52. package/dist/client/static/js/{index-73xfkyea.js → index-1y9r4frb.js} +2 -2
  53. package/dist/client/static/js/{index-0n9c85ke.js → index-2svnq5gg.js} +2 -2
  54. package/dist/client/static/js/{index-pe9j88d4.js → index-2x5f66t6.js} +2 -2
  55. package/dist/client/static/js/{index-ggaqh9rt.js → index-354mqqra.js} +2 -2
  56. package/dist/client/static/js/{index-2t2tnc3x.js → index-3rcjx70v.js} +1 -1
  57. package/dist/client/static/js/{index-9nbxb421.js → index-3zc1b0dv.js} +2 -2
  58. package/dist/client/static/js/{index-14wppnkx.js → index-5tgq7aqx.js} +2 -2
  59. package/dist/client/static/js/{index-vrbcj11n.js → index-76zb4m0n.js} +2 -2
  60. package/dist/client/static/js/{index-x64kqgen.js → index-7y6rpsrp.js} +2 -2
  61. package/dist/client/static/js/{index-2n5wy1sh.js → index-8239j2v1.js} +1 -1
  62. package/dist/client/static/js/{index-pkyrkkbt.js → index-9fjt5anh.js} +2 -2
  63. package/dist/client/static/js/{index-m6wwc5h6.js → index-9t82sx0w.js} +2 -2
  64. package/dist/client/static/js/{index-hkq0y3pn.js → index-9y3gjdj7.js} +2 -2
  65. package/dist/client/static/js/{index-hyry1n8x.js → index-ahv9y42z.js} +2 -2
  66. package/dist/client/static/js/{index-f519m6s3.js → index-ajs3jj6j.js} +1 -1
  67. package/dist/client/static/js/index-apvkd37e.js +4 -0
  68. package/dist/client/static/js/index-at6bhjyf.js +1 -0
  69. package/dist/client/static/js/index-bkye8mz4.js +2 -0
  70. package/dist/client/static/js/{index-e7a3fkvv.js → index-d495kfm0.js} +1 -1
  71. package/dist/client/static/js/{index-hhm62nfj.js → index-dbe6afkf.js} +2 -2
  72. package/dist/client/static/js/{index-c20a46ww.js → index-djmg1d7h.js} +2 -2
  73. package/dist/client/static/js/{index-fc2j6bq2.js → index-e4p4cd3r.js} +2 -2
  74. package/dist/client/static/js/{index-f63y3mjj.js → index-eyzeya95.js} +5 -5
  75. package/dist/client/static/js/{index-123e8tqq.js → index-gcs49f3p.js} +1 -1
  76. package/dist/client/static/js/{index-c8jzx6b0.js → index-gs6f0qwa.js} +2 -2
  77. package/dist/client/static/js/{index-6sdctwv2.js → index-hf52f59k.js} +2 -2
  78. package/dist/client/static/js/{index-3anc30zh.js → index-j0r5hj0j.js} +2 -2
  79. package/dist/client/static/js/{index-31jrebvn.js → index-js7t1vb1.js} +18 -18
  80. package/dist/client/static/js/{index-xa7nrnda.js → index-km2zb6wk.js} +2 -2
  81. package/dist/client/static/js/{index-yvcpdk5f.js → index-m73za75e.js} +1 -1
  82. package/dist/client/static/js/{index-e6rar25v.js → index-pbe4yed4.js} +2 -2
  83. package/dist/client/static/js/{index-xpf2ra60.js → index-pxv2nw9w.js} +1 -1
  84. package/dist/client/static/js/{index-deex10rz.js → index-q2w6s8n7.js} +5 -5
  85. package/dist/client/static/js/{index-22jaxtz1.js → index-qckv9nte.js} +2 -2
  86. package/dist/client/static/js/{index-e26rd868.js → index-qsm2z36d.js} +2 -2
  87. package/dist/client/static/js/{index-5zd1jx9r.js → index-rg8jpbsw.js} +2 -2
  88. package/dist/client/static/js/{index-gvwqjpcr.js → index-rytaa8ca.js} +2 -2
  89. package/dist/client/static/js/{index-fmxn1rzs.js → index-sdtye3jy.js} +2 -2
  90. package/dist/client/static/js/index-sffjtm5w.js +12 -0
  91. package/dist/client/static/js/{index-tr8754r0.js → index-trm9x02n.js} +45 -45
  92. package/dist/client/static/js/{index-cwaz6geq.js → index-vtbbfwx0.js} +2 -2
  93. package/dist/client/static/js/{index-vmvcse63.js → index-vw4brsdx.js} +1 -1
  94. package/dist/client/static/js/{index-qmh0h87h.js → index-vw5k8csz.js} +55 -55
  95. package/dist/client/static/js/{index-52bgxh6f.js → index-w0fwb80e.js} +1 -1
  96. package/dist/client/static/js/{index-s9vp6p70.js → index-x07kp3jz.js} +2 -2
  97. package/dist/client/static/js/{index-8a3tmm1h.js → index-xj9649ac.js} +7 -7
  98. package/dist/client/static/js/{index-w4re5r8w.js → index-ypx3qmhq.js} +2 -2
  99. package/dist/client/static/js/{index-y139vc12.js → index-zt75xpq0.js} +193 -193
  100. package/dist/client/static/js/{index-nsrnyqcm.js → index-zvfvqvn9.js} +2 -2
  101. package/dist/client/static/js/info-A6RAGUB7-4pkzh1qx.js +1 -0
  102. package/dist/client/static/js/{infoDiagram-VRGFBTTK-ptg07tp2.js → infoDiagram-VRGFBTTK-1qj804sn.js} +1 -1
  103. package/dist/client/static/js/ini-j5dyq6gm.js +1 -0
  104. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-bdk2dkf5.js → ishikawaDiagram-OU5B5YK6-4j4qsnzw.js} +3 -3
  105. package/dist/client/static/js/java-g4dgwbfd.js +1 -0
  106. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-kez0ha4c.js → journeyDiagram-ZHPQQLJL-j0brnfft.js} +4 -4
  107. package/dist/client/static/js/json-j5q8nt57.js +1 -0
  108. package/dist/client/static/js/jsx-7t5ecz9s.js +1 -0
  109. package/dist/client/static/js/{julia-nmr85k8z.js → julia-4ghmfy3e.js} +1 -1
  110. package/dist/client/static/js/{kanban-definition-PNTS6WVX-dhzp3qg5.js → kanban-definition-PNTS6WVX-qqc22br0.js} +3 -3
  111. package/dist/client/static/js/lua-1g6w30de.js +1 -0
  112. package/dist/client/static/js/markdown-afx21x8c.js +1 -0
  113. package/dist/client/static/js/{mermaid.core-h7wttbss.js → mermaid.core-vv3wbe65.js} +7 -7
  114. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-tq5dd1em.js → mindmap-definition-NLK3R4M7-y5b2z8zp.js} +4 -4
  115. package/dist/client/static/js/one-dark-pro-hm3f56n1.js +1 -0
  116. package/dist/client/static/js/one-light-xrz49rct.js +1 -0
  117. package/dist/client/static/js/packet-AYTQ26CC-yg71sp88.js +1 -0
  118. package/dist/client/static/js/{pegDiagram-GJSIUBJH-e5hrdfzv.js → pegDiagram-GJSIUBJH-0be07mqs.js} +1 -1
  119. package/dist/client/static/js/{perl-prxcva8r.js → perl-sd00t4b4.js} +1 -1
  120. package/dist/client/static/js/{php-m9kcctzs.js → php-2zfyqa61.js} +1 -1
  121. package/dist/client/static/js/pie-WAS4IAKB-89wd6np0.js +1 -0
  122. package/dist/client/static/js/{pieDiagram-5QR66LMP-axvbvnz8.js → pieDiagram-5QR66LMP-544w86jk.js} +2 -2
  123. package/dist/client/static/js/properties-thd83wey.js +1 -0
  124. package/dist/client/static/js/python-264ns4xw.js +1 -0
  125. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-wtn28cfm.js → quadrantDiagram-O4NWA36T-p09e7z5s.js} +4 -4
  126. package/dist/client/static/js/r-qw82kkv9.js +1 -0
  127. package/dist/client/static/js/radar-RG4KPBEZ-avn0b8r9.js +1 -0
  128. package/dist/client/static/js/railroad-74A4TZTK-de27xv5w.js +1 -0
  129. package/dist/client/static/js/railroad-abnf-HS5TGJTU-rg4zzj7x.js +1 -0
  130. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-d84fhj8v.js +1 -0
  131. package/dist/client/static/js/railroad-peg-WCYAUIDC-dvf8xrmc.js +1 -0
  132. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-avjkq945.js → railroadDiagram-XR7U4H2S-de830ed2.js} +1 -1
  133. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-bntx7r6q.js → requirementDiagram-PLB6GJNP-b47d74p1.js} +4 -4
  134. package/dist/client/static/js/{ruby-t06c0e7g.js → ruby-v9qaqhby.js} +1 -1
  135. package/dist/client/static/js/{rust-6gqjxyf0.js → rust-fkt0qyrs.js} +1 -1
  136. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-ps8nkdm2.js → sankeyDiagram-IPEJSGJF-6ezc2fpj.js} +5 -5
  137. package/dist/client/static/js/{sass-gsbyn3wh.js → sass-9bxped7y.js} +1 -1
  138. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-3ckf1q6z.js → sequenceDiagram-PO4LG4MO-by5zqj6w.js} +18 -18
  139. package/dist/client/static/js/{sizeCapture-INFHLROL-akvcr1x7.js → sizeCapture-INFHLROL-q85r06j6.js} +1 -1
  140. package/dist/client/static/js/sql-g8wcshpc.js +1 -0
  141. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-c82914fz.js → stateDiagram-v2-GCMORJYK-ep5pyexs.js} +3 -3
  142. package/dist/client/static/js/{svelte-j54gfrvq.js → svelte-mwtx07d9.js} +1 -1
  143. package/dist/client/static/js/{swimlanes-2SLR337P-scgdefh4.js → swimlanes-2SLR337P-95fcqkh8.js} +1 -1
  144. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-xs2en5dv.js +8 -0
  145. package/dist/client/static/js/{timeline-definition-EJHVYXUP-z2ha1rhq.js → timeline-definition-EJHVYXUP-461e615g.js} +2 -2
  146. package/dist/client/static/js/treeView-Q6P3EWNA-mham0bh6.js +1 -0
  147. package/dist/client/static/js/treemap-WGGIJYW6-mxrxax86.js +1 -0
  148. package/dist/client/static/js/tsx-nm94hed6.js +1 -0
  149. package/dist/client/static/js/typescript-0s2t05jj.js +1 -0
  150. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-3wdmrfmk.js → usecaseDiagram-POWQR4AR-ftqfnvhg.js} +38 -38
  151. package/dist/client/static/js/{vennDiagram-UO4OBE2U-7m5tatzv.js → vennDiagram-UO4OBE2U-7t96h6ez.js} +7 -7
  152. package/dist/client/static/js/{vue-y8bb5f3h.js → vue-j8vb9d7r.js} +1 -1
  153. package/dist/client/static/js/wardley-WFR3VGLG-8vrvh9p3.js +1 -0
  154. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-55ps9s4z.js → wardleyDiagram-VNRHLVJA-0de8w8c6.js} +4 -4
  155. package/dist/client/static/js/xml-dz51p1m3.js +1 -0
  156. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-8bsjtm4t.js → xychartDiagram-PMCCYNJV-dez9phkf.js} +5 -5
  157. package/dist/client/static/js/yaml-2cfkd30t.js +1 -0
  158. package/package.json +1 -1
  159. package/src/client/components/common/context-usage-button/McpSection.test.tsx +98 -0
  160. package/src/client/components/common/context-usage-button/McpSection.tsx +12 -5
  161. package/src/client/components/common/context-usage-button/SessionStats.tsx +80 -0
  162. package/src/client/components/common/context-usage-button/index.test.tsx +26 -0
  163. package/src/client/components/common/context-usage-button/index.tsx +36 -28
  164. package/src/client/components/common/harness-glyph/brands.ts +8 -0
  165. package/src/client/components/common/session-actions-menu/index.tsx +6 -1
  166. package/src/client/components/layout/session-sidebar/SessionsView.tsx +20 -33
  167. package/src/client/components/mobile/LayoutWrapper.tsx +28 -29
  168. package/src/client/components/mobile/mobile-right-sidebar/FullDiff.tsx +9 -2
  169. package/src/client/components/mobile/worktree-session.ts +4 -1
  170. package/src/client/components/settings/apply-side-effects.test.ts +11 -0
  171. package/src/client/components/settings/apply-side-effects.ts +7 -0
  172. package/src/client/components/settings/categories/ChatSettings.test.tsx +1 -1
  173. package/src/client/components/settings/categories/ChatSettings.tsx +2 -0
  174. package/src/client/components/settings/categories/NotificationSettings.tsx +1 -1
  175. package/src/client/components/settings/categories/chat-settings/ChangedFilesSection.tsx +79 -0
  176. package/src/client/components/settings/categories/chat-settings/groups.ts +4 -3
  177. package/src/client/components/workspace/chat-timeline/ChangedFilesSummary.tsx +101 -0
  178. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +16 -15
  179. package/src/client/components/workspace/chat-timeline/MessageList.tsx +33 -1
  180. package/src/client/components/workspace/chat-timeline/RunFooter.tsx +21 -1
  181. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +13 -0
  182. package/src/client/components/workspace/chat-timeline/fork-preview.test.tsx +11 -0
  183. package/src/client/components/workspace/chat-timeline/index.tsx +1 -1
  184. package/src/client/components/workspace/diff-panel/Toolbar.tsx +17 -51
  185. package/src/client/components/workspace/diff-panel/index.tsx +23 -4
  186. package/src/client/components/workspace/diff-panel/toolbar-git-actions.tsx +94 -0
  187. package/src/client/components/workspace/editor/Body.tsx +2 -0
  188. package/src/client/data/settings/omp-schema.json +73 -3
  189. package/src/client/hooks/chat/btw/mode.ts +5 -1
  190. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +9 -3
  191. package/src/client/hooks/chat/timeline/changed-files-setting.test.ts +31 -0
  192. package/src/client/hooks/chat/timeline/changed-files-setting.ts +60 -0
  193. package/src/client/hooks/chat/timeline/new-chat.ts +4 -1
  194. package/src/client/hooks/chat/timeline/pending-dispatch.ts +6 -10
  195. package/src/client/hooks/chat/timeline/session-changes.ts +51 -0
  196. package/src/client/hooks/chat/waiting/dispatch.ts +4 -1
  197. package/src/client/hooks/ui/notification-events.test.ts +3 -0
  198. package/src/client/hooks/ui/notification-events.ts +3 -1
  199. package/src/client/hooks/ui/notification-sound.ts +13 -6
  200. package/src/client/hooks/ui/ui-sounds.test.ts +15 -0
  201. package/src/client/hooks/workspace/batch-delete-run.ts +5 -1
  202. package/src/client/hooks/workspace/diff-file.ts +11 -4
  203. package/src/client/hooks/workspace/file-tabs.ts +13 -4
  204. package/src/client/hooks/workspace/journal-diff.ts +97 -0
  205. package/src/client/hooks/workspace/session-delete.ts +5 -1
  206. package/src/client/lib/notifications/native-banner-sound.test.ts +93 -0
  207. package/src/client/lib/notifications/native-banner-sound.ts +46 -0
  208. package/src/client/lib/notifications/os.test.ts +14 -5
  209. package/src/client/lib/notifications/os.ts +8 -0
  210. package/src/client/lib/router/branch-params.test.ts +62 -0
  211. package/src/client/lib/router/branch-params.ts +48 -0
  212. package/src/server/lib/assets/shell-settings.server.test.ts +35 -0
  213. package/src/server/lib/assets/shell-settings.server.ts +33 -0
  214. package/src/server/lib/harness/launch-table.ts +10 -0
  215. package/src/server/lib/omp/session/changes.test.ts +138 -0
  216. package/src/server/lib/omp/session/changes.ts +220 -0
  217. package/src/server/lib/omp/session/session-discovery.test.ts +4 -4
  218. package/src/server/lib/omp/session/sidebar-activity.server.test.ts +6 -2
  219. package/src/server/lib/omp/session/subagent-presence-scan.ts +54 -0
  220. package/src/server/lib/omp/session/subagent-presence-store.test.ts +1 -1
  221. package/src/server/lib/omp/session/subagent-presence.test.ts +115 -0
  222. package/src/server/lib/omp/session/subagent-presence.ts +12 -3
  223. package/src/server/lib/omp/session/telemetry/compute.ts +68 -0
  224. package/src/server/lib/omp/session/telemetry.test.ts +81 -0
  225. package/src/server/lib/realtime/topics/peer-relay.server.test.ts +1 -11
  226. package/src/server/plugins/ssr.ts +20 -8
  227. package/src/server/routes/sessions/changes.test.ts +90 -0
  228. package/src/server/routes/sessions/changes.ts +55 -0
  229. package/src/server/routes/sessions/index.ts +6 -0
  230. package/src/shared/lib/chat/duration.ts +34 -0
  231. package/src/shared/lib/chat/timeline/changed-files.test.ts +121 -0
  232. package/src/shared/lib/chat/timeline/changed-files.ts +71 -0
  233. package/src/shared/lib/chat/timeline/fork-anchor.test.ts +3 -0
  234. package/src/shared/lib/format/duration.test.ts +31 -0
  235. package/src/shared/lib/format/duration.ts +27 -0
  236. package/src/shared/lib/fs/unified-diff.test.ts +53 -0
  237. package/src/shared/lib/fs/unified-diff.ts +127 -0
  238. package/src/shared/lib/harness/brand-color.ts +3 -0
  239. package/src/shared/lib/harness/catalog.test.ts +13 -0
  240. package/src/shared/lib/harness/catalog.ts +8 -1
  241. package/src/shared/lib/harness/fork.ts +4 -2
  242. package/src/shared/lib/harness/mcp-facts.ts +3 -0
  243. package/src/shared/lib/harness/provider-facts.ts +14 -0
  244. package/src/shared/lib/harness/updates.ts +5 -0
  245. package/src/shared/lib/icons/tint-hues.generated.ts +27 -27
  246. package/src/shared/lib/omp/config/schema.test.ts +4 -2
  247. package/src/shared/lib/settings/defaults.ts +1 -0
  248. package/src/shared/lib/workspace/file-tab-id.ts +9 -0
  249. package/src/shared/types/context.ts +18 -0
  250. package/src/shared/types/fs.ts +21 -0
  251. package/src/shared/types/index.ts +1 -0
  252. package/src/shared/types/omp/session.ts +6 -0
  253. package/src/shared/types/session-changes.ts +58 -0
  254. package/src/shared/types/settings/state.ts +8 -0
  255. package/src/test-support/peer-harness.ts +13 -5
  256. package/dist/client/static/js/ImageView-ksx9bbct.js +0 -1
  257. package/dist/client/static/js/LayoutWrapper-9ftz050x.js +0 -2
  258. package/dist/client/static/js/Modal-f8x3j3be.js +0 -38
  259. package/dist/client/static/js/SessionsView-wzdf1cp6.js +0 -1
  260. package/dist/client/static/js/architecture-7GRP2DOG-4wsd6vk0.js +0 -1
  261. package/dist/client/static/js/bash-h6pkqvth.js +0 -1
  262. package/dist/client/static/js/c-thbdzmwv.js +0 -1
  263. package/dist/client/static/js/cpp-r1za1kke.js +0 -1
  264. package/dist/client/static/js/css-qsv4vvke.js +0 -1
  265. package/dist/client/static/js/cynefin-OW5HDTMX-eycwde8c.js +0 -1
  266. package/dist/client/static/js/eventmodeling-NTZA5JFV-srqbnmey.js +0 -1
  267. package/dist/client/static/js/flowDiagram-KWPJA3E3-yj98317w.js +0 -1
  268. package/dist/client/static/js/gitGraph-4MIJSDKK-5jcrvn94.js +0 -1
  269. package/dist/client/static/js/graphql-275pg7ya.js +0 -1
  270. package/dist/client/static/js/index-b08zd4eq.js +0 -1
  271. package/dist/client/static/js/index-g0pkzanm.js +0 -2
  272. package/dist/client/static/js/index-ga2xdef3.js +0 -2
  273. package/dist/client/static/js/index-r416e9dt.js +0 -12
  274. package/dist/client/static/js/index-xzfsaqyz.js +0 -4
  275. package/dist/client/static/js/info-A6RAGUB7-mbt0ryx5.js +0 -1
  276. package/dist/client/static/js/ini-jqdrx98c.js +0 -1
  277. package/dist/client/static/js/java-70zqqrkr.js +0 -1
  278. package/dist/client/static/js/json-kxk8gfet.js +0 -1
  279. package/dist/client/static/js/jsx-h1035eqk.js +0 -1
  280. package/dist/client/static/js/lua-j2356waf.js +0 -1
  281. package/dist/client/static/js/markdown-ffw6rgk6.js +0 -1
  282. package/dist/client/static/js/one-dark-pro-8acf6cn2.js +0 -1
  283. package/dist/client/static/js/one-light-ysc1knem.js +0 -1
  284. package/dist/client/static/js/packet-AYTQ26CC-a5yw789s.js +0 -1
  285. package/dist/client/static/js/pie-WAS4IAKB-x0y4v4r2.js +0 -1
  286. package/dist/client/static/js/properties-55mrarxr.js +0 -1
  287. package/dist/client/static/js/python-dhypc3j4.js +0 -1
  288. package/dist/client/static/js/r-6b8dt1wp.js +0 -1
  289. package/dist/client/static/js/radar-RG4KPBEZ-trrc3ta1.js +0 -1
  290. package/dist/client/static/js/railroad-74A4TZTK-dxgvx21w.js +0 -1
  291. package/dist/client/static/js/railroad-abnf-HS5TGJTU-rbgkd8sk.js +0 -1
  292. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-exgw7j47.js +0 -1
  293. package/dist/client/static/js/railroad-peg-WCYAUIDC-28tpamzk.js +0 -1
  294. package/dist/client/static/js/sql-9dq913c8.js +0 -1
  295. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-0x2ashav.js +0 -8
  296. package/dist/client/static/js/treeView-Q6P3EWNA-1a00b6kc.js +0 -1
  297. package/dist/client/static/js/treemap-WGGIJYW6-2q4f2f7m.js +0 -1
  298. package/dist/client/static/js/tsx-wh5xgm7f.js +0 -1
  299. package/dist/client/static/js/typescript-ge85req5.js +0 -1
  300. package/dist/client/static/js/wardley-WFR3VGLG-x9v91the.js +0 -1
  301. package/dist/client/static/js/xml-7bgz40qa.js +0 -1
  302. package/dist/client/static/js/yaml-4ht9416k.js +0 -1
  303. package/src/client/components/layout/session-sidebar/new-session-context.test.ts +0 -55
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The collapsed "N files changed" row above a run's footer.
8
+ *
9
+ * The list is the agent's own change journal, bucketed into the run by
10
+ * `bucketChangesByRun`; clicking a file opens a diff tab whose two sides are
11
+ * the journal's before/after snapshots, not the worktree. That is the point:
12
+ * another agent or the user may have edited the file since, and the reader
13
+ * asked what THIS run did.
14
+ */
15
+
16
+ import { useState } from 'preact/hooks';
17
+ import { ChevronDown, ChevronRight } from 'lucide-preact';
18
+ import type { ChangedFile } from '@/shared/types';
19
+
20
+ const STATUS_LABEL: Record<ChangedFile['status'], string> = {
21
+ added: 'A',
22
+ modified: 'M',
23
+ deleted: 'D',
24
+ };
25
+
26
+ const STATUS_CLASS: Record<ChangedFile['status'], string> = {
27
+ added: 'text-success',
28
+ modified: 'text-warning',
29
+ deleted: 'text-error',
30
+ };
31
+
32
+ interface ChangedFilesSummaryProps {
33
+ files: ChangedFile[];
34
+ sessionId: string;
35
+ /** Run window, epoch ms — the range the diff tab reads. */
36
+ from: number;
37
+ to: number;
38
+ }
39
+
40
+ export function ChangedFilesSummary({
41
+ files,
42
+ sessionId,
43
+ from,
44
+ to,
45
+ }: ChangedFilesSummaryProps) {
46
+ const [expanded, setExpanded] = useState(false);
47
+ if (files.length === 0) return null;
48
+ const label = `${files.length} file${files.length === 1 ? '' : 's'} changed`;
49
+
50
+ return (
51
+ <div className="rounded-md border border-ink/10 bg-paper/60">
52
+ <button
53
+ type="button"
54
+ onClick={() => setExpanded((value) => !value)}
55
+ aria-expanded={expanded}
56
+ className="flex w-full items-center gap-1.5 px-2.5 py-1.5 text-left text-[11px] text-ink/70 hover:text-ink transition-colors cursor-pointer"
57
+ >
58
+ {expanded
59
+ ? <ChevronDown size={12} className="shrink-0" />
60
+ : <ChevronRight size={12} className="shrink-0" />}
61
+ <span className="font-medium">{label}</span>
62
+ </button>
63
+ {expanded && (
64
+ <ul className="border-t border-ink/10 py-0.5">
65
+ {files.map((file) => (
66
+ <li key={file.path}>
67
+ <button
68
+ type="button"
69
+ onClick={() => openJournalDiff(file, sessionId, from, to)}
70
+ className="flex w-full items-center gap-2 px-2.5 py-1 text-left text-[11px] hover:bg-ink/[0.04] transition-colors cursor-pointer"
71
+ title={file.path}
72
+ >
73
+ <span className={`w-3 shrink-0 font-mono font-semibold ${STATUS_CLASS[file.status]}`}>
74
+ {STATUS_LABEL[file.status]}
75
+ </span>
76
+ <span className="min-w-0 flex-1 truncate font-mono text-ink/80">{file.displayPath}</span>
77
+ {file.agent !== 'Main' && (
78
+ <span className="shrink-0 text-[10px] text-ink/40">{file.agent}</span>
79
+ )}
80
+ </button>
81
+ </li>
82
+ ))}
83
+ </ul>
84
+ )}
85
+ </div>
86
+ );
87
+ }
88
+
89
+ /** Open the journal diff tab for one file. The desktop and phone layouts both
90
+ * listen for `omp:open-diff`; the journal fields are what make it a journal
91
+ * read rather than a worktree read. */
92
+ function openJournalDiff(file: ChangedFile, sessionId: string, from: number, to: number): void {
93
+ window.dispatchEvent(new CustomEvent('omp:open-diff', {
94
+ detail: {
95
+ file: file.displayPath,
96
+ status: STATUS_LABEL[file.status],
97
+ source: 'journal',
98
+ journal: { sessionId, path: file.path, from, to },
99
+ },
100
+ }));
101
+ }
@@ -249,21 +249,6 @@ export function EmptyWorkspacePrompt({
249
249
  >
250
250
  {docked ? (
251
251
  <>
252
- {/* A fork is composed, not created: the source it branches from is
253
- still switchable, so its picker stays above the transcript the
254
- preview draws. Every other pending chat loses the row once docked
255
- because its first send already dispatched the spawn. */}
256
- {branchPreview && onParentSessionChange && (
257
- <div className={`shrink-0 flex items-center gap-1 flex-wrap ${isMobile ? 'pl-4 pr-3 pt-3' : 'px-4 pt-3'}`}>
258
- <ParentSessionPicker
259
- folders={folders as WorkspaceFolderData[]}
260
- value={parentSessionId}
261
- onChange={onParentSessionChange}
262
- label={branchLabel ?? 'Fork from'}
263
- allowNone={branchAllowNone ?? false}
264
- />
265
- </div>
266
- )}
267
252
  {/* The pending transcript reserves the box the real timeline's own
268
253
  scroller does (`TimelineBody`), so adoption moves no text either. */}
269
254
  <div
@@ -302,6 +287,22 @@ export function EmptyWorkspacePrompt({
302
287
  />
303
288
  )}
304
289
  {heldPrompt}
290
+ {/* A fork is composed, not created, so its source stays switchable
291
+ until the first send. The picker is dock furniture: it belongs
292
+ directly above the composer, where the control it affects is,
293
+ not pinned to the top of the transcript where it reads as part
294
+ of the source history. */}
295
+ {branchPreview && onParentSessionChange && (
296
+ <div className="flex items-center gap-1 flex-wrap px-1 pb-1">
297
+ <ParentSessionPicker
298
+ folders={folders as WorkspaceFolderData[]}
299
+ value={parentSessionId}
300
+ onChange={onParentSessionChange}
301
+ label={branchLabel ?? 'Fork from'}
302
+ allowNone={branchAllowNone ?? false}
303
+ />
304
+ </div>
305
+ )}
305
306
  {composer}
306
307
  </ComposerDockFrame>
307
308
  </>
@@ -8,9 +8,11 @@ import { TurnRail } from '@/client/components/workspace/chat-timeline/TurnRail';
8
8
  import { useToolRenderMode } from '@/client/hooks/chat/timeline/tool-render-mode';
9
9
  import { isNoticeRow } from '@/shared/lib/chat/notice-row';
10
10
  import { previousNonNoticeIndex, resolveRunFooters, streamingRowIndex } from '@/shared/lib/chat/timeline/run-footer';
11
+ import { bucketChangesByRun } from '@/shared/lib/chat/timeline/changed-files';
12
+ import { runWindowMs } from '@/shared/lib/chat/duration';
11
13
  import { groupTraceRows } from '@/shared/lib/chat/timeline/trace-groups';
12
14
  import type { TimelineRowWindow } from '@/client/hooks/chat/timeline/row-window';
13
- import type { Attachment, ChatMessageData } from '@/shared/types';
15
+ import type { Attachment, ChatMessageData, SessionChangeRecord } from '@/shared/types';
14
16
  import type { ForkAnchorRole } from '@/shared/lib/chat/timeline/fork-anchor';
15
17
 
16
18
  export interface MessageListProps {
@@ -46,6 +48,10 @@ export interface MessageListProps {
46
48
  * own timeline mounts a window instead.
47
49
  */
48
50
  rowWindow?: TimelineRowWindow;
51
+ /** Session id the journal diff tabs read from. */
52
+ sessionId?: string;
53
+ /** The session's agent change journal, bucketed into runs here. */
54
+ changeRecords?: SessionChangeRecord[];
49
55
  }
50
56
 
51
57
  /**
@@ -78,6 +84,8 @@ export const MessageList = memo(function MessageList({
78
84
  isMobile = false,
79
85
  userActions = true,
80
86
  rowWindow,
87
+ sessionId,
88
+ changeRecords,
81
89
  }: MessageListProps) {
82
90
  const { streamingIdx, footers, prevNonNoticeIdx } = useMemo(() => {
83
91
  return {
@@ -90,6 +98,24 @@ export const MessageList = memo(function MessageList({
90
98
  };
91
99
  }, [messages, isGenerating]);
92
100
 
101
+ // The journal's writes bucketed into runs, and each run's wall-clock window
102
+ // (the range a journal diff tab reads). Both are derived from the same
103
+ // `footers` pass, so a run's list and its diff cannot disagree about which
104
+ // run they describe.
105
+ const changedFilesByOwner = useMemo(
106
+ () => bucketChangesByRun(messages, footers, changeRecords ?? []),
107
+ [messages, footers, changeRecords],
108
+ );
109
+ const runWindows = useMemo(() => {
110
+ const windows = new Map<number, { start: number; end: number }>();
111
+ for (const slot of footers) {
112
+ if (!slot) continue;
113
+ const window = runWindowMs(messages, slot.runStartIndex, slot.ownerIndex);
114
+ if (window) windows.set(slot.ownerIndex, window);
115
+ }
116
+ return windows;
117
+ }, [messages, footers]);
118
+
93
119
  const start = rowWindow ? rowWindow.start : 0;
94
120
  const end = rowWindow ? Math.min(rowWindow.end, messages.length) : messages.length;
95
121
  const visible = start === 0 && end === messages.length ? messages : messages.slice(start, end);
@@ -167,6 +193,9 @@ export const MessageList = memo(function MessageList({
167
193
  onFork={onFork}
168
194
  isMobile={isMobile}
169
195
  showActions={userActions}
196
+ changedFiles={changedFilesByOwner.get(inlineFooter.ownerIndex)}
197
+ sessionId={sessionId}
198
+ runWindow={runWindows.get(inlineFooter.ownerIndex)}
170
199
  />
171
200
  )}
172
201
  </div>
@@ -190,6 +219,9 @@ export const MessageList = memo(function MessageList({
190
219
  onFork={onFork}
191
220
  isMobile={isMobile}
192
221
  showActions={userActions}
222
+ changedFiles={changedFilesByOwner.get(trailingFooter.ownerIndex)}
223
+ sessionId={sessionId}
224
+ runWindow={runWindows.get(trailingFooter.ownerIndex)}
193
225
  />
194
226
  )}
195
227
  </Fragment>
@@ -1,5 +1,6 @@
1
- import type { Attachment, ChatMessageData } from '@/shared/types';
1
+ import type { Attachment, ChangedFile, ChatMessageData } from '@/shared/types';
2
2
  import { AiMessageFooter } from '@/client/components/workspace/chat-timeline/AiMessageFooter';
3
+ import { ChangedFilesSummary } from '@/client/components/workspace/chat-timeline/ChangedFilesSummary';
3
4
  import { messageAnswerText } from '@/shared/lib/chat/notice-row';
4
5
  import { formatMessageStamp } from '@/shared/lib/format/time';
5
6
  import type { ForkAnchorRole } from '@/shared/lib/chat/timeline/fork-anchor';
@@ -46,6 +47,12 @@ interface RunFooterProps {
46
47
  * side answer) turns them off rather than rendering dead buttons.
47
48
  */
48
49
  showActions?: boolean;
50
+ /** Files this run changed, from the session's agent change journal. */
51
+ changedFiles?: ChangedFile[];
52
+ /** Session id the journal diff tabs read from. */
53
+ sessionId?: string;
54
+ /** The run's wall-clock window, epoch ms. */
55
+ runWindow?: { start: number; end: number };
49
56
  }
50
57
 
51
58
  /**
@@ -70,9 +77,22 @@ export function RunFooter({
70
77
  onFork,
71
78
  isMobile = false,
72
79
  showActions = true,
80
+ changedFiles,
81
+ sessionId,
82
+ runWindow,
73
83
  }: RunFooterProps) {
74
84
  return (
75
85
  <div className="mt-2">
86
+ {changedFiles && changedFiles.length > 0 && sessionId && runWindow && (
87
+ <div className="mb-1.5">
88
+ <ChangedFilesSummary
89
+ files={changedFiles}
90
+ sessionId={sessionId}
91
+ from={runWindow.start}
92
+ to={runWindow.end}
93
+ />
94
+ </div>
95
+ )}
76
96
  <AiMessageFooter
77
97
  provider={msg.provider || provider}
78
98
  providerNames={providerNames}
@@ -5,6 +5,8 @@ import { MinimapShortcuts } from '@/client/components/workspace/chat-timeline/Mi
5
5
  import { MobileTurnJump } from '@/client/components/workspace/chat-timeline/MobileTurnJump';
6
6
  import { LoadingOlderIndicator } from '@/client/components/workspace/chat-timeline/SessionSkeleton';
7
7
  import { OrphanAsks } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks';
8
+ import { useSessionChanges } from '@/client/hooks/chat/timeline/session-changes';
9
+ import { useShowChangedFiles } from '@/client/hooks/chat/timeline/changed-files-setting';
8
10
  import type { Attachment, ChatMessageData, UserTurnRef } from '@/shared/types';
9
11
  import type { ForkAnchorRole } from '@/shared/lib/chat/timeline/fork-anchor';
10
12
 
@@ -41,6 +43,8 @@ interface TimelineBodyProps {
41
43
  jumpToBottom: (behavior?: ScrollBehavior) => void;
42
44
  /** Which rows of `messages` are mounted (see `useTimelineRowWindow`). */
43
45
  rowWindow: TimelineRowWindow;
46
+ /** Session id the journal diff tabs read from. */
47
+ sessionId?: string;
44
48
  }
45
49
 
46
50
  /**
@@ -76,7 +80,14 @@ export function TimelineBody({
76
80
  showScrollBottom,
77
81
  jumpToBottom,
78
82
  rowWindow,
83
+ sessionId,
79
84
  }: TimelineBodyProps) {
85
+ // The agent's own change journal, for the per-run file list above each
86
+ // footer. Read once a run settles; a session with no journal (older omp)
87
+ // answers an empty list and the summary simply does not render. The setting
88
+ // gates the read too, so turning the list off costs no request.
89
+ const showChangedFiles = useShowChangedFiles();
90
+ const records = useSessionChanges(sessionId ?? null, isGenerating, showChangedFiles);
80
91
  return (
81
92
  <>
82
93
  {/* Jump to a user turn. The rail is desktop's form — one 1px line per
@@ -129,6 +140,8 @@ export function TimelineBody({
129
140
  onFork={onFork}
130
141
  isMobile={isMobile}
131
142
  rowWindow={rowWindow}
143
+ sessionId={sessionId}
144
+ changeRecords={records}
132
145
  />
133
146
  {/* An ask whose tool card this client cannot see (a subagent's, an
134
147
  extension's own dialog, a call outside the loaded window) still
@@ -119,6 +119,17 @@ describe('fork preview in the pending composer', () => {
119
119
  expect(el.querySelector('[aria-label="Undo this message"]')).toBeNull();
120
120
  });
121
121
 
122
+ test('the fork picker is dock furniture, not part of the transcript', async () => {
123
+ const el = mount({});
124
+ await settle();
125
+ const dock = el.querySelector('[data-composer-dock]');
126
+ const trigger = el.querySelector('[data-testid="parent-session-picker"]');
127
+ expect(trigger, 'the fork picker is missing').not.toBeNull();
128
+ // It used to sit above the preview rows, at the top of the pane; the control
129
+ // it affects is the composer, so it belongs inside the dock.
130
+ expect(dock?.contains(trigger as Node), 'the fork picker is outside the composer dock').toBe(true);
131
+ });
132
+
122
133
  test('"Fork from" stays reachable while the preview is docked, and reports a new source', async () => {
123
134
  const picked: string[] = [];
124
135
  const el = mount({ onParentSessionChange: (id: string | null) => picked.push(String(id)) });
@@ -268,7 +268,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
268
268
  onFork={fork}
269
269
  showScrollBottom={showScrollBottom}
270
270
  jumpToBottom={jumpToBottom}
271
- rowWindow={rowWindow}
271
+ rowWindow={rowWindow} sessionId={sessionId}
272
272
  />
273
273
  )}
274
274
  </div>
@@ -1,10 +1,11 @@
1
- import { AlignJustify, Check, ChevronDown, ChevronUp, Code2, Columns, Copy, Diff, FileCode, Minus, Plus, RefreshCw, Space, Undo2, WrapText } from 'lucide-preact';
1
+ import { AlignJustify, Check, ChevronDown, ChevronUp, Code2, Columns, Copy, Diff, FileCode, RefreshCw, Space, WrapText } from 'lucide-preact';
2
2
  import { FileIcon } from '@/client/components/common/file-icon';
3
3
  import { EditorViewButtons, useEditorViewActions } from '@/client/components/common/editor-view-buttons';
4
4
  import { getGitStatusInfo } from '@/shared/lib/fs/git-status';
5
5
  import { ToolbarRow, type ToolbarCluster } from '@/client/components/common/toolbar-row';
6
6
  import { DiffContentModeSegments, DiffViewModeSegments } from '@/client/components/workspace/diff-panel/ToolbarSegments';
7
7
  import { HunkStepper } from '@/client/components/workspace/diff-panel/HunkStepper';
8
+ import { ACTION_CLASS, gitActionClusters } from '@/client/components/workspace/diff-panel/toolbar-git-actions';
8
9
 
9
10
  export type DiffViewMode = 'unified' | 'split';
10
11
 
@@ -41,6 +42,12 @@ interface DiffToolbarProps {
41
42
  * chat column or sidebar beside it for a mode to widen into.
42
43
  */
43
44
  viewModeButtons?: boolean;
45
+ /**
46
+ * Hide the git writes. A journal diff shows the agent's own snapshots, which
47
+ * are not the worktree: staging or discarding from it would write a state the
48
+ * reader never saw.
49
+ */
50
+ readOnly?: boolean;
44
51
  onSetViewMode: (mode: DiffViewMode) => void;
45
52
  onSetContentMode: (mode: DiffContentMode) => void;
46
53
  onToggleWordWrap: () => void;
@@ -52,9 +59,6 @@ interface DiffToolbarProps {
52
59
  onCopyDiff: () => void;
53
60
  }
54
61
 
55
- const ACTION_CLASS =
56
- 'flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-ink/50';
57
-
58
62
  export function DiffToolbar({
59
63
  filePath,
60
64
  status,
@@ -72,6 +76,7 @@ export function DiffToolbar({
72
76
  isCopied,
73
77
  isBusy = false,
74
78
  viewModeButtons = true,
79
+ readOnly = false,
75
80
  onSetViewMode,
76
81
  onSetContentMode,
77
82
  onToggleWordWrap,
@@ -249,53 +254,14 @@ export function DiffToolbar({
249
254
  ),
250
255
  });
251
256
 
252
- if (!isStaged) {
253
- clusters.push({
254
- id: 'discard',
255
- actions: [{ label: 'Discard changes in this file', icon: Undo2, onSelect: onDiscard, disabled: locked }],
256
- children: (
257
- <button
258
- type="button"
259
- onClick={onDiscard}
260
- className={`${ACTION_CLASS} text-ink/50 hover:text-error hover:bg-error/10`}
261
- title="Discard changes in this file"
262
- aria-label="Discard changes in this file"
263
- disabled={locked}
264
- >
265
- <Undo2 size={13} />
266
- </button>
267
- ),
268
- });
269
- }
270
-
271
- clusters.push({
272
- id: 'stage',
273
- // The panel's primary write: a menu row must not be the only way to stage.
274
- pinned: true,
275
- actions: [{ label: stageLabel, icon: isStaged ? Minus : Plus, onSelect: onStageUnstage, disabled: locked }],
276
- children: (
277
- <button
278
- type="button"
279
- onClick={onStageUnstage}
280
- className="px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent"
281
- title={stageLabel}
282
- aria-label={stageLabel}
283
- disabled={locked}
284
- >
285
- {isStaged ? (
286
- <>
287
- <Minus size={12} />
288
- <span className="hidden @[360px]:inline">Unstage</span>
289
- </>
290
- ) : (
291
- <>
292
- <Plus size={12} />
293
- <span className="hidden @[360px]:inline">Stage</span>
294
- </>
295
- )}
296
- </button>
297
- ),
298
- });
257
+ clusters.push(...gitActionClusters({
258
+ isStaged,
259
+ locked,
260
+ readOnly,
261
+ stageLabel,
262
+ onStageUnstage,
263
+ onDiscard,
264
+ }));
299
265
 
300
266
  if (onOpenInEditor) {
301
267
  clusters.push({
@@ -2,8 +2,10 @@ import { useCallback, useRef, useState } from 'preact/hooks';
2
2
  import { useSessionUiState } from '@/client/hooks/workspace/session-state';
3
3
  import { isUnmergedCode } from '@/shared/lib/fs/git-unmerged';
4
4
  import { useFileDiff } from '@/client/hooks/workspace/diff-file';
5
+ import { useJournalDiff } from '@/client/hooks/workspace/journal-diff';
5
6
  import { useDiffGitActions } from '@/client/hooks/workspace/diff-git-actions';
6
7
  import { getLanguageFromPath } from '@/shared/lib/code/language';
8
+ import type { JournalDiffRef } from '@/shared/types/fs';
7
9
  import { DiffToolbar, type DiffContentMode, type DiffViewMode } from '@/client/components/workspace/diff-panel/Toolbar';
8
10
  import { ConflictBanner } from '@/client/components/workspace/diff-panel/ConflictBanner';
9
11
  import { ThemedMergeDiffView } from '@/client/components/workspace/diff-panel/ThemedMergeDiffView';
@@ -33,6 +35,14 @@ interface DiffPanelProps {
33
35
  * already covers the chat and the sidebar.
34
36
  */
35
37
  viewModeButtons?: boolean;
38
+ /**
39
+ * Read the two sides from the session's agent change journal instead of the
40
+ * worktree. The panel then shows what the agent wrote, even after someone
41
+ * else edited the file, and its git writes are hidden.
42
+ */
43
+ journalDiff?: JournalDiffRef;
44
+ /** Hide the git writes (stage / discard). Implied by `journalDiff`. */
45
+ readOnly?: boolean;
36
46
  }
37
47
 
38
48
  export function DiffPanel({
@@ -46,6 +56,8 @@ export function DiffPanel({
46
56
  className = '',
47
57
  tabKey = null,
48
58
  viewModeButtons = true,
59
+ journalDiff,
60
+ readOnly = false,
49
61
  }: DiffPanelProps) {
50
62
  // Read and persist view mode & whitespace preference in session_ui_state
51
63
  const [viewMode, setViewMode] = useSessionUiState<DiffViewMode>('diff.viewMode', 'unified');
@@ -75,6 +87,11 @@ export function DiffPanel({
75
87
  }, []);
76
88
  const editorFontFamily = useEditorFontStack();
77
89
 
90
+ // Both hooks run unconditionally (hooks cannot be conditional); the journal
91
+ // one is inert without a ref, and the git one is told not to read when the
92
+ // journal owns the panel.
93
+ const gitDiff = useFileDiff({ filePath, status, isStaged, repo, root, enabled: !journalDiff });
94
+ const journalDiffState = useJournalDiff(journalDiff);
78
95
  const {
79
96
  rawDiff,
80
97
  oldContent,
@@ -85,8 +102,9 @@ export function DiffPanel({
85
102
  errorMessage,
86
103
  fetchDiff,
87
104
  adoptState,
88
- } = useFileDiff({ filePath, status, isStaged, repo, root });
89
- const conflicted = isUnmergedCode(currentStatus);
105
+ } = journalDiff ? journalDiffState : gitDiff;
106
+ const conflicted = !journalDiff && isUnmergedCode(currentStatus);
107
+ const isReadOnly = readOnly || Boolean(journalDiff);
90
108
 
91
109
  const language = getLanguageFromPath(filePath);
92
110
  // A contributed renderer replaces the built-in views below, never the toolbar.
@@ -168,12 +186,13 @@ export function DiffPanel({
168
186
  isCopied={isCopied}
169
187
  isBusy={isBusy}
170
188
  viewModeButtons={viewModeButtons}
189
+ readOnly={isReadOnly}
171
190
  onSetViewMode={handleSetViewMode}
172
191
  onSetContentMode={handleSetContentMode}
173
192
  onToggleWordWrap={handleToggleWordWrap}
174
193
  onToggleWhitespace={handleToggleWhitespace}
175
- onStageUnstage={() => void gitActions.stageUnstage()}
176
- onDiscard={() => setShowDiscardConfirm(true)}
194
+ onStageUnstage={() => { if (!isReadOnly) void gitActions.stageUnstage(); }}
195
+ onDiscard={() => { if (!isReadOnly) setShowDiscardConfirm(true); }}
177
196
  onOpenInEditor={onOpenInEditor}
178
197
  onRefresh={() => void fetchDiff()}
179
198
  onCopyDiff={handleCopyDiff}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The diff toolbar's two git writes, as clusters.
8
+ *
9
+ * Split out of `Toolbar.tsx` when the journal diff added a `readOnly` mode: the
10
+ * file was already at the repo's line ceiling, and these are the only clusters
11
+ * that write to git. A journal diff shows the agent's own snapshots, which are
12
+ * not the worktree, so it renders neither.
13
+ */
14
+
15
+ import { Minus, Plus, Undo2 } from 'lucide-preact';
16
+ import type { ToolbarCluster } from '@/client/components/common/toolbar-row';
17
+
18
+ /** Shared class for the toolbar's icon buttons. */
19
+ export const ACTION_CLASS =
20
+ 'flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent disabled:hover:text-ink/50';
21
+
22
+ interface GitActionClustersArgs {
23
+ isStaged: boolean;
24
+ /** A write is in flight; the actions lock. */
25
+ locked: boolean;
26
+ /** A journal diff: no git writes at all. */
27
+ readOnly: boolean;
28
+ stageLabel: string;
29
+ onStageUnstage: () => void;
30
+ onDiscard: () => void;
31
+ }
32
+
33
+ /** Discard (unstaged only) and Stage/Unstage, in the toolbar's visual order. */
34
+ export function gitActionClusters({
35
+ isStaged,
36
+ locked,
37
+ readOnly,
38
+ stageLabel,
39
+ onStageUnstage,
40
+ onDiscard,
41
+ }: GitActionClustersArgs): ToolbarCluster[] {
42
+ if (readOnly) return [];
43
+ const clusters: ToolbarCluster[] = [];
44
+
45
+ if (!isStaged) {
46
+ clusters.push({
47
+ id: 'discard',
48
+ actions: [{ label: 'Discard changes in this file', icon: Undo2, onSelect: onDiscard, disabled: locked }],
49
+ children: (
50
+ <button
51
+ type="button"
52
+ onClick={onDiscard}
53
+ className={`${ACTION_CLASS} text-ink/50 hover:text-error hover:bg-error/10`}
54
+ title="Discard changes in this file"
55
+ aria-label="Discard changes in this file"
56
+ disabled={locked}
57
+ >
58
+ <Undo2 size={13} />
59
+ </button>
60
+ ),
61
+ });
62
+ }
63
+
64
+ clusters.push({
65
+ id: 'stage',
66
+ // The panel's primary write: a menu row must not be the only way to stage.
67
+ pinned: true,
68
+ actions: [{ label: stageLabel, icon: isStaged ? Minus : Plus, onSelect: onStageUnstage, disabled: locked }],
69
+ children: (
70
+ <button
71
+ type="button"
72
+ onClick={onStageUnstage}
73
+ className="px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink cursor-pointer disabled:cursor-default disabled:opacity-40 disabled:hover:bg-transparent"
74
+ title={stageLabel}
75
+ aria-label={stageLabel}
76
+ disabled={locked}
77
+ >
78
+ {isStaged ? (
79
+ <>
80
+ <Minus size={12} />
81
+ <span className="hidden @[360px]:inline">Unstage</span>
82
+ </>
83
+ ) : (
84
+ <>
85
+ <Plus size={12} />
86
+ <span className="hidden @[360px]:inline">Stage</span>
87
+ </>
88
+ )}
89
+ </button>
90
+ ),
91
+ });
92
+
93
+ return clusters;
94
+ }
@@ -98,6 +98,8 @@ export function EditorBody({
98
98
  isStaged={Boolean(activeFile.diffStaged)}
99
99
  root={activeFile.root}
100
100
  repo={activeFile.repo || '.'}
101
+ journalDiff={activeFile.journalDiff}
102
+ readOnly={activeFile.diffSource === 'journal'}
101
103
  onOpenInEditor={() => onConvertDiffToEditor(activeFile.id)}
102
104
  onFileSaved={onFileSaved}
103
105
  className="flex-1"