@alwith/module-chat 0.5.3 → 0.5.5

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 (322) hide show
  1. package/dist/activity-host.d.ts +2 -0
  2. package/dist/activity-host.js +1 -1
  3. package/dist/approval/choice-elicitation-form.js +1 -1
  4. package/dist/approval/choice-schema.js +1 -1
  5. package/dist/approval/permission-options.js +1 -1
  6. package/dist/approval/permission-view.js +1 -1
  7. package/dist/approval/schema-elicitation-form.js +1 -1
  8. package/dist/approval/url-elicitation-card.js +1 -1
  9. package/dist/chunk-00sds3wb.js +2 -0
  10. package/dist/{chunk-r6e2abj6.js → chunk-0h993cve.js} +2 -2
  11. package/dist/{chunk-61vxy6yd.js → chunk-0jw4ffzj.js} +1 -1
  12. package/dist/{chunk-4dcagj01.js → chunk-0vy9fzs3.js} +1 -1
  13. package/dist/{chunk-9bjywaze.js → chunk-11v81zha.js} +1 -1
  14. package/dist/chunk-1dce9zt8.js +2 -0
  15. package/dist/{chunk-b5g1j1zv.js → chunk-1mnc7200.js} +2 -2
  16. package/dist/{chunk-hr9d9zpb.js → chunk-1mv3y3cs.js} +2 -2
  17. package/dist/{chunk-zjg9n6zj.js → chunk-1q1hyka4.js} +2 -2
  18. package/dist/chunk-1tz8afx9.js +2 -0
  19. package/dist/chunk-1v3wc4cv.js +2 -0
  20. package/dist/chunk-29wvjf38.js +2 -0
  21. package/dist/{chunk-cr294svm.js → chunk-2q71dv8k.js} +1 -1
  22. package/dist/chunk-2w9f1q84.js +4 -0
  23. package/dist/{chunk-x71x2atx.js → chunk-34xzrr3s.js} +2 -2
  24. package/dist/{chunk-dfengqjx.js → chunk-39f0d44a.js} +2 -2
  25. package/dist/{chunk-d4yhdesy.js → chunk-3d58k7fn.js} +2 -2
  26. package/dist/chunk-3p9j3gmw.js +2 -0
  27. package/dist/chunk-3zj0ka21.js +2 -0
  28. package/dist/chunk-42fw8maa.js +2 -0
  29. package/dist/{chunk-w92s8704.js → chunk-48av28r4.js} +5 -5
  30. package/dist/{chunk-w2tmm1va.js → chunk-494jkxv9.js} +2 -2
  31. package/dist/chunk-52y4pyr1.js +2 -0
  32. package/dist/chunk-5nemwzzv.js +2 -0
  33. package/dist/{chunk-w99ah6qt.js → chunk-5s5tedyw.js} +3 -3
  34. package/dist/{chunk-zcrct67v.js → chunk-5w48y2ad.js} +1 -1
  35. package/dist/{chunk-qpz97p1m.js → chunk-5xjm1hab.js} +1 -1
  36. package/dist/chunk-6bdd2cgs.js +2 -0
  37. package/dist/{chunk-j4teycge.js → chunk-6jyd3a7v.js} +2 -2
  38. package/dist/{chunk-hesyytcd.js → chunk-76fxyvb0.js} +2 -2
  39. package/dist/chunk-7w4tjrdw.js +2 -0
  40. package/dist/{chunk-p0cc67an.js → chunk-812n3qd8.js} +2 -2
  41. package/dist/chunk-85gdavf5.js +2 -0
  42. package/dist/{chunk-ptt7q7za.js → chunk-8fd8jhbf.js} +3 -3
  43. package/dist/chunk-8w6ze6pw.js +4 -0
  44. package/dist/{chunk-20re64ta.js → chunk-91qp7sps.js} +2 -2
  45. package/dist/chunk-932ykb37.js +2 -0
  46. package/dist/{chunk-jdv29apq.js → chunk-9d0vkezs.js} +2 -2
  47. package/dist/{chunk-3jcxkpvs.js → chunk-9mcfd41e.js} +2 -2
  48. package/dist/{chunk-3m06tqqk.js → chunk-9yv5c2s3.js} +2 -2
  49. package/dist/{chunk-cgxcxfh1.js → chunk-ad32h099.js} +3 -3
  50. package/dist/{chunk-mgakm5yv.js → chunk-ap1br099.js} +2 -2
  51. package/dist/{chunk-eyre28p1.js → chunk-at0v48cp.js} +2 -2
  52. package/dist/chunk-azp1438s.js +2 -0
  53. package/dist/{chunk-wf4tq3fn.js → chunk-b0v983ch.js} +1 -1
  54. package/dist/chunk-bafntrka.js +3 -0
  55. package/dist/chunk-bje0nmh9.js +2 -0
  56. package/dist/chunk-bse4zh1d.js +2 -0
  57. package/dist/chunk-bx1x7t6v.js +3 -0
  58. package/dist/{chunk-tptnjbrd.js → chunk-c7b8rscf.js} +2 -2
  59. package/dist/{chunk-mk10tgjk.js → chunk-cbbr9m3a.js} +2 -2
  60. package/dist/{chunk-a7mr12yc.js → chunk-cg97byvk.js} +1 -1
  61. package/dist/{chunk-2snmjnz9.js → chunk-cka09jf6.js} +2 -2
  62. package/dist/chunk-dgx31pdr.js +2 -0
  63. package/dist/{chunk-pb6xtb3n.js → chunk-dhvpffgf.js} +2 -2
  64. package/dist/{chunk-tj44vjyv.js → chunk-dkbtw3g9.js} +2 -2
  65. package/dist/{chunk-px7xxz3v.js → chunk-eyqbvc19.js} +2 -2
  66. package/dist/{chunk-aygzz2yg.js → chunk-ez1ac611.js} +2 -2
  67. package/dist/{chunk-zwvyfjj8.js → chunk-f3xhtnkz.js} +2 -2
  68. package/dist/chunk-f59aepmd.js +2 -0
  69. package/dist/{chunk-n3raktzz.js → chunk-fv7tp8pr.js} +2 -2
  70. package/dist/chunk-gdbzk1kt.js +2 -0
  71. package/dist/{chunk-23wzpgbs.js → chunk-gdhkb2rz.js} +2 -2
  72. package/dist/{chunk-bycbj1aq.js → chunk-h2nvgcbs.js} +2 -2
  73. package/dist/{chunk-tre0r8qm.js → chunk-h3s5e0c5.js} +2 -2
  74. package/dist/chunk-haf9qn5a.js +2 -0
  75. package/dist/chunk-hd682pax.js +2 -0
  76. package/dist/{chunk-86kkb0z4.js → chunk-hw5n7sqm.js} +2 -2
  77. package/dist/{chunk-dzydvx7r.js → chunk-jh46xzr6.js} +3 -3
  78. package/dist/{chunk-fqj76wq8.js → chunk-jhxjbpt3.js} +2 -2
  79. package/dist/chunk-jmcb7an2.js +2 -0
  80. package/dist/{chunk-kbvkr5mr.js → chunk-jtafw6h4.js} +2 -2
  81. package/dist/{chunk-8r010kvn.js → chunk-k6b4cf05.js} +1 -1
  82. package/dist/chunk-kc9rzb07.js +2 -0
  83. package/dist/{chunk-ckp6661s.js → chunk-key9msc9.js} +2 -2
  84. package/dist/{chunk-ek06eyp4.js → chunk-kjtd3wc3.js} +1 -1
  85. package/dist/{chunk-9v2gk9ex.js → chunk-kk2nr6dd.js} +2 -2
  86. package/dist/chunk-m3cbbk3v.js +2 -0
  87. package/dist/chunk-m92evp24.js +2 -0
  88. package/dist/{chunk-8kjsqjy6.js → chunk-mme37xva.js} +1 -1
  89. package/dist/{chunk-802bgza1.js → chunk-mwkr9pvg.js} +2 -2
  90. package/dist/{chunk-k50475tn.js → chunk-mxj4s2r8.js} +1 -1
  91. package/dist/{chunk-pcngn73n.js → chunk-mzc51shd.js} +2 -2
  92. package/dist/{chunk-d25r0vq3.js → chunk-n514z4we.js} +2 -2
  93. package/dist/chunk-n6xa65sp.js +2 -0
  94. package/dist/{chunk-st90r31c.js → chunk-nhsbjys5.js} +1 -1
  95. package/dist/{chunk-cw68hvkc.js → chunk-p0ebmb2m.js} +1 -1
  96. package/dist/{chunk-mmdpwbef.js → chunk-p2khnrm1.js} +2 -2
  97. package/dist/{chunk-rqbbb37p.js → chunk-p8n6rm5h.js} +2 -2
  98. package/dist/{chunk-zy6338m6.js → chunk-q53h2y2a.js} +2 -2
  99. package/dist/chunk-q989x2x5.js +2 -0
  100. package/dist/chunk-qqv0bewt.js +2 -0
  101. package/dist/{chunk-acrrwrzy.js → chunk-qsqyf4y3.js} +2 -2
  102. package/dist/chunk-r22h488a.js +3 -0
  103. package/dist/{chunk-543v9eke.js → chunk-r8k9jd0z.js} +2 -2
  104. package/dist/{chunk-87t0qtkr.js → chunk-raz9hb3h.js} +4 -4
  105. package/dist/{chunk-691gxr2e.js → chunk-rd2n48s1.js} +2 -2
  106. package/dist/{chunk-t2ceq16d.js → chunk-rmv0t2ee.js} +2 -2
  107. package/dist/chunk-s1vxbxzr.js +2 -0
  108. package/dist/chunk-s3mx42dt.js +2 -0
  109. package/dist/chunk-seg9xzjy.js +2 -0
  110. package/dist/chunk-sq5zstzq.js +2 -0
  111. package/dist/{chunk-3nmqebb6.js → chunk-t794afpy.js} +3 -3
  112. package/dist/{chunk-maj7m5s7.js → chunk-t9nky8ka.js} +3 -3
  113. package/dist/{chunk-hwwhxb3x.js → chunk-ta45etnd.js} +1 -1
  114. package/dist/{chunk-zzwnpk4q.js → chunk-tcgx9yxg.js} +2 -2
  115. package/dist/{chunk-aaqk0jrt.js → chunk-tjykfxrd.js} +2 -2
  116. package/dist/chunk-tp5y8cc7.js +2 -0
  117. package/dist/{chunk-51qsyrd6.js → chunk-tv9wdbxr.js} +1 -1
  118. package/dist/{chunk-t9vvcy09.js → chunk-v8rqevms.js} +3 -3
  119. package/dist/{chunk-awrzpp7x.js → chunk-v958q8hh.js} +2 -2
  120. package/dist/chunk-vmywavgm.js +2 -0
  121. package/dist/chunk-w3z37qwe.js +2 -0
  122. package/dist/{chunk-hmtgx7fw.js → chunk-w522gwhm.js} +2 -2
  123. package/dist/chunk-w5wzxdbk.js +2 -0
  124. package/dist/{chunk-d6nxypzc.js → chunk-w9nr7saa.js} +1 -1
  125. package/dist/chunk-wpx2bvd0.js +7 -0
  126. package/dist/chunk-wthttnkz.js +2 -0
  127. package/dist/{chunk-e3mkvx24.js → chunk-x8vd2d2g.js} +1 -1
  128. package/dist/{chunk-rkqe8p8n.js → chunk-xf91jp39.js} +2 -2
  129. package/dist/{chunk-ncekagm6.js → chunk-xjtqdp82.js} +1 -1
  130. package/dist/chunk-xnmjg8r1.js +2 -0
  131. package/dist/chunk-xrek8rbm.js +2 -0
  132. package/dist/{chunk-0n82kdek.js → chunk-xttthm0n.js} +2 -2
  133. package/dist/{chunk-4mnf89r3.js → chunk-y6v59cgf.js} +1 -1
  134. package/dist/{chunk-jnfp7j32.js → chunk-y8qmxd0j.js} +2 -2
  135. package/dist/{chunk-qbdqh38y.js → chunk-ygebvrv5.js} +1 -1
  136. package/dist/{chunk-1dp50khb.js → chunk-z79xmq12.js} +2 -2
  137. package/dist/{chunk-h80g3eme.js → chunk-zw2q13qg.js} +2 -2
  138. package/dist/codex/activity-group.d.ts +2 -1
  139. package/dist/codex/activity-group.js +1 -1
  140. package/dist/codex/assistant-message.js +1 -1
  141. package/dist/codex/async-question-card.js +1 -1
  142. package/dist/codex/disclosure-state.js +1 -1
  143. package/dist/codex/edited-files-card.js +1 -1
  144. package/dist/codex/image-view-activity.js +1 -1
  145. package/dist/codex/markdown-renderer.js +1 -1
  146. package/dist/codex/navigation-audio.js +1 -1
  147. package/dist/codex/navigation-preview.js +1 -1
  148. package/dist/codex/navigation-rail.js +1 -1
  149. package/dist/codex/patch-view.js +1 -1
  150. package/dist/codex/plan.js +1 -1
  151. package/dist/codex/timeline-virtualizer.js +1 -1
  152. package/dist/codex/turn-activity.d.ts +14 -0
  153. package/dist/codex/turn-activity.js +1 -0
  154. package/dist/codex/user-message.d.ts +3 -2
  155. package/dist/codex/user-message.js +1 -1
  156. package/dist/codex/virtualized-turn-list.js +1 -1
  157. package/dist/composer/completion-filter.js +1 -1
  158. package/dist/composer/completion-menu.js +1 -1
  159. package/dist/composer/completion-trigger.js +1 -1
  160. package/dist/composer/effort-slider.js +1 -1
  161. package/dist/composer/menu-radio.js +1 -1
  162. package/dist/composer/model-select.js +1 -1
  163. package/dist/composer/permission-mode-select.js +1 -1
  164. package/dist/composer/prompt-input-attachments.js +1 -1
  165. package/dist/composer/prompt-input-clipboard.js +1 -1
  166. package/dist/composer/prompt-input-context.js +1 -1
  167. package/dist/composer/prompt-input-textarea.js +1 -1
  168. package/dist/composer/prompt-input.js +1 -1
  169. package/dist/conversation/action-card.js +1 -1
  170. package/dist/conversation/composer/composer.js +1 -1
  171. package/dist/conversation/composer/config-options.js +1 -1
  172. package/dist/conversation/composer/context.js +1 -1
  173. package/dist/conversation/composer/drafts.js +1 -1
  174. package/dist/conversation/composer/file-items.js +1 -1
  175. package/dist/conversation/composer/long-text.js +1 -1
  176. package/dist/conversation/composer/mention-chips.js +1 -1
  177. package/dist/conversation/composer/model-menu.js +1 -1
  178. package/dist/conversation/composer/pasted-text-attachment.js +1 -1
  179. package/dist/conversation/composer/permission-mode-menu.js +1 -1
  180. package/dist/conversation/composer/prediction.d.ts +1 -1
  181. package/dist/conversation/composer/prediction.js +1 -1
  182. package/dist/conversation/composer/slash-command-button.js +1 -1
  183. package/dist/conversation/composer/submit-button.js +1 -1
  184. package/dist/conversation/composer/usage-meter.js +1 -1
  185. package/dist/conversation/context.js +1 -1
  186. package/dist/conversation/conversation-body.js +1 -1
  187. package/dist/conversation/conversation-view.d.ts +1 -0
  188. package/dist/conversation/conversation-view.js +1 -1
  189. package/dist/conversation/conversation.js +1 -1
  190. package/dist/conversation/diff-modal.js +1 -1
  191. package/dist/conversation/session-actions.js +1 -1
  192. package/dist/image-lightbox.js +1 -1
  193. package/dist/image-preview-dialog.js +1 -1
  194. package/dist/lib/code-highlighter.js +1 -1
  195. package/dist/lib/fuzzy.js +1 -1
  196. package/dist/lib/group-blocks.js +1 -1
  197. package/dist/lib/image-encode.js +1 -1
  198. package/dist/lib/limits.js +1 -1
  199. package/dist/lib/markdown-parser.js +1 -1
  200. package/dist/lib/markdown-rules.js +1 -1
  201. package/dist/lib/model-name.js +1 -1
  202. package/dist/lib/pointer-centered-zoom.js +1 -1
  203. package/dist/lib/prepare-prompt-files.js +1 -1
  204. package/dist/lib/stream-style.js +1 -1
  205. package/dist/lib/streaming-markdown.js +1 -1
  206. package/dist/locales.d.ts +24 -8
  207. package/dist/locales.js +1 -1
  208. package/dist/search/chat-search.d.ts +2 -1
  209. package/dist/search/chat-search.js +1 -1
  210. package/dist/search/dom-matches.d.ts +1 -0
  211. package/dist/search/dom-matches.js +1 -1
  212. package/dist/search/find-bar.js +1 -1
  213. package/dist/search/literal-matches.js +1 -1
  214. package/dist/session-list/archived-sessions.js +1 -1
  215. package/dist/session-list/highlight.js +1 -1
  216. package/dist/session-list/host.js +1 -1
  217. package/dist/session-list/hover-info-card.js +1 -1
  218. package/dist/session-list/navigation.js +1 -1
  219. package/dist/session-list/overflow-marquee.js +1 -1
  220. package/dist/session-list/row-stop-button.js +1 -1
  221. package/dist/session-list/session-groups.js +1 -1
  222. package/dist/session-list/session-info-card.js +1 -1
  223. package/dist/session-list/session-list.css +6 -4
  224. package/dist/session-list/session-list.js +1 -1
  225. package/dist/session-list/session-row.js +1 -1
  226. package/dist/session-list/session-state-dot.js +1 -1
  227. package/dist/session-list/sidebar-overlay.js +1 -1
  228. package/dist/session-list/trailing-swap.js +1 -1
  229. package/dist/session-list/use-activity-preview.js +1 -1
  230. package/dist/session-list/use-project-sessions.js +1 -1
  231. package/dist/session-list/virtual-session-rows.js +1 -1
  232. package/dist/session-timeline/activity-group.js +1 -1
  233. package/dist/session-timeline/activity-projection.js +1 -1
  234. package/dist/session-timeline/assistant-content.js +1 -1
  235. package/dist/session-timeline/assistant-turn.js +1 -1
  236. package/dist/session-timeline/async-questions.js +1 -1
  237. package/dist/session-timeline/edited-files-card.js +1 -1
  238. package/dist/session-timeline/history-timeline.js +1 -1
  239. package/dist/session-timeline/host.js +1 -1
  240. package/dist/session-timeline/navigation-rail.js +1 -1
  241. package/dist/session-timeline/plan.js +1 -1
  242. package/dist/session-timeline/question-reply.js +1 -1
  243. package/dist/session-timeline/resource-content.js +1 -1
  244. package/dist/session-timeline/session-timeline.js +1 -1
  245. package/dist/session-timeline/timeline-registry.d.ts +2 -0
  246. package/dist/session-timeline/timeline-registry.js +1 -1
  247. package/dist/session-timeline/turn-activity.d.ts +3 -0
  248. package/dist/session-timeline/turn-activity.js +1 -0
  249. package/dist/session-timeline/turn-error.js +1 -1
  250. package/dist/session-timeline/turn-retry.js +1 -1
  251. package/dist/session-timeline/turn-time.js +1 -1
  252. package/dist/session-timeline/turns.d.ts +1 -0
  253. package/dist/session-timeline/turns.js +1 -1
  254. package/dist/session-timeline/use-timeline-scroll.js +1 -1
  255. package/dist/session-timeline/user-message.js +1 -1
  256. package/dist/ui/alert.js +1 -1
  257. package/dist/ui/badge.js +1 -1
  258. package/dist/ui/button.js +1 -1
  259. package/dist/ui/card.js +1 -1
  260. package/dist/ui/checkbox.js +1 -1
  261. package/dist/ui/dialog.js +1 -1
  262. package/dist/ui/dropdown-menu.js +1 -1
  263. package/dist/ui/empty.js +1 -1
  264. package/dist/ui/field.js +1 -1
  265. package/dist/ui/hover-card.js +1 -1
  266. package/dist/ui/input-group-textarea.js +1 -1
  267. package/dist/ui/input-group.js +1 -1
  268. package/dist/ui/kbd.js +1 -1
  269. package/dist/ui/label.js +1 -1
  270. package/dist/ui/radio-group.js +1 -1
  271. package/dist/ui/select.js +1 -1
  272. package/dist/ui/separator.js +1 -1
  273. package/dist/ui/skeleton.js +1 -1
  274. package/dist/ui/spinner.js +1 -1
  275. package/dist/ui/switch.js +1 -1
  276. package/dist/ui/textarea.js +1 -1
  277. package/dist/ui/tooltip.js +1 -1
  278. package/package.json +3 -3
  279. package/dist/chunk-0j15twx6.js +0 -2
  280. package/dist/chunk-0pa5t12s.js +0 -2
  281. package/dist/chunk-0vvn08gg.js +0 -2
  282. package/dist/chunk-14a9wet3.js +0 -2
  283. package/dist/chunk-1wc83vxg.js +0 -2
  284. package/dist/chunk-20bww40d.js +0 -2
  285. package/dist/chunk-20gtemb9.js +0 -2
  286. package/dist/chunk-2b185a0a.js +0 -2
  287. package/dist/chunk-2sy8cs84.js +0 -2
  288. package/dist/chunk-30g0y24x.js +0 -2
  289. package/dist/chunk-33mgpcnd.js +0 -2
  290. package/dist/chunk-4d8q9bpy.js +0 -2
  291. package/dist/chunk-67txww0x.js +0 -2
  292. package/dist/chunk-6fht8rx9.js +0 -2
  293. package/dist/chunk-6ndz2pf9.js +0 -2
  294. package/dist/chunk-7gaper2w.js +0 -2
  295. package/dist/chunk-8mvg9a32.js +0 -2
  296. package/dist/chunk-9x4et210.js +0 -2
  297. package/dist/chunk-asxwsg2p.js +0 -2
  298. package/dist/chunk-cj5pkg2y.js +0 -4
  299. package/dist/chunk-ctedwb0a.js +0 -3
  300. package/dist/chunk-czahfwp7.js +0 -2
  301. package/dist/chunk-dnn8064m.js +0 -2
  302. package/dist/chunk-dqw30cz4.js +0 -2
  303. package/dist/chunk-e43pfcrt.js +0 -2
  304. package/dist/chunk-h4sw0pez.js +0 -2
  305. package/dist/chunk-jmx0awnf.js +0 -2
  306. package/dist/chunk-maepz12p.js +0 -3
  307. package/dist/chunk-npjw8dm5.js +0 -2
  308. package/dist/chunk-qf3a35g4.js +0 -2
  309. package/dist/chunk-r41p7378.js +0 -2
  310. package/dist/chunk-rzajhyrq.js +0 -2
  311. package/dist/chunk-sc746nr6.js +0 -2
  312. package/dist/chunk-sgbde4dv.js +0 -2
  313. package/dist/chunk-tgb70x2n.js +0 -2
  314. package/dist/chunk-vxnjsga5.js +0 -2
  315. package/dist/chunk-vyzzs0nc.js +0 -7
  316. package/dist/chunk-w0y1svj7.js +0 -3
  317. package/dist/chunk-wqwqx3hc.js +0 -2
  318. package/dist/chunk-wtk721nx.js +0 -2
  319. package/dist/chunk-x3b4dpac.js +0 -2
  320. package/dist/chunk-xem94nq0.js +0 -4
  321. package/dist/chunk-yx02h2ja.js +0 -2
  322. package/dist/chunk-z8fdvq3v.js +0 -2
