@kabmo-labs/kabmo 0.36.0 → 0.38.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 (292) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +547 -528
  3. package/dist/client/static/js/{CsvGrid-1h3bcak7.js → CsvGrid-90zfbn7f.js} +2 -2
  4. package/dist/client/static/js/{DocxView-ndca8jch.js → DocxView-vwq2rf16.js} +2 -2
  5. package/dist/client/static/js/{DrawioView-kpzd6y0b.js → DrawioView-bvx7eqcz.js} +2 -2
  6. package/dist/client/static/js/{ImageView-79prn3dg.js → ImageView-q6xfmbrq.js} +1 -1
  7. package/dist/client/static/js/{LayoutWrapper-v2wn2sb2.js → LayoutWrapper-qatdaw3n.js} +2 -2
  8. package/dist/client/static/js/{Modal-99j0zz3z.js → Modal-6jx1fvfb.js} +15 -15
  9. package/dist/client/static/js/{PdfView-2rjd87ay.js → PdfView-tkv2d2zs.js} +1 -1
  10. package/dist/client/static/js/{SessionsView-t7f3s71b.js → SessionsView-rbnecykz.js} +1 -1
  11. package/dist/client/static/js/{SheetView-ehb976st.js → SheetView-t08g8kdr.js} +4 -4
  12. package/dist/client/static/js/{SvgPreview-de2bbba6.js → SvgPreview-9vh6mdcp.js} +1 -1
  13. package/dist/client/static/js/{abnfDiagram-O67JEVCF-nx9jzn7m.js → abnfDiagram-O67JEVCF-bxcn33e1.js} +1 -1
  14. package/dist/client/static/js/architecture-7GRP2DOG-r8sz34h3.js +1 -0
  15. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-170v67rr.js → architectureDiagram-NJMV4G6O-40ggw6e8.js} +2 -2
  16. package/dist/client/static/js/{astro-80bs6hvg.js → astro-p3f5p9p2.js} +1 -1
  17. package/dist/client/static/js/{blockDiagram-BEXU5L5S-16q285n1.js → blockDiagram-BEXU5L5S-k41cvjrd.js} +6 -6
  18. package/dist/client/static/js/c-jkdstn33.js +1 -0
  19. package/dist/client/static/js/{c4Diagram-YGBWAQC7-rn3qt45h.js → c4Diagram-YGBWAQC7-rdcmn6ac.js} +2 -2
  20. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-r26wg74e.js → classDiagram-v2-NBCMYWYE-txbmbkxv.js} +5 -5
  21. package/dist/client/static/js/{cose-bilkent-JH36ORCC-82kwe7ha.js → cose-bilkent-JH36ORCC-bxzh3qj1.js} +1 -1
  22. package/dist/client/static/js/cpp-9d3xdpe3.js +1 -0
  23. package/dist/client/static/js/css-r3wja1ze.js +1 -0
  24. package/dist/client/static/js/css-sebxkh5f.js +1 -0
  25. package/dist/client/static/js/cynefin-OW5HDTMX-w2f2vev7.js +1 -0
  26. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-tcxdn6pa.js → cynefinDiagram-VND7K2PF-abx5343b.js} +1 -1
  27. package/dist/client/static/js/{dagre-6A5THRUB-g833ata3.js → dagre-6A5THRUB-baj278kt.js} +2 -2
  28. package/dist/client/static/js/{diagram-22UHCM2B-f1fq8xec.js → diagram-22UHCM2B-vqvhdc5m.js} +7 -7
  29. package/dist/client/static/js/{diagram-3UASUU5V-6j2w016f.js → diagram-3UASUU5V-w328rfx0.js} +2 -2
  30. package/dist/client/static/js/{diagram-ATOU4E4O-6t2qxsk4.js → diagram-ATOU4E4O-zzcmwnm8.js} +2 -2
  31. package/dist/client/static/js/{diagram-CDSNMT55-7abar8s7.js → diagram-CDSNMT55-8yw39mmj.js} +1 -1
  32. package/dist/client/static/js/{diagram-MLGK6HIB-s68rgy16.js → diagram-MLGK6HIB-zgc386pv.js} +1 -1
  33. package/dist/client/static/js/{diagram-MPIPVDR6-azgkm6w8.js → diagram-MPIPVDR6-efmvvscm.js} +1 -1
  34. package/dist/client/static/js/{dockerfile-47e33kqa.js → dockerfile-bp5dre33.js} +1 -1
  35. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-esrjz750.js → ebnfDiagram-ZINNZB2B-p66h0dzq.js} +1 -1
  36. package/dist/client/static/js/{elixir-rpa1g4gy.js → elixir-jwphgp8j.js} +1 -1
  37. package/dist/client/static/js/{elk-276RUBZZ-fhr4b4jj.js → elk-276RUBZZ-g0jjxcqd.js} +1 -1
  38. package/dist/client/static/js/{erDiagram-OPXOYQCR-5r3fmdnz.js → erDiagram-OPXOYQCR-39gat96z.js} +4 -4
  39. package/dist/client/static/js/{erlang-bh5cbm8m.js → erlang-6m6tpt72.js} +1 -1
  40. package/dist/client/static/js/eventmodeling-NTZA5JFV-k5n61zzh.js +1 -0
  41. package/dist/client/static/js/flowDiagram-KWPJA3E3-f6jpcqyq.js +1 -0
  42. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-j4pf6rdn.js → ganttDiagram-FUAMR5RP-nsjv1zt4.js} +2 -2
  43. package/dist/client/static/js/gitGraph-4MIJSDKK-2gf053bx.js +1 -0
  44. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-x5epk0gr.js → gitGraphDiagram-X574FWY7-r4vnkcy3.js} +2 -2
  45. package/dist/client/static/js/graphql-p4cskvad.js +1 -0
  46. package/dist/client/static/js/html-f26r6vv5.js +1 -0
  47. package/dist/client/static/js/{index-c1j0xb0w.js → index-0kxqzafy.js} +1 -1
  48. package/dist/client/static/js/{index-3kgrcaq1.js → index-11bdd235.js} +1 -1
  49. package/dist/client/static/js/{index-b48p8d1j.js → index-1qszrvzk.js} +2 -2
  50. package/dist/client/static/js/{index-3vdmwpbh.js → index-24yyj78e.js} +2 -2
  51. package/dist/client/static/js/{index-63c6t75t.js → index-2drjp9ks.js} +1 -1
  52. package/dist/client/static/js/{index-d2km9egp.js → index-2ndq1ngv.js} +4 -4
  53. package/dist/client/static/js/{index-0j518hqm.js → index-3az1w5f8.js} +2 -2
  54. package/dist/client/static/js/{index-ye450a7z.js → index-50z4ek83.js} +1 -1
  55. package/dist/client/static/js/{index-60ceydzn.js → index-5ebhb94w.js} +1 -1
  56. package/dist/client/static/js/{index-ctgefatv.js → index-5y0bvq4q.js} +34 -34
  57. package/dist/client/static/js/{index-40ve7zzv.js → index-6ax2z70w.js} +1 -1
  58. package/dist/client/static/js/{index-9t82sx0w.js → index-6k3e5dph.js} +2 -2
  59. package/dist/client/static/js/{index-6xzfta4b.js → index-73jwm4d5.js} +1 -1
  60. package/dist/client/static/js/{index-8cy3x2y8.js → index-7fdp9c7m.js} +2 -2
  61. package/dist/client/static/js/{index-zvfvqvn9.js → index-9wd9y6m0.js} +2 -2
  62. package/dist/client/static/js/{index-q5t4sy22.js → index-9wtg6ywn.js} +4 -4
  63. package/dist/client/static/js/{index-nws03exw.js → index-a74k07z2.js} +2 -2
  64. package/dist/client/static/js/{index-982jyfsb.js → index-ashpbfqv.js} +2 -2
  65. package/dist/client/static/js/{index-zp73zexp.js → index-b9b2nwdd.js} +2 -2
  66. package/dist/client/static/js/{index-h1e1abpt.js → index-c15r8jd3.js} +2 -2
  67. package/dist/client/static/js/{index-5rzk1226.js → index-da10qpns.js} +2 -2
  68. package/dist/client/static/js/{index-ky0prc71.js → index-dfgdn3fj.js} +9 -9
  69. package/dist/client/static/js/{index-c09a5s1n.js → index-dkseg29t.js} +9 -9
  70. package/dist/client/static/js/{index-w3n97x4b.js → index-dt7e1328.js} +2 -2
  71. package/dist/client/static/js/{index-sar2ggde.js → index-e1pr3k50.js} +2 -2
  72. package/dist/client/static/js/{index-0b1kwsam.js → index-fghst0kd.js} +32 -32
  73. package/dist/client/static/js/{index-af24nes6.js → index-gbfg0anm.js} +2 -2
  74. package/dist/client/static/js/{index-vtbbfwx0.js → index-gr6jng0x.js} +2 -2
  75. package/dist/client/static/js/{index-44qrckd2.js → index-gwhx66f4.js} +1 -1
  76. package/dist/client/static/js/{index-55pqvh82.js → index-h7pn9qw6.js} +2 -2
  77. package/dist/client/static/js/{index-97t3mv1v.js → index-h8h5c2r8.js} +1 -1
  78. package/dist/client/static/js/{index-v5t761a1.js → index-ha75kff0.js} +2 -2
  79. package/dist/client/static/js/{index-ydvfc9td.js → index-hzx81cjq.js} +4 -4
  80. package/dist/client/static/js/{index-be6gevq8.js → index-k9xsvab3.js} +1 -1
  81. package/dist/client/static/js/{index-v8qd8ypc.js → index-nd4p98mc.js} +2 -2
  82. package/dist/client/static/js/{index-dmgawfhw.js → index-qkscve6n.js} +2 -2
  83. package/dist/client/static/js/{index-w7xbfv44.js → index-qn4pkjfh.js} +2 -2
  84. package/dist/client/static/js/{index-zdtsvnpq.js → index-r83kr4s5.js} +2 -2
  85. package/dist/client/static/js/{index-htt8qxm3.js → index-ra38ggke.js} +1 -1
  86. package/dist/client/static/js/{index-skm6k5w2.js → index-rf0p3v7q.js} +5 -5
  87. package/dist/client/static/js/{index-7r1hw2gd.js → index-rgp69pa8.js} +1 -1
  88. package/dist/client/static/js/{index-8e15fzax.js → index-rqrcw8nj.js} +2 -2
  89. package/dist/client/static/js/{index-63jbb4kf.js → index-sa9cp6km.js} +2 -2
  90. package/dist/client/static/js/{index-75haaj8g.js → index-st202rjv.js} +184 -184
  91. package/dist/client/static/js/{index-mm1rf116.js → index-t5t71dhp.js} +2 -2
  92. package/dist/client/static/js/{index-ktvbsj6w.js → index-tfsaj5d1.js} +2 -2
  93. package/dist/client/static/js/{index-k1xt92h4.js → index-tv61v3t3.js} +1 -1
  94. package/dist/client/static/js/index-tzm90bsz.js +1 -0
  95. package/dist/client/static/js/{index-z6g74h7g.js → index-vb6t44dw.js} +2 -2
  96. package/dist/client/static/js/{index-pyx8n25s.js → index-vnn7m9yp.js} +3 -3
  97. package/dist/client/static/js/{index-5kjpacvd.js → index-vxd4gykh.js} +2 -2
  98. package/dist/client/static/js/{index-r8pckaqe.js → index-xya34x4v.js} +2 -2
  99. package/dist/client/static/js/{index-a293pdg7.js → index-y3hdv561.js} +2 -2
  100. package/dist/client/static/js/{index-9gf8b73w.js → index-z0cpp5bc.js} +2 -2
  101. package/dist/client/static/js/info-A6RAGUB7-3tr0y3s6.js +1 -0
  102. package/dist/client/static/js/{infoDiagram-VRGFBTTK-ktc8nb8g.js → infoDiagram-VRGFBTTK-e39pvm4j.js} +1 -1
  103. package/dist/client/static/js/ini-cg0a5wm3.js +1 -0
  104. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-n3dk6227.js → ishikawaDiagram-OU5B5YK6-rqhszgvp.js} +2 -2
  105. package/dist/client/static/js/java-vcck089n.js +1 -0
  106. package/dist/client/static/js/javascript-nyf39d5r.js +1 -0
  107. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-f0p1h8qn.js → journeyDiagram-ZHPQQLJL-wgy5qrsv.js} +3 -3
  108. package/dist/client/static/js/jsx-ht9zyzwa.js +1 -0
  109. package/dist/client/static/js/{julia-73zjh2w6.js → julia-237yk557.js} +1 -1
  110. package/dist/client/static/js/{kanban-definition-PNTS6WVX-7jdt7dv1.js → kanban-definition-PNTS6WVX-b8bxn0h1.js} +3 -3
  111. package/dist/client/static/js/lua-86fjqj8v.js +1 -0
  112. package/dist/client/static/js/markdown-gwmsh53r.js +1 -0
  113. package/dist/client/static/js/{mermaid.core-e8rzrjt9.js → mermaid.core-vb5ehtre.js} +6 -6
  114. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-7shv6ge0.js → mindmap-definition-NLK3R4M7-t4p38s38.js} +3 -3
  115. package/dist/client/static/js/one-dark-pro-dhybn1ff.js +1 -0
  116. package/dist/client/static/js/one-light-bqg77ay0.js +1 -0
  117. package/dist/client/static/js/packet-AYTQ26CC-xbsyjzrh.js +1 -0
  118. package/dist/client/static/js/{pegDiagram-GJSIUBJH-17ak2zx3.js → pegDiagram-GJSIUBJH-3gp4madx.js} +1 -1
  119. package/dist/client/static/js/{perl-8z46dmze.js → perl-dvz4y1tb.js} +1 -1
  120. package/dist/client/static/js/{php-6qvnp2t6.js → php-n6y7dzhm.js} +1 -1
  121. package/dist/client/static/js/pie-WAS4IAKB-j2tpz0cs.js +1 -0
  122. package/dist/client/static/js/{pieDiagram-5QR66LMP-at4x1g4q.js → pieDiagram-5QR66LMP-0cbm773h.js} +2 -2
  123. package/dist/client/static/js/properties-mzvvbqg5.js +1 -0
  124. package/dist/client/static/js/python-3w64wsyd.js +1 -0
  125. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-apzhwrn4.js → quadrantDiagram-O4NWA36T-jwg7fc9f.js} +1 -1
  126. package/dist/client/static/js/r-32re2zwb.js +1 -0
  127. package/dist/client/static/js/radar-RG4KPBEZ-m3tsyfv0.js +1 -0
  128. package/dist/client/static/js/railroad-74A4TZTK-5p202a4q.js +1 -0
  129. package/dist/client/static/js/railroad-abnf-HS5TGJTU-hj0y9tgn.js +1 -0
  130. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-8c5dct8f.js +1 -0
  131. package/dist/client/static/js/railroad-peg-WCYAUIDC-3tx8z65q.js +1 -0
  132. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-rw8cj5f3.js → railroadDiagram-XR7U4H2S-38xh691s.js} +1 -1
  133. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-qyrse7mb.js → requirementDiagram-PLB6GJNP-gpddawxh.js} +4 -4
  134. package/dist/client/static/js/{ruby-qy8mhstq.js → ruby-7zye3g0e.js} +1 -1
  135. package/dist/client/static/js/{rust-fpshqnk0.js → rust-bx3ecv4n.js} +1 -1
  136. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-254qr59q.js → sankeyDiagram-IPEJSGJF-s6t6bbhk.js} +1 -1
  137. package/dist/client/static/js/{sass-kbwea482.js → sass-m0h9yzfb.js} +1 -1
  138. package/dist/client/static/js/{scss-zphrqp25.js → scss-2pwwfkvn.js} +1 -1
  139. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-y9xjxfc5.js → sequenceDiagram-PO4LG4MO-wkq51pmb.js} +3 -3
  140. package/dist/client/static/js/{sizeCapture-INFHLROL-sc5e60t3.js → sizeCapture-INFHLROL-xtwexf8k.js} +1 -1
  141. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-r134s4xr.js → stateDiagram-v2-GCMORJYK-jnwsqa7y.js} +3 -3
  142. package/dist/client/static/js/{svelte-mwtx07d9.js → svelte-x8f8c8hq.js} +1 -1
  143. package/dist/client/static/js/{swimlanes-2SLR337P-xc7rbawt.js → swimlanes-2SLR337P-mnkkqcbx.js} +1 -1
  144. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-6xmrz03n.js +8 -0
  145. package/dist/client/static/js/{timeline-definition-EJHVYXUP-cgjd8shk.js → timeline-definition-EJHVYXUP-rxq6heqh.js} +2 -2
  146. package/dist/client/static/js/treeView-Q6P3EWNA-mf0rb2yv.js +1 -0
  147. package/dist/client/static/js/treemap-WGGIJYW6-0x5gf06b.js +1 -0
  148. package/dist/client/static/js/typescript-5nmrzgkj.js +1 -0
  149. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-9qsmjhm6.js → usecaseDiagram-POWQR4AR-dz94f57t.js} +13 -13
  150. package/dist/client/static/js/{vennDiagram-UO4OBE2U-4grw9awx.js → vennDiagram-UO4OBE2U-5mmvkhsq.js} +1 -1
  151. package/dist/client/static/js/{vue-j8vb9d7r.js → vue-myjjd0gd.js} +1 -1
  152. package/dist/client/static/js/wardley-WFR3VGLG-x7ej8dms.js +1 -0
  153. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-8gxy0wat.js → wardleyDiagram-VNRHLVJA-dctdntpa.js} +1 -1
  154. package/dist/client/static/js/xml-3dd1pter.js +1 -0
  155. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-5sh7tdrx.js → xychartDiagram-PMCCYNJV-njyfrqkv.js} +2 -2
  156. package/dist/client/static/js/yaml-yssayv8a.js +1 -0
  157. package/package.json +1 -1
  158. package/src/client/components/common/ComposerPicker.tsx +24 -12
  159. package/src/client/components/common/ComposerTextarea.tsx +1 -0
  160. package/src/client/components/layout/session-sidebar/scheduler-modal/ModelFields.tsx +1 -1
  161. package/src/client/components/settings/apply-side-effects.test.ts +5 -4
  162. package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +1 -1
  163. package/src/client/components/workspace/chat-timeline/index.tsx +3 -3
  164. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormAsk.test.tsx +210 -0
  165. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FormAsk.tsx +342 -0
  166. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/LooseFieldAsk.tsx +44 -0
  167. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.test.tsx +44 -1
  168. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +10 -5
  169. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/PluginPendingInteractions.test.ts +1 -0
  170. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/drafts.ts +19 -0
  171. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/form-picks.ts +52 -0
  172. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.test.ts +2 -2
  173. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +53 -4
  174. package/src/client/components/workspace/model-dropdown/index.tsx +1 -1
  175. package/src/client/components/workspace/model-dropdown/use-catalog.ts +3 -32
  176. package/src/client/data/settings/omp-schema.json +55 -1
  177. package/src/client/hooks/chat/composer/harness-model-picker.ts +84 -0
  178. package/src/client/hooks/chat/composer/index.ts +26 -6
  179. package/src/client/hooks/chat/timeline/ask-frames.test.ts +80 -7
  180. package/src/client/hooks/chat/timeline/ask-frames.ts +95 -21
  181. package/src/client/hooks/models/use-harnesses.ts +15 -2
  182. package/src/client/hooks/ui/icon-style.ts +7 -4
  183. package/src/client/hooks/ui/style-attributes.test.ts +11 -11
  184. package/src/client/hooks/ui/surface-style.ts +8 -5
  185. package/src/server/lib/assets/shell-attributes.server.ts +12 -9
  186. package/src/server/lib/assets/shell-attributes.test.ts +18 -13
  187. package/src/server/lib/auth/agent-gate.server.ts +64 -0
  188. package/src/server/lib/auth/agent-tree-gate.test.ts +121 -0
  189. package/src/server/lib/auth/guard.test.ts +18 -18
  190. package/src/server/lib/auth/guard.ts +15 -11
  191. package/src/server/lib/auth/handover-guard.test.ts +1 -1
  192. package/src/server/lib/changes/attach.server.ts +57 -0
  193. package/src/server/lib/changes/attach.test.ts +94 -0
  194. package/src/server/lib/changes/blobs.server.ts +52 -0
  195. package/src/server/lib/changes/capture-bash.server.ts +106 -0
  196. package/src/server/lib/changes/capture-fs.server.ts +64 -0
  197. package/src/server/lib/changes/capture-runs.test.ts +136 -0
  198. package/src/server/lib/changes/capture-test-util.ts +46 -0
  199. package/src/server/lib/changes/capture-types.ts +62 -0
  200. package/src/server/lib/changes/capture.server.ts +333 -0
  201. package/src/server/lib/changes/capture.test.ts +245 -0
  202. package/src/server/lib/changes/classify-command.test.ts +172 -0
  203. package/src/server/lib/changes/classify-command.ts +272 -0
  204. package/src/server/lib/changes/classify-git.ts +88 -0
  205. package/src/server/lib/changes/classify-paths.ts +112 -0
  206. package/src/server/lib/changes/classify-tokenize.ts +185 -0
  207. package/src/server/lib/changes/journal.server.ts +183 -0
  208. package/src/server/lib/changes/journal.test.ts +125 -0
  209. package/src/server/lib/changes/merge.test.ts +137 -0
  210. package/src/server/lib/changes/paths.server.ts +37 -0
  211. package/src/server/lib/changes/purge.server.ts +32 -0
  212. package/src/server/lib/changes/reader.server.ts +322 -0
  213. package/src/server/lib/changes/reader.test.ts +137 -0
  214. package/src/server/lib/changes/records.ts +120 -0
  215. package/src/server/lib/changes/scan.server.ts +89 -0
  216. package/src/server/lib/harness/register.server.ts +3 -0
  217. package/src/server/lib/omp/rpc/event-fanout.test.ts +58 -0
  218. package/src/server/lib/omp/rpc/event-fanout.ts +19 -0
  219. package/src/server/lib/omp/rpc/manager.ts +4 -3
  220. package/src/server/lib/omp/rpc/session-registration.ts +5 -0
  221. package/src/server/lib/omp/rpc/session-registry.ts +4 -5
  222. package/src/server/lib/omp/session/delete.server.ts +4 -0
  223. package/src/server/lib/sessions/agent-token.server.test.ts +28 -5
  224. package/src/server/lib/sessions/agent-token.server.ts +42 -6
  225. package/src/server/lib/sessions/relation-access.server.test.ts +96 -0
  226. package/src/server/lib/sessions/relation-access.server.ts +71 -0
  227. package/src/server/routes/sessions/changes.ts +1 -1
  228. package/src/shared/lib/chat/ask-form/fields.ts +1 -0
  229. package/src/shared/lib/chat/ask-form/types.ts +6 -0
  230. package/src/shared/lib/chat/ask-questions.ts +56 -3
  231. package/src/shared/lib/chat/composer/delegation.ts +2 -13
  232. package/src/shared/lib/chat/composer/filter.test.ts +39 -0
  233. package/src/shared/lib/chat/composer/filter.ts +23 -13
  234. package/src/shared/lib/chat/composer/harness-model-items.test.ts +54 -0
  235. package/src/shared/lib/chat/composer/harness-model-items.ts +41 -0
  236. package/src/shared/lib/chat/composer/trigger.test.ts +50 -0
  237. package/src/shared/lib/chat/composer/trigger.ts +29 -1
  238. package/src/shared/lib/chat/timeline/changed-files.test.ts +16 -0
  239. package/src/shared/lib/chat/timeline/changed-files.ts +102 -25
  240. package/src/shared/lib/harness/catalog.ts +21 -0
  241. package/src/{client/components/workspace/model-dropdown/harness-models.test.ts → shared/lib/harness/models.test.ts} +1 -1
  242. package/src/shared/lib/icons/icon-paint-authority.ts +5 -3
  243. package/src/shared/lib/models/option.ts +46 -0
  244. package/src/shared/lib/omp/config/schema.test.ts +20 -0
  245. package/src/shared/lib/theme/icon-style.test.ts +8 -5
  246. package/src/shared/lib/theme/icon-style.ts +15 -7
  247. package/src/shared/lib/theme/surface-style.test.ts +8 -5
  248. package/src/shared/lib/theme/surface-style.ts +17 -7
  249. package/src/shared/lib/workspace/sidebar-style.test.ts +7 -8
  250. package/src/shared/lib/workspace/sidebar-style.ts +7 -8
  251. package/src/shared/types/chat.ts +12 -6
  252. package/src/shared/types/omp/agent.ts +9 -0
  253. package/src/shared/types/session-changes.ts +4 -0
  254. package/dist/client/static/js/architecture-7GRP2DOG-aqft2erp.js +0 -1
  255. package/dist/client/static/js/c-wkgxb1t1.js +0 -1
  256. package/dist/client/static/js/cpp-y0t6mynx.js +0 -1
  257. package/dist/client/static/js/css-r2nhvzff.js +0 -1
  258. package/dist/client/static/js/css-tf1s0nb7.js +0 -1
  259. package/dist/client/static/js/cynefin-OW5HDTMX-v2sz60t6.js +0 -1
  260. package/dist/client/static/js/eventmodeling-NTZA5JFV-8qbefe4m.js +0 -1
  261. package/dist/client/static/js/flowDiagram-KWPJA3E3-krsvgcq7.js +0 -1
  262. package/dist/client/static/js/gitGraph-4MIJSDKK-9bx1a38k.js +0 -1
  263. package/dist/client/static/js/graphql-xnpp5gn9.js +0 -1
  264. package/dist/client/static/js/html-pv88ny12.js +0 -1
  265. package/dist/client/static/js/index-dh1vd0d9.js +0 -1
  266. package/dist/client/static/js/info-A6RAGUB7-j51t7jhh.js +0 -1
  267. package/dist/client/static/js/ini-ygfyhprj.js +0 -1
  268. package/dist/client/static/js/java-gm49vw59.js +0 -1
  269. package/dist/client/static/js/javascript-4kw2j9t3.js +0 -1
  270. package/dist/client/static/js/jsx-ksxw1byz.js +0 -1
  271. package/dist/client/static/js/lua-53gzb9bx.js +0 -1
  272. package/dist/client/static/js/markdown-tk3cd3vs.js +0 -1
  273. package/dist/client/static/js/one-dark-pro-39bt34v9.js +0 -1
  274. package/dist/client/static/js/one-light-xec0sehr.js +0 -1
  275. package/dist/client/static/js/packet-AYTQ26CC-n83gfj2g.js +0 -1
  276. package/dist/client/static/js/pie-WAS4IAKB-5c5pctwz.js +0 -1
  277. package/dist/client/static/js/properties-2tcybqjk.js +0 -1
  278. package/dist/client/static/js/python-qph3dntq.js +0 -1
  279. package/dist/client/static/js/r-gd26x93y.js +0 -1
  280. package/dist/client/static/js/radar-RG4KPBEZ-52e5n99a.js +0 -1
  281. package/dist/client/static/js/railroad-74A4TZTK-44nqxxpy.js +0 -1
  282. package/dist/client/static/js/railroad-abnf-HS5TGJTU-25jxgwg7.js +0 -1
  283. package/dist/client/static/js/railroad-ebnf-LZEXJU2U-64pqpf2y.js +0 -1
  284. package/dist/client/static/js/railroad-peg-WCYAUIDC-0p5sxzpx.js +0 -1
  285. package/dist/client/static/js/swimlanesDiagram-TC7HE7FX-kdcdamkj.js +0 -8
  286. package/dist/client/static/js/treeView-Q6P3EWNA-8j14nnd1.js +0 -1
  287. package/dist/client/static/js/treemap-WGGIJYW6-esf993kk.js +0 -1
  288. package/dist/client/static/js/typescript-0s2t05jj.js +0 -1
  289. package/dist/client/static/js/wardley-WFR3VGLG-v4dxm2sb.js +0 -1
  290. package/dist/client/static/js/xml-0py2vkw7.js +0 -1
  291. package/dist/client/static/js/yaml-vghdz0f0.js +0 -1
  292. /package/src/{client/components/workspace/model-dropdown/harness-models.ts → shared/lib/harness/models.ts} +0 -0
