@alwith/module-chat 0.5.8 → 0.5.9

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 (178) hide show
  1. package/dist/approval/choice-elicitation-form.js +1 -1
  2. package/dist/approval/permission-options.js +1 -1
  3. package/dist/approval/permission-view.js +1 -1
  4. package/dist/approval/schema-elicitation-form.js +1 -1
  5. package/dist/approval/url-elicitation-card.js +1 -1
  6. package/dist/{chunk-qgkj3wee.js → chunk-0d4xsx23.js} +1 -1
  7. package/dist/{chunk-gd9s35b8.js → chunk-0gwe31zs.js} +2 -2
  8. package/dist/{chunk-vc5nsece.js → chunk-0k36bfyd.js} +2 -2
  9. package/dist/chunk-0kwfy29d.js +2 -0
  10. package/dist/{chunk-jg1ntm7n.js → chunk-0rp1nnaa.js} +1 -1
  11. package/dist/{chunk-ty6yjhwk.js → chunk-17zegmxa.js} +1 -1
  12. package/dist/{chunk-s9sf8hqk.js → chunk-20svvgj3.js} +2 -2
  13. package/dist/{chunk-bjg1zasm.js → chunk-35jevrn7.js} +1 -1
  14. package/dist/{chunk-sgy0gbar.js → chunk-3e0mfcj6.js} +2 -2
  15. package/dist/{chunk-6ceybn6m.js → chunk-3vrtepy0.js} +2 -2
  16. package/dist/{chunk-fcqkxfv3.js → chunk-443z7mve.js} +2 -2
  17. package/dist/{chunk-asyfbagd.js → chunk-4b3s7gyc.js} +2 -2
  18. package/dist/{chunk-rky16ygr.js → chunk-50qyant6.js} +2 -2
  19. package/dist/chunk-51sbmqdk.js +2 -0
  20. package/dist/{chunk-nfwmx8by.js → chunk-5fgakrmr.js} +2 -2
  21. package/dist/{chunk-nfeea6s7.js → chunk-5kpcpjrb.js} +2 -2
  22. package/dist/{chunk-jtaph5am.js → chunk-5m4605a3.js} +1 -1
  23. package/dist/{chunk-2qhzvpzz.js → chunk-64whvkk0.js} +1 -1
  24. package/dist/{chunk-b91ggk46.js → chunk-6d7ppje3.js} +2 -2
  25. package/dist/{chunk-cg97byvk.js → chunk-6kn920c5.js} +1 -1
  26. package/dist/{chunk-2407f23n.js → chunk-728v2as1.js} +1 -1
  27. package/dist/{chunk-zb8cdt79.js → chunk-7a6t282a.js} +1 -1
  28. package/dist/{chunk-zsxt5bbk.js → chunk-7d41r9qk.js} +1 -1
  29. package/dist/{chunk-8pktp9pc.js → chunk-7drq0g9b.js} +2 -2
  30. package/dist/{chunk-1dw0dx23.js → chunk-7dzq2t68.js} +1 -1
  31. package/dist/{chunk-sc57jf2x.js → chunk-7h8pv9eg.js} +1 -1
  32. package/dist/{chunk-q256c3hn.js → chunk-7jdazbzv.js} +2 -2
  33. package/dist/{chunk-989btr3w.js → chunk-7k0wvvy0.js} +1 -1
  34. package/dist/{chunk-4q3w2353.js → chunk-91x8etvh.js} +1 -1
  35. package/dist/{chunk-hzxyj69n.js → chunk-93x6b2qa.js} +2 -2
  36. package/dist/{chunk-temeekck.js → chunk-96xwaa2t.js} +2 -2
  37. package/dist/{chunk-0v0mgxb4.js → chunk-9a4kjze3.js} +2 -2
  38. package/dist/{chunk-qgm2pqvw.js → chunk-a3krtv66.js} +2 -2
  39. package/dist/{chunk-5d0a5ykg.js → chunk-b4dsjhkq.js} +2 -2
  40. package/dist/{chunk-qq9p31a7.js → chunk-cgqhz23q.js} +1 -1
  41. package/dist/{chunk-gjkrfb1m.js → chunk-cjztkcsm.js} +1 -1
  42. package/dist/{chunk-0mm2wh23.js → chunk-cke0v0a7.js} +1 -1
  43. package/dist/chunk-d84cxw1v.js +2 -0
  44. package/dist/{chunk-jsjgymb4.js → chunk-e55zxnda.js} +1 -1
  45. package/dist/{chunk-jhe1aqmm.js → chunk-f1zvbkak.js} +1 -1
  46. package/dist/{chunk-p2prcbq9.js → chunk-f4h7yb7d.js} +2 -2
  47. package/dist/{chunk-6r5s4bjp.js → chunk-f7z3a48k.js} +1 -1
  48. package/dist/{chunk-t0fs5s5v.js → chunk-g7p46jq1.js} +2 -2
  49. package/dist/{chunk-zk3j2f24.js → chunk-gj3j9zh5.js} +1 -1
  50. package/dist/{chunk-0bcmb1tj.js → chunk-ha5jfz6r.js} +1 -1
  51. package/dist/{chunk-e0n346aa.js → chunk-hkcsnwc0.js} +1 -1
  52. package/dist/{chunk-yvnad5k0.js → chunk-hrsz92yq.js} +1 -1
  53. package/dist/{chunk-n8yj6reh.js → chunk-j2wtwb37.js} +1 -1
  54. package/dist/{chunk-ssmhqn6a.js → chunk-j2wty8a3.js} +1 -1
  55. package/dist/{chunk-ve686fw1.js → chunk-jhk2chpp.js} +1 -1
  56. package/dist/{chunk-34e5ad6w.js → chunk-jydpra8w.js} +1 -1
  57. package/dist/{chunk-wdyyy8c1.js → chunk-k5c82xk9.js} +2 -2
  58. package/dist/{chunk-pth2ajxw.js → chunk-k6pjjtdb.js} +2 -2
  59. package/dist/{chunk-85xjmqq8.js → chunk-kahn24np.js} +1 -1
  60. package/dist/{chunk-f7kngj14.js → chunk-knsf6jm1.js} +2 -2
  61. package/dist/{chunk-18mgzmdc.js → chunk-krmz8t4p.js} +1 -1
  62. package/dist/{chunk-b9m454cd.js → chunk-m28hdj8j.js} +2 -2
  63. package/dist/{chunk-0pz9ryqh.js → chunk-m6rrt94g.js} +2 -2
  64. package/dist/{chunk-gc9g67j5.js → chunk-m99k3e5h.js} +2 -2
  65. package/dist/{chunk-9evhky1b.js → chunk-magaaqab.js} +1 -1
  66. package/dist/{chunk-bbwb4555.js → chunk-mgtkmbmd.js} +2 -2
  67. package/dist/{chunk-x4jqabfz.js → chunk-nkypxxjk.js} +1 -1
  68. package/dist/{chunk-szanfktp.js → chunk-p1ydsj54.js} +1 -1
  69. package/dist/{chunk-9r0g5jc9.js → chunk-p660tatw.js} +1 -1
  70. package/dist/{chunk-3arz4kfx.js → chunk-p8nx34zm.js} +1 -1
  71. package/dist/chunk-p8qgqtkc.js +2 -0
  72. package/dist/{chunk-mvv28374.js → chunk-q905xt4v.js} +1 -1
  73. package/dist/{chunk-5ar229ya.js → chunk-qah4fs3d.js} +1 -1
  74. package/dist/{chunk-xb1wvyky.js → chunk-qj63fv6w.js} +2 -2
  75. package/dist/{chunk-401q6mpb.js → chunk-qnk5jk1b.js} +1 -1
  76. package/dist/{chunk-9fbkfhsv.js → chunk-qrvy629d.js} +1 -1
  77. package/dist/chunk-qw0jp3wm.js +2 -0
  78. package/dist/{chunk-5hv3f2z9.js → chunk-r79zqx0t.js} +5 -5
  79. package/dist/{chunk-m8sp44qa.js → chunk-rnykpmn2.js} +1 -1
  80. package/dist/{chunk-tdwk5dct.js → chunk-sex6d2c2.js} +1 -1
  81. package/dist/{chunk-dwwpe6se.js → chunk-syn2y1k9.js} +1 -1
  82. package/dist/{chunk-7ncycdpp.js → chunk-vv1ghqq3.js} +1 -1
  83. package/dist/{chunk-5n1xv5w0.js → chunk-w43dvzqk.js} +3 -3
  84. package/dist/{chunk-qfk24bq6.js → chunk-wb3zpzk3.js} +1 -1
  85. package/dist/{chunk-tjbn0y8j.js → chunk-xh8wth6z.js} +2 -2
  86. package/dist/{chunk-4hj619eb.js → chunk-y3qgsj79.js} +1 -1
  87. package/dist/{chunk-ab3thrqy.js → chunk-ynw0f8h2.js} +1 -1
  88. package/dist/{chunk-s6k9sg4g.js → chunk-zh3qwgea.js} +1 -1
  89. package/dist/{chunk-cyatvpv4.js → chunk-zt8qaqbz.js} +1 -1
  90. package/dist/codex/activity-group.js +1 -1
  91. package/dist/codex/assistant-message.js +1 -1
  92. package/dist/codex/async-question-card.js +1 -1
  93. package/dist/codex/disclosure-state.js +1 -1
  94. package/dist/codex/edited-files-card.js +1 -1
  95. package/dist/codex/image-view-activity.js +1 -1
  96. package/dist/codex/navigation-audio.js +1 -1
  97. package/dist/codex/timeline-virtualizer.js +1 -1
  98. package/dist/codex/virtualized-turn-list.js +1 -1
  99. package/dist/composer/completion-filter.js +1 -1
  100. package/dist/composer/completion-menu.js +1 -1
  101. package/dist/composer/menu-radio.js +1 -1
  102. package/dist/composer/model-select.js +1 -1
  103. package/dist/composer/permission-mode-select.js +1 -1
  104. package/dist/composer/prompt-input-attachments.js +1 -1
  105. package/dist/composer/prompt-input-clipboard.js +1 -1
  106. package/dist/composer/prompt-input-context.js +1 -1
  107. package/dist/composer/prompt-input-textarea.js +1 -1
  108. package/dist/composer/prompt-input.js +1 -1
  109. package/dist/conversation/action-card.js +1 -1
  110. package/dist/conversation/composer/composer.js +1 -1
  111. package/dist/conversation/composer/context.js +1 -1
  112. package/dist/conversation/composer/drafts.js +1 -1
  113. package/dist/conversation/composer/long-text.js +1 -1
  114. package/dist/conversation/composer/mention-chips.js +1 -1
  115. package/dist/conversation/composer/model-menu.js +1 -1
  116. package/dist/conversation/composer/pasted-text-attachment.js +1 -1
  117. package/dist/conversation/composer/permission-mode-menu.js +1 -1
  118. package/dist/conversation/composer/slash-command-button.js +1 -1
  119. package/dist/conversation/composer/submit-button.js +1 -1
  120. package/dist/conversation/conversation-body.js +1 -1
  121. package/dist/conversation/conversation-view.js +1 -1
  122. package/dist/conversation/conversation.js +1 -1
  123. package/dist/conversation/diff-modal.js +1 -1
  124. package/dist/conversation/session-actions.js +1 -1
  125. package/dist/image-preview-dialog.js +1 -1
  126. package/dist/lib/group-blocks.js +1 -1
  127. package/dist/lib/limits.js +1 -1
  128. package/dist/lib/stream-style.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-list/archived-sessions.js +1 -1
  134. package/dist/session-list/host.js +1 -1
  135. package/dist/session-list/navigation.js +1 -1
  136. package/dist/session-list/row-stop-button.js +1 -1
  137. package/dist/session-list/session-groups.js +1 -1
  138. package/dist/session-list/session-info-card.js +1 -1
  139. package/dist/session-list/session-list.d.ts +1 -0
  140. package/dist/session-list/session-list.js +1 -1
  141. package/dist/session-list/session-row.js +1 -1
  142. package/dist/session-list/session-state-menu.js +1 -1
  143. package/dist/session-list/trailing-swap.js +1 -1
  144. package/dist/session-list/use-activity-preview.js +1 -1
  145. package/dist/session-list/use-project-sessions.js +1 -1
  146. package/dist/session-list/virtual-session-rows.js +1 -1
  147. package/dist/session-timeline/activity-group.js +1 -1
  148. package/dist/session-timeline/assistant-content.js +1 -1
  149. package/dist/session-timeline/assistant-turn.js +1 -1
  150. package/dist/session-timeline/async-questions.js +1 -1
  151. package/dist/session-timeline/edited-files-card.js +1 -1
  152. package/dist/session-timeline/navigation-rail.js +1 -1
  153. package/dist/session-timeline/plan.js +1 -1
  154. package/dist/session-timeline/resource-content.js +1 -1
  155. package/dist/session-timeline/session-timeline.js +1 -1
  156. package/dist/session-timeline/timeline-registry.js +1 -1
  157. package/dist/session-timeline/turn-activity.js +1 -1
  158. package/dist/session-timeline/turn-error.js +1 -1
  159. package/dist/session-timeline/turns.js +1 -1
  160. package/dist/session-timeline/user-message.js +1 -1
  161. package/dist/ui/alert.js +1 -1
  162. package/dist/ui/badge.js +1 -1
  163. package/dist/ui/button.js +1 -1
  164. package/dist/ui/card.js +1 -1
  165. package/dist/ui/dialog.js +1 -1
  166. package/dist/ui/dropdown-menu.js +1 -1
  167. package/dist/ui/empty.js +1 -1
  168. package/dist/ui/field.js +1 -1
  169. package/dist/ui/input-group.js +1 -1
  170. package/dist/ui/kbd.js +1 -1
  171. package/dist/ui/radio-group.js +1 -1
  172. package/dist/ui/select.js +1 -1
  173. package/dist/ui/tooltip.js +1 -1
  174. package/package.json +1 -1
  175. package/dist/chunk-8b8hc0b7.js +0 -2
  176. package/dist/chunk-bztgv33r.js +0 -2
  177. package/dist/chunk-ckft9abb.js +0 -2
  178. package/dist/chunk-ncwd36vj.js +0 -2