@@ -12,6 +12,8 @@ export interface ActivityHost {
12
12
  language: string;
13
13
  };
14
14
  openLink: (url: string) => void;
15
+ copyText?: (text: string) => Promise<void>;
16
+ onCopyError?: (error: unknown) => void;
15
17
  Output?: ComponentType<{
16
18
  text: string;
17
19
  }>;
@@ -1 +1 @@
1
- import{nr,a,h}from"./chunk-1wc83vxg.js";export{nr as ActivityHostProvider,h as ActivityMarkdown,a as useActivityHost};
1
+ import{wo,a,g}from"./chunk-3p9j3gmw.js";export{wo as ActivityHostProvider,g as ActivityMarkdown,a as useActivityHost};
@@ -1 +1 @@
1
- import{Re}from"../chunk-51qsyrd6.js";import{e}from"../chunk-a7mr12yc.js";import{ge}from"../chunk-9bjywaze.js";import{l}from"../chunk-1hy64ewz.js";import{f}from"../chunk-ek06eyp4.js";import{V,M}from"../chunk-zcrct67v.js";import{k}from"../chunk-ncekagm6.js";import{Fn,Et,ie,ct}from"../chunk-0vvn08gg.js";import{autoUpdate as j}from"@floating-ui/dom";import{cn as B}from"cn";import{useCallback as Q,useEffect as H,useLayoutEffect as O,useMemo as _,useRef as G,useState as R}from"react";import{createPortal as W}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function le({current:r,total:F,anchorRef:N,t:p,onAccept:A,onDecline:I}){let x=_(()=>r?Fn(r.requestedSchema):[],[r]),[S,b]=R({}),T=G(null);H(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!ie(o)){let u=ct(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),H(()=>{if(r?.elicitationId!==void 0&&T.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")T.current.focus()},[r?.elicitationId]);let[y,L]=R(null),[C,z]=R(null),E=Q(()=>{let t=N.current;if(!t)return;let a=t.getBoundingClientRect();if(a.width===0){let o=Math.min(640,window.innerWidth*0.9);L({left:(window.innerWidth-o)/2,width:o,bottom:24});return}L({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);O(()=>{if(!r)return;let t=0,a=()=>{if(N.current){E();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,E,N]),O(()=>{let t=N.current;if(!r||!t||!C)return;return j(t,C,E,{animationFrame:!0})},[r,C,N,E]);let U=_(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=S[t];if(!o)return!1;if(ie(a)){if(!o.selectedSet||o.selectedSet.size===0)return!1;if(o.selectedSet.has(c)&&!o.otherText?.trim())return!1}else{if(!o.selected)return!1;if(o.selected===c&&!o.otherText?.trim())return!1}}return!0},[r,x,S]),D=Q(async()=>{if(!r)return;if(!U)return;let t={},a={};for(let{key:o,property:u}of x){let d=S[o];if(!d)continue;let g;if(ie(u))t[o]=[...d.selectedSet??[]].map((v)=>v===c?(d.otherText??"").trim():v).filter(Boolean);else{let v=d.selected??"";if(t[o]=v===c?(d.otherText??"").trim():v,v!==c)g=ct(u).find((s)=>s.value===v)?.preview}let h=d.notes?.trim();if(g||h)a[o]={...g&&{preview:g},...h&&{notes:h}}}await A(r.elicitationId,t,a)},[r,x,S,U,A]),q=Q(async()=>{if(r)await I(r.elicitationId)},[r,I]);if(!r||!y)return null;return W(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),q()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:y.left,width:y.width,bottom:y.bottom,maxHeight:"70vh"},ref:(t)=>{T.current=t,z(t)},children:[m("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),F>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${F}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:a},o)=>{let u=S[t],d=u?.selected,g=u?.selectedSet??new Set,h=ct(a),v=ie(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(Re,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:Et(a).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:Et(a).description})]}),v?m("div",{className:"space-y-1.5 ps-1",children:[h.map((s)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ge,{checked:g.has(s.value),onCheckedChange:(n)=>{b((w)=>{let P=new Set(w[t]?.selectedSet??new Set);if(n)P.add(s.value);else P.delete(s.value);return{...w,[t]:{...w[t],selectedSet:P}}})}}),m("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ge,{checked:g.has(c),onCheckedChange:(s)=>{b((n)=>{let w=new Set(n[t]?.selectedSet??new Set);if(s)w.add(c);else w.delete(c);return{...n,[t]:{...n[t],selectedSet:w}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}):m(V,{value:d??"",onValueChange:(s)=>b((n)=>({...n,[t]:{...n[t],selected:s}})),className:"space-y-1.5 ps-1",children:[h.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:B("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",d===s.value&&"bg-muted/60"),children:[i(M,{value:s.value,id:n}),m(f,{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),m("div",{className:B("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",d===c&&"bg-muted/60"),children:[i(M,{value:c,id:`${o}:other`,className:"mt-0.5"}),i(f,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!v&&d&&d!==c&&(()=>{let s=h.find((n)=>n.value===d)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),h.some((s)=>s.preview)&&i(k,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),m("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void q(),children:p("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!U,onClick:()=>void D(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{le as ChoiceElicitationForm};
1
+ import{ze}from"../chunk-tv9wdbxr.js";import{e}from"../chunk-cg97byvk.js";import{ce}from"../chunk-11v81zha.js";import{l}from"../chunk-1hy64ewz.js";import{v}from"../chunk-kjtd3wc3.js";import{U,R}from"../chunk-5w48y2ad.js";import{C}from"../chunk-xjtqdp82.js";import{kn,Tt,oe,lt}from"../chunk-gdbzk1kt.js";import{autoUpdate as G}from"@floating-ui/dom";import{cn as M}from"cn";import{useCallback as F,useEffect as O,useLayoutEffect as _,useMemo as z,useRef as V,useState as A}from"react";import{createPortal as W}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function le({current:r,total:I,anchorRef:N,t:p,onAccept:L,onDecline:q}){let x=z(()=>r?kn(r.requestedSchema):[],[r]),[S,b]=A({}),E=V(null);O(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!oe(o)){let u=lt(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),O(()=>{if(r?.elicitationId!==void 0&&E.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")E.current.focus()},[r?.elicitationId]);let[k,B]=A(null),[T,D]=A(null),y=F(()=>{let t=N.current;if(!t)return;let a=t.getBoundingClientRect();if(a.width===0){let o=Math.min(640,window.innerWidth*0.9);B({left:(window.innerWidth-o)/2,width:o,bottom:24});return}B({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);_(()=>{if(!r)return;let t=0,a=()=>{if(N.current){y();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,y,N]),_(()=>{let t=N.current;if(!r||!t||!T)return;return G(t,T,y,{animationFrame:!0})},[r,T,N,y]);let P=z(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=S[t];if(!o)return!1;if(oe(a)){if(!o.selectedSet||o.selectedSet.size===0)return!1;if(o.selectedSet.has(c)&&!o.otherText?.trim())return!1}else{if(!o.selected)return!1;if(o.selected===c&&!o.otherText?.trim())return!1}}return!0},[r,x,S]),j=F(async()=>{if(!r)return;if(!P)return;let t={},a={};for(let{key:o,property:u}of x){let d=S[o];if(!d)continue;let g;if(oe(u))t[o]=[...d.selectedSet??[]].map((f)=>f===c?(d.otherText??"").trim():f).filter(Boolean);else{let f=d.selected??"";if(t[o]=f===c?(d.otherText??"").trim():f,f!==c)g=lt(u).find((s)=>s.value===f)?.preview}let h=d.notes?.trim();if(g||h)a[o]={...g&&{preview:g},...h&&{notes:h}}}await L(r.elicitationId,t,a)},[r,x,S,P,L]),H=F(async()=>{if(r)await q(r.elicitationId)},[r,q]);if(!r||!k)return null;return W(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),H()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:k.left,width:k.width,bottom:k.bottom,maxHeight:"70vh"},ref:(t)=>{E.current=t,D(t)},children:[m("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),I>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${I}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:a},o)=>{let u=S[t],d=u?.selected,g=u?.selectedSet??new Set,h=lt(a),f=oe(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(ze,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:Tt(a).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:Tt(a).description})]}),f?m("div",{className:"space-y-1.5 ps-1",children:[h.map((s)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ce,{checked:g.has(s.value),onCheckedChange:(n)=>{b((w)=>{let Q=new Set(w[t]?.selectedSet??new Set);if(n)Q.add(s.value);else Q.delete(s.value);return{...w,[t]:{...w[t],selectedSet:Q}}})}}),m("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ce,{checked:g.has(c),onCheckedChange:(s)=>{b((n)=>{let w=new Set(n[t]?.selectedSet??new Set);if(s)w.add(c);else w.delete(c);return{...n,[t]:{...n[t],selectedSet:w}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}):m(U,{value:d??"",onValueChange:(s)=>b((n)=>({...n,[t]:{...n[t],selected:s}})),className:"space-y-1.5 ps-1",children:[h.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:M("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",d===s.value&&"bg-muted/60"),children:[i(R,{value:s.value,id:n}),m(v,{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),m("div",{className:M("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",d===c&&"bg-muted/60"),children:[i(R,{value:c,id:`${o}:other`,className:"mt-0.5"}),i(v,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!f&&d&&d!==c&&(()=>{let s=h.find((n)=>n.value===d)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),h.some((s)=>s.preview)&&i(C,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),m("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void H(),children:p("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!P,onClick:()=>void j(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{le as ChoiceElicitationForm};
@@ -1 +1 @@
1
- import{Fn,Et,ie,ct}from"../chunk-0vvn08gg.js";export{Fn as elicitationFields,Et as elicitationLabels,ct as elicitationOptions,ie as isMultiSelect};
1
+ import{kn,Tt,oe,lt}from"../chunk-gdbzk1kt.js";export{kn as elicitationFields,Tt as elicitationLabels,lt as elicitationOptions,oe as isMultiSelect};
@@ -1 +1 @@
1
- import{mr,Bn,Kr,Qr}from"../chunk-30g0y24x.js";export{mr as PERMISSION_KIND_GROUP_ORDER,Kr as isAllowKind,Qr as isAlwaysKind,Bn as sortPermissionOptions};
1
+ import{gr,wn,Gr,Wr}from"../chunk-hd682pax.js";export{gr as PERMISSION_KIND_GROUP_ORDER,Gr as isAllowKind,Wr as isAlwaysKind,wn as sortPermissionOptions};
@@ -1 +1 @@
1
- import{Ln}from"../chunk-tre0r8qm.js";import"../chunk-30g0y24x.js";export{Ln as PermissionView};
1
+ import{bn}from"../chunk-h3s5e0c5.js";import"../chunk-hd682pax.js";export{bn as PermissionView};
@@ -1 +1 @@
1
- import{kr,ur,Tr,Dn}from"../chunk-sgbde4dv.js";import"../chunk-st90r31c.js";import"../chunk-4mnf89r3.js";import"../chunk-9bjywaze.js";import"../chunk-qbdqh38y.js";import"../chunk-1hy64ewz.js";import"../chunk-cw68hvkc.js";import"../chunk-ek06eyp4.js";import"../chunk-zcrct67v.js";import"../chunk-ncekagm6.js";import"../chunk-a7mr12yc.js";export{Dn as SchemaElicitationForm,kr as elicitationFields,ur as initialValues,Tr as isAnswered};
1
+ import{Ir,fr,Pr,Cn}from"../chunk-wthttnkz.js";import"../chunk-11v81zha.js";import"../chunk-1hy64ewz.js";import"../chunk-y6v59cgf.js";import"../chunk-5w48y2ad.js";import"../chunk-p0ebmb2m.js";import"../chunk-cg97byvk.js";import"../chunk-xjtqdp82.js";import"../chunk-nhsbjys5.js";import"../chunk-ygebvrv5.js";import"../chunk-kjtd3wc3.js";export{Cn as SchemaElicitationForm,Ir as elicitationFields,fr as initialValues,Pr as isAnswered};
@@ -1 +1 @@
1
- import{_n}from"../chunk-86kkb0z4.js";import"../chunk-d6nxypzc.js";import"../chunk-a7mr12yc.js";export{_n as UrlElicitationCard};
1
+ import{yn}from"../chunk-hw5n7sqm.js";import"../chunk-w9nr7saa.js";import"../chunk-cg97byvk.js";export{yn as UrlElicitationCard};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-cg97byvk.js";import{ue,me,J}from"./chunk-k6b4cf05.js";import{f}from"./chunk-jtafw6h4.js";import{useState as g}from"react";import{jsx as o,jsxs as t}from"react/jsx-runtime";function qo({value:p,currentName:n,icon:r,options:s,label:i,header:a,onValueChange:d,showLabel:l=!1,disabled:u=!1}){let[m,c]=g(!1);return t(ue,{open:m,onOpenChange:c,children:[o(me,{render:t(e,{disabled:u,variant:"ghost","aria-label":`${i}: ${n}`,title:n,className:"text-muted-foreground data-popup-open:hover:bg-muted h-7 gap-1.5 rounded-full bg-transparent px-2 text-xs font-normal whitespace-nowrap data-popup-open:bg-transparent",children:[r,o("span",{className:l?"max-w-40 truncate":"hidden max-w-40 truncate @[40rem]/input-footer:inline-block",children:n})]})}),t(J,{align:"start",sideOffset:4,className:"permission-mode-menu z-100 w-auto max-w-[calc(100vw-2rem)] min-w-72 rounded-xl p-1.5",children:[a&&o("div",{className:"text-muted-foreground flex items-center px-1.5 pt-0.5 pb-1 text-[11px] leading-4",children:o("span",{children:a})}),o(f,{value:p,onValueChange:d,itemClassName:"items-center gap-2 py-1 pr-6 pl-2 whitespace-nowrap",options:s})]})]})}
2
+ export{qo};
@@ -1,2 +1,2 @@
1
- var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function Wt(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function lo(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=Wt(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
2
- export{Wt,lo};
1
+ var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function Vt(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function To(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=Vt(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
2
+ export{Vt,To};
@@ -1 +1 @@
1
- import{cn as a}from"cn";import{Loader2Icon as r}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function ve({className:o,...n}){return e(r,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:a("size-4 animate-spin",o),...n})}export{ve};
1
+ import{cn as a}from"cn";import{Loader2Icon as r}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function de({className:o,...n}){return e(r,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:a("size-4 animate-spin",o),...n})}export{de};
@@ -1 +1 @@
1
- import{cva as s}from"class-variance-authority";import{cn as a}from"cn";import{jsx as r}from"react/jsx-runtime";var n=s("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function O({className:t,variant:e,...o}){return r("div",{"data-slot":"alert",role:"alert",className:a(n({variant:e}),t),...o})}function $t({className:t,...e}){return r("div",{"data-slot":"alert-title",className:a("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function F({className:t,...e}){return r("div",{"data-slot":"alert-description",className:a("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}function ai({className:t,...e}){return r("div",{"data-slot":"alert-action",className:a("absolute top-2.5 end-3",t),...e})}export{O,$t,F,ai};
1
+ import{cva as s}from"class-variance-authority";import{cn as a}from"cn";import{jsx as r}from"react/jsx-runtime";var n=s("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function B({className:t,variant:e,...o}){return r("div",{"data-slot":"alert",role:"alert",className:a(n({variant:e}),t),...o})}function rn({className:t,...e}){return r("div",{"data-slot":"alert-title",className:a("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function z({className:t,...e}){return r("div",{"data-slot":"alert-description",className:a("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}function hi({className:t,...e}){return r("div",{"data-slot":"alert-action",className:a("absolute top-2.5 end-3",t),...e})}export{B,rn,z,hi};
@@ -1 +1 @@
1
- import{Checkbox as i}from"@base-ui/react/checkbox";import{cn as o}from"cn";import{CheckIcon as t}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function ge({className:r,...a}){return e(i.Root,{"data-slot":"checkbox",className:o("peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:e(i.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e(t,{})})})}export{ge};
1
+ import{Checkbox as i}from"@base-ui/react/checkbox";import{cn as o}from"cn";import{CheckIcon as t}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function ce({className:r,...a}){return e(i.Root,{"data-slot":"checkbox",className:o("peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:e(i.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e(t,{})})})}export{ce};
@@ -0,0 +1,2 @@
1
+ import{l}from"./chunk-1hy64ewz.js";import{V}from"./chunk-ygebvrv5.js";import{h}from"./chunk-bse4zh1d.js";import{wt}from"./chunk-cbbr9m3a.js";import{L}from"./chunk-tjykfxrd.js";import{gt,ft}from"./chunk-fv7tp8pr.js";import{formatDistanceToNowStrict as x}from"date-fns";import{enUS as z,zhCN as E}from"date-fns/locale";import{ClockIcon as w,MessageSquareIcon as A}from"lucide-react";import{useEffect as g,useState as D}from"react";import{jsx as o,jsxs as C,Fragment as M}from"react/jsx-runtime";var S={en:z,"zh-CN":E};function Ae(t,a){let i=a==="zh-CN"?S["zh-CN"]:S.en;return x(new Date(t),{locale:i})}function mt({sessionRow:t,actions:a,shortcut:i,renaming:n=!1,onRename:m}){let{t:r,i18n:I,PathAction:u}=h(),f=ft(),y=gt();g(()=>{f(n)},[n,f]);let[H,p]=D(t.title??"");g(()=>{if(n)p(t.title??"")},[n,t.title]);let d=(e)=>{let c=e.trim();m?.(c!==""&&c!==t.title?c:null)},N=t.archived?r("sessionList.archived"):t.updatedAt!==null?Ae(t.updatedAt,I.language):null,v=[];if(N!==null)v.push({icon:o(w,{className:"size-3.5"}),text:N});let s=u&&o(u,{cwd:t.cwd,onOpened:y});return o(wt,{title:n?o(l,{autoFocus:!0,value:H,className:"h-7 text-sm","aria-label":r("sessionList.rename"),onChange:(e)=>p(e.target.value),onKeyDown:(e)=>{if(e.stopPropagation(),e.key==="Enter")d(e.target.value);if(e.key==="Escape")m?.(null)},onBlur:(e)=>d(e.target.value)}):C("span",{className:"flex items-center gap-2",children:[o("span",{className:"min-w-0",children:o(L,{className:"min-w-0 flex-1",children:t.title??r("sessionList.untitled")})}),i]}),titleIcon:o(A,{className:"size-3.5"}),details:v,actions:s||a!==void 0?C(M,{children:[s,s&&a!==void 0&&o(V,{}),a]}):void 0})}
2
+ export{Ae,mt};
@@ -1,2 +1,2 @@
1
- import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function It({name:p,value:P,levels:h,disabled:c,onChange:v}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===P)),[M,d]=k(null),l=y(null),[I,b]=k(null),x=y(0),s=M??I??g,w=(t)=>{let n=++x.current;b(t);let e=()=>{if(x.current===n)b(null)};try{Promise.resolve(v(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=76,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
2
- export{It};
1
+ import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function Wt({name:p,value:P,levels:h,disabled:c,onChange:v}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===P)),[M,d]=k(null),l=y(null),[I,b]=k(null),x=y(0),s=M??I??g,w=(t)=>{let n=++x.current;b(t);let e=()=>{if(x.current===n)b(null)};try{Promise.resolve(v(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=76,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
2
+ export{Wt};
@@ -1,2 +1,2 @@
1
- import{t}from"./chunk-yx02h2ja.js";import{Re}from"./chunk-51qsyrd6.js";import{e}from"./chunk-a7mr12yc.js";import{tt}from"./chunk-jf5651fz.js";import{FileIcon as m,XIcon as r}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function Rn({mentions:n,onRemove:s}){let{t:i}=t();if(n.length===0)return null;return a("div",{className:"mb-1.5 flex flex-wrap items-center gap-1.5",children:n.map((o)=>l(Re,{variant:"secondary",className:"gap-1 pe-0.5",title:o,children:[a(m,{className:"size-3"}),a("span",{className:"max-w-40 truncate",children:tt(o)}),a(e,{type:"button",variant:"ghost",size:"icon-xs",className:"size-4","aria-label":i("composer.removeMention",{name:tt(o)}),onClick:()=>s(o),children:a(r,{className:"size-3"})})]},o))})}
2
- export{Rn};
1
+ import{t}from"./chunk-vmywavgm.js";import{ze}from"./chunk-tv9wdbxr.js";import{e}from"./chunk-cg97byvk.js";import{tt}from"./chunk-jf5651fz.js";import{FileIcon as m,XIcon as r}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function fn({mentions:n,onRemove:s}){let{t:i}=t();if(n.length===0)return null;return a("div",{className:"mb-1.5 flex flex-wrap items-center gap-1.5",children:n.map((o)=>l(ze,{variant:"secondary",className:"gap-1 pe-0.5",title:o,children:[a(m,{className:"size-3"}),a("span",{className:"max-w-40 truncate",children:tt(o)}),a(e,{type:"button",variant:"ghost",size:"icon-xs",className:"size-4","aria-label":i("composer.removeMention",{name:tt(o)}),onClick:()=>s(o),children:a(r,{className:"size-3"})})]},o))})}
2
+ export{fn};
@@ -1,2 +1,2 @@
1
- import{useCallback as S,useLayoutEffect as C,useRef as I,useState as f}from"react";import{jsx as b}from"react/jsx-runtime";var y=30,s=32,g=6;function zt({sessionRows:t,viewport:r,renderRow:u}){let o=I(null),[c,m]=f({start:0,end:g}),[d,R]=f(()=>new Set),[E,M]=f(null),v=S((e,n)=>{R((a)=>{if(a.has(e)===n)return a;let l=new Set(a);if(n)l.add(e);else l.delete(e);return l})},[]),h=S(()=>{if(o.current===null||r===null)return;let e=r.getBoundingClientRect().top+r.clientTop-o.current.getBoundingClientRect().top,n=Math.max(0,Math.min(t.length,Math.floor(e/s)-g)),a=Math.max(n,Math.min(t.length,Math.ceil((e+r.clientHeight)/s)+g));m((l)=>l.start===n&&l.end===a?l:{start:n,end:a})},[t.length,r]);C(()=>h()),C(()=>{if(r===null)return;let e,n=()=>{if(e!==void 0)return;e=requestAnimationFrame(()=>{e=void 0,h()})},a=new ResizeObserver(n);if(a.observe(r),r.firstElementChild)a.observe(r.firstElementChild);return r.addEventListener("scroll",n,{passive:!0}),()=>{if(a.disconnect(),r.removeEventListener("scroll",n),e!==void 0)cancelAnimationFrame(e)}},[h,r]);let i=new Set;for(let e=c.start;e<Math.min(c.end,t.length);e++)i.add(e);if(t.length>0)i.add(0),i.add(t.length-1);if(t.forEach((e,n)=>{if(d.has(e.sessionId))i.add(n);if(E===e.sessionId)for(let a=Math.max(0,n-1);a<=Math.min(t.length-1,n+1);a++)i.add(a)}),t.length===0)return null;return b("div",{ref:o,"data-slot":"virtual-session-rows","data-count":t.length,className:"relative w-full",style:{height:t.length*s-(s-y)},children:[...i].toSorted((e,n)=>e-n).map((e)=>{let n=t[e];return b(T,{sessionRow:n,index:e,retainCard:v,onFocus:M,renderRow:u},n.sessionId)})})}function T({sessionRow:t,index:r,retainCard:u,onFocus:o,renderRow:c}){let m=S((d)=>u(t.sessionId,d),[u,t.sessionId]);return b("div",{"data-slot":"virtual-session-row",className:"absolute inset-x-0",style:{top:r*s,height:y},onFocusCapture:()=>o(t.sessionId),onBlurCapture:(d)=>{if(!d.currentTarget.contains(d.relatedTarget))o(null)},children:c(t,m)})}
2
- export{zt};
1
+ import{useCallback as S,useLayoutEffect as C,useRef as I,useState as f}from"react";import{jsx as b}from"react/jsx-runtime";var y=30,s=32,g=6;function Xt({sessionRows:t,viewport:r,renderRow:u}){let o=I(null),[c,m]=f({start:0,end:g}),[d,R]=f(()=>new Set),[E,M]=f(null),v=S((e,n)=>{R((a)=>{if(a.has(e)===n)return a;let l=new Set(a);if(n)l.add(e);else l.delete(e);return l})},[]),h=S(()=>{if(o.current===null||r===null)return;let e=r.getBoundingClientRect().top+r.clientTop-o.current.getBoundingClientRect().top,n=Math.max(0,Math.min(t.length,Math.floor(e/s)-g)),a=Math.max(n,Math.min(t.length,Math.ceil((e+r.clientHeight)/s)+g));m((l)=>l.start===n&&l.end===a?l:{start:n,end:a})},[t.length,r]);C(()=>h()),C(()=>{if(r===null)return;let e,n=()=>{if(e!==void 0)return;e=requestAnimationFrame(()=>{e=void 0,h()})},a=new ResizeObserver(n);if(a.observe(r),r.firstElementChild)a.observe(r.firstElementChild);return r.addEventListener("scroll",n,{passive:!0}),()=>{if(a.disconnect(),r.removeEventListener("scroll",n),e!==void 0)cancelAnimationFrame(e)}},[h,r]);let i=new Set;for(let e=c.start;e<Math.min(c.end,t.length);e++)i.add(e);if(t.length>0)i.add(0),i.add(t.length-1);if(t.forEach((e,n)=>{if(d.has(e.sessionId))i.add(n);if(E===e.sessionId)for(let a=Math.max(0,n-1);a<=Math.min(t.length-1,n+1);a++)i.add(a)}),t.length===0)return null;return b("div",{ref:o,"data-slot":"virtual-session-rows","data-count":t.length,className:"relative w-full",style:{height:t.length*s-(s-y)},children:[...i].toSorted((e,n)=>e-n).map((e)=>{let n=t[e];return b(T,{sessionRow:n,index:e,retainCard:v,onFocus:M,renderRow:u},n.sessionId)})})}function T({sessionRow:t,index:r,retainCard:u,onFocus:o,renderRow:c}){let m=S((d)=>u(t.sessionId,d),[u,t.sessionId]);return b("div",{"data-slot":"virtual-session-row",className:"absolute inset-x-0",style:{top:r*s,height:y},onFocusCapture:()=>o(t.sessionId),onBlurCapture:(d)=>{if(!d.currentTarget.contains(d.relatedTarget))o(null)},children:c(t,m)})}
2
+ export{Xt};
@@ -0,0 +1,2 @@
1
+ function Or(t,e){if(t.type||!e.type)return t;let o=e.type.split("/")[1],i=o!==void 0&&o!==""?`pasted-${Date.now()}.${o==="jpeg"?"jpg":o}`:"";return new File([t],t.name||i||`pasted-${Date.now()}`,{type:e.type})}function Io(t){let e=[],o=!1;for(let i of t){if(i.kind!=="file")continue;let n=i.getAsFile();if(!n)continue;if(!(n.type||i.type).startsWith("image/")){o=!0;continue}e.push(Or(n,i))}return{imageFiles:e,sawNonImageFile:o}}function Po(t){return[...t].some((e)=>e.kind==="string")}function s(t){let e=t.codePointAt(0);return e<32&&e!==9&&e!==10&&e!==13||e===127}function Fr(t){return[...t].filter((e)=>!s(e)).join("")}function yr(t,e){let o=0;for(let i=0;i<e;i++){let n=t.charCodeAt(i);if(n>=0&&n<=8||n===11||n===12||n>=14&&n<=31||n===127)o++}return o}function dt(t){let{value:e,selectionStart:o,selectionEnd:i}=t,n=Fr(e);if(n===e)return n;if(t.value=n,o!==null&&i!==null){let a=Math.max(0,o-yr(e,o)),r=Math.max(0,i-yr(e,i));requestAnimationFrame(()=>{t.setSelectionRange(a,r)})}return n}
2
+ export{Or,Io,Po,Fr,yr,dt};
@@ -0,0 +1,2 @@
1
+ import{j}from"./chunk-vmywavgm.js";import{createContext as v,useContext as C,useMemo as a}from"react";import{jsx as r}from"react/jsx-runtime";var i=v(null);function rt({host:o,client:e,children:t}){let s=a(()=>({host:o,client:e}),[o,e]);return r(j,{host:o,client:e,children:r(i,{value:s,children:t})})}function n(){let o=C(i);if(o===null)throw Error("Conversation host is missing");return o}function b(o,e){e.catch((t)=>{if(o.reportError)o.reportError(t);else console.error(t)})}
2
+ export{rt,n,b};
@@ -0,0 +1,2 @@
1
+ import{createContext as t,useContext as o}from"react";var Ct=t(null);function dr(){let e=o(Ct);if(e===null)throw Error("Composer is missing");return e}
2
+ export{Ct,dr};
@@ -1 +1 @@
1
- import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function On({className:t,...n}){return o("kbd",{"data-slot":"kbd",className:e("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",t),...n})}function Wr({className:t,...n}){return o("kbd",{"data-slot":"kbd-group",className:e("inline-flex items-center gap-1",t),...n})}export{On,Wr};
1
+ import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function Yo({className:t,...n}){return o("kbd",{"data-slot":"kbd",className:e("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",t),...n})}function vi({className:t,...n}){return o("kbd",{"data-slot":"kbd-group",className:e("inline-flex items-center gap-1",t),...n})}export{Yo,vi};
@@ -0,0 +1,4 @@
1
+ import{e}from"./chunk-cg97byvk.js";import{v}from"./chunk-kjtd3wc3.js";import{U,R}from"./chunk-5w48y2ad.js";import{C}from"./chunk-xjtqdp82.js";import{useId as w}from"react";import{jsx as r,jsxs as c,Fragment as Q}from"react/jsx-runtime";function a(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function p(n){if(!a(n)||!a(n.codex))return[];let s=n.codex,i=s.questions;if(s.delivery!=="async"||!Array.isArray(i))return[];if(!i.every((t)=>a(t)&&typeof t.title==="string"&&t.title.trim().length>0&&(t.options===null||Array.isArray(t.options)&&t.options.every((l)=>typeof l==="string"))))return[];return i}function Lt(n,s){return JSON.stringify(["request_user_input_async",n,s])}function io(n){return{selected:n.options?.length?0:null,text:""}}function Dt(n,s){return s.selected===null?s.text:n.options?.[s.selected]??""}function ao(n){return`<send_user_message_question_reply>
2
+ ${JSON.stringify([n])}
3
+ </send_user_message_question_reply>`}function _t(n){if(!a(n)||!a(n.codex))return[];let s=n.codex;return(Array.isArray(s.questionReplyParts)?s.questionReplyParts.map((t)=>a(t)?{...t,answer:t.text}:t):[s.questionReply]).filter((t)=>a(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:l,answer:d})=>({questionItemId:t,question:l,answer:d}))}function so({question:n,draft:s,status:i,answer:t,error:l,onChange:d,onSubmit:x,onSkip:f,t:o}){let g=w(),y=i==="pending",b=i==="answered"||i==="skipped";return c("section",{"aria-labelledby":`${g}-title`,className:"border-border bg-card text-card-foreground flex min-w-0 flex-col gap-3 rounded-xl border p-4",children:[r("h3",{id:`${g}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title}),b?r("p",{className:"text-sm whitespace-pre-wrap",children:i==="answered"?t:o("asyncQuestion.skipped")}):c(Q,{children:[(n.options?.length??0)>0&&c(U,{"aria-labelledby":`${g}-title`,disabled:!y,value:s.selected===null?"other":String(s.selected),onValueChange:(u)=>d({...s,selected:u==="other"?null:Number(u)}),children:[n.options?.map((u,m)=>c(v,{className:"flex items-start gap-2 text-sm",children:[r(R,{value:String(m)}),r("span",{className:"whitespace-pre-wrap",children:u})]},m)),c(v,{className:"flex items-center gap-2 text-sm",children:[r(R,{value:"other"}),o("asyncQuestion.other")]})]}),r(C,{"aria-label":o("asyncQuestion.answer"),placeholder:o("asyncQuestion.answer"),value:s.text,readOnly:!y,onChange:(u)=>d({selected:null,text:u.target.value})}),l&&r("p",{role:"alert",className:"text-destructive text-sm",children:l}),c("div",{className:"flex flex-wrap items-center gap-2",children:[r(e,{size:"sm",disabled:!y||Dt(n,s).trim().length===0,onClick:x,children:o(i==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")}),r(e,{size:"sm",variant:"ghost",disabled:!y,onClick:f,children:o("asyncQuestion.skip")}),(i==="closed"||i==="unavailable")&&r("span",{role:"status",className:"text-muted-foreground text-xs",children:o(`asyncQuestion.${i}`)})]})]})]})}
4
+ export{p,Lt,io,Dt,ao,_t,so};
@@ -1,2 +1,2 @@
1
- import{h}from"./chunk-1wc83vxg.js";import{t}from"./chunk-yx02h2ja.js";import{L}from"./chunk-h80g3eme.js";import{ContentBlock as i}from"@agentclientprotocol/sdk/experimental/v2/unstable";import{isEmbeddedResource as m,isResourceLink as u}from"@alwith/api";import{jsx as n}from"react/jsx-runtime";function d({block:e,streaming:o}){let r=t();if(i.isText(e)){if(e.text.length===0)return null;return n("div",{className:"codex-assistant-message",children:n(h,{text:e.text,streaming:o})})}if(i.isImage(e))return n(L,{block:e,generated:!0});if(i.isAudio(e))return n("audio",{controls:!0,src:`data:${e.mimeType};base64,${e.data}`});if(u(e)||m(e))return n(L,{block:e,generated:!0});return n("div",{className:"text-muted-foreground",children:r.t("timeline.unsupportedContent",{type:e.type})})}function Ct({content:e,messageId:o,streaming:r}){return e.map((s,a)=>n(d,{block:s,streaming:r},`${o}:${a}`))}
2
- export{Ct};
1
+ import{g}from"./chunk-3p9j3gmw.js";import{t}from"./chunk-vmywavgm.js";import{M}from"./chunk-zw2q13qg.js";import{ContentBlock as i}from"@agentclientprotocol/sdk/experimental/v2/unstable";import{isEmbeddedResource as m,isResourceLink as u}from"@alwith/api";import{jsx as n}from"react/jsx-runtime";function d({block:e,streaming:o}){let r=t();if(i.isText(e)){if(e.text.length===0)return null;return n("div",{className:"codex-assistant-message",children:n(g,{text:e.text,streaming:o})})}if(i.isImage(e))return n(M,{block:e,generated:!0});if(i.isAudio(e))return n("audio",{controls:!0,src:`data:${e.mimeType};base64,${e.data}`});if(u(e)||m(e))return n(M,{block:e,generated:!0});return n("div",{className:"text-muted-foreground",children:r.t("timeline.unsupportedContent",{type:e.type})})}function W({content:e,messageId:o,streaming:r}){return e.map((s,a)=>n(d,{block:s,streaming:r},`${o}:${a}`))}
2
+ export{W};
@@ -1,2 +1,2 @@
1
- async function co(g,u){try{let a=await(await fetch(g)).blob(),s=u??a.type??"";if(!s.startsWith("image/"))return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(a)});let w=s.includes("svg"),n,r,o;if(w){let e=new Image,t=URL.createObjectURL(a);e.src=t;try{await new Promise((h,f)=>{e.onload=()=>h(),e.onerror=()=>f(Error("svg load failed"))})}finally{URL.revokeObjectURL(t)}r=e.naturalWidth||1024,o=e.naturalHeight||1024,n=e}else{let e=await createImageBitmap(a);r=e.width,o=e.height,n=e}let i=Math.min(1,2000/Math.max(r,o)),c=Math.round(r*i),l=Math.round(o*i),d=new OffscreenCanvas(c,l),m=d.getContext("2d");if(!m)throw Error("image-encode: OffscreenCanvas 2d context 不可用");if(m.drawImage(n,0,0,c,l),n instanceof ImageBitmap)n.close();let b=await d.convertToBlob({type:"image/webp",quality:0.85});return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(b)})}catch{return null}}
2
- export{co};
1
+ async function _o(g,u){try{let a=await(await fetch(g)).blob(),s=u??a.type??"";if(!s.startsWith("image/"))return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(a)});let w=s.includes("svg"),n,r,o;if(w){let e=new Image,t=URL.createObjectURL(a);e.src=t;try{await new Promise((h,f)=>{e.onload=()=>h(),e.onerror=()=>f(Error("svg load failed"))})}finally{URL.revokeObjectURL(t)}r=e.naturalWidth||1024,o=e.naturalHeight||1024,n=e}else{let e=await createImageBitmap(a);r=e.width,o=e.height,n=e}let i=Math.min(1,2000/Math.max(r,o)),c=Math.round(r*i),l=Math.round(o*i),d=new OffscreenCanvas(c,l),m=d.getContext("2d");if(!m)throw Error("image-encode: OffscreenCanvas 2d context 不可用");if(m.drawImage(n,0,0,c,l),n instanceof ImageBitmap)n.close();let b=await d.convertToBlob({type:"image/webp",quality:0.85});return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(b)})}catch{return null}}
2
+ export{_o};
@@ -1,2 +1,2 @@
1
- import{so}from"./chunk-jnfp7j32.js";import{d,io,u,m}from"./chunk-cw68hvkc.js";import{cn as M}from"cn";import{XIcon as L}from"lucide-react";import{useCallback as O,useEffect as z,useMemo as j,useRef as H,useState as S}from"react";import{jsx as i,jsxs as A}from"react/jsx-runtime";function Jn({open:l,onOpenChange:P,url:h,filename:x,scale:v,onScaleChange:p,containerRef:T,containerClassName:I,dialogContentClassName:R,imageClassName:W}){let g=O((e)=>Math.min(4,Math.max(0.25,e)),[]),[Z,C]=S(1),o=g(v??Z),k=H(null),s=T??k,D=H(null),[f,N]=S({width:0,height:0}),[y,E]=S({width:0,height:0}),b=O((e)=>{let n=g(e);if(typeof p==="function"){p(n);return}C(n)},[p,g]);z(()=>{if(!l)return;if(!h)return;if(typeof v==="number")return;C(1)},[l,h,v]),z(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{N({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let X=O(()=>{b(1)},[b]),r=j(()=>{let{width:e,height:n}=y,{width:t,height:a}=f;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),w=e*c,_=n*c;return{width:w*o,height:_*o}},[o,y,f]);if(!h)return null;return i(d,{open:l,onOpenChange:P,children:A(u,{className:M("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",R),showCloseButton:!1,children:[i(m,{className:"sr-only",children:x||"Image preview"}),i(io,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(L,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=D.current,w=a&&c?so({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(b(t),a&&w)requestAnimationFrame(()=>{a.scrollTo(w)})},className:M("h-full w-full scrollbar-thin overflow-auto",I),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(f.width,r.width),height:Math.max(f.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:x||"image preview",className:M("block object-contain select-none",W),decoding:"async",draggable:!1,ref:D,onDoubleClick:X,onLoad:(e)=>{let n=e.currentTarget;E({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))N({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
2
- export{Jn};
1
+ import{$o}from"./chunk-y8qmxd0j.js";import{d,Zo,u,m}from"./chunk-p0ebmb2m.js";import{cn as M}from"cn";import{XIcon as L}from"lucide-react";import{useCallback as O,useEffect as z,useMemo as j,useRef as H,useState as S}from"react";import{jsx as i,jsxs as A}from"react/jsx-runtime";function Uo({open:l,onOpenChange:P,url:h,filename:x,scale:v,onScaleChange:p,containerRef:T,containerClassName:I,dialogContentClassName:R,imageClassName:W}){let g=O((e)=>Math.min(4,Math.max(0.25,e)),[]),[Z,C]=S(1),o=g(v??Z),k=H(null),s=T??k,D=H(null),[f,N]=S({width:0,height:0}),[y,E]=S({width:0,height:0}),b=O((e)=>{let n=g(e);if(typeof p==="function"){p(n);return}C(n)},[p,g]);z(()=>{if(!l)return;if(!h)return;if(typeof v==="number")return;C(1)},[l,h,v]),z(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{N({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let X=O(()=>{b(1)},[b]),r=j(()=>{let{width:e,height:n}=y,{width:t,height:a}=f;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),w=e*c,_=n*c;return{width:w*o,height:_*o}},[o,y,f]);if(!h)return null;return i(d,{open:l,onOpenChange:P,children:A(u,{className:M("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",R),showCloseButton:!1,children:[i(m,{className:"sr-only",children:x||"Image preview"}),i(Zo,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(L,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=D.current,w=a&&c?$o({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(b(t),a&&w)requestAnimationFrame(()=>{a.scrollTo(w)})},className:M("h-full w-full scrollbar-thin overflow-auto",I),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(f.width,r.width),height:Math.max(f.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:x||"image preview",className:M("block object-contain select-none",W),decoding:"async",draggable:!1,ref:D,onDoubleClick:X,onLoad:(e)=>{let n=e.currentTarget;E({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))N({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
2
+ export{Uo};
@@ -0,0 +1,2 @@
1
+ import{createContext as i,useContext as r}from"react";import{jsx as e}from"react/jsx-runtime";var n=i(null);function wo({host:t,children:o}){return e(n.Provider,{value:t,children:o})}function a(){let t=r(n);if(t===null)throw Error("Activity host is missing");return t}function g(t){let{Markdown:o}=a();return e(o,{...t})}
2
+ export{wo,a,g};
@@ -0,0 +1,2 @@
1
+ import{yo}from"./chunk-dhvpffgf.js";import{useCallback as xe,useEffect as P,useLayoutEffect as ye,useMemo as X,useRef as I,useState as E}from"react";import"@alwith/module-chat/navigation-rail.css";import{jsx as T,jsxs as Ne,Fragment as ke}from"react/jsx-runtime";var Se=4,ge=10;function we(h,x){let v=new Map(x.flatMap((c)=>c.itemIds.map((S)=>[S,c.key]))),p=Array(h.length),C;for(let c=h.length-1;c>=0;c--)C=v.get(h[c])??C,p[c]=C;let A=Math.max(-1,...x.map((c)=>c.key))+1,B=new Set,n=[];for(let[c,S]of h.entries()){let w=v.get(S),m=n.at(-1);if(!m||w!==void 0&&w!==m.key||w===void 0&&m.itemIds.length>=64&&p[c]!==m.key){let y=w!==void 0&&!B.has(w)?w:A++;m={key:y,startIndex:c,itemIds:[]},n.push(m),B.add(y)}m.itemIds.push(S)}return n}function fe(h,x){if(h.size!==x.size)return!1;for(let v of h)if(!x.has(v))return!1;return!0}function go({audio:h,beforeReveal:x,ensureItemMounted:v,items:p,onPreviewItem:C,renderPreview:A,onRevealError:B,scrollRoot:n,targetTopMarginPx:c=16}){let[S,w]=E(()=>{let e=p.at(-1);return new Set(e===void 0?[]:[e.id])}),[m,y]=E(null),[_,O]=E(null),[Z,R]=E(!1),[j,pe]=E(()=>new Set),[ve,be]=E(!0),[Ie,F]=E(null),{installUnlock:ee,preload:te,playSequence:ne}=h,K=I(null),M=I(null),U=I(!1),H=I(null),L=I(0),G=I(null),k=I(null),V=I(new Set),z=X(()=>p.map((e)=>e.id).join("\x00"),[p]),J=I(p);J.current=p;let ie=I(j),re=I(S),se=I({itemIdsKey:z,scrollRoot:n});if(se.current.scrollRoot!==n)L.current+=1,se.current={itemIdsKey:z,scrollRoot:n};let g=X(()=>v===void 0?p.filter((e)=>j.has(e.id)):p,[v,p,j]),ae=X(()=>g.map((e)=>({inputTokens:e.inputTokens,outputTokens:e.outputTokens})),[g]),D=I({ids:"",groups:[]}),oe=g.map((e)=>e.id).join("\x00");if(D.current.ids!==oe)D.current={ids:oe,groups:we(g.map((e)=>e.id),D.current.groups)};P(()=>ee(),[ee]),P(()=>()=>{if(L.current+=1,G.current?.cancel(),k.current!==null)clearTimeout(k.current)},[]),P(()=>{y(null),R(!1),O(null),M.current=null,U.current=!1,H.current=null,F(null),V.current.clear()},[n]),P(()=>{te()},[te]),P(()=>{if(n===null)return;let e=new Set,t=new Map,i=new Set(J.current.map((s)=>s.id)),r=()=>{let s=new Set(t.values()),d=J.current.filter((f)=>s.has(f.id)).map((f)=>f.id),o=d.findIndex((f)=>e.has(f));if(o===-1)return;let b=o;for(let f=o+1;f<d.length;f++)if(e.has(d[f]))b=f;let N=new Set(d.slice(o,b+1));if(fe(re.current,N))return;re.current=N,w(N)},a=new IntersectionObserver((s)=>{for(let d of s){let o=t.get(d.target);if(d.isIntersecting)e.add(o);else e.delete(o)}r()},{root:n,rootMargin:`-${c}px 0px 0px 0px`}),u=()=>{let s=new Set,d=new Set;for(let o of n.querySelectorAll("[data-content-search-unit-key]")){let b=o.dataset.contentSearchUnitKey;if(b===void 0||!i.has(b)||s.has(b))continue;s.add(b);let N=o.closest("[data-turn-key]"),f=N===null||d.has(N)?o:N;if(d.add(f),t.has(f))continue;t.set(f,b),a.observe(f)}for(let o of t.keys()){if(d.has(o))continue;a.unobserve(o),e.delete(t.get(o)),t.delete(o)}if(r(),fe(ie.current,s))return;ie.current=s,pe(s)};u();let l=new MutationObserver((s)=>{if(s.some((o)=>[...o.addedNodes,...o.removedNodes].some((b)=>b instanceof Element&&(b.matches("[data-turn-key], [data-content-search-unit-key]")||b.querySelector("[data-turn-key], [data-content-search-unit-key]")!==null))))u()});return l.observe(n,{childList:!0,subtree:!0}),()=>{l.disconnect(),a.disconnect()}},[z,n,c]);let Y=g.find((e)=>S.has(e.id))?.id??g.at(-1)?.id;ye(()=>{let e=K.current;if(e===null||M.current!==null||Y===void 0)return;let t=e.querySelector(`[data-timeline-user-message-navigation-item-id="${CSS.escape(Y)}"]`);if(t===null)return;let i=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(r.top<i.top)e.scrollTop+=r.top-i.top;else if(r.bottom>i.bottom)e.scrollTop+=r.bottom-i.bottom+1},[Y,z]),P(()=>{let e=n?.querySelector("[data-timeline-user-message-navigation-content]");if(!n||!e)return;let t=()=>{let r=n.getBoundingClientRect(),a=e.getBoundingClientRect();if(r.width===0||a.width===0)return;let u=n.offsetWidth>0?r.width/n.offsetWidth:1;be((a.left-r.left)/u>=48)},i=new ResizeObserver(t);return i.observe(n),i.observe(e),t(),()=>i.disconnect()},[n]);let he=xe(async(e,t="smooth")=>{if(n===null)throw Error("Thread user-message navigation scroll root is missing");let i=L.current+1;L.current=i,x();let r=()=>n.querySelector(`[data-content-search-unit-key="${CSS.escape(e.id)}"]`),a=r(),u=a!==null&&n.clientHeight>0&&a.closest("[data-turn-key]")!==null&&Math.abs(a.getBoundingClientRect().top-n.getBoundingClientRect().top)>n.clientHeight*2;if((a===null||u)&&v!==void 0){if(t==="instant"&&e.isLoaded===!1)return;a=await v(e,()=>L.current===i)??r(),t="instant"}if(L.current!==i)return;if(a===null)return;let l=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;a.scrollIntoView({behavior:l?"instant":t,block:"start"});let s=a.querySelector("[data-user-message-bubble], [data-composer-attachment-pill]");if(G.current?.cancel(),G.current=null,s===null)return;let d=getComputedStyle(s).backgroundColor,o=`color-mix(in srgb, var(--foreground) 14%, ${d})`;G.current=s.animate?.([{backgroundColor:o},{backgroundColor:o,offset:0.35},{backgroundColor:d}],{duration:l?0:1000,easing:"cubic-bezier(0.23, 1, 0.32, 1)"})??null},[x,v,n]);if(g.length<Se||!ve)return null;let Q=()=>{if(k.current!==null)clearTimeout(k.current);k.current=null},ue=(e,t=!1)=>{if(Q(),C===void 0||e.isLoaded!==!1||V.current.has(e.turnKey))return;let i=()=>{k.current=null,V.current.add(e.turnKey),C(e).catch(()=>V.current.delete(e.turnKey))};if(t)i();else k.current=setTimeout(i,150)},q=m===null?null:g.find((e)=>e.id===m.item.id)??g.find((e)=>e.nativeTurnId!==void 0&&e.nativeTurnId===m.item.nativeTurnId)??m.item,le=(e,t="smooth")=>{he(e,t).catch((i)=>{if(B)B(i);else throw i})},de=g.findIndex((e)=>e.id===(_??Ie)),ce=K.current,Te=m===null||!ce?.contains(m.button)?0:Me(ce,m.button),me=(e)=>{let t=e?.closest("[data-timeline-user-message-navigation-item-id]"),i=K.current;if(t===void 0||t===null||!i.contains(t))return null;let r=t.dataset.timelineUserMessageNavigationItemId,a=g.findIndex((u)=>u.id===r);return{button:t,item:g[a],index:a}},W=(e)=>{let t=M.current;if(t?.pointerId!==e.pointerId)return;if(M.current=null,O(null),t.captureTarget.hasPointerCapture(e.pointerId))t.captureTarget.releasePointerCapture(e.pointerId)};return T("nav",{"aria-label":"User messages",className:"timeline-user-message-navigation absolute start-4 top-1/2 z-20 -translate-y-1/2",children:T(yo,{open:Z,onOpenChange:R,side:"inline-end",sideOffset:0,align:"center",alignOffset:Te,trigger:T("div",{ref:K,"data-timeline-user-message-navigation-rail-list":!0,"data-scrubbing":_===null?void 0:"",className:"timeline-user-message-navigation-rail-list",onPointerEnter:()=>{H.current=null},onPointerDown:(e)=>{if(e.button!==0)return;Q();let t=me(e.target instanceof Element?e.target:null);if(t===null)return;U.current=!1,M.current={pointerId:e.pointerId,itemId:t.item.id,itemIndex:t.index,captureTarget:t.button},t.button.setPointerCapture(e.pointerId),O(t.item.id),y(t),R(!0)},onPointerMove:(e)=>{let t=M.current;if(t===null){let l=me(e.target instanceof Element?e.target:null);if(l!==null){F(l.item.id);let s=H.current;if(s!==null&&s!==l.index)ne(s,l.index,ae);H.current=l.index,y((d)=>d?.item.id===l.item.id?d:l),ue(l.item)}return}if(t.pointerId!==e.pointerId)return;if((e.buttons&1)===0){W(e);return}let i=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(g.length-1,Math.floor((e.clientY-i.top+e.currentTarget.scrollTop)/ge))),u={button:e.currentTarget.querySelectorAll("[data-timeline-user-message-navigation-item-id]")[r],item:g[r],index:r};if(u.item.id===t.itemId)return;ne(t.itemIndex,u.index,ae),H.current=u.index,M.current={...t,itemId:u.item.id,itemIndex:u.index},U.current=!0,O(u.item.id),y(u),le(u.item,"instant")},onPointerUp:W,onPointerCancel:W,onLostPointerCapture:W,onPointerLeave:()=>{if(Q(),F(null),H.current=null,M.current===null&&!Z)y(null)},children:T("div",{className:"flex flex-col",children:D.current.groups.map((e)=>T("div",{className:"flex w-9 shrink-0 flex-col [content-visibility:auto]",style:{height:e.itemIds.length*ge},children:g.slice(e.startIndex,e.startIndex+e.itemIds.length).map((t,i)=>{let r=e.startIndex+i,a=Math.abs(r-de),u=de===-1||a>3?void 0:[1,0.7,0.4,0.2][a];return T("button",{type:"button","data-timeline-user-message-navigation-item-id":t.id,"data-scrub-target":_===t.id?"":void 0,"aria-current":S.has(t.id)?"true":void 0,"aria-label":`Jump to user message ${r+1}`,className:"timeline-user-message-navigation-row",onClick:(l)=>{if(U.current){U.current=!1;return}let s={button:l.currentTarget,item:t,index:r};y(s),R(!0),le(t)},onFocus:(l)=>{ue(t,!0),y({button:l.currentTarget,item:t,index:r}),R(!0)},children:T("span",{className:"flex h-0.5 w-[30px] items-center",children:T("span",{className:"timeline-user-message-navigation-marker",style:u===void 0?void 0:{"--marker-progress":u}})})},t.id)})},e.key))})}),children:q!==null&&T("div",{className:"bg-popover/95 text-popover-foreground ring-border w-80 max-w-[calc(100vw-1rem)] overflow-hidden rounded-xl p-2 text-sm leading-5 shadow-xl ring-[0.5px] backdrop-blur-sm",children:A?A(q):Ne(ke,{children:[T("div",{className:"min-w-0 truncate font-medium",children:q.label}),q.response.length>0&&T("div",{className:"text-muted-foreground mt-1 line-clamp-3",children:q.response})]})})})})}function Me(h,x){let v=h.getBoundingClientRect(),p=x.getBoundingClientRect();return p.top+p.height/2-(v.top+v.height/2)}
2
+ export{go};
@@ -0,0 +1,2 @@
1
+ import{o}from"./chunk-vmywavgm.js";import{B,rn,z}from"./chunk-0vy9fzs3.js";import{e}from"./chunk-cg97byvk.js";import{fe,he,ve,xe}from"./chunk-5xjm1hab.js";import{rt,n,b}from"./chunk-1v3wc4cv.js";import{Qe}from"./chunk-dgx31pdr.js";import{je}from"./chunk-f59aepmd.js";import{Ge,We}from"./chunk-v8rqevms.js";import{Ve}from"./chunk-n514z4we.js";import{LockIcon as D,UnplugIcon as g}from"lucide-react";import{useMemo as A}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";function cr({host:t,client:l,...s}){let c=A(()=>t.openDiff?t:{...t,openDiff:Ge},[t]);return i(rt,{host:c,client:l,children:[r(R,{...s}),!t.openDiff&&r(We,{})]})}function R({session:t,header:l,overlay:s,timeline:c,composer:y,readOnlyActions:x,welcome:u,children:C,rootRef:N}){let{host:d,client:w}=n(),{t:a}=d,p=o((m)=>m.connection==="ready"),f=o((m)=>m.historyPages[t.id]?.error),v=()=>b(d,w.open(t.id,t.cwd)),h=t.items.length===0&&t.attached&&!t.restoring&&t.state==="idle";return i("div",{"data-chat-drop-zone":!0,ref:N,className:"flex h-full min-h-0 flex-col",children:[l,i("div",{className:"relative flex min-h-0 flex-1 flex-col","data-chat-content":!0,children:[s,p&&!t.attached&&!t.restoring&&!t.readOnly&&r("div",{className:"mx-auto my-3 w-full max-w-4xl px-4",children:i(B,{children:[r(g,{}),r(rn,{children:a("conversation.stopped")}),r(z,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),h?u??r(fe,{className:"flex-1",children:i(he,{children:[r(ve,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(xe,{children:a("conversation.welcomeDescription")})]})}):r(je,{session:t,timeline:c}),r(Ve,{sessionId:t.id}),t.readOnly?r("div",{className:"mx-auto w-full max-w-3xl shrink-0 px-6 pb-5","data-readonly-composer":!0,children:i(B,{className:"flex items-center justify-between gap-4 rounded-3xl px-5 py-4",children:[i("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[r(D,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("div",{className:"min-w-0 space-y-1",children:[r(rn,{children:a("conversation.readOnlyTitle")}),r(z,{children:a("conversation.readOnlyDescription")}),f&&r("p",{role:"alert",className:"text-destructive break-words",children:f})]})]}),i("div",{className:"border-border flex shrink-0 items-center gap-1 border-s ps-3","data-readonly-actions":!0,children:[r(e,{size:"sm",variant:"outline",className:"text-foreground cursor-pointer disabled:cursor-not-allowed",onClick:v,disabled:!p||t.restoring,children:a(t.restoring?"conversation.restoring":"conversation.readOnlyRetry")}),x]})]})}):y??r(Qe,{session:t})]}),C]})}
2
+ export{cr};
@@ -1,5 +1,5 @@
1
- import{Xt}from"./chunk-cgxcxfh1.js";import{t}from"./chunk-yx02h2ja.js";import{isDiffEntry as p}from"@alwith/api";import{jsx as f,jsxs as g,Fragment as h}from"react/jsx-runtime";function Rr(o,s){let e=o.split(/^(?=diff --git )/m).filter((i)=>i.length>0);if(e.length<=1)return o;return e.find((i)=>{let a=i.split(`
2
- `,1)[0]??"";return a.endsWith(` b/${s}`)||a.endsWith(` ${s}`)||a.includes(`/${s} `)})??o}function Er(o){let s=new Map,e=null;for(let n of o.split(`
3
- `)){if(n.startsWith("diff --git ")){e=null;continue}if(n.startsWith("+++ ")){let i=n.slice(4).trim(),a=i==="/dev/null"?null:i.replace(/^b\//,"");if(a!==null)e={additions:0,deletions:0},s.set(a,e);continue}if(n.startsWith("--- ")){let i=n.slice(4).trim();if(i!=="/dev/null"&&e===null)e={additions:0,deletions:0},s.set(i.replace(/^a\//,""),e);continue}if(e===null)continue;if(n.startsWith("+"))e.additions+=1;else if(n.startsWith("-"))e.deletions+=1}return s}function u(o,s){let e=s.replaceAll("\\","/");for(let[n,i]of o)if(e===n||e.endsWith(`/${n}`))return i;return{additions:0,deletions:0}}function Ar(o){let s=new Map;for(let e of o)for(let n of e.content){if(!p(n))continue;let i=n.patch?Er(n.patch.text):new Map;for(let a of n.changes){let r=typeof a.path==="string"?a.path:null;if(r===null)continue;let c=u(i,r),d=n.patch?Rr(n.patch.text,r):"",l=s.get(r);if(l)l.additions+=c.additions,l.deletions+=c.deletions,l.patch=l.patch?`${l.patch}
4
- ${d}`:d;else s.set(r,{path:r,patch:d,...c})}}return[...s.values()]}function wo({items:o}){let s=t(),{openDiff:e,FileIcon:n}=s;return f(Xt,{files:Ar(o),onOpen:e===void 0?void 0:(i)=>e({path:i.path,patch:i.patch}),renderPath:n===void 0?void 0:(i)=>g(h,{children:[f(n,{path:i.path,className:"codex-edited-file-icon"}),f("span",{className:"codex-edited-file-name",children:i.path})]})})}
5
- export{Rr,Er,Ar,wo};
1
+ import{zt}from"./chunk-ad32h099.js";import{t}from"./chunk-vmywavgm.js";import{isDiffEntry as p}from"@alwith/api";import{jsx as f,jsxs as g,Fragment as h}from"react/jsx-runtime";function Sr(o,s){let e=o.split(/^(?=diff --git )/m).filter((i)=>i.length>0);if(e.length<=1)return o;return e.find((i)=>{let a=i.split(`
2
+ `,1)[0]??"";return a.endsWith(` b/${s}`)||a.endsWith(` ${s}`)||a.includes(`/${s} `)})??o}function Nr(o){let s=new Map,e=null;for(let n of o.split(`
3
+ `)){if(n.startsWith("diff --git ")){e=null;continue}if(n.startsWith("+++ ")){let i=n.slice(4).trim(),a=i==="/dev/null"?null:i.replace(/^b\//,"");if(a!==null)e={additions:0,deletions:0},s.set(a,e);continue}if(n.startsWith("--- ")){let i=n.slice(4).trim();if(i!=="/dev/null"&&e===null)e={additions:0,deletions:0},s.set(i.replace(/^a\//,""),e);continue}if(e===null)continue;if(n.startsWith("+"))e.additions+=1;else if(n.startsWith("-"))e.deletions+=1}return s}function u(o,s){let e=s.replaceAll("\\","/");for(let[n,i]of o)if(e===n||e.endsWith(`/${n}`))return i;return{additions:0,deletions:0}}function Rr(o){let s=new Map;for(let e of o)for(let n of e.content){if(!p(n))continue;let i=n.patch?Nr(n.patch.text):new Map;for(let a of n.changes){let r=typeof a.path==="string"?a.path:null;if(r===null)continue;let c=u(i,r),d=n.patch?Sr(n.patch.text,r):"",l=s.get(r);if(l)l.additions+=c.additions,l.deletions+=c.deletions,l.patch=l.patch?`${l.patch}
4
+ ${d}`:d;else s.set(r,{path:r,patch:d,...c})}}return[...s.values()]}function Ln({items:o}){let s=t(),{openDiff:e,FileIcon:n}=s;return f(zt,{files:Rr(o),onOpen:e===void 0?void 0:(i)=>e({path:i.path,patch:i.patch}),renderPath:n===void 0?void 0:(i)=>g(h,{children:[f(n,{path:i.path,className:"codex-edited-file-icon"}),f("span",{className:"codex-edited-file-name",children:i.path})]})})}
5
+ export{Sr,Nr,Rr,Ln};
@@ -1,2 +1,2 @@
1
- import{nativeTurnId as a}from"@nyssance/codex-acp-v2/client";function bo(o,i){let u=new Set,s=(e)=>{let t=e.items.map(a).find((r)=>r!==null),n=e.items.every((r)=>r.replayed);if(t===void 0||u.has(t))return{turnKey:e.key,turn:e,deferUntilReady:n};return u.add(t),{turnKey:`history:${t}`,aliases:[e.key],turn:e,deferUntilReady:n}};if(!i?.complete)return o.map(s);let d=new Map;for(let e of o){let t=e.items.map(a).find((r)=>r!==null);if(t===void 0)continue;let n=d.get(t)??[];n.push(e),d.set(t,n)}let l=new Set(i.turns.map((e)=>e.turnId)),y=new Set(i.loadedTurnIds);return[...i.turns.flatMap((e)=>{let t=d.get(e.turnId);if(t)return t.map(s);return y.has(e.turnId)?[]:[{turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,estimatedHeightPx:320,placeholder:!0}]}),...o.filter((e)=>!e.items.some((t)=>l.has(a(t)??""))).map(s)]}
2
- export{bo};
1
+ import{nativeTurnId as a}from"@nyssance/codex-acp-v2/client";function Sn(o,i){let u=new Set,s=(e)=>{let t=e.items.map(a).find((r)=>r!==null),n=e.items.every((r)=>r.replayed);if(t===void 0||u.has(t))return{turnKey:e.key,turn:e,deferUntilReady:n};return u.add(t),{turnKey:`history:${t}`,aliases:[e.key],turn:e,deferUntilReady:n}};if(!i?.complete)return o.map(s);let d=new Map;for(let e of o){let t=e.items.map(a).find((r)=>r!==null);if(t===void 0)continue;let n=d.get(t)??[];n.push(e),d.set(t,n)}let l=new Set(i.turns.map((e)=>e.turnId)),y=new Set(i.loadedTurnIds);return[...i.turns.flatMap((e)=>{let t=d.get(e.turnId);if(t)return t.map(s);return y.has(e.turnId)?[]:[{turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,estimatedHeightPx:320,placeholder:!0}]}),...o.filter((e)=>!e.items.some((t)=>l.has(a(t)??""))).map(s)]}
2
+ export{Sn};
@@ -0,0 +1,2 @@
1
+ import{h,s,vt,r,S}from"./chunk-bse4zh1d.js";import{F}from"./chunk-cbbr9m3a.js";import{ht}from"./chunk-fv7tp8pr.js";import{ut}from"./chunk-key9msc9.js";import{Ae,mt}from"./chunk-1dce9zt8.js";import{hasRename as D}from"@nyssance/codex-acp-v2/client";import{ArchiveIcon as A,ArchiveRestoreIcon as H,GitForkIcon as N,PencilIcon as x,Trash2Icon as R}from"lucide-react";import{useRef as B,useState as y}from"react";import{jsx as n,jsxs as b,Fragment as C}from"react/jsx-runtime";function Yt({sessionRow:e,active:f,onSelect:u,onForked:p=u,onHoverCardOpenChange:a,actions:c}){let i=h(),{t:m,i18n:v}=i,k=s(),l=r((o)=>o.runStates[e.sessionId]),I=vt(),d=()=>u(e);return n(ht,{"data-session-id":e.sessionId,role:"button",tabIndex:0,active:f,onClick:d,onKeyDown:(o)=>{if(o.key==="Enter"||o.key===" ")o.preventDefault(),d()},state:l?.state,interruption:l?.interruption??null,title:e.title??m("sessionList.untitled"),onHoverCardOpenChange:a,hoverCard:n(E,{sessionRow:e,onDelete:()=>I(e),onForked:p,actions:c}),meta:e.updatedAt!==null?n("span",{className:"text-muted-foreground shrink-0 text-xs",children:Ae(e.updatedAt,v.language)}):void 0,actions:l!=null?n(ut,{title:m("sessionList.stop"),onStop:()=>S(i,k.stopSession(e.sessionId))}):void 0})}function E({sessionRow:e,onDelete:f,onForked:u,actions:p}){let a=h(),{t:c}=a,i=s(),m=r((t)=>D(t.agent)),v=r((t)=>t.connection==="ready"&&t.agent?.capabilities?.session?.fork!=null),[k,l]=y(!1),[I,d]=y(!1),o=B(!1);return n(mt,{sessionRow:e,renaming:k,onRename:(t)=>{if(l(!1),t!==null)S(a,i.renameSession(e.sessionId,t))},actions:b(C,{children:[m&&n(F,{icon:n(x,{}),label:c("sessionList.rename"),onClick:()=>l(!0)}),p,e.archived?n(F,{icon:n(H,{}),label:c("sessionList.unarchive"),onClick:()=>void S(a,i.unarchive(e.sessionId))}):b(C,{children:[n(F,{icon:n(N,{}),label:c("sessionList.fork"),disabled:!v||I,onClick:()=>{if(o.current)return;o.current=!0,d(!0),S(a,i.fork(e.sessionId,e.cwd).then((t)=>{let g=i.state.sessionList.find((L)=>L.sessionId===t);if(!g)throw Error("Forked chat is missing from the session list");u(g)}).finally(()=>{o.current=!1,d(!1)}))}}),n(F,{icon:n(A,{}),label:c("sessionList.archive"),onClick:()=>void S(a,i.archive(e.sessionId))})]}),n(F,{variant:"destructive",icon:n(R,{}),label:c("sessionList.delete"),onClick:f})]})})}
2
+ export{Yt};
@@ -0,0 +1,2 @@
1
+ import{Et}from"./chunk-s1vxbxzr.js";async function Zn(i,c){let s=new WeakSet;while(!c.aborted){let r=Array.from(i.querySelectorAll('[data-codex-disclosure][aria-expanded="false"]')).filter((e)=>!s.has(e)&&!e.matches(":disabled"));for(let e of r)s.add(e),e.click();if(r.length===0&&i.querySelector("[data-markdown-pending]")===null)return;await new Promise((e)=>requestAnimationFrame(()=>e()))}}function ct(i,c){if(!c)return[];let s=[],r="",e=[],o=()=>{let t=0,n=0;for(let{start:a,end:l}of Et(r,c)){while(t<e.length&&e[t].end<=a)t++;n=Math.max(n,t);while(n<e.length&&e[n].end<l)n++;let d=e[t],f=e[n];if(!d||!f)throw Error("Search text offset has no DOM node");let h=document.createRange();h.setStart(d.node,a-d.start),h.setEnd(f.node,l-f.start),s.push(h)}r="",e=[]},m=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DIV","DL","DT","DD","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","TABLE","TD","TH","TR","UL"]),u=(t)=>{if(t.nodeType===Node.TEXT_NODE){let a=t.parentElement;if(!a||a.offsetParent===null&&a.tagName!=="BODY")return;let l=t.nodeValue??"";e.push({node:t,start:r.length,end:r.length+l.length}),r+=l;return}if(!(t instanceof Element))return;if(t.matches("script, style, [hidden], [aria-hidden='true']")){o();return}if(t.tagName==="BR"){o();return}let n=m.has(t.tagName);if(n)o();for(let a of t.childNodes)u(a);if(n)o()};return u(i),o(),s}
2
+ export{Zn,ct};
@@ -1,3 +1,3 @@
1
- import{html as n}from"diff2html";import{ColorSchemeType as r}from"diff2html/lib/types";import{useMemo as s}from"react";import{jsx as a}from"react/jsx-runtime";function An(e){let t=0,i=0;for(let o of e.split(`
2
- `)){if(o.startsWith("+++")||o.startsWith("---"))continue;if(o.startsWith("+"))t+=1;else if(o.startsWith("-"))i+=1}return{additions:t,deletions:i}}function Ie({patch:e,theme:t}){let i=s(()=>n(e,{drawFileList:!1,outputFormat:"line-by-line",matching:"lines",colorScheme:t==="dark"?r.DARK:r.LIGHT}),[e,t]);return a("div",{className:"codex-patch-view",dangerouslySetInnerHTML:{__html:i}})}
3
- export{An,Ie};
1
+ import{html as n}from"diff2html";import{ColorSchemeType as r}from"diff2html/lib/types";import{useMemo as s}from"react";import{jsx as a}from"react/jsx-runtime";function oo(e){let t=0,i=0;for(let o of e.split(`
2
+ `)){if(o.startsWith("+++")||o.startsWith("---"))continue;if(o.startsWith("+"))t+=1;else if(o.startsWith("-"))i+=1}return{additions:t,deletions:i}}function Se({patch:e,theme:t}){let i=s(()=>n(e,{drawFileList:!1,outputFormat:"line-by-line",matching:"lines",colorScheme:t==="dark"?r.DARK:r.LIGHT}),[e,t]);return a("div",{className:"codex-patch-view",dangerouslySetInnerHTML:{__html:i}})}
3
+ export{oo,Se};
@@ -1 +1 @@
1
- import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function V({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function M({className:r,...a}){return i(e.Root,{"data-slot":"radio-group-item",className:o("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:i(e.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{V,M};
1
+ import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function U({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function R({className:r,...a}){return i(e.Root,{"data-slot":"radio-group-item",className:o("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:i(e.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{U,R};
@@ -1 +1 @@
1
- import{cva as o}from"class-variance-authority";import{cn as n}from"cn";import{jsx as a}from"react/jsx-runtime";function ae({className:e,...t}){return a("div",{"data-slot":"empty",className:n("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-lg border-dashed p-12 text-center text-balance",e),...t})}function se({className:e,...t}){return a("div",{"data-slot":"empty-header",className:n("flex max-w-sm flex-col items-center gap-2",e),...t})}var i=o("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function ti({className:e,variant:t="default",...r}){return a("div",{"data-slot":"empty-icon","data-variant":t,className:n(i({variant:t,className:e})),...r})}function le({className:e,...t}){return a("div",{"data-slot":"empty-title",className:n("font-heading text-lg font-medium tracking-tight",e),...t})}function ce({className:e,...t}){return a("div",{"data-slot":"empty-description",className:n("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function ni({className:e,...t}){return a("div",{"data-slot":"empty-content",className:n("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",e),...t})}export{ae,se,ti,le,ce,ni};
1
+ import{cva as o}from"class-variance-authority";import{cn as n}from"cn";import{jsx as a}from"react/jsx-runtime";function fe({className:e,...t}){return a("div",{"data-slot":"empty",className:n("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-lg border-dashed p-12 text-center text-balance",e),...t})}function he({className:e,...t}){return a("div",{"data-slot":"empty-header",className:n("flex max-w-sm flex-col items-center gap-2",e),...t})}var i=o("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function Ii({className:e,variant:t="default",...r}){return a("div",{"data-slot":"empty-icon","data-variant":t,className:n(i({variant:t,className:e})),...r})}function ve({className:e,...t}){return a("div",{"data-slot":"empty-title",className:n("font-heading text-lg font-medium tracking-tight",e),...t})}function xe({className:e,...t}){return a("div",{"data-slot":"empty-description",className:n("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Pi({className:e,...t}){return a("div",{"data-slot":"empty-content",className:n("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",e),...t})}export{fe,he,Ii,ve,xe,Pi};
@@ -0,0 +1,2 @@
1
+ import{p}from"./chunk-2w9f1q84.js";import{textOf as A,turns as S}from"@alwith/api";import{codexMessageError as _,nativeTurnId as y}from"@nyssance/codex-acp-v2/client";function Er(t){return t.kind==="tool"&&t.name==="mcp_startup"}function E(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let n=e.phase;return typeof n==="string"?n:null}function w(t){let e=t._meta?.codex;return typeof e==="object"&&e!==null&&e.notice===!0}function Hn(t){return t.user===null&&t.items.length>0&&t.items.every((e)=>e.kind==="assistant"&&w(e))}function T(t,e,n){let o=t.work.at(-1);if(o?.kind==="activity"&&o.items.at(-1)===n){o.items.push(e);return}t.work.push({kind:"activity",key:`activity:${e.kind}:${e.id}`,items:[e]})}function M(t,e,n){if(t.kind!=="tool"){e.push(t);return}let o=n.get(t.id);if(o===void 0)throw Error(`Grouped tool is missing from the session: ${t.id}`);e.push(o);for(let s of t.children)M(s,e,n)}function j(t,e,n,o){switch(e.kind){case"user":break;case"assistant":{if(_(e)!==null){let u=y(e),f=t.errors.findIndex((m)=>u!==null&&y(m)===u);if(f===-1)t.errors.push(e);else t.errors[f]=e;break}let s=E(e),i=e._meta?.codex,d=p(e._meta).length>0||typeof i==="object"&&i!==null&&"delivery"in i&&i.delivery==="async";if(p(e._meta).length>0)t.final.push(e);else if(d)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else if(s==="final_answer")t.final.push(e);else if(s==="commentary"||w(e)||s===null&&n)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else t.final.push(e);break}case"thought":T(t,e,o);break;case"tool":if(T(t,e,o),e.toolKind==="edit")t.edits.push(e);break;case"plan":t.work.push({kind:"plan",key:`plan:${e.id}`,item:e});break;case"compaction":t.work.push({kind:"compaction",key:`compaction:${e.id}`,item:e});break}}function On(t,e=[],n=[]){let o=new Map(e.map((r)=>[r.key,r])),s=new Map(t.items.filter((r)=>r.kind==="tool").map((r)=>[r.id,r])),i={...t,items:t.items.filter((r)=>!Er(r))},d=new Map(n.map((r,a)=>[r.turnId,a])),u=[],f=[u],m,I=null;for(let r of i.items){let a=y(r),l=d.get(a??"");if(a!==null&&I!==null&&a!==I||l!==void 0&&m!==void 0&&l>m+1)u=[],f.push(u);if(u.push(r),a!==null||r.kind==="user")I=a;if(l!==void 0)m=l}return f.flatMap((r)=>S({...i,items:r})).map((r)=>{let a=r.prompt===null?[]:[r.prompt];for(let c of r.entries)M(c,a,s);let l=a[0];if(l===void 0)throw Error("A turn without items");let h=`turn:${l.kind}:${l.id}`,b=r.endedAt??Math.max(...a.map((c)=>c.at)),k=o.get(h);if(k!==void 0&&K(k.items,a)&&k.endedAt===b)return k;let g={key:h,user:r.prompt,work:[],final:[],errors:[],edits:[],startedAt:r.startedAt??l.at,endedAt:b,replayed:a.every(Nt),items:a},v=a.findLastIndex((c)=>c.kind!=="user"&&c.kind!=="compaction");return a.forEach((c,x)=>j(g,c,x<v,a[x-1])),g})}function K(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}function Nt(t){let e=t._meta?.codex;return t.replayed||typeof e==="object"&&e!==null&&"historyReplay"in e&&e.historyReplay===!0}function D(t){return A(t.content)}function Ie(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function Rt(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function Fn(t){let e=(s)=>{for(let i of t.items){let d=i._meta?.codex;if(typeof d!=="object"||d===null)continue;let u=d[s];if(typeof u==="number"&&Number.isFinite(u)&&u>=0)return u}return},n=e("workDurationMs"),o=e("turnDurationMs");return{durationMs:n??o,durationKind:n===void 0&&o!==void 0?"total":"work",startedAt:e("workStartedAt")}}function Bn(t,e,n){if(n?.user==null)return!1;let o=e.items.map(y).find((i)=>i!==null),s=y(n.user);if(o!==void 0&&s!==null)return o===s;return!e.items.some((i)=>{let d=i._meta?.codex;return typeof d==="object"&&d!==null&&"turnCompletedAt"in d&&typeof d.turnCompletedAt==="number"})&&t.state!=="idle"&&(n.user.echo==="pending"||n.user.echo==="acknowledged")&&e.user!==null&&t.turnEndedAt[e.user.id]===void 0&&e.errors.length===0}function zn(t,e){if(t.state==="idle")return;let n=e.length-1;while(n>0){let o=e[n];if(o.items.some((s)=>s.kind!=="user"))break;if(!Bn(t,e[n-1],o))break;n--}return e[n]?.key}function Un(t,e,n){let o=n,s=n;while(o>0&&Bn(t,e[o-1],e[o]))o--;while(s+1<e.length&&Bn(t,e[s],e[s+1]))s++;let i=e.slice(o,s+1),d=i.findLast((u)=>u.items.some((f)=>f.kind!=="user"))??i[0];return{continued:e[n]!==d,items:i.flatMap((u)=>u.items),edits:i.flatMap((u)=>u.edits),startedAt:i[0].startedAt}}
2
+ export{Er,Hn,On,Nt,D,Ie,Rt,Fn,Bn,zn,Un};
@@ -1,2 +1,2 @@
1
- import{createContext as d,useCallback as n,useContext as i,useEffect as V,useMemo as q,useRef as g,useState as z}from"react";import{jsx as D}from"react/jsx-runtime";var F=d(null),St=d(null);function $r(){return i(St)}var Nt=d(null);function qr(){return i(Nt)}var we=d(null);function Ce(){let r=i(F);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var ke=()=>i(F);function Vr(){let r=i(we);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var X=()=>i(we);function In({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:A,attachmentPolicy:f,value:R,onValueChange:y,attachments:U,onAttachmentsChange:L,children:B}){let S=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),T=R!==void 0,[G,J]=z(r),p=R??G,o=g({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let W=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,T)y?.(t);else J(t)},[T,y]),h=n(()=>P(""),[P]),x=U!==void 0,[K,N]=z([]),I=U??K,b=g(I);b.current=I;let s=n((t)=>{let e=typeof t==="function"?t(b.current):t;if(x)L?.(e);else N(e)},[x,L]),j=g(null),w=g(()=>{}),O=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let _=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:S(u),filename:u.name,size:u.size,lastModified:u.lastModified,..._===void 0?{}:{sourcePath:_}}})]})},[f,S,s]),M=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),A?.()},[A,s]),E=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);V(()=>{if(x)return;return()=>{for(let t of b.current)if(t.url)URL.revokeObjectURL(t.url)}},[x]);let k=n(()=>{w.current?.()},[]),C=q(()=>({files:I,add:O,remove:M,clear:E,openFileDialog:k,fileInputRef:j}),[I,O,M,E,k]),H=n((t,e)=>{j.current=t.current,w.current=e},[]),Q=q(()=>({textInput:{value:p,setInput:P,clear:h,getRevision:W,clearSubmitted:c??h},attachments:C,__registerFileInput:H}),[p,P,h,W,c,C,H]);return D(F.Provider,{value:Q,children:D(we.Provider,{value:C,children:B})})}var Mt=d(null);function v(){let r=X(),l=i(Mt),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
- export{St,$r,Nt,qr,we,Ce,ke,Vr,In,Mt,v};
1
+ import{createContext as d,useCallback as n,useContext as i,useEffect as V,useMemo as q,useRef as g,useState as z}from"react";import{jsx as D}from"react/jsx-runtime";var F=d(null),jt=d(null);function li(){return i(jt)}var Kt=d(null);function ci(){return i(Kt)}var Re=d(null);function Me(){let r=i(F);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var Ee=()=>i(F);function di(){let r=i(Re);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var X=()=>i(Re);function zo({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:A,attachmentPolicy:f,value:R,onValueChange:y,attachments:U,onAttachmentsChange:L,children:B}){let S=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),T=R!==void 0,[G,J]=z(r),p=R??G,o=g({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let W=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,T)y?.(t);else J(t)},[T,y]),h=n(()=>P(""),[P]),v=U!==void 0,[K,N]=z([]),I=U??K,b=g(I);b.current=I;let s=n((t)=>{let e=typeof t==="function"?t(b.current):t;if(v)L?.(e);else N(e)},[v,L]),j=g(null),w=g(()=>{}),O=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let _=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:S(u),filename:u.name,size:u.size,lastModified:u.lastModified,..._===void 0?{}:{sourcePath:_}}})]})},[f,S,s]),M=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),A?.()},[A,s]),E=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);V(()=>{if(v)return;return()=>{for(let t of b.current)if(t.url)URL.revokeObjectURL(t.url)}},[v]);let k=n(()=>{w.current?.()},[]),C=q(()=>({files:I,add:O,remove:M,clear:E,openFileDialog:k,fileInputRef:j}),[I,O,M,E,k]),H=n((t,e)=>{j.current=t.current,w.current=e},[]),Q=q(()=>({textInput:{value:p,setInput:P,clear:h,getRevision:W,clearSubmitted:c??h},attachments:C,__registerFileInput:H}),[p,P,h,W,c,C,H]);return D(F.Provider,{value:Q,children:D(Re.Provider,{value:C,children:B})})}var Qt=d(null);function x(){let r=X(),l=i(Qt),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
+ export{jt,li,Kt,ci,Re,Me,Ee,di,zo,Qt,x};
@@ -1,2 +1,2 @@
1
- class s{worker=new Worker(new URL("@alwith/module-chat/code-highlighter.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(i)=>{let e=this.active,t=i.data;if(t.clientId!==e?.clientId||t.revision!==e.revision){this.fail(Error("Code highlighting worker returned an unexpected request"));return}if(this.active=null,!t.ok){this.fail(Error(t.error));return}let r=this.clients.get(e.clientId);if(r?.revision===e.revision)r.onResult({code:e.code,language:e.language,html:t.html});this.dispatch()},this.worker.onerror=(i)=>this.fail(Error(i.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize code highlighting result"))}fail(i){this.failure=i,this.worker.terminate(),this.pending.clear(),this.active=null;for(let e of this.clients.values())e.onError(i)}dispatch(){if(this.active!==null||this.pending.size===0)return;let i=this.pending.values().next().value;this.pending.delete(i.clientId),this.active=i;try{this.worker.postMessage(i)}catch(e){this.fail(e instanceof Error?e:Error(String(e)))}}connect(i,e){if(this.failure!==null)throw this.failure;let t=++this.nextClientId,r={revision:0,onResult:i,onError:e};return this.clients.set(t,r),{update:(o,l)=>{if(this.failure!==null)throw this.failure;r.revision+=1,this.pending.set(t,{clientId:t,revision:r.revision,code:o,language:l}),this.dispatch()},dispose:()=>{if(this.clients.delete(t),this.pending.delete(t),this.clients.size===0)this.worker.terminate(),n=void 0}}}}var n;function Vo(i,e){return n??=new s,n.connect(i,e)}
2
- export{Vo};
1
+ class s{worker=new Worker(new URL("@alwith/module-chat/code-highlighter.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(i)=>{let e=this.active,t=i.data;if(t.clientId!==e?.clientId||t.revision!==e.revision){this.fail(Error("Code highlighting worker returned an unexpected request"));return}if(this.active=null,!t.ok){this.fail(Error(t.error));return}let r=this.clients.get(e.clientId);if(r?.revision===e.revision)r.onResult({code:e.code,language:e.language,html:t.html});this.dispatch()},this.worker.onerror=(i)=>this.fail(Error(i.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize code highlighting result"))}fail(i){this.failure=i,this.worker.terminate(),this.pending.clear(),this.active=null;for(let e of this.clients.values())e.onError(i)}dispatch(){if(this.active!==null||this.pending.size===0)return;let i=this.pending.values().next().value;this.pending.delete(i.clientId),this.active=i;try{this.worker.postMessage(i)}catch(e){this.fail(e instanceof Error?e:Error(String(e)))}}connect(i,e){if(this.failure!==null)throw this.failure;let t=++this.nextClientId,r={revision:0,onResult:i,onError:e};return this.clients.set(t,r),{update:(o,l)=>{if(this.failure!==null)throw this.failure;r.revision+=1,this.pending.set(t,{clientId:t,revision:r.revision,code:o,language:l}),this.dispatch()},dispose:()=>{if(this.clients.delete(t),this.pending.delete(t),this.clients.size===0)this.worker.terminate(),n=void 0}}}}var n;function vo(i,e){return n??=new s,n.connect(i,e)}
2
+ export{vo};
@@ -0,0 +1,2 @@
1
+ import{p,Lt,io,Dt,ao,_t,so}from"./chunk-2w9f1q84.js";import{t,K,re,o}from"./chunk-vmywavgm.js";import{W}from"./chunk-34xzrr3s.js";import{isText as k}from"@alwith/api";import{createStore as E}from"@alwith/api/client";import{nativeTurnId as v}from"@nyssance/codex-acp-v2/client";import{jsx as g}from"react/jsx-runtime";var x=E({entries:{}});function l(i,e){x.setState((n)=>({entries:{...n.entries,[i]:e}}))}function q(i,e){let n=v(e),a=i.items.findLast((s)=>v(s)!==null);return!e.replayed&&n!==null&&a!==void 0&&v(a)===n}function M(i,e){for(let n of i.items){if(n.kind!=="user"||n.echo==="pending")continue;for(let a of[..._t(n._meta),...n.content.filter(k).flatMap((s)=>_t(s._meta))])if(a.questionItemId===e)return a.answer}return}function O({sessionId:i,item:e,question:n,index:a}){let s=K(),{t:m}=t(),S=Lt(e.id,a),d=JSON.stringify([i,S]),u=re(x,(r)=>r.entries[d]),c=o((r)=>r.sessions[i]),A=o((r)=>r.connection==="ready"),f=u?.draft??io(n),b=c===void 0?u?.accepted:M(c,S)??u?.accepted,h=c!==void 0&&q(c,e),D=A&&c?.attached&&!c.restoring&&!c.readOnly,y=b!==void 0?"answered":u?.skipped?"skipped":u?.pending?"submitting":!h?"closed":!D?"unavailable":"pending",C=async()=>{if(x.getState().entries[d]?.pending||y!=="pending")return;let r=s.state.sessions[i];if(r===void 0||!q(r,e)||!r.attached||r.readOnly||r.restoring)return;let I=Dt(n,f);if(!I.trim())return;let w={questionItemId:S,question:n.title,answer:I};l(d,{draft:f,pending:!0});try{await s.prompt(i,[{type:"text",text:ao(w),_meta:{codex:{questionReply:w}}}]),l(d,{draft:f,accepted:I})}catch(Q){l(d,{draft:f,error:Q instanceof Error?Q.message:String(Q)})}};if(y==="closed")return null;return g(so,{question:n,draft:f,status:y,answer:b,error:y==="pending"?u?.error:void 0,t:m,onChange:(r)=>l(d,{draft:r}),onSkip:()=>l(d,{draft:f,skipped:!0}),onSubmit:()=>{C()}})}function It({sessionId:i,item:e}){let n=o((s)=>s.sessions[i]),a=p(e._meta);if(n===void 0||n.readOnly||!q(n,e))return g(W,{content:e.content.some((s)=>!k(s)||s.text.trim().length>0)?e.content:a.map((s)=>({type:"text",text:s.title})),messageId:e.id,streaming:!1});return g("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":e.id,children:a.map((s,m)=>g(O,{sessionId:i,item:e,question:s,index:m},Lt(e.id,m)))})}
2
+ export{It};
@@ -1,2 +1,2 @@
1
- import{ao,Y}from"./chunk-0pa5t12s.js";import{Zn}from"./chunk-jdv29apq.js";import{Qn,Dt,_t}from"./chunk-e3mkvx24.js";import{St,Nt,we,ke,Mt}from"./chunk-j4teycge.js";import{cn as P}from"cn";import{ArrowUpIcon as fe,Loader2Icon as ge,SquareIcon as be,XIcon as ve}from"lucide-react";import{Children as Z,useCallback as h,useEffect as F,useMemo as he,useRef as M,useState as Pe}from"react";import{flushSync as Ie}from"react-dom";import{jsx as a,jsxs as ye}from"react/jsx-runtime";function ee(u){let o=new FormData(u).get("message");return typeof o==="string"?o:""}var bn=({className:u,bashMode:o=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:E,multiple:te,globalDrop:C,syncHiddenInput:U,maxFiles:z,maxFileSize:H,onError:b,onSubmit:re,children:ne,...oe})=>{let s=ke(),l=!!s,se=o&&l&&s.textInput.value.startsWith("!"),x=M(null),A=M(null),k=M(!1),[ie,N]=Pe([]),c=l?s.attachments.files:ie,B=M(c);B.current=c;let ae=h(()=>{x.current?.click()},[]),O=h((e)=>{if(!E||E.trim()==="")return!0;return E.split(",").map((t)=>t.trim()).filter(Boolean).some((t)=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t})},[E]),W=h((e)=>{if(e.type)return e.type;let r=(e.name||"").toLowerCase();if(r.endsWith(".png"))return"image/png";if(r.endsWith(".jpg")||r.endsWith(".jpeg"))return"image/jpeg";if(r.endsWith(".webp"))return"image/webp";if(r.endsWith(".gif"))return"image/gif";if(r.endsWith(".bmp"))return"image/bmp";if(r.endsWith(".svg"))return"image/svg+xml";return""},[]),ue=h((e)=>{let r=[...e],t=r.filter((i)=>O(i));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(i)=>H?i.size<=H:!0,m=t.filter(n);if(t.length>0&&m.length===0){b?.({code:"max_file_size",message:"All files exceed the maximum size."});return}N((i)=>{let v=I?I.uniqueFiles(m,i):m,p=typeof z==="number"?Math.max(0,z-i.length):void 0,_=typeof p==="number"?v.slice(0,p):v;if(typeof p==="number"&&v.length>p)b?.({code:"max_files",message:"Too many files. Some were not added."});let Q=[];for(let T of _){let V=I?.sourcePath(T);Q.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(T),mediaType:W(T),filename:T.name,size:T.size,lastModified:T.lastModified,...V===void 0?{}:{sourcePath:V}})}return[...i,...Q]})},[I,W,O,z,H,b]),le=h((e)=>N((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),pe=h(()=>N((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),G=l?s.attachments.add:ue,L=h((e)=>{let r=[...e],t=r.filter((m)=>!(m.type??"").toLowerCase().startsWith("image/"));if(t.length>0){b?.({code:"unsupported_type",message:`Only image attachments are supported. ${t.length} non-image file(s) were ignored.`});return}let n=r.reduce((m,i)=>m+i.size,0);if(n>0){let m=c.filter((i)=>(i.mediaType??"").toLowerCase().startsWith("image/")).reduce((i,v)=>i+(v.size??0),0);if(ao(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${Y}MB.`});return}}G(r)},[c,G,b]),j=l?s.attachments.remove:le,R=l?s.attachments.clear:pe,q=l?s.attachments.openFileDialog:ae;F(()=>{if(!l)return;s.__registerFileInput(x,()=>x.current?.click())},[l,s]),F(()=>{if(U&&x.current&&c.length===0)x.current.value=""},[c,U]),F(()=>{let e=A.current;if(!e)return;if(C)return;let r=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault()},t=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault();if(n.dataTransfer?.files&&n.dataTransfer.files.length>0)L(n.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",t),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",t)}},[L,C]),F(()=>{if(!C)return;let e=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault()},r=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault();if(t.dataTransfer?.files&&t.dataTransfer.files.length>0)L(t.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[L,C]),F(()=>()=>{if(!l){for(let e of B.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let me=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},X=he(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:j,clear:R,openFileDialog:q,fileInputRef:x}),[c,L,j,R,q]),w=M({controller:s,files:c,canSubmit:f});w.current={controller:s,files:c,canSubmit:f};let S=M(!0);F(()=>(S.current=!0,()=>{S.current=!1}),[]);let J=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(k.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=A.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?s.textInput.value:ee(t),m=s?.textInput.getRevision?.(),i=c,v=()=>{if(!S.current)return;let p=w.current;if(p.files!==i)return;if(l){if(m===void 0||p.controller===null||p.controller.textInput.getRevision?.()!==m)return;if(p.controller.textInput.clearSubmitted===void 0)p.controller.textInput.clear();else p.controller.textInput.clearSubmitted()}else if(ee(t)===n)t.reset();R()};k.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await Zn(i),_=w.current.canSubmit===void 0?!0:w.current.canSubmit();if(_!==!0)return{status:"blocked",reason:_};if(!S.current)return{status:"blocked",reason:"form_unmounted"};if(p.rejectedCount>0)b?.({code:"accept",message:"One or more images are corrupted and were removed before sending."});if(g!==void 0)await g({text:n,files:p.files});else if(e!==null)await re({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{k.current=!1}},ce=(e)=>{e.preventDefault(),J(e).catch(y)},de=h((e)=>{if(!e.trim())return;if(l&&s)Ie(()=>{s.textInput.setInput(e)});A.current?.requestSubmit()},[s,l]),K=a(Nt.Provider,{value:()=>J(null),children:ye(St.Provider,{value:de,children:[a("input",{accept:E,"aria-label":"Upload files",className:"hidden",multiple:te,onChange:me,ref:x,title:"Upload files",type:"file"}),a("form",{className:P("w-full",u),onSubmit:ce,ref:A,"data-tour":"chat-input",...oe,children:a(Qn,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",se&&"border! border-[rgb(255,0,135)] has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(255,0,135)] dark:border-[rgb(253,93,177)] dark:has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(253,93,177)]"),children:ne})})]})});return l?a(we.Provider,{value:X,children:K}):a(Mt.Provider,{value:X,children:K})};function wn({className:u,...o}){return a("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...o})}function Cn({className:u,...o}){return a(Dt,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...o})}function kn({className:u,...o}){return a(Dt,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...o})}function Tn({className:u,...o}){return a("div",{className:P("flex items-center gap-1",u),...o})}var D=({variant:u="ghost",className:o,size:I,collapsed:d=!1,...y})=>{let f=d||Z.count(y.children)<=1?"icon-xs":"xs";return a(_t,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||Z.count(y.children)<=1)&&"size-7",o),size:f,type:"button",variant:u,...y})},Pn=({className:u,variant:o="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=a(fe,{className:"size-4"});if(d==="submitted")g=a(ge,{className:"size-4 animate-spin"});else if(d==="streaming")g=a(be,{className:"size-3 fill-current"});else if(d==="error")g=a(ve,{className:"size-4"});return a(_t,{"aria-label":"Submit",className:P("bg-foreground text-background hover:bg-foreground/70 size-7 rounded-full p-0 transition-opacity disabled:opacity-50",u),size:I,type:"submit",variant:o,...f,children:y??g})};
2
- export{bn,wn,Cn,kn,Tn,D,Pn};
1
+ import{Lo,Q}from"./chunk-seg9xzjy.js";import{Do}from"./chunk-9d0vkezs.js";import{ir,an,sn}from"./chunk-x8vd2d2g.js";import{jt,Kt,Re,Ee,Qt}from"./chunk-6jyd3a7v.js";import{cn as P}from"cn";import{ArrowUpIcon as fe,Loader2Icon as ge,SquareIcon as be,XIcon as ve}from"lucide-react";import{Children as Z,useCallback as h,useEffect as F,useMemo as he,useRef as M,useState as Pe}from"react";import{flushSync as Ie}from"react-dom";import{jsx as a,jsxs as ye}from"react/jsx-runtime";function ee(u){let o=new FormData(u).get("message");return typeof o==="string"?o:""}var So=({className:u,bashMode:o=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:E,multiple:te,globalDrop:C,syncHiddenInput:U,maxFiles:z,maxFileSize:k,onError:b,onSubmit:re,children:ne,...oe})=>{let s=Ee(),l=!!s,se=o&&l&&s.textInput.value.startsWith("!"),x=M(null),A=M(null),D=M(!1),[ie,N]=Pe([]),c=l?s.attachments.files:ie,B=M(c);B.current=c;let ae=h(()=>{x.current?.click()},[]),O=h((e)=>{if(!E||E.trim()==="")return!0;return E.split(",").map((t)=>t.trim()).filter(Boolean).some((t)=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t})},[E]),W=h((e)=>{if(e.type)return e.type;let r=(e.name||"").toLowerCase();if(r.endsWith(".png"))return"image/png";if(r.endsWith(".jpg")||r.endsWith(".jpeg"))return"image/jpeg";if(r.endsWith(".webp"))return"image/webp";if(r.endsWith(".gif"))return"image/gif";if(r.endsWith(".bmp"))return"image/bmp";if(r.endsWith(".svg"))return"image/svg+xml";return""},[]),ue=h((e)=>{let r=[...e],t=r.filter((i)=>O(i));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(i)=>k?i.size<=k:!0,m=t.filter(n);if(t.length>0&&m.length===0){b?.({code:"max_file_size",message:"All files exceed the maximum size."});return}N((i)=>{let v=I?I.uniqueFiles(m,i):m,p=typeof z==="number"?Math.max(0,z-i.length):void 0,_=typeof p==="number"?v.slice(0,p):v;if(typeof p==="number"&&v.length>p)b?.({code:"max_files",message:"Too many files. Some were not added."});let V=[];for(let T of _){let Y=I?.sourcePath(T);V.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(T),mediaType:W(T),filename:T.name,size:T.size,lastModified:T.lastModified,...Y===void 0?{}:{sourcePath:Y}})}return[...i,...V]})},[I,W,O,z,k,b]),le=h((e)=>N((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),pe=h(()=>N((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),G=l?s.attachments.add:ue,L=h((e)=>{let r=[...e],t=r.filter((m)=>!(m.type??"").toLowerCase().startsWith("image/"));if(t.length>0){b?.({code:"unsupported_type",message:`Only image attachments are supported. ${t.length} non-image file(s) were ignored.`});return}let n=r.reduce((m,i)=>m+i.size,0);if(n>0){let m=c.filter((i)=>(i.mediaType??"").toLowerCase().startsWith("image/")).reduce((i,v)=>i+(v.size??0),0);if(Lo(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${Q}MB.`});return}}G(r)},[c,G,b]),j=l?s.attachments.remove:le,R=l?s.attachments.clear:pe,q=l?s.attachments.openFileDialog:ae;F(()=>{if(!l)return;s.__registerFileInput(x,()=>x.current?.click())},[l,s]),F(()=>{if(U&&x.current&&c.length===0)x.current.value=""},[c,U]),F(()=>{let e=A.current;if(!e)return;if(C)return;let r=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault()},t=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault();if(n.dataTransfer?.files&&n.dataTransfer.files.length>0)L(n.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",t),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",t)}},[L,C]),F(()=>{if(!C)return;let e=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault()},r=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault();if(t.dataTransfer?.files&&t.dataTransfer.files.length>0)L(t.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[L,C]),F(()=>()=>{if(!l){for(let e of B.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let me=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},X=he(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:j,clear:R,openFileDialog:q,fileInputRef:x}),[c,L,j,R,q]),w=M({controller:s,files:c,canSubmit:f});w.current={controller:s,files:c,canSubmit:f};let S=M(!0);F(()=>(S.current=!0,()=>{S.current=!1}),[]);let J=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(D.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=A.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?s.textInput.value:ee(t),m=s?.textInput.getRevision?.(),i=c,v=()=>{if(!S.current)return;let p=w.current;if(p.files!==i)return;if(l){if(m===void 0||p.controller===null||p.controller.textInput.getRevision?.()!==m)return;if(p.controller.textInput.clearSubmitted===void 0)p.controller.textInput.clear();else p.controller.textInput.clearSubmitted()}else if(ee(t)===n)t.reset();R()};D.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await Do(i),_=w.current.canSubmit===void 0?!0:w.current.canSubmit();if(_!==!0)return{status:"blocked",reason:_};if(!S.current)return{status:"blocked",reason:"form_unmounted"};if(p.rejectedCount>0)b?.({code:"accept",message:"One or more images are corrupted and were removed before sending."});if(g!==void 0)await g({text:n,files:p.files});else if(e!==null)await re({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{D.current=!1}},ce=(e)=>{e.preventDefault(),J(e).catch(y)},de=h((e)=>{if(!e.trim())return;if(l&&s)Ie(()=>{s.textInput.setInput(e)});A.current?.requestSubmit()},[s,l]),K=a(Kt.Provider,{value:()=>J(null),children:ye(jt.Provider,{value:de,children:[a("input",{accept:E,"aria-label":"Upload files",className:"hidden",multiple:te,onChange:me,ref:x,title:"Upload files",type:"file"}),a("form",{className:P("w-full",u),onSubmit:ce,ref:A,"data-tour":"chat-input",...oe,children:a(ir,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",se&&"border! border-[rgb(255,0,135)] has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(255,0,135)] dark:border-[rgb(253,93,177)] dark:has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(253,93,177)]"),children:ne})})]})});return l?a(Re.Provider,{value:X,children:K}):a(Qt.Provider,{value:X,children:K})};function No({className:u,...o}){return a("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...o})}function Ro({className:u,...o}){return a(an,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...o})}function Mo({className:u,...o}){return a(an,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...o})}function Eo({className:u,...o}){return a("div",{className:P("flex items-center gap-1",u),...o})}var H=({variant:u="ghost",className:o,size:I,collapsed:d=!1,...y})=>{let f=d||Z.count(y.children)<=1?"icon-xs":"xs";return a(sn,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||Z.count(y.children)<=1)&&"size-7",o),size:f,type:"button",variant:u,...y})},Ao=({className:u,variant:o="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=a(fe,{className:"size-4"});if(d==="submitted")g=a(ge,{className:"size-4 animate-spin"});else if(d==="streaming")g=a(be,{className:"size-3 fill-current"});else if(d==="error")g=a(ve,{className:"size-4"});return a(sn,{"aria-label":"Submit",className:P("bg-foreground text-background hover:bg-foreground/70 size-7 rounded-full p-0 transition-opacity disabled:opacity-50",u),size:I,type:"submit",variant:o,...f,children:y??g})};
2
+ export{So,No,Ro,Mo,Eo,H,Ao};
@@ -0,0 +1,2 @@
1
+ import{ro}from"./chunk-sq5zstzq.js";import{isPlanItems as o}from"@alwith/api";function Pn(s,r){let n=s.items.findLast((e)=>e.kind!=="user"),a=s.items.map((e)=>{switch(e.kind){case"user":return{key:e.id,kind:"user",active:!1};case"tool":return{key:e.id,kind:"tool",active:e.status==="pending"||e.status==="in_progress"};case"compaction":return{key:e.id,kind:"compaction",active:e.status==="in_progress"};case"plan":return{key:e.id,kind:"plan",active:o(e.plan)&&e.plan.entries.some((t)=>t.status==="in_progress")};case"thought":return{key:e.id,kind:"reasoning",active:e===n};case"assistant":{let t=e._meta?.codex,i=typeof t==="object"&&t!==null&&(("messageCompleted"in t)&&t.messageCompleted===!0||("messageCompletedAt"in t)&&typeof t.messageCompletedAt==="number");return{key:e.id,kind:s.final.includes(e)?"answer":"text",active:e===n&&!i}}}});return ro(a,r)}
2
+ export{Pn};
@@ -1,3 +1,3 @@
1
- import{Ln}from"./chunk-tre0r8qm.js";import{Dn}from"./chunk-sgbde4dv.js";import{_n}from"./chunk-86kkb0z4.js";import{Ie}from"./chunk-w99ah6qt.js";import{n}from"./chunk-vxnjsga5.js";import{isContentEntry as d,isDiffEntry as f,isFormElicitation as g,isText as x,isToolCallSubject as h,isUrlElicitation as w}from"@alwith/api";import{jsx as l,jsxs as u}from"react/jsx-runtime";function te(t){return t.kind==="elicitation"&&g(t.params)}function b(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let o=e.description;return typeof o==="string"?o:null}function y(t){let e=t.rawInput;if(typeof e!=="object"||e===null)return null;let o=e.command;if(typeof o==="string")return o;if(Array.isArray(o))return o.map(String).join(" ");return null}function A(t){for(let e of t.content??[])if(f(e)&&e.patch&&e.patch.text.length>0)return e.patch.text;return null}function v(t){return(t.content??[]).filter(d).map((e)=>x(e.content)?e.content.text:"").filter((e)=>e.length>0).join(`
2
- `)}function R({subject:t,requestTitle:e}){let{host:o}=n();if(!h(t))return null;let r=t.toolCall,s=y(r),i=A(r),c=v(r),a=o.toolTitle?.(r)??r.title;return u("div",{className:"flex flex-col gap-2",children:[a&&a!==e&&s===null&&l("div",{className:"text-sm font-medium",children:a}),s!==null&&u("pre",{className:"bg-muted overflow-x-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:[l("span",{className:"text-muted-foreground select-none",children:"$ "}),s]}),i!==null&&l("div",{className:"max-h-80 overflow-auto rounded-lg border","data-stream-style":"codexUI",children:l(Ie,{patch:i,theme:o.theme})}),i===null&&s===null&&c.length>0&&l("pre",{className:"bg-muted max-h-60 overflow-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:c}),(r.locations??[]).length>0&&l("ul",{className:"text-muted-foreground flex flex-col gap-0.5 text-xs",children:(r.locations??[]).map((p)=>l("li",{className:"truncate font-mono",children:p.path},`${p.path}:${p.line??""}`))})]})}function m(t,e){let{host:o,client:r}=n();return(s)=>{try{if(e)e(t.id,s);else r.respond(t.id,s)}catch(i){if(o.reportError)o.reportError(i);else console.error(i)}}}function T({action:t,total:e,onRespond:o}){let{host:r}=n(),s=m(t,o),i=t.params,c=r.permissionTitle?.(i)??i.title;return u(Ln,{requestId:t.id,title:c,alwaysLabel:r.t("approval.always"),autoFocus:"if-idle",total:e,options:i.options.map((a)=>({...a,description:b(a)??void 0})),onRespond:(a)=>s({outcome:a===null?{outcome:"cancelled"}:{outcome:"selected",optionId:a}}),children:[i.description&&l("div",{className:"text-muted-foreground mt-0.5 text-xs",children:i.description}),i.subject&&l(R,{subject:i.subject,requestTitle:c})]})}function Pe({action:t,total:e,onRespond:o}){let{host:r}=n(),s=m(t,o);return l(Dn,{requestId:t.id,schema:t.params.requestedSchema,message:t.params.message,total:e,t:r.t,onRespond:s})}function at({action:t,total:e,onRespond:o}){let{host:r}=n(),s=m(t,o);if(t.kind==="permission")return l(T,{action:t,total:e,onRespond:o});if(te(t))return l(Pe,{action:t,total:e??1,onRespond:o});let i=t.params;if(!w(i))throw Error("Unsupported elicitation mode");return l(_n,{message:i.message,url:i.url,t:r.t,onOpen:r.openLink,onRespond:(c)=>s(c==="cancel"?{action:"cancel"}:{action:"decline"})})}
3
- export{te,Pe,at};
1
+ import{bn}from"./chunk-h3s5e0c5.js";import{Cn}from"./chunk-wthttnkz.js";import{yn}from"./chunk-hw5n7sqm.js";import{Se}from"./chunk-5s5tedyw.js";import{n}from"./chunk-1v3wc4cv.js";import{isContentEntry as d,isDiffEntry as f,isFormElicitation as g,isText as x,isToolCallSubject as h,isUrlElicitation as w}from"@alwith/api";import{jsx as l,jsxs as u}from"react/jsx-runtime";function te(t){return t.kind==="elicitation"&&g(t.params)}function b(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let o=e.description;return typeof o==="string"?o:null}function y(t){let e=t.rawInput;if(typeof e!=="object"||e===null)return null;let o=e.command;if(typeof o==="string")return o;if(Array.isArray(o))return o.map(String).join(" ");return null}function A(t){for(let e of t.content??[])if(f(e)&&e.patch&&e.patch.text.length>0)return e.patch.text;return null}function v(t){return(t.content??[]).filter(d).map((e)=>x(e.content)?e.content.text:"").filter((e)=>e.length>0).join(`
2
+ `)}function R({subject:t,requestTitle:e}){let{host:o}=n();if(!h(t))return null;let r=t.toolCall,s=y(r),i=A(r),c=v(r),a=o.toolTitle?.(r)??r.title;return u("div",{className:"flex flex-col gap-2",children:[a&&a!==e&&s===null&&l("div",{className:"text-sm font-medium",children:a}),s!==null&&u("pre",{className:"bg-muted overflow-x-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:[l("span",{className:"text-muted-foreground select-none",children:"$ "}),s]}),i!==null&&l("div",{className:"max-h-80 overflow-auto rounded-lg border","data-stream-style":"codexUI",children:l(Se,{patch:i,theme:o.theme})}),i===null&&s===null&&c.length>0&&l("pre",{className:"bg-muted max-h-60 overflow-auto rounded-lg p-3 font-mono text-xs whitespace-pre-wrap",children:c}),(r.locations??[]).length>0&&l("ul",{className:"text-muted-foreground flex flex-col gap-0.5 text-xs",children:(r.locations??[]).map((p)=>l("li",{className:"truncate font-mono",children:p.path},`${p.path}:${p.line??""}`))})]})}function m(t,e){let{host:o,client:r}=n();return(s)=>{try{if(e)e(t.id,s);else r.respond(t.id,s)}catch(i){if(o.reportError)o.reportError(i);else console.error(i)}}}function T({action:t,total:e,onRespond:o}){let{host:r}=n(),s=m(t,o),i=t.params,c=r.permissionTitle?.(i)??i.title;return u(bn,{requestId:t.id,title:c,alwaysLabel:r.t("approval.always"),autoFocus:"if-idle",total:e,options:i.options.map((a)=>({...a,description:b(a)??void 0})),onRespond:(a)=>s({outcome:a===null?{outcome:"cancelled"}:{outcome:"selected",optionId:a}}),children:[i.description&&l("div",{className:"text-muted-foreground mt-0.5 text-xs",children:i.description}),i.subject&&l(R,{subject:i.subject,requestTitle:c})]})}function ke({action:t,total:e,onRespond:o}){let{host:r}=n(),s=m(t,o);return l(Cn,{requestId:t.id,schema:t.params.requestedSchema,message:t.params.message,total:e,t:r.t,onRespond:s})}function Ke({action:t,total:e,onRespond:o}){let{host:r}=n(),s=m(t,o);if(t.kind==="permission")return l(T,{action:t,total:e,onRespond:o});if(te(t))return l(ke,{action:t,total:e??1,onRespond:o});let i=t.params;if(!w(i))throw Error("Unsupported elicitation mode");return l(yn,{message:i.message,url:i.url,t:r.t,onOpen:r.openLink,onRespond:(c)=>s(c==="cancel"?{action:"cancel"}:{action:"decline"})})}
3
+ export{te,ke,Ke};
@@ -0,0 +1,4 @@
1
+ import{co}from"./chunk-q989x2x5.js";import{t}from"./chunk-vmywavgm.js";import{Gn,Wn}from"./chunk-r8k9jd0z.js";import{M}from"./chunk-zw2q13qg.js";import{D}from"./chunk-6bdd2cgs.js";import{isEmbeddedResource as g,isImage as d,isResourceLink as f,isText as x}from"@alwith/api";import{memo as p}from"react";import{jsx as r,jsxs as h}from"react/jsx-runtime";var Nn=p(function({item:s,messageTime:c}){let l=t(),o=Wn(s._meta),m=o?o.map((e)=>e.question===void 0?e.text:`${e.question}
2
+ ${e.text}`).join(`
3
+ `):D(s),a=s.content.filter(d),i=s.content.filter((e)=>f(e)||g(e)),u=o??s.content.filter(x).map((e)=>{let n=Gn(e._meta);return n?{question:n.question,text:n.answer}:{text:e.text}});if(m.length===0&&a.length===0&&i.length===0)return null;return h("div",{className:"group/codex-user flex min-w-0 flex-col items-end gap-2","data-content-search-unit-key":s.id,children:[i.length>0&&r("div",{className:"codex-user-mentions",children:i.map((e,n)=>r(M,{block:e},`${s.id}:${n}`))}),r(co,{host:l,message:s,text:m,textParts:u.some((e)=>("question"in e))?u:void 0,images:a,mentions:[],messageTime:c})]})});
4
+ export{Nn};
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-1wc83vxg.js";import{N}from"./chunk-acrrwrzy.js";import{isContentEntry as k,isImage as b,isResourceLink as w}from"@alwith/api";import{ChevronRightIcon as C,ImageIcon as S,LoaderCircleIcon as A,RefreshCwIcon as R}from"lucide-react";import{useEffect as B,useState as h}from"react";import{jsx as n,jsxs as y}from"react/jsx-runtime";function ye(e){return e.type==="tool_use"&&e.name==="view_image"&&e.status==="completed"}function T(e){let r=[];for(let[c,l]of e.content.entries()){if(!k(l))continue;let o=l.content;if(b(o))r.push({key:`${e.id}:${c}`,src:`data:${o.mimeType};base64,${o.data}`,alt:e.title??""});if(w(o))r.push({key:`${e.id}:${c}`,path:o.uri,alt:o.name})}if(r.length)return r;let i=e.rawInput;if(i!==null&&typeof i==="object"&&"path"in i&&typeof i.path==="string")return[{key:e.id,path:i.path,alt:i.path.split(/[\\/]/).at(-1)??i.path}];throw Error(`Image view ${e.id} has no image source`)}function E({images:e}){let{loadImage:r,openImageGallery:i,openImage:c,t:l}=a(),[o,g]=h({}),[v,x]=h(0),f=JSON.stringify(e);B(()=>{let t=!0,u=JSON.parse(f);g({});for(let s of u)(s.src!==void 0?Promise.resolve(s.src):s.path!==void 0&&r?r(s.path):Promise.reject(Error("Image loading is unavailable"))).then((d)=>{if(t)g((p)=>({...p,[s.key]:{src:d}}))},()=>{if(t)g((d)=>({...d,[s.key]:{error:!0}}))});return()=>{t=!1}},[f,r,v]);let I=e.flatMap((t)=>{let u=o[t.key];return u&&"src"in u?[{src:u.src,alt:t.alt}]:[]});return n("div",{className:"codex-image-thumbnails",children:e.map((t,u)=>{let s=o[t.key];if(!s)return n("div",{className:"codex-image-thumbnail",role:"status","aria-label":l("stream.codex.imageLoading"),children:n(A,{className:"motion-safe:animate-spin","aria-hidden":"true"})},t.key);if("error"in s)return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,"aria-label":l("stream.codex.imageFailed"),onClick:()=>x((m)=>m+1),children:n(R,{"aria-hidden":"true"})},t.key);return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,onClick:()=>{let m=e.slice(0,u).filter((d)=>{let p=o[d.key];return p&&"src"in p}).length;if(i)i(I,m);else c?.(s.src)},children:n("img",{src:s.src,alt:t.alt,draggable:!1})},t.key)})})}function Mo({blocks:e}){let{t:r}=a(),i=e.flatMap(T),[c,l]=N(`image-view:${e[0].id}`,!1);return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((o)=>!o),children:[y("span",{className:"codex-activity-label",children:[n(S,{className:"codex-activity-icon","aria-hidden":"true"}),n("span",{className:"codex-activity-leading",children:r("stream.codex.viewedImages",{count:i.length})})]}),n(C,{className:c?"codex-image-chevron codex-image-chevron-open":"codex-image-chevron","aria-hidden":"true"})]}),c&&n(E,{images:i})]})}
2
- export{ye,Mo};
1
+ import{a}from"./chunk-3p9j3gmw.js";import{P}from"./chunk-qsqyf4y3.js";import{isContentEntry as k,isImage as b,isResourceLink as N}from"@alwith/api";import{ChevronRightIcon as w,ImageIcon as C,LoaderCircleIcon as S,RefreshCwIcon as A}from"lucide-react";import{useEffect as R,useState as h}from"react";import{jsx as n,jsxs as y}from"react/jsx-runtime";function ae(e){return e.type==="tool_use"&&e.name==="view_image"&&e.status==="completed"}function B(e){let r=[];for(let[c,l]of e.content.entries()){if(!k(l))continue;let o=l.content;if(b(o))r.push({key:`${e.id}:${c}`,src:`data:${o.mimeType};base64,${o.data}`,alt:e.title??""});if(N(o))r.push({key:`${e.id}:${c}`,path:o.uri,alt:o.name})}if(r.length)return r;let i=e.rawInput;if(i!==null&&typeof i==="object"&&"path"in i&&typeof i.path==="string")return[{key:e.id,path:i.path,alt:i.path.split(/[\\/]/).at(-1)??i.path}];throw Error(`Image view ${e.id} has no image source`)}function T({images:e}){let{loadImage:r,openImageGallery:i,openImage:c,t:l}=a(),[o,g]=h({}),[v,x]=h(0),f=JSON.stringify(e);R(()=>{let t=!0,u=JSON.parse(f);g({});for(let s of u)(s.src!==void 0?Promise.resolve(s.src):s.path!==void 0&&r?r(s.path):Promise.reject(Error("Image loading is unavailable"))).then((d)=>{if(t)g((p)=>({...p,[s.key]:{src:d}}))},()=>{if(t)g((d)=>({...d,[s.key]:{error:!0}}))});return()=>{t=!1}},[f,r,v]);let I=e.flatMap((t)=>{let u=o[t.key];return u&&"src"in u?[{src:u.src,alt:t.alt}]:[]});return n("div",{className:"codex-image-thumbnails",children:e.map((t,u)=>{let s=o[t.key];if(!s)return n("div",{className:"codex-image-thumbnail",role:"status","aria-label":l("stream.codex.imageLoading"),children:n(S,{className:"motion-safe:animate-spin","aria-hidden":"true"})},t.key);if("error"in s)return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,"aria-label":l("stream.codex.imageFailed"),onClick:()=>x((m)=>m+1),children:n(A,{"aria-hidden":"true"})},t.key);return n("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,onClick:()=>{let m=e.slice(0,u).filter((d)=>{let p=o[d.key];return p&&"src"in p}).length;if(i)i(I,m);else c?.(s.src)},children:n("img",{src:s.src,alt:t.alt,draggable:!1})},t.key)})})}function bo({blocks:e}){let{t:r}=a(),i=e.flatMap(B),[c,l]=P(`image-view:${e[0].id}`,!1);return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((o)=>!o),children:[y("span",{className:"codex-activity-label",children:[n(C,{className:"codex-activity-icon","aria-hidden":"true"}),n("span",{className:"codex-activity-leading",children:r("stream.codex.viewedImages",{count:i.length})})]}),n(w,{className:c?"codex-image-chevron codex-image-chevron-open":"codex-image-chevron","aria-hidden":"true"})]}),c&&n(T,{images:i})]})}
2
+ export{ae,bo};
@@ -0,0 +1,2 @@
1
+ var xt="chrome-hover hover:bg-foreground/8 data-[active=true]:bg-foreground/5",Z="chrome-hover hover:bg-foreground/8 data-active:bg-foreground/5";
2
+ export{xt,Z};