@alwith/module-chat 0.5.2 → 0.5.4

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 (371) hide show
  1. package/README.md +29 -0
  2. package/dist/activity-host.d.ts +2 -0
  3. package/dist/activity-host.js +1 -1
  4. package/dist/approval/choice-elicitation-form.js +1 -1
  5. package/dist/approval/choice-schema.js +1 -1
  6. package/dist/approval/permission-options.js +1 -1
  7. package/dist/approval/permission-view.js +1 -1
  8. package/dist/approval/schema-elicitation-form.js +1 -1
  9. package/dist/approval/url-elicitation-card.js +1 -1
  10. package/dist/chunk-0d8k5bmd.js +2 -0
  11. package/dist/chunk-0fvpmcps.js +2 -0
  12. package/dist/{chunk-d675nr2b.js → chunk-0grd0g0x.js} +2 -2
  13. package/dist/chunk-0habpww5.js +2 -0
  14. package/dist/chunk-0hpww4x3.js +2 -0
  15. package/dist/chunk-0k654tyt.js +2 -0
  16. package/dist/chunk-0mf7yh69.js +2 -0
  17. package/dist/{chunk-9dsa5vm7.js → chunk-17wjmyj7.js} +2 -2
  18. package/dist/chunk-1drkvxzk.js +1 -0
  19. package/dist/{chunk-7q7c0mds.js → chunk-1hy64ewz.js} +1 -1
  20. package/dist/chunk-1txn4b0v.js +1 -0
  21. package/dist/{chunk-6vky4fcv.js → chunk-2s4y2v50.js} +2 -2
  22. package/dist/chunk-2ysnmwx1.js +2 -0
  23. package/dist/{chunk-vhat5rbz.js → chunk-367b1yab.js} +2 -2
  24. package/dist/chunk-3nj26hhf.js +2 -0
  25. package/dist/{chunk-15nwm04a.js → chunk-3ryhmzsq.js} +2 -2
  26. package/dist/chunk-3wsg6710.js +2 -0
  27. package/dist/chunk-3x1eq95a.js +2 -0
  28. package/dist/chunk-4jagfjhm.js +2 -0
  29. package/dist/chunk-4pbh3fph.js +2 -0
  30. package/dist/chunk-5s2wpbdt.js +1 -0
  31. package/dist/chunk-5t3rrnfd.js +2 -0
  32. package/dist/chunk-5wyxvpgt.js +1 -0
  33. package/dist/chunk-61vxy6yd.js +1 -0
  34. package/dist/chunk-65jedxc3.js +4 -0
  35. package/dist/chunk-68y66m3v.js +2 -0
  36. package/dist/chunk-69yx37pv.js +3 -0
  37. package/dist/chunk-6d38ff76.js +2 -0
  38. package/dist/chunk-6j4g51ff.js +3 -0
  39. package/dist/chunk-6pq1xmwg.js +2 -0
  40. package/dist/chunk-6vqnsdgc.js +2 -0
  41. package/dist/chunk-76tkqx9n.js +2 -0
  42. package/dist/{chunk-jeyvacx6.js → chunk-78ew0821.js} +5 -5
  43. package/dist/chunk-7e1m1d9x.js +2 -0
  44. package/dist/chunk-88vkk9s3.js +2 -0
  45. package/dist/chunk-8bzk9e4v.js +2 -0
  46. package/dist/{chunk-8vvn71rf.js → chunk-8fn5n4yv.js} +2 -2
  47. package/dist/chunk-8p0074ye.js +2 -0
  48. package/dist/chunk-91trh8rj.js +2 -0
  49. package/dist/chunk-93q2dm10.js +1 -0
  50. package/dist/chunk-94k9byb1.js +2 -0
  51. package/dist/chunk-9c41y5hw.js +2 -0
  52. package/dist/chunk-9hqz5fbc.js +2 -0
  53. package/dist/chunk-a2ftkzak.js +1 -0
  54. package/dist/chunk-acrrwrzy.js +2 -0
  55. package/dist/{chunk-h0dq9ztv.js → chunk-an03g9e8.js} +2 -2
  56. package/dist/chunk-bwas6kp2.js +2 -0
  57. package/dist/chunk-c6w4bp15.js +1 -0
  58. package/dist/{chunk-801v0awm.js → chunk-cg97byvk.js} +1 -1
  59. package/dist/{chunk-42zr8zpv.js → chunk-cywx4qmv.js} +2 -2
  60. package/dist/chunk-d2rrvka6.js +2 -0
  61. package/dist/chunk-dcxprfnp.js +2 -0
  62. package/dist/chunk-dsdxw9s8.js +2 -0
  63. package/dist/{chunk-k7zzrns3.js → chunk-ehh31hzz.js} +1 -1
  64. package/dist/chunk-epqjzw63.js +2 -0
  65. package/dist/{chunk-j2mcvb68.js → chunk-f0sbnmcs.js} +6 -6
  66. package/dist/chunk-fwd1zewt.js +2 -0
  67. package/dist/{chunk-ea7zsd2s.js → chunk-fzetrkvd.js} +2 -2
  68. package/dist/chunk-gb2dmt6b.js +2 -0
  69. package/dist/chunk-gmhbqxcg.js +2 -0
  70. package/dist/chunk-gsq8mzr7.js +2 -0
  71. package/dist/{chunk-2f19pcpn.js → chunk-gtddnhdy.js} +2 -2
  72. package/dist/chunk-gwav4k8b.js +2 -0
  73. package/dist/chunk-gy63n5pz.js +2 -0
  74. package/dist/chunk-h05s12jn.js +3 -0
  75. package/dist/chunk-h7gq5y52.js +2 -0
  76. package/dist/chunk-h9tnsvjr.js +2 -0
  77. package/dist/chunk-hhw1pjz6.js +2 -0
  78. package/dist/{chunk-6qn5srgg.js → chunk-hjm26kwf.js} +1 -1
  79. package/dist/chunk-hmj7yqyb.js +3 -0
  80. package/dist/chunk-hmze7f10.js +2 -0
  81. package/dist/chunk-hrexfky6.js +2 -0
  82. package/dist/{chunk-1d4c9j8w.js → chunk-jd61cfkk.js} +2 -2
  83. package/dist/chunk-jwb3723b.js +2 -0
  84. package/dist/chunk-k2zg8xva.js +2 -0
  85. package/dist/chunk-kg1gk77d.js +2 -0
  86. package/dist/chunk-kh1tc15g.js +2 -0
  87. package/dist/chunk-m4mfw5s4.js +7 -0
  88. package/dist/{chunk-h6df4xfd.js → chunk-m5jhw1e6.js} +2 -2
  89. package/dist/{chunk-8e7xf2tb.js → chunk-mgt5j803.js} +1 -1
  90. package/dist/chunk-mv8jmv1e.js +2 -0
  91. package/dist/chunk-n4cseazv.js +3 -0
  92. package/dist/chunk-nb5wjv92.js +2 -0
  93. package/dist/{chunk-hx6wfscz.js → chunk-nx91ewps.js} +1 -1
  94. package/dist/chunk-p2s04v76.js +2 -0
  95. package/dist/chunk-pkgrt90z.js +2 -0
  96. package/dist/chunk-py1t2v6e.js +2 -0
  97. package/dist/chunk-q2ppgpfd.js +2 -0
  98. package/dist/chunk-q3hdevem.js +2 -0
  99. package/dist/chunk-q4y1q1na.js +2 -0
  100. package/dist/{chunk-q7e2bdav.js → chunk-q98941j2.js} +2 -2
  101. package/dist/{chunk-h38yw8y3.js → chunk-qbdqh38y.js} +1 -1
  102. package/dist/chunk-qbj5s8qa.js +2 -0
  103. package/dist/chunk-qgfq5vrz.js +1 -0
  104. package/dist/chunk-qqdca2rm.js +2 -0
  105. package/dist/chunk-r7c0tca8.js +2 -0
  106. package/dist/chunk-r8z8f31m.js +2 -0
  107. package/dist/{chunk-ypvjzkfb.js → chunk-rd94eyan.js} +2 -2
  108. package/dist/chunk-rdtj6bad.js +2 -0
  109. package/dist/{chunk-bkbemt8g.js → chunk-rgkhm4s4.js} +2 -2
  110. package/dist/{chunk-v0zn87k5.js → chunk-rkqe8p8n.js} +2 -2
  111. package/dist/chunk-s44rx1sz.js +3 -0
  112. package/dist/{chunk-6qa5dt1k.js → chunk-scddkjv8.js} +1 -1
  113. package/dist/chunk-sj7jdb7m.js +1 -0
  114. package/dist/chunk-spt7tnqx.js +2 -0
  115. package/dist/{chunk-dgp9q950.js → chunk-sqh158m4.js} +1 -1
  116. package/dist/{chunk-5j3wnans.js → chunk-syv6gady.js} +2 -2
  117. package/dist/chunk-tpx841s3.js +2 -0
  118. package/dist/chunk-ttk21631.js +2 -0
  119. package/dist/chunk-twwqgd8e.js +2 -0
  120. package/dist/{chunk-8k7wzkna.js → chunk-tzjk7zkc.js} +2 -2
  121. package/dist/chunk-v5wwv2t9.js +4 -0
  122. package/dist/chunk-wf4tq3fn.js +1 -0
  123. package/dist/{chunk-9ab18v07.js → chunk-wjs8bwpk.js} +2 -2
  124. package/dist/chunk-wrs447cs.js +2 -0
  125. package/dist/chunk-x053g6f2.js +2 -0
  126. package/dist/chunk-xf14bg2v.js +4 -0
  127. package/dist/chunk-xfjcwypy.js +4 -0
  128. package/dist/{chunk-c4621n0b.js → chunk-xjtqdp82.js} +1 -1
  129. package/dist/chunk-xp0nfvxg.js +2 -0
  130. package/dist/chunk-xw0gvwh5.js +2 -0
  131. package/dist/{chunk-d8gwsw6j.js → chunk-y438yezf.js} +3 -3
  132. package/dist/chunk-y6r6tzfh.js +2 -0
  133. package/dist/chunk-yegh80h4.js +2 -0
  134. package/dist/chunk-yf2p44mq.js +2 -0
  135. package/dist/chunk-yg42bpjr.js +3 -0
  136. package/dist/chunk-yhmb3z56.js +2 -0
  137. package/dist/chunk-z3e38981.js +2 -0
  138. package/dist/{chunk-7kcdf82d.js → chunk-z4zm74ge.js} +2 -2
  139. package/dist/{chunk-cw9tg2sz.js → chunk-z75zbdq8.js} +1 -1
  140. package/dist/{chunk-t5nstx0k.js → chunk-zc2hdmk1.js} +2 -2
  141. package/dist/chunk-zjg9n6zj.js +2 -0
  142. package/dist/codex/activity-group.d.ts +2 -1
  143. package/dist/codex/activity-group.js +1 -1
  144. package/dist/codex/assistant-message.js +1 -1
  145. package/dist/codex/async-question-card.js +1 -1
  146. package/dist/codex/disclosure-state.js +1 -1
  147. package/dist/codex/edited-files-card.js +1 -1
  148. package/dist/codex/image-view-activity.js +1 -1
  149. package/dist/codex/markdown-renderer.js +1 -1
  150. package/dist/codex/navigation-audio.js +1 -1
  151. package/dist/codex/navigation-preview.js +1 -1
  152. package/dist/codex/navigation-rail.js +1 -1
  153. package/dist/codex/patch-view.js +1 -2
  154. package/dist/codex/plan.js +1 -1
  155. package/dist/codex/timeline-virtualizer.js +1 -1
  156. package/dist/codex/turn-activity.d.ts +14 -0
  157. package/dist/codex/turn-activity.js +1 -0
  158. package/dist/codex/user-message.d.ts +3 -2
  159. package/dist/codex/user-message.js +1 -1
  160. package/dist/codex/virtualized-turn-list.js +1 -1
  161. package/dist/composer/completion-filter.js +1 -1
  162. package/dist/composer/completion-menu.js +1 -3
  163. package/dist/composer/completion-trigger.js +1 -1
  164. package/dist/composer/effort-slider.js +1 -1
  165. package/dist/composer/menu-radio.js +1 -1
  166. package/dist/composer/model-select.js +1 -1
  167. package/dist/composer/permission-mode-select.js +1 -1
  168. package/dist/composer/prompt-input-attachments.js +1 -1
  169. package/dist/composer/prompt-input-clipboard.js +1 -1
  170. package/dist/composer/prompt-input-context.js +1 -1
  171. package/dist/composer/prompt-input-textarea.js +1 -3
  172. package/dist/composer/prompt-input.js +1 -1
  173. package/dist/conversation/action-card.d.ts +20 -0
  174. package/dist/conversation/action-card.js +1 -0
  175. package/dist/conversation/composer/composer.d.ts +21 -0
  176. package/dist/conversation/composer/composer.js +1 -0
  177. package/dist/conversation/composer/config-options.d.ts +6 -0
  178. package/dist/conversation/composer/config-options.js +1 -0
  179. package/dist/conversation/composer/context.d.ts +32 -0
  180. package/dist/conversation/composer/context.js +1 -0
  181. package/dist/conversation/composer/drafts.d.ts +15 -0
  182. package/dist/conversation/composer/drafts.js +1 -0
  183. package/dist/conversation/composer/file-items.d.ts +3 -0
  184. package/dist/conversation/composer/file-items.js +1 -0
  185. package/dist/conversation/composer/long-text.d.ts +14 -0
  186. package/dist/conversation/composer/long-text.js +1 -0
  187. package/dist/conversation/composer/mention-chips.d.ts +4 -0
  188. package/dist/conversation/composer/mention-chips.js +1 -0
  189. package/dist/conversation/composer/mention-uri.d.ts +7 -0
  190. package/dist/conversation/composer/mention-uri.js +1 -0
  191. package/dist/conversation/composer/model-menu.d.ts +26 -0
  192. package/dist/conversation/composer/model-menu.js +1 -0
  193. package/dist/conversation/composer/pasted-text-attachment.d.ts +5 -0
  194. package/dist/conversation/composer/pasted-text-attachment.js +1 -0
  195. package/dist/conversation/composer/permission-mode-menu.d.ts +8 -0
  196. package/dist/conversation/composer/permission-mode-menu.js +1 -0
  197. package/dist/conversation/composer/prediction.d.ts +6 -0
  198. package/dist/conversation/composer/prediction.js +1 -0
  199. package/dist/conversation/composer/slash-command-button.d.ts +8 -0
  200. package/dist/conversation/composer/slash-command-button.js +1 -0
  201. package/dist/conversation/composer/submit-button.d.ts +7 -0
  202. package/dist/conversation/composer/submit-button.js +1 -0
  203. package/dist/conversation/composer/usage-meter.d.ts +7 -0
  204. package/dist/conversation/composer/usage-meter.js +1 -0
  205. package/dist/conversation/context.d.ts +14 -0
  206. package/dist/conversation/context.js +1 -0
  207. package/dist/conversation/conversation-body.d.ts +7 -0
  208. package/dist/conversation/conversation-body.js +1 -0
  209. package/dist/conversation/conversation-view.d.ts +18 -0
  210. package/dist/conversation/conversation-view.js +1 -0
  211. package/dist/conversation/conversation.d.ts +18 -0
  212. package/dist/conversation/conversation.js +1 -0
  213. package/dist/conversation/diff-modal.d.ts +7 -0
  214. package/dist/conversation/diff-modal.js +1 -0
  215. package/dist/conversation/session-actions.d.ts +3 -0
  216. package/dist/conversation/session-actions.js +1 -0
  217. package/dist/conversation/types.d.ts +21 -0
  218. package/dist/conversation/types.js +0 -0
  219. package/dist/image-lightbox.js +1 -1
  220. package/dist/image-preview-dialog.js +1 -1
  221. package/dist/lib/code-highlighter.js +1 -1
  222. package/dist/lib/fuzzy.js +1 -1
  223. package/dist/lib/group-blocks.js +1 -1
  224. package/dist/lib/image-encode.js +1 -1
  225. package/dist/lib/limits.js +1 -1
  226. package/dist/lib/markdown-parser.js +1 -1
  227. package/dist/lib/markdown-rules.js +1 -1
  228. package/dist/lib/model-name.js +1 -1
  229. package/dist/lib/pointer-centered-zoom.js +1 -1
  230. package/dist/lib/prepare-prompt-files.js +1 -1
  231. package/dist/lib/stream-style.js +1 -1
  232. package/dist/lib/streaming-markdown.js +1 -1
  233. package/dist/locales.d.ts +1136 -0
  234. package/dist/locales.js +1 -1
  235. package/dist/search/chat-search.d.ts +2 -1
  236. package/dist/search/chat-search.js +1 -1
  237. package/dist/search/dom-matches.d.ts +1 -0
  238. package/dist/search/dom-matches.js +1 -1
  239. package/dist/search/find-bar.js +1 -1
  240. package/dist/search/literal-matches.js +1 -1
  241. package/dist/session-list/archived-sessions.d.ts +7 -0
  242. package/dist/session-list/archived-sessions.js +1 -0
  243. package/dist/session-list/highlight.d.ts +2 -0
  244. package/dist/session-list/highlight.js +1 -0
  245. package/dist/session-list/host.d.ts +43 -0
  246. package/dist/session-list/host.js +1 -0
  247. package/dist/session-list/hover-info-card.d.ts +21 -0
  248. package/dist/session-list/hover-info-card.js +1 -0
  249. package/dist/session-list/locales.d.ts +247 -0
  250. package/dist/session-list/locales.js +1 -0
  251. package/dist/session-list/navigation.d.ts +50 -0
  252. package/dist/session-list/navigation.js +1 -0
  253. package/dist/session-list/overflow-marquee.d.ts +2 -0
  254. package/dist/session-list/overflow-marquee.js +1 -0
  255. package/dist/session-list/row-stop-button.d.ts +4 -0
  256. package/dist/session-list/row-stop-button.js +1 -0
  257. package/dist/session-list/session-groups.d.ts +5 -0
  258. package/dist/session-list/session-groups.js +1 -0
  259. package/dist/session-list/session-info-card.d.ts +10 -0
  260. package/dist/session-list/session-info-card.js +1 -0
  261. package/dist/session-list/session-list.css +97 -0
  262. package/dist/session-list/session-list.d.ts +37 -0
  263. package/dist/session-list/session-list.js +1 -0
  264. package/dist/session-list/session-row.d.ts +10 -0
  265. package/dist/session-list/session-row.js +1 -0
  266. package/dist/session-list/session-state-dot.d.ts +10 -0
  267. package/dist/session-list/session-state-dot.js +1 -0
  268. package/dist/session-list/sidebar-overlay.d.ts +2 -0
  269. package/dist/session-list/sidebar-overlay.js +1 -0
  270. package/dist/session-list/trailing-swap.d.ts +11 -0
  271. package/dist/session-list/trailing-swap.js +1 -0
  272. package/dist/session-list/use-activity-preview.d.ts +2 -0
  273. package/dist/session-list/use-activity-preview.js +1 -0
  274. package/dist/session-list/use-project-sessions.d.ts +16 -0
  275. package/dist/session-list/use-project-sessions.js +1 -0
  276. package/dist/session-list/virtual-session-rows.d.ts +9 -0
  277. package/dist/session-list/virtual-session-rows.js +1 -0
  278. package/dist/session-timeline/activity-group.js +1 -1
  279. package/dist/session-timeline/activity-projection.js +1 -1
  280. package/dist/session-timeline/assistant-content.js +1 -1
  281. package/dist/session-timeline/assistant-turn.js +1 -1
  282. package/dist/session-timeline/async-questions.js +1 -1
  283. package/dist/session-timeline/edited-files-card.js +1 -1
  284. package/dist/session-timeline/history-timeline.js +1 -1
  285. package/dist/session-timeline/host.js +1 -1
  286. package/dist/session-timeline/navigation-rail.js +1 -1
  287. package/dist/session-timeline/plan.js +1 -1
  288. package/dist/session-timeline/question-reply.js +1 -1
  289. package/dist/session-timeline/resource-content.js +1 -1
  290. package/dist/session-timeline/session-timeline.js +1 -1
  291. package/dist/session-timeline/timeline-registry.d.ts +2 -0
  292. package/dist/session-timeline/timeline-registry.js +1 -1
  293. package/dist/session-timeline/turn-activity.d.ts +3 -0
  294. package/dist/session-timeline/turn-activity.js +1 -0
  295. package/dist/session-timeline/turn-error.js +1 -1
  296. package/dist/session-timeline/turn-retry.js +1 -1
  297. package/dist/session-timeline/turn-time.js +1 -1
  298. package/dist/session-timeline/turns.d.ts +1 -0
  299. package/dist/session-timeline/turns.js +1 -1
  300. package/dist/session-timeline/use-timeline-scroll.js +1 -1
  301. package/dist/session-timeline/user-message.js +1 -1
  302. package/dist/ui/alert.d.ts +10 -0
  303. package/dist/ui/alert.js +1 -0
  304. package/dist/ui/badge.js +1 -1
  305. package/dist/ui/button.js +1 -1
  306. package/dist/ui/card.js +1 -1
  307. package/dist/ui/checkbox.js +1 -1
  308. package/dist/ui/dialog.js +1 -1
  309. package/dist/ui/dropdown-menu.js +1 -1
  310. package/dist/ui/empty.d.ts +11 -0
  311. package/dist/ui/empty.js +1 -0
  312. package/dist/ui/field.js +1 -1
  313. package/dist/ui/hover-card.js +1 -1
  314. package/dist/ui/input-group-textarea.js +1 -1
  315. package/dist/ui/input-group.js +1 -1
  316. package/dist/ui/input.js +1 -1
  317. package/dist/ui/kbd.d.ts +3 -0
  318. package/dist/ui/kbd.js +1 -0
  319. package/dist/ui/label.js +1 -1
  320. package/dist/ui/radio-group.js +1 -1
  321. package/dist/ui/select.d.ts +15 -0
  322. package/dist/ui/select.js +1 -0
  323. package/dist/ui/separator.js +1 -1
  324. package/dist/ui/skeleton.d.ts +2 -0
  325. package/dist/ui/skeleton.js +1 -0
  326. package/dist/ui/spinner.d.ts +2 -0
  327. package/dist/ui/spinner.js +1 -0
  328. package/dist/ui/switch.js +1 -1
  329. package/dist/ui/textarea.js +1 -1
  330. package/dist/ui/tooltip.js +1 -1
  331. package/package.json +18 -5
  332. package/dist/chunk-16y5rmm5.js +0 -2
  333. package/dist/chunk-20zcgxa5.js +0 -4
  334. package/dist/chunk-2epnn4sq.js +0 -1
  335. package/dist/chunk-3vt71emt.js +0 -2
  336. package/dist/chunk-4svwa5p8.js +0 -3
  337. package/dist/chunk-4tkxmh52.js +0 -2
  338. package/dist/chunk-5grywgpq.js +0 -4
  339. package/dist/chunk-5h13saah.js +0 -2
  340. package/dist/chunk-6p5hgnpq.js +0 -1
  341. package/dist/chunk-9pdj44jr.js +0 -2
  342. package/dist/chunk-9s1cgt7s.js +0 -1
  343. package/dist/chunk-aqj0v5a9.js +0 -7
  344. package/dist/chunk-azmqtycn.js +0 -2
  345. package/dist/chunk-b5mkvr4d.js +0 -2
  346. package/dist/chunk-bfe7xk9m.js +0 -3
  347. package/dist/chunk-dm31xvh3.js +0 -2
  348. package/dist/chunk-dr6z453e.js +0 -2
  349. package/dist/chunk-fgsd4fsd.js +0 -2
  350. package/dist/chunk-fvnb8ds4.js +0 -2
  351. package/dist/chunk-h87xp1gv.js +0 -2
  352. package/dist/chunk-jh8jske0.js +0 -2
  353. package/dist/chunk-jn2pj92h.js +0 -2
  354. package/dist/chunk-jrrvpnf3.js +0 -1
  355. package/dist/chunk-jsb0zged.js +0 -2
  356. package/dist/chunk-k2y4cpra.js +0 -2
  357. package/dist/chunk-m2myfd89.js +0 -2
  358. package/dist/chunk-m2wxz0sj.js +0 -2
  359. package/dist/chunk-nxarfyj2.js +0 -2
  360. package/dist/chunk-p1pd1twf.js +0 -2
  361. package/dist/chunk-p6558tbk.js +0 -2
  362. package/dist/chunk-phe3an96.js +0 -2
  363. package/dist/chunk-qh5fhcrh.js +0 -3
  364. package/dist/chunk-sky795ex.js +0 -1
  365. package/dist/chunk-t3vgbc9s.js +0 -2
  366. package/dist/chunk-trgq8rq1.js +0 -2
  367. package/dist/chunk-v72t4sf9.js +0 -2
  368. package/dist/chunk-vw2hv2sq.js +0 -2
  369. package/dist/chunk-w3yddw6n.js +0 -2
  370. package/dist/chunk-x9pramem.js +0 -2
  371. package/dist/chunk-xjen1yt6.js +0 -2