@@ -23,11 +23,15 @@
23
23
  * answers"), leaving the run parked.
24
24
  *
25
25
  * The claim walks two keys, because omp gives the frame less than the tool call
26
- * does: the question IDS when both carry them, and the question TEXT (what
27
- * omp's own per-question loop matches on). A frame that matches neither is an
28
- * orphan, not a modal — and deliberately not "the only open ask", which would
29
- * steal a ratchet approval or an extension's own `askDialog` into a tool card
30
- * that did not raise it.
26
+ * does: the question TEXT (what omp's own per-question loop matches on, with a
27
+ * context prefix and a decorated suffix both accepted) and the offered ROWS.
28
+ * A frame that names a question of an ask we know but no OPEN card owns is an
29
+ * inline orphan, never a modal. A field frame that matches neither key is still
30
+ * owned by the only open ask when its title shares a content word with one of
31
+ * that ask's questions — omp's ask tool is exclusive, so nothing else can be
32
+ * asking, and this is what keeps a parser-drift question on the timeline.
33
+ * Everything that matches nothing ask-shaped (a ratchet approval, an extension
34
+ * picker) keeps the modal.
31
35
  *
32
36
  * The modal is also held until the session's own history has loaded. Ownership
33
37
  * is decided against the ask tool calls in `messages`, and on session open the
@@ -42,7 +46,7 @@
42
46
  import { createContext, useContext } from 'preact/compat';
43
47
  import type { ChatMessageData } from '@/shared/types';
44
48
  import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
45
- import { askQuestionForOptions, askQuestionForTitle, groupAskFrames, isAskSettled, isAskToolCall, normalizeAskText, parseAskQuestions } from '@/shared/lib/chat/ask-questions';
49
+ import { askQuestionForFrame, askQuestionForOptions, askQuestionForTitle, askQuestionSharesText, groupAskFrames, isAskSettled, isAskToolCall, normalizeAskText, parseAskQuestions } from '@/shared/lib/chat/ask-questions';
46
50
  import { parseAskResult } from '@/shared/lib/chat/ask-results';
47
51
  import type { AskQuestion } from '@/shared/lib/chat/ask-form/types';
48
52
  import { isApprovalGateFrame } from '@/shared/lib/chat/omp/approval-gate';
@@ -51,6 +55,13 @@ import type { ExtensionDialogResponse } from '@/client/components/workspace/chat
51
55
  export interface AskFramesSplit {
52
56
  /** The ask's dialogs, bucketed per question, keyed by ask tool-call id. */
53
57
  framesByTool: Map<string, ExtensionUiDialogRequest[][]>;
58
+ /**
59
+ * Field dialogs that belong to an open ask but matched no question, keyed by
60
+ * tool id. A form parser can drift from omp's on a shape neither was written
61
+ * for; the frame must still be answerable on the card, and the modal has no
62
+ * field body. The card draws these last, as the live control.
63
+ */
64
+ looseByTool: Map<string, ExtensionUiDialogRequest[]>;
54
65
  /** Ask dialogs no card can own — the timeline draws them inline. */
55
66
  orphanAsks: ExtensionUiDialogRequest[];
56
67
  /** Oldest non-ask request nothing claimed — the one the modal renders. */
@@ -59,13 +70,15 @@ export interface AskFramesSplit {
59
70
 
60
71
  export interface AskFramesHandle {
61
72
  framesByTool: AskFramesSplit['framesByTool'];
73
+ /** Ask field dialogs a card owns but no question matched (see `looseByTool`). */
74
+ looseByTool: AskFramesSplit['looseByTool'];
62
75
  /** Ask dialogs with no tool card to render them (see `orphanAsks`). */
63
76
  orphanAsks: AskFramesSplit['orphanAsks'];
64
77
  /** Answer one ask dialog and drop it from the pending queue. */
65
78
  respond: (request: ExtensionUiDialogRequest, response: ExtensionDialogResponse) => void;
66
79
  }
67
80
 
68
- const EMPTY: AskFramesHandle = { framesByTool: new Map(), orphanAsks: [], respond: () => {} };
81
+ const EMPTY: AskFramesHandle = { framesByTool: new Map(), looseByTool: new Map(), orphanAsks: [], respond: () => {} };
69
82
 
70
83
  export const AskFramesContext = createContext<AskFramesHandle>(EMPTY);
71
84
 
@@ -82,7 +95,8 @@ export function splitAskFrames(
82
95
  historyLoaded: boolean,
83
96
  ): AskFramesSplit {
84
97
  const framesByTool = new Map<string, ExtensionUiDialogRequest[][]>();
85
- if (pending.length === 0) return { framesByTool, orphanAsks: [], modalRequest: null };
98
+ const looseByTool = new Map<string, ExtensionUiDialogRequest[]>();
99
+ if (pending.length === 0) return { framesByTool, looseByTool, orphanAsks: [], modalRequest: null };
86
100
 
87
101
  // Match against the asks that can still own a dialog: a reloaded session
88
102
  // reads its tool calls back from the JSONL, where a call still parked on a
@@ -97,21 +111,29 @@ export function splitAskFrames(
97
111
  // therefore not a candidate at all. A parked call read back from the JSONL is
98
112
  // neither: omp writes no result until the question is answered.
99
113
  const openAsks: { toolId: string; questions: AskQuestion[] }[] = [];
114
+ // Every ask, settled ones included: a dialog whose call just failed is still
115
+ // the ask's dialog, so it belongs on the timeline (an inline orphan), never
116
+ // in the modal. Keeping them apart from `openAsks` is what lets ownership
117
+ // prefer the live call while recognition still avoids the modal.
118
+ const allAsks: { toolId: string; questions: AskQuestion[] }[] = [];
100
119
  for (const message of messages) {
101
120
  for (const tool of message.toolCalls ?? []) {
102
121
  if (!isAskToolCall(tool)) continue;
103
- if (isAskSettled(tool)) continue;
104
122
  const questions = parseAskQuestions(tool);
105
123
  if (questions.length === 0) continue;
124
+ allAsks.push({ toolId: tool.id, questions });
125
+ if (isAskSettled(tool)) continue;
106
126
  if (parseAskResult(tool, questions).every((answer) => answer !== null)) continue;
107
127
  openAsks.push({ toolId: tool.id, questions });
108
128
  }
109
129
  }
110
130
 
111
131
  const owned = new Map<string, ExtensionUiDialogRequest[]>();
112
- const claimed = new Set<ExtensionUiDialogRequest>();
132
+ const handled = new Set<ExtensionUiDialogRequest>();
113
133
  /** Frames claimed by their option rows, with the question index they name. */
114
134
  const optionPlacements = new Map<ExtensionUiDialogRequest, number>();
135
+ /** Owned frames whose title and rows both missed — drawn as the live control. */
136
+ const unplaced = new Map<string, ExtensionUiDialogRequest[]>();
115
137
  const orphanAsks: ExtensionUiDialogRequest[] = [];
116
138
  let lastOwner: string | null = null;
117
139
 
@@ -150,7 +172,7 @@ export function splitAskFrames(
150
172
  );
151
173
  }
152
174
  if (groupedOwner) {
153
- claimed.add(request);
175
+ handled.add(request);
154
176
  lastOwner = groupedOwner.toolId;
155
177
  owned.set(groupedOwner.toolId, [...(owned.get(groupedOwner.toolId) ?? []), request]);
156
178
  }
@@ -165,11 +187,15 @@ export function splitAskFrames(
165
187
  // lands, so drawing it now would paint the question at the tail of the
166
188
  // timeline and then move it onto its card. The frame stays queued, so
167
189
  // nothing is lost — the split simply re-runs.
168
- if (!groupedOwner && historyLoaded) orphanAsks.push(request);
190
+ if (!groupedOwner && historyLoaded) {
191
+ orphanAsks.push(request);
192
+ handled.add(request);
193
+ }
169
194
  continue;
170
195
  }
171
196
 
172
197
  let owner: string | null = null;
198
+ let titleMatched = false;
173
199
  if (typeof request.title === 'string' && request.title) {
174
200
  // Newest first: omp asks one question at a time and blocks on it, so when
175
201
  // two live calls name the same question the later one is the one in
@@ -178,6 +204,7 @@ export function splitAskFrames(
178
204
  const candidate = openAsks[index];
179
205
  if (askQuestionForTitle(candidate.questions, request.title) !== -1) {
180
206
  owner = candidate.toolId;
207
+ titleMatched = true;
181
208
  break;
182
209
  }
183
210
  }
@@ -197,25 +224,64 @@ export function splitAskFrames(
197
224
  // are the question's rows: the two parsers can disagree on a form shape
198
225
  // neither was written for, and the title is the only key that drifts. The
199
226
  // option list is the same list either way, so it is the fallback key — and
200
- // an exact set match of two or more labels cannot steal an extension
201
- // picker or a gate.
227
+ // an exact set match cannot steal an extension picker or a gate.
202
228
  if (!owner && request.method === 'select' && !isApprovalGateFrame(request)) {
203
229
  for (let index = openAsks.length - 1; index >= 0; index -= 1) {
204
230
  const candidate = openAsks[index];
205
231
  const matched = askQuestionForOptions(candidate.questions, request.options);
206
232
  if (matched === -1) continue;
207
233
  owner = candidate.toolId;
208
- // The title walk already placed it in `groupAskFrames`; a frame claimed
209
- // by its rows has no title to place by, so its row is recorded here.
234
+ // The title walk already places a title match in `groupAskFrames`; a
235
+ // frame claimed by its rows has no title to place by, so its row is
236
+ // recorded here.
210
237
  optionPlacements.set(request, matched);
211
238
  break;
212
239
  }
213
240
  }
214
- if (!owner && request.method !== 'confirm' && !isApprovalGateFrame(request)) owner = lastOwner;
241
+ if (!owner && request.method !== 'confirm' && !isApprovalGateFrame(request)) {
242
+ // The frame names a question of an ask this client knows, but that ask is
243
+ // not a live owner (it failed, was aborted, or already has every answer).
244
+ // It is still an ask dialog: show it inline and leave the modal to
245
+ // extension pickers, which have no card.
246
+ const knownAsk = [...allAsks].reverse().some(
247
+ (candidate) => askQuestionForFrame(candidate.questions, request) !== -1,
248
+ );
249
+ if (knownAsk) {
250
+ if (historyLoaded) {
251
+ orphanAsks.push(request);
252
+ handled.add(request);
253
+ }
254
+ continue;
255
+ }
256
+ // A continuation of the ask that spoke last (the free-text dialog opened
257
+ // by an "Other" row) can arrive with a decorated title that names nothing.
258
+ // An approval gate is never part of an ask, so it keeps its own modal.
259
+ if (lastOwner && openAsks.some((candidate) => candidate.toolId === lastOwner)) {
260
+ owner = lastOwner;
261
+ } else if (
262
+ openAsks.length === 1 &&
263
+ request.secret !== true &&
264
+ (request.method === 'select' || request.method === 'input' || request.method === 'editor') &&
265
+ askQuestionSharesText(openAsks[0].questions, request.title)
266
+ ) {
267
+ // The ask tool is EXCLUSIVE: while it blocks on a field, no extension
268
+ // tool can raise a dialog of its own. A single open ask therefore owns
269
+ // an unclaimed field dialog whose title still shares a content word
270
+ // with one of its questions — this is the guarantee that a question
271
+ // whose derived text drifted can never open as a modal. A dialog with
272
+ // no shared word is someone else's (an extension picker) and keeps the
273
+ // modal.
274
+ owner = openAsks[0].toolId;
275
+ }
276
+ if (!owner) continue;
277
+ }
215
278
  if (!owner) continue;
216
- claimed.add(request);
279
+ handled.add(request);
217
280
  lastOwner = owner;
218
281
  owned.set(owner, [...(owned.get(owner) ?? []), request]);
282
+ if (!titleMatched && !optionPlacements.has(request)) {
283
+ unplaced.set(owner, [...(unplaced.get(owner) ?? []), request]);
284
+ }
219
285
  }
220
286
 
221
287
  for (const [toolId, frames] of owned) {
@@ -224,6 +290,7 @@ export function splitAskFrames(
224
290
  // on each question it names rather than in a single bucket.
225
291
  const placed: ExtensionUiDialogRequest[][] = questions.map((): ExtensionUiDialogRequest[] => []);
226
292
  const loose: ExtensionUiDialogRequest[] = [];
293
+ const unmatched = new Set(unplaced.get(toolId) ?? []);
227
294
  for (const frame of frames) {
228
295
  if (Array.isArray(frame.questions) && frame.questions.length > 0) {
229
296
  for (const grouped of frame.questions) {
@@ -240,20 +307,27 @@ export function splitAskFrames(
240
307
  else loose.push(frame);
241
308
  continue;
242
309
  }
310
+ // A frame with neither a title nor a row match has no question to walk
311
+ // to; the card draws it as the live control (see `looseByTool`) rather
312
+ // than guessing a question and printing the wrong one as open.
313
+ if (unmatched.has(frame)) continue;
243
314
  loose.push(frame);
244
315
  }
245
316
  // Everything that was not part of a grouped frame keeps the per-question
246
317
  // walk it has always used.
247
318
  const walked = groupAskFrames(questions, loose);
248
319
  framesByTool.set(toolId, questions.map((_, index) => [...placed[index], ...walked[index]]));
320
+ const unplacedFrames = unplaced.get(toolId);
321
+ if (unplacedFrames && unplacedFrames.length > 0) looseByTool.set(toolId, unplacedFrames);
249
322
  }
250
323
 
251
324
  // The frame stays queued either way — only the modal waits for the history,
252
325
  // so nothing is dropped and nothing flashes. An `ask` frame is excluded here
253
326
  // in BOTH states: it is answered by a card or by the orphan row, and the
254
- // modal has no body for it.
327
+ // modal has no body for it. Anything this split already handed to an inline
328
+ // surface is excluded too — a dialog must never be drawn twice.
255
329
  const modalRequest = historyLoaded
256
- ? pending.find((request) => !claimed.has(request) && request.method !== 'ask') ?? null
330
+ ? pending.find((request) => !handled.has(request) && request.method !== 'ask') ?? null
257
331
  : null;
258
- return { framesByTool, orphanAsks, modalRequest };
332
+ return { framesByTool, looseByTool, orphanAsks, modalRequest };
259
333
  }
@@ -174,10 +174,23 @@ async function setHarnessEnabled(id: string, enabled: boolean): Promise<string |
174
174
  }
175
175
  }
176
176
 
177
- export function useHarnesses(): HarnessesController {
177
+ export interface UseHarnessesOptions {
178
+ /**
179
+ * Read `/api/harness` and follow its changes. Defaults to true.
180
+ *
181
+ * The composer's `@harness:<id>:` completion mounts this hook on EVERY
182
+ * composer, but only needs the catalogue once a model trigger is active;
183
+ * disabling until then keeps an idle draft from issuing a request (and a
184
+ * caller that stubs one endpoint from seeing a second).
185
+ */
186
+ enabled?: boolean;
187
+ }
188
+
189
+ export function useHarnesses({ enabled = true }: UseHarnessesOptions = {}): HarnessesController {
178
190
  const [snapshot, setSnapshot] = useState(() => ({ ...store }));
179
191
 
180
192
  useEffect(() => {
193
+ if (!enabled) return;
181
194
  const sync = () => setSnapshot({ ...store });
182
195
  listeners.add(sync);
183
196
  // A subscriber that arrives after the first read has to see the catalog the
@@ -194,7 +207,7 @@ export function useHarnesses(): HarnessesController {
194
207
  listeners.delete(sync);
195
208
  offModels();
196
209
  };
197
- }, []);
210
+ }, [enabled]);
198
211
 
199
212
  return {
200
213
  harnesses: snapshot.harnesses,
@@ -15,9 +15,9 @@
15
15
 
16
16
  import { readKabmoSetting } from '@/shared/lib/settings/client';
17
17
  import {
18
- DEFAULT_ICON_STYLE,
19
18
  ICON_STYLE_ATTRIBUTE,
20
19
  ICON_STYLE_SETTING_KEY,
20
+ ICON_STYLE_WITHOUT_ATTRIBUTE,
21
21
  resolveIconStyle,
22
22
  } from '@/shared/lib/theme/icon-style';
23
23
  import {
@@ -54,14 +54,17 @@ export function applyIconPaper(theme?: string): void {
54
54
  /**
55
55
  * Point the document at `style`.
56
56
  *
57
- * The default is REMOVED rather than written, so the ink rule in CSS is the
58
- * single statement of what "no attribute" means.
57
+ * `monochrome` is REMOVED rather than written, because the ink pass in CSS is
58
+ * stated as the absence of the attribute (`:root:not([data-icon-style="color"])`).
59
+ * The comparison is against that ABSENT state, not against `DEFAULT_ICON_STYLE`:
60
+ * the default is `color`, and omitting the attribute for it would paint every
61
+ * mark ink while the setting says full colour.
59
62
  */
60
63
  export function applyIconStyle(style: unknown): void {
61
64
  if (typeof document === 'undefined') return;
62
65
  const root = document.documentElement;
63
66
  const resolved = resolveIconStyle(style);
64
- if (resolved === DEFAULT_ICON_STYLE) root.removeAttribute(ICON_STYLE_ATTRIBUTE);
67
+ if (resolved === ICON_STYLE_WITHOUT_ATTRIBUTE) root.removeAttribute(ICON_STYLE_ATTRIBUTE);
65
68
  else root.setAttribute(ICON_STYLE_ATTRIBUTE, resolved);
66
69
  // The bucket belongs to the same writer: a document that states one style
67
70
  // without the other paints a `mid` palette with the `deep` table.
@@ -8,10 +8,10 @@
8
8
  *
9
9
  * Both writers exist because the value reaches CSS through the document, not a
10
10
  * prop — so the facts worth pinning are the ones a wrong implementation breaks
11
- * silently: the default must CLEAR the attribute (a document carrying it and a
12
- * document not carrying it have to be the same state), an unknown stored value
13
- * must not produce an attribute no rule matches, and the boot path must read
14
- * the primed settings snapshot rather than hardcode the default.
11
+ * silently: the style CSS paints with no attribute (`classic` / `monochrome`)
12
+ * must CLEAR it, an unknown stored value must resolve to the shipped default
13
+ * (`glass` / `color`) and write THAT, and the boot path must read the primed
14
+ * settings snapshot rather than hardcode the default.
15
15
  *
16
16
  * The settings client keeps a module-level snapshot, so each case primes it
17
17
  * explicitly instead of relying on file order.
@@ -59,23 +59,23 @@ describe('the stored keys', () => {
59
59
  });
60
60
 
61
61
  describe('applySurfaceStyle', () => {
62
- test('writes the non-default style as the attribute CSS keys on', () => {
62
+ test('writes glass as the attribute CSS keys on', () => {
63
63
  applySurfaceStyle('glass');
64
64
 
65
65
  expect(document.documentElement.getAttribute('data-surface')).toBe('glass');
66
66
  });
67
67
 
68
- test('the default CLEARS the attribute instead of writing it', () => {
68
+ test('classic CLEARS the attribute instead of writing it', () => {
69
69
  applySurfaceStyle('glass');
70
70
  applySurfaceStyle('classic');
71
71
 
72
72
  expect(document.documentElement.hasAttribute('data-surface')).toBe(false);
73
73
  });
74
74
 
75
- test('an unknown value resolves to the default rather than an unmatched rule', () => {
75
+ test('an unknown value resolves to the glass default and writes it', () => {
76
76
  applySurfaceStyle('liquid');
77
77
 
78
- expect(document.documentElement.hasAttribute('data-surface')).toBe(false);
78
+ expect(document.documentElement.getAttribute('data-surface')).toBe('glass');
79
79
  });
80
80
  });
81
81
 
@@ -109,12 +109,12 @@ describe('the boot path', () => {
109
109
  expect(document.documentElement.getAttribute('data-icon-style')).toBe('color');
110
110
  });
111
111
 
112
- test('an install with no stored preference boots opaque and monochrome', () => {
112
+ test('an install with no stored preference boots glass and full colour', () => {
113
113
  primeKabmoSettings({});
114
114
  initSurfaceStyle();
115
115
  initIconStyle();
116
116
 
117
- expect(document.documentElement.hasAttribute('data-surface')).toBe(false);
118
- expect(document.documentElement.hasAttribute('data-icon-style')).toBe(false);
117
+ expect(document.documentElement.getAttribute('data-surface')).toBe('glass');
118
+ expect(document.documentElement.getAttribute('data-icon-style')).toBe('color');
119
119
  });
120
120
  });
@@ -23,24 +23,27 @@
23
23
 
24
24
  import { readKabmoSetting } from '@/shared/lib/settings/client';
25
25
  import {
26
- DEFAULT_SURFACE_STYLE,
27
26
  SURFACE_ATTRIBUTE,
28
27
  SURFACE_STYLE_SETTING_KEY,
28
+ SURFACE_STYLE_WITHOUT_ATTRIBUTE,
29
29
  resolveSurfaceStyle,
30
30
  } from '@/shared/lib/theme/surface-style';
31
31
 
32
32
  /**
33
33
  * Point the document at `style`.
34
34
  *
35
- * The default is REMOVED rather than written, so a document carrying `classic`
36
- * and a document carrying nothing are the same state — which is what makes the
37
- * `:root` fallback in CSS the single statement of the opaque default.
35
+ * The style CSS paints with no attribute is REMOVED rather than written, so a
36
+ * document carrying `classic` and a document carrying nothing are the same
37
+ * state — which is what makes the `:root` fallback in CSS the single statement
38
+ * of the opaque look. The comparison is against that ABSENT state, not against
39
+ * `DEFAULT_SURFACE_STYLE`: the default is `glass`, and omitting the attribute
40
+ * for it would paint the opaque shell while the setting says glass.
38
41
  */
39
42
  export function applySurfaceStyle(style: unknown): void {
40
43
  if (typeof document === 'undefined') return;
41
44
  const root = document.documentElement;
42
45
  const resolved = resolveSurfaceStyle(style);
43
- if (resolved === DEFAULT_SURFACE_STYLE) root.removeAttribute(SURFACE_ATTRIBUTE);
46
+ if (resolved === SURFACE_STYLE_WITHOUT_ATTRIBUTE) root.removeAttribute(SURFACE_ATTRIBUTE);
44
47
  else root.setAttribute(SURFACE_ATTRIBUTE, resolved);
45
48
  }
46
49
 
@@ -18,24 +18,27 @@
18
18
  * - **`data-theme` and `data-theme-variant` are ALWAYS written.** They are the
19
19
  * palette; `applyDocumentTheme` owns them after hydration, and a document
20
20
  * served without them keeps `:root`'s shipped palette.
21
- * - **The two style attributes are written only when they are not the default.**
22
- * `applySurfaceStyle` / `applyIconStyle` remove the attribute for the default,
23
- * so emitting `data-surface="classic"` here would make the server and the
24
- * client disagree about the document's own state — and every CSS rule keys on
25
- * the value, not on its absence.
21
+ * - **The two style attributes are written only when the style is not the one
22
+ * CSS paints with no attribute** (`classic` / `monochrome`). The client's
23
+ * `applySurfaceStyle` / `applyIconStyle` remove the attribute for exactly
24
+ * those values, so emitting `data-surface="classic"` here would make the
25
+ * server and the client disagree about the document's own state — and every
26
+ * CSS rule keys on the value, not on its absence. This is NOT the same test
27
+ * as `DEFAULT_*`: the defaults are now `glass` / `color`, and those must be
28
+ * emitted so the first frame is already frosted and coloured.
26
29
  */
27
30
 
28
31
  import type { ThemePalette } from '@/shared/types/theme';
29
32
  import {
30
- DEFAULT_ICON_STYLE,
31
33
  ICON_STYLE_ATTRIBUTE,
34
+ ICON_STYLE_WITHOUT_ATTRIBUTE,
32
35
  resolveIconStyle,
33
36
  } from '@/shared/lib/theme/icon-style';
34
37
  import { ICON_PAPER_ATTRIBUTE } from '@/shared/lib/icons/tint';
35
38
  import { paperBucketOf } from '@/shared/lib/icons/icon-tone';
36
39
  import {
37
- DEFAULT_SURFACE_STYLE,
38
40
  SURFACE_ATTRIBUTE,
41
+ SURFACE_STYLE_WITHOUT_ATTRIBUTE,
39
42
  resolveSurfaceStyle,
40
43
  } from '@/shared/lib/theme/surface-style';
41
44
 
@@ -59,8 +62,8 @@ export function styleAttributes(surfaceStyle: unknown, iconStyle: unknown, palet
59
62
  const surface = resolveSurfaceStyle(surfaceStyle);
60
63
  const icon = resolveIconStyle(iconStyle);
61
64
  const parts: string[] = [];
62
- if (surface !== DEFAULT_SURFACE_STYLE) parts.push(`${SURFACE_ATTRIBUTE}="${surface}"`);
63
- if (icon !== DEFAULT_ICON_STYLE) parts.push(`${ICON_STYLE_ATTRIBUTE}="${icon}"`);
65
+ if (surface !== SURFACE_STYLE_WITHOUT_ATTRIBUTE) parts.push(`${SURFACE_ATTRIBUTE}="${surface}"`);
66
+ if (icon !== ICON_STYLE_WITHOUT_ATTRIBUTE) parts.push(`${ICON_STYLE_ATTRIBUTE}="${icon}"`);
64
67
  // The paper bucket is written for EVERY light palette, including the default
65
68
  // one, because it is not a preference: without it the first frame paints the
66
69
  // `deep` icon table on a `mid` paper — one step darker than the palette allows,
@@ -7,11 +7,13 @@
7
7
  * The first frame's `<html>` attributes.
8
8
  *
9
9
  * The rule worth pinning is the ASYMMETRY: the palette is always written, and
10
- * the two presentation styles are written only when they are not the default —
11
- * because the client's writers REMOVE the attribute for the default, and a
12
- * server that emitted `data-surface="classic"` would leave a document the
13
- * client thinks is "explicitly classic" and a reload flipping between two
14
- * spellings of the same state.
10
+ * the two presentation styles are written only when they are not the style CSS
11
+ * paints with no attribute (`classic` / `monochrome`) — because the client's
12
+ * writers REMOVE the attribute for exactly those values, and a server that
13
+ * emitted `data-surface="classic"` would leave a document the client thinks is
14
+ * "explicitly classic" and a reload flipping between two spellings of the same
15
+ * state. The shipped DEFAULTS (`glass` / `color`) are therefore emitted, so the
16
+ * first frame is already frosted and coloured.
15
17
  */
16
18
 
17
19
  import { describe, expect, test } from 'bun:test';
@@ -35,13 +37,18 @@ const light = KABMO_PALETTES[0];
35
37
  const dark = THEMES.find((theme) => theme.variant === 'dark')!;
36
38
 
37
39
  describe('styleAttributes', () => {
38
- test('the defaults add nothing at all', () => {
40
+ test('the styles CSS paints with no attribute add nothing', () => {
39
41
  expect(styleAttributes('classic', 'monochrome')).toBe('');
40
- expect(styleAttributes(undefined, undefined)).toBe('');
41
- expect(styleAttributes('nonsense', 'nonsense')).toBe('');
42
42
  });
43
43
 
44
- test('each non-default style contributes its own attribute', () => {
44
+ test('the shipped defaults are emitted so the first frame is frosted and coloured', () => {
45
+ const defaults = ' data-surface="glass" data-icon-style="color"';
46
+ expect(styleAttributes(undefined, undefined)).toBe(defaults);
47
+ expect(styleAttributes('nonsense', 'nonsense')).toBe(defaults);
48
+ expect(styleAttributes('glass', 'color')).toBe(defaults);
49
+ });
50
+
51
+ test('each style contributes its own attribute independently', () => {
45
52
  expect(styleAttributes('glass', 'monochrome')).toBe(' data-surface="glass"');
46
53
  expect(styleAttributes('classic', 'color')).toBe(' data-icon-style="color"');
47
54
  expect(styleAttributes('glass', 'color')).toBe(' data-surface="glass" data-icon-style="color"');
@@ -58,7 +65,7 @@ describe('styleAttributes', () => {
58
65
  });
59
66
 
60
67
  describe('applyShellDocumentFacts', () => {
61
- test('writes the palette and the chrome colour, and nothing else by default', () => {
68
+ test('writes the palette, the shipped styles and the chrome colour', () => {
62
69
  const html = applyShellDocumentFacts(TEMPLATE, {
63
70
  palette: light,
64
71
  surfaceStyle: undefined,
@@ -67,11 +74,9 @@ describe('applyShellDocumentFacts', () => {
67
74
  });
68
75
 
69
76
  expect(html).toContain(
70
- `<html lang="en" data-theme="${light.id}" data-icon-paper="mid" data-theme-variant="${light.variant}">`,
77
+ `<html lang="en" data-theme="${light.id}" data-surface="glass" data-icon-style="color" data-icon-paper="mid" data-theme-variant="${light.variant}">`,
71
78
  );
72
79
  expect(html).toContain('<meta name="theme-color" content="#123456" />');
73
- expect(html).not.toContain('data-surface');
74
- expect(html).not.toContain('data-icon-style');
75
80
  });
76
81
 
77
82
  test('a stored glass style lands on the FIRST frame, not after hydration', () => {
@@ -0,0 +1,64 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The agent-token half of the gate: may this subprocess touch that session?
8
+ *
9
+ * Split out of `guard.ts` for two reasons. The file ceiling is one, but the
10
+ * real one is that this is a different question from "is there a UI session":
11
+ * a browser cookie is all-or-nothing, while an agent token is scoped to a
12
+ * session TREE. Keeping the two rules in one function made the tree rule look
13
+ * like a path check, which is exactly the bug it replaces.
14
+ *
15
+ * Three outcomes, because the caller must distinguish "not an agent request"
16
+ * (fall through to the device/401 path) from "an agent request that is allowed"
17
+ * (stop, allow) and "an agent request that is refused" (stop, 403).
18
+ */
19
+
20
+ import {
21
+ agentTokenScopeForPath,
22
+ bearerToken,
23
+ lookupAgentToken,
24
+ } from '@/server/lib/sessions/agent-token.server';
25
+ import { resolveAgentAccess } from '@/server/lib/sessions/relation-access.server';
26
+
27
+ export type AgentGateOutcome =
28
+ | { kind: 'none' }
29
+ | { kind: 'pass' }
30
+ | { kind: 'deny'; response: Response };
31
+
32
+ /**
33
+ * The answer for a valid agent token naming a session outside its tree.
34
+ *
35
+ * Deliberately identical for "exists but is not yours" and "does not exist": a
36
+ * gate that distinguished them would be an id oracle for any agent process. The
37
+ * routes keep their own 404 for callers that already passed this check.
38
+ */
39
+ function refusal(): Response {
40
+ return new Response(
41
+ JSON.stringify({ error: 'That session is not in this session’s tree', code: 'session_not_in_tree' }),
42
+ { status: 403, headers: { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' } },
43
+ );
44
+ }
45
+
46
+ /**
47
+ * Resolve one request against the agent-token rule.
48
+ *
49
+ * Spawn is the one path any token may call (a child must be able to create its
50
+ * own children); every other agent path names a session that must be in the
51
+ * token's tree — itself, an ancestor, or a descendant. The lookup falls back to
52
+ * the table so a peer instance that never saw the spawn still recognises the
53
+ * token.
54
+ */
55
+ export async function agentGate(request: Request, pathname: string): Promise<AgentGateOutcome> {
56
+ const scope = agentTokenScopeForPath(pathname);
57
+ if (!scope) return { kind: 'none' };
58
+
59
+ const agentSession = await lookupAgentToken(bearerToken(request));
60
+ if (!agentSession) return { kind: 'none' };
61
+ if (scope.kind === 'any') return { kind: 'pass' };
62
+ if (await resolveAgentAccess(agentSession, scope.target)) return { kind: 'pass' };
63
+ return { kind: 'deny', response: refusal() };
64
+ }