@@ -1 +1 @@
1
- import{qe}from"../chunk-x4jqabfz.js";import{e}from"../chunk-cg97byvk.js";import{ue}from"../chunk-1drkvxzk.js";import{l}from"../chunk-1hy64ewz.js";import{f}from"../chunk-ek06eyp4.js";import{j,S}from"../chunk-jtaph5am.js";import{k}from"../chunk-ncekagm6.js";import{mn,Ct,ae,We}from"../chunk-t6t6hgzx.js";import{autoUpdate as G}from"@floating-ui/dom";import{cn as H}from"cn";import{useCallback as R,useEffect as M,useLayoutEffect as O,useMemo as _,useRef as V,useState as F}from"react";import{createPortal as W}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function le({current:r,total:A,anchorRef:N,t:p,onAccept:I,onDecline:L}){let x=_(()=>r?mn(r.requestedSchema):[],[r]),[y,b]=F({}),C=V(null);M(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!ae(o)){let u=We(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),M(()=>{if(r?.elicitationId!==void 0&&C.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")C.current.focus()},[r?.elicitationId]);let[E,q]=F(null),[U,z]=F(null),T=R(()=>{let t=N.current;if(!t)return;let a=t.getBoundingClientRect();if(a.width===0){let o=Math.min(640,window.innerWidth*0.9);q({left:(window.innerWidth-o)/2,width:o,bottom:24});return}q({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);O(()=>{if(!r)return;let t=0,a=()=>{if(N.current){T();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,T,N]),O(()=>{let t=N.current;if(!r||!t||!U)return;return G(t,U,T,{animationFrame:!0})},[r,U,N,T]);let P=_(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=y[t];if(!o)return!1;if(ae(a)){if(!o.selectedSet||o.selectedSet.size===0)return!1;if(o.selectedSet.has(c)&&!o.otherText?.trim())return!1}else{if(!o.selected)return!1;if(o.selected===c&&!o.otherText?.trim())return!1}}return!0},[r,x,y]),D=R(async()=>{if(!r)return;if(!P)return;let t={},a={};for(let{key:o,property:u}of x){let d=y[o];if(!d)continue;let g;if(ae(u))t[o]=[...d.selectedSet??[]].map((v)=>v===c?(d.otherText??"").trim():v).filter(Boolean);else{let v=d.selected??"";if(t[o]=v===c?(d.otherText??"").trim():v,v!==c)g=We(u).find((s)=>s.value===v)?.preview}let h=d.notes?.trim();if(g||h)a[o]={...g&&{preview:g},...h&&{notes:h}}}await I(r.elicitationId,t,a)},[r,x,y,P,I]),B=R(async()=>{if(r)await L(r.elicitationId)},[r,L]);if(!r||!E)return null;return W(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),B()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:E.left,width:E.width,bottom:E.bottom,maxHeight:"70vh"},ref:(t)=>{C.current=t,z(t)},children:[m("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),A>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${A}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:a},o)=>{let u=y[t],d=u?.selected,g=u?.selectedSet??new Set,h=We(a),v=ae(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(qe,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:Ct(a).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:Ct(a).description})]}),v?m("div",{className:"space-y-1.5 ps-1",children:[h.map((s)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ue,{checked:g.has(s.value),onCheckedChange:(n)=>{b((w)=>{let Q=new Set(w[t]?.selectedSet??new Set);if(n)Q.add(s.value);else Q.delete(s.value);return{...w,[t]:{...w[t],selectedSet:Q}}})}}),m("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ue,{checked:g.has(c),onCheckedChange:(s)=>{b((n)=>{let w=new Set(n[t]?.selectedSet??new Set);if(s)w.add(c);else w.delete(c);return{...n,[t]:{...n[t],selectedSet:w}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}):m(j,{value:d??"",onValueChange:(s)=>b((n)=>({...n,[t]:{...n[t],selected:s}})),className:"space-y-1.5 ps-1",children:[h.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:H("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",d===s.value&&"bg-muted/60"),children:[i(S,{value:s.value,id:n}),m(f,{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),m("div",{className:H("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",d===c&&"bg-muted/60"),children:[i(S,{value:c,id:`${o}:other`,className:"mt-0.5"}),i(f,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!v&&d&&d!==c&&(()=>{let s=h.find((n)=>n.value===d)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),h.some((s)=>s.preview)&&i(k,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),m("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void B(),children:p("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!P,onClick:()=>void D(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{le as ChoiceElicitationForm};
1
+ import{qe}from"../chunk-nkypxxjk.js";import{e}from"../chunk-6kn920c5.js";import{ue}from"../chunk-1drkvxzk.js";import{l}from"../chunk-1hy64ewz.js";import{f}from"../chunk-ek06eyp4.js";import{j,I}from"../chunk-5m4605a3.js";import{k}from"../chunk-ncekagm6.js";import{mn,Ct,ae,We}from"../chunk-t6t6hgzx.js";import{autoUpdate as G}from"@floating-ui/dom";import{cn as H}from"cn";import{useCallback as Q,useEffect as M,useLayoutEffect as O,useMemo as _,useRef as V,useState as R}from"react";import{createPortal as W}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function le({current:r,total:F,anchorRef:N,t:p,onAccept:A,onDecline:L}){let x=_(()=>r?mn(r.requestedSchema):[],[r]),[S,b]=R({}),T=V(null);M(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!ae(o)){let u=We(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),M(()=>{if(r?.elicitationId!==void 0&&T.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")T.current.focus()},[r?.elicitationId]);let[y,q]=R(null),[C,z]=R(null),E=Q(()=>{let t=N.current;if(!t)return;let a=t.getBoundingClientRect();if(a.width===0){let o=Math.min(640,window.innerWidth*0.9);q({left:(window.innerWidth-o)/2,width:o,bottom:24});return}q({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);O(()=>{if(!r)return;let t=0,a=()=>{if(N.current){E();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,E,N]),O(()=>{let t=N.current;if(!r||!t||!C)return;return G(t,C,E,{animationFrame:!0})},[r,C,N,E]);let U=_(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=S[t];if(!o)return!1;if(ae(a)){if(!o.selectedSet||o.selectedSet.size===0)return!1;if(o.selectedSet.has(c)&&!o.otherText?.trim())return!1}else{if(!o.selected)return!1;if(o.selected===c&&!o.otherText?.trim())return!1}}return!0},[r,x,S]),D=Q(async()=>{if(!r)return;if(!U)return;let t={},a={};for(let{key:o,property:u}of x){let d=S[o];if(!d)continue;let g;if(ae(u))t[o]=[...d.selectedSet??[]].map((v)=>v===c?(d.otherText??"").trim():v).filter(Boolean);else{let v=d.selected??"";if(t[o]=v===c?(d.otherText??"").trim():v,v!==c)g=We(u).find((s)=>s.value===v)?.preview}let h=d.notes?.trim();if(g||h)a[o]={...g&&{preview:g},...h&&{notes:h}}}await A(r.elicitationId,t,a)},[r,x,S,U,A]),B=Q(async()=>{if(r)await L(r.elicitationId)},[r,L]);if(!r||!y)return null;return W(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),B()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:y.left,width:y.width,bottom:y.bottom,maxHeight:"70vh"},ref:(t)=>{T.current=t,z(t)},children:[m("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),F>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${F}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:a},o)=>{let u=S[t],d=u?.selected,g=u?.selectedSet??new Set,h=We(a),v=ae(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(qe,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:Ct(a).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:Ct(a).description})]}),v?m("div",{className:"space-y-1.5 ps-1",children:[h.map((s)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ue,{checked:g.has(s.value),onCheckedChange:(n)=>{b((w)=>{let P=new Set(w[t]?.selectedSet??new Set);if(n)P.add(s.value);else P.delete(s.value);return{...w,[t]:{...w[t],selectedSet:P}}})}}),m("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ue,{checked:g.has(c),onCheckedChange:(s)=>{b((n)=>{let w=new Set(n[t]?.selectedSet??new Set);if(s)w.add(c);else w.delete(c);return{...n,[t]:{...n[t],selectedSet:w}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}):m(j,{value:d??"",onValueChange:(s)=>b((n)=>({...n,[t]:{...n[t],selected:s}})),className:"space-y-1.5 ps-1",children:[h.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:H("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",d===s.value&&"bg-muted/60"),children:[i(I,{value:s.value,id:n}),m(f,{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),m("div",{className:H("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",d===c&&"bg-muted/60"),children:[i(I,{value:c,id:`${o}:other`,className:"mt-0.5"}),i(f,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!v&&d&&d!==c&&(()=>{let s=h.find((n)=>n.value===d)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),h.some((s)=>s.preview)&&i(k,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),m("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void B(),children:p("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!U,onClick:()=>void D(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{le as ChoiceElicitationForm};
@@ -1 +1 @@
1
- import{fr,kn,Xr,Yr}from"../chunk-bztgv33r.js";export{fr as PERMISSION_KIND_GROUP_ORDER,Xr as isAllowKind,Yr as isAlwaysKind,kn as sortPermissionOptions};
1
+ import{hr,kn,Yr,Zr}from"../chunk-p8qgqtkc.js";export{hr as PERMISSION_KIND_GROUP_ORDER,Yr as isAllowKind,Zr as isAlwaysKind,kn as sortPermissionOptions};
@@ -1 +1 @@
1
- import{yn}from"../chunk-qq9p31a7.js";import"../chunk-bztgv33r.js";export{yn as PermissionView};
1
+ import{yn}from"../chunk-cgqhz23q.js";import"../chunk-p8qgqtkc.js";export{yn as PermissionView};
@@ -1 +1 @@
1
- import{Sr,gr,Pr,bn}from"../chunk-fcqkxfv3.js";import"../chunk-1drkvxzk.js";import"../chunk-989btr3w.js";import"../chunk-1hy64ewz.js";import"../chunk-jtaph5am.js";import"../chunk-ek06eyp4.js";import"../chunk-ksv9pjc2.js";import"../chunk-ty6yjhwk.js";import"../chunk-ak0k5vg6.js";import"../chunk-ncekagm6.js";import"../chunk-cg97byvk.js";export{bn as SchemaElicitationForm,Sr as elicitationFields,gr as initialValues,Pr as isAnswered};
1
+ import{Pr,fr,Nr,bn}from"../chunk-443z7mve.js";import"../chunk-1drkvxzk.js";import"../chunk-7k0wvvy0.js";import"../chunk-1hy64ewz.js";import"../chunk-5m4605a3.js";import"../chunk-ek06eyp4.js";import"../chunk-ksv9pjc2.js";import"../chunk-17zegmxa.js";import"../chunk-ak0k5vg6.js";import"../chunk-ncekagm6.js";import"../chunk-6kn920c5.js";export{bn as SchemaElicitationForm,Pr as elicitationFields,fr as initialValues,Nr as isAnswered};
@@ -1 +1 @@
1
- import{wn}from"../chunk-18mgzmdc.js";import"../chunk-7ncycdpp.js";import"../chunk-cg97byvk.js";export{wn as UrlElicitationCard};
1
+ import{wn}from"../chunk-krmz8t4p.js";import"../chunk-vv1ghqq3.js";import"../chunk-6kn920c5.js";export{wn as UrlElicitationCard};
@@ -1,2 +1,2 @@
1
- import{Me}from"./chunk-0v0mgxb4.js";import{To}from"./chunk-k3375qqd.js";import{t}from"./chunk-dp8pjv6r.js";import{_}from"./chunk-t0fs5s5v.js";import{qt}from"./chunk-0pz9ryqh.js";import{isContentEntry as f,isEmbeddedResource as y,isResourceLink as g}from"@nyssance/codex-acp-v2/client";import{memo as k,useMemo as v}from"react";import{jsx as l,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(f).filter((o)=>y(o.content)||g(o.content));if(r.length===0)return null;return u("fieldset",{className:"mt-1 min-w-0",children:[l("legend",{className:"text-muted-foreground text-xs",children:n.title??n.name}),r.map((o,s)=>l(_,{block:o.content},`${n.id}:${s}`))]})}var io=k(function({sessionId:r,items:o,terminals:s,streamingThoughtId:d}){let p=t(),i=o.every(qt),c=p.toolBlock,a=v(()=>o.map((e)=>{let m={...To(e,s,e.kind==="thought"&&e.id===d),id:JSON.stringify([r,i?"history":"live",e.id])};return m.type==="tool_use"&&e.kind==="tool"&&c!==void 0?c(m,e):m}),[r,i,o,s,d,c]);return u(T,{children:[l(Me,{blocks:a,defaultExpanded:!i}),o.map((e)=>e.kind==="tool"&&l(R,{item:e},e.id))]})});
1
+ import{Me}from"./chunk-9a4kjze3.js";import{To}from"./chunk-k3375qqd.js";import{t}from"./chunk-dp8pjv6r.js";import{_}from"./chunk-g7p46jq1.js";import{qt}from"./chunk-m6rrt94g.js";import{isContentEntry as f,isEmbeddedResource as y,isResourceLink as g}from"@nyssance/codex-acp-v2/client";import{memo as k,useMemo as v}from"react";import{jsx as l,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(f).filter((o)=>y(o.content)||g(o.content));if(r.length===0)return null;return u("fieldset",{className:"mt-1 min-w-0",children:[l("legend",{className:"text-muted-foreground text-xs",children:n.title??n.name}),r.map((o,s)=>l(_,{block:o.content},`${n.id}:${s}`))]})}var io=k(function({sessionId:r,items:o,terminals:s,streamingThoughtId:d}){let p=t(),i=o.every(qt),c=p.toolBlock,a=v(()=>o.map((e)=>{let m={...To(e,s,e.kind==="thought"&&e.id===d),id:JSON.stringify([r,i?"history":"live",e.id])};return m.type==="tool_use"&&e.kind==="tool"&&c!==void 0?c(m,e):m}),[r,i,o,s,d,c]);return u(T,{children:[l(Me,{blocks:a,defaultExpanded:!i}),o.map((e)=>e.kind==="tool"&&l(R,{item:e},e.id))]})});
2
2
  export{io};
@@ -1,2 +1,2 @@
1
- var oi=280;function _n({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 me({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 Dt({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 Hn({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 On({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 Fn({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{oi,_n,me,Dt,Hn,On,Fn};
1
+ var ri=280;function _n({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 me({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 Dt({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 Hn({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 On({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 Fn({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{ri,_n,me,Dt,Hn,On,Fn};
@@ -1,2 +1,2 @@
1
- import{o}from"./chunk-dp8pjv6r.js";import{q,Et,V}from"./chunk-0mm2wh23.js";import{e}from"./chunk-cg97byvk.js";import{ge,fe,he,ve}from"./chunk-9evhky1b.js";import{ht,n,C}from"./chunk-ysc51tpb.js";import{lt}from"./chunk-e0n346aa.js";import{st}from"./chunk-2qhzvpzz.js";import{nt,ot}from"./chunk-zk3j2f24.js";import{rt}from"./chunk-4hj619eb.js";import{LockIcon as g,UnplugIcon as A}from"lucide-react";import{useMemo as R}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";function pr({host:t,client:l,...c}){let s=R(()=>t.openDiff?t:{...t,openDiff:nt},[t]);return i(ht,{host:s,client:l,children:[r(E,{...c}),!t.openDiff&&r(ot,{})]})}function E({session:t,header:l,overlay:c,timeline:s,composer:y,readOnlyActions:x,welcome:u,children:N,rootRef:w}){let{host:d,client:h}=n(),{t:a}=d,p=o((m)=>m.connection==="ready"),f=o((m)=>m.historyPages[t.id]?.error),v=()=>C(d,h.open(t.id,t.cwd)),D=t.items.length===0&&t.attached&&!t.restoring&&t.state==="idle";return i("div",{"data-chat-drop-zone":!0,ref:w,className:"flex h-full min-h-0 flex-col",children:[l,i("div",{className:"relative flex min-h-0 flex-1 flex-col","data-chat-content":!0,children:[c,p&&!t.attached&&!t.restoring&&!t.readOnly&&r("div",{className:"mx-auto my-3 w-full max-w-4xl px-4",children:i(q,{children:[r(A,{}),r(Et,{children:a("conversation.stopped")}),r(V,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),D?u??r(ge,{className:"flex-1",children:i(fe,{children:[r(he,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(ve,{children:a("conversation.welcomeDescription")})]})}):r(st,{session:t,timeline:s}),r(rt,{sessionId:t.id}),t.readOnly?r("div",{className:"mx-auto w-full max-w-3xl shrink-0 px-6 pb-5","data-readonly-composer":!0,children:i(q,{className:"flex items-center justify-between gap-4 rounded-3xl px-5 py-4",children:[i("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[r(g,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("div",{className:"min-w-0 space-y-1",children:[r(Et,{children:a("conversation.readOnlyTitle")}),r(V,{children:a("conversation.readOnlyDescription")}),f&&r("p",{role:"alert",className:"text-destructive break-words",children:f})]})]}),i("div",{className:"border-border flex shrink-0 items-center gap-1 border-s ps-3","data-readonly-actions":!0,children:[r(e,{size:"sm",variant:"outline",className:"text-foreground cursor-pointer disabled:cursor-not-allowed",onClick:v,disabled:!p||t.restoring,children:a(t.restoring?"conversation.restoring":"conversation.readOnlyRetry")}),x]})]})}):y??r(lt,{session:t})]}),N]})}
2
- export{pr};
1
+ import{o}from"./chunk-dp8pjv6r.js";import{q,Et,V}from"./chunk-cke0v0a7.js";import{e}from"./chunk-6kn920c5.js";import{ge,fe,he,ve}from"./chunk-magaaqab.js";import{ht,n,C}from"./chunk-ysc51tpb.js";import{lt}from"./chunk-hkcsnwc0.js";import{st}from"./chunk-64whvkk0.js";import{nt,ot}from"./chunk-gj3j9zh5.js";import{rt}from"./chunk-y3qgsj79.js";import{LockIcon as g,UnplugIcon as A}from"lucide-react";import{useMemo as R}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";function gr({host:t,client:l,...c}){let s=R(()=>t.openDiff?t:{...t,openDiff:nt},[t]);return i(ht,{host:s,client:l,children:[r(E,{...c}),!t.openDiff&&r(ot,{})]})}function E({session:t,header:l,overlay:c,timeline:s,composer:y,readOnlyActions:x,welcome:u,children:N,rootRef:w}){let{host:d,client:h}=n(),{t:a}=d,p=o((m)=>m.connection==="ready"),f=o((m)=>m.historyPages[t.id]?.error),v=()=>C(d,h.open(t.id,t.cwd)),D=t.items.length===0&&t.attached&&!t.restoring&&t.state==="idle";return i("div",{"data-chat-drop-zone":!0,ref:w,className:"flex h-full min-h-0 flex-col",children:[l,i("div",{className:"relative flex min-h-0 flex-1 flex-col","data-chat-content":!0,children:[c,p&&!t.attached&&!t.restoring&&!t.readOnly&&r("div",{className:"mx-auto my-3 w-full max-w-4xl px-4",children:i(q,{children:[r(A,{}),r(Et,{children:a("conversation.stopped")}),r(V,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),D?u??r(ge,{className:"flex-1",children:i(fe,{children:[r(he,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(ve,{children:a("conversation.welcomeDescription")})]})}):r(st,{session:t,timeline:s}),r(rt,{sessionId:t.id}),t.readOnly?r("div",{className:"mx-auto w-full max-w-3xl shrink-0 px-6 pb-5","data-readonly-composer":!0,children:i(q,{className:"flex items-center justify-between gap-4 rounded-3xl px-5 py-4",children:[i("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[r(g,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("div",{className:"min-w-0 space-y-1",children:[r(Et,{children:a("conversation.readOnlyTitle")}),r(V,{children:a("conversation.readOnlyDescription")}),f&&r("p",{role:"alert",className:"text-destructive break-words",children:f})]})]}),i("div",{className:"border-border flex shrink-0 items-center gap-1 border-s ps-3","data-readonly-actions":!0,children:[r(e,{size:"sm",variant:"outline",className:"text-foreground cursor-pointer disabled:cursor-not-allowed",onClick:v,disabled:!p||t.restoring,children:a(t.restoring?"conversation.restoring":"conversation.readOnlyRetry")}),x]})]})}):y??r(lt,{session:t})]}),N]})}
2
+ export{gr};
@@ -0,0 +1,2 @@
1
+ var wi=1e6,ki=5000000;function Jo(_,e){return _+e>5000000}function Ci(_){return(_/1e6).toFixed(1)}var oe=5;
2
+ export{wi,ki,Jo,Ci,oe};
@@ -1,2 +1,2 @@
1
- import{x}from"./chunk-pth2ajxw.js";import{e}from"./chunk-cg97byvk.js";import{n}from"./chunk-ysc51tpb.js";import{Fe}from"./chunk-b9m454cd.js";import{FileText as l,RotateCcw as d,X as u}from"lucide-react";import{jsx as t,jsxs as i}from"react/jsx-runtime";function Fo({data:s,sessionId:m}){let{host:a}=n(),{t:o}=a,p=x(),{text:c,status:r}=s.pastedText;return i("div",{className:"bg-muted flex max-w-64 min-w-0 items-center gap-1 rounded-lg px-2 py-1",children:[i(e,{type:"button",variant:"ghost",disabled:r!=="ready",onClick:()=>a.openLink(s.url),className:"h-auto min-w-0 flex-1 shrink gap-2 overflow-hidden px-0 py-1",children:[t(l,{className:"size-4 shrink-0"}),i("span",{className:"min-w-0 flex-1 text-start",children:[t("span",{className:"block truncate text-xs",children:s.filename}),t("span",{className:"text-muted-foreground block text-xs",children:r==="ready"?o("composer.pastedTextCharacters",{count:c.length}):o(r==="pending"?"composer.pastedTextPending":"composer.pastedTextError")})]})]}),r==="error"&&a.writeTextAttachment&&t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":o("composer.pastedTextRetry"),onClick:()=>Fe(m,s,a.writeTextAttachment),children:t(d,{className:"size-3"})}),t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":o("composer.pastedTextRemove"),onClick:()=>p.remove(s.id),children:t(u,{className:"size-3"})})]})}
1
+ import{x}from"./chunk-k6pjjtdb.js";import{e}from"./chunk-6kn920c5.js";import{n}from"./chunk-ysc51tpb.js";import{Fe}from"./chunk-m28hdj8j.js";import{FileText as l,RotateCcw as d,X as u}from"lucide-react";import{jsx as t,jsxs as i}from"react/jsx-runtime";function Fo({data:s,sessionId:m}){let{host:a}=n(),{t:o}=a,p=x(),{text:c,status:r}=s.pastedText;return i("div",{className:"bg-muted flex max-w-64 min-w-0 items-center gap-1 rounded-lg px-2 py-1",children:[i(e,{type:"button",variant:"ghost",disabled:r!=="ready",onClick:()=>a.openLink(s.url),className:"h-auto min-w-0 flex-1 shrink gap-2 overflow-hidden px-0 py-1",children:[t(l,{className:"size-4 shrink-0"}),i("span",{className:"min-w-0 flex-1 text-start",children:[t("span",{className:"block truncate text-xs",children:s.filename}),t("span",{className:"text-muted-foreground block text-xs",children:r==="ready"?o("composer.pastedTextCharacters",{count:c.length}):o(r==="pending"?"composer.pastedTextPending":"composer.pastedTextError")})]})]}),r==="error"&&a.writeTextAttachment&&t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":o("composer.pastedTextRetry"),onClick:()=>Fe(m,s,a.writeTextAttachment),children:t(d,{className:"size-3"})}),t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":o("composer.pastedTextRemove"),onClick:()=>p.remove(s.id),children:t(u,{className:"size-3"})})]})}
2
2
  export{Fo};
@@ -1 +1 @@
1
- import{e}from"./chunk-cg97byvk.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as g}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function d({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function Pi({...o}){return a(i.Trigger,{"data-slot":"dialog-trigger",...o})}function Ur({...o}){return a(i.Portal,{"data-slot":"dialog-portal",...o})}function rr({...o}){return a(i.Close,{"data-slot":"dialog-close",...o})}function $r({className:o,...t}){return a(i.Backdrop,{"data-slot":"dialog-overlay",className:r("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",o),...t})}function u({className:o,children:t,showCloseButton:n=!0,...s}){return l(Ur,{children:[a($r,{}),l(i.Popup,{"data-slot":"dialog-content",className:r("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md",o),...s,children:[t,n&&l(i.Close,{"data-slot":"dialog-close",render:a(e,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm"}),children:[a(g,{}),a("span",{className:"sr-only",children:"Close"})]})]})]})}function b({className:o,...t}){return a("div",{"data-slot":"dialog-header",className:r("flex flex-col gap-2",o),...t})}function X({className:o,showCloseButton:t=!1,children:n,...s}){return l("div",{"data-slot":"dialog-footer",className:r("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),...s,children:[n,t&&a(i.Close,{render:a(e,{variant:"outline"}),children:"Close"})]})}function m({className:o,...t}){return a(i.Title,{"data-slot":"dialog-title",className:r("font-heading leading-none font-medium",o),...t})}function w({className:o,...t}){return a(i.Description,{"data-slot":"dialog-description",className:r("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",o),...t})}export{d,Pi,Ur,rr,$r,u,b,X,m,w};
1
+ import{e}from"./chunk-6kn920c5.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as g}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function d({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function Ni({...o}){return a(i.Trigger,{"data-slot":"dialog-trigger",...o})}function $r({...o}){return a(i.Portal,{"data-slot":"dialog-portal",...o})}function rr({...o}){return a(i.Close,{"data-slot":"dialog-close",...o})}function qr({className:o,...t}){return a(i.Backdrop,{"data-slot":"dialog-overlay",className:r("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",o),...t})}function u({className:o,children:t,showCloseButton:n=!0,...s}){return l($r,{children:[a(qr,{}),l(i.Popup,{"data-slot":"dialog-content",className:r("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md",o),...s,children:[t,n&&l(i.Close,{"data-slot":"dialog-close",render:a(e,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm"}),children:[a(g,{}),a("span",{className:"sr-only",children:"Close"})]})]})]})}function b({className:o,...t}){return a("div",{"data-slot":"dialog-header",className:r("flex flex-col gap-2",o),...t})}function X({className:o,showCloseButton:t=!1,children:n,...s}){return l("div",{"data-slot":"dialog-footer",className:r("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),...s,children:[n,t&&a(i.Close,{render:a(e,{variant:"outline"}),children:"Close"})]})}function m({className:o,...t}){return a(i.Title,{"data-slot":"dialog-title",className:r("font-heading leading-none font-medium",o),...t})}function w({className:o,...t}){return a(i.Description,{"data-slot":"dialog-description",className:r("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",o),...t})}export{d,Ni,$r,rr,qr,u,b,X,m,w};
@@ -1,2 +1,2 @@
1
- var i=new Map,a=new Map,f=new Map;function ir(t,r){if(a.has(t))throw Error("An attachment writer is already registered for this session");return a.set(t,r),()=>{if(a.get(t)===r)a.delete(t)}}function E(t,r){let n=i.get(t);if(!n)return;let e=r(n.attachments);i.set(t,{...n,attachments:e}),a.get(t)?.(e)}function vt(t,r){f.set(t,r),r.finally(()=>{if(f.get(t)===r)f.delete(t)})}async function wr(t){for(;;){let e=i.get(t)?.attachments.flatMap((c)=>{let m=f.get(c.id);return m?[m]:[]})??[];if(!e.length)break;await Promise.all(e)}let r=i.get(t);if(!r)return null;let n=await Promise.all(r.attachments.map(async(e)=>{if(!e.url.startsWith("blob:"))return e;let c=await fetch(e.url);if(!c.ok)throw Error("Cannot read draft image");let m=await c.blob(),l=await new Promise((g,p)=>{let o=new FileReader;o.onload=()=>g(o.result),o.onerror=()=>p(o.error),o.readAsDataURL(m)});return{...e,url:l}}));return{text:r.text,mentions:[...r.mentions],attachments:n,modelId:r.modelId}}function kr(t,r){if(r===null)i.delete(t);else i.set(t,r)}var s=new Map;function xt(t,r){if(s.has(t))throw Error("A composer is already registered for this session");return s.set(t,r),()=>{if(s.get(t)===r)s.delete(t)}}function Cr(t,r){if(typeof r!=="string"||!r.trim())throw Error("The draft is empty");let n=s.get(t);if(!n)throw Error("The session's composer is not open; open the session first");let e=i.get(t);if(e&&(e.text.length||e.attachments.length||e.mentions.length))throw Error("The composer already has a draft; send or clear it first");n(r),i.set(t,{text:r,attachments:[],mentions:[],modelId:e?.modelId??null})}
2
- export{i,ir,E,vt,wr,kr,xt,Cr};
1
+ var i=new Map,a=new Map,f=new Map;function ir(t,r){if(a.has(t))throw Error("An attachment writer is already registered for this session");return a.set(t,r),()=>{if(a.get(t)===r)a.delete(t)}}function E(t,r){let n=i.get(t);if(!n)return;let e=r(n.attachments);i.set(t,{...n,attachments:e}),a.get(t)?.(e)}function vt(t,r){f.set(t,r),r.finally(()=>{if(f.get(t)===r)f.delete(t)})}async function kr(t){for(;;){let e=i.get(t)?.attachments.flatMap((c)=>{let m=f.get(c.id);return m?[m]:[]})??[];if(!e.length)break;await Promise.all(e)}let r=i.get(t);if(!r)return null;let n=await Promise.all(r.attachments.map(async(e)=>{if(!e.url.startsWith("blob:"))return e;let c=await fetch(e.url);if(!c.ok)throw Error("Cannot read draft image");let m=await c.blob(),l=await new Promise((g,p)=>{let o=new FileReader;o.onload=()=>g(o.result),o.onerror=()=>p(o.error),o.readAsDataURL(m)});return{...e,url:l}}));return{text:r.text,mentions:[...r.mentions],attachments:n,modelId:r.modelId}}function Cr(t,r){if(r===null)i.delete(t);else i.set(t,r)}var s=new Map;function xt(t,r){if(s.has(t))throw Error("A composer is already registered for this session");return s.set(t,r),()=>{if(s.get(t)===r)s.delete(t)}}function Tr(t,r){if(typeof r!=="string"||!r.trim())throw Error("The draft is empty");let n=s.get(t);if(!n)throw Error("The session's composer is not open; open the session first");let e=i.get(t);if(e&&(e.text.length||e.attachments.length||e.mentions.length))throw Error("The composer already has a draft; send or clear it first");n(r),i.set(t,{text:r,attachments:[],mentions:[],modelId:e?.modelId??null})}
2
+ export{i,ir,E,vt,kr,Cr,xt,Tr};
@@ -1,2 +1,2 @@
1
- import{ze}from"./chunk-pth2ajxw.js";import{K,Zo}from"./chunk-9r0g5jc9.js";import{t}from"./chunk-dp8pjv6r.js";import{Go}from"./chunk-zb8cdt79.js";import{ye,be,we}from"./chunk-qfk24bq6.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function Vo({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=ze(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(K,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(ye,{children:[o(be,{render:o(Zo,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(we,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(Go,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
1
+ import{ze}from"./chunk-k6pjjtdb.js";import{K,Zo}from"./chunk-p660tatw.js";import{t}from"./chunk-dp8pjv6r.js";import{Go}from"./chunk-7a6t282a.js";import{ye,be,we}from"./chunk-wb3zpzk3.js";import{cn as d}from"cn";import{SquareIcon as b}from"lucide-react";import{jsx as o,jsxs as n,Fragment as h}from"react/jsx-runtime";var f=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform);function Vo({active:a,sending:r,ready:p,hasMentions:m=!1,onStop:c}){let{t:e}=t(),s=ze(),u=m||s.textInput.value.trim().length>0||s.attachments.files.length>0,l=!p||r||!u,i=a?e("composer.steer"):e("composer.send");return n(h,{children:[a&&o(K,{"aria-label":e("composer.stop"),title:e("composer.stop"),className:"border-border size-7 rounded-full border",onClick:c,children:o(b,{className:"size-3 fill-current"})}),o("div",{className:d(l&&"cursor-not-allowed"),children:n(ye,{children:[o(be,{render:o(Zo,{"aria-label":i,disabled:l,"aria-busy":r,status:r?"submitted":"ready"})}),n(we,{role:"tooltip",children:[o("span",{className:"min-w-0",children:i}),o(Go,{className:"shrink-0",children:f?"↩":"Enter"})]})]})})]})}
2
2
  export{Vo};
@@ -1,2 +1,2 @@
1
- import{createContext as t,useContext as o}from"react";var en=t(null);function br(){let e=o(en);if(e===null)throw Error("Composer is missing");return e}
2
- export{en,br};
1
+ import{createContext as t,useContext as o}from"react";var en=t(null);function wr(){let e=o(en);if(e===null)throw Error("Composer is missing");return e}
2
+ export{en,wr};
@@ -1,3 +1,3 @@
1
- import{q,V}from"./chunk-0mm2wh23.js";import{e}from"./chunk-cg97byvk.js";import{d,u,b,X,m,w}from"./chunk-ty6yjhwk.js";import{l}from"./chunk-1hy64ewz.js";import{Nt,Mt,Rt,hn,Z}from"./chunk-yvnad5k0.js";import{ce}from"./chunk-xxkdv1zf.js";import{p,s,r}from"./chunk-nfwmx8by.js";import{le,U,L}from"./chunk-8b8hc0b7.js";import{sessionGroup as _}from"@nyssance/codex-acp-v2/client";import{cn as fe}from"cn";import{ArchiveIcon as ve,FolderIcon as Y,ListFilterIcon as ge,SearchIcon as xe,Trash2Icon as ee}from"lucide-react";import{useEffect as Se,useRef as ye,useState as f}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";function te({className:v,...n}){return i(hn,{align:"start",alignItemWithTrigger:!1,sideOffset:6,...n,className:fe("max-w-(--available-width) min-w-0 p-1",v)})}function z(v){return v instanceof Error?v.message:String(v)}function Le({children:v}){return i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"flex flex-col gap-8",children:v})})}function dr({Scroll:v=Le}){let{t:n,i18n:B}=p(),g=s(),C=r((t)=>t.archivedSessions),A=r((t)=>t.connection),[H,se]=f(""),[k,ie]=f("all"),[x,re]=f("all"),[ne,ae]=f(0),[O,G]=f(!0),[F,K]=f(null),[Q,R]=f(null),[I,j]=f(!1),S=ye(!1),[P,y]=f(null),[W,T]=f(null),[oe,J]=f(!1);Se(()=>{if(A!=="ready")return;let t=!1;G(!0),K(null);async function h(){try{await g.listArchived({reset:!0});let o=new Set;while(!t&&g.state.archivedCursor!==null){let N=g.state.archivedCursor;if(o.has(N))throw Error("Archive pagination returned a repeated cursor");o.add(N),await g.listArchived()}}catch(o){if(!t)K(z(o))}finally{if(!t)G(!1)}}return h(),()=>{t=!0}},[g,A,ne]);let c=r((t)=>t.projectContext),E=!(c!==null&&A==="ready"&&!O&&F===null)||I,D=(t)=>t.title??n("sessionList.untitled"),de=[...new Set(C.filter((t)=>c&&_(c,t).id!==L).map((t)=>c?_(c,t).id:t.cwd))].toSorted(),ue=H.trim().toLocaleLowerCase(B.language),M=C.filter((t)=>{let h=c?_(c,t).id:null,o=h===L;return D(t).toLocaleLowerCase(B.language).includes(ue)&&(k==="all"||(k==="quick"?o:!o))&&(x==="all"||(x==="quick"?o:h===x))}),me=new Intl.DateTimeFormat(B.language,{dateStyle:"medium",timeStyle:"short"});async function pe(t){if(S.current)return;S.current=!0,j(!0),R(null);try{await g.unarchive(t.sessionId)}catch(h){R(z(h))}finally{S.current=!1,j(!1)}}async function he(){if(S.current||!P)return;S.current=!0,j(!0),T(null);let t=[],h=[];try{for(let o of P){if(!g.state.archivedSessions.some((N)=>N.sessionId===o.sessionId))continue;try{await g.delete(o.sessionId)}catch(N){t.push(o),h.push(`${D(o)}: ${z(N)}`)}}if(t.length)y(t),T(h.join(`
1
+ import{q,V}from"./chunk-cke0v0a7.js";import{e}from"./chunk-6kn920c5.js";import{d,u,b,X,m,w}from"./chunk-17zegmxa.js";import{l}from"./chunk-1hy64ewz.js";import{Nt,Mt,Rt,hn,Z}from"./chunk-hrsz92yq.js";import{ce}from"./chunk-xxkdv1zf.js";import{p,s,r}from"./chunk-5fgakrmr.js";import{le,U,L}from"./chunk-d84cxw1v.js";import{sessionGroup as _}from"@nyssance/codex-acp-v2/client";import{cn as fe}from"cn";import{ArchiveIcon as ve,FolderIcon as Y,ListFilterIcon as ge,SearchIcon as xe,Trash2Icon as ee}from"lucide-react";import{useEffect as Se,useRef as ye,useState as f}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";function te({className:v,...n}){return i(hn,{align:"start",alignItemWithTrigger:!1,sideOffset:6,...n,className:fe("max-w-(--available-width) min-w-0 p-1",v)})}function z(v){return v instanceof Error?v.message:String(v)}function Le({children:v}){return i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"flex flex-col gap-8",children:v})})}function ur({Scroll:v=Le}){let{t:n,i18n:B}=p(),g=s(),C=r((t)=>t.archivedSessions),A=r((t)=>t.connection),[H,se]=f(""),[k,ie]=f("all"),[x,re]=f("all"),[ne,ae]=f(0),[O,G]=f(!0),[F,K]=f(null),[Q,R]=f(null),[I,j]=f(!1),S=ye(!1),[P,y]=f(null),[W,T]=f(null),[oe,J]=f(!1);Se(()=>{if(A!=="ready")return;let t=!1;G(!0),K(null);async function h(){try{await g.listArchived({reset:!0});let o=new Set;while(!t&&g.state.archivedCursor!==null){let N=g.state.archivedCursor;if(o.has(N))throw Error("Archive pagination returned a repeated cursor");o.add(N),await g.listArchived()}}catch(o){if(!t)K(z(o))}finally{if(!t)G(!1)}}return h(),()=>{t=!0}},[g,A,ne]);let c=r((t)=>t.projectContext),E=!(c!==null&&A==="ready"&&!O&&F===null)||I,D=(t)=>t.title??n("sessionList.untitled"),de=[...new Set(C.filter((t)=>c&&_(c,t).id!==L).map((t)=>c?_(c,t).id:t.cwd))].toSorted(),ue=H.trim().toLocaleLowerCase(B.language),M=C.filter((t)=>{let h=c?_(c,t).id:null,o=h===L;return D(t).toLocaleLowerCase(B.language).includes(ue)&&(k==="all"||(k==="quick"?o:!o))&&(x==="all"||(x==="quick"?o:h===x))}),me=new Intl.DateTimeFormat(B.language,{dateStyle:"medium",timeStyle:"short"});async function pe(t){if(S.current)return;S.current=!0,j(!0),R(null);try{await g.unarchive(t.sessionId)}catch(h){R(z(h))}finally{S.current=!1,j(!1)}}async function he(){if(S.current||!P)return;S.current=!0,j(!0),T(null);let t=[],h=[];try{for(let o of P){if(!g.state.archivedSessions.some((N)=>N.sessionId===o.sessionId))continue;try{await g.delete(o.sessionId)}catch(N){t.push(o),h.push(`${D(o)}: ${z(N)}`)}}if(t.length)y(t),T(h.join(`
2
2
  `));else y(null)}finally{S.current=!1,j(!1)}}return a("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden","aria-label":n("sessionList.archives.title"),children:[a("div",{className:"mx-auto flex min-h-0 w-full max-w-5xl flex-1 flex-col gap-8 px-6 pt-8 pb-10 lg:pb-14",children:[a("header",{className:"flex min-h-9 shrink-0 flex-wrap items-center justify-between gap-3",children:[i("h1",{className:"text-2xl leading-9 font-semibold tracking-tight",children:n("sessionList.archives.title")}),a(e,{variant:"destructive",className:"text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))]",disabled:E||C.length===0,onClick:()=>{T(null),J(!0),y([...C])},children:[i(ee,{"aria-hidden":"true"}),n("sessionList.archives.deleteAll")]})]}),a("div",{className:"flex shrink-0 flex-wrap gap-3",children:[a("div",{className:"relative min-w-48 flex-1",children:[i(xe,{"aria-hidden":"true",className:"text-muted-foreground pointer-events-none absolute start-3 top-2.5 size-4"}),i(l,{"aria-label":n("sessionList.archives.search"),placeholder:n("sessionList.archives.search"),value:H,onChange:(t)=>se(t.target.value),className:"rounded-md ps-9"})]}),a(Nt,{value:k,onValueChange:(t)=>{if(t===null)throw Error("Archive chat type cannot be empty");ie(t)},children:[a(Rt,{"aria-label":n("sessionList.archives.chatType"),className:"w-40 rounded-md",children:[i(ge,{"aria-hidden":"true"}),i(Mt,{children:n(`sessionList.archives.${k==="all"?"allChats":k==="quick"?"quickChats":"projectChats"}`)})]}),a(te,{children:[i(Z,{value:"all",children:n("sessionList.archives.allChats")}),i(Z,{value:"quick",children:n("sessionList.archives.quickChats")}),i(Z,{value:"project",children:n("sessionList.archives.projectChats")})]})]}),a(Nt,{value:x,onValueChange:(t)=>{if(t===null)throw Error("Archive project filter cannot be empty");re(t)},children:[a(Rt,{"aria-label":n("sessionList.archives.project"),className:"w-48 rounded-md",children:[i(Y,{"aria-hidden":"true"}),i(Mt,{className:"truncate",children:x==="all"?n("sessionList.archives.allProjects"):x==="quick"?n("sessionList.archives.noProject"):U(x,c??void 0)})]}),a(te,{children:[i(Z,{value:"all",children:n("sessionList.archives.allProjects")}),i(Z,{value:"quick",children:n("sessionList.archives.noProject")}),de.map((t)=>i(Z,{value:t,title:t,children:U(t,c??void 0)},t))]})]})]}),a(v,{children:[A!=="ready"?i("p",{role:"status",className:"text-muted-foreground",children:n("sessionList.archives.connecting")}):O?a("div",{role:"status",className:"text-muted-foreground flex items-center gap-2",children:[i(ce,{}),n("sessionList.archives.loading")]}):F?i(q,{variant:"destructive",children:a(V,{className:"flex items-center justify-between gap-4",children:[i("span",{children:F}),i(e,{variant:"outline",onClick:()=>ae((t)=>t+1),children:n("sessionList.archives.retry")})]})}):C.length===0?a("div",{className:"text-muted-foreground flex flex-col items-center gap-3 py-16",children:[i(ve,{"aria-hidden":"true",className:"size-8"}),i("p",{children:n("sessionList.archives.empty")})]}):M.length===0?i("p",{className:"text-muted-foreground py-12 text-center",children:n("sessionList.archives.noResults")}):(c?le(M,c):[]).filter(([,t])=>t.length>0).map(([t,h])=>a("section",{className:"flex flex-col gap-3",children:[a("div",{className:"flex items-center justify-between gap-3",children:[a("h2",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",title:t===L?void 0:t,children:[i(Y,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("span",{className:"truncate",children:t===L?n("sessionList.archives.noProject"):U(t,c??void 0)})]}),i("span",{className:"text-muted-foreground shrink-0 text-sm",children:n("sessionList.archives.count",{count:h.length})})]}),i("div",{className:"divide-border divide-y overflow-hidden rounded-lg border",children:h.map((o)=>a("article",{"aria-label":D(o),className:"flex flex-wrap items-center gap-4 px-4 py-3",children:[a("div",{className:"min-w-0 flex-1 basis-40",children:[i("h3",{className:"truncate text-sm font-medium",title:D(o),children:D(o)}),o.updatedAt!==null&&i("time",{dateTime:o.updatedAt,title:n("sessionList.archives.updatedAt"),className:"text-muted-foreground text-xs",children:me.format(new Date(o.updatedAt))})]}),a("div",{className:"flex shrink-0 items-center gap-2",children:[i(e,{variant:"ghost",size:"icon-sm","aria-label":n("sessionList.delete"),title:n("sessionList.delete"),disabled:E,className:"text-muted-foreground hover:text-destructive",onClick:()=>{T(null),J(!1),y([o])},children:i(ee,{"aria-hidden":"true"})}),i(e,{variant:"secondary",size:"sm",disabled:E,onClick:()=>void pe(o),children:n("sessionList.archives.unarchive")})]})]},o.sessionId))})]},t)),Q&&i(q,{variant:"destructive",children:i(V,{children:Q})})]})]}),i(d,{open:P!==null,onOpenChange:(t)=>{if(!t&&!S.current)y(null)},children:a(u,{showCloseButton:!I,children:[a(b,{children:[i(m,{children:n("sessionList.archives.deleteTitle")}),i(w,{children:n(oe?"sessionList.archives.deleteAllDescription":"sessionList.archives.deleteDescription",{count:P?.length??0})})]}),W&&i(q,{variant:"destructive",children:i(V,{className:"max-h-40 overflow-auto whitespace-pre-wrap",children:W})}),a(X,{children:[i(e,{variant:"outline",disabled:I,onClick:()=>y(null),children:n("sessionList.cancel")}),a(e,{variant:"destructive",className:"text-[color-mix(in_oklab,var(--destructive)_80%,var(--foreground))]",disabled:E,onClick:()=>void he(),children:[I&&i(ce,{}),n("sessionList.archives.confirmDelete")]})]})]})})]})}
3
- export{dr};
3
+ export{ur};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-cg97byvk.js";import{ue}from"./chunk-1drkvxzk.js";import{d,u,b,X,m,w}from"./chunk-ty6yjhwk.js";import{f}from"./chunk-ek06eyp4.js";import{At,Lt,Mn,Rn,En,at}from"./chunk-989btr3w.js";import{l}from"./chunk-1hy64ewz.js";import{j,S}from"./chunk-jtaph5am.js";import{$e}from"./chunk-ak0k5vg6.js";import{k}from"./chunk-ncekagm6.js";import{isArrayProperty as A,isBooleanProperty as C,isNumberProperty as E,isStringProperty as N}from"@nyssance/codex-acp-v2/client";import{useEffect as V,useMemo as R,useState as q}from"react";import{jsx as o,jsxs as p}from"react/jsx-runtime";function P(r){if(!N(r))return null;if(r.oneOf&&r.oneOf.length>0)return r.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(r.enum&&r.enum.length>0)return r.enum.map((t)=>({value:t,label:t}));return null}function L(r){let t=r,n=t._meta?.alwith?.options;if(Array.isArray(n)&&Array.isArray(t.enum))return n.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));if(Array.isArray(t.enum))return t.enum.map((i)=>({value:String(i),label:String(i)}));if(Array.isArray(t.oneOf))return t.oneOf.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));return null}function Sr(r){let t=new Set(r.required??[]);return Object.entries(r.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:P(i),multiOptions:A(i)?L(i.items):null}))}function gr(r){let t={};for(let n of r){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(C(n.property))t[n.key]=!1;else if(A(n.property))t[n.key]=[]}return t}function Pr(r,t){if(r.multiOptions)return Array.isArray(t)&&t.length>0;if(!r.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function D({id:r,label:t,description:n,control:i}){return p("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,p(f,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[o("div",{className:"text-foreground text-sm",children:t}),n&&o("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function G({id:r,field:t,value:n,onChange:i}){if(t.multiOptions){let a=new Set(Array.isArray(n)?n:[]);return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(at,{children:t.description}),o("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((c)=>{let g=`${r}:${c.value}`;return o(D,{id:g,...c,control:o(ue,{id:g,checked:a.has(c.value),onCheckedChange:(F)=>{let y=new Set(a);if(F)y.add(c.value);else y.delete(c.value);i([...y])}})},c.value)})})]})}if(t.options)return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(at,{children:t.description}),o(j,{value:typeof n==="string"?n:"",onValueChange:(a)=>i(String(a)),className:"flex flex-col gap-1",children:t.options.map((a)=>{let c=`${r}:${a.value}`;return o(D,{id:c,...a,control:o(S,{value:a.value,id:c})},a.value)})})]});return p(Rn,{children:[o(En,{htmlFor:r,children:t.title}),C(t.property)?o($e,{id:r,checked:n===!0,onCheckedChange:(a)=>i(a)}):E(t.property)?o(l,{id:r,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(a)=>i(a.target.value===""?void 0:Number(a.target.value))}):o(k,{id:r,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(a)=>i(a.target.value)}),t.description&&o(at,{children:t.description})]})}function bn({requestId:r,schema:t,message:n,total:i,t:a,onRespond:c}){let g=R(()=>Sr(t),[t]),[F,y]=q(()=>gr(g));V(()=>y(gr(g)),[r,g]);let x=g.every((s)=>Pr(s,F[s.key])),O=()=>{if(!x)return;let s={};for(let[h,v]of Object.entries(F))if(v!==void 0)s[h]=v;c({action:"accept",content:s})};return o(d,{open:!0,onOpenChange:(s)=>!s&&c({action:"cancel"}),children:p(u,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(s)=>{if(s.key==="Enter"&&(s.metaKey||s.ctrlKey))s.preventDefault(),O()},children:[p(b,{children:[p("div",{className:"flex items-center justify-between gap-2 pe-8",children:[o(m,{children:t.title??a("approval.needed")}),i>1&&o("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),o(w,{children:n})]}),o("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o(Mn,{children:g.map((s)=>o(G,{id:`${r}:${s.key}`,field:s,value:F[s.key],onChange:(h)=>y((v)=>({...v,[s.key]:h}))},s.key))})}),p(X,{children:[o(e,{variant:"ghost",onClick:()=>c({action:"decline"}),children:a("actions.decline")}),o(e,{disabled:!x,onClick:O,children:a("actions.submit")})]})]})})}
2
- export{Sr,gr,Pr,bn};
1
+ import{e}from"./chunk-6kn920c5.js";import{ue}from"./chunk-1drkvxzk.js";import{d,u,b,X,m,w}from"./chunk-17zegmxa.js";import{f}from"./chunk-ek06eyp4.js";import{At,Lt,Mn,Rn,En,at}from"./chunk-7k0wvvy0.js";import{l}from"./chunk-1hy64ewz.js";import{j,I}from"./chunk-5m4605a3.js";import{$e}from"./chunk-ak0k5vg6.js";import{k}from"./chunk-ncekagm6.js";import{isArrayProperty as S,isBooleanProperty as A,isNumberProperty as C,isStringProperty as E}from"@nyssance/codex-acp-v2/client";import{useEffect as N,useMemo as V,useState as R}from"react";import{jsx as o,jsxs as p}from"react/jsx-runtime";function q(r){if(!E(r))return null;if(r.oneOf&&r.oneOf.length>0)return r.oneOf.map((t)=>({value:t.const,label:t.title??t.const,...t.description?{description:t.description}:{}}));if(r.enum&&r.enum.length>0)return r.enum.map((t)=>({value:t,label:t}));return null}function P(r){let t=r,n=t._meta?.alwith?.options;if(Array.isArray(n)&&Array.isArray(t.enum))return n.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));if(Array.isArray(t.enum))return t.enum.map((i)=>({value:String(i),label:String(i)}));if(Array.isArray(t.oneOf))return t.oneOf.map((i)=>({value:i.const,label:i.title,...i.description?{description:i.description}:{}}));return null}function Pr(r){let t=new Set(r.required??[]);return Object.entries(r.properties??{}).map(([n,i])=>({key:n,property:i,title:i.title??n,description:i.description??null,required:t.has(n),options:q(i),multiOptions:S(i)?P(i.items):null}))}function fr(r){let t={};for(let n of r){let i=n.property.default;if(i!==void 0&&i!==null)t[n.key]=i;else if(n.options)t[n.key]=n.options[0].value;else if(A(n.property))t[n.key]=!1;else if(S(n.property))t[n.key]=[]}return t}function Nr(r,t){if(r.multiOptions)return Array.isArray(t)&&t.length>0;if(!r.required)return!0;return t!==void 0&&t!==""&&!(Array.isArray(t)&&t.length===0)}function D({id:r,label:t,description:n,control:i}){return p("div",{className:"hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",children:[i,p(f,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer font-normal",children:[o("div",{className:"text-foreground text-sm",children:t}),n&&o("div",{className:"text-muted-foreground text-xs",children:n})]})]})}function L({id:r,field:t,value:n,onChange:i}){if(t.multiOptions){let a=new Set(Array.isArray(n)?n:[]);return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(at,{children:t.description}),o("div",{className:"flex flex-col gap-1",children:t.multiOptions.map((c)=>{let g=`${r}:${c.value}`;return o(D,{id:g,...c,control:o(ue,{id:g,checked:a.has(c.value),onCheckedChange:(F)=>{let y=new Set(a);if(F)y.add(c.value);else y.delete(c.value);i([...y])}})},c.value)})})]})}if(t.options)return p(At,{children:[o(Lt,{variant:"label",children:t.title}),t.description&&o(at,{children:t.description}),o(j,{value:typeof n==="string"?n:"",onValueChange:(a)=>i(String(a)),className:"flex flex-col gap-1",children:t.options.map((a)=>{let c=`${r}:${a.value}`;return o(D,{id:c,...a,control:o(I,{value:a.value,id:c})},a.value)})})]});return p(Rn,{children:[o(En,{htmlFor:r,children:t.title}),A(t.property)?o($e,{id:r,checked:n===!0,onCheckedChange:(a)=>i(a)}):C(t.property)?o(l,{id:r,type:"number",required:t.required,value:typeof n==="number"?n:"",onChange:(a)=>i(a.target.value===""?void 0:Number(a.target.value))}):o(k,{id:r,rows:2,required:t.required,value:typeof n==="string"?n:"",onChange:(a)=>i(a.target.value)}),t.description&&o(at,{children:t.description})]})}function bn({requestId:r,schema:t,message:n,total:i,t:a,onRespond:c}){let g=V(()=>Pr(t),[t]),[F,y]=R(()=>fr(g));N(()=>y(fr(g)),[r,g]);let x=g.every((s)=>Nr(s,F[s.key])),O=()=>{if(!x)return;let s={};for(let[h,v]of Object.entries(F))if(v!==void 0)s[h]=v;c({action:"accept",content:s})};return o(d,{open:!0,onOpenChange:(s)=>!s&&c({action:"cancel"}),children:p(u,{className:"flex max-h-[80vh] flex-col gap-4 sm:max-w-lg",onKeyDown:(s)=>{if(s.key==="Enter"&&(s.metaKey||s.ctrlKey))s.preventDefault(),O()},children:[p(b,{children:[p("div",{className:"flex items-center justify-between gap-2 pe-8",children:[o(m,{children:t.title??a("approval.needed")}),i>1&&o("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${i}`})]}),o(w,{children:n})]}),o("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o(Mn,{children:g.map((s)=>o(L,{id:`${r}:${s.key}`,field:s,value:F[s.key],onChange:(h)=>y((v)=>({...v,[s.key]:h}))},s.key))})}),p(X,{children:[o(e,{variant:"ghost",onClick:()=>c({action:"decline"}),children:a("actions.decline")}),o(e,{disabled:!x,onClick:O,children:a("actions.submit")})]})]})})}
2
+ export{Pr,fr,Nr,bn};
@@ -1,3 +1,3 @@
1
- import{Ft,Bt}from"./chunk-hzxyj69n.js";import{g}from"./chunk-nfeea6s7.js";import{t}from"./chunk-dp8pjv6r.js";import{fo,G,Ee,vo}from"./chunk-0pz9ryqh.js";import{io}from"./chunk-qgkj3wee.js";import{ee}from"./chunk-ve686fw1.js";import{jt}from"./chunk-mvv28374.js";import{uo}from"./chunk-5hv3f2z9.js";import{Io}from"./chunk-5d0a5ykg.js";import{So}from"./chunk-gc9g67j5.js";import{Gt,Wt}from"./chunk-4q3w2353.js";import{Re}from"./chunk-c0ac9k7h.js";import{codexMessageError as J,codexTurnError as q,isContentEntry as oe,isEmbeddedResource as U,isImage as X,isResourceLink as ae,isText as me,nativeTurnId as le}from"@nyssance/codex-acp-v2/client";import{LoaderCircleIcon as de,SparklesIcon as ce}from"lucide-react";import{Fragment as ge,memo as pe}from"react";import{jsx as s,jsxs as m,Fragment as R}from"react/jsx-runtime";function D(r){if(X(r))return`${r.mimeType.toLowerCase()}:${r.data}`;if(U(r)&&"blob"in r.resource&&r.resource.mimeType?.toLowerCase().startsWith("image/"))return`${r.resource.mimeType.toLowerCase()}:${r.resource.blob}`;return null}function T({sessionId:r,entry:n,terminals:l,streaming:o,streamingThoughtId:w}){let{t:a}=t();switch(n.kind){case"activity":return s(io,{sessionId:r,items:n.items,terminals:l,streamingThoughtId:w});case"text":return g(n.item._meta).length>0?s(jt,{sessionId:r,item:n.item}):s(ee,{content:n.item.content,messageId:n.item.id,streaming:o});case"plan":return s(Io,{plan:n.item.plan});case"compaction":if(n.item.status==="failed")return m(Gt,{children:[s("div",{children:a("timeline.compactionFailed")}),n.item.error!==null&&s("div",{children:n.item.error})]});return m("div",{className:"codex-context-compaction",children:[s(ce,{"aria-hidden":"true"}),s("span",{children:n.item.status==="completed"?a("stream.codex.contextCompacted"):n.item.status==="cancelled"?a("timeline.interrupted"):a("timeline.compacting")})]})}}function ue({sessionId:r,turn:n,terminals:l,active:o,blocked:w=!1,continued:a=!1,edits:S=n.edits,activityItems:_=n.items,workStartedAt:Y=n.startedAt,isLast:F,error:u,interrupted:M,retry:L,retrying:p,answerActions:W,footer:Z}){let{t:d}=t(),I=n.errors.map((e)=>{let i=J(e);if(i===null)throw Error("Turn error item is missing its diagnostics");let k=L?.turnId===le(e)?L:void 0;return s(Wt,{error:i,retry:k},`${e.id}:${k?.delaySeconds??"manual"}`)});if(F&&u!==null&&!n.errors.some((e)=>{let i=J(e);return i!==null&&i.stopReason===u.stopReason&&q(i).message===q(u).message}))I.push(s(Wt,{error:u},"current-run-error"));let v=I.length>0?s("div",{className:"codex-turn-errors",children:I}):null,f=n.work,y=f.length>0&&f.every((e)=>e.kind==="compaction");if(fo(n)||y&&n.final.length===0)return m(R,{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(T,{sessionId:r,entry:e,terminals:l,streaming:!1,streamingThoughtId:null},e.key))}),v]});let K=Ee(n),O=n.final.filter((e)=>g(e._meta).length===0).map(G).join(`
2
- `),h=o?null:Re(n,"assistant"),P=n.items.filter((e)=>e.kind==="tool"&&e.name==="image_generation"&&(e.status==="pending"||e.status==="in_progress")),B=new Set(n.final.flatMap((e)=>e.content.map(D).filter((i)=>i!==null))),N=n.items.flatMap((e)=>{if(e.kind!=="tool"||e.status!=="completed")return[];return e.content.filter(oe).flatMap((i,k)=>{let c=i.content,ie=e.name==="image_generation"&&X(c),re=e.toolKind!=="read"&&e.toolKind!=="search"&&(ae(c)||U(c)&&("blob"in c.resource));if(!ie&&!re)return[];let b=D(c);if(b!==null){if(B.has(b))return[];B.add(b)}return[{key:`${e.id}:${k}`,block:c}]})}),A=n.final.some((e)=>g(e._meta).length===0&&e.content.some((i)=>!me(i)||i.text.trim().length>0)),te=P.length>0||N.length>0||y||A||n.final.some((e)=>g(e._meta).length>0),x=n.items.findIndex((e)=>n.final.includes(e)),C=(e)=>n.items.indexOf(e.kind==="activity"?e.items[0]:e.item),H=f.filter((e)=>x===-1||C(e)<x),ne=f.filter((e)=>x!==-1&&C(e)>x),se=[...n.final.map((e)=>({kind:"answer",item:e,index:n.items.indexOf(e)})),...ne.map((e)=>({kind:"work",entry:e,index:C(e)}))].toSorted((e,i)=>e.index-i.index),Q=!o&&!a&&(O.trim().length>0?s(Ft,{text:O,isMostRecentTurn:F,time:h,afterCopy:W}):m("div",{className:"flex items-center gap-0.5",children:[W,h&&s("span",{className:"codex-user-time ms-1",title:h.full,children:h.short})]})),E=So({...n,items:_},{running:o,blocked:w,retrying:p!==void 0}),V=E.kind==="reasoning"?E.ownerKey??null:null,j=E.kind==="thinking",z=vo({...n,items:_});return m(R,{children:[s(Bt,{stateKey:JSON.stringify([r,n.replayed?"history":"live",n.key]),active:o&&!A,defaultExpanded:o&&!A||!n.replayed&&(M||K),...z,startedAt:z.startedAt??Y,loading:j&&n.work.length===0,work:a||y?[]:H.map((e)=>s(T,{sessionId:r,entry:e,terminals:l,streaming:o,streamingThoughtId:V},e.key)),answer:te||a?m("div",{className:"flex min-w-0 flex-col gap-3",children:[(a||y)&&H.map((e)=>s(T,{sessionId:r,entry:e,terminals:l,streaming:!1,streamingThoughtId:null},e.key)),se.map((e)=>{if(e.kind==="work")return s(T,{sessionId:r,entry:e.entry,terminals:l,streaming:o,streamingThoughtId:V},e.entry.key);let i=e.item;return m(ge,{children:[g(i._meta).length>0?s(jt,{sessionId:r,item:i}):s(ee,{content:i.content,messageId:i.id,streaming:o}),i===n.final.at(-1)&&Q]},i.id)}),P.map((e)=>m("div",{className:"codex-image-generation",role:"status","aria-label":d(o?"timeline.imageGenerating":"timeline.imageStopped"),"aria-busy":o,children:[s("div",{className:"codex-image-generation-texture","aria-hidden":"true"}),m("span",{className:"codex-image-generation-status",children:[o&&s(de,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),d(o?"timeline.imageGenerating":"timeline.imageStopped")]})]},e.id)),N.length>0&&s("div",{className:"codex-reply-artifacts flex min-w-0 flex-col gap-3",children:N.map((e)=>s(ee,{content:[e.block],messageId:e.key,streaming:!1},e.key))}),n.final.length===0&&Q]}):null,footer:m(R,{children:[j&&n.work.length>0&&s("div",{className:"codex-pending-message py-2",role:"status",children:s("span",{className:"codex-activity-running",children:d("message.thinking")})}),Z,S.length>0&&!o&&!a&&s(uo,{items:S}),M&&!K&&s("div",{className:"codex-interrupted-turn",role:"status",children:d("timeline.interrupted")}),!o&&v]})}),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?d("timeline.capacityReconnecting"):d("timeline.capacityReconnectingProgress",{progress:e})})():p.message}),o&&v]})}var ro=pe(ue);
1
+ import{Ft,Bt}from"./chunk-93x6b2qa.js";import{g}from"./chunk-5kpcpjrb.js";import{t}from"./chunk-dp8pjv6r.js";import{fo,G,Ee,vo}from"./chunk-m6rrt94g.js";import{io}from"./chunk-0d4xsx23.js";import{ee}from"./chunk-jhk2chpp.js";import{jt}from"./chunk-q905xt4v.js";import{uo}from"./chunk-r79zqx0t.js";import{So}from"./chunk-b4dsjhkq.js";import{Io}from"./chunk-m99k3e5h.js";import{Gt,Wt}from"./chunk-91x8etvh.js";import{Re}from"./chunk-c0ac9k7h.js";import{codexMessageError as J,codexTurnError as q,isContentEntry as oe,isEmbeddedResource as U,isImage as X,isResourceLink as ae,isText as me,nativeTurnId as le}from"@nyssance/codex-acp-v2/client";import{LoaderCircleIcon as de,SparklesIcon as ce}from"lucide-react";import{Fragment as ge,memo as pe}from"react";import{jsx as s,jsxs as m,Fragment as R}from"react/jsx-runtime";function D(r){if(X(r))return`${r.mimeType.toLowerCase()}:${r.data}`;if(U(r)&&"blob"in r.resource&&r.resource.mimeType?.toLowerCase().startsWith("image/"))return`${r.resource.mimeType.toLowerCase()}:${r.resource.blob}`;return null}function T({sessionId:r,entry:n,terminals:l,streaming:o,streamingThoughtId:w}){let{t:a}=t();switch(n.kind){case"activity":return s(io,{sessionId:r,items:n.items,terminals:l,streamingThoughtId:w});case"text":return g(n.item._meta).length>0?s(jt,{sessionId:r,item:n.item}):s(ee,{content:n.item.content,messageId:n.item.id,streaming:o});case"plan":return s(So,{plan:n.item.plan});case"compaction":if(n.item.status==="failed")return m(Gt,{children:[s("div",{children:a("timeline.compactionFailed")}),n.item.error!==null&&s("div",{children:n.item.error})]});return m("div",{className:"codex-context-compaction",children:[s(ce,{"aria-hidden":"true"}),s("span",{children:n.item.status==="completed"?a("stream.codex.contextCompacted"):n.item.status==="cancelled"?a("timeline.interrupted"):a("timeline.compacting")})]})}}function ue({sessionId:r,turn:n,terminals:l,active:o,blocked:w=!1,continued:a=!1,edits:S=n.edits,activityItems:_=n.items,workStartedAt:Y=n.startedAt,isLast:F,error:u,interrupted:M,retry:L,retrying:p,answerActions:W,footer:Z}){let{t:d}=t(),I=n.errors.map((e)=>{let i=J(e);if(i===null)throw Error("Turn error item is missing its diagnostics");let k=L?.turnId===le(e)?L:void 0;return s(Wt,{error:i,retry:k},`${e.id}:${k?.delaySeconds??"manual"}`)});if(F&&u!==null&&!n.errors.some((e)=>{let i=J(e);return i!==null&&i.stopReason===u.stopReason&&q(i).message===q(u).message}))I.push(s(Wt,{error:u},"current-run-error"));let v=I.length>0?s("div",{className:"codex-turn-errors",children:I}):null,f=n.work,y=f.length>0&&f.every((e)=>e.kind==="compaction");if(fo(n)||y&&n.final.length===0)return m(R,{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(T,{sessionId:r,entry:e,terminals:l,streaming:!1,streamingThoughtId:null},e.key))}),v]});let K=Ee(n),O=n.final.filter((e)=>g(e._meta).length===0).map(G).join(`
2
+ `),h=o?null:Re(n,"assistant"),P=n.items.filter((e)=>e.kind==="tool"&&e.name==="image_generation"&&(e.status==="pending"||e.status==="in_progress")),B=new Set(n.final.flatMap((e)=>e.content.map(D).filter((i)=>i!==null))),N=n.items.flatMap((e)=>{if(e.kind!=="tool"||e.status!=="completed")return[];return e.content.filter(oe).flatMap((i,k)=>{let c=i.content,ie=e.name==="image_generation"&&X(c),re=e.toolKind!=="read"&&e.toolKind!=="search"&&(ae(c)||U(c)&&("blob"in c.resource));if(!ie&&!re)return[];let b=D(c);if(b!==null){if(B.has(b))return[];B.add(b)}return[{key:`${e.id}:${k}`,block:c}]})}),A=n.final.some((e)=>g(e._meta).length===0&&e.content.some((i)=>!me(i)||i.text.trim().length>0)),te=P.length>0||N.length>0||y||A||n.final.some((e)=>g(e._meta).length>0),x=n.items.findIndex((e)=>n.final.includes(e)),C=(e)=>n.items.indexOf(e.kind==="activity"?e.items[0]:e.item),H=f.filter((e)=>x===-1||C(e)<x),ne=f.filter((e)=>x!==-1&&C(e)>x),se=[...n.final.map((e)=>({kind:"answer",item:e,index:n.items.indexOf(e)})),...ne.map((e)=>({kind:"work",entry:e,index:C(e)}))].toSorted((e,i)=>e.index-i.index),Q=!o&&!a&&(O.trim().length>0?s(Ft,{text:O,isMostRecentTurn:F,time:h,afterCopy:W}):m("div",{className:"flex items-center gap-0.5",children:[W,h&&s("span",{className:"codex-user-time ms-1",title:h.full,children:h.short})]})),E=Io({...n,items:_},{running:o,blocked:w,retrying:p!==void 0}),V=E.kind==="reasoning"?E.ownerKey??null:null,j=E.kind==="thinking",z=vo({...n,items:_});return m(R,{children:[s(Bt,{stateKey:JSON.stringify([r,n.replayed?"history":"live",n.key]),active:o&&!A,defaultExpanded:o&&!A||!n.replayed&&(M||K),...z,startedAt:z.startedAt??Y,loading:j&&n.work.length===0,work:a||y?[]:H.map((e)=>s(T,{sessionId:r,entry:e,terminals:l,streaming:o,streamingThoughtId:V},e.key)),answer:te||a?m("div",{className:"flex min-w-0 flex-col gap-3",children:[(a||y)&&H.map((e)=>s(T,{sessionId:r,entry:e,terminals:l,streaming:!1,streamingThoughtId:null},e.key)),se.map((e)=>{if(e.kind==="work")return s(T,{sessionId:r,entry:e.entry,terminals:l,streaming:o,streamingThoughtId:V},e.entry.key);let i=e.item;return m(ge,{children:[g(i._meta).length>0?s(jt,{sessionId:r,item:i}):s(ee,{content:i.content,messageId:i.id,streaming:o}),i===n.final.at(-1)&&Q]},i.id)}),P.map((e)=>m("div",{className:"codex-image-generation",role:"status","aria-label":d(o?"timeline.imageGenerating":"timeline.imageStopped"),"aria-busy":o,children:[s("div",{className:"codex-image-generation-texture","aria-hidden":"true"}),m("span",{className:"codex-image-generation-status",children:[o&&s(de,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),d(o?"timeline.imageGenerating":"timeline.imageStopped")]})]},e.id)),N.length>0&&s("div",{className:"codex-reply-artifacts flex min-w-0 flex-col gap-3",children:N.map((e)=>s(ee,{content:[e.block],messageId:e.key,streaming:!1},e.key))}),n.final.length===0&&Q]}):null,footer:m(R,{children:[j&&n.work.length>0&&s("div",{className:"codex-pending-message py-2",role:"status",children:s("span",{className:"codex-activity-running",children:d("message.thinking")})}),Z,S.length>0&&!o&&!a&&s(uo,{items:S}),M&&!K&&s("div",{className:"codex-interrupted-turn",role:"status",children:d("timeline.interrupted")}),!o&&v]})}),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?d("timeline.capacityReconnecting"):d("timeline.capacityReconnectingProgress",{progress:e})})():p.message}),o&&v]})}var ro=pe(ue);
3
3
  export{ro};