package/README.md CHANGED
@@ -50,6 +50,35 @@ instead of following the bottom; `Viewport` replaces the scrolling element. Key
50
50
  session. This entry needs `@nyssance/codex-acp-v2` installed; it is an optional peer for the rest. `turns` exports the grouping for search sources and diagnostics, and `timeline-registry`
51
51
  lets search reveal a turn in the mounted timeline. `resource-content` renders a file, link or image the way the timeline does, for an application's `Markdown` inside it; outside the timeline, wrap it in `TimelineProvider`. The update scheduler moved to `@alwith/api/client`.
52
52
 
53
+ `conversation` exports `ConversationView`, one session's whole chat surface: the timeline, the
54
+ restoring, detached, stopped and read-only states, inline permission and URL requests, the form
55
+ dialog, the diff dialog and the `Composer`. The application passes the session, a
56
+ `ConversationClient` (`CodexClient` satisfies it) and a `ConversationHost`: the timeline host plus
57
+ optional long-paste files (`writeTextAttachment`) and titles for its own tools (`permissionTitle`,
58
+ `toolTitle`). Product content goes into slots: `header`, `overlay` (search, previews), `timeline`
59
+ (the `SessionTimeline` slots), `composer` and `children` (application dialogs). Errors go to
60
+ `host.reportError`; a `ReportedError` carries a `description` under its message. Key the view by
61
+ session.
62
+
63
+ The `Composer` keeps a draft per session (text, images, mentions) for the life of the page and
64
+ exposes it through `drafts`, `exportDraft`, `importDraft` and `setComposerDraft` for other windows
65
+ and extensions. Its footer has slash commands, `PermissionModeMenu`, `UsageMeter`, `ModelMenu` and
66
+ send, steer and stop. Hosts add tools before the send button through `actions` and adapters inside
67
+ the form through `children`; both read the composer through `useComposer()` (session, readiness,
68
+ the draft port, the interrupt hook for dictation and the receipt observer for hands-free turns).
69
+ `modelMenu` supplies the catalog policy (group order, decorations, short labels, a header action);
70
+ `modelSelector` replaces the menu, such as before a draft session exists. `ModelMenu` and
71
+ `PermissionModeMenu` write through `client.setConfig` unless the host passes `onConfigChange`, and
72
+ `ActionCard` answers through `client.respond` unless it passes `onRespond`. Outside a
73
+ `ConversationView`, wrap these in `ConversationProvider`.
74
+
75
+ `session-list` exports the sidebar's session list: project groups with five rows each and
76
+ "Show all", loading rows and retry, `SessionRow` with rename, fork or restore, archive, delete and
77
+ stop, the `SessionInfoCard` hover card, `ArchivedSessions` and the hooks behind them
78
+ (`useActivityPreview`, `useProjectSessions`). `SessionListProvider` takes the host and client and
79
+ owns the delete confirmation; slots add the application's row actions and group headers. Import
80
+ `@alwith/module-chat/session-list.css` once.
81
+
53
82
  `search` provides Desktop's complete find bar, DOM matching, highlights and navigation. The host supplies its viewport, labels and native-menu subscription; virtualized callers also supply source matches and an async turn-reveal callback. Key the component by session identity to discard the previous search on a session switch. Highlight ownership is per mounted search, and cancelled navigation cannot repaint after close. Source projection stays with the application's message model; the search component never reads a private store.
54
83
 
55
84
  `search-source` shares Unicode-aware literal matching and original UTF-16 offsets with DOM matching. This does **not** make raw tool fields, Markdown source or folded content equivalent to rendered text: the current per-turn occurrence index still requires a complete source-to-rendered mapping. Do not treat the current search counter as proof that every indexed match can be revealed. Automatic expansion of folded matches has not been agreed.
