@alwith/module-chat 0.5.0 → 0.5.2

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 (208) hide show
  1. package/README.md +23 -10
  2. package/dist/activity-host.d.ts +1 -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-15nwm04a.js +2 -0
  11. package/dist/chunk-16y5rmm5.js +2 -0
  12. package/dist/chunk-1d4c9j8w.js +2 -0
  13. package/dist/chunk-20zcgxa5.js +4 -0
  14. package/dist/{chunk-kaeqvcew.js → chunk-2epnn4sq.js} +1 -1
  15. package/dist/chunk-2f19pcpn.js +2 -0
  16. package/dist/chunk-3vt71emt.js +2 -0
  17. package/dist/{chunk-1yy2jsnh.js → chunk-42zr8zpv.js} +2 -2
  18. package/dist/{chunk-k7s0drzk.js → chunk-4svwa5p8.js} +3 -3
  19. package/dist/chunk-4tkxmh52.js +2 -0
  20. package/dist/chunk-5grywgpq.js +4 -0
  21. package/dist/chunk-5h13saah.js +2 -0
  22. package/dist/chunk-5j3wnans.js +2 -0
  23. package/dist/{chunk-yw4e2tcz.js → chunk-6p5hgnpq.js} +1 -1
  24. package/dist/{chunk-kget6qfz.js → chunk-6qa5dt1k.js} +1 -1
  25. package/dist/{chunk-341yykkp.js → chunk-6qn5srgg.js} +1 -1
  26. package/dist/{chunk-1cy1j8gj.js → chunk-6vky4fcv.js} +2 -2
  27. package/dist/{chunk-p9wpghey.js → chunk-7kcdf82d.js} +2 -2
  28. package/dist/{chunk-1hy64ewz.js → chunk-7q7c0mds.js} +1 -1
  29. package/dist/{chunk-wjejhpgw.js → chunk-801v0awm.js} +1 -1
  30. package/dist/{chunk-evcrrxfp.js → chunk-8e7xf2tb.js} +1 -1
  31. package/dist/chunk-8k7wzkna.js +2 -0
  32. package/dist/chunk-8vvn71rf.js +2 -0
  33. package/dist/{chunk-0e1pdbec.js → chunk-9ab18v07.js} +2 -2
  34. package/dist/{chunk-ph7bk34y.js → chunk-9dsa5vm7.js} +2 -2
  35. package/dist/chunk-9pdj44jr.js +2 -0
  36. package/dist/{chunk-m5pbe513.js → chunk-9s1cgt7s.js} +1 -1
  37. package/dist/chunk-aqj0v5a9.js +7 -0
  38. package/dist/chunk-azmqtycn.js +2 -0
  39. package/dist/{chunk-3eg720sa.js → chunk-b5mkvr4d.js} +2 -2
  40. package/dist/chunk-bfe7xk9m.js +3 -0
  41. package/dist/{chunk-k1pd257q.js → chunk-bkbemt8g.js} +2 -2
  42. package/dist/{chunk-d0ptk8x8.js → chunk-c4621n0b.js} +1 -1
  43. package/dist/chunk-cw9tg2sz.js +1 -0
  44. package/dist/{chunk-25na55ve.js → chunk-d675nr2b.js} +2 -2
  45. package/dist/{chunk-y2xbq7rb.js → chunk-d8gwsw6j.js} +3 -3
  46. package/dist/{chunk-1twg3evk.js → chunk-dgp9q950.js} +1 -1
  47. package/dist/chunk-dm31xvh3.js +2 -0
  48. package/dist/chunk-dr6z453e.js +2 -0
  49. package/dist/{chunk-4gayxp21.js → chunk-ea7zsd2s.js} +2 -2
  50. package/dist/chunk-fgsd4fsd.js +2 -0
  51. package/dist/chunk-fvnb8ds4.js +2 -0
  52. package/dist/{chunk-qj8r5xvx.js → chunk-h0dq9ztv.js} +2 -2
  53. package/dist/{chunk-66headm4.js → chunk-h38yw8y3.js} +1 -1
  54. package/dist/{chunk-hnt4tt1n.js → chunk-h6df4xfd.js} +2 -2
  55. package/dist/chunk-h87xp1gv.js +2 -0
  56. package/dist/{chunk-bwzjm3g8.js → chunk-hx6wfscz.js} +1 -1
  57. package/dist/chunk-j2mcvb68.js +7 -0
  58. package/dist/chunk-jeyvacx6.js +5 -0
  59. package/dist/chunk-jh8jske0.js +2 -0
  60. package/dist/chunk-jn2pj92h.js +2 -0
  61. package/dist/{chunk-r5d37dc0.js → chunk-jrrvpnf3.js} +1 -1
  62. package/dist/chunk-jsb0zged.js +2 -0
  63. package/dist/chunk-k2y4cpra.js +2 -0
  64. package/dist/{chunk-zt7a6b1m.js → chunk-k7zzrns3.js} +1 -1
  65. package/dist/chunk-m2myfd89.js +2 -0
  66. package/dist/chunk-m2wxz0sj.js +2 -0
  67. package/dist/chunk-nxarfyj2.js +2 -0
  68. package/dist/chunk-p1pd1twf.js +2 -0
  69. package/dist/chunk-p6558tbk.js +2 -0
  70. package/dist/{chunk-e9zndx26.js → chunk-phe3an96.js} +2 -2
  71. package/dist/{chunk-ftka421d.js → chunk-q7e2bdav.js} +2 -2
  72. package/dist/chunk-qh5fhcrh.js +3 -0
  73. package/dist/chunk-sky795ex.js +1 -0
  74. package/dist/chunk-t3vgbc9s.js +2 -0
  75. package/dist/{chunk-90rwhxdf.js → chunk-t5nstx0k.js} +2 -2
  76. package/dist/chunk-trgq8rq1.js +2 -0
  77. package/dist/{chunk-bf5fh35b.js → chunk-v0zn87k5.js} +2 -2
  78. package/dist/chunk-v72t4sf9.js +2 -0
  79. package/dist/chunk-vhat5rbz.js +2 -0
  80. package/dist/chunk-vw2hv2sq.js +2 -0
  81. package/dist/{chunk-3496tgga.js → chunk-w3yddw6n.js} +2 -2
  82. package/dist/chunk-x9pramem.js +2 -0
  83. package/dist/{chunk-arge74eh.js → chunk-xjen1yt6.js} +2 -2
  84. package/dist/{chunk-g20b01rn.js → chunk-ypvjzkfb.js} +2 -2
  85. package/dist/codex/activity-group.js +1 -1
  86. package/dist/codex/assistant-message.js +1 -2
  87. package/dist/codex/async-question-card.js +1 -3
  88. package/dist/codex/disclosure-state.js +1 -1
  89. package/dist/codex/edited-files-card.js +1 -1
  90. package/dist/codex/image-view-activity.js +1 -1
  91. package/dist/codex/markdown-renderer.js +1 -6
  92. package/dist/codex/navigation-audio.d.ts +5 -5
  93. package/dist/codex/navigation-audio.js +1 -1
  94. package/dist/codex/navigation-preview.js +1 -1
  95. package/dist/codex/navigation-rail.js +1 -1
  96. package/dist/codex/plan.js +1 -1
  97. package/dist/codex/styles.css +176 -0
  98. package/dist/codex/timeline-virtualizer.js +1 -1
  99. package/dist/codex/user-message.js +1 -1
  100. package/dist/codex/virtualized-turn-list.js +1 -1
  101. package/dist/composer/completion-filter.js +1 -1
  102. package/dist/composer/completion-menu.js +2 -2
  103. package/dist/composer/completion-trigger.js +1 -1
  104. package/dist/composer/effort-slider.js +1 -1
  105. package/dist/composer/menu-radio.js +1 -1
  106. package/dist/composer/model-select.js +1 -1
  107. package/dist/composer/permission-mode-select.js +1 -1
  108. package/dist/composer/prompt-input-attachments.js +1 -1
  109. package/dist/composer/prompt-input-clipboard.js +1 -1
  110. package/dist/composer/prompt-input-context.js +1 -1
  111. package/dist/composer/prompt-input-textarea.js +3 -3
  112. package/dist/composer/prompt-input.js +1 -1
  113. package/dist/image-lightbox.js +1 -1
  114. package/dist/image-preview-dialog.js +1 -1
  115. package/dist/lib/code-highlighter.js +1 -1
  116. package/dist/lib/fuzzy.js +1 -1
  117. package/dist/lib/group-blocks.js +1 -1
  118. package/dist/lib/image-encode.js +1 -1
  119. package/dist/lib/limits.js +1 -1
  120. package/dist/lib/markdown-parser.js +1 -1
  121. package/dist/lib/markdown-rules.js +1 -1
  122. package/dist/lib/model-name.js +1 -1
  123. package/dist/lib/pointer-centered-zoom.js +1 -1
  124. package/dist/lib/prepare-prompt-files.js +1 -1
  125. package/dist/lib/stream-style.js +1 -1
  126. package/dist/lib/streaming-markdown.js +1 -1
  127. package/dist/locales.d.ts +312 -0
  128. package/dist/locales.js +1 -1
  129. package/dist/search/chat-search.js +1 -1
  130. package/dist/search/dom-matches.js +1 -1
  131. package/dist/search/find-bar.js +1 -1
  132. package/dist/search/literal-matches.js +1 -1
  133. package/dist/session-timeline/activity-group.d.ts +7 -0
  134. package/dist/session-timeline/activity-group.js +1 -0
  135. package/dist/session-timeline/activity-projection.d.ts +3 -0
  136. package/dist/session-timeline/activity-projection.js +1 -0
  137. package/dist/session-timeline/assistant-content.d.ts +7 -0
  138. package/dist/session-timeline/assistant-content.js +1 -0
  139. package/dist/session-timeline/assistant-turn.d.ts +28 -0
  140. package/dist/session-timeline/assistant-turn.js +1 -0
  141. package/dist/session-timeline/async-questions.d.ts +5 -0
  142. package/dist/session-timeline/async-questions.js +1 -0
  143. package/dist/session-timeline/edited-files-card.d.ts +18 -0
  144. package/dist/session-timeline/edited-files-card.js +1 -0
  145. package/dist/session-timeline/history-timeline.d.ts +12 -0
  146. package/dist/session-timeline/history-timeline.js +1 -0
  147. package/dist/session-timeline/host.d.ts +14 -0
  148. package/dist/session-timeline/host.js +1 -0
  149. package/dist/session-timeline/navigation-rail.d.ts +10 -0
  150. package/dist/session-timeline/navigation-rail.js +1 -0
  151. package/dist/session-timeline/plan.d.ts +4 -0
  152. package/dist/session-timeline/plan.js +1 -0
  153. package/dist/session-timeline/question-reply.d.ts +8 -0
  154. package/dist/session-timeline/question-reply.js +1 -0
  155. package/dist/session-timeline/resource-content.d.ts +7 -0
  156. package/dist/session-timeline/resource-content.js +1 -0
  157. package/dist/session-timeline/session-timeline.d.ts +40 -0
  158. package/dist/session-timeline/session-timeline.js +1 -0
  159. package/dist/session-timeline/timeline-registry.d.ts +12 -0
  160. package/dist/session-timeline/timeline-registry.js +1 -0
  161. package/dist/session-timeline/turn-error.d.ts +14 -0
  162. package/dist/session-timeline/turn-error.js +1 -0
  163. package/dist/session-timeline/turn-retry.d.ts +2 -0
  164. package/dist/session-timeline/turn-retry.js +1 -0
  165. package/dist/session-timeline/turn-time.d.ts +5 -0
  166. package/dist/session-timeline/turn-time.js +1 -0
  167. package/dist/session-timeline/turns.d.ts +51 -0
  168. package/dist/session-timeline/turns.js +1 -0
  169. package/dist/session-timeline/types.d.ts +31 -0
  170. package/dist/session-timeline/types.js +0 -0
  171. package/dist/session-timeline/use-timeline-scroll.d.ts +12 -0
  172. package/dist/session-timeline/use-timeline-scroll.js +1 -0
  173. package/dist/session-timeline/user-message.d.ts +8 -0
  174. package/dist/session-timeline/user-message.js +1 -0
  175. package/dist/ui/badge.js +1 -1
  176. package/dist/ui/button.js +1 -1
  177. package/dist/ui/card.js +1 -1
  178. package/dist/ui/checkbox.js +1 -1
  179. package/dist/ui/dialog.js +1 -1
  180. package/dist/ui/dropdown-menu.js +1 -1
  181. package/dist/ui/field.js +1 -1
  182. package/dist/ui/hover-card.js +1 -1
  183. package/dist/ui/input-group-textarea.js +1 -1
  184. package/dist/ui/input-group.js +1 -1
  185. package/dist/ui/input.js +1 -1
  186. package/dist/ui/label.js +1 -1
  187. package/dist/ui/radio-group.js +1 -1
  188. package/dist/ui/separator.js +1 -1
  189. package/dist/ui/switch.js +1 -1
  190. package/dist/ui/textarea.js +1 -1
  191. package/dist/ui/tooltip.js +1 -1
  192. package/package.json +32 -4
  193. package/dist/chunk-2q9rzxbj.js +0 -2
  194. package/dist/chunk-36h9z1mt.js +0 -1
  195. package/dist/chunk-7tj0a2na.js +0 -2
  196. package/dist/chunk-8z8va1ws.js +0 -2
  197. package/dist/chunk-91nk8n6w.js +0 -2
  198. package/dist/chunk-c4cqqqqh.js +0 -2
  199. package/dist/chunk-cp20nzhv.js +0 -2
  200. package/dist/chunk-gfj69sqc.js +0 -2
  201. package/dist/chunk-mbrd76nh.js +0 -2
  202. package/dist/chunk-pc1yzf1x.js +0 -1
  203. package/dist/chunk-pqgtv07g.js +0 -2
  204. package/dist/chunk-reqrpvyy.js +0 -2
  205. package/dist/chunk-rgy601b7.js +0 -2
  206. package/dist/chunk-svmc952q.js +0 -7
  207. package/dist/chunk-tzdd96d0.js +0 -2
  208. package/dist/chunk-yvj5y06y.js +0 -2