@@ -1,3 +1,3 @@
1
1
  import{a}from"./chunk-ryz4c13z.js";import{ChevronDownIcon as v,ChevronUpIcon as b,FileDiffIcon as C}from"lucide-react";import{useState as m}from"react";import{jsx as s,jsxs as n}from"react/jsx-runtime";function x(e){if(e===null||e.length===0)return 0;return e.split(`
2
- `).length}function Hr(e){let l=new Map;for(let u of e)for(let d of u.content){if(d.type!=="diff")continue;let f=d,r=f._meta?.alwith?.hunks??[],h=r.reduce((o,i)=>o+x(i.newText),0),c=r.reduce((o,i)=>o+x(i.oldText),0);for(let o of f.changes){let i=l.get(o.path);if(i)i.additions+=h,i.deletions+=c;else l.set(o.path,{path:o.path,additions:h,deletions:c})}}return[...l.values()]}function mo({blocks:e}){return s(Ut,{files:Hr(e)})}function Ut({files:e,onOpen:l,renderPath:u}){let{t:d,openLink:f}=a(),[r,h]=m(!0),[c,o]=m(!1);if(e.length===0)return null;let i=e.reduce((t,p)=>t+p.additions,0),g=e.reduce((t,p)=>t+p.deletions,0);return n("section",{className:"codex-edited-files-card",children:[n("div",{className:"codex-edited-files-header",children:[s("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:s(C,{})}),n("div",{className:"codex-edited-files-summary",children:[s("strong",{children:d("stream.codex.editedFilesCount",{count:e.length})}),s("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((t)=>!t),o(!1)},"aria-expanded":r,children:d(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),n("div",{className:"codex-edited-files-total",title:d("stream.codex.changedLines"),children:[n("span",{className:"codex-diff-additions",children:["+",i]}),n("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&n("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((t)=>n("div",{className:"codex-edited-file-row",children:[s("button",{type:"button",className:"codex-edited-file-path",title:t.path,onClick:()=>l===void 0?f(t.path):l(t),children:u===void 0?t.path:u(t)}),n("span",{className:"codex-edited-file-counts",children:[n("span",{className:"codex-diff-additions",children:["+",t.additions]}),n("span",{className:"codex-diff-deletions",children:["-",t.deletions]})]})]},t.path)),e.length>3&&n("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>o((t)=>!t),children:[d(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?s(b,{size:16,"aria-hidden":"true"}):s(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
- export{Hr,mo,Ut};
2
+ `).length}function Or(e){let l=new Map;for(let u of e)for(let d of u.content){if(d.type!=="diff")continue;let f=d,r=f._meta?.alwith?.hunks??[],h=r.reduce((o,i)=>o+x(i.newText),0),c=r.reduce((o,i)=>o+x(i.oldText),0);for(let o of f.changes){let i=l.get(o.path);if(i)i.additions+=h,i.deletions+=c;else l.set(o.path,{path:o.path,additions:h,deletions:c})}}return[...l.values()]}function mo({blocks:e}){return s(Ut,{files:Or(e)})}function Ut({files:e,onOpen:l,renderPath:u}){let{t:d,openLink:f}=a(),[r,h]=m(!0),[c,o]=m(!1);if(e.length===0)return null;let i=e.reduce((t,p)=>t+p.additions,0),g=e.reduce((t,p)=>t+p.deletions,0);return n("section",{className:"codex-edited-files-card",children:[n("div",{className:"codex-edited-files-header",children:[s("div",{className:"codex-edited-files-icon","aria-hidden":"true",children:s(C,{})}),n("div",{className:"codex-edited-files-summary",children:[s("strong",{children:d("stream.codex.editedFilesCount",{count:e.length})}),s("button",{type:"button","data-codex-disclosure":"",onClick:()=>{h((t)=>!t),o(!1)},"aria-expanded":r,children:d(r?"stream.codex.hideChanges":"stream.codex.viewChanges")})]}),n("div",{className:"codex-edited-files-total",title:d("stream.codex.changedLines"),children:[n("span",{className:"codex-diff-additions",children:["+",i]}),n("span",{className:"codex-diff-deletions",children:["-",g]})]})]}),r&&n("div",{className:"codex-edited-files-list",children:[(c?e:e.slice(0,3)).map((t)=>n("div",{className:"codex-edited-file-row",children:[s("button",{type:"button",className:"codex-edited-file-path",title:t.path,onClick:()=>l===void 0?f(t.path):l(t),children:u===void 0?t.path:u(t)}),n("span",{className:"codex-edited-file-counts",children:[n("span",{className:"codex-diff-additions",children:["+",t.additions]}),n("span",{className:"codex-diff-deletions",children:["-",t.deletions]})]})]},t.path)),e.length>3&&n("button",{type:"button",className:"codex-edited-files-more","aria-expanded":c,onClick:()=>o((t)=>!t),children:[d(c?"stream.codex.showFewerFiles":"stream.codex.showMoreFiles",{count:e.length-3}),c?s(b,{size:16,"aria-hidden":"true"}):s(v,{size:16,"aria-hidden":"true"})]})]})]})}
3
+ export{Or,mo,Ut};
@@ -0,0 +1,2 @@
1
+ import{useCallback as r,useState as x}from"react";var t=new Map;function S(o,e,k=!1){let[p,d]=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,d({key:o,expanded:n});let b=r((c)=>{d((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{S};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-cg97byvk.js";import{d,u,b,X,m,w}from"./chunk-ty6yjhwk.js";import{J}from"./chunk-m8djwdd5.js";import{createContext as g,useContext as C,useState as y,useSyncExternalStore as L}from"react";import{jsx as i,jsxs as S}from"react/jsx-runtime";var v=g(null),f=g(null),x=g(null);function mr({host:t,client:o,children:n}){let[l,a]=y(null);J(l!==null);let{t:c}=t;return i(v,{value:t,children:i(f,{value:o,children:S(x,{value:a,children:[n,i(d,{open:l!==null,onOpenChange:(D)=>!D&&a(null),children:S(u,{children:[S(b,{children:[i(m,{children:c("sessionList.deleteTitle")}),i(w,{children:c("sessionList.deleteDescription")})]}),S(X,{children:[i(e,{variant:"outline",onClick:()=>a(null),children:c("sessionList.cancel")}),i(e,{onClick:()=>{if(l)T(t,o.delete(l.sessionId));a(null)},children:c("sessionList.delete")})]})]})})]})})})}function p(){let t=C(v);if(t===null)throw Error("Session list host is missing");return t}function s(){let t=C(f);if(t===null)throw Error("Session list client is missing");return t}function tt(){let t=C(x);if(t===null)throw Error("Session list provider is missing");return t}function r(t){let o=s();return L((n)=>o.store.subscribe(n),()=>t(o.store.getState()),()=>t(o.store.getState()))}function T(t,o){return o.then(()=>{},(n)=>{if(t.reportError)t.reportError(n);else console.error(n)})}
2
- export{mr,p,s,tt,r,T};
1
+ import{e}from"./chunk-6kn920c5.js";import{d,u,b,X,m,w}from"./chunk-17zegmxa.js";import{J}from"./chunk-m8djwdd5.js";import{createContext as g,useContext as C,useState as y,useSyncExternalStore as L}from"react";import{jsx as i,jsxs as S}from"react/jsx-runtime";var v=g(null),f=g(null),x=g(null);function pr({host:t,client:o,children:n}){let[l,a]=y(null);J(l!==null);let{t:c}=t;return i(v,{value:t,children:i(f,{value:o,children:S(x,{value:a,children:[n,i(d,{open:l!==null,onOpenChange:(D)=>!D&&a(null),children:S(u,{children:[S(b,{children:[i(m,{children:c("sessionList.deleteTitle")}),i(w,{children:c("sessionList.deleteDescription")})]}),S(X,{children:[i(e,{variant:"outline",onClick:()=>a(null),children:c("sessionList.cancel")}),i(e,{onClick:()=>{if(l)T(t,o.delete(l.sessionId));a(null)},children:c("sessionList.delete")})]})]})})]})})})}function p(){let t=C(v);if(t===null)throw Error("Session list host is missing");return t}function s(){let t=C(f);if(t===null)throw Error("Session list client is missing");return t}function tt(){let t=C(x);if(t===null)throw Error("Session list provider is missing");return t}function r(t){let o=s();return L((n)=>o.store.subscribe(n),()=>t(o.store.getState()),()=>t(o.store.getState()))}function T(t,o){return o.then(()=>{},(n)=>{if(t.reportError)t.reportError(n);else console.error(n)})}
2
+ export{pr,p,s,tt,r,T};
@@ -1,4 +1,4 @@
1
- import{e}from"./chunk-cg97byvk.js";import{f}from"./chunk-ek06eyp4.js";import{j,S}from"./chunk-jtaph5am.js";import{k}from"./chunk-ncekagm6.js";import{useId as Q}from"react";import{jsx as r,jsxs as p,Fragment as h}from"react/jsx-runtime";function a(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function g(n){if(!a(n)||!a(n.codex))return[];let s=n.codex,i=s.questions;if(s.delivery!=="async"||!Array.isArray(i))return[];if(!i.every((t)=>a(t)&&typeof t.title==="string"&&t.title.trim().length>0&&(t.options===null||Array.isArray(t.options)&&t.options.every((l)=>typeof l==="string"))))return[];return i}function Kt(n,s){return JSON.stringify(["request_user_input_async",n,s])}function wo(n){return{selected:n.options?.length?0:null,text:""}}function Qt(n,s){return s.selected===null?s.text:n.options?.[s.selected]??""}function ko(n){return`<send_user_message_question_reply>
1
+ import{e}from"./chunk-6kn920c5.js";import{f}from"./chunk-ek06eyp4.js";import{j,I}from"./chunk-5m4605a3.js";import{k}from"./chunk-ncekagm6.js";import{useId as Q}from"react";import{jsx as r,jsxs as p,Fragment as h}from"react/jsx-runtime";function a(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function g(n){if(!a(n)||!a(n.codex))return[];let s=n.codex,i=s.questions;if(s.delivery!=="async"||!Array.isArray(i))return[];if(!i.every((t)=>a(t)&&typeof t.title==="string"&&t.title.trim().length>0&&(t.options===null||Array.isArray(t.options)&&t.options.every((l)=>typeof l==="string"))))return[];return i}function Kt(n,s){return JSON.stringify(["request_user_input_async",n,s])}function wo(n){return{selected:n.options?.length?0:null,text:""}}function Qt(n,s){return s.selected===null?s.text:n.options?.[s.selected]??""}function ko(n){return`<send_user_message_question_reply>
2
2
  ${JSON.stringify([n])}
3
- </send_user_message_question_reply>`}function Xt(n){if(!a(n)||!a(n.codex))return[];let s=n.codex;return(Array.isArray(s.questionReplyParts)?s.questionReplyParts.map((t)=>a(t)?{...t,answer:t.text}:t):[s.questionReply]).filter((t)=>a(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:l,answer:c})=>({questionItemId:t,question:l,answer:c}))}function Co({question:n,draft:s,status:i,answer:t,error:l,onChange:c,onSubmit:x,onSkip:b,t:o}){let y=Q(),d=i==="pending",w=i==="answered"||i==="skipped";return p("section",{"aria-labelledby":`${y}-title`,className:"border-border bg-card text-card-foreground flex min-w-0 flex-col gap-3 rounded-xl border p-4",children:[r("h3",{id:`${y}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title}),w?r("p",{className:"text-sm whitespace-pre-wrap",children:i==="answered"?t:o("asyncQuestion.skipped")}):p(h,{children:[(n.options?.length??0)>0&&p(j,{"aria-labelledby":`${y}-title`,disabled:!d,value:s.selected===null?"other":String(s.selected),onValueChange:(u)=>c({...s,selected:u==="other"?null:Number(u)}),children:[n.options?.map((u,m)=>p(f,{className:"flex items-start gap-2 text-sm",children:[r(S,{value:String(m)}),r("span",{className:"whitespace-pre-wrap",children:u})]},m)),p(f,{className:"flex items-center gap-2 text-sm",children:[r(S,{value:"other"}),o("asyncQuestion.other")]})]}),r(k,{"aria-label":o("asyncQuestion.answer"),placeholder:o("asyncQuestion.answer"),value:s.text,readOnly:!d,onChange:(u)=>c({selected:null,text:u.target.value})}),l&&r("p",{role:"alert",className:"text-destructive text-sm",children:l}),p("div",{className:"flex flex-wrap items-center gap-2",children:[r(e,{size:"sm",disabled:!d||Qt(n,s).trim().length===0,onClick:x,children:o(i==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")}),r(e,{size:"sm",variant:"ghost",disabled:!d,onClick:b,children:o("asyncQuestion.skip")}),(i==="closed"||i==="unavailable")&&r("span",{role:"status",className:"text-muted-foreground text-xs",children:o(`asyncQuestion.${i}`)})]})]})]})}
3
+ </send_user_message_question_reply>`}function Xt(n){if(!a(n)||!a(n.codex))return[];let s=n.codex;return(Array.isArray(s.questionReplyParts)?s.questionReplyParts.map((t)=>a(t)?{...t,answer:t.text}:t):[s.questionReply]).filter((t)=>a(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:l,answer:c})=>({questionItemId:t,question:l,answer:c}))}function Co({question:n,draft:s,status:i,answer:t,error:l,onChange:c,onSubmit:x,onSkip:b,t:o}){let y=Q(),d=i==="pending",w=i==="answered"||i==="skipped";return p("section",{"aria-labelledby":`${y}-title`,className:"border-border bg-card text-card-foreground flex min-w-0 flex-col gap-3 rounded-xl border p-4",children:[r("h3",{id:`${y}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title}),w?r("p",{className:"text-sm whitespace-pre-wrap",children:i==="answered"?t:o("asyncQuestion.skipped")}):p(h,{children:[(n.options?.length??0)>0&&p(j,{"aria-labelledby":`${y}-title`,disabled:!d,value:s.selected===null?"other":String(s.selected),onValueChange:(u)=>c({...s,selected:u==="other"?null:Number(u)}),children:[n.options?.map((u,m)=>p(f,{className:"flex items-start gap-2 text-sm",children:[r(I,{value:String(m)}),r("span",{className:"whitespace-pre-wrap",children:u})]},m)),p(f,{className:"flex items-center gap-2 text-sm",children:[r(I,{value:"other"}),o("asyncQuestion.other")]})]}),r(k,{"aria-label":o("asyncQuestion.answer"),placeholder:o("asyncQuestion.answer"),value:s.text,readOnly:!d,onChange:(u)=>c({selected:null,text:u.target.value})}),l&&r("p",{role:"alert",className:"text-destructive text-sm",children:l}),p("div",{className:"flex flex-wrap items-center gap-2",children:[r(e,{size:"sm",disabled:!d||Qt(n,s).trim().length===0,onClick:x,children:o(i==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")}),r(e,{size:"sm",variant:"ghost",disabled:!d,onClick:b,children:o("asyncQuestion.skip")}),(i==="closed"||i==="unavailable")&&r("span",{role:"status",className:"text-muted-foreground text-xs",children:o(`asyncQuestion.${i}`)})]})]})]})}
4
4
  export{g,Kt,wo,Qt,ko,Xt,Co};
@@ -1 +1 @@
1
- import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function j({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function S({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{j,S};
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 j({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function I({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{j,I};
@@ -1,2 +1,2 @@
1
- import{o}from"./chunk-dp8pjv6r.js";import{e}from"./chunk-cg97byvk.js";import{Ln}from"./chunk-szanfktp.js";import{ge,fe,he,ve}from"./chunk-9evhky1b.js";import{n,C}from"./chunk-ysc51tpb.js";import{Loader2Icon as f}from"lucide-react";import{jsx as i,jsxs as m}from"react/jsx-runtime";function st({session:t,timeline:c}){let{host:s,client:a}=n(),{t:r}=s,l=o((y)=>y.historyPages[t.id]?.cursor!=null),d=()=>C(s,a.open(t.id,t.cwd)),p=i(Ln,{...c,session:t,client:a,host:s});if(t.restoring)return t.items.length===0?m("div",{className:"text-muted-foreground flex flex-1 items-center justify-center gap-2 text-sm",children:[i(f,{className:"size-4 animate-spin","aria-hidden":"true"}),r("conversation.restoring")]}):p;if(!t.attached&&t.items.length===0)return m(ge,{className:"flex-1",children:[m(fe,{children:[i(he,{children:r("conversation.reopen")}),i(ve,{children:r("conversation.detached")})]}),i(e,{onClick:d,children:r("conversation.reopen")})]});if(t.items.length===0&&t.state==="idle"&&!l)return i(ge,{className:"flex-1",children:m(fe,{children:[i(he,{className:"text-[28px] font-normal",children:r("conversation.welcomeTitle")}),i(ve,{className:"truncate font-mono",children:t.cwd})]})});return p}
1
+ import{o}from"./chunk-dp8pjv6r.js";import{e}from"./chunk-6kn920c5.js";import{Ln}from"./chunk-p1ydsj54.js";import{ge,fe,he,ve}from"./chunk-magaaqab.js";import{n,C}from"./chunk-ysc51tpb.js";import{Loader2Icon as f}from"lucide-react";import{jsx as i,jsxs as m}from"react/jsx-runtime";function st({session:t,timeline:c}){let{host:s,client:a}=n(),{t:r}=s,l=o((y)=>y.historyPages[t.id]?.cursor!=null),d=()=>C(s,a.open(t.id,t.cwd)),p=i(Ln,{...c,session:t,client:a,host:s});if(t.restoring)return t.items.length===0?m("div",{className:"text-muted-foreground flex flex-1 items-center justify-center gap-2 text-sm",children:[i(f,{className:"size-4 animate-spin","aria-hidden":"true"}),r("conversation.restoring")]}):p;if(!t.attached&&t.items.length===0)return m(ge,{className:"flex-1",children:[m(fe,{children:[i(he,{children:r("conversation.reopen")}),i(ve,{children:r("conversation.detached")})]}),i(e,{onClick:d,children:r("conversation.reopen")})]});if(t.items.length===0&&t.state==="idle"&&!l)return i(ge,{className:"flex-1",children:m(fe,{children:[i(he,{className:"text-[28px] font-normal",children:r("conversation.welcomeTitle")}),i(ve,{className:"truncate font-mono",children:t.cwd})]})});return p}
2
2
  export{st};
@@ -1,2 +1,2 @@
1
- import{createStore as r}from"@alwith/api/client";var _t=r({sessionId:null,turns:[],api:null,beforeReveal:null,terminals:{}});function zn(e){_t.setState({...e,terminals:e.terminals??{}})}function Un(e){if(_t.getState().sessionId===e)_t.setState({sessionId:null,turns:[],api:null,beforeReveal:null,terminals:{}})}async function ri(e,n,t){let i=_t.getState();if(t.aborted||e===null||i.sessionId!==e||i.api===null)return;if(i.beforeReveal===null)throw Error("Mounted timeline has no navigation lifecycle");i.beforeReveal(),await i.api.scrollToKey(n,void 0,{align:"top"})}
2
- export{_t,zn,Un,ri};
1
+ import{createStore as r}from"@alwith/api/client";var _t=r({sessionId:null,turns:[],api:null,beforeReveal:null,terminals:{}});function zn(e){_t.setState({...e,terminals:e.terminals??{}})}function Un(e){if(_t.getState().sessionId===e)_t.setState({sessionId:null,turns:[],api:null,beforeReveal:null,terminals:{}})}async function ii(e,n,t){let i=_t.getState();if(t.aborted||e===null||i.sessionId!==e||i.api===null)return;if(i.beforeReveal===null)throw Error("Mounted timeline has no navigation lifecycle");i.beforeReveal(),await i.api.scrollToKey(n,void 0,{align:"top"})}
2
+ export{_t,zn,Un,ii};
@@ -1 +1 @@
1
- import{Button as n}from"@base-ui/react/button";import{cva as d}from"class-variance-authority";import{cn as o}from"cn";import{jsx as s}from"react/jsx-runtime";var Vr=d("group/button focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 shadow-xs",secondary:"bg-secondary text-secondary-foreground aria-expanded:bg-secondary aria-expanded:text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function e({className:r,variant:t="default",size:i="default",...a}){return s(n,{"data-slot":"button",className:o(Vr({variant:t,size:i,className:r})),...a})}export{Vr,e};
1
+ import{Button as n}from"@base-ui/react/button";import{cva as d}from"class-variance-authority";import{cn as o}from"cn";import{jsx as s}from"react/jsx-runtime";var Gr=d("group/button focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:ring-3 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:ring-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 shadow-xs",secondary:"bg-secondary text-secondary-foreground aria-expanded:bg-secondary aria-expanded:text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-9","icon-xs":"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function e({className:r,variant:t="default",size:i="default",...a}){return s(n,{"data-slot":"button",className:o(Gr({variant:t,size:i,className:r})),...a})}export{Gr,e};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-cg97byvk.js";import{l}from"./chunk-1hy64ewz.js";import{cn as h}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 un({ref:p,value:o,onChange:d,onFind:i,onClose:s,placeholder:m,autoFocusOpen:a=!0,prevTitle:c,nextTitle:u,className:v}){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({preventScroll:!0}),t.select()},[a]);let f=!o;return k("div",{className:h("border-border flex h-9 shrink-0 items-center gap-1 border-b px-2",v),children:[n(l,{ref:r,value:o,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(),o)i(t.shiftKey)}}}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>i(!0),title:c?`${c} (⇧↵)`:"⇧↵",children:n(b,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>i(!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"})})]})}
1
+ import{e}from"./chunk-6kn920c5.js";import{l}from"./chunk-1hy64ewz.js";import{cn as h}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 un({ref:p,value:o,onChange:d,onFind:i,onClose:s,placeholder:m,autoFocusOpen:a=!0,prevTitle:c,nextTitle:u,className:v}){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({preventScroll:!0}),t.select()},[a]);let f=!o;return k("div",{className:h("border-border flex h-9 shrink-0 items-center gap-1 border-b px-2",v),children:[n(l,{ref:r,value:o,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(),o)i(t.shiftKey)}}}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>i(!0),title:c?`${c} (⇧↵)`:"⇧↵",children:n(b,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>i(!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
2
  export{un};
@@ -1 +1 @@
1
- import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function Go({className:t,...n}){return o("kbd",{"data-slot":"kbd",className:e("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",t),...n})}function xi({className:t,...n}){return o("kbd",{"data-slot":"kbd-group",className:e("inline-flex items-center gap-1",t),...n})}export{Go,xi};
1
+ import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function Go({className:t,...n}){return o("kbd",{"data-slot":"kbd",className:e("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",t),...n})}function yi({className:t,...n}){return o("kbd",{"data-slot":"kbd-group",className:e("inline-flex items-center gap-1",t),...n})}export{Go,yi};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-cg97byvk.js";import{Do}from"./chunk-tdwk5dct.js";import{Ae,Le,De}from"./chunk-b65vdzz3.js";import{x}from"./chunk-pth2ajxw.js";import{cn as f}from"cn";import{PaperclipIcon as k,XIcon as T}from"lucide-react";import{Fragment as M,useEffect as L,useRef as z,useState as N}from"react";import{jsx as t,jsxs as o,Fragment as R}from"react/jsx-runtime";function E(n){return t(De,{align:"start",...n})}function No({data:n,t:r,className:u,...c}){let p=x(),[d,h]=N(!1),[I,v]=N(1),C=z(null),s=n.filename||"",i=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",A=s||(i?r("input.image"):r("input.attachment"));return L(()=>{if(!d)return;let l=0.1,g=(a)=>Math.min(10,Math.max(0.1,a)),y=(a)=>{if(!(a.ctrlKey||a.metaKey))return;let m=a.key,w=m==="+"||m==="=",H=m==="-"||m==="_",b=m==="0";if(!w&&!H&&!b)return;a.preventDefault(),v((P)=>{if(b)return 1;if(w)return g(P+l);return g(P-l)})};return window.addEventListener("keydown",y,{passive:!1}),()=>window.removeEventListener("keydown",y)},[d]),o(R,{children:[o(Ae,{children:[t(Le,{render:o("div",{className:f("group border-border hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent relative flex h-8 cursor-pointer items-center gap-1.5 rounded-md border px-1.5 text-sm font-medium transition-all select-none",u),...c,children:[o("div",{className:"relative size-5 shrink-0",children:[i?t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":r("input.image"),className:"bg-background absolute inset-0 size-5 overflow-hidden rounded p-0 transition-opacity group-hover:opacity-0",onClick:()=>{v(1),h(!0)},children:t("img",{alt:s||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20})}):t("div",{className:"bg-background text-muted-foreground absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded transition-opacity group-hover:opacity-0",children:t(k,{className:"size-3"})}),o(e,{"aria-label":r("input.removeAttachment"),className:f("absolute -top-1 -right-1 size-4 rounded-full p-0 opacity-0 transition-opacity [&>svg]:size-3","pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100"),onClick:(l)=>{l.stopPropagation(),p.remove(n.id)},type:"button",variant:"ghost",children:[t(T,{}),t("span",{className:"sr-only",children:r("input.removeAttachment")})]})]}),!i&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:A})]})}),t(E,{className:"w-auto p-2",children:o("div",{className:"w-auto space-y-3",children:[i&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:s||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448})}),t("div",{className:"flex items-center gap-2.5",children:o("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[t("h4",{className:"truncate text-sm leading-none font-semibold",children:s||(i?"Image":"Attachment")}),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType})]})})]})})]}),i&&n.url&&t(Do,{containerRef:C,filename:s||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:I,url:n.url})]})}function Mo({children:n,className:r,...u}){let c=x();if(!c.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:c.files.map((p)=>t(M,{children:n(p)},p.id))})}
1
+ import{e}from"./chunk-6kn920c5.js";import{Do}from"./chunk-sex6d2c2.js";import{Ae,Le,De}from"./chunk-b65vdzz3.js";import{x}from"./chunk-k6pjjtdb.js";import{cn as f}from"cn";import{PaperclipIcon as k,XIcon as T}from"lucide-react";import{Fragment as M,useEffect as L,useRef as z,useState as N}from"react";import{jsx as t,jsxs as o,Fragment as R}from"react/jsx-runtime";function E(n){return t(De,{align:"start",...n})}function No({data:n,t:r,className:u,...c}){let p=x(),[d,h]=N(!1),[I,v]=N(1),C=z(null),s=n.filename||"",i=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",A=s||(i?r("input.image"):r("input.attachment"));return L(()=>{if(!d)return;let l=0.1,g=(a)=>Math.min(10,Math.max(0.1,a)),y=(a)=>{if(!(a.ctrlKey||a.metaKey))return;let m=a.key,w=m==="+"||m==="=",H=m==="-"||m==="_",b=m==="0";if(!w&&!H&&!b)return;a.preventDefault(),v((P)=>{if(b)return 1;if(w)return g(P+l);return g(P-l)})};return window.addEventListener("keydown",y,{passive:!1}),()=>window.removeEventListener("keydown",y)},[d]),o(R,{children:[o(Ae,{children:[t(Le,{render:o("div",{className:f("group border-border hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent relative flex h-8 cursor-pointer items-center gap-1.5 rounded-md border px-1.5 text-sm font-medium transition-all select-none",u),...c,children:[o("div",{className:"relative size-5 shrink-0",children:[i?t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":r("input.image"),className:"bg-background absolute inset-0 size-5 overflow-hidden rounded p-0 transition-opacity group-hover:opacity-0",onClick:()=>{v(1),h(!0)},children:t("img",{alt:s||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20})}):t("div",{className:"bg-background text-muted-foreground absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded transition-opacity group-hover:opacity-0",children:t(k,{className:"size-3"})}),o(e,{"aria-label":r("input.removeAttachment"),className:f("absolute -top-1 -right-1 size-4 rounded-full p-0 opacity-0 transition-opacity [&>svg]:size-3","pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100"),onClick:(l)=>{l.stopPropagation(),p.remove(n.id)},type:"button",variant:"ghost",children:[t(T,{}),t("span",{className:"sr-only",children:r("input.removeAttachment")})]})]}),!i&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:A})]})}),t(E,{className:"w-auto p-2",children:o("div",{className:"w-auto space-y-3",children:[i&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:s||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448})}),t("div",{className:"flex items-center gap-2.5",children:o("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[t("h4",{className:"truncate text-sm leading-none font-semibold",children:s||(i?"Image":"Attachment")}),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType})]})})]})})]}),i&&n.url&&t(Do,{containerRef:C,filename:s||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:I,url:n.url})]})}function Mo({children:n,className:r,...u}){let c=x();if(!c.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:c.files.map((p)=>t(M,{children:n(p)},p.id))})}
2
2
  export{No,Mo};
@@ -1,2 +1,2 @@
1
- function*kt(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 Gr(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 kt(s,e))r.push({turnKey:t,occurrenceInTurn:c}),c+=1}return r}
2
- export{kt,Gr};
1
+ function*kt(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 Wr(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 kt(s,e))r.push({turnKey:t,occurrenceInTurn:c}),c+=1}return r}
2
+ export{kt,Wr};
@@ -1,2 +1,2 @@
1
- import{_n,me,Dt,Hn,On,Fn}from"./chunk-gd9s35b8.js";import{forwardRef as ve,useCallback as K,useEffect as ge,useImperativeHandle as pe,useLayoutEffect as w,useMemo as ne,useRef as s,useState as F}from"react";import{jsx as R,jsxs as re}from"react/jsx-runtime";var Re=12,X=2,V=800,he=new Map;function He({turnKey:q,heightPx:x,placeholder:W=!1,deferUntilReady:n=!1,observe:H,onReady:L,children:z}){let h=s(null),[T,_]=F(!1),U=K((m)=>{h.current=m,H(q,m)},[H,q]);return w(()=>{let m=h.current;if(m===null)throw Error("Codex turn element is missing");let b=()=>{L(m),_(!0)};if(m.querySelector("[data-markdown-pending]")===null){b();return}let d=new MutationObserver(()=>{if(m.querySelector("[data-markdown-pending]")!==null)return;d.disconnect(),b()});return d.observe(m,{childList:!0,subtree:!0}),()=>d.disconnect()},[L]),re("div",{style:T?void 0:{position:"relative",height:x,overflow:"hidden"},children:[R("div",{ref:U,className:"[&_[data-virtualized-turn-content]]:[content-visibility:visible]","data-turn-key":q,"aria-busy":!T||void 0,style:!T&&!W&&n?{visibility:"hidden"}:void 0,"data-turn-ready":T?"":void 0,children:z}),!T&&!W&&n&&R("div",{"aria-hidden":"true",className:"codex-turn-loading",children:re("div",{className:"codex-turn-loading-lines",children:[R("span",{}),R("span",{}),R("span",{})]})})]})}var Dn=ve(function({entries:x,renderTurn:W,scrollElement:n,sessionKey:H,leadingContent:L,leadingInsetPx:z=0,preserveViewport:h=!1},T){let _=s(null),[U,m]=F(z),b=L!==void 0&&L!==null;w(()=>{let e=_.current;if(e===null)return;let t=()=>m(e.getBoundingClientRect().height);t();let o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[b]);let d=ne(()=>he.get(H),[H]),[j,J]=F(()=>d?.turnHeightsByKey??{}),i=ne(()=>_n({entries:x,gapPx:Re,measuredHeightsByKey:j,leadingInsetPx:b?U:z}),[x,j,b,U,z]),fe=ne(()=>{let e=me({distanceFromBottomPx:d?.distanceFromBottomPx??0,layout:i,overscanCount:X,viewportHeightPx:V}),t=d?.renderedWindow;if(t===void 0||t===null)return e;return Dt({anchorKey:t.anchorKey,layout:i,previousRange:{startIndex:0,endIndex:Math.min(t.count,e.endIndex-e.startIndex)}})??e},[d,i]),[M,ie]=F(fe),[y,oe]=F(V),[c,ue]=F(null),N=s(d?.distanceFromBottomPx??0),k=s(M),ae=s(i.turnKeys),l=s(j),S=s(i),se=s(i),P=s(new Map),v=s(null),C=s(null),E=s(null),D=s(new Map),Q=s(!1),ce=s(()=>{}),O=s(null),de=K(()=>{if(!h||n===null||v.current!==null||O.current!==null)return;let e=n.getBoundingClientRect();if(e.height<=0)return;let t=[...P.current].filter(([,r])=>r.hasAttribute("data-turn-ready")).map(([r,u])=>{let a=u.getBoundingClientRect(),g=S.current.turnIndexByKey.get(r),B=g===void 0?a.height:S.current.heightsPx[g];return{key:r,element:u,rect:a,bottom:a.top+B}}).filter(({rect:r,bottom:u})=>u>e.top&&r.top<e.bottom).toSorted((r,u)=>r.rect.top-u.rect.top),o=t.flatMap((r)=>[...r.element.querySelectorAll("[data-user-message-bubble], .codex-markdown-root > *")].filter((u)=>!u.closest('[aria-hidden="true"], [inert]')).map((u)=>({key:r.key,element:u,rect:u.getBoundingClientRect()})).filter(({rect:u})=>u.height>0&&u.top>=e.top&&u.top<e.bottom)).toSorted((r,u)=>r.rect.top-u.rect.top)[0]??t[0];if(o)O.current={key:o.key,element:o.element,top:o.rect.top-e.top,scrollTop:n.scrollTop}},[h,n]),Y=s(de);Y.current=de;let p=K((e,t)=>{let o=Math.min(e,i.totalHeightPx),r=me({distanceFromBottomPx:o,layout:i,overscanCount:X,viewportHeightPx:t}),u=k.current,a=u.startIndex<=r.startIndex&&u.endIndex>=r.endIndex?u:r;if(N.current=o,k.current=a,ae.current=i.turnKeys,oe(t),a!==u)ie(a)},[i]),A=K((e)=>{let t=Math.max(0,e.scrollHeight-i.totalHeightPx);return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop-t)},[i.totalHeightPx]),xe=K((e)=>{let t=e.dataset.turnKey;if(t===void 0)throw Error("Codex measured turn is missing its key");let o=Math.max(1,e.getBoundingClientRect().height);if(l.current[t]===o)return;Y.current();let r={...l.current,[t]:o};l.current=r,J(r)},[]),Z=K(()=>{if(C.current!==null)return C.current;return C.current=new ResizeObserver((e)=>{for(let t of e){let o=t.target;if(!("turnReady"in o.dataset)&&o.querySelector("[data-markdown-pending]")!==null)continue;let r=o.dataset.turnKey;if(r===void 0)throw Error("Codex measured turn is missing its key");let u=Math.max(1,t.borderBoxSize[0]?.blockSize??t.contentRect.height);D.current.set(r,u)}if(E.current!==null||D.current.size===0)return;E.current=requestAnimationFrame(()=>{E.current=null;let t=[...D.current].filter(([r,u])=>l.current[r]!==u);if(D.current.clear(),t.length===0)return;Y.current();let o={...l.current,...Object.fromEntries(t)};l.current=o,J(o)})}),C.current},[]),ye=K((e,t)=>{let o=P.current.get(e);if(o!==void 0)Z().unobserve(o),P.current.delete(e);if(t===null)return;if(t.dataset.turnKey!==e)throw Error(`Codex turn key does not match its element: ${e}`);P.current.set(e,t),Z().observe(t)},[Z]);ge(()=>()=>{if(C.current?.disconnect(),E.current!==null)cancelAnimationFrame(E.current);D.current.clear(),C.current=null,P.current.clear()},[]),w(()=>{ce.current=()=>{if(n===null)return;let e=A(n);if(v.current!==null){N.current=e,oe(n.clientHeight||V);return}p(e,n.clientHeight||V)}},[A,n,p]),w(()=>{if(n===null)return;if(!Q.current){Q.current=!0;let o=d?.distanceFromBottomPx??0;n.scrollTo({behavior:"instant",top:Math.max(0,o>0?S.current.totalHeightPx-n.clientHeight-o:n.scrollHeight-n.clientHeight)})}let e=()=>ce.current();e(),n.addEventListener("scroll",e,{passive:!0});let t=new ResizeObserver(e);return t.observe(n),()=>{n.removeEventListener("scroll",e),t.disconnect()}},[d,n]),w(()=>{if(n===null||c===null)return;let e=P.current.get(c.turnKey);if(e?.querySelector("[data-markdown-pending]")!==null)return;let t=e.offsetHeight;if(t<=0)return;if(l.current[c.turnKey]!==t){let g={...l.current,[c.turnKey]:t};l.current=g,J(g);return}let o=c.getTargetElement(e)??e,r=e.getBoundingClientRect(),u=o.getBoundingClientRect(),a=Fn({align:c.align,layout:i,targetHeightPx:u.height,targetOffsetPx:u.top-r.top,turnKey:c.turnKey,viewportHeightPx:n.clientHeight});if(a===null)throw Error(`Codex virtual turn is missing: ${c.turnKey}`);n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-a)}),p(a,n.clientHeight||V),queueMicrotask(()=>{if(v.current!==c)return;c.complete(),v.current=null,ue(null)})},[i,c,n,p]),w(()=>{let e=se.current;if(se.current=i,S.current=i,n===null||c!==null){O.current=null;return}let t=O.current;O.current=null;let o=t===null?void 0:n.contains(t.element)?t.element:P.current.get(t.key);if(h&&e!==i&&t!==null&&o!==void 0){let u=o.getBoundingClientRect().top-n.getBoundingClientRect().top,a=n.scrollTop-t.scrollTop;n.scrollTop+=u-t.top+a,p(A(n),n.clientHeight);return}let r=N.current;if(h&&e!==i&&Q.current)r=Math.max(0,e.totalHeightPx-n.clientHeight-n.scrollTop);if((r>24||h)&&e!==i){let u=A(n);if(u<=96&&!h){p(u,y);return}let a=me({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=Hn({anchorKey:B,distanceFromBottomPx:r,nextLayout:i,previousLayout:e});if(f===null)throw Error(`Codex viewport anchor is missing: ${B}`);r=f,n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-r)})}}p(r,y)},[i,c,A,n,p,y,h]),w(()=>{k.current=M},[M]),ge(()=>()=>{v.current?.complete(),v.current=null;let e=k.current,o=S.current.turnKeys[e.startIndex];he.set(H,{distanceFromBottomPx:N.current,renderedWindow:o===void 0?null:{anchorKey:o,count:e.endIndex-e.startIndex},turnHeightsByKey:l.current})},[H]),pe(T,()=>({scrollToKey(e,t=(r)=>r,o={align:"center"}){v.current?.complete();let r=i.turnIndexByKey.get(e);if(r===void 0)throw Error(`Codex virtual turn is missing: ${e}`);let u=i.turnKeys[r],a=On({layout:i,turnKey:e,viewportHeightPx:y});if(a===null)throw Error(`Codex virtual turn is missing: ${e}`);let g=me({distanceFromBottomPx:a,layout:i,overscanCount:X,viewportHeightPx:y});return k.current=g,ie(g),new Promise((B)=>{let f={align:o.align,complete:B,getTargetElement:t,turnKey:u};v.current=f,ue(f)})}}),[i,y]);let I=M,G=ae.current;if(!(G===i.turnKeys||G.length===i.turnKeys.length&&G.every((e,t)=>e===i.turnKeys[t]))){let e=G[M.startIndex];I=(e===void 0?null:Dt({anchorKey:e,layout:i,previousRange:M}))??me({distanceFromBottomPx:N.current,layout:i,overscanCount:X,viewportHeightPx:y})}let ee=x.length-1,le=x[ee],te=x.slice(I.startIndex,Math.min(I.endIndex,ee)).map((e,t)=>({entry:e,index:I.startIndex+t}));if(le!==void 0)te.push({entry:le,index:ee});return re("div",{"data-codex-timeline":!0,"data-codex-virtualized-pending-key":c?.turnKey,"data-codex-virtualized-range":`${I.startIndex}:${I.endIndex}`,"data-codex-virtualized-total-count":x.length,"data-codex-virtualized-turn-count":te.length,className:"relative shrink-0",style:{height:i.totalHeightPx},children:[b&&R("div",{ref:_,"data-codex-timeline-leading":!0,className:"absolute inset-x-0 top-0",children:L}),te.map(({entry:e,index:t})=>R("div",{className:"absolute inset-x-0",style:{top:i.topOffsetsPx[t]??0},children:R(He,{turnKey:e.turnKey,heightPx:i.heightsPx[t],placeholder:e.placeholder,deferUntilReady:e.deferUntilReady,observe:ye,onReady:xe,children:W(e,t)})},e.turnKey))]})});
1
+ import{_n,me,Dt,Hn,On,Fn}from"./chunk-0gwe31zs.js";import{forwardRef as ve,useCallback as K,useEffect as ge,useImperativeHandle as pe,useLayoutEffect as w,useMemo as ne,useRef as s,useState as F}from"react";import{jsx as R,jsxs as re}from"react/jsx-runtime";var Re=12,X=2,V=800,he=new Map;function He({turnKey:q,heightPx:x,placeholder:W=!1,deferUntilReady:n=!1,observe:H,onReady:L,children:z}){let h=s(null),[T,_]=F(!1),U=K((m)=>{h.current=m,H(q,m)},[H,q]);return w(()=>{let m=h.current;if(m===null)throw Error("Codex turn element is missing");let b=()=>{L(m),_(!0)};if(m.querySelector("[data-markdown-pending]")===null){b();return}let d=new MutationObserver(()=>{if(m.querySelector("[data-markdown-pending]")!==null)return;d.disconnect(),b()});return d.observe(m,{childList:!0,subtree:!0}),()=>d.disconnect()},[L]),re("div",{style:T?void 0:{position:"relative",height:x,overflow:"hidden"},children:[R("div",{ref:U,className:"[&_[data-virtualized-turn-content]]:[content-visibility:visible]","data-turn-key":q,"aria-busy":!T||void 0,style:!T&&!W&&n?{visibility:"hidden"}:void 0,"data-turn-ready":T?"":void 0,children:z}),!T&&!W&&n&&R("div",{"aria-hidden":"true",className:"codex-turn-loading",children:re("div",{className:"codex-turn-loading-lines",children:[R("span",{}),R("span",{}),R("span",{})]})})]})}var Dn=ve(function({entries:x,renderTurn:W,scrollElement:n,sessionKey:H,leadingContent:L,leadingInsetPx:z=0,preserveViewport:h=!1},T){let _=s(null),[U,m]=F(z),b=L!==void 0&&L!==null;w(()=>{let e=_.current;if(e===null)return;let t=()=>m(e.getBoundingClientRect().height);t();let o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[b]);let d=ne(()=>he.get(H),[H]),[j,J]=F(()=>d?.turnHeightsByKey??{}),i=ne(()=>_n({entries:x,gapPx:Re,measuredHeightsByKey:j,leadingInsetPx:b?U:z}),[x,j,b,U,z]),fe=ne(()=>{let e=me({distanceFromBottomPx:d?.distanceFromBottomPx??0,layout:i,overscanCount:X,viewportHeightPx:V}),t=d?.renderedWindow;if(t===void 0||t===null)return e;return Dt({anchorKey:t.anchorKey,layout:i,previousRange:{startIndex:0,endIndex:Math.min(t.count,e.endIndex-e.startIndex)}})??e},[d,i]),[M,ie]=F(fe),[y,oe]=F(V),[c,ue]=F(null),N=s(d?.distanceFromBottomPx??0),k=s(M),ae=s(i.turnKeys),l=s(j),S=s(i),se=s(i),P=s(new Map),v=s(null),C=s(null),E=s(null),D=s(new Map),Q=s(!1),ce=s(()=>{}),O=s(null),de=K(()=>{if(!h||n===null||v.current!==null||O.current!==null)return;let e=n.getBoundingClientRect();if(e.height<=0)return;let t=[...P.current].filter(([,r])=>r.hasAttribute("data-turn-ready")).map(([r,u])=>{let a=u.getBoundingClientRect(),g=S.current.turnIndexByKey.get(r),B=g===void 0?a.height:S.current.heightsPx[g];return{key:r,element:u,rect:a,bottom:a.top+B}}).filter(({rect:r,bottom:u})=>u>e.top&&r.top<e.bottom).toSorted((r,u)=>r.rect.top-u.rect.top),o=t.flatMap((r)=>[...r.element.querySelectorAll("[data-user-message-bubble], .codex-markdown-root > *")].filter((u)=>!u.closest('[aria-hidden="true"], [inert]')).map((u)=>({key:r.key,element:u,rect:u.getBoundingClientRect()})).filter(({rect:u})=>u.height>0&&u.top>=e.top&&u.top<e.bottom)).toSorted((r,u)=>r.rect.top-u.rect.top)[0]??t[0];if(o)O.current={key:o.key,element:o.element,top:o.rect.top-e.top,scrollTop:n.scrollTop}},[h,n]),Y=s(de);Y.current=de;let p=K((e,t)=>{let o=Math.min(e,i.totalHeightPx),r=me({distanceFromBottomPx:o,layout:i,overscanCount:X,viewportHeightPx:t}),u=k.current,a=u.startIndex<=r.startIndex&&u.endIndex>=r.endIndex?u:r;if(N.current=o,k.current=a,ae.current=i.turnKeys,oe(t),a!==u)ie(a)},[i]),A=K((e)=>{let t=Math.max(0,e.scrollHeight-i.totalHeightPx);return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop-t)},[i.totalHeightPx]),xe=K((e)=>{let t=e.dataset.turnKey;if(t===void 0)throw Error("Codex measured turn is missing its key");let o=Math.max(1,e.getBoundingClientRect().height);if(l.current[t]===o)return;Y.current();let r={...l.current,[t]:o};l.current=r,J(r)},[]),Z=K(()=>{if(C.current!==null)return C.current;return C.current=new ResizeObserver((e)=>{for(let t of e){let o=t.target;if(!("turnReady"in o.dataset)&&o.querySelector("[data-markdown-pending]")!==null)continue;let r=o.dataset.turnKey;if(r===void 0)throw Error("Codex measured turn is missing its key");let u=Math.max(1,t.borderBoxSize[0]?.blockSize??t.contentRect.height);D.current.set(r,u)}if(E.current!==null||D.current.size===0)return;E.current=requestAnimationFrame(()=>{E.current=null;let t=[...D.current].filter(([r,u])=>l.current[r]!==u);if(D.current.clear(),t.length===0)return;Y.current();let o={...l.current,...Object.fromEntries(t)};l.current=o,J(o)})}),C.current},[]),ye=K((e,t)=>{let o=P.current.get(e);if(o!==void 0)Z().unobserve(o),P.current.delete(e);if(t===null)return;if(t.dataset.turnKey!==e)throw Error(`Codex turn key does not match its element: ${e}`);P.current.set(e,t),Z().observe(t)},[Z]);ge(()=>()=>{if(C.current?.disconnect(),E.current!==null)cancelAnimationFrame(E.current);D.current.clear(),C.current=null,P.current.clear()},[]),w(()=>{ce.current=()=>{if(n===null)return;let e=A(n);if(v.current!==null){N.current=e,oe(n.clientHeight||V);return}p(e,n.clientHeight||V)}},[A,n,p]),w(()=>{if(n===null)return;if(!Q.current){Q.current=!0;let o=d?.distanceFromBottomPx??0;n.scrollTo({behavior:"instant",top:Math.max(0,o>0?S.current.totalHeightPx-n.clientHeight-o:n.scrollHeight-n.clientHeight)})}let e=()=>ce.current();e(),n.addEventListener("scroll",e,{passive:!0});let t=new ResizeObserver(e);return t.observe(n),()=>{n.removeEventListener("scroll",e),t.disconnect()}},[d,n]),w(()=>{if(n===null||c===null)return;let e=P.current.get(c.turnKey);if(e?.querySelector("[data-markdown-pending]")!==null)return;let t=e.offsetHeight;if(t<=0)return;if(l.current[c.turnKey]!==t){let g={...l.current,[c.turnKey]:t};l.current=g,J(g);return}let o=c.getTargetElement(e)??e,r=e.getBoundingClientRect(),u=o.getBoundingClientRect(),a=Fn({align:c.align,layout:i,targetHeightPx:u.height,targetOffsetPx:u.top-r.top,turnKey:c.turnKey,viewportHeightPx:n.clientHeight});if(a===null)throw Error(`Codex virtual turn is missing: ${c.turnKey}`);n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-a)}),p(a,n.clientHeight||V),queueMicrotask(()=>{if(v.current!==c)return;c.complete(),v.current=null,ue(null)})},[i,c,n,p]),w(()=>{let e=se.current;if(se.current=i,S.current=i,n===null||c!==null){O.current=null;return}let t=O.current;O.current=null;let o=t===null?void 0:n.contains(t.element)?t.element:P.current.get(t.key);if(h&&e!==i&&t!==null&&o!==void 0){let u=o.getBoundingClientRect().top-n.getBoundingClientRect().top,a=n.scrollTop-t.scrollTop;n.scrollTop+=u-t.top+a,p(A(n),n.clientHeight);return}let r=N.current;if(h&&e!==i&&Q.current)r=Math.max(0,e.totalHeightPx-n.clientHeight-n.scrollTop);if((r>24||h)&&e!==i){let u=A(n);if(u<=96&&!h){p(u,y);return}let a=me({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=Hn({anchorKey:B,distanceFromBottomPx:r,nextLayout:i,previousLayout:e});if(f===null)throw Error(`Codex viewport anchor is missing: ${B}`);r=f,n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-r)})}}p(r,y)},[i,c,A,n,p,y,h]),w(()=>{k.current=M},[M]),ge(()=>()=>{v.current?.complete(),v.current=null;let e=k.current,o=S.current.turnKeys[e.startIndex];he.set(H,{distanceFromBottomPx:N.current,renderedWindow:o===void 0?null:{anchorKey:o,count:e.endIndex-e.startIndex},turnHeightsByKey:l.current})},[H]),pe(T,()=>({scrollToKey(e,t=(r)=>r,o={align:"center"}){v.current?.complete();let r=i.turnIndexByKey.get(e);if(r===void 0)throw Error(`Codex virtual turn is missing: ${e}`);let u=i.turnKeys[r],a=On({layout:i,turnKey:e,viewportHeightPx:y});if(a===null)throw Error(`Codex virtual turn is missing: ${e}`);let g=me({distanceFromBottomPx:a,layout:i,overscanCount:X,viewportHeightPx:y});return k.current=g,ie(g),new Promise((B)=>{let f={align:o.align,complete:B,getTargetElement:t,turnKey:u};v.current=f,ue(f)})}}),[i,y]);let I=M,G=ae.current;if(!(G===i.turnKeys||G.length===i.turnKeys.length&&G.every((e,t)=>e===i.turnKeys[t]))){let e=G[M.startIndex];I=(e===void 0?null:Dt({anchorKey:e,layout:i,previousRange:M}))??me({distanceFromBottomPx:N.current,layout:i,overscanCount:X,viewportHeightPx:y})}let ee=x.length-1,le=x[ee],te=x.slice(I.startIndex,Math.min(I.endIndex,ee)).map((e,t)=>({entry:e,index:I.startIndex+t}));if(le!==void 0)te.push({entry:le,index:ee});return re("div",{"data-codex-timeline":!0,"data-codex-virtualized-pending-key":c?.turnKey,"data-codex-virtualized-range":`${I.startIndex}:${I.endIndex}`,"data-codex-virtualized-total-count":x.length,"data-codex-virtualized-turn-count":te.length,className:"relative shrink-0",style:{height:i.totalHeightPx},children:[b&&R("div",{ref:_,"data-codex-timeline-leading":!0,className:"absolute inset-x-0 top-0",children:L}),te.map(({entry:e,index:t})=>R("div",{className:"absolute inset-x-0",style:{top:i.topOffsetsPx[t]??0},children:R(He,{turnKey:e.turnKey,heightPx:i.heightsPx[t],placeholder:e.placeholder,deferUntilReady:e.deferUntilReady,observe:ye,onReady:xe,children:W(e,t)})},e.turnKey))]})});
2
2
  export{Dn};
@@ -1 +1 @@
1
- import{e}from"./chunk-cg97byvk.js";import{cva as i}from"class-variance-authority";import{cn as r}from"cn";import{jsx as o}from"react/jsx-runtime";function nr({className:a,...t}){return o("div",{"data-slot":"input-group",role:"group",className:r("group/input-group border-input has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...t})}var p=i("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function on({className:a,align:t="inline-start",...s}){return o("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:r(p({align:t}),a),onClick:(n)=>{if(n.target.closest("button"))return;n.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}var l=i("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function rn({className:a,type:t="button",variant:s="ghost",size:n="xs",...u}){return o(e,{type:t,"data-size":n,variant:s,className:r(l({size:n}),a),...u})}function Ci({className:a,...t}){return o("span",{className:r("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",a),...t})}export{nr,on,rn,Ci};
1
+ import{e}from"./chunk-6kn920c5.js";import{cva as i}from"class-variance-authority";import{cn as r}from"cn";import{jsx as o}from"react/jsx-runtime";function nr({className:a,...t}){return o("div",{"data-slot":"input-group",role:"group",className:r("group/input-group border-input has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 relative flex h-9 w-full min-w-0 items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-3 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",a),...t})}var p=i("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]","inline-end":"order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]","block-start":"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2","block-end":"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"}},defaultVariants:{align:"inline-start"}});function on({className:a,align:t="inline-start",...s}){return o("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:r(p({align:t}),a),onClick:(n)=>{if(n.target.closest("button"))return;n.currentTarget.parentElement?.querySelector("input")?.focus()},...s})}var l=i("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",sm:"","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function rn({className:a,type:t="button",variant:s="ghost",size:n="xs",...u}){return o(e,{type:t,"data-size":n,variant:s,className:r(l({size:n}),a),...u})}function Ti({className:a,...t}){return o("span",{className:r("text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",a),...t})}export{nr,on,rn,Ti};
@@ -1,2 +1,2 @@
1
- import{cn as i}from"cn";import{jsx as t,jsxs as s}from"react/jsx-runtime";var Ie="group/trailing";function se({children:n,className:e}){return t("span",{className:i("flex w-5 shrink-0 items-center justify-center whitespace-nowrap",e),children:n})}function Se({content:n,actions:e,className:r}){if(n==null&&e==null)return null;return s("span",{className:i("group/swap relative flex min-h-5 min-w-5 shrink-0 items-center justify-end",r),children:[n!=null&&t("span",{className:i("flex items-center justify-end",e!=null&&"group-focus-within/trailing:hidden group-hover/trailing:hidden group-has-[[data-popup-open]]/swap:hidden"),children:n}),e!=null&&t("span",{className:"absolute inset-y-0 end-0 hidden w-max items-center justify-end gap-0.5 group-focus-within/trailing:flex group-hover/trailing:flex has-[[data-popup-open]]:flex",onClick:(a)=>a.stopPropagation(),onKeyDown:(a)=>a.stopPropagation(),children:e})]})}
2
- export{Ie,se,Se};
1
+ import{cn as i}from"cn";import{jsx as t,jsxs as s}from"react/jsx-runtime";var Se="group/trailing";function se({children:n,className:e}){return t("span",{className:i("flex w-5 shrink-0 items-center justify-center whitespace-nowrap",e),children:n})}function Ie({content:n,actions:e,className:r}){if(n==null&&e==null)return null;return s("span",{className:i("group/swap relative flex min-h-5 min-w-5 shrink-0 items-center justify-end",r),children:[n!=null&&t("span",{className:i("flex items-center justify-end",e!=null&&"group-focus-within/trailing:hidden group-hover/trailing:hidden group-has-[[data-popup-open]]/swap:hidden"),children:n}),e!=null&&t("span",{className:"absolute inset-y-0 end-0 hidden w-max items-center justify-end gap-0.5 group-focus-within/trailing:flex group-hover/trailing:flex has-[[data-popup-open]]:flex",onClick:(a)=>a.stopPropagation(),onKeyDown:(a)=>a.stopPropagation(),children:e})]})}
2
+ export{Se,se,Ie};
@@ -1 +1 @@
1
- import{f}from"./chunk-ek06eyp4.js";import{Q}from"./chunk-ksv9pjc2.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 At({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 Lt({className:a,variant:e="legend",...o}){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),...o})}function Mn({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 Rn({className:a,orientation:e="vertical",...o}){return t("div",{role:"group","data-slot":"field","data-orientation":e,className:l(c({orientation:e}),a),...o})}function Jr({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 En({className:a,...e}){return t(f,{"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 ei({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 at({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 ti({children:a,className:e,...o}){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),...o,children:[t(Q,{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 ni({className:a,children:e,errors:o,...s}){let i=u(()=>{if(e)return e;if(!o?.length)return null;let r=[...new Map(o.map((d)=>[d?.message,d])).values()];if(r?.length==1)return r[0]?.message;return t("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:r.map((d,n)=>d?.message&&t("li",{children:d.message},n))})},[e,o]);if(!i)return null;return t("div",{role:"alert","data-slot":"field-error",className:l("text-destructive text-sm font-normal",a),...s,children:i})}export{At,Lt,Mn,Rn,Jr,En,ei,at,ti,ni};
1
+ import{f}from"./chunk-ek06eyp4.js";import{Q}from"./chunk-ksv9pjc2.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 At({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 Lt({className:a,variant:e="legend",...o}){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),...o})}function Mn({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 Rn({className:a,orientation:e="vertical",...o}){return t("div",{role:"group","data-slot":"field","data-orientation":e,className:l(c({orientation:e}),a),...o})}function ei({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 En({className:a,...e}){return t(f,{"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 ti({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 at({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 ni({children:a,className:e,...o}){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),...o,children:[t(Q,{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 oi({className:a,children:e,errors:o,...s}){let i=u(()=>{if(e)return e;if(!o?.length)return null;let r=[...new Map(o.map((d)=>[d?.message,d])).values()];if(r?.length==1)return r[0]?.message;return t("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:r.map((d,n)=>d?.message&&t("li",{children:d.message},n))})},[e,o]);if(!i)return null;return t("div",{role:"alert","data-slot":"field-error",className:l("text-destructive text-sm font-normal",a),...s,children:i})}export{At,Lt,Mn,Rn,ei,En,ti,at,ni,oi};
@@ -1,2 +1,2 @@
1
- import{e}from"./chunk-cg97byvk.js";import{t}from"./chunk-dp8pjv6r.js";import{codexTurnError as h}from"@nyssance/codex-acp-v2/client";import{AlertCircleIcon as R}from"lucide-react";import{useEffect as C,useRef as u,useState as i}from"react";import{jsx as o,jsxs as m}from"react/jsx-runtime";function Gt({children:c}){return m("div",{className:"codex-error-message",role:"alert",children:[o(R,{"aria-hidden":"true"}),o("div",{className:"min-w-0 flex-1",children:c})]})}function Wt({error:c,retry:r}){let{t:f}=t(),p=h(c),[l]=i(()=>r?.delaySeconds==null?null:Date.now()+r.delaySeconds*1000),[v,y]=i(r?.delaySeconds??null),[T,x]=i(!1),[g,w]=i(null),a=u(!1),E=u(!1),S=u(r?.run);S.current=r?.run;let b=u((N)=>{let s=S.current;if(a.current||s===void 0)return;a.current=!0,x(!0),w(null),s(N).catch((n)=>{E.current=!0,a.current=!1,y(null),x(!1),w(n instanceof Error?n.message:String(n))})}),d=r!==void 0&&p.retryable;return C(()=>{if(!d||l===null)return;let s=setInterval(()=>{if(E.current||a.current)return;let n=Math.max(0,Math.ceil((l-Date.now())/1000));if(y(n),n===0)b.current("automatic")},1000);return()=>clearInterval(s)},[l,d]),m(Gt,{children:[m("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[o("div",{className:"min-w-0 flex-1 whitespace-pre-wrap",children:p.message}),d&&o(e,{variant:"outline",size:"sm",disabled:T,onClick:()=>b.current("manual"),children:v===null?f("timeline.retry"):f("timeline.retryCountdown",{seconds:v})})]}),g!==null&&o("div",{className:"text-muted-foreground mt-2 text-sm",children:g})]})}
1
+ import{e}from"./chunk-6kn920c5.js";import{t}from"./chunk-dp8pjv6r.js";import{codexTurnError as h}from"@nyssance/codex-acp-v2/client";import{AlertCircleIcon as R}from"lucide-react";import{useEffect as C,useRef as u,useState as i}from"react";import{jsx as o,jsxs as m}from"react/jsx-runtime";function Gt({children:c}){return m("div",{className:"codex-error-message",role:"alert",children:[o(R,{"aria-hidden":"true"}),o("div",{className:"min-w-0 flex-1",children:c})]})}function Wt({error:c,retry:r}){let{t:f}=t(),p=h(c),[l]=i(()=>r?.delaySeconds==null?null:Date.now()+r.delaySeconds*1000),[v,y]=i(r?.delaySeconds??null),[T,x]=i(!1),[g,w]=i(null),a=u(!1),E=u(!1),S=u(r?.run);S.current=r?.run;let b=u((N)=>{let s=S.current;if(a.current||s===void 0)return;a.current=!0,x(!0),w(null),s(N).catch((n)=>{E.current=!0,a.current=!1,y(null),x(!1),w(n instanceof Error?n.message:String(n))})}),d=r!==void 0&&p.retryable;return C(()=>{if(!d||l===null)return;let s=setInterval(()=>{if(E.current||a.current)return;let n=Math.max(0,Math.ceil((l-Date.now())/1000));if(y(n),n===0)b.current("automatic")},1000);return()=>clearInterval(s)},[l,d]),m(Gt,{children:[m("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[o("div",{className:"min-w-0 flex-1 whitespace-pre-wrap",children:p.message}),d&&o(e,{variant:"outline",size:"sm",disabled:T,onClick:()=>b.current("manual"),children:v===null?f("timeline.retry"):f("timeline.retryCountdown",{seconds:v})})]}),g!==null&&o("div",{className:"text-muted-foreground mt-2 text-sm",children:g})]})}
2
2
  export{Gt,Wt};