@@ -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{en,n,i}from"./chunk-azmqtycn.js";export{en as ActivityHostProvider,i as ActivityMarkdown,n as useActivityHost};
1
+ import{lr,a,v}from"./chunk-y6r6tzfh.js";export{lr as ActivityHostProvider,v as ActivityMarkdown,a as useActivityHost};
@@ -1 +1 @@
1
- import{Ye}from"../chunk-6qn5srgg.js";import{e}from"../chunk-801v0awm.js";import{P}from"../chunk-jrrvpnf3.js";import{u}from"../chunk-7q7c0mds.js";import{o}from"../chunk-hx6wfscz.js";import{v,c}from"../chunk-k7zzrns3.js";import{s}from"../chunk-c4621n0b.js";import{Oe,se,w,W}from"../chunk-dr6z453e.js";import{autoUpdate as K}from"@floating-ui/dom";import{cn as _}from"cn";import{useCallback as I,useEffect as z,useLayoutEffect as D,useMemo as j,useRef as X,useState as L}from"react";import{createPortal as J}from"react-dom";import{jsx as n,jsxs as p}from"react/jsx-runtime";var f="__other__";function me({current:l,total:q,anchorRef:E,t:x,onAccept:B,onDecline:H}){let S=j(()=>l?Oe(l.requestedSchema):[],[l]),[T,k]=L({}),Q=X(null);z(()=>{if(l?.elicitationId===void 0)return;let t={};for(let{key:d,property:r}of S)if(!w(r)){let g=W(r)[0];if(g)t[d]={selected:g.value}}k(t)},[l?.elicitationId,S]),z(()=>{if(l?.elicitationId!==void 0&&Q.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")Q.current.focus()},[l?.elicitationId]);let[C,M]=L(null),[R,G]=L(null),U=I(()=>{let t=E.current;if(!t)return;let d=t.getBoundingClientRect();if(d.width===0){let r=Math.min(640,window.innerWidth*0.9);M({left:(window.innerWidth-r)/2,width:r,bottom:24});return}M({left:d.left,width:d.width,bottom:window.innerHeight-d.bottom+20})},[E]);D(()=>{if(!l)return;let t=0,d=()=>{if(E.current){U();return}t=requestAnimationFrame(d)};return d(),()=>cancelAnimationFrame(t)},[l,U,E]),D(()=>{let t=E.current;if(!l||!t||!R)return;return K(t,R,U,{animationFrame:!0})},[l,R,E,U]);let F=j(()=>{if(!l)return!1;for(let{key:t,property:d}of S){let r=T[t];if(!r)return!1;if(w(d)){if(!r.selectedSet||r.selectedSet.size===0)return!1;if(r.selectedSet.has(f)&&!r.otherText?.trim())return!1}else{if(!r.selected)return!1;if(r.selected===f&&!r.otherText?.trim())return!1}}return!0},[l,S,T]),V=I(async()=>{if(!l)return;if(!F)return;let t={},d={};for(let{key:r,property:g}of S){let m=T[r];if(!m)continue;let b;if(w(g))t[r]=[...m.selectedSet??[]].map((h)=>h===f?(m.otherText??"").trim():h).filter(Boolean);else{let h=m.selected??"";if(t[r]=h===f?(m.otherText??"").trim():h,h!==f)b=W(g).find((i)=>i.value===h)?.preview}let N=m.notes?.trim();if(b||N)d[r]={...b&&{preview:b},...N&&{notes:N}}}await B(l.elicitationId,t,d)},[l,S,T,F,B]),O=I(async()=>{if(l)await H(l.elicitationId)},[l,H]);if(!l||!C)return null;return J(p("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),O()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:C.left,width:C.width,bottom:C.bottom,maxHeight:"70vh"},ref:(t)=>{Q.current=t,G(t)},children:[p("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[n("div",{className:"text-foreground text-sm font-medium",children:x("askUserQuestion.title")}),q>1&&n("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${q}`})]}),n("div",{className:"min-h-0 flex-1 overflow-y-auto",children:n("div",{className:"space-y-4 px-3 py-3",children:S.map(({key:t,property:d},r)=>{let g=T[t],m=g?.selected,b=g?.selectedSet??new Set,N=W(d),h=w(d);return p("div",{className:"space-y-2",children:[p("div",{className:"flex items-center gap-2",children:[n(Ye,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:se(d).title??t}),n("div",{className:"text-foreground text-sm font-medium",children:se(d).description})]}),h?p("div",{className:"space-y-1.5 ps-1",children:[N.map((i)=>p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(P,{checked:b.has(i.value),onCheckedChange:(a)=>{k((y)=>{let A=new Set(y[t]?.selectedSet??new Set);if(a)A.add(i.value);else A.delete(i.value);return{...y,[t]:{...y[t],selectedSet:A}}})}}),p("div",{className:"min-w-0 flex-1",children:[n("div",{className:"text-foreground text-sm",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs",children:i.description})]})]},i.value)),p("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[n(P,{checked:b.has(f),onCheckedChange:(i)=>{k((a)=>{let y=new Set(a[t]?.selectedSet??new Set);if(i)y.add(f);else y.delete(f);return{...a,[t]:{...a[t],selectedSet:y}}})}}),n("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:x("askUserQuestion.other")})]}),b.has(f)&&n("div",{className:"ps-7",children:n(u,{placeholder:x("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>k((a)=>({...a,[t]:{...a[t],otherText:i.target.value}}))})})]}):p(v,{value:m??"",onValueChange:(i)=>k((a)=>({...a,[t]:{...a[t],selected:i}})),className:"space-y-1.5 ps-1",children:[N.map((i)=>{let a=`${r}:${i.value}`;return p("div",{className:_("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",m===i.value&&"bg-muted/60"),children:[n(c,{value:i.value,id:a}),p(o,{htmlFor:a,className:"min-w-0 flex-1 cursor-pointer",children:[n("div",{className:"text-foreground text-sm font-normal",children:i.label}),i.description&&n("div",{className:"text-muted-foreground text-xs font-normal",children:i.description})]})]},i.value)}),p("div",{className:_("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",m===f&&"bg-muted/60"),children:[n(c,{value:f,id:`${r}:other`,className:"mt-0.5"}),n(o,{htmlFor:`${r}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:x("askUserQuestion.other")})]}),m===f&&n("div",{className:"ps-7",children:n(u,{placeholder:x("askUserQuestion.otherPlaceholder"),value:g?.otherText??"",onChange:(i)=>k((a)=>({...a,[t]:{...a[t],otherText:i.target.value}}))})})]}),!h&&m&&m!==f&&(()=>{let i=N.find((a)=>a.value===m)?.preview;if(!i)return null;return n("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:i})})(),N.some((i)=>i.preview)&&n(s,{placeholder:x("askUserQuestion.notesPlaceholder"),value:g?.notes??"",onChange:(i)=>k((a)=>({...a,[t]:{...a[t],notes:i.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),p("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[n(e,{variant:"ghost",size:"sm",onClick:()=>void O(),children:x("askUserQuestion.cancel")}),n(e,{size:"sm",disabled:!F,onClick:()=>void V(),children:x("askUserQuestion.submit")})]})]}),document.body)}export{me as ChoiceElicitationForm};
1
+ import{Ae}from"../chunk-hjm26kwf.js";import{e}from"../chunk-cg97byvk.js";import{ue}from"../chunk-1drkvxzk.js";import{l}from"../chunk-1hy64ewz.js";import{h}from"../chunk-nx91ewps.js";import{V,R}from"../chunk-ehh31hzz.js";import{C}from"../chunk-xjtqdp82.js";import{$n,Et,de,dt}from"../chunk-qbj5s8qa.js";import{autoUpdate as j}from"@floating-ui/dom";import{cn as H}from"cn";import{useCallback as Q,useEffect as M,useLayoutEffect as O,useMemo as _,useRef as G,useState as F}from"react";import{createPortal as W}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function ae({current:r,total:A,anchorRef:N,t:v,onAccept:I,onDecline:L}){let x=_(()=>r?$n(r.requestedSchema):[],[r]),[S,b]=F({}),E=G(null);M(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!de(o)){let u=dt(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),M(()=>{if(r?.elicitationId!==void 0&&E.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")E.current.focus()},[r?.elicitationId]);let[k,q]=F(null),[T,z]=F(null),y=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);q({left:(window.innerWidth-o)/2,width:o,bottom:24});return}q({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);O(()=>{if(!r)return;let t=0,a=()=>{if(N.current){y();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,y,N]),O(()=>{let t=N.current;if(!r||!t||!T)return;return j(t,T,y,{animationFrame:!0})},[r,T,N,y]);let U=_(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=S[t];if(!o)return!1;if(de(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 p;if(de(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)p=dt(u).find((s)=>s.value===f)?.preview}let g=d.notes?.trim();if(p||g)a[o]={...p&&{preview:p},...g&&{notes:g}}}await I(r.elicitationId,t,a)},[r,x,S,U,I]),B=Q(async()=>{if(r)await L(r.elicitationId)},[r,L]);if(!r||!k)return null;return W(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),B()},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,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:v("askUserQuestion.title")}),A>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${A}`})]}),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,p=u?.selectedSet??new Set,g=dt(a),f=de(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(Ae,{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})]}),f?m("div",{className:"space-y-1.5 ps-1",children:[g.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(ue,{checked:p.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(ue,{checked:p.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:v("askUserQuestion.other")})]}),p.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:v("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:[g.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:H("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(h,{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:H("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(h,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:v("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:v("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!f&&d&&d!==c&&(()=>{let s=g.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})})(),g.some((s)=>s.preview)&&i(C,{placeholder:v("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 B(),children:v("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!U,onClick:()=>void D(),children:v("askUserQuestion.submit")})]})]}),document.body)}export{ae as ChoiceElicitationForm};
@@ -1 +1 @@
1
- import{Oe,se,w,W}from"../chunk-dr6z453e.js";export{Oe as elicitationFields,se as elicitationLabels,W as elicitationOptions,w as isMultiSelect};
1
+ import{$n,Et,de,dt}from"../chunk-qbj5s8qa.js";export{$n as elicitationFields,Et as elicitationLabels,dt as elicitationOptions,de as isMultiSelect};
@@ -1 +1 @@
1
- import{on,ze,Fn,Dn}from"../chunk-5h13saah.js";export{on as PERMISSION_KIND_GROUP_ORDER,Fn as isAllowKind,Dn as isAlwaysKind,ze as sortPermissionOptions};
1
+ import{fr,Hn,Qr,Xr}from"../chunk-gwav4k8b.js";export{fr as PERMISSION_KIND_GROUP_ORDER,Qr as isAllowKind,Xr as isAlwaysKind,Hn as sortPermissionOptions};
@@ -1 +1 @@
1
- import{ze}from"../chunk-5h13saah.js";import{autoUpdate as L}from"@floating-ui/dom";import{cn as I}from"cn";import{CheckCheckIcon as M,CheckIcon as h,ShieldXIcon as V,XIcon as F}from"lucide-react";import{useCallback as H,useEffect as N,useId as T,useLayoutEffect as _,useRef as S,useState as f}from"react";import{createPortal as z}from"react-dom";import{jsx as i,jsxs as u}from"react/jsx-runtime";var U={allow_once:{icon:h},allow_always:{icon:M},reject_once:{icon:F},reject_always:{icon:V}};function Y({requestId:p,options:D,title:E,children:P,total:w=1,alwaysLabel:j="always",autoFocus:y="always",anchorRef:n,onRespond:r}){let b=T(),[a,g]=f(0),[s,v]=f(null),[l,A]=f(null),x=S(null),c=ze(D);N(()=>{g(0)},[p]),N(()=>{let e=document.activeElement;if(y==="always"||e===null||e===document.body)x.current?.focus()},[p,l,y]);let d=H(()=>{let e=n?.current;if(!e)return;let t=e.getBoundingClientRect();if(t.width===0){let o=Math.min(640,window.innerWidth*0.9);v({left:(window.innerWidth-o)/2,width:o,bottom:24});return}v({left:t.left,width:t.width,bottom:window.innerHeight-t.bottom+20})},[n]);if(_(()=>{if(!n)return;let e=0,t=()=>{if(n.current)d();else e=requestAnimationFrame(t)};return t(),()=>cancelAnimationFrame(e)},[p,n,d]),_(()=>{let e=n?.current;if(!e||!l)return;return L(e,l,d,{animationFrame:!0})},[n,l,d]),n&&!s)return null;let k=u("div",{ref:A,"data-overlay":"permission-request",className:I("bg-card border-border overflow-hidden rounded-lg border",n&&"fixed z-50"),style:n&&s?{left:s.left,width:s.width,bottom:s.bottom}:void 0,children:[u("div",{className:"border-border border-b px-3 py-2",children:[u("div",{className:"flex items-center justify-between gap-2",children:[i("div",{id:b,className:"text-foreground text-sm font-medium",children:E}),w>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${w}`})]}),P]}),i("div",{role:"listbox","aria-labelledby":b,tabIndex:0,ref:x,onKeyDown:(e)=>{let t=c.length;if(t===0&&e.key!=="Escape")return;if(e.key==="ArrowDown"||e.key==="ArrowUp")e.preventDefault(),g((o)=>e.key==="ArrowDown"?(o+1)%t:(o-1+t)%t);else if(e.key==="Enter")e.preventDefault(),r(c[a].optionId);else if(e.key==="Escape")e.preventDefault(),r(null);else if(/^[1-9]$/.test(e.key)&&Number(e.key)<=t)e.preventDefault(),r(c[Number(e.key)-1].optionId)},className:"outline-none",children:c.map((e,t)=>{let o=e.kind??"allow_once",C=U[o]?.icon??h,K=o==="allow_always"||o==="reject_always",O=o==="reject_once"||o==="reject_always";return u("div",{role:"option",tabIndex:-1,"aria-selected":t===a,title:e.description,onClick:()=>void r(e.optionId),onKeyDown:(m)=>{if(m.key==="Enter"||m.key===" ")m.preventDefault(),m.stopPropagation(),r(e.optionId)},className:I("flex cursor-pointer items-center gap-2 px-3 py-1.5 text-sm select-none",t===a?"bg-ring text-accent-foreground":"text-foreground",O&&t!==a&&"text-muted-foreground"),children:[i("span",{className:"min-w-3 text-xs opacity-70",children:t+1}),i(C,{className:"size-3.5 shrink-0 opacity-80"}),i("span",{className:"min-w-0 flex-1 truncate",children:e.name}),K&&i("span",{className:"bg-muted text-muted-foreground rounded px-1.5 py-0.5 text-[10px] tracking-wide uppercase",children:j})]},e.optionId)})})]});return n?z(k,document.body):k}export{Y as PermissionView};
1
+ import{_n}from"../chunk-hmze7f10.js";import"../chunk-gwav4k8b.js";export{_n as PermissionView};
@@ -1 +1 @@
1
- import{e}from"../chunk-801v0awm.js";import{P}from"../chunk-jrrvpnf3.js";import{L,A,tt,nt,_,rt}from"../chunk-6p5hgnpq.js";import{o}from"../chunk-hx6wfscz.js";import"../chunk-h38yw8y3.js";import{ne,re,Fe,De,Be,G}from"../chunk-sky795ex.js";import{u}from"../chunk-7q7c0mds.js";import{v,c}from"../chunk-k7zzrns3.js";import{R}from"../chunk-9s1cgt7s.js";import{s}from"../chunk-c4621n0b.js";import{isArrayProperty as w,isBooleanProperty as D,isNumberProperty as S,isStringProperty as C}from"@alwith/api";import{useEffect as E,useMemo as N,useState as V}from"react";import{jsx as a,jsxs as p}from"react/jsx-runtime";function q(r){if(!C(r))return null;if(r.oneOf&&r.oneOf.length>0)return r.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(r.enum&&r.enum.length>0)return r.enum.map((t)=>({value:t,label:t}));return null}function I(r){let t=r,n=t._meta?.alwith?.options;if(Array.isArray(n)&&Array.isArray(t.enum))return n.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));if(Array.isArray(t.enum))return t.enum.map((i)=>({value:String(i),label:String(i)}));if(Array.isArray(t.oneOf))return t.oneOf.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));return null}function B(r){let t=new Set(r.required??[]);return Object.entries(r.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:q(i),multiOptions:w(i)?I(i.items):null}))}function k(r){let t={};for(let n of r){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(D(n.property))t[n.key]=!1;else if(w(n.property))t[n.key]=[]}return t}function K(r,t){if(r.multiOptions)return Array.isArray(t)&&t.length>0;if(!r.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function O({id:r,label:t,description:n,control:i}){return p("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,p(o,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[a("div",{className:"text-foreground text-sm",children:t}),n&&a("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function T({id:r,field:t,value:n,onChange:i}){if(t.multiOptions){let l=new Set(Array.isArray(n)?n:[]);return p(ne,{children:[a(re,{variant:"label",children:t.title}),t.description&&a(G,{children:t.description}),a("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((d)=>{let f=`${r}:${d.value}`;return a(O,{id:f,...d,control:a(P,{id:f,checked:l.has(d.value),onCheckedChange:(y)=>{let g=new Set(l);if(y)g.add(d.value);else g.delete(d.value);i([...g])}})},d.value)})})]})}if(t.options)return p(ne,{children:[a(re,{variant:"label",children:t.title}),t.description&&a(G,{children:t.description}),a(v,{value:typeof n==="string"?n:"",onValueChange:(l)=>i(String(l)),className:"flex flex-col gap-1",children:t.options.map((l)=>{let d=`${r}:${l.value}`;return a(O,{id:d,...l,control:a(c,{value:l.value,id:d})},l.value)})})]});return p(De,{children:[a(Be,{htmlFor:r,children:t.title}),D(t.property)?a(R,{id:r,checked:n===!0,onCheckedChange:(l)=>i(l)}):S(t.property)?a(u,{id:r,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(l)=>i(l.target.value===""?void 0:Number(l.target.value))}):a(s,{id:r,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(l)=>i(l.target.value)}),t.description&&a(G,{children:t.description})]})}function ee({requestId:r,schema:t,message:n,total:i,t:l,onRespond:d}){let f=N(()=>B(t),[t]),[y,g]=V(()=>k(f));E(()=>g(k(f)),[r,f]);let b=f.every((m)=>K(m,y[m.key])),x=()=>{if(!b)return;let m={};for(let[h,F]of Object.entries(y))if(F!==void 0)m[h]=F;d({action:"accept",content:m})};return a(L,{open:!0,onOpenChange:(m)=>!m&&d({action:"cancel"}),children:p(A,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(m)=>{if(m.key==="Enter"&&(m.metaKey||m.ctrlKey))m.preventDefault(),x()},children:[p(tt,{children:[p("div",{className:"flex items-center justify-between gap-2 pe-8",children:[a(_,{children:t.title??l("approval.needed")}),i>1&&a("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),a(rt,{children:n})]}),a("div",{className:"min-h-0 flex-1 overflow-y-auto",children:a(Fe,{children:f.map((m)=>a(T,{id:`${r}:${m.key}`,field:m,value:y[m.key],onChange:(h)=>g((F)=>({...F,[m.key]:h}))},m.key))})}),p(nt,{children:[a(e,{variant:"ghost",onClick:()=>d({action:"decline"}),children:l("actions.decline")}),a(e,{disabled:!b,onClick:x,children:l("actions.submit")})]})]})})}export{ee as SchemaElicitationForm,B as elicitationFields,k as initialValues,K as isAnswered};
1
+ import{Sr,hr,Nr,On}from"../chunk-dsdxw9s8.js";import"../chunk-5wyxvpgt.js";import"../chunk-sj7jdb7m.js";import"../chunk-1drkvxzk.js";import"../chunk-qbdqh38y.js";import"../chunk-1hy64ewz.js";import"../chunk-1txn4b0v.js";import"../chunk-nx91ewps.js";import"../chunk-ehh31hzz.js";import"../chunk-xjtqdp82.js";import"../chunk-cg97byvk.js";export{On as SchemaElicitationForm,Sr as elicitationFields,hr as initialValues,Nr as isAnswered};
@@ -1 +1 @@
1
- import{e}from"../chunk-801v0awm.js";import{Ue,Ve,qe,Ke,Ge,We}from"../chunk-6qa5dt1k.js";import{ExternalLinkIcon as d}from"lucide-react";import{jsx as a,jsxs as n}from"react/jsx-runtime";function C({message:r,url:t,t:i,onOpen:l,onRespond:o}){return n(Ue,{size:"sm",children:[n(Ve,{children:[a(Ke,{children:i("approval.needed")}),a(qe,{children:r})]}),a(Ge,{children:n("div",{className:"flex flex-col gap-3",children:[n(e,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>void l(t),children:[a(d,{"data-icon":"inline-start"}),i("approval.openLink")]}),a("p",{className:"text-muted-foreground text-sm",children:i("approval.waitingForLink")})]})}),n(We,{className:"flex flex-wrap gap-2",children:[a(e,{variant:"outline",size:"sm",onClick:()=>o("decline"),children:i("actions.decline")}),a(e,{variant:"ghost",size:"sm",onClick:()=>o("cancel"),children:i("actions.cancel")})]})]})}export{C as UrlElicitationCard};
1
+ import{Fn}from"../chunk-epqjzw63.js";import"../chunk-scddkjv8.js";import"../chunk-cg97byvk.js";export{Fn as UrlElicitationCard};
@@ -0,0 +1,2 @@
1
+ import{ho,ye,jt,vo,xo,yo}from"./chunk-hhw1pjz6.js";import{forwardRef as ve,useCallback as K,useEffect as ge,useImperativeHandle as pe,useLayoutEffect as w,useMemo as ne,useRef as s,useState as F}from"react";import{jsx as R,jsxs as re}from"react/jsx-runtime";var Re=12,X=2,V=800,he=new Map;function He({turnKey:q,heightPx:x,placeholder:W=!1,deferUntilReady:n=!1,observe:H,onReady:L,children:z}){let h=s(null),[T,_]=F(!1),U=K((m)=>{h.current=m,H(q,m)},[H,q]);return w(()=>{let m=h.current;if(m===null)throw Error("Codex turn element is missing");let b=()=>{L(m),_(!0)};if(m.querySelector("[data-markdown-pending]")===null){b();return}let d=new MutationObserver(()=>{if(m.querySelector("[data-markdown-pending]")!==null)return;d.disconnect(),b()});return d.observe(m,{childList:!0,subtree:!0}),()=>d.disconnect()},[L]),re("div",{style:T?void 0:{position:"relative",height:x,overflow:"hidden"},children:[R("div",{ref:U,className:"[&_[data-virtualized-turn-content]]:[content-visibility:visible]","data-turn-key":q,"aria-busy":!T||void 0,style:!T&&!W&&n?{visibility:"hidden"}:void 0,"data-turn-ready":T?"":void 0,children:z}),!T&&!W&&n&&R("div",{"aria-hidden":"true",className:"codex-turn-loading",children:re("div",{className:"codex-turn-loading-lines",children:[R("span",{}),R("span",{}),R("span",{})]})})]})}var fo=ve(function({entries:x,renderTurn:W,scrollElement:n,sessionKey:H,leadingContent:L,leadingInsetPx:z=0,preserveViewport:h=!1},T){let _=s(null),[U,m]=F(z),b=L!==void 0&&L!==null;w(()=>{let e=_.current;if(e===null)return;let t=()=>m(e.getBoundingClientRect().height);t();let o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[b]);let d=ne(()=>he.get(H),[H]),[j,J]=F(()=>d?.turnHeightsByKey??{}),i=ne(()=>ho({entries:x,gapPx:Re,measuredHeightsByKey:j,leadingInsetPx:b?U:z}),[x,j,b,U,z]),me=ne(()=>{let e=ye({distanceFromBottomPx:d?.distanceFromBottomPx??0,layout:i,overscanCount:X,viewportHeightPx:V}),t=d?.renderedWindow;if(t===void 0||t===null)return e;return jt({anchorKey:t.anchorKey,layout:i,previousRange:{startIndex:0,endIndex:Math.min(t.count,e.endIndex-e.startIndex)}})??e},[d,i]),[M,ie]=F(me),[y,oe]=F(V),[c,ue]=F(null),N=s(d?.distanceFromBottomPx??0),k=s(M),ae=s(i.turnKeys),l=s(j),S=s(i),se=s(i),P=s(new Map),v=s(null),C=s(null),E=s(null),D=s(new Map),Q=s(!1),ce=s(()=>{}),O=s(null),de=K(()=>{if(!h||n===null||v.current!==null||O.current!==null)return;let e=n.getBoundingClientRect();if(e.height<=0)return;let t=[...P.current].filter(([,r])=>r.hasAttribute("data-turn-ready")).map(([r,u])=>{let a=u.getBoundingClientRect(),g=S.current.turnIndexByKey.get(r),B=g===void 0?a.height:S.current.heightsPx[g];return{key:r,element:u,rect:a,bottom:a.top+B}}).filter(({rect:r,bottom:u})=>u>e.top&&r.top<e.bottom).toSorted((r,u)=>r.rect.top-u.rect.top),o=t.flatMap((r)=>[...r.element.querySelectorAll("[data-user-message-bubble], .codex-markdown-root > *")].filter((u)=>!u.closest('[aria-hidden="true"], [inert]')).map((u)=>({key:r.key,element:u,rect:u.getBoundingClientRect()})).filter(({rect:u})=>u.height>0&&u.top>=e.top&&u.top<e.bottom)).toSorted((r,u)=>r.rect.top-u.rect.top)[0]??t[0];if(o)O.current={key:o.key,element:o.element,top:o.rect.top-e.top,scrollTop:n.scrollTop}},[h,n]),Y=s(de);Y.current=de;let p=K((e,t)=>{let o=Math.min(e,i.totalHeightPx),r=ye({distanceFromBottomPx:o,layout:i,overscanCount:X,viewportHeightPx:t}),u=k.current,a=u.startIndex<=r.startIndex&&u.endIndex>=r.endIndex?u:r;if(N.current=o,k.current=a,ae.current=i.turnKeys,oe(t),a!==u)ie(a)},[i]),A=K((e)=>{let t=Math.max(0,e.scrollHeight-i.totalHeightPx);return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop-t)},[i.totalHeightPx]),fe=K((e)=>{let t=e.dataset.turnKey;if(t===void 0)throw Error("Codex measured turn is missing its key");let o=Math.max(1,e.getBoundingClientRect().height);if(l.current[t]===o)return;Y.current();let r={...l.current,[t]:o};l.current=r,J(r)},[]),Z=K(()=>{if(C.current!==null)return C.current;return C.current=new ResizeObserver((e)=>{for(let t of e){let o=t.target;if(!("turnReady"in o.dataset)&&o.querySelector("[data-markdown-pending]")!==null)continue;let r=o.dataset.turnKey;if(r===void 0)throw Error("Codex measured turn is missing its key");let u=Math.max(1,t.borderBoxSize[0]?.blockSize??t.contentRect.height);D.current.set(r,u)}if(E.current!==null||D.current.size===0)return;E.current=requestAnimationFrame(()=>{E.current=null;let t=[...D.current].filter(([r,u])=>l.current[r]!==u);if(D.current.clear(),t.length===0)return;Y.current();let o={...l.current,...Object.fromEntries(t)};l.current=o,J(o)})}),C.current},[]),xe=K((e,t)=>{let o=P.current.get(e);if(o!==void 0)Z().unobserve(o),P.current.delete(e);if(t===null)return;if(t.dataset.turnKey!==e)throw Error(`Codex turn key does not match its element: ${e}`);P.current.set(e,t),Z().observe(t)},[Z]);ge(()=>()=>{if(C.current?.disconnect(),E.current!==null)cancelAnimationFrame(E.current);D.current.clear(),C.current=null,P.current.clear()},[]),w(()=>{ce.current=()=>{if(n===null)return;let e=A(n);if(v.current!==null){N.current=e,oe(n.clientHeight||V);return}p(e,n.clientHeight||V)}},[A,n,p]),w(()=>{if(n===null)return;if(!Q.current){Q.current=!0;let o=d?.distanceFromBottomPx??0;n.scrollTo({behavior:"instant",top:Math.max(0,o>0?S.current.totalHeightPx-n.clientHeight-o:n.scrollHeight-n.clientHeight)})}let e=()=>ce.current();e(),n.addEventListener("scroll",e,{passive:!0});let t=new ResizeObserver(e);return t.observe(n),()=>{n.removeEventListener("scroll",e),t.disconnect()}},[d,n]),w(()=>{if(n===null||c===null)return;let e=P.current.get(c.turnKey);if(e?.querySelector("[data-markdown-pending]")!==null)return;let t=e.offsetHeight;if(t<=0)return;if(l.current[c.turnKey]!==t){let g={...l.current,[c.turnKey]:t};l.current=g,J(g);return}let o=c.getTargetElement(e)??e,r=e.getBoundingClientRect(),u=o.getBoundingClientRect(),a=yo({align:c.align,layout:i,targetHeightPx:u.height,targetOffsetPx:u.top-r.top,turnKey:c.turnKey,viewportHeightPx:n.clientHeight});if(a===null)throw Error(`Codex virtual turn is missing: ${c.turnKey}`);n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-a)}),p(a,n.clientHeight||V),queueMicrotask(()=>{if(v.current!==c)return;c.complete(),v.current=null,ue(null)})},[i,c,n,p]),w(()=>{let e=se.current;if(se.current=i,S.current=i,n===null||c!==null){O.current=null;return}let t=O.current;O.current=null;let o=t===null?void 0:n.contains(t.element)?t.element:P.current.get(t.key);if(h&&e!==i&&t!==null&&o!==void 0){let u=o.getBoundingClientRect().top-n.getBoundingClientRect().top,a=n.scrollTop-t.scrollTop;n.scrollTop+=u-t.top+a,p(A(n),n.clientHeight);return}let r=N.current;if(h&&e!==i&&Q.current)r=Math.max(0,e.totalHeightPx-n.clientHeight-n.scrollTop);if((r>24||h)&&e!==i){let u=A(n);if(u<=96&&!h){p(u,y);return}let a=ye({distanceFromBottomPx:r,layout:e,overscanCount:0,viewportHeightPx:y}),g=e.turnKeys.slice(a.startIndex,a.endIndex).filter((f)=>i.turnIndexByKey.has(f)),B=g.find((f)=>l.current[f]!==void 0)??g[0];if(B!==void 0){let f=vo({anchorKey:B,distanceFromBottomPx:r,nextLayout:i,previousLayout:e});if(f===null)throw Error(`Codex viewport anchor is missing: ${B}`);r=f,n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-r)})}}p(r,y)},[i,c,A,n,p,y,h]),w(()=>{k.current=M},[M]),ge(()=>()=>{v.current?.complete(),v.current=null;let e=k.current,o=S.current.turnKeys[e.startIndex];he.set(H,{distanceFromBottomPx:N.current,renderedWindow:o===void 0?null:{anchorKey:o,count:e.endIndex-e.startIndex},turnHeightsByKey:l.current})},[H]),pe(T,()=>({scrollToKey(e,t=(r)=>r,o={align:"center"}){v.current?.complete();let r=i.turnIndexByKey.get(e);if(r===void 0)throw Error(`Codex virtual turn is missing: ${e}`);let u=i.turnKeys[r],a=xo({layout:i,turnKey:e,viewportHeightPx:y});if(a===null)throw Error(`Codex virtual turn is missing: ${e}`);let g=ye({distanceFromBottomPx:a,layout:i,overscanCount:X,viewportHeightPx:y});return k.current=g,ie(g),new Promise((B)=>{let f={align:o.align,complete:B,getTargetElement:t,turnKey:u};v.current=f,ue(f)})}}),[i,y]);let I=M,G=ae.current;if(!(G===i.turnKeys||G.length===i.turnKeys.length&&G.every((e,t)=>e===i.turnKeys[t]))){let e=G[M.startIndex];I=(e===void 0?null:jt({anchorKey:e,layout:i,previousRange:M}))??ye({distanceFromBottomPx:N.current,layout:i,overscanCount:X,viewportHeightPx:y})}let ee=x.length-1,le=x[ee],te=x.slice(I.startIndex,Math.min(I.endIndex,ee)).map((e,t)=>({entry:e,index:I.startIndex+t}));if(le!==void 0)te.push({entry:le,index:ee});return re("div",{"data-codex-timeline":!0,"data-codex-virtualized-pending-key":c?.turnKey,"data-codex-virtualized-range":`${I.startIndex}:${I.endIndex}`,"data-codex-virtualized-total-count":x.length,"data-codex-virtualized-turn-count":te.length,className:"relative shrink-0",style:{height:i.totalHeightPx},children:[b&&R("div",{ref:_,"data-codex-timeline-leading":!0,className:"absolute inset-x-0 top-0",children:L}),te.map(({entry:e,index:t})=>R("div",{className:"absolute inset-x-0",style:{top:i.topOffsetsPx[t]??0},children:R(He,{turnKey:e.turnKey,heightPx:i.heightsPx[t],placeholder:e.placeholder,deferUntilReady:e.deferUntilReady,observe:xe,onReady:fe,children:W(e,t)})},e.turnKey))]})});
2
+ export{fo};
@@ -0,0 +1,2 @@
1
+ import{f}from"./chunk-xf14bg2v.js";import{textOf as A,turns as S}from"@alwith/api";import{codexMessageError as _,nativeTurnId as y}from"@nyssance/codex-acp-v2/client";function qr(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 Jo(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),p=t.errors.findIndex((m)=>u!==null&&y(m)===u);if(p===-1)t.errors.push(e);else t.errors[p]=e;break}let s=E(e),i=e._meta?.codex,d=f(e._meta).length>0||typeof i==="object"&&i!==null&&"delivery"in i&&i.delivery==="async";if(f(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 er(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)=>!qr(r))},d=new Map(n.map((r,a)=>[r.turnId,a])),u=[],p=[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=[],p.push(u);if(u.push(r),a!==null||r.kind==="user")I=a;if(l!==void 0)m=l}return p.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(an),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 an(t){let e=t._meta?.codex;return t.replayed||typeof e==="object"&&e!==null&&"historyReplay"in e&&e.historyReplay===!0}function q(t){return A(t.content)}function $e(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function sn(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function tr(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 nr(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 or(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(!nr(t,e[n-1],o))break;n--}return e[n]?.key}function rr(t,e,n){let o=n,s=n;while(o>0&&nr(t,e[o-1],e[o]))o--;while(s+1<e.length&&nr(t,e[s],e[s+1]))s++;let i=e.slice(o,s+1),d=i.findLast((u)=>u.items.some((p)=>p.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{qr,Jo,er,an,q,$e,sn,tr,nr,or,rr};
@@ -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 Ut(i,e){return n??=new s,n.connect(i,e)}
2
- export{Ut};
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 Yo(i,e){return n??=new s,n.connect(i,e)}
2
+ export{Yo};
@@ -0,0 +1,2 @@
1
+ import{o}from"./chunk-6d38ff76.js";import{O,$t,F}from"./chunk-a2ftkzak.js";import{e}from"./chunk-cg97byvk.js";import{oe,re,ie,ae}from"./chunk-qgfq5vrz.js";import{lt,n,b}from"./chunk-76tkqx9n.js";import{Ge}from"./chunk-h7gq5y52.js";import{Ve}from"./chunk-q2ppgpfd.js";import{rt,it}from"./chunk-69yx37pv.js";import{at}from"./chunk-88vkk9s3.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:rt},[t]);return i(lt,{host:c,client:l,children:[r(R,{...s}),!t.openDiff&&r(it,{})]})}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(O,{children:[r(g,{}),r($t,{children:a("conversation.stopped")}),r(F,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),h?u??r(oe,{className:"flex-1",children:i(re,{children:[r(ie,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(ae,{children:a("conversation.welcomeDescription")})]})}):r(Ve,{session:t,timeline:c}),r(at,{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(O,{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($t,{children:a("conversation.readOnlyTitle")}),r(F,{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(Ge,{session:t})]}),C]})}
2
+ export{cr};
@@ -0,0 +1,2 @@
1
+ function Tr(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 pn(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(Tr(n,i))}return{imageFiles:e,sawNonImageFile:o}}function gn(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 Ir(t){return[...t].filter((e)=>!s(e)).join("")}function dr(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 We(t){let{value:e,selectionStart:o,selectionEnd:i}=t,n=Ir(e);if(n===e)return n;if(t.value=n,o!==null&&i!==null){let a=Math.max(0,o-dr(e,o)),r=Math.max(0,i-dr(e,i));requestAnimationFrame(()=>{t.setSelectionRange(a,r)})}return n}
2
+ export{Tr,pn,gn,Ir,dr,We};
@@ -0,0 +1,2 @@
1
+ import{uo}from"./chunk-an03g9e8.js";import{d,lo,u,m}from"./chunk-1txn4b0v.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 no({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(lo,{"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?uo({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{no};
@@ -0,0 +1,2 @@
1
+ import{Qo}from"./chunk-17wjmyj7.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 Ko({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(Qo,{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{Ko};
@@ -1,2 +1,2 @@
1
- import{PreviewCard as e}from"@base-ui/react/preview-card";import{jsx as o,jsxs as d}from"react/jsx-runtime";function $t({open:r,onOpenChange:a,trigger:i,children:t,...n}){return d(e.Root,{open:r,onOpenChange:a,children:[o(e.Trigger,{render:i,delay:700,closeDelay:100}),o(e.Portal,{children:o(e.Positioner,{...n,className:"isolate z-50",children:o(e.Popup,{"data-slot":"codex-hover-card",className:"m-0 outline-hidden",children:t})})})]})}
2
- export{$t};
1
+ import{PreviewCard as e}from"@base-ui/react/preview-card";import{jsx as o,jsxs as d}from"react/jsx-runtime";function Qo({open:r,onOpenChange:a,trigger:i,children:t,...n}){return d(e.Root,{open:r,onOpenChange:a,children:[o(e.Trigger,{render:i,delay:700,closeDelay:100}),o(e.Portal,{children:o(e.Positioner,{...n,className:"isolate z-50",children:o(e.Popup,{"data-slot":"codex-hover-card",className:"m-0 outline-hidden",children:t})})})]})}
2
+ export{Qo};
@@ -0,0 +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 ue({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{ue};
@@ -1 +1 @@
1
- import{Input as t}from"@base-ui/react/input";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function u({className:i,type:e,...r}){return o(t,{type:e,"data-slot":"input",className:n("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 h-9 w-full min-w-0 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",i),...r})}export{u};
1
+ import{Input as t}from"@base-ui/react/input";import{cn as n}from"cn";import{jsx as o}from"react/jsx-runtime";function l({className:i,type:e,...r}){return o(t,{type:e,"data-slot":"input",className:n("border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 h-9 w-full min-w-0 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",i),...r})}export{l};
@@ -0,0 +1 @@
1
+ import{e}from"./chunk-cg97byvk.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as g}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function d({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function gi({...o}){return a(i.Trigger,{"data-slot":"dialog-trigger",...o})}function Ar({...o}){return a(i.Portal,{"data-slot":"dialog-portal",...o})}function lo({...o}){return a(i.Close,{"data-slot":"dialog-close",...o})}function Lr({className:o,...t}){return a(i.Backdrop,{"data-slot":"dialog-overlay",className:r("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",o),...t})}function u({className:o,children:t,showCloseButton:n=!0,...s}){return l(Ar,{children:[a(Lr,{}),l(i.Popup,{"data-slot":"dialog-content",className:r("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md",o),...s,children:[t,n&&l(i.Close,{"data-slot":"dialog-close",render:a(e,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm"}),children:[a(g,{}),a("span",{className:"sr-only",children:"Close"})]})]})]})}function w({className:o,...t}){return a("div",{"data-slot":"dialog-header",className:r("flex flex-col gap-2",o),...t})}function z({className:o,showCloseButton:t=!1,children:n,...s}){return l("div",{"data-slot":"dialog-footer",className:r("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),...s,children:[n,t&&a(i.Close,{render:a(e,{variant:"outline"}),children:"Close"})]})}function m({className:o,...t}){return a(i.Title,{"data-slot":"dialog-title",className:r("font-heading leading-none font-medium",o),...t})}function k({className:o,...t}){return a(i.Description,{"data-slot":"dialog-description",className:r("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",o),...t})}export{d,gi,Ar,lo,Lr,u,w,z,m,k};
@@ -1,4 +1,4 @@
1
- function Re(t,e){if(e===0)return null;let r=e-1;while(r>=0){let n=t[r];if(n===" "||n==="\t"||n===`
1
+ function mn(t,e){if(e===0)return null;let r=e-1;while(r>=0){let n=t[r];if(n===" "||n==="\t"||n===`
2
2
  `)return null;if(n==="@"||n==="/"){let i=r===0?"":t[r-1],s=r===0||i===`
3
3
  `;if(n==="/"?s&&!/[/\\]/.test(t.slice(r+1,e)):s||i===" "||i==="\t")return{kind:n==="/"?"slash":"at",start:r,end:e,query:t.slice(r+1,e)}}r-=1}return null}
4
- export{Re};
4
+ export{mn};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-cg97byvk.js";import{no}from"./chunk-0k654tyt.js";import{Re,Me,Ee}from"./chunk-sqh158m4.js";import{x}from"./chunk-tpx841s3.js";import{cn as f}from"cn";import{PaperclipIcon as k,XIcon as T}from"lucide-react";import{Fragment as M,useEffect as L,useRef as z,useState as N}from"react";import{jsx as t,jsxs as o,Fragment as R}from"react/jsx-runtime";function E(n){return t(Ee,{align:"start",...n})}function fn({data:n,t:r,className:u,...c}){let p=x(),[d,h]=N(!1),[I,v]=N(1),C=z(null),s=n.filename||"",i=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",A=s||(i?r("input.image"):r("input.attachment"));return L(()=>{if(!d)return;let l=0.1,g=(a)=>Math.min(10,Math.max(0.1,a)),y=(a)=>{if(!(a.ctrlKey||a.metaKey))return;let m=a.key,w=m==="+"||m==="=",H=m==="-"||m==="_",b=m==="0";if(!w&&!H&&!b)return;a.preventDefault(),v((P)=>{if(b)return 1;if(w)return g(P+l);return g(P-l)})};return window.addEventListener("keydown",y,{passive:!1}),()=>window.removeEventListener("keydown",y)},[d]),o(R,{children:[o(Re,{children:[t(Me,{render:o("div",{className:f("group border-border hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent relative flex h-8 cursor-pointer items-center gap-1.5 rounded-md border px-1.5 text-sm font-medium transition-all select-none",u),...c,children:[o("div",{className:"relative size-5 shrink-0",children:[i?t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":r("input.image"),className:"bg-background absolute inset-0 size-5 overflow-hidden rounded p-0 transition-opacity group-hover:opacity-0",onClick:()=>{v(1),h(!0)},children:t("img",{alt:s||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20})}):t("div",{className:"bg-background text-muted-foreground absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded transition-opacity group-hover:opacity-0",children:t(k,{className:"size-3"})}),o(e,{"aria-label":r("input.removeAttachment"),className:f("absolute -top-1 -right-1 size-4 rounded-full p-0 opacity-0 transition-opacity [&>svg]:size-3","pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100"),onClick:(l)=>{l.stopPropagation(),p.remove(n.id)},type:"button",variant:"ghost",children:[t(T,{}),t("span",{className:"sr-only",children:r("input.removeAttachment")})]})]}),!i&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:A})]})}),t(E,{className:"w-auto p-2",children:o("div",{className:"w-auto space-y-3",children:[i&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:s||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448})}),t("div",{className:"flex items-center gap-2.5",children:o("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[t("h4",{className:"truncate text-sm leading-none font-semibold",children:s||(i?"Image":"Attachment")}),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType})]})})]})})]}),i&&n.url&&t(no,{containerRef:C,filename:s||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:I,url:n.url})]})}function hn({children:n,className:r,...u}){let c=x();if(!c.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:c.files.map((p)=>t(M,{children:n(p)},p.id))})}
2
+ export{fn,hn};
@@ -1,2 +1,2 @@
1
- import{Ot}from"./chunk-j2mcvb68.js";import{Ft,Dt,Bt}from"./chunk-2f19pcpn.js";import{zt}from"./chunk-jn2pj92h.js";import{t}from"./chunk-vw2hv2sq.js";import{h}from"./chunk-fvnb8ds4.js";import{textOf as f}from"@alwith/api";import{nativeTurnId as I}from"@nyssance/codex-acp-v2/client";import{useMemo as N}from"react";import{jsx as r,jsxs as v,Fragment as y}from"react/jsx-runtime";function sn(i,n){return{installUnlock:n==="none"?()=>()=>{}:Dt,preload:()=>{if(n!=="none")Ft(i)},playSequence:(a,d,l)=>Bt(a,d,l,i,n)}}function _t(i,n={},a){let d=[];for(let e of i){if(e.user===null)continue;let o="";for(let m of e.final){let p=f(m.content).trim();if(p.length===0)continue;o=p}let u=n[e.user.id],s=e.items.map(I).find((m)=>m!==null);d.push({id:e.user.id,turnKey:e.key,label:h(e.user),response:o,inputTokens:u?.inputTokens??0,outputTokens:u?.outputTokens??0,...s===void 0?{}:{nativeTurnId:s}})}if(!a?.complete)return d;let l=new Map;for(let e of d){if(e.nativeTurnId===void 0)continue;let o=l.get(e.nativeTurnId)??[];o.push(e),l.set(e.nativeTurnId,o)}let c=new Set(a.turns.map((e)=>e.turnId)),g=new Set(a.loadedTurnIds);return[...a.turns.flatMap((e)=>{let o=l.get(e.turnId);if(o)return o;if(g.has(e.turnId))return[];let u=a.previews[e.turnId];return((u?.messages.length)?u.messages:[{id:"",label:"",response:""}]).map((s,m)=>({id:`history:${e.turnId}:${m===0?"0":s.id}`,messageId:s.id||void 0,turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,isLoaded:!1,previewState:u?.state??"loading",label:s.label,response:s.response,inputTokens:0,outputTokens:0}))}),...d.filter((e)=>e.nativeTurnId===void 0||!c.has(e.nativeTurnId))]}function T({item:i}){let n=t(),a=N(()=>({theme:n.theme,copyLabel:n.t("actions.copy"),openLink:()=>{},preview:!0}),[n]);if(i.previewState==="loading")return v("div",{role:"status",className:"animate-pulse space-y-2 py-1","aria-label":n.t("timeline.navigationLoading"),children:[r("div",{className:"bg-muted h-3 w-3/5 rounded"}),r("div",{className:"bg-muted h-3 rounded"}),r("div",{className:"bg-muted h-3 w-4/5 rounded"})]});return v(y,{children:[r("div",{className:"min-w-0 truncate font-medium",children:i.previewState==="unavailable"?n.t("timeline.navigationUnavailable"):i.label||n.t("timeline.navigationEmpty")}),i.response&&r("div",{className:"text-muted-foreground pointer-events-none mt-1 line-clamp-3 [&_img]:hidden [&_pre]:max-h-20 [&_table]:table-fixed","data-navigation-response":!0,children:r(Ot,{text:i.response,host:a})})]})}function Ht(i){return r(zt,{...i,renderPreview:(n)=>r(T,{item:n})})}
2
- export{sn,_t,Ht};
1
+ import{jo}from"./chunk-f0sbnmcs.js";import{Vo,Go,Wo}from"./chunk-gtddnhdy.js";import{Ko}from"./chunk-0mf7yh69.js";import{t}from"./chunk-6d38ff76.js";import{q}from"./chunk-0fvpmcps.js";import{textOf as f}from"@alwith/api";import{nativeTurnId as I}from"@nyssance/codex-acp-v2/client";import{useMemo as N}from"react";import{jsx as r,jsxs as v,Fragment as y}from"react/jsx-runtime";function Br(i,n){return{installUnlock:n==="none"?()=>()=>{}:Go,preload:()=>{if(n!=="none")Vo(i)},playSequence:(a,d,l)=>Wo(a,d,l,i,n)}}function $o(i,n={},a){let d=[];for(let e of i){if(e.user===null)continue;let o="";for(let m of e.final){let p=f(m.content).trim();if(p.length===0)continue;o=p}let u=n[e.user.id],s=e.items.map(I).find((m)=>m!==null);d.push({id:e.user.id,turnKey:e.key,label:q(e.user),response:o,inputTokens:u?.inputTokens??0,outputTokens:u?.outputTokens??0,...s===void 0?{}:{nativeTurnId:s}})}if(!a?.complete)return d;let l=new Map;for(let e of d){if(e.nativeTurnId===void 0)continue;let o=l.get(e.nativeTurnId)??[];o.push(e),l.set(e.nativeTurnId,o)}let c=new Set(a.turns.map((e)=>e.turnId)),g=new Set(a.loadedTurnIds);return[...a.turns.flatMap((e)=>{let o=l.get(e.turnId);if(o)return o;if(g.has(e.turnId))return[];let u=a.previews[e.turnId];return((u?.messages.length)?u.messages:[{id:"",label:"",response:""}]).map((s,m)=>({id:`history:${e.turnId}:${m===0?"0":s.id}`,messageId:s.id||void 0,turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,isLoaded:!1,previewState:u?.state??"loading",label:s.label,response:s.response,inputTokens:0,outputTokens:0}))}),...d.filter((e)=>e.nativeTurnId===void 0||!c.has(e.nativeTurnId))]}function T({item:i}){let n=t(),a=N(()=>({theme:n.theme,copyLabel:n.t("actions.copy"),openLink:()=>{},preview:!0}),[n]);if(i.previewState==="loading")return v("div",{role:"status",className:"animate-pulse space-y-2 py-1","aria-label":n.t("timeline.navigationLoading"),children:[r("div",{className:"bg-muted h-3 w-3/5 rounded"}),r("div",{className:"bg-muted h-3 rounded"}),r("div",{className:"bg-muted h-3 w-4/5 rounded"})]});return v(y,{children:[r("div",{className:"min-w-0 truncate font-medium",children:i.previewState==="unavailable"?n.t("timeline.navigationUnavailable"):i.label||n.t("timeline.navigationEmpty")}),i.response&&r("div",{className:"text-muted-foreground pointer-events-none mt-1 line-clamp-3 [&_img]:hidden [&_pre]:max-h-20 [&_table]:table-fixed","data-navigation-response":!0,children:r(jo,{text:i.response,host:a})})]})}function qo(i){return r(Ko,{...i,renderPreview:(n)=>r(T,{item:n})})}
2
+ export{Br,$o,qo};
@@ -0,0 +1,2 @@
1
+ import{cn as a}from"cn";import{useRef as u,useState as E}from"react";import{jsx as l}from"react/jsx-runtime";var d=45,w=8;function M({className:i,children:p,onMouseEnter:c,onMouseLeave:f,...m}){let s=u(null),[t,r]=E(0);return l("span",{className:a("min-w-0 overflow-hidden",i),onMouseEnter:(e)=>{let n=s.current;if(!n)return;let o=n.scrollWidth-n.clientWidth;if(o>w)r(getComputedStyle(n).direction==="rtl"?o:-o);c?.(e)},onMouseLeave:(e)=>{r(0),f?.(e)},...m,children:l("span",{ref:s,className:a("block whitespace-nowrap",t===0?"truncate":"overflow-visible"),style:{transform:`translateX(${t}px)`,transition:`transform ${Math.abs(t)/d}s linear`},children:p})})}
2
+ export{M};
@@ -1,2 +1,2 @@
1
- function Rt(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReply"in o))return null;let n=o.questionReply;if(!n||typeof n!=="object"||!("question"in n)||!("answer"in n))return null;return typeof n.question==="string"&&typeof n.answer==="string"?{question:n.question,answer:n.answer}:null}function Lt(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReplyParts"in o))return null;let n=o.questionReplyParts;if(!Array.isArray(n)||n.length===0)return null;let i=n;if(!i.every((e)=>!!e&&typeof e==="object"&&("text"in e)&&typeof e.text==="string"&&(!("question"in e)||e.question===void 0||typeof e.question==="string")))return null;return i.map((e)=>({text:e.text,...e.question===void 0?{}:{question:e.question}}))}
2
- export{Rt,Lt};
1
+ function Bo(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReply"in o))return null;let n=o.questionReply;if(!n||typeof n!=="object"||!("question"in n)||!("answer"in n))return null;return typeof n.question==="string"&&typeof n.answer==="string"?{question:n.question,answer:n.answer}:null}function zo(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReplyParts"in o))return null;let n=o.questionReplyParts;if(!Array.isArray(n)||n.length===0)return null;let i=n;if(!i.every((e)=>!!e&&typeof e==="object"&&("text"in e)&&typeof e.text==="string"&&(!("question"in e)||e.question===void 0||typeof e.question==="string")))return null;return i.map((e)=>({text:e.text,...e.question===void 0?{}:{question:e.question}}))}
2
+ export{Bo,zo};
@@ -0,0 +1,2 @@
1
+ import{v}from"./chunk-y6r6tzfh.js";import{t}from"./chunk-6d38ff76.js";import{L}from"./chunk-3x1eq95a.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(v,{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 Z({content:e,messageId:o,streaming:r}){return e.map((s,a)=>n(d,{block:s,streaming:r},`${o}:${a}`))}
2
+ export{Z};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-cg97byvk.js";import{t,qe}from"./chunk-6d38ff76.js";import{isEmbeddedResource as B,isImage as h,isResourceLink as E}from"@alwith/api";import{DownloadIcon as T,FileIcon as N,ImageOffIcon as F,LoaderCircleIcon as U}from"lucide-react";import{useState as y}from"react";import{jsx as i,jsxs as r}from"react/jsx-runtime";function wr(a){let o=a.split(/[\\/]/).at(-1)??a;if(a.startsWith("file:")||/^https?:/.test(a))o=new URL(a).pathname.split("/").at(-1)??"";try{return decodeURIComponent(o)||"attachment"}catch(n){if(n instanceof URIError)return o||"attachment";throw n}}function b(a,o){let n=document.createElement("a");n.href=o,n.download=a,n.click()}function L({block:a,generated:o=!1}){let n=t(),[p,d]=y(!1),[I,C]=y(null);if(E(a)){if(a.uri==="codex-image:unavailable")return r("span",{className:"text-muted-foreground flex items-center gap-2 rounded-lg border p-3 text-sm",children:[i(F,{className:"size-4"}),n.t("timeline.imageUnavailable")]});let u=wr(a.uri);return r(e,{variant:"outline",className:"h-auto max-w-full min-w-0 justify-start gap-3 overflow-hidden p-3","aria-label":a.title??a.name,title:a.uri,onClick:()=>n.openLink(a.uri),children:[i(N,{}),r("span",{className:"min-w-0 flex-1 text-start",children:[i("span",{className:"block truncate",children:a.title??a.name}),r("span",{className:"text-muted-foreground block truncate text-xs",children:[(a.title??a.name)!==u&&`${u} · `,a.mimeType??u.split(".").at(-1)?.toUpperCase()]})]})]})}if(!B(a)&&!h(a))return null;let s=h(a)?{uri:a.uri??`image.${a.mimeType.split("/")[1]??"png"}`,mimeType:a.mimeType,blob:a.data}:a.resource,l=wr(s.uri);if("text"in s)return r("div",{className:"min-w-0",children:[i("pre",{className:"overflow-x-auto whitespace-pre-wrap",children:s.text}),r(e,{variant:"link",size:"sm",className:"max-w-full min-w-0",title:s.uri,onClick:()=>n.openLink(s.uri),children:[i(N,{}),i("span",{className:"truncate",children:l})]})]});let m=`data:${s.mimeType??"application/octet-stream"};base64,${s.blob}`,f=s.mimeType?.toLowerCase().startsWith("image/")&&I!==m,{openImage:g,openImageGallery:w}=n,x=w?()=>w([{src:m,alt:l,uri:s.uri}],0):g&&(()=>g(m)),c=o&&f,R=async()=>{d(!0);try{if(n.saveFile)await n.saveFile(l,s.blob);else b(l,m)}catch(u){qe(n,u)}finally{d(!1)}},v=i("img",{src:m,alt:"",className:o?"max-h-[40rem] max-w-full object-contain":"max-h-96 max-w-full rounded object-contain",onError:()=>C(m)});return r("div",{className:c?"codex-generated-image":"flex max-w-full min-w-0 flex-col items-start gap-1",children:[f&&(x===void 0?v:i(e,{variant:"ghost",className:o?"codex-generated-image-preview h-auto max-w-full p-0":"h-auto max-w-full p-0","aria-label":n.t("timeline.viewImage"),onClick:x,children:v})),r(e,{variant:c?"secondary":"link",size:c?"icon":"sm",className:c?"codex-generated-image-download":"max-w-full min-w-0",disabled:p,title:n.t("timeline.download",{name:l}),"aria-label":n.t("timeline.download",{name:l}),onClick:()=>{R()},children:[p?i(U,{className:"motion-safe:animate-spin"}):i(T,{}),!c&&i("span",{className:"truncate",children:l})]})]})}
2
+ export{wr,L};
@@ -0,0 +1,2 @@
1
+ var a=(e)=>String(e).padStart(2,"0");function Ue(e,l="user"){let r=e.replayed||e.items.some((t)=>t._meta?.codex&&typeof t._meta.codex==="object"&&("historyReplay"in t._meta.codex)&&t._meta.codex.historyReplay===!0),n=l==="user"?s(e.user?._meta,"messageSentAt")??(!r?e.user?.at??null:null):s(e.final.at(-1)?._meta,"messageCompletedAt")??e.items.map((t)=>s(t._meta,"turnCompletedAt")).find((t)=>t!==null)??(!r&&e.final.length>0?e.endedAt:null);if(n===null)return null;let o=new Date(n),u=o.toDateString()===new Date().toDateString();return{short:new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",...u?{}:{month:"short",day:"numeric"}}).format(o),full:`${o.getFullYear()}-${a(o.getMonth()+1)}-${a(o.getDate())} ${a(o.getHours())}:${a(o.getMinutes())}`}}function s(e,l){let r=e?.codex;if(typeof r!=="object"||r===null)return null;let n=r[l];return typeof n==="number"&&Number.isFinite(n)&&Math.abs(n)<=8640000000000000?n:null}
2
+ export{Ue};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-cg97byvk.js";import{me,pe,W,ge,mt,fe,Le,De,_e,Ot,P}from"./chunk-5s2wpbdt.js";import{Ne}from"./chunk-5wyxvpgt.js";import{se,le,ce}from"./chunk-z75zbdq8.js";import{Pt}from"./chunk-rdtj6bad.js";import{p}from"./chunk-cywx4qmv.js";import{cn as m}from"cn";import{ArrowUpRight as E,ChevronUp as L,Loader2Icon as j,Zap as B}from"lucide-react";import{Fragment as ee,useState as G}from"react";import{jsx as n,jsxs as s,Fragment as c}from"react/jsx-runtime";function kn({value:h,onChange:F,models:v,modelGroups:f,compactCatalog:l,effortPresentation:V="slider",unavailableEffort:N,providerMenu:w,header:g,className:z,condensed:S,stripLabelPrefix:C,showDescription:U,showModelList:Z=!0,loading:q,switching:_,isLoading:H,effortConfig:i,booleanOptions:y,onBooleanChange:T,selectOptions:J=[],t:u,...r}){let[K,Q]=G(!1),[X,Y]=G(!1),d=y?.find((a)=>a.id==="fast_mode"),O=l?y?.filter((a)=>a!==d):y,R=(a)=>C&&a.startsWith(C)?a.slice(C.length):a;if(q)return n("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:s(e,{variant:"ghost",disabled:!0,className:m("h-7 min-w-0 shrink gap-1.5 rounded-md px-2 text-xs font-normal",z),children:[n(j,{className:"size-3 animate-spin"}),n("span",{className:"text-muted-foreground truncate",children:u("model.loadingModels")})]})});return s("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:[w&&s(me,{open:K,onOpenChange:Q,children:[s(se,{children:[n(le,{render:n(pe,{render:s(e,{"data-testid":"provider-trigger",variant:"ghost",disabled:r.disabled,className:m("h-7 shrink-0 gap-1 rounded-md px-1.5","hover:bg-accent"),children:[w.icon,n(L,{className:"size-2.5 shrink-0 opacity-60"})]})})}),n(ce,{children:u("model.switchProvider")})]}),s(W,{side:"top",align:"end",sideOffset:4,className:"z-100 min-w-[10rem]",children:[w.groups.map((a,t)=>s(ee,{children:[t>0&&a.length>0&&n(P,{}),n(p,{value:w.value,onValueChange:w.onChange,options:a})]},t)),w.moreAction&&s(c,{children:[n(P,{}),s(fe,{onClick:w.moreAction,className:"whitespace-nowrap",children:[n("span",{className:"min-w-0 flex-1 truncate",children:u("model.moreModels")}),n(E,{className:"size-4"})]})]})]})]}),s(me,{open:X,onOpenChange:Y,children:[s(se,{children:[n(le,{render:n(pe,{render:s(e,{"data-testid":"model-trigger","aria-busy":_,variant:"ghost",className:m("h-7 gap-1.5 rounded-md px-2 text-xs font-normal","hover:bg-accent","max-w-full min-w-0 shrink",S&&"h-7 gap-1 px-1.5 text-[11px]",z),...r,children:[h.icon,y?.some((a)=>a.id==="fast_mode"&&a.currentValue&&!a.disabled)&&n(B,{"aria-hidden":"true",className:"size-3 shrink-0 fill-current"}),n("span",{className:m("min-w-0 flex-1 truncate text-start",S&&"text-[11px]"),children:R(h.label)||u("model.selectModel")}),i&&s("span",{className:"text-muted-foreground grid shrink-0 justify-items-center",children:[n("span",{className:"invisible col-start-1 row-start-1",children:i.sizer??i.levels.reduce((a,t)=>t.name.length>a.length?t.name:a,"")}),n("span",{className:"col-start-1 row-start-1",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),_?n(j,{"data-testid":"model-switch-loading",className:"size-3 shrink-0 animate-spin"}):n(L,{className:m("size-3 shrink-0",S&&"size-2.5")})]})})}),n(ce,{children:u("model.switchModel")})]}),s(W,{side:"top",align:"end",sideOffset:4,className:m("z-100 w-auto max-w-[min(24rem,calc(100vw-1rem))] min-w-[14rem]",l&&"flex h-[350px] w-80 min-w-0 flex-col overflow-hidden rounded-xl p-1.5"),children:[l&&s(c,{children:[s(ge,{"data-model-menu-header":!0,className:"flex shrink-0 items-center justify-between gap-2 px-1 py-1",children:[i?V==="slider"?n("div",{role:"menuitem","aria-label":i.name,className:"min-w-0 [&>div]:justify-start [&>div]:gap-3 [&>div]:px-2 [&>div]:py-1.5",children:n(Pt,{...i,disabled:r.disabled})}):s(Le,{children:[s(De,{disabled:r.disabled,className:"h-8 min-w-0 flex-1 gap-2 rounded-md",children:[n("span",{children:i.name}),n("span",{className:"text-muted-foreground min-w-0 truncate text-xs",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),n(_e,{children:n(p,{value:i.value,onValueChange:i.onChange,options:i.levels.map((a)=>({value:a.value,label:a.name}))})})]}):N?s(fe,{disabled:!0,className:"h-8 min-w-0 flex-1 gap-2",children:[n("span",{children:N.name}),n("span",{className:"text-muted-foreground truncate text-xs",children:N.label})]}):n(mt,{className:"min-w-0 flex-1 truncate",children:g?.name}),d&&n(Ot,{"aria-label":d.name,title:d.title??d.name,disabled:r.disabled||d.disabled,checked:d.currentValue,closeOnClick:!1,onCheckedChange:(a)=>T?.(d.id,a),className:m("hover:bg-accent focus:hover:bg-accent focus-visible:bg-accent ml-auto size-8 shrink-0 justify-center rounded-md p-0 focus:bg-transparent [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",d.currentValue&&!d.disabled?"text-foreground [&_svg]:fill-current":"text-muted-foreground"),children:d.icon??n(B,{className:"size-4","aria-hidden":"true"})})]}),n(P,{className:"shrink-0"})]}),g&&!l&&s(c,{children:[s("div",{className:"flex items-center gap-2 px-2 py-2",children:[g.icon,n("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:g.name}),g.action]}),n(P,{})]}),s(ge,{"data-model-menu-list":l?"":void 0,className:l?"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain":void 0,children:[Z&&(H?n(fe,{disabled:!0,className:"text-muted-foreground",children:u("model.loadingModels")}):v.length===0?n(fe,{disabled:!0,className:"text-muted-foreground",children:u("model.noModelsAvailable")}):(()=>{let a=v.filter((o)=>!o.more),t=v.filter((o)=>o.more),I=a.length>0&&t.length>0,M=(o,b)=>({disabled:r.disabled,icon:o.icon,value:o.api_id,label:R(o.label),description:b?.noDescription?void 0:U?o.description:void 0}),D=(o)=>{let b=v.find((k)=>k.api_id===o);if(b)F(b)};if(l)return n(p,{value:h.api_id,onValueChange:D,itemClassName:"min-w-0 max-w-full font-normal whitespace-nowrap",options:v.map((o)=>M(o))});return s(c,{children:[f?f.map((o)=>{let b=o.models.filter((x)=>!x.more),k=o.models.filter((x)=>x.more),A=b.length>0&&k.length>0;return s(ge,{children:[n(mt,{className:"text-muted-foreground text-xs font-normal",children:o.name}),n(p,{value:h.api_id,onValueChange:D,itemClassName:"font-medium whitespace-nowrap",options:(A?b:o.models).map((x)=>M(x))}),A&&s(Le,{children:[n(De,{className:"font-medium whitespace-nowrap",children:u("model.moreModels")}),n(_e,{children:n(p,{value:h.api_id,onValueChange:D,itemClassName:"font-medium whitespace-nowrap",options:k.map((x)=>M(x,{noDescription:!0}))})})]})]},o.id)}):n(p,{value:h.api_id,onValueChange:D,itemClassName:"font-medium whitespace-nowrap",options:(I?a:v).map((o)=>M(o))}),!f&&I&&s(Le,{children:[n(De,{className:"font-medium whitespace-nowrap",children:u("model.moreModels")}),n(_e,{children:n(p,{value:h.api_id,onValueChange:D,itemClassName:"font-medium whitespace-nowrap",options:t.map((o)=>M(o,{noDescription:!0}))})})]})]})})()),!l&&i&&s(c,{children:[n(P,{}),V==="menu"?s(Le,{children:[s(De,{disabled:r.disabled,children:[n("span",{className:"flex-1",children:i.name}),n("span",{className:"text-muted-foreground",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),n(_e,{children:n(p,{value:i.value,onValueChange:i.onChange,options:i.levels.map((a)=>({value:a.value,label:a.name}))})})]}):n(Pt,{...i,disabled:r.disabled})]}),!l&&!i&&N&&s(c,{children:[n(P,{}),s(fe,{disabled:!0,children:[n("span",{className:"flex-1",children:N.name}),n("span",{children:N.label})]})]}),J.map((a)=>s(ge,{children:[n(P,{}),n(mt,{children:a.name}),n(p,{value:a.value,onValueChange:a.onChange,options:a.options,itemClassName:"whitespace-nowrap"})]},a.id)),O&&O.length>0&&s(c,{children:[!i&&n(P,{}),O.map((a)=>l?s(Ot,{"aria-label":a.name,title:a.title,disabled:r.disabled||a.disabled,checked:a.currentValue,closeOnClick:!1,onCheckedChange:(t)=>T?.(a.id,t),className:"justify-between gap-3 py-2.5 pr-2 [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",children:[s("span",{className:"flex items-center gap-2",children:[a.icon,a.name]}),n("span",{"aria-hidden":"true",className:m("flex h-[18px] w-8 shrink-0 items-center rounded-full p-0.5",a.currentValue?"bg-primary":"bg-input"),children:n("span",{className:m("bg-background size-3.5 rounded-full shadow-xs transition-transform",a.currentValue&&"translate-x-3.5")})})]},a.id):s("div",{title:a.title,className:m("flex items-center justify-between gap-3 px-2 py-2.5",a.disabled&&"opacity-50"),children:[s("span",{className:"flex items-center gap-2 text-sm font-medium",children:[a.icon,a.name]}),n(Ne,{"aria-label":a.name,disabled:r.disabled||a.disabled,checked:a.currentValue,onCheckedChange:(t)=>T?.(a.id,t)})]},a.id))]})]}),l&&g?.action&&s(c,{children:[n(P,{className:"shrink-0"}),n(ge,{"data-model-menu-footer":!0,className:"shrink-0",children:g.action})]})]})]})]})}
2
+ export{kn};
@@ -0,0 +1 @@
1
+ import{Menu as n}from"@base-ui/react/menu";import{cn as i}from"cn";import{CheckIcon as c,ChevronRightIcon as p}from"lucide-react";import{jsx as t,jsxs as u}from"react/jsx-runtime";function me({...e}){return t(n.Root,{"data-slot":"dropdown-menu",...e})}function li({...e}){return t(n.Portal,{"data-slot":"dropdown-menu-portal",...e})}function pe({...e}){return t(n.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function W({align:e="start",alignOffset:o=0,side:a="bottom",sideOffset:r=4,className:d,...s}){return t(n.Portal,{children:t(n.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:o,side:a,sideOffset:r,children:t(n.Popup,{"data-slot":"dropdown-menu-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 duration-100 outline-none data-closed:overflow-hidden",d),...s})})})}function ge({...e}){return t(n.Group,{"data-slot":"dropdown-menu-group",...e})}function mt({className:e,inset:o,...a}){return t(n.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":o,className:i("text-muted-foreground px-2 py-1.5 text-xs font-medium data-inset:pl-8",e),...a})}function fe({className:e,inset:o,variant:a="default",...r}){return t(n.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:i("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function Le({...e}){return t(n.SubmenuRoot,{"data-slot":"dropdown-menu-sub",...e})}function De({className:e,inset:o,children:a,...r}){return u(n.SubmenuTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:i("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[a,t(p,{className:"ml-auto"})]})}function _e({align:e="start",alignOffset:o=-3,side:a="right",sideOffset:r=0,className:d,...s}){return t(W,{"data-slot":"dropdown-menu-sub-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 w-auto min-w-[96px] rounded-md p-1 shadow-lg ring-1 duration-100",d),align:e,alignOffset:o,side:a,sideOffset:r,...s})}function Ot({className:e,children:o,checked:a,inset:r,...d}){return u(n.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":r,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...d,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:t(n.CheckboxItemIndicator,{children:t(c,{})})}),o]})}function Jn({...e}){return t(n.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...e})}function eo({className:e,children:o,inset:a,...r}){return u(n.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:t(n.RadioItemIndicator,{children:t(c,{})})}),o]})}function P({className:e,...o}){return t(n.Separator,{"data-slot":"dropdown-menu-separator",className:i("bg-border -mx-1 my-1 h-px",e),...o})}function ci({className:e,...o}){return t("span",{"data-slot":"dropdown-menu-shortcut",className:i("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest",e),...o})}export{me,li,pe,W,ge,mt,fe,Le,De,_e,Ot,Jn,eo,P,ci};
@@ -0,0 +1,2 @@
1
+ import{D}from"./chunk-hrexfky6.js";import{t}from"./chunk-6d38ff76.js";import{SquareSlashIcon as s}from"lucide-react";import{useRef as l}from"react";import{jsx as r}from"react/jsx-runtime";function yn({textareaRef:a,onOpenChange:p,menuOpen:e,disabled:m}){let{t:o}=t(),n=l(!1);return r(D,{"aria-label":o("composer.commands"),title:o("composer.commands"),disabled:m,"aria-pressed":e,onPointerDown:()=>{n.current=e},onClick:()=>{p(!n.current),a.current?.getTextarea()?.focus()},children:r(s,{className:"size-4"})})}
2
+ export{yn};
@@ -0,0 +1 @@
1
+ import{Switch as a}from"@base-ui/react/switch";import{cn as d}from"cn";import{jsx as e}from"react/jsx-runtime";function Ne({className:i,size:t="default",...r}){return e(a.Root,{"data-slot":"switch","data-size":t,className:d("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",i),...r,children:e(a.Thumb,{"data-slot":"switch-thumb",className:"bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"})})}export{Ne};
@@ -0,0 +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};
@@ -0,0 +1,4 @@
1
+ import{No}from"./chunk-gsq8mzr7.js";import{t}from"./chunk-6d38ff76.js";import{Bo,zo}from"./chunk-3ryhmzsq.js";import{L}from"./chunk-3x1eq95a.js";import{q}from"./chunk-0fvpmcps.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 So=p(function({item:s,messageTime:c}){let l=t(),o=zo(s._meta),m=o?o.map((e)=>e.question===void 0?e.text:`${e.question}
2
+ ${e.text}`).join(`
3
+ `):q(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=Bo(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(L,{block:e},`${s.id}:${n}`))}),r(No,{host:l,message:s,text:m,textParts:u.some((e)=>("question"in e))?u:void 0,images:a,mentions:[],messageTime:c})]})});
4
+ export{So};
@@ -0,0 +1,2 @@
1
+ var Q="quick-chats";function E(e){let t=n(e);if(/^[a-z]:\//i.test(t)||t.startsWith("//"))return/^[a-z]:\/users\/[^/]+\/documents\/(codex(?:\/.*)?|alwith)$/.test(t);return/^\/Users\/[^/]+\/Documents\/(Codex(?:\/.*)?|ALwith)$/.test(e.replace(/\/+$/,""))}function n(e){return e.replaceAll("\\","/").replace(/^\/\/\?\/UNC\//i,"//").replace(/^\/\/\?\//,"").replace(/\/+$/,"").toLowerCase()}function xe(e){let t=new Map([["quick-chats",[]]]);for(let r of[...e].toSorted((s,o)=>(o.updatedAt??"").localeCompare(s.updatedAt??""))){let s=E(r.cwd)?"quick-chats":r.cwd,o=t.get(s);if(o)o.push(r);else t.set(s,[r])}return[...t]}function B(e){let t=e.replaceAll("\\","/").replace(/\/+$/,"").split("/").pop();return t?t:e}
2
+ export{Q,E,xe,B};
@@ -0,0 +1,3 @@
1
+ import{Dn,Se}from"./chunk-6j4g51ff.js";import{t,we}from"./chunk-6d38ff76.js";import{d,u,w,m,k}from"./chunk-1txn4b0v.js";import{createStore as f}from"@alwith/api/client";import{jsx as i,jsxs as l}from"react/jsx-runtime";var c=f({request:null});function rt(e){c.setState({request:{path:e.path,patch:Ln(e.patch,e.path)}})}function Ln(e,a){let n=e.split(/^(?=diff --git )/m).filter((o)=>o.length>0);if(n.length<=1)return e;return n.find((o)=>{let r=o.split(`
2
+ `,1)[0]??"";return r.endsWith(` b/${a}`)||r.endsWith(` ${a}`)||r.includes(`/${a} `)})??e}function it(){let{t:e,theme:a}=t(),n=we(c,(o)=>o.request),s=n===null?null:Dn(n.patch);return i(d,{open:n!==null,onOpenChange:(o)=>!o&&c.setState({request:null}),children:l(u,{className:"flex h-[calc(100vh-2.5rem)] max-h-[900px] flex-col gap-3 sm:max-w-[min(1400px,calc(100vw-2.5rem))]",children:[l(w,{children:[i(m,{className:"truncate pe-8 font-mono text-sm font-normal",children:n?.path}),s!==null&&l(k,{children:[l("span",{className:"codex-diff-additions",children:["+",s.additions]})," ",l("span",{className:"codex-diff-deletions",children:["-",s.deletions]})," ",i("span",{children:e("conversation.changedLines")})]})]}),i("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden rounded-lg border [&>.codex-patch-view]:h-full","data-stream-style":"codexUI",children:n!==null&&i(Se,{patch:n.patch,theme:a})})]})})}
3
+ export{rt,Ln,it};
@@ -0,0 +1,2 @@
1
+ import{lr}from"./chunk-y6r6tzfh.js";import{createContext as s,useContext as l,useSyncExternalStore as m}from"react";import{jsx as r}from"react/jsx-runtime";var c=s(null),u=s(null);function J({host:e,client:n,children:i}){return r(lr,{host:e,children:r(c,{value:e,children:r(u,{value:n,children:i})})})}function t(){let e=l(c);if(e===null)throw Error("Timeline host is missing");return e}function ee(){let e=l(u);if(e===null)throw Error("Timeline client is missing");return e}function we(e,n){return m((i)=>e.subscribe(i),()=>n(e.getState()),()=>n(e.getState()))}function o(e){let n=ee();return we(n.store,e)}function qe(e,n){if(e.reportError)e.reportError(n);else console.error(n)}
2
+ export{J,t,ee,we,o,qe};
@@ -0,0 +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 Dn(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{Dn,Se};
@@ -0,0 +1,2 @@
1
+ import{v}from"./chunk-y6r6tzfh.js";import{U}from"./chunk-rkqe8p8n.js";import{isPlanItems as n,isPlanMarkdown as r}from"@alwith/api";import{jsx as e}from"react/jsx-runtime";function Ho({plan:t}){if(r(t))return e("div",{className:"codex-reasoning-details",children:e(v,{text:t.content,streaming:!1})});if(!n(t))return null;return e(U,{entries:t.entries})}
2
+ export{Ho};
@@ -0,0 +1,2 @@
1
+ import{g,s,kt,r,S}from"./chunk-gb2dmt6b.js";import{H}from"./chunk-r7c0tca8.js";import{yt}from"./chunk-bwas6kp2.js";import{pt}from"./chunk-pkgrt90z.js";import{He,gt}from"./chunk-qqdca2rm.js";import{hasRename as F}from"@nyssance/codex-acp-v2/client";import{ArchiveIcon as D,ArchiveRestoreIcon as A,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 Bt({sessionRow:e,active:f,onSelect:u,onForked:p=u,onHoverCardOpenChange:a,actions:c}){let i=g(),{t:m,i18n:v}=i,k=s(),l=r((o)=>o.runStates[e.sessionId]),h=kt(),d=()=>u(e);return n(yt,{"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:()=>h(e),onForked:p,actions:c}),meta:e.updatedAt!==null?n("span",{className:"text-muted-foreground shrink-0 text-xs",children:He(e.updatedAt,v.language)}):void 0,actions:l!=null?n(pt,{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=g(),{t:c}=a,i=s(),m=r((t)=>F(t.agent)),v=r((t)=>t.connection==="ready"&&t.agent?.capabilities?.session?.fork!=null),[k,l]=y(!1),[h,d]=y(!1),o=B(!1);return n(gt,{sessionRow:e,renaming:k,onRename:(t)=>{if(l(!1),t!==null)S(a,i.renameSession(e.sessionId,t))},actions:b(C,{children:[m&&n(H,{icon:n(x,{}),label:c("sessionList.rename"),onClick:()=>l(!0)}),p,e.archived?n(H,{icon:n(A,{}),label:c("sessionList.unarchive"),onClick:()=>void S(a,i.unarchive(e.sessionId))}):b(C,{children:[n(H,{icon:n(N,{}),label:c("sessionList.fork"),disabled:!v||h,onClick:()=>{if(o.current)return;o.current=!0,d(!0),S(a,i.fork(e.sessionId,e.cwd).then((t)=>{let I=i.state.sessionList.find((L)=>L.sessionId===t);if(!I)throw Error("Forked chat is missing from the session list");u(I)}).finally(()=>{o.current=!1,d(!1)}))}}),n(H,{icon:n(D,{}),label:c("sessionList.archive"),onClick:()=>void S(a,i.archive(e.sessionId))})]}),n(H,{variant:"destructive",icon:n(R,{}),label:c("sessionList.delete"),onClick:f})]})})}
2
+ export{Bt};
@@ -0,0 +1,2 @@
1
+ import{J}from"./chunk-6d38ff76.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 lt({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{lt,n,b};
@@ -1,5 +1,5 @@
1
- import{ve}from"./chunk-4svwa5p8.js";import{t}from"./chunk-vw2hv2sq.js";import{isDiffEntry as p}from"@alwith/api";import{jsx as f,jsxs as g,Fragment as h}from"react/jsx-runtime";function fn(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 hn(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 vn(o){let s=new Map;for(let e of o)for(let n of e.content){if(!p(n))continue;let i=n.patch?hn(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?fn(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 bt({items:o}){let s=t(),{openDiff:e,FileIcon:n}=s;return f(ve,{files:vn(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{fn,hn,vn,bt};
1
+ import{Zt}from"./chunk-yg42bpjr.js";import{t}from"./chunk-6d38ff76.js";import{isDiffEntry as p}from"@alwith/api";import{jsx as f,jsxs as g,Fragment as h}from"react/jsx-runtime";function Dr(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 _r(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 Hr(o){let s=new Map;for(let e of o)for(let n of e.content){if(!p(n))continue;let i=n.patch?_r(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?Dr(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 Io({items:o}){let s=t(),{openDiff:e,FileIcon:n}=s;return f(Zt,{files:Hr(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{Dr,_r,Hr,Io};
@@ -0,0 +1,2 @@
1
+ function tt(n){return`file://${encodeURI(n.absPath).replaceAll(/[?#]/g,encodeURIComponent)}`}function nt(n){return n.replace(/[\\/]+$/,"").split(/[\\/]/).at(-1)??n}function ot(n){return nt(n.absPath)}
2
+ export{tt,nt,ot};
@@ -0,0 +1,2 @@
1
+ import{o}from"./chunk-6d38ff76.js";import{ne,Pe,st}from"./chunk-n4cseazv.js";import{jsx as n,jsxs as m,Fragment as r}from"react/jsx-runtime";var c=[];function at({sessionId:s}){let e=o((i)=>i.actions),l=e.some((i)=>i.sessionId===s)?e.filter((i)=>i.sessionId===s):c,t=l.filter(ne),a=l.filter((i)=>!ne(i));return m(r,{children:[a.length>0&&n("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-3 px-6 pb-3","data-session-actions":!0,children:a.map((i)=>n(st,{action:i},i.id))}),t[0]!==void 0&&n(Pe,{action:t[0],total:t.length},t[0].id)]})}
2
+ export{at};
@@ -0,0 +1,2 @@
1
+ import{o}from"./chunk-6d38ff76.js";import{Re,Me,Ee}from"./chunk-sqh158m4.js";import{n}from"./chunk-76tkqx9n.js";import{y,G}from"./chunk-9c41y5hw.js";import{hasAccount as D}from"@nyssance/codex-acp-v2/client";import{cn as M}from"cn";import{useEffect as C,useState as L}from"react";import{jsx as a,jsxs as u}from"react/jsx-runtime";var d=new Intl.NumberFormat("en-US",{maximumFractionDigits:0}),H=new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1}),T=new Intl.NumberFormat("en-US",{maximumFractionDigits:1});function p(e){return typeof e==="number"&&!Number.isNaN(e)?Math.max(0,e):0}function W(e,t){let r=Math.min(100,e/t*100),s=r>=90?"text-destructive":r>=70?"text-foreground":"text-muted-foreground";return{pct:r,className:s}}function F(e){let t=y(e.configOptions,"model");return t===void 0?void 0:G(t)}function bn(e,t){let r=e.windowDurationMins;if(r===null)return t("usage.usage");if(r%1440===0)return t("usage.windowDays",{count:r/1440});return t("usage.windowHours",{count:Math.round(r/60)})}function z(){let{client:e}=n(),t=o((i)=>i.connection==="ready"&&D(i.agent)),[r,s]=L(null);return C(()=>{if(!t){s(null);return}let i=!0;e.readRateLimits().then((m)=>{if(i)s(m)},()=>{return});let l=e.onRateLimits((m)=>{if(i)s(m)});return()=>{i=!1,l()}},[t,e]),r}function Ke({session:e}){let{t}=n().host,r=z(),{usage:s,lastTurnUsage:i}=e;if(s===null&&i===null)return null;let l=s&&s.size>0?W(s.used,s.size):null,m=7,N=2*Math.PI*m,x=p(i?.inputTokens),h=p(i?.outputTokens),f=p(i?.cachedReadTokens),v=p(i?.cachedWriteTokens),b=p(i?.totalTokens)||x+h+f+v,k=x+f,w=k>0?H.format(f/k):t("tokens.notAvailable"),R=[[t("tokens.input"),d.format(x)],[t("tokens.output"),d.format(h)],[t("tokens.cachedRead"),d.format(f)],[t("tokens.cachedWrite"),d.format(v)],[t("tokens.cacheHitRate"),w],[t("tokens.total"),d.format(b)]],g=F(e);return u(Re,{children:[a(Me,{delay:100,closeDelay:100,render:u("button",{type:"button",className:M("hover:text-foreground flex h-7 items-center gap-1.5 rounded-md px-1.5 text-xs tabular-nums",l?.className??"text-muted-foreground"),"aria-label":t("tokens.openDetails"),children:[u("svg",{viewBox:"0 0 18 18",className:"size-4","aria-hidden":"true",children:[a("circle",{cx:"9",cy:"9",r:m,fill:"none",stroke:"currentColor",strokeOpacity:"0.2",strokeWidth:"2"}),l!==null&&a("circle",{cx:"9",cy:"9",r:m,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:N,strokeDashoffset:N*(1-l.pct/100),transform:"rotate(-90 9 9)"})]}),l!==null&&u("span",{children:[Math.round(l.pct),"%"]})]})}),u(Ee,{align:"end",side:"top",sideOffset:8,className:"w-56 p-0",children:[g!==void 0&&a("div",{className:"border-b px-3 py-2",children:a("p",{className:"text-foreground truncate text-xs font-semibold",title:g,children:g})}),u("div",{className:"flex flex-col gap-3 p-3",children:[i!==null&&u("div",{className:"flex flex-col gap-1.5",children:[a("p",{className:"text-xs font-medium",children:t("tokens.openDetails")}),a("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:R.map(([c,S])=>u("div",{className:"contents",children:[a("dt",{className:"text-muted-foreground",children:c}),a("dd",{className:"text-end tabular-nums",children:S})]},c))})]}),s!==null&&s.size>0&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[a("p",{className:"text-xs font-medium",children:t("tokens.context")}),a("p",{className:"text-muted-foreground text-xs tabular-nums",children:t("tokens.contextSummary",{used:d.format(s.used),limit:d.format(s.size),percent:T.format(s.used/s.size*100)})})]}),r!==null&&(r.primary!==null||r.secondary!==null)&&u("div",{className:"flex flex-col gap-1.5 border-t pt-2",children:[a("p",{className:"text-xs font-medium",children:t("usage.limits")}),a("dl",{className:"grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 text-xs",children:[r.primary,r.secondary].filter((c)=>c!==null).map((c)=>u("div",{className:"contents",children:[a("dt",{className:"text-muted-foreground",children:bn(c,t)}),a("dd",{className:"text-end tabular-nums",children:t("usage.used",{percent:Math.round(Math.min(100,Math.max(0,c.usedPercent)))})})]},`${c.windowDurationMins??"window"}`))})]})]})]})]})}
2
+ export{bn,Ke};