@@ -0,0 +1,7 @@
1
+ import{n,i}from"./chunk-azmqtycn.js";import{be}from"./chunk-7kcdf82d.js";import{m}from"./chunk-d8gwsw6j.js";import{d}from"./chunk-trgq8rq1.js";import{M,Nt}from"./chunk-m2wxz0sj.js";import{f}from"./chunk-v0zn87k5.js";import{cn as b}from"cn";import{BotIcon as ue,CheckIcon as me,CopyIcon as pe}from"lucide-react";import{Fragment as ge,useEffect as Z,useRef as H,useState as D}from"react";import{jsx as a,jsxs as y,Fragment as U}from"react/jsx-runtime";function G(e,t){let[o,r]=D(()=>({key:e,mounted:t})),s=t||o.key===e&&o.mounted;if(o.key!==e||o.mounted!==s)r({key:e,mounted:s});return s}var K=new WeakMap,J=1;function T(e){if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return`${e.type}:${e.id}`;if(e.type==="thinking"&&e.id!==void 0)return`thinking:${e.id}`;let t=K.get(e);if(t!==void 0)return`${e.type}:${t}`;let o=J;return J+=1,K.set(e,o),`${e.type}:${o}`}function k(e){switch(e){case"pending":case"in_progress":return!0;case"completed":case"failed":case"cancelled":case"interrupted":return!1;default:throw Error(`Unknown ACP tool status: ${e}`)}}function W(e,t){let o=Math.max(0,Math.round(e/1000)),r=Math.floor(o/3600),s=Math.floor(o%3600/60),c=o%60;if(c>=60)s+=Math.floor(c/60),c%=60;if(s>=60)r+=Math.floor(s/60),s%=60;let u=Intl.DurationFormat;if(u)try{return new u(t,{style:"narrow"}).format({hours:r,minutes:s,seconds:r>0?0:c})}catch{}if(r>0)return s>0?`${r}h ${s}m`:`${r}h`;if(s>0)return c>0?`${s}m ${c}s`:`${s}m`;return`${c}s`}var fe="M7.52925 3.7793C7.75652 3.55203 8.10803 3.52383 8.36616 3.69434L8.47065 3.7793L14.2207 9.5293C14.4804 9.789 14.4804 10.211 14.2207 10.4707L8.47065 16.2207C8.21095 16.4804 7.78895 16.4804 7.52925 16.2207C7.26955 15.961 7.26955 15.539 7.52925 15.2793L12.8085 10L7.52925 4.7207L7.44429 4.61621C7.27378 4.35808 7.30198 4.00657 7.52925 3.7793Z";function S({expanded:e,className:t}){return a("svg",{className:b("codex-activity-disclosure",e&&"codex-activity-disclosure-expanded",t),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:fe})})}function Ce(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M16.3965 5.01128C16.3963 4.93399 16.3489 4.87691 16.293 4.85406L16.2354 4.84332C13.9306 4.91764 12.5622 5.32101 10.665 6.34722V16.3716C11.3851 15.9994 12.0688 15.7115 12.7861 15.5015C13.8286 15.1965 14.9113 15.0633 16.2402 15.0435L16.2979 15.0308C16.353 15.0063 16.3965 14.9483 16.3965 14.8755V5.01128ZM3.54492 14.8765C3.54492 14.9725 3.62159 15.0422 3.70117 15.0435L4.19629 15.0562C5.94062 15.1247 7.26036 15.4201 8.65918 16.0484C8.05544 15.1706 7.14706 14.436 6.17871 14.1109V14.1099C5.56757 13.9045 5.16816 13.3314 5.16797 12.6988V4.98882C4.86679 4.93786 4.60268 4.8999 4.28223 4.87457L3.72754 4.84429C3.62093 4.84079 3.54505 4.92417 3.54492 5.01226V14.8765ZM17.7266 14.8755C17.7266 15.6314 17.1607 16.2751 16.4121 16.3628L16.2598 16.3736C15.0122 16.3922 14.0555 16.5159 13.1602 16.7779C12.2629 17.0404 11.3966 17.4508 10.3369 18.0738C10.129 18.1959 9.87099 18.1958 9.66309 18.0738C7.71455 16.9283 6.31974 16.4689 4.12988 16.3853L3.68164 16.3736C2.85966 16.3614 2.21484 15.6838 2.21484 14.8765V5.01226C2.21497 4.15391 2.93263 3.4871 3.77246 3.51519L4.39844 3.54937C4.67996 3.57191 4.92258 3.60421 5.16797 3.64214V2.51031C5.16797 1.44939 6.29018 0.645615 7.31055 1.15679L7.31152 1.15582C8.78675 1.89511 10.0656 3.33006 10.5352 4.91461C12.3595 3.98907 13.8688 3.58817 16.1924 3.51324L16.3506 3.51714C17.1285 3.5741 17.7264 4.23496 17.7266 5.01128V14.8755ZM6.49805 12.6988C6.49824 12.7723 6.5442 12.8296 6.60254 12.8492L6.96289 12.9859C7.85245 13.3586 8.68125 13.9846 9.33496 14.7496V5.5816C9.08794 4.37762 8.13648 3.1566 6.95801 2.47613L6.71582 2.34527C6.67779 2.32617 6.6337 2.32502 6.58301 2.35796C6.52946 2.39279 6.49805 2.44863 6.49805 2.51031V12.6988Z"})})}function xe(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M7.33057 1.98535C10.2484 1.98535 12.6136 4.3508 12.6138 7.26855C12.6138 8.58031 12.1346 9.77942 11.3433 10.7031L13.9897 13.3496C14.1655 13.5253 14.1655 13.8106 13.9897 13.9863C13.814 14.1621 13.5288 14.1621 13.353 13.9863L10.7017 11.335C9.78678 12.0942 8.61243 12.5518 7.33057 12.5518C4.41281 12.5516 2.04736 10.1864 2.04736 7.26855C2.04754 4.35091 4.41292 1.98553 7.33057 1.98535ZM7.33057 2.88574C4.90998 2.88592 2.94793 4.84796 2.94775 7.26855C2.94775 9.68929 4.90987 11.6522 7.33057 11.6523C9.75141 11.6523 11.7144 9.6894 11.7144 7.26855C11.7142 4.84786 9.75131 2.88574 7.33057 2.88574Z"})})}function ye(){return y("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[a("path",{d:"M6.19629 7.86231C6.42357 7.63534 6.7752 7.60692 7.0332 7.77734L7.1377 7.86231L8.80371 9.5293C9.06329 9.78889 9.06307 10.21 8.80371 10.4697L7.1377 12.1367C6.878 12.3964 6.45599 12.3964 6.19629 12.1367C5.93686 11.8771 5.93697 11.456 6.19629 11.1963L7.39258 9.99902L6.19629 8.80371L6.11133 8.69922C5.94087 8.4411 5.96904 8.08955 6.19629 7.86231Z"}),a("path",{d:"M13.4668 11.0156C13.7699 11.0776 13.998 11.3456 13.998 11.667C13.9979 11.9883 13.7698 12.2564 13.4668 12.3184L13.333 12.332H10.833C10.466 12.3319 10.1682 12.034 10.168 11.667C10.168 11.2998 10.4659 11.0021 10.833 11.002H13.333L13.4668 11.0156Z"}),a("path",{d:"M12.6602 2.66504C13.3492 2.66504 13.9062 2.66439 14.3564 2.70117C14.8142 2.73859 15.2201 2.81796 15.5967 3.00977C16.1922 3.31321 16.677 3.79805 16.9805 4.39356C17.1722 4.77014 17.2517 5.17604 17.2891 5.63379C17.3258 6.08402 17.3252 6.64102 17.3252 7.33008V12.6602C17.3252 13.3492 17.3258 13.9062 17.2891 14.3564C17.2516 14.8142 17.1723 15.2201 16.9805 15.5967C16.677 16.1922 16.1922 16.677 15.5967 16.9805C15.2201 17.1723 14.8142 17.2516 14.3564 17.2891C13.9062 17.3258 13.3492 17.3252 12.6602 17.3252H7.33008C6.64102 17.3252 6.08402 17.3258 5.63379 17.2891C5.17604 17.2517 4.77014 17.1722 4.39356 16.9805C3.79805 16.677 3.31321 16.1922 3.00977 15.5967C2.81796 15.2201 2.73859 14.8142 2.70117 14.3564C2.66439 13.9062 2.66504 13.3492 2.66504 12.6602V7.33008C2.66504 6.64101 2.66439 6.08402 2.70117 5.63379C2.73858 5.17601 2.81797 4.77016 3.00977 4.39356C3.31321 3.79802 3.79802 3.31321 4.39356 3.00977C4.77016 2.81797 5.17601 2.73858 5.63379 2.70117C6.08402 2.66439 6.64101 2.66504 7.33008 2.66504H12.6602ZM7.33008 3.99512C6.61907 3.99512 6.1257 3.99601 5.74219 4.02734C5.3665 4.05804 5.15508 4.11481 4.99707 4.19531C4.65183 4.37124 4.37124 4.65183 4.19531 4.99707C4.11481 5.15508 4.05805 5.3665 4.02734 5.74219C3.99601 6.1257 3.99512 6.61908 3.99512 7.33008V12.6602C3.99512 13.3711 3.99601 13.8646 4.02734 14.248C4.05805 14.6237 4.11481 14.8352 4.19531 14.9932C4.37124 15.3384 4.65186 15.619 4.99707 15.7949C5.15507 15.8754 5.36654 15.9322 5.74219 15.9629C6.1257 15.9942 6.61908 15.9951 7.33008 15.9951H12.6602C13.3711 15.9951 13.8646 15.9942 14.248 15.9629C14.6237 15.9322 14.8352 15.8754 14.9932 15.7949C15.3384 15.619 15.619 15.3384 15.7949 14.9932C15.8754 14.8352 15.9322 14.6237 15.9629 14.248C15.9942 13.8646 15.9951 13.3711 15.9951 12.6602V7.33008C15.9951 6.61908 15.9942 6.1257 15.9629 5.74219C15.9322 5.36654 15.8754 5.15507 15.7949 4.99707C15.619 4.65186 15.3384 4.37124 14.9932 4.19531C14.8352 4.11481 14.6237 4.05805 14.248 4.02734C13.8646 3.99601 13.3711 3.99512 12.6602 3.99512H7.33008Z"})]})}function ve(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M11.3312 4.20472C12.7488 2.92391 14.9377 2.96644 16.3039 4.33265L16.4318 4.46742C17.6713 5.8393 17.6713 7.93343 16.4318 9.30531L16.3039 9.44007L10.0119 15.7311C9.68839 16.0546 9.45384 16.2917 9.22185 16.4821L8.98748 16.6588C8.78233 16.799 8.56429 16.9196 8.33709 17.0192L8.10759 17.1119C7.92582 17.1785 7.73843 17.2266 7.52166 17.2711L6.75701 17.4069L4.36345 17.8053C4.22059 17.8291 4.06914 17.8552 3.9406 17.8649C3.84183 17.8723 3.70833 17.875 3.56267 17.8395L3.41423 17.7907C3.19121 17.695 3.00747 17.5271 2.89177 17.316L2.84588 17.2223C2.75958 17.0209 2.76174 16.8276 2.77166 16.6959C2.78136 16.5674 2.80742 16.4159 2.83123 16.2731L3.22966 13.8795L3.36443 13.1149C3.40899 12.898 3.45795 12.7108 3.52459 12.5289L3.61736 12.2985C3.71691 12.0715 3.83772 11.854 3.97771 11.6491L4.15349 11.4147C4.34392 11.1825 4.58171 10.9484 4.90545 10.6246L11.1965 4.33265L11.3312 4.20472ZM5.84588 11.5651C5.49671 11.9142 5.31258 12.0998 5.1867 12.2526L5.07537 12.3991C4.98194 12.5358 4.90157 12.6812 4.83513 12.8327L4.77361 12.9869C4.73328 13.0971 4.70248 13.2125 4.66814 13.3815L4.54119 14.0983L4.14275 16.4918L4.14177 16.4938H4.1447L6.53826 16.0944L7.25505 15.9684C7.42406 15.9341 7.53946 15.9033 7.64959 15.8629L7.80291 15.8014C7.95461 15.7349 8.09953 15.6538 8.2365 15.5602L8.38396 15.4498C8.53674 15.3239 8.72231 15.1398 9.07146 14.7907L14.0588 9.80238L10.8332 6.57679L5.84588 11.5651ZM15.3635 5.27308C14.5281 4.43776 13.2058 4.38573 12.3097 5.11683L12.1369 5.27308L11.7736 5.63636L15.0002 8.86195L15.3635 8.49964L15.5197 8.32581C16.2015 7.48961 16.2015 6.28311 15.5197 5.44691L15.3635 5.27308Z"})})}function he(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M16.8347 7.91699C16.8347 7.76279 16.8266 7.61021 16.8123 7.45996L15.4705 8.80371C14.2903 9.98388 12.3762 9.98388 11.1961 8.80371C10.016 7.62352 10.0159 5.70942 11.1961 4.5293L12.5378 3.18652C12.3885 3.17238 12.237 3.16505 12.0837 3.16504C9.45947 3.16504 7.33179 5.29272 7.33179 7.91699C7.33184 8.56608 7.46162 9.18329 7.69605 9.74512C7.79981 9.9939 7.74311 10.2811 7.5525 10.4717L3.59547 14.4287C3.0498 14.9744 3.04991 15.8586 3.59547 16.4043L3.70191 16.501C4.25076 16.9483 5.05957 16.9158 5.57105 16.4043L9.52906 12.4473L9.60426 12.3828C9.79018 12.2455 10.0369 12.2131 10.2546 12.3037C10.8166 12.5382 11.4345 12.668 12.0837 12.668C14.7078 12.6678 16.8345 10.541 16.8347 7.91699ZM18.1648 7.91699C18.1646 11.2755 15.4423 13.9979 12.0837 13.998C11.4151 13.998 10.7708 13.8886 10.1677 13.6885L6.51246 17.3457C5.51389 18.3443 3.93332 18.406 2.86207 17.5322L2.65504 17.3457C1.58992 16.2806 1.58992 14.5534 2.65504 13.4883L6.31031 9.83203C6.1104 9.22921 6.00175 8.58526 6.00172 7.91699C6.00172 4.55818 8.72494 1.83496 12.0837 1.83496C12.7838 1.835 13.458 1.95316 14.0857 2.17188L14.1638 2.20508C14.3404 2.29325 14.4697 2.45713 14.5144 2.65234C14.5653 2.87533 14.4984 3.10876 14.3367 3.27051L12.1375 5.4707C11.4767 6.13148 11.4767 7.20251 12.1375 7.86328C12.7983 8.52373 13.8694 8.52395 14.53 7.86328L16.7293 5.66309L16.7937 5.60742C16.9499 5.48687 17.1532 5.44067 17.3484 5.48535C17.5714 5.53648 17.7526 5.69898 17.8279 5.91504C18.0466 6.54272 18.1648 7.21689 18.1648 7.91699Z"})})}function ee({block:e}){if(e.type!=="tool_use")return null;let t=m(e).category;if(t==="read")return a(Ce,{});if(t==="search"||t==="fetch")return a(xe,{});if(t==="execute")return a(ye,{});if(t==="edit")return a(ve,{});return a(he,{})}function E(e,t){let o=e.rawInput[t];return typeof o==="string"&&o.length>0?o:void 0}function we(e){return m(e).target}function q(e){return e.name.startsWith("mcp__")||e.name.startsWith("mcp_")}function te(e,t){let{category:o}=m(e),r=we(e),s=k(e.status);if(q(e))return{leading:e.title};if(o==="execute"){let c=E(e,"command")?.split(`
2
+ `)[0]??r;return c?{leading:t(s?"stream.codex.running":"stream.codex.ran"),trailing:c}:{leading:t(s?"stream.codex.runningCommand":"stream.codex.ranCommandGeneric")}}if(o==="search"){let c=E(e,"pattern")??E(e,"query")??r;return c?{leading:t(s?"stream.codex.searching":"stream.codex.searched"),trailing:t("stream.codex.forDetail",{detail:c})}:{leading:t(s?"stream.codex.searchingFiles":"stream.codex.searchedFiles")}}if(o==="fetch"){let c=E(e,"query")??E(e,"url")??r;return c?{leading:t(s?"stream.codex.searchingWeb":"stream.codex.searchedWeb"),trailing:t("stream.codex.forDetail",{detail:c})}:{leading:t(s?"stream.codex.searchingWeb":"stream.codex.searchedWeb")}}if(o==="read")return r?{leading:t("stream.codex.readLabel"),trailing:r}:{leading:t("stream.codex.readFiles")};if(o==="edit")return r?{leading:t(s?"stream.codex.editingLabel":"stream.codex.editedLabel"),trailing:r}:{leading:t(s?"stream.codex.editingFiles":"stream.codex.editedFiles")};if(o==="delete")return r?{leading:t(s?"stream.codex.deletingLabel":"stream.codex.deletedLabel"),trailing:r}:{leading:t(s?"stream.codex.deletingFiles":"stream.codex.deletedFiles")};if(o==="move")return r?{leading:t(s?"stream.codex.movingLabel":"stream.codex.movedLabel"),trailing:r}:{leading:t(s?"stream.codex.movingFiles":"stream.codex.movedFiles")};return{leading:e.title}}function Le(e,t){let o=te(e,t);return o.trailing===void 0?o.leading:`${o.leading} ${o.trailing}`}function Ne(e){return e.map((t)=>{if(t.type!=="content")return"";let o=t.content;return o.type==="text"?o.text:""}).filter(Boolean).join(`
3
+ `).trim()}function Te(e){return e.flatMap((t)=>{if(t.type!=="content")return[];let o=t.content;return o.type==="image"?[{data:o.data,mimeType:o.mimeType}]:[]})}function $e(e){return e.flatMap((t)=>{if(t.type!=="content")return[];let o=t.content;return o.type==="audio"?[{data:o.data,mimeType:o.mimeType}]:[]})}function ke(e){if(typeof e==="string"&&e.length>0)return e;return}function Ae(e){return e.type==="diff"}function Be(e){let t=e.content.find(Ae);if(t===void 0)return;return t.changes.map((o)=>`${o.operation} ${o.path}`).join(`
4
+ `)}function ne(e){let t=ke(e.rawOutput);if(t!==void 0)return t;let o=Ne(e.content);if(o.length>0)return o;return Be(e)}function Me({block:e,command:t}){let{t:o,Output:r,commandStatus:s}=n(),[c,u]=D(!1),[p,g]=D(!1),x=ne(e),l=s===void 0?e.exitCode===void 0?void 0:o("stream.codex.exitCode",{code:e.exitCode}):s(e),C=()=>{navigator.clipboard.writeText([`$ ${t}`,x].filter((w)=>w!==void 0).join(`
5
+ `)),u(!0),setTimeout(()=>u(!1),1500)};return a("div",{className:"codex-command-details",children:y("div",{className:"codex-command-card",children:[y("div",{className:"codex-command-line-row",children:[a("span",{className:"codex-command-prompt","aria-hidden":"true",children:"$"}),a("button",{type:"button",className:b("codex-command-line",!p&&"codex-command-line-clamped"),"data-codex-disclosure":"","aria-expanded":p,onClick:()=>g((w)=>!w),children:t}),a("button",{type:"button",className:"codex-command-copy","aria-label":o("actions.copy"),onClick:C,children:c?a(me,{}):a(pe,{})})]}),x!==void 0&&(r===void 0?a("pre",{className:"codex-command-output",children:x}):a(r,{text:x})),l!==void 0&&a("div",{className:"codex-command-footer",children:a("span",{className:"codex-command-status",children:l})})]})})}function ae({block:e}){let{t,openLink:o,Patch:r,openImage:s,commandStatus:c,expandToolOutput:u=!1}=n(),p=ne(e),g=r===void 0?void 0:e.content.flatMap((v)=>{if(v.type!=="diff")return[];let I=v;return I.patch?.text?[I.patch.text]:[]}).join(`
6
+ `),x=Te(e.content),l=$e(e.content),[C,w]=d(`tool:${e.id}`,!1),B=G(`tool:${e.id}`,C),L=m(e),N=L.category,h=te(e,t),R=N==="execute"?E(e,"command"):void 0,A=R!==void 0||q(e)||x.length>0||l.length>0||Boolean(g)||u&&p!==void 0,_=!A&&!k(e.status)?L.filePath:void 0;if(N==="execute"&&!k(e.status)&&e.status!=="completed"){let v=c?.(e);if(v)h={...h,leading:v}}if(N==="read"&&k(e.status))return null;let F=y("span",{className:"codex-activity-label",children:[a(ee,{block:e}),a("span",{className:"min-w-0 flex-1 truncate",children:k(e.status)?a("span",{className:"codex-activity-running",children:h.trailing===void 0?h.leading:`${h.leading} ${h.trailing}`}):y(U,{children:[a("span",{className:"codex-activity-leading",children:h.leading}),h.trailing!==void 0&&(_!==void 0?y(U,{children:[" ",a("button",{type:"button",className:"codex-activity-trailing codex-activity-file-link",title:_,onClick:()=>o(_),children:h.trailing})]}):y("span",{className:"codex-activity-trailing",children:[" ",h.trailing]}))]})})]});return y("div",{className:"codex-activity-item",children:[A?y("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-label":h.trailing===void 0?h.leading:`${h.leading} ${h.trailing}`,"aria-expanded":C,onClick:()=>w((v)=>!v),children:[F,a(S,{expanded:C})]}):a("div",{className:"codex-activity-header codex-activity-header-static",children:F}),a("div",{className:b("codex-activity-details-grid",C&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:B&&y(U,{children:[R!==void 0?a(Me,{block:e,command:R}):r!==void 0&&g?a(r,{patch:g}):p!==void 0&&a("pre",{className:"codex-activity-details",children:p}),x.length>0&&a("div",{className:"codex-activity-media",children:x.map((v)=>{let I=`data:${v.mimeType};base64,${v.data}`,z=a("img",{src:I,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},`${v.mimeType}:${v.data.slice(0,32)}`);return s===void 0?z:a("button",{type:"button",className:"cursor-pointer",onClick:()=>s(I),children:z},I)})}),l.map((v)=>a("audio",{className:"mt-1 w-full","aria-label":t("stream.codex.audioOutput"),controls:!0,src:`data:${v.mimeType};base64,${v.data}`},`${v.mimeType}:${v.data.slice(0,32)}`))]})})})]})}function oe({block:e}){if(e.type==="tool_use")return a(ae,{block:e});if(e.type==="thinking")return a(le,{block:e});if(e.type==="collab")return a(ce,{block:e});return a(ie,{block:e})}function ie({block:e}){let{t,openSession:o}=n(),r=k(e.status),[s,c]=d(`subagent:${e.id}`,r),u=H(r);Z(()=>{if(r)c(!0);if(u.current&&!r)c(!1);u.current=r},[r,c]);let p=`${Re(e.activity,r,e.name,t)}${re(e.model,e.reasoningEffort,t)}`,g=e.threadId??"",x=e.blocks.length>0;return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:b("codex-activity-header",!x&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":x?s:void 0,disabled:!x,onClick:()=>c((l)=>!l),children:[y("span",{className:"codex-activity-label",children:[a(Se,{seed:e.threadId??e.id}),a("span",{className:"min-w-0 flex-1 truncate",children:o===void 0||e.threadId===null?r?a("span",{className:"codex-activity-running",children:p}):p:a("span",{role:"link",tabIndex:0,className:b("codex-agent-link",r&&"codex-activity-running"),"aria-label":t("stream.codex.subagentOpen",{name:e.name}),onClick:(l)=>{l.stopPropagation(),o(g,e.name)},onKeyDown:(l)=>{if(l.key!=="Enter"&&l.key!==" ")return;l.preventDefault(),l.stopPropagation(),o(g,e.name)},children:p})})]}),x&&a(S,{expanded:s})]}),a("div",{className:b("codex-activity-details-grid",s&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-subagent-details",children:e.blocks.map((l)=>{if(l.type==="tool_use")return a(ae,{block:l},l.id);if(l.type==="thinking")return a(le,{block:l},T(l));if(l.type==="subagent")return a(ie,{block:l},l.id);if(l.type==="collab")return a(ce,{block:l},l.id);if(l.type==="text")return a("div",{className:"codex-reasoning-details",children:a(i,{text:l.text,streaming:!1})},T(l));if(l.type==="plan")return a(f,{entries:l.entries},T(l));if(l.type==="image")return a("img",{src:`data:${l.source.media_type};base64,${l.source.data}`,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},T(l));return null})})})})]})}var Ie=8;function Ee(e){let t=0;for(let o=0;o<e.length;o+=1)t=(t*31+e.charCodeAt(o))%2147483647;return t%Ie}function Se({seed:e}){return a("span",{className:"codex-agent-avatar","data-hue":Ee(e),"aria-hidden":"true"})}function Re(e,t,o,r){switch(e){case"started":return r(t?"stream.codex.subagentWorking":"stream.codex.subagentFinished",{name:o});case"interacted":return r("stream.codex.subagentMessaged",{name:o});case"interrupted":return r("stream.codex.subagentInterrupted",{name:o});case"completed":return r("stream.codex.subagentFinished",{name:o})}}var _e=new Set(["none","minimal","low","medium","high","xhigh","max","ultra","persistent"]);function re(e,t,o){if(e===null)return"";if(t===null)return` · ${be(e)}`;let r=_e.has(t)?o(`stream.codex.reasoningEffort.${t}`):t;return` · ${be(e)} · ${r}`}var Fe={spawnAgent:"spawn",sendInput:"message",sendMessage:"message",followupTask:"message",interruptAgent:"interrupt",listAgents:"list",resumeAgent:"resume",closeAgent:"close"};function se(e){switch(e){case"pending":case"in_progress":return"inProgress";case"completed":return"completed";case"failed":return"failed";case"cancelled":case"interrupted":return"interrupted";default:throw Error(`Unknown ACP tool status: ${e}`)}}function j(e,t,o){if(e.tool==="wait")throw Error("Codex does not present wait calls");let r=se(e.status);if(r==="interrupted")return o("stream.codex.collab.interrupted");return o(`stream.codex.collab.${t}.${Fe[e.tool]}.${r}`)}function De(e){return e.agents.filter((t)=>t.nickname!==null)}function de(e,t){let o=e.agents.length>0?e.agents.length:1;return`${j(e,"header",t)}${t("stream.codex.collab.agentCount",{count:o})}`}var P="\x01";function V(e,t,o,r){let s=Object.fromEntries(Object.keys(r).map((c)=>[c,`${P}${c}${P}`]));return e(t,{...o,...s}).split(new RegExp(`${P}(\\w+)${P}`,"u")).map((c,u)=>a(ge,{children:u%2===1?r[c]:c},`${u}:${c}`))}function Pe({agent:e,showModel:t}){let{t:o,openSession:r}=n(),s=e.nickname??"",c=r===void 0?a("span",{className:"font-medium",children:s}):a("button",{type:"button",className:"codex-agent-link font-medium","aria-label":o("stream.codex.subagentOpen",{name:s}),onClick:()=>r(e.threadId,s),children:s});return y("span",{children:[c,e.role!==null&&` (${e.role})`,t&&re(e.model,e.reasoningEffort,o)]})}function Q({prompt:e}){return a("span",{className:"codex-collab-prompt",title:e,children:e})}function Ve(e,t){let o=e.prompt?.trim()?e.prompt:null,r=se(e.status),s=e.tool==="spawnAgent"&&r==="completed"&&o!==null,c=(e.tool==="sendInput"||e.tool==="sendMessage"||e.tool==="followupTask")&&o!==null,u=De(e),p=[];if(u.length===0)p.push({key:"generic",node:j(e,"row",t)});for(let g of u){let x=a(Pe,{agent:g,showModel:e.tool==="spawnAgent"});if(s)p.push({key:g.threadId,node:a("span",{className:"codex-collab-line",children:V(t,"stream.codex.collab.createdWithInstructions",{},{agent:x,instructions:a(Q,{prompt:o})})})});else if(c)p.push({key:g.threadId,node:a("span",{className:"codex-collab-line",children:V(t,"stream.codex.collab.messagedWithPrompt",{action:r==="interrupted"?t("stream.codex.collab.interrupted"):t(`stream.codex.collab.messaged.${r}`)},{agent:x,prompt:a(Q,{prompt:o})})})});else{let C=e.tool!=="closeAgent"&&e.tool!=="resumeAgent"&&g.state!==null&&g.state!==null?g.state.message?.trim()?t("stream.codex.collab.stateWithMessage",{state:t(`stream.codex.collab.state.${g.state.status}`),message:g.state.message}):t("stream.codex.collab.stateOnly",{state:t(`stream.codex.collab.state.${g.state.status}`)}):"";p.push({key:g.threadId,node:V(t,"stream.codex.collab.agentRow",{action:j(e,"row",t),state:C},{agent:x})})}}if(!s&&!c&&o!==null)p.push({key:"input",node:V(t,"stream.codex.collab.input",{},{prompt:a("span",{className:"codex-collab-input",children:o})})});return p}function ce({block:e}){let{t}=n(),[o,r]=d(`collab:${e.id}`,!1);if(e.tool==="wait")return null;let s=k(e.status),c=de(e,t);return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":o,onClick:()=>r((u)=>!u),children:[y("span",{className:"codex-activity-label",children:[a(ue,{className:"size-4 shrink-0","aria-hidden":"true"}),a("span",{className:"min-w-0 flex-1 truncate",children:s?a("span",{className:"codex-activity-running",children:c}):c})]}),a(S,{expanded:o})]}),a("div",{className:b("codex-activity-details-grid",o&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-subagent-details",children:Ve(e,t).map((u)=>a("div",{className:"codex-collab-row",children:u.node},u.key))})})})]})}function le({block:e}){let{t,i18n:o}=n(),r=Boolean(e.isComplete),[s,c]=d(`thinking:${T(e)}`,!1),u=H(null),p=e.thinking.trim().length>0;Z(()=>{if(r||!p)return;let l=u.current;if(l===null)throw Error("Thinking details are not mounted");let C=new ResizeObserver(()=>{l.scrollTop=l.scrollHeight}),w=null,B=()=>{let N=l.firstElementChild;if(N===w)return;if(w!==null)C.unobserve(w);if(w=N,w!==null)C.observe(w)},L=new MutationObserver(B);return L.observe(l,{childList:!0}),B(),()=>{L.disconnect(),C.disconnect()}},[p,r]);let g=r?e.durationMs!==void 0?t("stream.codex.thoughtFor",{duration:W(e.durationMs,o.language)}):t("stream.codex.thought"):t("message.thinking"),x=e.thinking.trimStart().replace(/^\*\*[^\n]*?\*\*\s*/,"");return y("div",{className:"codex-activity-item",children:[y("button",{type:"button",className:b("codex-activity-header",!p&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":p?s:void 0,disabled:!p,onClick:()=>c((l)=>!l),children:[a("span",{className:"codex-activity-label",children:a("span",{className:"codex-reasoning-label min-w-0 flex-1 truncate",children:r?g:a("span",{className:"codex-activity-running",children:g})})}),p&&a(S,{expanded:s})]}),a("div",{className:b("codex-activity-details-grid",s&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:p&&a("div",{ref:u,className:"codex-reasoning-details",role:"region","aria-label":g,"aria-hidden":!s,tabIndex:0,inert:!s,children:a(i,{text:x,streaming:!r})})})})]})}function Oe(e){if(q(e))return"mcp";let t=m(e).category;return t==="think"||t==="switch_mode"?"other":t}function Ue(e,t,o,r){return r(`stream.codex.summary.${e}.${o?"leading":"following"}`,{count:t})}function Ze(e,t,o){let r=new Map;for(let c of e){let u=Oe(c);r.set(u,(r.get(u)??0)+1)}let s=Array.from(r,([c,u],p)=>Ue(c,u,p===0,t));if(o.startsWith("zh"))return s.join("");return new Intl.ListFormat(o,{style:"long",type:"conjunction"}).format(s)}function Pt({stateKey:e,durationMs:t,durationKind:o="work",active:r,defaultExpanded:s=r,startedAt:c,providerId:u,providerIcon:p,children:g}){let{t:x,i18n:l}=n(),[C,w]=d(`work:${e}`,s,!0),B=G(`work:${e}`,C||r),L=H(null),[N,h]=D(0);Z(()=>{if(!r||t!==void 0){L.current=null;return}L.current=c??Date.now();let A=()=>{let F=L.current;if(F===null)throw Error("Codex work section is ticking without a start time");h(Date.now()-F)};A();let _=window.setInterval(A,1000);return()=>window.clearInterval(_)},[r,c,t]);let R=t!==void 0?x(o==="total"?"stream.codex.totalDuration":"stream.codex.workedFor",{duration:W(t,l.language)}):r&&N>=1000?x("stream.codex.workingFor",{duration:W(N,l.language)}):x(r?"stream.codex.working":"stream.codex.worked");return y("section",{className:"codex-work-section",children:[y("button",{type:"button",className:"codex-work-trigger","data-codex-disclosure":"","aria-expanded":C,onClick:()=>w((A)=>!A),children:[u!==void 0&&a("span",{className:"codex-work-provider-icon","data-testid":"codex-work-provider-icon","data-provider-id":u,"aria-hidden":"true",children:p}),a("span",{children:R}),a(S,{expanded:C,className:"codex-work-chevron"})]}),a("div",{className:"codex-work-separator","aria-hidden":"true"}),a("div",{className:b("codex-work-grid",C&&"codex-work-grid-open"),"aria-hidden":!C,inert:!C,children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-work-body",children:B&&g})})})]})}function He(e,t){if(e.type==="tool_use")return Le(e,t);if(e.type==="thinking")return t("message.thinking");if(e.type==="collab")return de(e,t);return t("stream.codex.subagentWorking",{name:e.name})}function X(e){if(e.type==="thinking")return!e.isComplete;if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return k(e.status);return!1}function We(e,t,o=1000){let[r,s]=D({text:e,live:t}),c=H(Date.now());return Z(()=>{if(e===r.text&&t===r.live)return;let u=Date.now(),p=Math.max(0,c.current+o-u);if(p===0||t!==r.live){c.current=u,s({text:e,live:t});return}let g=window.setTimeout(()=>{c.current=Date.now(),s({text:e,live:t})},p);return()=>window.clearTimeout(g)},[r,t,o,e]),t===r.live?r.text:e}function je({blocks:e}){let{t,i18n:o}=n(),r=e.some(X),s=T(e[0]),[c,u]=d(`group:${s}`,!0),p=G(`group:${s}`,c||r),g=e.findLast(X)??e.at(-1);if(g===void 0)throw Error("CodexActivityGroup requires at least one activity block");let x=e.filter((C)=>C.type==="tool_use"),l=We(r?He(g,t):Ze(x,t,o.language),r);return y("div",{className:"codex-activity-group",children:[y("button",{type:"button",className:"codex-activity-group-trigger","aria-expanded":c,onClick:()=>u((C)=>!C),children:[y("span",{className:"codex-activity-label",children:[a(ee,{block:e[0]}),a("span",{className:"truncate",children:r?a("span",{className:"codex-activity-running",children:l}):l})]}),a(S,{expanded:c})]}),a("div",{className:b("codex-activity-group-grid",c&&"codex-activity-group-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-activity-group-body",children:p&&e.map((C)=>a(oe,{block:C},T(C)))})})})]})}function Y({blocks:e}){if(e.length===0)throw Error("CodexActivityGroup requires at least one activity block");if(e.length===1)return a(oe,{block:e[0]});return a(je,{blocks:e})}function O({blocks:e}){if(!e.some(M))return a(Y,{blocks:e});let t=[];for(let o of e){let r=t.at(-1);if(r&&M(r[0])===M(o))r.push(o);else t.push([o])}return a(U,{children:t.map((o)=>M(o[0])?a(Nt,{blocks:o.filter(M)},T(o[0])):a(Y,{blocks:o},T(o[0])))})}
7
+ export{Pt,O};
@@ -0,0 +1,2 @@
1
+ import{createContext as s,useContext as a}from"react";import{jsx as r}from"react/jsx-runtime";var e=s(null);function en({host:t,children:o}){return r(e.Provider,{value:t,children:o})}function n(){let t=a(e);if(t===null)throw Error("Activity host is missing");return t}function i(t){let{Markdown:o}=n();return r(o,{...t})}
2
+ export{en,n,i};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-wjejhpgw.js";import{l}from"./chunk-1hy64ewz.js";import{cn as v}from"cn";import{ChevronDownIcon as g,ChevronUpIcon as b,XIcon as z}from"lucide-react";import{useEffect as B,useImperativeHandle as N,useRef as E}from"react";import{jsx as n,jsxs as k}from"react/jsx-runtime";function Te({ref:p,value:i,onChange:d,onFind:o,onClose:s,placeholder:m,autoFocusOpen:a=!0,prevTitle:c,nextTitle:u,className:h}){let r=E(null);N(p,()=>{if(r.current===null)throw Error("FindBar input is not mounted");return r.current},[]),B(()=>{if(!a)return;let t=r.current;if(t===null)throw Error("FindBar input is not mounted");t.focus(),t.select()},[a]);let f=!i;return k("div",{className:v("border-border flex h-9 shrink-0 items-center gap-1 border-b px-2",h),children:[n(l,{ref:r,value:i,onChange:(t)=>d(t.target.value),placeholder:m,className:"h-7 text-xs",onKeyDown:(t)=>{if(t.key==="Escape"){t.preventDefault(),s();return}if(t.key==="Enter"){if(t.preventDefault(),i)o(t.shiftKey)}}}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>o(!0),title:c?`${c} (⇧↵)`:"⇧↵",children:n(b,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>o(!1),title:u?`${u} (↵)`:"↵",children:n(g,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",onClick:s,title:"Esc",children:n(z,{className:"size-3.5"})})]})}
2
- export{Te};
1
+ import{e}from"./chunk-801v0awm.js";import{u}from"./chunk-7q7c0mds.js";import{cn as v}from"cn";import{ChevronDownIcon as g,ChevronUpIcon as b,XIcon as z}from"lucide-react";import{useEffect as B,useImperativeHandle as N,useRef as E}from"react";import{jsx as n,jsxs as k}from"react/jsx-runtime";function He({ref:p,value:i,onChange:d,onFind:o,onClose:s,placeholder:m,autoFocusOpen:a=!0,prevTitle:l,nextTitle:c,className:h}){let r=E(null);N(p,()=>{if(r.current===null)throw Error("FindBar input is not mounted");return r.current},[]),B(()=>{if(!a)return;let t=r.current;if(t===null)throw Error("FindBar input is not mounted");t.focus(),t.select()},[a]);let f=!i;return k("div",{className:v("border-border flex h-9 shrink-0 items-center gap-1 border-b px-2",h),children:[n(u,{ref:r,value:i,onChange:(t)=>d(t.target.value),placeholder:m,className:"h-7 text-xs",onKeyDown:(t)=>{if(t.key==="Escape"){t.preventDefault(),s();return}if(t.key==="Enter"){if(t.preventDefault(),i)o(t.shiftKey)}}}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>o(!0),title:l?`${l} (⇧↵)`:"⇧↵",children:n(b,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>o(!1),title:c?`${c} (↵)`:"↵",children:n(g,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",onClick:s,title:"Esc",children:n(z,{className:"size-3.5"})})]})}
2
+ export{He};
@@ -0,0 +1,3 @@
1
+ import{n,i}from"./chunk-azmqtycn.js";import{m}from"./chunk-d8gwsw6j.js";import{ht}from"./chunk-t5nstx0k.js";import{f}from"./chunk-v0zn87k5.js";import{Pt,O}from"./chunk-aqj0v5a9.js";import{yt}from"./chunk-4svwa5p8.js";import{xe}from"./chunk-w3yddw6n.js";import{cn as P}from"cn";import{jsx as o,jsxs as C}from"react/jsx-runtime";var N=new WeakMap,I=1;function A(t){if(t.type==="tool_use"||t.type==="subagent"||t.type==="collab")return`${t.type}:${t.id}`;let s=N.get(t);if(s!==void 0)return`${t.type}:${s}`;let r=I++;return N.set(t,r),`${t.type}:${r}`}function E({block:t,streaming:s,actions:r}){if(t.isApiError)return o("div",{className:"codex-stream-error",children:t.text});return C("div",{className:"codex-assistant-message",children:[o(i,{text:t.text,streaming:s}),r]})}function _({block:t,streaming:s,actions:r,renderText:a}){switch(t.type){case"text":return a===void 0?o(E,{block:t,streaming:s,actions:r}):a({block:t,streaming:s,actions:r});case"thinking":return t.thinking.length>0?o(i,{text:t.thinking,streaming:!t.isComplete}):null;case"plan":return o(f,{entries:t.entries});case"image":return o("img",{src:`data:${t.source.media_type};base64,${t.source.data}`,className:"max-h-64 rounded",alt:""});case"tool_use":case"subagent":case"collab":return null}}var S=new Set;function Wn({message:t,isMostRecentTurn:s,hiddenTools:r=S,time:a,beforeCopy:c,afterCopy:u,providerIcon:B,renderText:M,renderEditedFiles:h}){if(t.streaming===!0&&t.content.every((e)=>e.type==="text"?e.text.length===0:e.type==="thinking"?e.thinking.length===0:!1))return o(T,{});let k=t.content.filter((e)=>e.type==="text").map((e)=>e.text).join(`
2
+ `),b=!t.streaming&&k.trim().length>0?o(fe,{text:k,isMostRecentTurn:s,beforeCopy:c,afterCopy:u,time:a}):null,l=ht(t.content,"compact"),x=l.reduce((e,d,p)=>d.kind==="codexActivityGroup"?p:e,-1),v=l.findIndex((e,d)=>d>x&&e.kind==="block"&&e.block.type==="text"),w=[...t.content].toReversed().find((e)=>e.type==="text"),g=t.content.filter((e)=>e.type==="tool_use"&&m(e).category==="edit"),R=(e)=>{if(e.kind==="codexActivityGroup"){let d=e.blocks.filter((p)=>p.type!=="tool_use"||!r.has(p.name));return d.length===0?null:o(O,{blocks:d},`activity:${A(d[0])}`)}if(e.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${e.kind}`);return o(_,{block:e.block,streaming:Boolean(t.streaming),actions:e.block===w?b:void 0,renderText:M},A(e.block))},y=x===-1?0:v===-1?l.length:v;return o(he,{stateKey:t.id,active:Boolean(t.streaming),startedAt:t.startedAt,durationMs:t.durationMs,providerId:t.providerId,providerIcon:B,work:l.slice(0,y).map(R),answer:l.length>y?l.slice(y).map(R):null,footer:x!==-1&&g.length>0&&(h===void 0?o(yt,{blocks:g}):h(g))})}function fe({text:t,isMostRecentTurn:s=!1,beforeCopy:r,afterCopy:a,time:c}){let{t:u}=n();return C("div",{className:P("mt-1.5 flex h-5 w-fit -translate-x-1 items-center justify-start gap-0.5 [&_*]:transition-none",s?"opacity-100":"opacity-0 group-focus-within/am:opacity-100 group-hover/am:opacity-100"),children:[r,o(xe,{text:t,label:u("actions.copy")}),a,c&&o("span",{className:"codex-user-time ms-1",title:c.full,children:c.short})]})}function T(){let{t}=n();return o("div",{className:"codex-pending-message py-2",role:"status",children:o("span",{className:"codex-activity-running",children:t("message.thinking")})})}function he({work:t,answer:s,footer:r,loading:a=!1,...c}){if(a)return o(T,{});return C("div",{className:"group/am codex-assistant-turn",children:[t.length>0&&o(Pt,{...c,children:t}),s!==null&&(t.length===0?s:o("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:s})),r]})}
3
+ export{Wn,fe,he};
@@ -1,2 +1,2 @@
1
- import{Marked as p}from"marked";import k from"marked-linkify-it";var h=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,m=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,d=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,x={extensions:[{name:"math",level:"block",tokenizer(n){let t=d.exec(n);if(t===null)return;return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0}}},{name:"math",level:"inline",start(n){return n.search(/\$|\\[([]/)},tokenizer(n){let t=d.exec(n);if(t!==null)return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0};let r=/^\\\(([^\n]+?)\\\)/.exec(n);if(r!==null)return{type:"math",raw:r[0],text:r[1].trim(),display:!1};let i=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(n);if(i===null||/^\s|\s$/.test(i[1]))return;return{type:"math",raw:i[0],text:i[1],display:!1}}}]};function Be(){let n=new p({gfm:!0}),t=k(),r=t.extensions[0],i=r.tokenizer;r.tokenizer=function(o,a){let e=i.call(this,o,a);if(e===void 0)return;if(e.raw.startsWith("<"))return e;let l=/^(?:[a-z][a-z\d+.-]*:\/\/|www\.)[^/?#]+[/?#]/i.exec(e.raw);if(l===null)return e;let c=l[0].length-1,u=e.raw.slice(c).search(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u);if(u===-1)return e;let s=e.raw.slice(0,c+u),f=e.href.slice(0,e.href.length-(e.raw.length-s.length));return{...e,raw:s,href:f,text:s,tokens:[{type:"text",raw:s,text:s}]}},n.use(x,t);for(let o of["block","inline"])n.use({extensions:[{name:"internalMessage",level:o,...o==="inline"?{start(a){return h.exec(a)?.index}}:{},tokenizer(a){let e=m.exec(a);if(e===null)return;return{type:"internalMessage",raw:e[0]}},renderer(){return""}}]});return n}function ne(n){let t=n.replaceAll(/[\p{Cc}\s]/gu,"");return!/^(?:data|javascript|vbscript):/i.test(t)}
2
- export{Be,ne};
1
+ import{Marked as p}from"marked";import k from"marked-linkify-it";var h=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,m=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,d=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,x={extensions:[{name:"math",level:"block",tokenizer(n){let t=d.exec(n);if(t===null)return;return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0}}},{name:"math",level:"inline",start(n){return n.search(/\$|\\[([]/)},tokenizer(n){let t=d.exec(n);if(t!==null)return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0};let r=/^\\\(([^\n]+?)\\\)/.exec(n);if(r!==null)return{type:"math",raw:r[0],text:r[1].trim(),display:!1};let i=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(n);if(i===null||/^\s|\s$/.test(i[1]))return;return{type:"math",raw:i[0],text:i[1],display:!1}}}]};function Vt(){let n=new p({gfm:!0}),t=k(),r=t.extensions[0],i=r.tokenizer;r.tokenizer=function(o,a){let e=i.call(this,o,a);if(e===void 0)return;if(e.raw.startsWith("<"))return e;let l=/^(?:[a-z][a-z\d+.-]*:\/\/|www\.)[^/?#]+[/?#]/i.exec(e.raw);if(l===null)return e;let c=l[0].length-1,u=e.raw.slice(c).search(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u);if(u===-1)return e;let s=e.raw.slice(0,c+u),f=e.href.slice(0,e.href.length-(e.raw.length-s.length));return{...e,raw:s,href:f,text:s,tokens:[{type:"text",raw:s,text:s}]}},n.use(x,t);for(let o of["block","inline"])n.use({extensions:[{name:"internalMessage",level:o,...o==="inline"?{start(a){return h.exec(a)?.index}}:{},tokenizer(a){let e=m.exec(a);if(e===null)return;return{type:"internalMessage",raw:e[0]}},renderer(){return""}}]});return n}function ke(n){let t=n.replaceAll(/[\p{Cc}\s]/gu,"");return!/^(?:data|javascript|vbscript):/i.test(t)}
2
+ export{Vt,ke};
@@ -1 +1 @@
1
- import{cn as i}from"cn";import{jsx as a}from"react/jsx-runtime";function o({className:r,...e}){return a("textarea",{"data-slot":"textarea",className:i("border-input 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 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",r),...e})}export{o};
1
+ import{cn as i}from"cn";import{jsx as a}from"react/jsx-runtime";function s({className:r,...e}){return a("textarea",{"data-slot":"textarea",className:i("border-input 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 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",r),...e})}export{s};
@@ -0,0 +1 @@
1
+ import{Tooltip as i}from"@base-ui/react/tooltip";import{cn as l}from"cn";import{jsx as o,jsxs as p}from"react/jsx-runtime";function Hn({delay:t=0,...e}){return o(i.Provider,{"data-slot":"tooltip-provider",delay:t,...e})}function oe({...t}){return o(i.Root,{"data-slot":"tooltip",...t})}function ie({...t}){return o(i.Trigger,{"data-slot":"tooltip-trigger",...t})}function ae({className:t,side:e="top",sideOffset:a=4,align:d="center",alignOffset:r=0,children:n,...s}){return o(i.Portal,{children:o(i.Positioner,{align:d,alignOffset:r,side:e,sideOffset:a,className:"isolate z-50",children:p(i.Popup,{"data-slot":"tooltip-content",className:l("bg-foreground text-background 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-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md px-3 py-1.5 text-xs has-data-[slot=kbd]:pr-1.5 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm",t),...s,children:[n,o(i.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}export{Hn,oe,ie,ae};
@@ -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 tt(i,e){return n??=new s,n.connect(i,e)}
2
- export{tt};
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,3 +1,3 @@
1
- var Ht=["full","compact","codexUI"];function et(t){return t==="compact"||t==="codexUI"}var mt=["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"];function c(t){let o=t.split(/[/\\]/).at(-1)??"";return o===""?t:o}function d(t){let o=mt.includes(t.kind)?t.kind:"other",i=t.rawInput,e=(a)=>{let r=i[a];return typeof r==="string"&&r.length>0?r:void 0},n=t.locations?.[0]?.path??e("file_path")??e("notebook_path"),s=n!==void 0?c(n):e("command")?.split(`
2
- `)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function Ot(t,o){if(o)return"dot-permission";switch(t){case"completed":return"dot-success";case"failed":return"dot-error";case"in_progress":return"dot-in-progress";case"pending":return"dot-pending";case"interrupted":return"dot-interrupted";default:return console.warn("[acp] unknown tool call status:",t),"dot-pending"}}
3
- export{Ht,et,mt,d,Ot};
1
+ var jn=["full","compact","codexUI"];function Mt(t){return t==="compact"||t==="codexUI"}var bn=["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"];function c(t){let o=t.split(/[/\\]/).at(-1)??"";return o===""?t:o}function m(t){let o=bn.includes(t.kind)?t.kind:"other",i=t.rawInput,e=(a)=>{let r=i[a];return typeof r==="string"&&r.length>0?r:void 0},n=t.locations?.[0]?.path??e("file_path")??e("notebook_path"),s=n!==void 0?c(n):e("command")?.split(`
2
+ `)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function Qn(t,o){if(o)return"dot-permission";switch(t){case"completed":return"dot-success";case"failed":return"dot-error";case"in_progress":return"dot-in-progress";case"pending":return"dot-pending";case"interrupted":return"dot-interrupted";default:return console.warn("[acp] unknown tool call status:",t),"dot-pending"}}
3
+ export{jn,Mt,bn,m,Qn};
@@ -1 +1 @@
1
- import{PreviewCard as i}from"@base-ui/react/preview-card";import{cn as s}from"cn";import{jsx as r}from"react/jsx-runtime";function Re({...e}){return r(i.Root,{"data-slot":"hover-card",...e})}function Le({...e}){return r(i.Trigger,{"data-slot":"hover-card-trigger",...e})}function _e({className:e,side:o="bottom",sideOffset:t=4,align:a="center",alignOffset:d=4,...n}){return r(i.Portal,{"data-slot":"hover-card-portal",children:r(i.Positioner,{align:a,alignOffset:d,side:o,sideOffset:t,className:"isolate z-50",children:r(i.Popup,{"data-slot":"hover-card-content",className:s("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 w-64 origin-(--transform-origin) rounded-lg p-4 text-sm shadow-md ring-1 outline-hidden duration-100",e),...n})})})}export{Re,Le,_e};
1
+ import{PreviewCard as i}from"@base-ui/react/preview-card";import{cn as s}from"cn";import{jsx as r}from"react/jsx-runtime";function je({...e}){return r(i.Root,{"data-slot":"hover-card",...e})}function Qe({...e}){return r(i.Trigger,{"data-slot":"hover-card-trigger",...e})}function Xe({className:e,side:o="bottom",sideOffset:t=4,align:a="center",alignOffset:d=4,...n}){return r(i.Portal,{"data-slot":"hover-card-portal",children:r(i.Positioner,{align:a,alignOffset:d,side:o,sideOffset:t,className:"isolate z-50",children:r(i.Popup,{"data-slot":"hover-card-content",className:s("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 w-64 origin-(--transform-origin) rounded-lg p-4 text-sm shadow-md ring-1 outline-hidden duration-100",e),...n})})})}export{je,Qe,Xe};
@@ -0,0 +1,2 @@
1
+ import{st}from"./chunk-h0dq9ztv.js";import{L,et,A,_}from"./chunk-6p5hgnpq.js";import{cn as v}from"cn";import{XIcon as E}from"lucide-react";import{useCallback as p,useEffect as D,useMemo as X,useRef as N,useState as b}from"react";import{jsx as i,jsxs as j}from"react/jsx-runtime";function Je({open:l,onOpenChange:y,url:h,filename:M,scale:d,onScaleChange:f,containerRef:z,containerClassName:H,dialogContentClassName:P,imageClassName:T}){let g=p((e)=>Math.min(4,Math.max(0.25,e)),[]),[I,O]=b(1),o=g(d??I),R=N(null),s=z??R,S=N(null),[m,x]=b({width:0,height:0}),[C,W]=b({width:0,height:0}),w=p((e)=>{let n=g(e);if(typeof f==="function"){f(n);return}O(n)},[f,g]);D(()=>{if(!l)return;if(!h)return;if(typeof d==="number")return;O(1)},[l,h,d]),D(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{x({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let Z=p(()=>{w(1)},[w]),r=X(()=>{let{width:e,height:n}=C,{width:t,height:a}=m;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),u=e*c,k=n*c;return{width:u*o,height:k*o}},[o,C,m]);if(!h)return null;return i(L,{open:l,onOpenChange:y,children:j(A,{className:v("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]!",P),showCloseButton:!1,children:[i(_,{className:"sr-only",children:M||"Image preview"}),i(et,{"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(E,{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=S.current,u=a&&c?st({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(w(t),a&&u)requestAnimationFrame(()=>{a.scrollTo(u)})},className:v("h-full w-full scrollbar-thin overflow-auto",H),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(m.width,r.width),height:Math.max(m.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:M||"image preview",className:v("block object-contain select-none",T),decoding:"async",draggable:!1,ref:S,onDoubleClick:Z,onLoad:(e)=>{let n=e.currentTarget;W({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))x({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{Je};
@@ -0,0 +1,2 @@
1
+ function Oe(t){return Object.entries(t.properties??{}).map(([n,e])=>({key:n,property:e}))}function se(t){let{title:n,description:e}=t;return{title:n??void 0,description:e??void 0}}function w(t){return t.type==="array"}function W(t){return(w(t)?t.items?.oneOf??[]:t.oneOf??[]).map((e)=>{let i=e,r=i.const??i.title??"";return{value:r,label:i.title??r,...i.description?{description:i.description}:{},...i._meta?.alwith?.preview?{preview:i._meta.alwith.preview}:{}}})}
2
+ export{Oe,se,w,W};
@@ -1,2 +1,2 @@
1
- import{Qe}from"./chunk-0e1pdbec.js";async function m(r){try{let i=await(await fetch(r)).blob();if(typeof createImageBitmap==="function")return(await createImageBitmap(i)).close(),!0;return await new Promise((a)=>{let o=new Image;o.onload=()=>a(!0),o.onerror=()=>a(!1),o.src=r})}catch{return!1}}async function $e(r){let n=await Promise.all(r.map(async({id:a,lastModified:o,sourcePath:p,...t})=>{let e=t.url;if(t.url.startsWith("blob:")){let s=await Qe(t.url,t.mediaType);if(s===null)return null;e=s}let l=t.mediaType.toLowerCase().startsWith("image/"),c=e.startsWith("data:image/");if(l&&c&&!await m(e))return null;let u=e.startsWith("data:")?e.slice(5,e.indexOf(";")):t.mediaType;return{...t,url:e,mediaType:u}})),i=n.filter((a)=>a!==null);return{files:i,rejectedCount:n.length-i.length}}
2
- export{$e};
1
+ import{dt}from"./chunk-9ab18v07.js";async function m(r){try{let i=await(await fetch(r)).blob();if(typeof createImageBitmap==="function")return(await createImageBitmap(i)).close(),!0;return await new Promise((a)=>{let o=new Image;o.onload=()=>a(!0),o.onerror=()=>a(!1),o.src=r})}catch{return!1}}async function Ze(r){let n=await Promise.all(r.map(async({id:a,lastModified:o,sourcePath:p,...t})=>{let e=t.url;if(t.url.startsWith("blob:")){let s=await dt(t.url,t.mediaType);if(s===null)return null;e=s}let l=t.mediaType.toLowerCase().startsWith("image/"),c=e.startsWith("data:image/");if(l&&c&&!await m(e))return null;let u=e.startsWith("data:")?e.slice(5,e.indexOf(";")):t.mediaType;return{...t,url:e,mediaType:u}})),i=n.filter((a)=>a!==null);return{files:i,rejectedCount:n.length-i.length}}
2
+ export{Ze};
@@ -0,0 +1,2 @@
1
+ import{e}from"./chunk-801v0awm.js";import{t,V}from"./chunk-vw2hv2sq.js";import{isEmbeddedResource as E,isImage as N,isResourceLink as T}from"@alwith/api";import{DownloadIcon as L,FileIcon as y,ImageOffIcon as F,LoaderCircleIcon as U}from"lucide-react";import{useState as I}from"react";import{jsx as i,jsxs as r}from"react/jsx-runtime";function an(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 p({block:a,generated:o=!1}){let n=t(),[d,f]=I(!1),[C,R]=I(null);if(T(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=an(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(y,{}),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(!E(a)&&!N(a))return null;let s=N(a)?{uri:a.uri??`image.${a.mimeType.split("/")[1]??"png"}`,mimeType:a.mimeType,blob:a.data}:a.resource,l=an(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(y,{}),i("span",{className:"truncate",children:l})]})]});let m=`data:${s.mimeType??"application/octet-stream"};base64,${s.blob}`,g=s.mimeType?.toLowerCase().startsWith("image/")&&C!==m,{openImage:w,openImageGallery:x}=n,v=x?()=>x([{src:m,alt:l,uri:s.uri}],0):w&&(()=>w(m)),c=o&&g,B=async()=>{f(!0);try{if(n.saveFile)await n.saveFile(l,s.blob);else b(l,m)}catch(u){V(n,u)}finally{f(!1)}},h=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:()=>R(m)});return r("div",{className:c?"codex-generated-image":"flex max-w-full min-w-0 flex-col items-start gap-1",children:[g&&(v===void 0?h: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:v,children:h})),r(e,{variant:c?"secondary":"link",size:c?"icon":"sm",className:c?"codex-generated-image-download":"max-w-full min-w-0",disabled:d,title:n.t("timeline.download",{name:l}),"aria-label":n.t("timeline.download",{name:l}),onClick:()=>{B()},children:[d?i(U,{className:"motion-safe:animate-spin"}):i(L,{}),!c&&i("span",{className:"truncate",children:l})]})]})}
2
+ export{an,p};
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-5grywgpq.js";import{textOf as S,turns as E}from"@alwith/api";import{codexMessageError as _,nativeTurnId as m}from"@nyssance/codex-acp-v2/client";function Cn(t){return t.kind==="tool"&&t.name==="mcp_startup"}function j(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 Kt(t){return t.user===null&&t.items.length>0&&t.items.every((e)=>e.kind==="assistant"&&w(e))}function T(t,e){let n=t.work.at(-1),r=n?.kind==="activity"?n.items.at(-1):void 0;if(n?.kind==="activity"&&r!==void 0&&t.items.indexOf(e)===t.items.indexOf(r)+1){n.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 r=n.get(t.id);if(r===void 0)throw Error(`Grouped tool is missing from the session: ${t.id}`);e.push(r);for(let i of t.children)M(i,e,n)}function K(t,e,n){switch(e.kind){case"user":break;case"assistant":{if(_(e)!==null){let i=m(e),u=t.errors.findIndex((c)=>i!==null&&m(c)===i);if(u===-1)t.errors.push(e);else t.errors[u]=e;break}let r=j(e);if(a(e._meta).length>0||r==="final_answer")t.final.push(e);else if(r==="commentary"||w(e)||r===null&&n)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else t.final.push(e);break}case"thought":T(t,e);break;case"tool":if(T(t,e),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 Gt(t,e=[],n=[]){let r=new Map(e.map((o)=>[o.key,o])),i=new Map(t.items.filter((o)=>o.kind==="tool").map((o)=>[o.id,o])),u={...t,items:t.items.filter((o)=>!Cn(o))},c=new Map(n.map((o,s)=>[o.turnId,s])),d=[],p=[d],y,I=null;for(let o of u.items){let s=m(o),f=c.get(s??"");if(s!==null&&I!==null&&s!==I||f!==void 0&&y!==void 0&&f>y+1)d=[],p.push(d);if(d.push(o),s!==null||o.kind==="user")I=s;if(f!==void 0)y=f}return p.flatMap((o)=>E({...u,items:o})).map((o)=>{let s=o.prompt===null?[]:[o.prompt];for(let l of o.entries)M(l,s,i);let f=s[0];if(f===void 0)throw Error("A turn without items");let g=`turn:${f.kind}:${f.id}`,b=o.endedAt??Math.max(...s.map((l)=>l.at)),k=r.get(g);if(k!==void 0&&P(k.items,s)&&k.endedAt===b)return k;let x={key:g,user:o.prompt,work:[],final:[],errors:[],edits:[],startedAt:o.startedAt??f.at,endedAt:b,replayed:s.every((l)=>l.replayed),items:s},v=s.findLastIndex((l)=>l.kind!=="user"&&l.kind!=="compaction");return s.forEach((l,A)=>K(x,l,A<v)),x})}function P(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function h(t){return S(t.content)}function U(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function Te(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function Wt(t){let e=(i)=>{for(let u of t.items){let c=u._meta?.codex;if(typeof c!=="object"||c===null)continue;let d=c[i];if(typeof d==="number"&&Number.isFinite(d)&&d>=0)return d}return},n=e("workDurationMs"),r=e("turnDurationMs");return{durationMs:n??r,durationKind:n===void 0&&r!==void 0?"total":"work",startedAt:e("workStartedAt")}}function jt(t,e,n){if(n?.user==null)return!1;let r=e.items.map(m).find((u)=>u!==null),i=m(n.user);if(r!==void 0&&i!==null)return r===i;return 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 Qt(t,e){if(t.state==="idle")return;let n=e.length-1;while(n>0){let r=e[n];if(r.items.some((i)=>i.kind!=="user"))break;if(!jt(t,e[n-1],r))break;n--}return e[n]?.key}function Xt(t,e,n){let r=n,i=n;while(r>0&&jt(t,e[r-1],e[r]))r--;while(i+1<e.length&&jt(t,e[i],e[i+1]))i++;let u=e.slice(r,i+1),c=u.findLast((d)=>d.items.some((p)=>p.kind!=="user"))??u[0];return{continued:e[n]!==c,items:u.flatMap((d)=>d.items),edits:u.flatMap((d)=>d.edits),startedAt:u[0].startedAt}}
2
+ export{Cn,Kt,Gt,h,U,Te,Wt,jt,Qt,Xt};
@@ -1,2 +1,2 @@
1
- function Ye({container:i,target:f,clientX:e,clientY:n,currentScale:r,nextScale:s}){if(r<=0||s<=0)return null;let o=i.getBoundingClientRect(),t=f.getBoundingClientRect();if(t.width===0||t.height===0)return null;let h=e>=t.left&&e<=t.right&&n>=t.top&&n<=t.bottom,l=h?(e-t.left)/t.width:0.5,a=h?(n-t.top)/t.height:0.5,c=t.width/r,g=t.height/r,m=c*s,u=g*s,d=e-o.left,p=n-o.top,P=i.scrollLeft+(t.left-o.left)+t.width/2,b=i.scrollTop+(t.top-o.top)+t.height/2,C=(l-0.5)*m,x=(a-0.5)*u;return{left:Math.max(0,P+C-d),top:Math.max(0,b+x-p)}}
2
- export{Ye};
1
+ function st({container:i,target:f,clientX:e,clientY:n,currentScale:r,nextScale:s}){if(r<=0||s<=0)return null;let o=i.getBoundingClientRect(),t=f.getBoundingClientRect();if(t.width===0||t.height===0)return null;let h=e>=t.left&&e<=t.right&&n>=t.top&&n<=t.bottom,l=h?(e-t.left)/t.width:0.5,a=h?(n-t.top)/t.height:0.5,c=t.width/r,g=t.height/r,m=c*s,u=g*s,d=e-o.left,p=n-o.top,P=i.scrollLeft+(t.left-o.left)+t.width/2,b=i.scrollTop+(t.top-o.top)+t.height/2,C=(l-0.5)*m,x=(a-0.5)*u;return{left:Math.max(0,P+C-d),top:Math.max(0,b+x-p)}}
2
+ export{st};
@@ -1 +1 @@
1
- import{Separator as o}from"@base-ui/react/separator";import{cn as i}from"cn";import{jsx as e}from"react/jsx-runtime";function P({className:a,orientation:r="horizontal",...t}){return e(o,{"data-slot":"separator",orientation:r,className:i("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...t})}export{P};
1
+ import{Separator as o}from"@base-ui/react/separator";import{cn as i}from"cn";import{jsx as e}from"react/jsx-runtime";function B({className:a,orientation:r="horizontal",...t}){return e(o,{"data-slot":"separator",orientation:r,className:i("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...t})}export{B};
@@ -1,2 +1,2 @@
1
- var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function se(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function Je(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=se(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
2
- export{se,Je};
1
+ var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function pe(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function lt(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=pe(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
2
+ export{pe,lt};
@@ -0,0 +1,2 @@
1
+ import{i}from"./chunk-azmqtycn.js";import{t}from"./chunk-vw2hv2sq.js";import{p}from"./chunk-fgsd4fsd.js";import{ContentBlock as s}from"@agentclientprotocol/sdk/experimental/v2/unstable";import{isEmbeddedResource as u,isResourceLink as d}from"@alwith/api";import{jsx as n}from"react/jsx-runtime";function c({block:e,streaming:o}){let r=t();if(s.isText(e)){if(e.text.length===0)return null;return n("div",{className:"codex-assistant-message",children:n(i,{text:e.text,streaming:o})})}if(s.isImage(e))return n(p,{block:e,generated:!0});if(s.isAudio(e))return n("audio",{controls:!0,src:`data:${e.mimeType};base64,${e.data}`});if(d(e)||u(e))return n(p,{block:e,generated:!0});return n("div",{className:"text-muted-foreground",children:r.t("timeline.unsupportedContent",{type:e.type})})}function Q({content:e,messageId:o,streaming:r}){return e.map((a,m)=>n(c,{block:a,streaming:r},`${o}:${m}`))}
2
+ export{Q};
@@ -1 +1 @@
1
- import{cn as a}from"cn";import{jsx as o}from"react/jsx-runtime";function r({className:e,...t}){return o("label",{"data-slot":"label",className:a("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}export{r};
1
+ import{cn as a}from"cn";import{jsx as l}from"react/jsx-runtime";function o({className:e,...t}){return l("label",{"data-slot":"label",className:a("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}export{o};
@@ -0,0 +1,7 @@
1
+ import{Ut}from"./chunk-d675nr2b.js";import{Ce,qt}from"./chunk-ypvjzkfb.js";import{ke}from"./chunk-bkbemt8g.js";import{decodeHTMLAttribute as v,decodeHTMLStrict as I}from"entities";import oe from"katex";import{CheckIcon as z,ChevronLeftIcon as ae,ChevronRightIcon as se,CopyIcon as ie,DownloadIcon as ce,FileIcon as de,LinkIcon as le,MailIcon as ue,XIcon as me}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as ge,createElement as U,memo as B,startTransition as fe,useContext as he,useEffect as p,useLayoutEffect as D,useMemo as X,useRef as k,useState as h}from"react";import{jsx as a,jsxs as g,Fragment as te}from"react/jsx-runtime";var G=ge(null);function C(){let e=he(G);if(e===null)throw Error("Markdown host is missing");return e}var pe=80,A=/\[([^\]\n]+)\]\(([^)\n]+)$/,we=/(^|\n)[^\S\n]*!\[[^\]\n]*(?:\](?:\([^\n]*)?)?\s*$/,be=/\uE200[^\uE201]*$/,xe=4,Te=new Set("7zipx.accdb.asarpack.asciidoc.backup.backupdb.bundle.ccproj.cdrdao.code-workspace.config.debugin.deploy.design.docbook.dockerfile.dockerignore.editorconfig.eslintignore.gitattributes.gitignore.gitignore.gitkeep.gradle.graphqls.ignore.ipynb.keychain.keynote.licensee.lockfile.lockfile.markdown.markup.matlab.mkdocs.models.module.msstyle.notebook.npmignore.output.packageinfo.parquet.pickle.plistx.policy.postcssrc.prettierignore.projectfile.python.readme.review.robots.schema.search.series.settingsjson.shader.sqlite.sqlite3.storyboard.styles.system.target.terraform.update.vertex.webapp.webdoc.webpackrc.widget.workspace.xcodeproj.yarnlock".split("."));function y(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function J(e,n,t){if(t.length!==1)return!1;return e[n-1]===t||e[n+1]===t}function ve(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)&&!J(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function ye(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!y(e,t)&&!J(e,t,n))return t;return-1}function Ne(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function Me(e){return Ne(e,"```")%2===1}function V(e){let n=0;for(let t=0;t<e.length;){if(e.startsWith("```",t)){for(t+=3;t<e.length&&!e.startsWith("```",t);)t+=1;if(t<e.length)t+=3;continue}if(e[t]==="`"&&!y(e,t))n+=1;t+=1}return n%2===1}function Le(e){return e.endsWith(`
2
+ `)?`${e}\`\`\``:`${e}
3
+ \`\`\``}function H(e,n){if(!e.includes(n)||ve(e,n)%2===0)return e;let t=ye(e,n);if(t<0)return e;let r=e.slice(t+n.length);if(r.length===0||/^\s/.test(r)||r.includes(`
4
+ `)||V(r))return e;return`${e}${n}`}function Ee(e){return e.startsWith("/")&&!e.startsWith("//")||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)||/^\/\/[^/]+\/[^/]+/.test(e)}function Z(e){let n=e.replaceAll("`","").trim(),t=n.match(/^(.*?):(\d+)(?::(\d+))?(?:[-–](\d+)(?::(\d+))?)?$/);if(t!==null){let[,o,s,i,c,d]=t;if(o===void 0||s===void 0)throw Error("Codex file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}let r=n.match(/^(.*?)#L(\d+)(?:C(\d+))?(?:-L(\d+)(?:C(\d+))?)?$/);if(r!==null){let[,o,s,i,c,d]=r;if(o===void 0||s===void 0)throw Error("Codex hash file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}return{path:n}}function Ie(e){let{path:n,line:t,column:r,endLine:o,endColumn:s}=Z(e);if(/^[a-z][a-z0-9+.-]*:\/\//i.test(n)||/^www\./i.test(n)||/^(mailto|tel):/i.test(n))return!1;if(t!==void 0||r!==void 0||o!==void 0||s!==void 0)return!0;if(!/(?:^|[\\/])[^\\/]+\.(?!\d+$)[^\\/.]+$/i.test(n))return!1;let i=/[\\/]/.test(n),c=n.split(/[\\/]/).at(-1);if(c===void 0)throw Error("Codex streaming link target has no file name");let d=c.split(".").at(-1);if(d===void 0||d.length===0)return!1;if(!i&&/[a-z]/.test(d)&&/[A-Z]/.test(d.slice(1)))return!1;if(!i){let u=d.toLowerCase();if(u.length>xe&&!Te.has(u))return!1}return!0}function $e(e){let{path:n}=Z(e);if(Ee(n))return!0;try{return new URL(n).protocol==="file:"}catch{return!1}}function Re(e){let n=e.match(A);if(n===null)return e;let t=n[2];if(t===void 0)throw Error("Codex streaming link target is missing");return Ie(t)||$e(t)?e.replace(A,"$1"):`${e})`}function Pe(e){let n=e.replace(be,"");if(n.length===0||n.includes("`")&&V(n))return{isCodeFenceOpen:!1,markdown:n};if(n.includes("```")&&Me(n))return{isCodeFenceOpen:!0,markdown:Le(n)};if(n.includes("!["))n=n.replace(we,(t,r)=>r);if(n.includes("]("))n=Re(n);return n=H(n,"**"),n=H(n,"*"),{isCodeFenceOpen:!1,markdown:n}}function Se(e){return e?.type==="paragraph"&&"tokens"in e&&Array.isArray(e.tokens)}function _(e){return Se(e)&&e.tokens.length===1&&e.tokens[0]?.type==="image"}function Y(e){for(let n=0;n<e.length;n+=1){let t=e[n];if(t===void 0)throw Error(`Codex Markdown token is missing at index ${n}`);if("tokens"in t&&Array.isArray(t.tokens))Y(t.tokens);if(!_(t))continue;let r=[...t.tokens],o=n+1,s=o;for(;;){while(e[o]?.type==="space")o+=1;let i=e[o];if(!_(i))break;r.push(...i.tokens),o+=1,s=o}if(s===n+1)continue;t.tokens=r,t.text=r.map((i)=>i.raw).join(`
5
+ `),t.raw=e.slice(n,s).map((i)=>i.raw).join(""),e.splice(n+1,s-n-1)}}function O(e){return{type:"text",raw:e,text:e}}function Fe(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function E(e){for(let n of e){if(n.type==="list")for(let t of n.items){let r=t.tokens[0];if(r?.type==="heading"){let o=r,s=o.raw.trimEnd(),i=s.match(/^#{1,6}\s+/)?.[0];if(i!==void 0)t.tokens[0]={type:"paragraph",raw:o.raw,text:s,tokens:o.tokens===void 0?[O(s)]:[O(i),...o.tokens]}}if(t.loose)t.tokens=t.tokens.map((o)=>o.type==="text"?Fe(o):o);E(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))E(n.tokens)}}function Ae(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function He(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function _e(e){let n=He(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function Oe({href:e}){let n=X(()=>_e(e),[e]),[t,r]=h(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?ue:o?de:le;return g("span",{className:"codex-markdown-favicon",children:[t===void 0?a("span",{className:"codex-markdown-favicon-fallback",children:a(s,{"aria-hidden":!0})}):null,n.map((i)=>a("img",{alt:"",className:t===i?"codex-markdown-favicon-image-loaded":void 0,decoding:"async",draggable:!1,referrerPolicy:"no-referrer",src:i,onLoad:()=>r((c)=>c!==void 0&&n.includes(c)?c:i)},i))]})}function je({children:e,href:n,title:t}){let r=C();if(r.preview)return a("span",{children:e});return a("a",{className:"codex-markdown-link","data-inline-mention-interactive":"",href:n,title:t,onClick:(o)=>Ae(o,n,r),children:g("span",{className:"codex-markdown-link-mention","data-layout":"inline-flow","data-interactive":"","data-underline-on-hover":"",children:[a("span",{className:"codex-markdown-link-icon-container","data-markdown-copy":"exclude",children:a(Oe,{href:n})}),a("span",{className:"codex-markdown-link-label",children:e})]})})}function We({code:e,language:n}){let{theme:t,copyLabel:r}=C(),o=k(null),[s,i]=h(null),[c,d]=h(null),[u,w]=h(!1);if(p(()=>{let f=Ut(i,d);return o.current=f,()=>{f.dispose(),o.current=null}},[]),p(()=>{let f=o.current;if(f===null)throw Error("Code highlighter is not mounted");f.update(e,n)},[e,n]),c!==null)throw c;let x=s!==null&&s.code===e&&s.language===n?s.html:null;return g("div",{className:"codex-markdown-code-block","data-markdown-copy":"code-block","data-markdown-copy-text":e,"data-theme":t==="dark"?"dark":"light",children:[g("div",{className:"codex-markdown-code-header","data-markdown-copy":"exclude",children:[a("div",{className:"codex-markdown-code-title",children:n}),a("div",{className:"codex-markdown-code-actions",children:a("button",{type:"button",className:"codex-markdown-code-copy",title:r,onClick:()=>{navigator.clipboard.writeText(e),w(!0),window.setTimeout(()=>w(!1),2000)},children:u?a(z,{}):a(ie,{})})})]}),a("div",{className:"codex-markdown-code-container",dir:"ltr",children:a("code",{className:"codex-markdown-code-content hljs",...x===null?{children:e}:{dangerouslySetInnerHTML:{__html:x}}})})]})}function qe({code:e,language:n}){return C().preview?a("span",{children:e}):a(Ke,{code:e,language:n})}function Ke({code:e,language:n}){let t=k(null),[r,o]=h(!1);if(p(()=>{if(r)return;let s=t.current;if(s===null)throw Error("Codex code block placeholder is not mounted");if(typeof IntersectionObserver>"u"){let c=window.setTimeout(()=>o(!0),0);return()=>window.clearTimeout(c)}let i=new IntersectionObserver((c)=>{if(!c.some((d)=>d.isIntersecting))return;o(!0),i.disconnect()},{rootMargin:"600px 0px"});return i.observe(s),()=>i.disconnect()},[r]),r)return a(We,{code:e,language:n});return a("div",{ref:t,className:"codex-markdown-code-block",children:a("pre",{className:"codex-markdown-code-placeholder",children:a("code",{children:e})})})}function ze(e){let n=[...document.body.querySelectorAll('[data-markdown-image-preview-trigger="true"]')],t=n.map((o)=>{let s=o.querySelector("img");if(s===null)throw Error("Codex image preview trigger has no image");return{src:s.currentSrc||s.src,alt:s.alt}}),r=n.indexOf(e);if(r===-1)throw Error("Codex image preview trigger is outside the document");return{images:t,index:r}}function Ue({preview:e,setPreview:n}){let t=e.images[e.index];if(t===void 0)throw Error(`Codex image preview index is out of range: ${e.index}`);return g("div",{className:"codex-markdown-image-preview",children:[a("img",{src:t.src,alt:t.alt}),g("div",{className:"codex-markdown-image-preview-actions",children:[a("button",{type:"button","aria-label":"Previous image",disabled:e.index===0,onClick:()=>n({...e,index:e.index-1}),children:a(ae,{})}),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(ce,{})}),a("button",{type:"button","aria-label":"Next image",disabled:e.index===e.images.length-1,onClick:()=>n({...e,index:e.index+1}),children:a(se,{})}),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(me,{})})]})]})}function Be(e){return C().preview?a(te,{children:e.alt}):a(De,{...e})}function De({src:e,alt:n,title:t,allowWide:r}){let o=k(null),[s,i]=h();p(()=>{let d=o.current;if(d===null)throw Error("Codex image preview dialog is not mounted");if(s===void 0){if(d.open)d.close();return}if(!d.open)d.showModal()},[s]);let c=n.length===0?"Open image preview":n;return g(te,{children:[a("button",{type:"button",className:`codex-markdown-image-trigger${r?"codex-markdown-image-trigger-wide":""}`,"aria-label":c,"data-markdown-image-preview-trigger":"true",onClick:(d)=>i(ze(d.currentTarget)),children:a("img",{className:`codex-markdown-image${r?"codex-markdown-image-wide":""}`,src:e,alt:n,title:t,loading:"lazy"})}),a("dialog",{ref:o,className:"codex-markdown-image-dialog","aria-label":c,onClose:()=>i(void 0),children:s===void 0?null:a(Ue,{preview:s,setPreview:i})})]})}function Xe({value:e,display:n}){let t=k(null);return D(()=>{if(t.current===null)throw Error("Codex math root is not mounted");oe.render(e,t.current,{displayMode:n,throwOnError:!1})},[n,e]),a("span",{ref:t,className:n?"codex-markdown-math-block":"codex-markdown-inline-math"})}var Ge=150,T=null;function j(e,n){let t=T;if(t===null)return e;let r=t.cursor,o=r+e.length;t.cursor=o;let s=[],i=r;for(let c of t.runs){if(c.end<=r)continue;if(c.start>=o)break;let d=Math.max(r,c.start),u=Math.min(o,c.end);if(i<d)s.push(e.slice(i-r,d-r));s.push(a("span",{className:"codex-markdown-fade",children:e.slice(d-r,u-r)},`${n}:${t.generation}:${c.start}`)),i=u}if(i<o)s.push(e.slice(i-r));return s}function Q(e){let n=5381;for(let t=0;t<e.length;t+=1)n=(n*33+e.charCodeAt(t))%4294967296;return n.toString(36)}function W(e){let n=e.trim();if(n.length===0)return"";let t=n.split(`
6
+ `,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,pe)}function Je(e){switch(e.type){case"code":return e.raw.trimStart().match(/^(```|~~~)/)?.[1]??"";case"link":return e.href;case"image":{let n=e;return`${n.href}:${W(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return W(e.text);default:return""}}function ee(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Q(Je(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=ee(r),s=t.get(o)??0;return t.set(o,s+1),ne(r,`${n}-${o}-${s}`)})}function Ve(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return g("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?g("div",{className:"codex-markdown-task-checkbox",children:[a("input",{type:"checkbox",className:"codex-markdown-checkbox",checked:e.checked,"data-state":e.checked?"checked":"unchecked",readOnly:!0,disabled:!0}),e.checked?a(z,{}):null]}):null,m(t,n)]},n)}function Ze(e,n){let r=`codex-markdown-list ${e.items.some((s)=>s.task)?"codex-markdown-task-list":e.ordered?"codex-markdown-ordered-list":"codex-markdown-unordered-list"}`,o=m(e.items,n);return e.ordered?a("ol",{className:r,start:e.start===""?void 0:e.start,children:o},n):a("ul",{className:r,children:o},n)}function q(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return U(r,{key:n,className:`${t?"codex-markdown-table-header":"codex-markdown-table-cell"}${o?" codex-markdown-numeric-table-cell":""}`,align:e.align??void 0},...m(e.tokens,n))}function Ye(e,n){let t=new Map;return a("div",{className:"codex-markdown-table-container","data-markdown-table":!0,tabIndex:-1,children:a("div",{className:"codex-markdown-table-scroller",children:a("div",{className:"codex-markdown-table-wrapper",children:g("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>q(r,`${n}-header-${o}`,!0))})}),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Q(r.map((c)=>c.text).join("\x00")),s=t.get(o)??0;t.set(o,s+1);let i=`${n}-row-${o}-${s}`;return a("tr",{className:"codex-markdown-table-row",children:r.map((c,d)=>q(c,`${i}-cell-${d}`,!1))},i)})})]})})})},n)}function K(e,n,t){let r=v(e.href);if(!ke(r))return null;return a(Be,{src:r,alt:I(e.text),title:e.title==null?void 0:v(e.title),allowWide:t},n)}function ne(e,n){switch(e.type){case"space":case"def":case"internalMessage":return null;case"hr":return a("hr",{className:"codex-markdown-horizontal-rule"},n);case"heading":{let t=e,o={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"}[t.depth];if(o===void 0)throw Error(`Unsupported Codex Markdown heading depth: ${t.depth}`);return U(o,{key:n,className:`codex-markdown-heading codex-markdown-heading-${t.depth}`},...m(t.tokens,n))}case"paragraph":{let t=e,r=t.tokens.filter((i)=>i.type!=="space"&&i.type!=="br"),o=r.length>0&&r.every((i)=>i.type==="image"),s=o&&r.length>1;return a("p",{className:`codex-markdown-paragraph${o?"codex-markdown-media-paragraph codex-markdown-media-wide-block":""}${s?"codex-markdown-media-grid-paragraph":""}`,"data-markdown-image-grid":s?"true":void 0,"data-wide-markdown-block":o?"true":void 0,"data-wide-markdown-block-kind":o?"image":void 0,children:o?r.map((i,c)=>K(i,`${n}-image-${c}`,!0)):m(t.tokens,n)},n)}case"text":{let t=e;return t.tokens===void 0?j(I(t.text),n):m(t.tokens,n)}case"escape":return j(e.text,n);case"strong":return a("strong",{className:"codex-markdown-strong",children:m(e.tokens,n)},n);case"em":return a("em",{children:m(e.tokens,n)},n);case"del":return a("del",{children:m(e.tokens,n)},n);case"codespan":return a("span",{className:"codex-markdown-inline-code",dir:"ltr","data-markdown-copy":"inline-code",children:e.text},n);case"br":return a("br",{},n);case"link":{let t=e,r=m(t.tokens,n),o=v(t.href);return ke(o)?a(je,{href:o,title:t.title==null?void 0:v(t.title),children:r},n):a("span",{children:r},n)}case"image":return K(e,n,!1);case"code":{let t=e;return a(qe,{code:t.text,language:t.lang},n)}case"blockquote":return a("blockquote",{className:"codex-markdown-blockquote",children:m(e.tokens,n)},n);case"list":return Ze(e,n);case"list_item":return Ve(e,n);case"table":return Ye(e,n);case"html":{let t=e;return/^<br\s*\/?>$/i.test(t.raw.trim())?a("br",{},n):t.raw}case"math":{let t=e;return a(Xe,{value:t.text,display:t.display},n)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function b(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?I(n.text):n.tokens.map(b).join("")}case"escape":return e.text;case"paragraph":case"heading":case"strong":case"em":case"del":case"link":case"blockquote":case"list_item":return e.tokens.map(b).join("");case"list":return e.items.map(b).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(b).join("")).join("")).join("")}default:return""}}function Qe({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=T;try{return T={cursor:t,runs:r,generation:o},ne(e,n)}finally{T=s}}var en=B(function({result:n}){let{text:t,isStreaming:r}=n,o=X(()=>{let l=n.tokens;if(n.source.includes("!["))Y(l);E(l);let R=new Map,P=0;return l.map((M)=>{let L=ee(M),S=R.get(L)??0;R.set(L,S+1);let F=b(M),re={token:M,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,re})},[n]),s=o.map((l)=>l.visibleText).join(""),i=k({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,w=performance.now(),x=r&&d?c.runs.filter((l)=>w-l.firstSeenAtMs<Ge):[],N=c.generation+(d?0:1),f={text:t,visibleText:s,runs:x.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:N};if(r&&s.length>u)f.runs.push({start:u,end:s.length,firstSeenAtMs:w});return D(()=>{i.current=f}),a("div",{dir:"auto",className:"codex-markdown-content codex-markdown-root","data-streaming":r?"true":void 0,children:o.map((l)=>a(Qe,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:f.runs,generation:N},l.tokenKey))})}),nn=B(function({text:n,isStreaming:t}){let r=k(null),[o,s]=h(()=>Ce(n,t)),[i,c]=h(null);if(p(()=>{let d=qt((u)=>{fe(()=>s(u))},c);return r.current=d,()=>{d.dispose(),r.current=null}},[]),p(()=>{let d=r.current;if(d===null)throw Error("Markdown parser is not mounted");let u=t?Pe(n).markdown:n;d.update({source:u,text:n,isStreaming:t})},[t,n]),i!==null)throw i;return o===null?a("div",{"data-markdown-pending":!0}):a(en,{result:o})});function Ot({text:e,streaming:n,host:t}){let r=n===!0,[o,s]=h(e);return p(()=>{if(o===e)return;if(!r){s(e);return}let i=requestAnimationFrame(()=>s(e));return()=>cancelAnimationFrame(i)},[o,r,e]),a(G.Provider,{value:t,children:a(nn,{text:r?o:e,isStreaming:r})})}
7
+ export{Ot};
@@ -0,0 +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};
@@ -0,0 +1,2 @@
1
+ function*te(n,e){if(e.length===0)return;let r=new RegExp(e.replaceAll(/[.*+?^{}()|[\]\\$]/g,String.raw`\$&`),"giu");for(let t of n.matchAll(r))yield{start:t.index,end:t.index+t[0].length}}function En(n,e){if(e.length===0)return[];let r=[];for(let{turnKey:t,segments:o}of n){let c=0;for(let s of o)for(let a of te(s,e))r.push({turnKey:t,occurrenceInTurn:c}),c+=1}return r}
2
+ export{te,En};
@@ -0,0 +1,2 @@
1
+ import{$t}from"./chunk-9dsa5vm7.js";import{useCallback as Te,useEffect as P,useLayoutEffect as xe,useMemo as Q,useRef as I,useState as E}from"react";import"@alwith/module-chat/navigation-rail.css";import{jsx as T,jsxs as Ne,Fragment as Me}from"react/jsx-runtime";var ye=4,me=10;function we(h,x){let v=new Map(x.flatMap((c)=>c.itemIds.map((w)=>[w,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 O=Math.max(-1,...x.map((c)=>c.key))+1,B=new Set,n=[];for(let[c,w]of h.entries()){let S=v.get(w),m=n.at(-1);if(!m||S!==void 0&&S!==m.key||S===void 0&&m.itemIds.length>=64&&p[c]!==m.key){let y=S!==void 0&&!B.has(S)?S:O++;m={key:y,startIndex:c,itemIds:[]},n.push(m),B.add(y)}m.itemIds.push(w)}return n}function ge(h,x){if(h.size!==x.size)return!1;for(let v of h)if(!x.has(v))return!1;return!0}function zt({audio:h,beforeReveal:x,ensureItemMounted:v,items:p,onPreviewItem:C,renderPreview:O,onRevealError:B,scrollRoot:n,targetTopMarginPx:c=16}){let[w,S]=E(()=>{let e=p.at(-1);return new Set(e===void 0?[]:[e.id])}),[m,y]=E(null),[W,A]=E(null),[X,U]=E(!1),[_,fe]=E(()=>new Set),[pe,ve]=E(!0),[be,j]=E(null),{installUnlock:Z,preload:ee,playSequence:te}=h,K=I(null),M=I(null),R=I(!1),H=I(null),L=I(0),N=I(null),G=I(new Set),V=Q(()=>p.map((e)=>e.id).join("\x00"),[p]),F=I(p);F.current=p;let ne=I(_),ie=I(w),re=I({itemIdsKey:V,scrollRoot:n});if(re.current.scrollRoot!==n)L.current+=1,re.current={itemIdsKey:V,scrollRoot:n};let g=Q(()=>v===void 0?p.filter((e)=>_.has(e.id)):p,[v,p,_]),se=Q(()=>g.map((e)=>({inputTokens:e.inputTokens,outputTokens:e.outputTokens})),[g]),z=I({ids:"",groups:[]}),ae=g.map((e)=>e.id).join("\x00");if(z.current.ids!==ae)z.current={ids:ae,groups:we(g.map((e)=>e.id),z.current.groups)};P(()=>Z(),[Z]),P(()=>()=>{if(L.current+=1,N.current!==null)clearTimeout(N.current)},[]),P(()=>{y(null),U(!1),A(null),M.current=null,R.current=!1,H.current=null,j(null),G.current.clear()},[n]),P(()=>{ee()},[ee]),P(()=>{if(n===null)return;let e=new Set,t=new Map,i=new Set(F.current.map((o)=>o.id)),r=()=>{let o=new Set(t.values()),d=F.current.filter((f)=>o.has(f.id)).map((f)=>f.id),u=d.findIndex((f)=>e.has(f));if(u===-1)return;let b=u;for(let f=u+1;f<d.length;f++)if(e.has(d[f]))b=f;let k=new Set(d.slice(u,b+1));if(ge(ie.current,k))return;ie.current=k,S(k)},s=new IntersectionObserver((o)=>{for(let d of o){let u=t.get(d.target);if(d.isIntersecting)e.add(u);else e.delete(u)}r()},{root:n,rootMargin:`-${c}px 0px 0px 0px`}),a=()=>{let o=new Set,d=new Set;for(let u of n.querySelectorAll("[data-content-search-unit-key]")){let b=u.dataset.contentSearchUnitKey;if(b===void 0||!i.has(b)||o.has(b))continue;o.add(b);let k=u.closest("[data-turn-key]"),f=k===null||d.has(k)?u:k;if(d.add(f),t.has(f))continue;t.set(f,b),s.observe(f)}for(let u of t.keys()){if(d.has(u))continue;s.unobserve(u),e.delete(t.get(u)),t.delete(u)}if(r(),ge(ne.current,o))return;ne.current=o,fe(o)};a();let l=new MutationObserver((o)=>{if(o.some((u)=>[...u.addedNodes,...u.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))))a()});return l.observe(n,{childList:!0,subtree:!0}),()=>{l.disconnect(),s.disconnect()}},[V,n,c]);let J=g.find((e)=>w.has(e.id))?.id??g.at(-1)?.id;xe(()=>{let e=K.current;if(e===null||M.current!==null||J===void 0)return;let t=e.querySelector(`[data-timeline-user-message-navigation-item-id="${CSS.escape(J)}"]`);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},[J,V]),P(()=>{let e=n?.querySelector("[data-timeline-user-message-navigation-content]");if(!n||!e)return;let t=()=>{let r=n.getBoundingClientRect(),s=e.getBoundingClientRect();if(r.width===0||s.width===0)return;let a=n.offsetWidth>0?r.width/n.offsetWidth:1;ve((s.left-r.left)/a>=48)},i=new ResizeObserver(t);return i.observe(n),i.observe(e),t(),()=>i.disconnect()},[n]);let Ie=Te(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)}"]`),s=r(),a=s!==null&&n.clientHeight>0&&s.closest("[data-turn-key]")!==null&&Math.abs(s.getBoundingClientRect().top-n.getBoundingClientRect().top)>n.clientHeight*2;if((s===null||a)&&v!==void 0){if(t==="instant"&&e.isLoaded===!1)return;s=await v(e,()=>L.current===i)??r(),t="instant"}if(L.current!==i)return;if(s===null)return;let l=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;s.scrollIntoView({behavior:l?"instant":t,block:"start"}),s.querySelector("[data-user-message-bubble], [data-composer-attachment-pill]")?.animate?.([{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)"},{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)",offset:0.35},{backgroundColor:"transparent"}],{duration:l?0:1000,easing:"cubic-bezier(0.23, 1, 0.32, 1)"})},[x,v,n]);if(g.length<ye||!pe)return null;let Y=()=>{if(N.current!==null)clearTimeout(N.current);N.current=null},oe=(e,t=!1)=>{if(Y(),C===void 0||e.isLoaded!==!1||G.current.has(e.turnKey))return;let i=()=>{N.current=null,G.current.add(e.turnKey),C(e).catch(()=>G.current.delete(e.turnKey))};if(t)i();else N.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,ue=(e,t="smooth")=>{Ie(e,t).catch((i)=>{if(B)B(i);else throw i})},le=g.findIndex((e)=>e.id===(W??be)),de=K.current,he=m===null||!de?.contains(m.button)?0:Se(de,m.button),ce=(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,s=g.findIndex((a)=>a.id===r);return{button:t,item:g[s],index:s}},D=(e)=>{let t=M.current;if(t?.pointerId!==e.pointerId)return;if(M.current=null,A(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($t,{open:X,onOpenChange:U,side:"inline-end",sideOffset:0,align:"center",alignOffset:he,trigger:T("div",{ref:K,"data-timeline-user-message-navigation-rail-list":!0,"data-scrubbing":W===null?void 0:"",className:"timeline-user-message-navigation-rail-list",onPointerEnter:()=>{H.current=null},onPointerDown:(e)=>{if(e.button!==0)return;Y();let t=ce(e.target instanceof Element?e.target:null);if(t===null)return;R.current=!1,M.current={pointerId:e.pointerId,itemId:t.item.id,itemIndex:t.index,captureTarget:t.button},t.button.setPointerCapture(e.pointerId),A(t.item.id),y(t),U(!0)},onPointerMove:(e)=>{let t=M.current;if(t===null){let l=ce(e.target instanceof Element?e.target:null);if(l!==null){j(l.item.id);let o=H.current;if(o!==null&&o!==l.index)te(o,l.index,se);H.current=l.index,y((d)=>d?.item.id===l.item.id?d:l),oe(l.item)}return}if(t.pointerId!==e.pointerId)return;if((e.buttons&1)===0){D(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)/me))),a={button:e.currentTarget.querySelectorAll("[data-timeline-user-message-navigation-item-id]")[r],item:g[r],index:r};if(a.item.id===t.itemId)return;te(t.itemIndex,a.index,se),H.current=a.index,M.current={...t,itemId:a.item.id,itemIndex:a.index},R.current=!0,A(a.item.id),y(a),ue(a.item,"instant")},onPointerUp:D,onPointerCancel:D,onLostPointerCapture:D,onPointerLeave:()=>{if(Y(),j(null),H.current=null,M.current===null&&!X)y(null)},children:T("div",{className:"flex flex-col",children:z.current.groups.map((e)=>T("div",{className:"flex w-9 shrink-0 flex-col [content-visibility:auto]",style:{height:e.itemIds.length*me},children:g.slice(e.startIndex,e.startIndex+e.itemIds.length).map((t,i)=>{let r=e.startIndex+i,s=Math.abs(r-le),a=le===-1||s>3?void 0:[1,0.7,0.4,0.2][s];return T("button",{type:"button","data-timeline-user-message-navigation-item-id":t.id,"data-scrub-target":W===t.id?"":void 0,"aria-current":w.has(t.id)?"true":void 0,"aria-label":`Jump to user message ${r+1}`,className:"timeline-user-message-navigation-row",onClick:(l)=>{if(R.current){R.current=!1;return}let o={button:l.currentTarget,item:t,index:r};y(o),U(!0),ue(t)},onFocus:(l)=>{oe(t,!0),y({button:l.currentTarget,item:t,index:r}),U(!0)},children:T("span",{className:"flex h-0.5 w-[30px] items-center",children:T("span",{className:"timeline-user-message-navigation-marker",style:a===void 0?void 0:{"--marker-progress":a}})})},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:O?O(q):Ne(Me,{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 Se(h,x){let v=h.getBoundingClientRect(),p=x.getBoundingClientRect();return p.top+p.height/2-(v.top+v.height/2)}
2
+ export{zt};
@@ -1 +1 @@
1
- import{Checkbox as i}from"@base-ui/react/checkbox";import{cn as o}from"cn";import{CheckIcon as t}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function v({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{v};
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 P({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{P};
@@ -0,0 +1,2 @@
1
+ import{ut,N,ge,mt,pt,gt}from"./chunk-nxarfyj2.js";import{forwardRef as pe,useCallback as K,useEffect as me,useImperativeHandle as Re,useLayoutEffect as w,useMemo as re,useRef as s,useState as F}from"react";import{jsx as R,jsxs as ie}from"react/jsx-runtime";var He=12,j=2,q=800,fe=new Map;function Te({turnKey:W,heightPx:x,placeholder:_=!1,deferUntilReady:n=!1,observe:H,onReady:L,children:z}){let h=s(null),[T,U]=F(!1),G=K((m)=>{h.current=m,H(W,m)},[H,W]);return w(()=>{let m=h.current;if(m===null)throw Error("Codex turn element is missing");let b=()=>{L(m),U(!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]),ie("div",{style:T?void 0:{position:"relative",height:x,overflow:"hidden"},children:[R("div",{ref:G,className:"[&_[data-virtualized-turn-content]]:[content-visibility:visible]","data-turn-key":W,"aria-busy":!T||void 0,style:!T&&!_&&n?{visibility:"hidden"}:void 0,"data-turn-ready":T?"":void 0,children:z}),!T&&!_&&n&&R("div",{"aria-hidden":"true",className:"codex-turn-loading",children:ie("div",{className:"codex-turn-loading-lines",children:[R("span",{}),R("span",{}),R("span",{})]})})]})}var ct=pe(function({entries:x,renderTurn:_,scrollElement:n,sessionKey:H,leadingContent:L,leadingInsetPx:z=0,preserveViewport:h=!1},T){let U=s(null),[G,m]=F(z),b=L!==void 0&&L!==null;w(()=>{let e=U.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=re(()=>fe.get(H),[H]),[J,Q]=F(()=>d?.turnHeightsByKey??{}),i=re(()=>ut({entries:x,gapPx:He,measuredHeightsByKey:J,leadingInsetPx:b?G:z}),[x,J,b,G,z]),xe=re(()=>{let e=N({distanceFromBottomPx:d?.distanceFromBottomPx??0,layout:i,overscanCount:j,viewportHeightPx:q}),t=d?.renderedWindow;if(t===void 0||t===null)return e;return ge({anchorKey:t.anchorKey,layout:i,previousRange:{startIndex:0,endIndex:Math.min(t.count,e.endIndex-e.startIndex)}})??e},[d,i]),[M,oe]=F(xe),[y,ue]=F(q),[c,ae]=F(null),k=s(d?.distanceFromBottomPx??0),S=s(M),se=s(i.turnKeys),l=s(J),E=s(i),ce=s(i),P=s(new Map),v=s(null),C=s(null),D=s(null),O=s(new Map),Y=s(!1),de=s(()=>{}),A=s(null),le=K(()=>{if(!h||n===null||v.current!==null||A.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=E.current.turnIndexByKey.get(r),B=g===void 0?a.height:E.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)A.current={key:o.key,element:o.element,top:o.rect.top-e.top,scrollTop:n.scrollTop}},[h,n]),Z=s(le);Z.current=le;let p=K((e,t)=>{let o=Math.min(e,i.totalHeightPx),r=N({distanceFromBottomPx:o,layout:i,overscanCount:j,viewportHeightPx:t}),u=S.current,a=u.startIndex<=r.startIndex&&u.endIndex>=r.endIndex?u:r;if(k.current=o,S.current=a,se.current=i.turnKeys,ue(t),a!==u)oe(a)},[i]),V=K((e)=>{let t=Math.max(0,e.scrollHeight-i.totalHeightPx);return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop-t)},[i.totalHeightPx]),ye=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;Z.current();let r={...l.current,[t]:o};l.current=r,Q(r)},[]),ee=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);O.current.set(r,u)}if(D.current!==null||O.current.size===0)return;D.current=requestAnimationFrame(()=>{D.current=null;let t=[...O.current].filter(([r,u])=>l.current[r]!==u);if(O.current.clear(),t.length===0)return;Z.current();let o={...l.current,...Object.fromEntries(t)};l.current=o,Q(o)})}),C.current},[]),ve=K((e,t)=>{let o=P.current.get(e);if(o!==void 0)ee().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),ee().observe(t)},[ee]);me(()=>()=>{if(C.current?.disconnect(),D.current!==null)cancelAnimationFrame(D.current);O.current.clear(),C.current=null,P.current.clear()},[]),w(()=>{de.current=()=>{if(n===null)return;let e=V(n);if(v.current!==null){k.current=e,ue(n.clientHeight||q);return}p(e,n.clientHeight||q)}},[V,n,p]),w(()=>{if(n===null)return;if(!Y.current){Y.current=!0;let o=d?.distanceFromBottomPx??0;n.scrollTo({behavior:"instant",top:Math.max(0,o>0?E.current.totalHeightPx-n.clientHeight-o:n.scrollHeight-n.clientHeight)})}let e=()=>de.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,Q(g);return}let o=c.getTargetElement(e)??e,r=e.getBoundingClientRect(),u=o.getBoundingClientRect(),a=gt({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||q),queueMicrotask(()=>{if(v.current!==c)return;c.complete(),v.current=null,ae(null)})},[i,c,n,p]),w(()=>{let e=ce.current;if(ce.current=i,E.current=i,n===null||c!==null){A.current=null;return}let t=A.current;A.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(V(n),n.clientHeight);return}let r=k.current;if(h&&e!==i&&Y.current)r=Math.max(0,e.totalHeightPx-n.clientHeight-n.scrollTop);if((r>24||h)&&e!==i){let u=V(n);if(u<=96&&!h){p(u,y);return}let a=N({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=mt({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,V,n,p,y,h]),w(()=>{S.current=M},[M]),me(()=>()=>{v.current?.complete(),v.current=null;let e=S.current,o=E.current.turnKeys[e.startIndex];fe.set(H,{distanceFromBottomPx:k.current,renderedWindow:o===void 0?null:{anchorKey:o,count:e.endIndex-e.startIndex},turnHeightsByKey:l.current})},[H]),Re(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=pt({layout:i,turnKey:e,viewportHeightPx:y});if(a===null)throw Error(`Codex virtual turn is missing: ${e}`);let g=N({distanceFromBottomPx:a,layout:i,overscanCount:j,viewportHeightPx:y});return S.current=g,oe(g),new Promise((B)=>{let f={align:o.align,complete:B,getTargetElement:t,turnKey:u};v.current=f,ae(f)})}}),[i,y]);let I=M,X=se.current;if(!(X===i.turnKeys||X.length===i.turnKeys.length&&X.every((e,t)=>e===i.turnKeys[t]))){let e=X[M.startIndex];I=(e===void 0?null:ge({anchorKey:e,layout:i,previousRange:M}))??N({distanceFromBottomPx:k.current,layout:i,overscanCount:j,viewportHeightPx:y})}let te=x.length-1,he=x[te],ne=x.slice(I.startIndex,Math.min(I.endIndex,te)).map((e,t)=>({entry:e,index:I.startIndex+t}));if(he!==void 0)ne.push({entry:he,index:te});return ie("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":ne.length,className:"relative shrink-0",style:{height:i.totalHeightPx},children:[b&&R("div",{ref:U,"data-codex-timeline-leading":!0,className:"absolute inset-x-0 top-0",children:L}),ne.map(({entry:e,index:t})=>R("div",{className:"absolute inset-x-0",style:{top:i.topOffsetsPx[t]??0},children:R(Te,{turnKey:e.turnKey,heightPx:i.heightsPx[t],placeholder:e.placeholder,deferUntilReady:e.deferUntilReady,observe:ve,onReady:ye,children:_(e,t)})},e.turnKey))]})});
2
+ export{ct};
@@ -0,0 +1,2 @@
1
+ import{O}from"./chunk-aqj0v5a9.js";import{St}from"./chunk-p6558tbk.js";import{t}from"./chunk-vw2hv2sq.js";import{p}from"./chunk-fgsd4fsd.js";import{isContentEntry as a,isEmbeddedResource as f,isResourceLink as g}from"@alwith/api";import{memo as k,useMemo as y}from"react";import{jsx as s,jsxs as u,Fragment as T}from"react/jsx-runtime";function R({item:n}){if(n.name==="view_image"&&n.status==="completed")return null;let r=n.content.filter(a).filter((e)=>f(e.content)||g(e.content));if(r.length===0)return null;return u("fieldset",{className:"mt-1 min-w-0",children:[s("legend",{className:"text-muted-foreground text-xs",children:n.title??n.name}),r.map((e,l)=>s(p,{block:e.content},`${n.id}:${l}`))]})}var It=k(function({sessionId:r,items:e,terminals:l,streamingThoughtId:m}){let i=t().toolBlock,d=y(()=>e.map((o)=>{let c={...St(o,l,o.kind==="thought"&&o.id===m),id:JSON.stringify([r,o.id])};return c.type==="tool_use"&&o.kind==="tool"&&i!==void 0?i(c,o):c}),[r,e,l,m,i]);return u(T,{children:[s(O,{blocks:d}),e.map((o)=>o.kind==="tool"&&s(R,{item:o},o.id))]})});
2
+ export{It};
@@ -1 +1 @@
1
- import{Radio as o}from"@base-ui/react/radio";import{RadioGroup as t}from"@base-ui/react/radio-group";import{cn as d}from"cn";import{jsx as i}from"react/jsx-runtime";function c({className:r,...e}){return i(t,{"data-slot":"radio-group",className:d("grid w-full gap-3",r),...e})}function a({className:r,...e}){return i(o.Root,{"data-slot":"radio-group-item",className:d("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...e,children:i(o.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{c,a};
1
+ import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function v({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function c({className:r,...a}){return i(e.Root,{"data-slot":"radio-group-item",className:o("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:i(e.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{v,c};
@@ -0,0 +1,2 @@
1
+ function cn(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 Le(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(cn(n,i))}return{imageFiles:e,sawNonImageFile:o}}function Ae(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 un(t){return[...t].filter((e)=>!s(e)).join("")}function rn(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 q(t){let{value:e,selectionStart:o,selectionEnd:i}=t,n=un(e);if(n===e)return n;if(t.value=n,o!==null&&i!==null){let a=Math.max(0,o-rn(e,o)),r=Math.max(0,i-rn(e,i));requestAnimationFrame(()=>{t.setSelectionRange(a,r)})}return n}
2
+ export{cn,Le,Ae,un,rn,q};
@@ -0,0 +1,2 @@
1
+ import{n}from"./chunk-azmqtycn.js";import{d}from"./chunk-trgq8rq1.js";import{isContentEntry as b,isImage as N,isResourceLink as w}from"@alwith/api";import{ChevronRightIcon as C,ImageIcon as S,LoaderCircleIcon as A,RefreshCwIcon as R}from"lucide-react";import{useEffect as B,useState as v}from"react";import{jsx as s,jsxs as f}from"react/jsx-runtime";function M(e){return e.type==="tool_use"&&e.name==="view_image"&&e.status==="completed"}function T(e){let r=[];for(let[c,l]of e.content.entries()){if(!b(l))continue;let i=l.content;if(N(i))r.push({key:`${e.id}:${c}`,src:`data:${i.mimeType};base64,${i.data}`,alt:e.title??""});if(w(i))r.push({key:`${e.id}:${c}`,path:i.uri,alt:i.name})}if(r.length)return r;let a=e.rawInput;if(a!==null&&typeof a==="object"&&"path"in a&&typeof a.path==="string")return[{key:e.id,path:a.path,alt:a.path.split(/[\\/]/).at(-1)??a.path}];throw Error(`Image view ${e.id} has no image source`)}function E({images:e}){let{loadImage:r,openImageGallery:a,openImage:c,t:l}=n(),[i,y]=v({}),[x,I]=v(0),h=JSON.stringify(e);B(()=>{let t=!0,u=JSON.parse(h);y({});for(let o of u)(o.src!==void 0?Promise.resolve(o.src):o.path!==void 0&&r?r(o.path):Promise.reject(Error("Image loading is unavailable"))).then((m)=>{if(t)y((g)=>({...g,[o.key]:{src:m}}))},()=>{if(t)y((m)=>({...m,[o.key]:{error:!0}}))});return()=>{t=!1}},[h,r,x]);let k=e.flatMap((t)=>{let u=i[t.key];return u&&"src"in u?[{src:u.src,alt:t.alt}]:[]});return s("div",{className:"codex-image-thumbnails",children:e.map((t,u)=>{let o=i[t.key];if(!o)return s("div",{className:"codex-image-thumbnail",role:"status","aria-label":l("stream.codex.imageLoading"),children:s(A,{className:"motion-safe:animate-spin","aria-hidden":"true"})},t.key);if("error"in o)return s("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,"aria-label":l("stream.codex.imageFailed"),onClick:()=>I((p)=>p+1),children:s(R,{"aria-hidden":"true"})},t.key);return s("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,onClick:()=>{let p=e.slice(0,u).filter((m)=>{let g=i[m.key];return g&&"src"in g}).length;if(a)a(k,p);else c?.(o.src)},children:s("img",{src:o.src,alt:t.alt,draggable:!1})},t.key)})})}function Nt({blocks:e}){let{t:r}=n(),a=e.flatMap(T),[c,l]=d(`image-view:${e[0].id}`,!1);return f("div",{className:"codex-activity-item",children:[f("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((i)=>!i),children:[f("span",{className:"codex-activity-label",children:[s(S,{className:"codex-activity-icon","aria-hidden":"true"}),s("span",{className:"codex-activity-leading",children:r("stream.codex.viewedImages",{count:a.length})})]}),s(C,{className:c?"codex-image-chevron codex-image-chevron-open":"codex-image-chevron","aria-hidden":"true"})]}),c&&s(E,{images:a})]})}
2
+ export{M,Nt};
@@ -0,0 +1,2 @@
1
+ var Gn=280;function ut({entries:i,gapPx:t,measuredHeightsByKey:o,leadingInsetPx:e=0}){let n=[],r=[],d=new Map,s=[],u=e;for(let[x,a]of i.entries()){d.set(a.turnKey,x);for(let h of a.aliases??[])d.set(h,x);s.push(a.turnKey),r.push(u);let f=a.aliases?.map((h)=>o[h]).find((h)=>h!==void 0),m=o[a.turnKey]??f??a.estimatedHeightPx??280;if(n.push(m),u+=m,x<i.length-1)u+=t}return{bottomOffsetsPx:r.map((x,a)=>{let f=n[a];if(f===void 0)throw Error(`Codex turn height is missing at index ${a}`);return u-x-f}),heightsPx:n,topOffsetsPx:r,totalHeightPx:u,turnIndexByKey:d,turnKeys:s}}function N({distanceFromBottomPx:i,layout:t,overscanCount:o,viewportHeightPx:e}){if(t.turnKeys.length===0)return{startIndex:0,endIndex:0};let n=Math.min(Math.max(0,i),t.totalHeightPx),r=Math.min(n+Math.max(0,e),t.totalHeightPx),d=g(t.bottomOffsetsPx,r),s=l(t.bottomOffsetsPx,t.heightsPx,n);return{startIndex:Math.max(0,d-o),endIndex:Math.min(t.turnKeys.length,Math.max(s,d+1)+o)}}function ge({anchorKey:i,layout:t,previousRange:o}){let e=t.turnIndexByKey.get(i);if(e===void 0)return null;return{startIndex:e,endIndex:Math.min(t.turnKeys.length,e+o.endIndex-o.startIndex)}}function mt({anchorKey:i,distanceFromBottomPx:t,nextLayout:o,previousLayout:e}){let n=e.turnIndexByKey.get(i),r=o.turnIndexByKey.get(i);if(n===void 0||r===void 0)return null;let d=e.bottomOffsetsPx[n],s=e.heightsPx[n],u=o.bottomOffsetsPx[r],x=o.heightsPx[r];if(d===void 0||s===void 0||u===void 0||x===void 0)throw Error(`Codex turn geometry is missing: ${i}`);return Math.max(0,t+u+x-d-s)}function pt({layout:i,turnKey:t,viewportHeightPx:o}){let e=i.turnIndexByKey.get(t);if(e===void 0)return null;let n=i.bottomOffsetsPx[e],r=i.heightsPx[e];if(n===void 0||r===void 0)throw Error(`Codex turn geometry is missing: ${t}`);return Math.max(0,n-o/2+r/2)}function gt({align:i,layout:t,targetHeightPx:o,targetOffsetPx:e,turnKey:n,viewportHeightPx:r}){let d=t.turnIndexByKey.get(n);if(d===void 0)return null;let s=t.bottomOffsetsPx[d],u=t.heightsPx[d];if(s===void 0||u===void 0)throw Error(`Codex turn geometry is missing: ${n}`);let x=s+u-e;return i==="top"?Math.max(0,x-r+10):Math.max(0,x-o/2-r/2)}function g(i,t){let o=0,e=i.length;while(o<e){let n=Math.floor((o+e)/2),r=i[n];if(r===void 0)throw Error(`Codex bottom offset is missing at index ${n}`);if(r<t)e=n;else o=n+1}return o}function l(i,t,o){let e=0,n=i.length;while(e<n){let r=Math.floor((e+n)/2),d=i[r],s=t[r];if(d===void 0||s===void 0)throw Error(`Codex turn geometry is missing at index ${r}`);if(d+s<=o)n=r;else e=r+1}return e}
2
+ export{Gn,ut,N,ge,mt,pt,gt};
@@ -0,0 +1,2 @@
1
+ var a=(e)=>String(e).padStart(2,"0");function z(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{z};
@@ -0,0 +1,2 @@
1
+ import{terminalOf as u,textOf as g}from"@alwith/api";function St(n,o,r){if(n.kind!=="tool"){let t=g(n.content),c=/^\s*\*\*([^\n]*?)\*\*\s*$/.exec(t);return{type:"thinking",id:n.id,thinking:c?c[1]:t,isComplete:!r}}if(n.name==="subagent"){let t=s(n.rawInput,n.id);return{type:"subagent",id:n.id,name:p(t.agentPath,n.id),threadId:f(t.agentThreadId,"agentThreadId",n.id),activity:y(t.activity,n.id),model:l(t.model,"model",n.id),reasoningEffort:l(t.reasoningEffort,"reasoningEffort",n.id),status:n.status??"pending",blocks:[]}}if(n.name==="collab"){let t=s(s(s(n._meta,n.id).codex,n.id).collaboration,n.id);if(typeof t.tool!=="string"||!Array.isArray(t.agents))throw Error(`Collaboration call ${n.id} lacks codex-acp-v2 agent metadata`);return{type:"collab",id:n.id,tool:t.tool,status:n.status??"pending",prompt:l(s(n.rawInput,n.id).prompt,"prompt",n.id),agents:t.agents}}let i=typeof n.rawInput==="object"&&n.rawInput!==null&&!Array.isArray(n.rawInput)?{...n.rawInput}:{},e=u(n,o);if(Array.isArray(i.command))i.command=i.command.map(String).join(" ");if(n.toolKind==="execute"&&typeof i.command!=="string"){let t=e?.command??n.title;if(t!==null)i.command=t}let a=n.rawOutput;if(typeof a==="object"&&a!==null&&"output"in a&&typeof a.output==="string")a=a.output;if(e!==null&&e.output.length>0)a=e.output;let d=e?.exitStatus?.exitCode;return{type:"tool_use",id:n.id,name:n.name??"",title:n.title??n.name??"",kind:n.toolKind??"other",status:n.status??"pending",content:n.content,locations:n.locations,rawInput:i,rawOutput:a,...typeof d==="number"?{exitCode:d}:{}}}function s(n,o){if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`Tool call ${o} is missing an object codex-acp-v2 always sends`);return n}function l(n,o,r){if(n===null||typeof n==="string")return n;throw Error(`Tool call ${r} has a non-string ${o}`)}function p(n,o){let r=typeof n==="string"?n.split("/").findLast(Boolean):void 0;if(r===void 0)throw Error(`Subagent ${o} has no agent path`);return r}function f(n,o,r){if(typeof n==="string")return n;throw Error(`Tool call ${r} has no ${o}`)}function y(n,o){if(n==="started"||n==="interacted"||n==="interrupted"||n==="completed")return n;throw Error(`Subagent ${o} has an unknown activity ${String(n)}`)}
2
+ export{St};
@@ -1,2 +1,2 @@
1
- import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function O({name:p,value:P,levels:h,disabled:c,onChange:v}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===P)),[M,d]=k(null),l=y(null),[I,b]=k(null),x=y(0),s=M??I??g,w=(t)=>{let n=++x.current;b(t);let e=()=>{if(x.current===n)b(null)};try{Promise.resolve(v(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=76,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
2
- export{O};
1
+ import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function Y({name:p,value:P,levels:h,disabled:c,onChange:v}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===P)),[M,d]=k(null),l=y(null),[I,b]=k(null),x=y(0),s=M??I??g,w=(t)=>{let n=++x.current;b(t);let e=()=>{if(x.current===n)b(null)};try{Promise.resolve(v(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=76,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
2
+ export{Y};
@@ -1,2 +1,2 @@
1
- import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function we({src:o,alt:e,onClose:i}){return n(t("button",{type:"button",className:"fixed inset-0 z-[1000] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.7)"},onClick:i,children:t("img",{src:o,alt:e,style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4}})}),document.body)}
2
- export{we};
1
+ import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function Ct({src:o,alt:e,onClose:i}){return n(t("button",{type:"button",className:"fixed inset-0 z-[1000] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.7)"},onClick:i,children:t("img",{src:o,alt:e,style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4}})}),document.body)}
2
+ export{Ct};
@@ -0,0 +1,3 @@
1
+ import{fe,he}from"./chunk-bfe7xk9m.js";import{a}from"./chunk-5grywgpq.js";import{t}from"./chunk-vw2hv2sq.js";import{It}from"./chunk-k2y4cpra.js";import{Q}from"./chunk-h87xp1gv.js";import{vt}from"./chunk-3vt71emt.js";import{bt}from"./chunk-jeyvacx6.js";import{Et}from"./chunk-4tkxmh52.js";import{ye,we}from"./chunk-8k7wzkna.js";import{z}from"./chunk-p1pd1twf.js";import{Kt,h,U,Wt}from"./chunk-fvnb8ds4.js";import{isContentEntry as ge,isEmbeddedResource as ee,isImage as te,isResourceLink as pe,isText as ue}from"@alwith/api";import{codexMessageError as X,codexTurnError as Y,nativeTurnId as ke}from"@nyssance/codex-acp-v2/client";import{LoaderCircleIcon as xe,SparklesIcon as Te}from"lucide-react";import{memo as Ie}from"react";import{jsx as s,jsxs as l,Fragment as W}from"react/jsx-runtime";function Z(r){if(te(r))return`${r.mimeType.toLowerCase()}:${r.data}`;if(ee(r)&&"blob"in r.resource&&r.resource.mimeType?.toLowerCase().startsWith("image/"))return`${r.resource.mimeType.toLowerCase()}:${r.resource.blob}`;return null}function u({sessionId:r,entry:n,terminals:d,streaming:o,streamingThoughtId:w}){let{t:m}=t();switch(n.kind){case"activity":return s(It,{sessionId:r,items:n.items,terminals:d,streamingThoughtId:w});case"text":return s(Q,{content:n.item.content,messageId:n.item.id,streaming:o});case"plan":return s(Et,{plan:n.item.plan});case"compaction":if(n.item.status==="failed")return l(ye,{children:[s("div",{children:m("timeline.compactionFailed")}),n.item.error!==null&&s("div",{children:n.item.error})]});return l("div",{className:"codex-context-compaction",children:[s(Te,{"aria-hidden":"true"}),s("span",{children:n.item.status==="completed"?m("stream.codex.contextCompacted"):m("timeline.compacting")})]})}}function Ce({sessionId:r,turn:n,terminals:d,active:o,blocked:w=!1,continued:m=!1,edits:F=n.edits,activityItems:C=n.items,workStartedAt:ne=n.startedAt,isLast:O,error:f,interrupted:P,retry:G,retrying:p,answerActions:K,footer:se}){let{t:c}=t(),N=n.errors.map((e)=>{let i=X(e);if(i===null)throw Error("Turn error item is missing its diagnostics");let I=G?.turnId===ke(e)?G:void 0;return s(we,{error:i,retry:I},`${e.id}:${I?.delaySeconds??"manual"}`)});if(O&&f!==null&&!n.errors.some((e)=>{let i=X(e);return i!==null&&i.stopReason===f.stopReason&&Y(i).message===Y(f).message}))N.push(s(we,{error:f},"current-run-error"));let A=N.length>0?s("div",{className:"codex-turn-errors",children:N}):null,b=n.work.filter((e)=>e.kind==="compaction"&&e.item.status==="completed"),v=n.work.filter((e)=>!b.includes(e)),ie=b.length>0&&v.length===0&&n.final.length===0;if(Kt(n)||ie)return l(W,{children:[s("div",{role:"status",className:"text-muted-foreground flex min-w-0 flex-col gap-2 py-2 text-sm",children:n.work.map((e)=>s(u,{sessionId:r,entry:e,terminals:d,streaming:!1,streamingThoughtId:null},e.key))}),A]});let E=U(n),y=C.findLast((e)=>e.kind!=="user"),R=o&&y?.kind==="thought"?y.id:null,B=n.final.filter((e)=>a(e._meta).length===0).map(h).join(`
2
+ `),k=o?null:z(n,"assistant"),H=n.items.filter((e)=>e.kind==="tool"&&e.name==="image_generation"&&(e.status==="pending"||e.status==="in_progress")),V=new Set(n.final.flatMap((e)=>e.content.map(Z).filter((i)=>i!==null))),S=n.items.flatMap((e)=>{if(e.kind!=="tool"||e.status!=="completed")return[];return e.content.filter(ge).flatMap((i,I)=>{let g=i.content,de=e.name==="image_generation"&&te(g),ce=e.toolKind!=="read"&&e.toolKind!=="search"&&(pe(g)||ee(g)&&("blob"in g.resource));if(!de&&!ce)return[];let M=Z(g);if(M!==null){if(V.has(M))return[];V.add(M)}return[{key:`${e.id}:${I}`,block:g}]})}),x=n.final.some((e)=>a(e._meta).length===0&&e.content.some((i)=>!ue(i)||i.text.trim().length>0)),oe=H.length>0||S.length>0||x||n.final.some((e)=>a(e._meta).length>0),T=n.items.findIndex((e)=>n.final.includes(e)),_=(e)=>n.items.indexOf(e.kind==="activity"?e.items[0]:e.item),j=v.filter((e)=>T===-1||_(e)<T),J=v.filter((e)=>T!==-1&&_(e)>T),re=[...n.final.map((e)=>({kind:"answer",item:e,index:n.items.indexOf(e)})),...J.map((e)=>({kind:"work",entry:e,index:_(e)}))].toSorted((e,i)=>e.index-i.index),ae=o&&(!x||J.length>0),me=C.some((e)=>e.kind==="tool"&&(e.status==="pending"||e.status==="in_progress")),L=y?._meta?.codex,le=y?.kind==="assistant"&&!(typeof L==="object"&&L!==null&&("messageCompletedAt"in L)),q=ae&&!w&&!me&&!le&&R===null&&p===void 0,D=Wt({...n,items:C});return l(W,{children:[s(he,{stateKey:JSON.stringify([r,n.key]),active:o&&!x,defaultExpanded:P||E||o&&!x,...D,startedAt:D.startedAt??ne,loading:q&&n.work.length===0,work:m?[]:j.map((e)=>s(u,{sessionId:r,entry:e,terminals:d,streaming:o,streamingThoughtId:R},e.key)),answer:oe||m?l("div",{className:"flex min-w-0 flex-col gap-3",children:[m&&j.map((e)=>s(u,{sessionId:r,entry:e,terminals:d,streaming:!1,streamingThoughtId:null},e.key)),re.map((e)=>{if(e.kind==="work")return s(u,{sessionId:r,entry:e.entry,terminals:d,streaming:o,streamingThoughtId:R},e.entry.key);let i=e.item;return a(i._meta).length>0?s(vt,{sessionId:r,item:i},i.id):s(Q,{content:i.content,messageId:i.id,streaming:o},i.id)}),H.map((e)=>l("div",{className:"codex-image-generation",role:"status","aria-label":c(o?"timeline.imageGenerating":"timeline.imageStopped"),"aria-busy":o,children:[s("div",{className:"codex-image-generation-texture","aria-hidden":"true"}),l("span",{className:"codex-image-generation-status",children:[o&&s(xe,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),c(o?"timeline.imageGenerating":"timeline.imageStopped")]})]},e.id)),S.length>0&&s("div",{className:"codex-reply-artifacts flex min-w-0 flex-col gap-3",children:S.map((e)=>s(Q,{content:[e.block],messageId:e.key,streaming:!1},e.key))}),!o&&!m&&(B.trim().length>0?s(fe,{text:B,isMostRecentTurn:O,time:k,afterCopy:K}):l("div",{className:"flex items-center gap-0.5",children:[K,k&&s("span",{className:"codex-user-time ms-1",title:k.full,children:k.short})]}))]}):null,footer:l(W,{children:[q&&n.work.length>0&&s("div",{className:"codex-pending-message py-2",role:"status",children:s("span",{className:"codex-activity-running",children:c("message.thinking")})}),b.map((e)=>s(u,{sessionId:r,entry:e,terminals:d,streaming:!1,streamingThoughtId:null},e.key)),se,F.length>0&&!o&&!m&&s(bt,{items:F}),(P||E)&&s("div",{className:"codex-interrupted-turn",role:"status",children:c(E?"timeline.historyInterrupted":"timeline.interrupted")}),!o&&A]})}),o&&p!==void 0&&s("div",{className:"text-muted-foreground py-2 text-sm",role:"status",children:p.capacity?(()=>{let e=/Reconnecting(?:\.\.\.)?\s+(\d+\/\d+)/.exec(p.message)?.[1];return e===void 0?c("timeline.capacityReconnecting"):c("timeline.capacityReconnectingProgress",{progress:e})})():p.message}),o&&A]})}var ft=Ie(Ce);
3
+ export{ft};
@@ -0,0 +1 @@
1
+ import{o}from"./chunk-hx6wfscz.js";import{B}from"./chunk-h38yw8y3.js";import{cva as p}from"class-variance-authority";import{cn as l}from"cn";import{useMemo as u}from"react";import{jsx as t,jsxs as m}from"react/jsx-runtime";function ne({className:a,...e}){return t("fieldset",{"data-slot":"field-set",className:l("flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",a),...e})}function re({className:a,variant:e="legend",...d}){return t("legend",{"data-slot":"field-legend","data-variant":e,className:l("mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",a),...d})}function Fe({className:a,...e}){return t("div",{"data-slot":"field-group",className:l("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",a),...e})}var c=p("group/field data-[invalid=true]:text-destructive flex w-full gap-3",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function De({className:a,orientation:e="vertical",...d}){return t("div",{role:"group","data-slot":"field","data-orientation":e,className:l(c({orientation:e}),a),...d})}function Rn({className:a,...e}){return t("div",{"data-slot":"field-content",className:l("group/field-content flex flex-1 flex-col gap-1 leading-snug",a),...e})}function Be({className:a,...e}){return t(o,{"data-slot":"field-label",className:l("group/field-label peer/field-label has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10 flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 *:data-[slot=field]:p-3","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",a),...e})}function Ln({className:a,...e}){return t("div",{"data-slot":"field-label",className:l("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",a),...e})}function G({className:a,...e}){return t("p",{"data-slot":"field-description",className:l("text-muted-foreground text-left text-sm leading-normal font-normal group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",a),...e})}function An({children:a,className:e,...d}){return m("div",{"data-slot":"field-separator","data-content":!!a,className:l("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",e),...d,children:[t(B,{className:"absolute inset-0 top-1/2"}),a&&t("span",{className:"bg-background text-muted-foreground relative mx-auto block w-fit px-2","data-slot":"field-separator-content",children:a})]})}function _n({className:a,children:e,errors:d,...n}){let s=u(()=>{if(e)return e;if(!d?.length)return null;let i=[...new Map(d.map((r)=>[r?.message,r])).values()];if(i?.length==1)return i[0]?.message;return t("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((r,f)=>r?.message&&t("li",{children:r.message},f))})},[e,d]);if(!s)return null;return t("div",{role:"alert","data-slot":"field-error",className:l("text-destructive text-sm font-normal",a),...n,children:s})}export{ne,re,Fe,De,Rn,Be,Ln,G,An,_n};
@@ -0,0 +1,2 @@
1
+ import{createContext as d,useCallback as n,useContext as i,useEffect as tt,useMemo as D,useRef as I,useState as B}from"react";import{jsx as G}from"react/jsx-runtime";var C=d(null),Z=d(null);function Pn(){return i(Z)}var J=d(null);function Nn(){return i(J)}var S=d(null);function _e(){let r=i(C);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var E=()=>i(C);function Mn(){let r=i(S);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var et=()=>i(S);function Sn({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:F,attachmentPolicy:f,value:A,onValueChange:R,attachments:U,onAttachmentsChange:L,children:K}){let T=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),W=A!==void 0,[N,Q]=B(r),p=A??N,o=I({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let j=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,W)R?.(t);else Q(t)},[W,R]),g=n(()=>P(""),[P]),x=U!==void 0,[V,X]=B([]),v=U??V,h=I(v);h.current=v;let s=n((t)=>{let e=typeof t==="function"?t(h.current):t;if(x)L?.(e);else X(e)},[x,L]),w=I(null),O=I(()=>{}),M=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let z=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:T(u),filename:u.name,size:u.size,lastModified:u.lastModified,...z===void 0?{}:{sourcePath:z}}})]})},[f,T,s]),k=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),F?.()},[F,s]),H=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);tt(()=>{if(x)return;return()=>{for(let t of h.current)if(t.url)URL.revokeObjectURL(t.url)}},[x]);let _=n(()=>{O.current?.()},[]),b=D(()=>({files:v,add:M,remove:k,clear:H,openFileDialog:_,fileInputRef:w}),[v,M,k,H,_]),q=n((t,e)=>{w.current=t.current,O.current=e},[]),Y=D(()=>({textInput:{value:p,setInput:P,clear:g,getRevision:j,clearSubmitted:c??g},attachments:b,__registerFileInput:q}),[p,P,g,j,c,b,q]);return G(C.Provider,{value:Y,children:G(S.Provider,{value:b,children:K})})}var ee=d(null);function y(){let r=et(),l=i(ee),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
2
+ export{Z,Pn,J,Nn,S,_e,E,Mn,Sn,ee,y};
@@ -1,2 +1,2 @@
1
- import{et}from"./chunk-y2xbq7rb.js";function ze(t,o){if(et(o))return y(t);return t.map((e)=>({kind:"block",block:e}))}function i(t){return t.type==="thinking"||t.type==="tool_use"||t.type==="subagent"||t.type==="collab"}function c(t){return t.type==="tool_use"&&t.kind!=="think"}function y(t){let o=[],e=[],r=()=>{if(e.length===0)return;o.push({kind:"codexActivityGroup",blocks:e}),e=[]};for(let n of t){if(i(n)&&c(n)){e.push(n);continue}if(r(),i(n)){o.push({kind:"codexActivityGroup",blocks:[n]});continue}o.push({kind:"block",block:n})}return r(),o}
2
- export{ze};
1
+ import{Mt}from"./chunk-d8gwsw6j.js";function ht(t,o){if(Mt(o))return y(t);return t.map((e)=>({kind:"block",block:e}))}function i(t){return t.type==="thinking"||t.type==="tool_use"||t.type==="subagent"||t.type==="collab"}function c(t){return t.type==="tool_use"&&t.kind!=="think"}function y(t){let o=[],e=[],r=()=>{if(e.length===0)return;o.push({kind:"codexActivityGroup",blocks:e}),e=[]};for(let n of t){if(i(n)&&c(n)){e.push(n);continue}if(r(),i(n)){o.push({kind:"codexActivityGroup",blocks:[n]});continue}o.push({kind:"block",block:n})}return r(),o}
2
+ export{ht};
@@ -0,0 +1,2 @@
1
+ import{useCallback as r,useState as x}from"react";var t=new Map;function d(o,e,k=!1){let[p,S]=x(()=>({key:o,expanded:t.get(o)??e})),n=p.expanded;if(p.key!==o||k&&!t.has(o)&&n!==e)n=t.get(o)??e,S({key:o,expanded:n});let b=r((c)=>{S((s)=>{let f=s.key===o?s.expanded:t.get(o)??e,a=typeof c==="function"?c(f):c;return t.set(o,a),s.key===o?{key:o,expanded:a}:s})},[o,e]);return[n,b]}
2
+ export{d};