@alwith/module-chat 0.5.15 → 0.5.17

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 (151) hide show
  1. package/dist/approval/choice-elicitation-form.js +1 -1
  2. package/dist/approval/choice-schema.js +1 -1
  3. package/dist/approval/schema-elicitation-form.js +1 -1
  4. package/dist/{chunk-20mzyay7.js → chunk-0dnwqm94.js} +1 -1
  5. package/dist/{chunk-g5gz25jy.js → chunk-0n3q4g7y.js} +2 -2
  6. package/dist/{chunk-6acs2hzs.js → chunk-0ss92kxr.js} +2 -2
  7. package/dist/{chunk-3w0wbv9c.js → chunk-14r2ktqe.js} +2 -2
  8. package/dist/{chunk-6k4mbmg1.js → chunk-1gp5f49d.js} +1 -1
  9. package/dist/{chunk-vk36fprb.js → chunk-2ahqcs3n.js} +2 -2
  10. package/dist/{chunk-7f89k828.js → chunk-2cbya1f5.js} +1 -1
  11. package/dist/{chunk-4andq00q.js → chunk-2mmhpb9s.js} +2 -2
  12. package/dist/{chunk-qpmjezsw.js → chunk-2rperg04.js} +1 -1
  13. package/dist/{chunk-40d5the9.js → chunk-2swp3nfs.js} +2 -2
  14. package/dist/{chunk-zzhwfrzb.js → chunk-3ebdnbcj.js} +1 -1
  15. package/dist/{chunk-dxnttcwd.js → chunk-3k5n3809.js} +1 -1
  16. package/dist/{chunk-0pv9mq6d.js → chunk-3my2mbn9.js} +2 -2
  17. package/dist/{chunk-z3mp9z01.js → chunk-465r54av.js} +1 -1
  18. package/dist/{chunk-rxc15vtr.js → chunk-4zzhckab.js} +2 -2
  19. package/dist/{chunk-c493d8ay.js → chunk-58wt406v.js} +1 -1
  20. package/dist/{chunk-61944cv6.js → chunk-59j0p8hy.js} +2 -2
  21. package/dist/{chunk-qvknvzqn.js → chunk-5p1cs4vg.js} +2 -2
  22. package/dist/{chunk-t1j88bvm.js → chunk-65m4bm74.js} +2 -2
  23. package/dist/{chunk-56e8naj1.js → chunk-6b1hdb25.js} +1 -1
  24. package/dist/{chunk-f4a1my6v.js → chunk-6nnwmqqp.js} +2 -2
  25. package/dist/{chunk-p1wnt0e5.js → chunk-74824tng.js} +1 -1
  26. package/dist/{chunk-4tff1nyj.js → chunk-7ap638hx.js} +1 -1
  27. package/dist/{chunk-1aeswxaf.js → chunk-7jdjdnh6.js} +1 -1
  28. package/dist/chunk-7mr1zajc.js +4 -0
  29. package/dist/{chunk-m2jsfvs2.js → chunk-7wyrcphh.js} +1 -1
  30. package/dist/{chunk-egqxz6f8.js → chunk-88cfz41t.js} +2 -2
  31. package/dist/{chunk-zjmqne2f.js → chunk-8bfnjqkg.js} +1 -1
  32. package/dist/{chunk-r4r5ythb.js → chunk-8g09jrj1.js} +2 -2
  33. package/dist/{chunk-7qrz8zq8.js → chunk-91h14q3y.js} +2 -2
  34. package/dist/{chunk-9zmkj0dp.js → chunk-9scwmd07.js} +3 -3
  35. package/dist/{chunk-q4btsq6a.js → chunk-9v7zgsa9.js} +3 -3
  36. package/dist/{chunk-0keppemg.js → chunk-as1cvbzm.js} +2 -2
  37. package/dist/{chunk-cjmjv7pv.js → chunk-bew4srqj.js} +1 -1
  38. package/dist/{chunk-h2gng003.js → chunk-bnj58bev.js} +2 -2
  39. package/dist/{chunk-2aqv0chk.js → chunk-bv4adcrd.js} +1 -1
  40. package/dist/{chunk-nbkkfyss.js → chunk-c1vavp0q.js} +1 -1
  41. package/dist/{chunk-n8kfbg68.js → chunk-c26vy827.js} +2 -2
  42. package/dist/{chunk-dyp6kjqz.js → chunk-c2bkhrcc.js} +2 -2
  43. package/dist/{chunk-7zrnt6zw.js → chunk-cazdmcwd.js} +2 -2
  44. package/dist/{chunk-7eje3z81.js → chunk-d94rmh12.js} +1 -1
  45. package/dist/{chunk-pzth3knm.js → chunk-ebmbz9tg.js} +1 -1
  46. package/dist/{chunk-cf5mxxyp.js → chunk-ewvhf3wb.js} +2 -2
  47. package/dist/{chunk-aarvddmn.js → chunk-gdpa9dp5.js} +1 -1
  48. package/dist/{chunk-25bzk1wv.js → chunk-h68f23r0.js} +1 -1
  49. package/dist/{chunk-pafshe3v.js → chunk-hfaarm10.js} +2 -2
  50. package/dist/{chunk-5cnw6yc7.js → chunk-jdjk6tf4.js} +1 -1
  51. package/dist/{chunk-2mkqpzzx.js → chunk-jfb6a7tz.js} +1 -1
  52. package/dist/{chunk-r9p03chx.js → chunk-kmhwwzga.js} +1 -1
  53. package/dist/{chunk-z4zm74ge.js → chunk-ktjma5ts.js} +2 -2
  54. package/dist/{chunk-y2z94rrh.js → chunk-m9en74e3.js} +2 -2
  55. package/dist/{chunk-b9hjn4a5.js → chunk-nqv69z6n.js} +2 -2
  56. package/dist/{chunk-2ecx1xed.js → chunk-qca5mhqd.js} +1 -1
  57. package/dist/{chunk-y3567zfn.js → chunk-rf9yxbes.js} +2 -2
  58. package/dist/{chunk-x7jtngzd.js → chunk-s0zbha64.js} +1 -1
  59. package/dist/{chunk-nt224frq.js → chunk-sf6ze845.js} +1 -1
  60. package/dist/{chunk-nact4a4b.js → chunk-t1yzfva7.js} +1 -1
  61. package/dist/{chunk-frqg34kq.js → chunk-txn8v2yc.js} +1 -1
  62. package/dist/{chunk-vzy4vwqr.js → chunk-tyngss2t.js} +2 -2
  63. package/dist/{chunk-10j68dch.js → chunk-tz96pyvx.js} +2 -2
  64. package/dist/{chunk-xe52kj6h.js → chunk-v29ww61x.js} +3 -3
  65. package/dist/{chunk-jzkmsbpe.js → chunk-v8cyw9xa.js} +1 -1
  66. package/dist/{chunk-aj5fk4ez.js → chunk-vp8fb7r8.js} +1 -1
  67. package/dist/chunk-w1awbykg.js +2 -0
  68. package/dist/{chunk-4ed8as5d.js → chunk-w390ewja.js} +1 -1
  69. package/dist/{chunk-jkwf97cs.js → chunk-wrkwz65x.js} +2 -2
  70. package/dist/chunk-xe3h32y1.js +4 -0
  71. package/dist/{chunk-7jyekmy9.js → chunk-yy4tw3nj.js} +2 -2
  72. package/dist/chunk-zbe8myhx.js +3 -0
  73. package/dist/codex/activity-group.js +1 -1
  74. package/dist/codex/assistant-message.js +1 -1
  75. package/dist/codex/async-question-card.js +1 -1
  76. package/dist/codex/edited-files-card.d.ts +2 -1
  77. package/dist/codex/edited-files-card.js +1 -1
  78. package/dist/codex/markdown-renderer.js +1 -1
  79. package/dist/codex/navigation-audio.js +1 -1
  80. package/dist/codex/styles.css +178 -3
  81. package/dist/codex/timeline-virtualizer.js +1 -1
  82. package/dist/codex/user-message.js +1 -1
  83. package/dist/codex/virtualized-turn-list.js +1 -1
  84. package/dist/composer/completion-filter.js +1 -1
  85. package/dist/composer/completion-menu.js +1 -1
  86. package/dist/composer/effort-slider.js +1 -1
  87. package/dist/composer/menu-radio.js +1 -1
  88. package/dist/composer/model-select.js +1 -1
  89. package/dist/composer/permission-mode-select.js +1 -1
  90. package/dist/composer/prompt-input-attachments.js +1 -1
  91. package/dist/composer/prompt-input-context.js +1 -1
  92. package/dist/composer/prompt-input-textarea.js +1 -1
  93. package/dist/composer/prompt-input.js +1 -1
  94. package/dist/conversation/action-card.js +1 -1
  95. package/dist/conversation/composer/composer.js +1 -1
  96. package/dist/conversation/composer/drafts.js +1 -1
  97. package/dist/conversation/composer/long-text.js +1 -1
  98. package/dist/conversation/composer/mention-chips.js +1 -1
  99. package/dist/conversation/composer/mention-uri.js +1 -1
  100. package/dist/conversation/composer/model-menu.js +1 -1
  101. package/dist/conversation/composer/pasted-text-attachment.js +1 -1
  102. package/dist/conversation/composer/permission-mode-menu.js +1 -1
  103. package/dist/conversation/composer/prediction.js +1 -1
  104. package/dist/conversation/composer/slash-command-button.js +1 -1
  105. package/dist/conversation/composer/submit-button.js +1 -1
  106. package/dist/conversation/composer/usage-meter.js +1 -1
  107. package/dist/conversation/context.js +1 -1
  108. package/dist/conversation/conversation-body.js +1 -1
  109. package/dist/conversation/conversation-view.js +1 -1
  110. package/dist/conversation/conversation.js +1 -1
  111. package/dist/conversation/session-actions.js +1 -1
  112. package/dist/conversation/subagent-sessions.js +1 -1
  113. package/dist/lib/fuzzy.js +1 -1
  114. package/dist/lib/markdown-parser.js +1 -1
  115. package/dist/lib/markdown-rules.js +1 -1
  116. package/dist/lib/model-name.js +1 -1
  117. package/dist/lib/streaming-markdown.js +1 -1
  118. package/dist/search/chat-search.js +1 -1
  119. package/dist/search/dom-matches.js +1 -1
  120. package/dist/search/literal-matches.js +1 -1
  121. package/dist/session-list/archived-sessions.js +1 -1
  122. package/dist/session-list/navigation.js +1 -1
  123. package/dist/session-list/session-info-card.js +1 -1
  124. package/dist/session-list/session-list.js +1 -1
  125. package/dist/session-list/session-row.js +1 -1
  126. package/dist/session-list/session-state-menu.js +1 -1
  127. package/dist/session-list/virtual-session-rows.js +1 -1
  128. package/dist/session-timeline/activity-group.js +1 -1
  129. package/dist/session-timeline/assistant-turn.js +1 -1
  130. package/dist/session-timeline/async-questions.js +1 -1
  131. package/dist/session-timeline/edited-files-card.js +1 -1
  132. package/dist/session-timeline/history-timeline.js +1 -1
  133. package/dist/session-timeline/navigation-rail.js +1 -1
  134. package/dist/session-timeline/session-timeline.js +1 -1
  135. package/dist/session-timeline/timeline-registry.js +1 -1
  136. package/dist/session-timeline/turn-error.js +1 -1
  137. package/dist/session-timeline/turns.js +1 -1
  138. package/dist/session-timeline/types.d.ts +3 -0
  139. package/dist/session-timeline/use-timeline-scroll.js +1 -1
  140. package/dist/session-timeline/user-message.js +1 -1
  141. package/dist/ui/alert.js +1 -1
  142. package/dist/ui/dropdown-menu.js +1 -1
  143. package/dist/ui/field.js +1 -1
  144. package/dist/ui/input-group.js +1 -1
  145. package/dist/ui/select.js +1 -1
  146. package/dist/ui/skeleton.js +1 -1
  147. package/package.json +1 -1
  148. package/dist/chunk-4r3ch7fk.js +0 -2
  149. package/dist/chunk-8e3wcvkd.js +0 -4
  150. package/dist/chunk-en8s7tet.js +0 -4
  151. package/dist/chunk-gtahrx8j.js +0 -3
@@ -1 +1 @@
1
- import{We}from"../chunk-9gv1zffv.js";import{e}from"../chunk-wpdn3rx8.js";import{fe}from"../chunk-2a3tezgr.js";import{s}from"../chunk-96x0d2vd.js";import{v}from"../chunk-kjtd3wc3.js";import{Y,A}from"../chunk-0nkvfecf.js";import{k}from"../chunk-da6d6wze.js";import{fn,St,ae,Ke}from"../chunk-egqxz6f8.js";import{autoUpdate as j}from"@floating-ui/dom";import{cn as H}from"cn";import{useCallback as Q,useEffect as M,useLayoutEffect as O,useMemo as _,useRef as G,useState as R}from"react";import{createPortal as V}from"react-dom";import{jsx as o,jsxs as m}from"react/jsx-runtime";var c="__other__";function le({current:a,total:F,anchorRef:N,t:p,onAccept:I,onDecline:L}){let x=_(()=>a?fn(a.requestedSchema):[],[a]),[S,b]=R({}),T=G(null);M(()=>{if(a?.elicitationId===void 0)return;let t={};for(let{key:l,property:n}of x)if(!ae(n)){let u=Ke(n)[0];if(u)t[l]={selected:u.value}}b(t)},[a?.elicitationId,x]),M(()=>{if(a?.elicitationId!==void 0&&T.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")T.current.focus()},[a?.elicitationId]);let[y,q]=R(null),[C,z]=R(null),E=Q(()=>{let t=N.current;if(!t)return;let l=t.getBoundingClientRect();if(l.width===0){let n=Math.min(640,window.innerWidth*0.9);q({left:(window.innerWidth-n)/2,width:n,bottom:24});return}q({left:l.left,width:l.width,bottom:window.innerHeight-l.bottom+20})},[N]);O(()=>{if(!a)return;let t=0,l=()=>{if(N.current){E();return}t=requestAnimationFrame(l)};return l(),()=>cancelAnimationFrame(t)},[a,E,N]),O(()=>{let t=N.current;if(!a||!t||!C)return;return j(t,C,E,{animationFrame:!0})},[a,C,N,E]);let U=_(()=>{if(!a)return!1;for(let{key:t,property:l}of x){let n=S[t];if(!n)return!1;if(ae(l)){if(!n.selectedSet||n.selectedSet.size===0)return!1;if(n.selectedSet.has(c)&&!n.otherText?.trim())return!1}else{if(!n.selected)return!1;if(n.selected===c&&!n.otherText?.trim())return!1}}return!0},[a,x,S]),D=Q(async()=>{if(!a)return;if(!U)return;let t={},l={};for(let{key:n,property:u}of x){let d=S[n];if(!d)continue;let g;if(ae(u))t[n]=[...d.selectedSet??[]].map((f)=>f===c?(d.otherText??"").trim():f).filter(Boolean);else{let f=d.selected??"";if(t[n]=f===c?(d.otherText??"").trim():f,f!==c)g=Ke(u).find((i)=>i.value===f)?.preview}let h=d.notes?.trim();if(g||h)l[n]={...g&&{preview:g},...h&&{notes:h}}}await I(a.elicitationId,t,l)},[a,x,S,U,I]),B=Q(async()=>{if(a)await L(a.elicitationId)},[a,L]);if(!a||!y)return null;return V(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:[o("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),F>1&&o("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${F}`})]}),o("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:l},n)=>{let u=S[t],d=u?.selected,g=u?.selectedSet??new Set,h=Ke(l),f=ae(l);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[o(We,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:St(l).title??t}),o("div",{className:"text-foreground text-sm font-medium",children:St(l).description})]}),f?m("div",{className:"space-y-1.5 ps-1",children:[h.map((i)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[o(fe,{checked:g.has(i.value),onCheckedChange:(r)=>{b((w)=>{let P=new Set(w[t]?.selectedSet??new Set);if(r)P.add(i.value);else P.delete(i.value);return{...w,[t]:{...w[t],selectedSet:P}}})}}),m("div",{className:"min-w-0 flex-1",children:[o("div",{className:"text-foreground text-sm",children:i.label}),i.description&&o("div",{className:"text-muted-foreground text-xs",children:i.description})]})]},i.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[o(fe,{checked:g.has(c),onCheckedChange:(i)=>{b((r)=>{let w=new Set(r[t]?.selectedSet??new Set);if(i)w.add(c);else w.delete(c);return{...r,[t]:{...r[t],selectedSet:w}}})}}),o("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&o("div",{className:"ps-7",children:o(s,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(i)=>b((r)=>({...r,[t]:{...r[t],otherText:i.target.value}}))})})]}):m(Y,{value:d??"",onValueChange:(i)=>b((r)=>({...r,[t]:{...r[t],selected:i}})),className:"space-y-1.5 ps-1",children:[h.map((i)=>{let r=`${n}:${i.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===i.value&&"bg-muted/60"),children:[o(A,{value:i.value,id:r}),m(v,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer",children:[o("div",{className:"text-foreground text-sm font-normal",children:i.label}),i.description&&o("div",{className:"text-muted-foreground text-xs font-normal",children:i.description})]})]},i.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:[o(A,{value:c,id:`${n}:other`,className:"mt-0.5"}),o(v,{htmlFor:`${n}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&o("div",{className:"ps-7",children:o(s,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(i)=>b((r)=>({...r,[t]:{...r[t],otherText:i.target.value}}))})})]}),!f&&d&&d!==c&&(()=>{let i=h.find((r)=>r.value===d)?.preview;if(!i)return null;return o("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:i})})(),h.some((i)=>i.preview)&&o(k,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(i)=>b((r)=>({...r,[t]:{...r[t],notes:i.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:[o(e,{variant:"ghost",size:"sm",onClick:()=>void B(),children:p("askUserQuestion.cancel")}),o(e,{size:"sm",disabled:!U,onClick:()=>void D(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{le as ChoiceElicitationForm};
1
+ import{We}from"../chunk-9gv1zffv.js";import{e}from"../chunk-wpdn3rx8.js";import{fe}from"../chunk-2a3tezgr.js";import{s}from"../chunk-96x0d2vd.js";import{v}from"../chunk-kjtd3wc3.js";import{Y,A}from"../chunk-0nkvfecf.js";import{k}from"../chunk-da6d6wze.js";import{fn,It,ae,Ke}from"../chunk-88cfz41t.js";import{autoUpdate as j}from"@floating-ui/dom";import{cn as H}from"cn";import{useCallback as Q,useEffect as M,useLayoutEffect as O,useMemo as _,useRef as G,useState as R}from"react";import{createPortal as V}from"react-dom";import{jsx as o,jsxs as m}from"react/jsx-runtime";var c="__other__";function le({current:a,total:F,anchorRef:N,t:p,onAccept:I,onDecline:L}){let x=_(()=>a?fn(a.requestedSchema):[],[a]),[S,b]=R({}),T=G(null);M(()=>{if(a?.elicitationId===void 0)return;let t={};for(let{key:l,property:n}of x)if(!ae(n)){let u=Ke(n)[0];if(u)t[l]={selected:u.value}}b(t)},[a?.elicitationId,x]),M(()=>{if(a?.elicitationId!==void 0&&T.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")T.current.focus()},[a?.elicitationId]);let[y,q]=R(null),[C,z]=R(null),E=Q(()=>{let t=N.current;if(!t)return;let l=t.getBoundingClientRect();if(l.width===0){let n=Math.min(640,window.innerWidth*0.9);q({left:(window.innerWidth-n)/2,width:n,bottom:24});return}q({left:l.left,width:l.width,bottom:window.innerHeight-l.bottom+20})},[N]);O(()=>{if(!a)return;let t=0,l=()=>{if(N.current){E();return}t=requestAnimationFrame(l)};return l(),()=>cancelAnimationFrame(t)},[a,E,N]),O(()=>{let t=N.current;if(!a||!t||!C)return;return j(t,C,E,{animationFrame:!0})},[a,C,N,E]);let U=_(()=>{if(!a)return!1;for(let{key:t,property:l}of x){let n=S[t];if(!n)return!1;if(ae(l)){if(!n.selectedSet||n.selectedSet.size===0)return!1;if(n.selectedSet.has(c)&&!n.otherText?.trim())return!1}else{if(!n.selected)return!1;if(n.selected===c&&!n.otherText?.trim())return!1}}return!0},[a,x,S]),D=Q(async()=>{if(!a)return;if(!U)return;let t={},l={};for(let{key:n,property:u}of x){let d=S[n];if(!d)continue;let g;if(ae(u))t[n]=[...d.selectedSet??[]].map((f)=>f===c?(d.otherText??"").trim():f).filter(Boolean);else{let f=d.selected??"";if(t[n]=f===c?(d.otherText??"").trim():f,f!==c)g=Ke(u).find((i)=>i.value===f)?.preview}let h=d.notes?.trim();if(g||h)l[n]={...g&&{preview:g},...h&&{notes:h}}}await I(a.elicitationId,t,l)},[a,x,S,U,I]),B=Q(async()=>{if(a)await L(a.elicitationId)},[a,L]);if(!a||!y)return null;return V(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:[o("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),F>1&&o("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${F}`})]}),o("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:l},n)=>{let u=S[t],d=u?.selected,g=u?.selectedSet??new Set,h=Ke(l),f=ae(l);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[o(We,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:It(l).title??t}),o("div",{className:"text-foreground text-sm font-medium",children:It(l).description})]}),f?m("div",{className:"space-y-1.5 ps-1",children:[h.map((i)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[o(fe,{checked:g.has(i.value),onCheckedChange:(r)=>{b((w)=>{let P=new Set(w[t]?.selectedSet??new Set);if(r)P.add(i.value);else P.delete(i.value);return{...w,[t]:{...w[t],selectedSet:P}}})}}),m("div",{className:"min-w-0 flex-1",children:[o("div",{className:"text-foreground text-sm",children:i.label}),i.description&&o("div",{className:"text-muted-foreground text-xs",children:i.description})]})]},i.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[o(fe,{checked:g.has(c),onCheckedChange:(i)=>{b((r)=>{let w=new Set(r[t]?.selectedSet??new Set);if(i)w.add(c);else w.delete(c);return{...r,[t]:{...r[t],selectedSet:w}}})}}),o("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&o("div",{className:"ps-7",children:o(s,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(i)=>b((r)=>({...r,[t]:{...r[t],otherText:i.target.value}}))})})]}):m(Y,{value:d??"",onValueChange:(i)=>b((r)=>({...r,[t]:{...r[t],selected:i}})),className:"space-y-1.5 ps-1",children:[h.map((i)=>{let r=`${n}:${i.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===i.value&&"bg-muted/60"),children:[o(A,{value:i.value,id:r}),m(v,{htmlFor:r,className:"min-w-0 flex-1 cursor-pointer",children:[o("div",{className:"text-foreground text-sm font-normal",children:i.label}),i.description&&o("div",{className:"text-muted-foreground text-xs font-normal",children:i.description})]})]},i.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:[o(A,{value:c,id:`${n}:other`,className:"mt-0.5"}),o(v,{htmlFor:`${n}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&o("div",{className:"ps-7",children:o(s,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(i)=>b((r)=>({...r,[t]:{...r[t],otherText:i.target.value}}))})})]}),!f&&d&&d!==c&&(()=>{let i=h.find((r)=>r.value===d)?.preview;if(!i)return null;return o("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:i})})(),h.some((i)=>i.preview)&&o(k,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(i)=>b((r)=>({...r,[t]:{...r[t],notes:i.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:[o(e,{variant:"ghost",size:"sm",onClick:()=>void B(),children:p("askUserQuestion.cancel")}),o(e,{size:"sm",disabled:!U,onClick:()=>void D(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{le as ChoiceElicitationForm};
@@ -1 +1 @@
1
- import{fn,St,ae,Ke}from"../chunk-egqxz6f8.js";export{fn as elicitationFields,St as elicitationLabels,Ke as elicitationOptions,ae as isMultiSelect};
1
+ import{fn,It,ae,Ke}from"../chunk-88cfz41t.js";export{fn as elicitationFields,It as elicitationLabels,Ke as elicitationOptions,ae as isMultiSelect};
@@ -1 +1 @@
1
- import{Ar,yr,Lr,eo}from"../chunk-x7jtngzd.js";import"../chunk-2a3tezgr.js";import"../chunk-c493d8ay.js";import"../chunk-1fm5vx1n.js";import"../chunk-n5xqjct2.js";import"../chunk-4s1rhts0.js";import"../chunk-96x0d2vd.js";import"../chunk-0nkvfecf.js";import"../chunk-kjtd3wc3.js";import"../chunk-da6d6wze.js";import"../chunk-wpdn3rx8.js";export{eo as SchemaElicitationForm,Ar as elicitationFields,yr as initialValues,Lr as isAnswered};
1
+ import{Ar,yr,Lr,eo}from"../chunk-s0zbha64.js";import"../chunk-2a3tezgr.js";import"../chunk-58wt406v.js";import"../chunk-1fm5vx1n.js";import"../chunk-n5xqjct2.js";import"../chunk-4s1rhts0.js";import"../chunk-96x0d2vd.js";import"../chunk-0nkvfecf.js";import"../chunk-kjtd3wc3.js";import"../chunk-da6d6wze.js";import"../chunk-wpdn3rx8.js";export{eo as SchemaElicitationForm,Ar as elicitationFields,yr as initialValues,Lr as isAnswered};
@@ -1,2 +1,2 @@
1
- import{n}from"./chunk-q6km9nha.js";import{o}from"./chunk-6acs2hzs.js";import{codexExtensionCapabilities as T,codexTurnId as w,composerPrediction as j,isBooleanOption as B,isSelectOption as F}from"@nyssance/codex-acp-v2/client";import{useEffect as b,useRef as C,useState as P}from"react";function mt(t,g,c,y){let{client:S}=o(),R=n((e)=>T(e.agent).composerPredictions),k=t.items.findLast((e)=>e.kind==="user"),i=w(k?._meta),O=t.configOptions.flatMap((e)=>F(e)||B(e)?[[e.configId,e.currentValue]]:[]).sort(([e],[u])=>String(e).localeCompare(String(u))),r=JSON.stringify([t.id,i,O]),s=j(t._meta),d=t._meta?.codex,m=typeof d==="object"&&d!==null&&"prediction"in d?d.prediction:null,l=C(null),f=C(!1);b(()=>(f.current=!0,()=>{f.current=!1}),[]);let[a,_]=P(null),[v,x]=P(null),p=y&&R&&g&&t.state==="idle"&&t.lastStopReason==="end_turn"&&!k?.replayed&&i!==null;b(()=>{if(!p||c||a===r||l.current?.key===r||i===null)return;let e={key:r,previousResult:m};l.current=e,x(null),S.requestPrediction(t.id,i).catch((u)=>{if(f.current&&l.current===e)x({key:r,message:u instanceof Error?u.message:String(u)})})},[S,p,c,a,r,m,t.id,i]);let I=p&&!c&&a!==r&&l.current?.key===r&&l.current.previousResult!==m&&s?.sourceTurnId===i,q=I&&s.result.type==="completed"?s.result.text:null,E=y&&g&&t.state==="idle"&&!c&&a!==r?v?.key===r?v.message:I&&s.result.type==="failed"?"Prediction failed":null:null;return{text:q,error:E,invalidate:()=>{if(p)_(r)}}}
1
+ import{n}from"./chunk-q6km9nha.js";import{o}from"./chunk-0ss92kxr.js";import{codexExtensionCapabilities as T,codexTurnId as w,composerPrediction as j,isBooleanOption as B,isSelectOption as F}from"@nyssance/codex-acp-v2/client";import{useEffect as b,useRef as C,useState as P}from"react";function mt(t,g,c,y){let{client:S}=o(),R=n((e)=>T(e.agent).composerPredictions),k=t.items.findLast((e)=>e.kind==="user"),i=w(k?._meta),O=t.configOptions.flatMap((e)=>F(e)||B(e)?[[e.configId,e.currentValue]]:[]).sort(([e],[u])=>String(e).localeCompare(String(u))),r=JSON.stringify([t.id,i,O]),s=j(t._meta),d=t._meta?.codex,m=typeof d==="object"&&d!==null&&"prediction"in d?d.prediction:null,l=C(null),f=C(!1);b(()=>(f.current=!0,()=>{f.current=!1}),[]);let[a,_]=P(null),[v,x]=P(null),p=y&&R&&g&&t.state==="idle"&&t.lastStopReason==="end_turn"&&!k?.replayed&&i!==null;b(()=>{if(!p||c||a===r||l.current?.key===r||i===null)return;let e={key:r,previousResult:m};l.current=e,x(null),S.requestPrediction(t.id,i).catch((u)=>{if(f.current&&l.current===e)x({key:r,message:u instanceof Error?u.message:String(u)})})},[S,p,c,a,r,m,t.id,i]);let I=p&&!c&&a!==r&&l.current?.key===r&&l.current.previousResult!==m&&s?.sourceTurnId===i,q=I&&s.result.type==="completed"?s.result.text:null,E=y&&g&&t.state==="idle"&&!c&&a!==r?v?.key===r?v.message:I&&s.result.type==="failed"?"Prediction failed":null:null;return{text:q,error:E,invalidate:()=>{if(p)_(r)}}}
2
2
  export{mt};
@@ -1,2 +1,2 @@
1
- import{h}from"./chunk-en8s7tet.js";import{codexMessageError as A,nativeTurnId as m,textOf as S,turns as _}from"@nyssance/codex-acp-v2/client";function Wr(t){return t.kind==="tool"&&t.name==="mcp_startup"}function E(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let n=e.phase;return typeof n==="string"?n:null}function w(t){let e=t._meta?.codex;return typeof e==="object"&&e!==null&&e.notice===!0}function Ko(t){return t.user===null&&t.items.length>0&&t.items.every((e)=>e.kind==="assistant"&&w(e))}function T(t,e,n){let o=t.work.at(-1);if(o?.kind==="activity"&&o.items.at(-1)===n){o.items.push(e);return}t.work.push({kind:"activity",key:`activity:${e.kind}:${e.id}`,items:[e]})}function M(t,e,n){if(t.kind!=="tool"){e.push(t);return}let o=n.get(t.id);if(o===void 0)throw Error(`Grouped tool is missing from the session: ${t.id}`);e.push(o);for(let s of t.children)M(s,e,n)}function j(t,e,n,o){switch(e.kind){case"user":break;case"assistant":{if(A(e)!==null){let u=m(e),f=t.errors.findIndex((p)=>u!==null&&m(p)===u);if(f===-1)t.errors.push(e);else t.errors[f]=e;break}let s=E(e),i=e._meta?.codex,d=h(e._meta).length>0||typeof i==="object"&&i!==null&&"delivery"in i&&i.delivery==="async";if(h(e._meta).length>0)t.final.push(e);else if(d)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else if(s==="final_answer")t.final.push(e);else if(s==="commentary"||w(e)||s===null&&n)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else t.final.push(e);break}case"thought":T(t,e,o);break;case"tool":if(T(t,e,o),e.toolKind==="edit")t.edits.push(e);break;case"plan":t.work.push({kind:"plan",key:`plan:${e.id}`,item:e});break;case"compaction":t.work.push({kind:"compaction",key:`compaction:${e.id}`,item:e});break}}function Qo(t,e=[],n=[]){let o=new Map(e.map((r)=>[r.key,r])),s=new Map(t.items.filter((r)=>r.kind==="tool").map((r)=>[r.id,r])),i={...t,items:t.items.filter((r)=>!Wr(r))},d=new Map(n.map((r,a)=>[r.turnId,a])),u=[],f=[u],p,k=null;for(let r of i.items){let a=m(r),l=d.get(a??"");if(a!==null&&k!==null&&a!==k||l!==void 0&&p!==void 0&&l>p+1)u=[],f.push(u);if(u.push(r),a!==null||r.kind==="user")k=a;if(l!==void 0)p=l}return f.flatMap((r)=>_({...i,items:r})).map((r)=>{let a=r.prompt===null?[]:[r.prompt];for(let c of r.entries)M(c,a,s);let l=a[0];if(l===void 0)throw Error("A turn without items");let I=`turn:${l.kind}:${l.id}`,x=r.endedAt??Math.max(...a.map((c)=>c.at)),y=o.get(I);if(y!==void 0&&K(y.items,a)&&y.endedAt===x)return y;let b={key:I,user:r.prompt,work:[],final:[],errors:[],edits:[],startedAt:r.startedAt??l.at,endedAt:x,replayed:a.every(on),items:a},v=a.findLastIndex((c)=>c.kind!=="user"&&c.kind!=="compaction");return a.forEach((c,g)=>j(b,c,g<v,a[g-1])),b})}function K(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}function on(t){let e=t._meta?.codex;return t.replayed||typeof e==="object"&&e!==null&&"historyReplay"in e&&e.historyReplay===!0}function Q(t){return S(t.content)}function Ve(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function rn(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function Xo(t){let e=(s)=>{for(let i of t.items){let d=i._meta?.codex;if(typeof d!=="object"||d===null)continue;let u=d[s];if(typeof u==="number"&&Number.isFinite(u)&&u>=0)return u}return},n=e("workDurationMs"),o=e("turnDurationMs");return{durationMs:n??o,durationKind:n===void 0&&o!==void 0?"total":"work",startedAt:e("workStartedAt")}}function Yo(t,e,n){if(n?.user==null)return!1;let o=e.items.map(m).find((i)=>i!==null),s=m(n.user);if(o!==void 0&&s!==null)return o===s;return!e.items.some((i)=>{let d=i._meta?.codex;return typeof d==="object"&&d!==null&&"turnCompletedAt"in d&&typeof d.turnCompletedAt==="number"})&&t.state!=="idle"&&(n.user.echo==="pending"||n.user.echo==="acknowledged")&&e.user!==null&&t.turnEndedAt[e.user.id]===void 0&&e.errors.length===0}function Zo(t,e){if(t.state==="idle")return;let n=e.length-1;while(n>0){let o=e[n];if(o.items.some((s)=>s.kind!=="user"))break;if(!Yo(t,e[n-1],o))break;n--}return e[n]?.key}function Jo(t,e,n){let o=n,s=n;while(o>0&&Yo(t,e[o-1],e[o]))o--;while(s+1<e.length&&Yo(t,e[s],e[s+1]))s++;let i=e.slice(o,s+1),d=i.findLast((u)=>u.items.some((f)=>f.kind!=="user"))??i[0];return{continued:e[n]!==d,items:i.flatMap((u)=>u.items),edits:i.flatMap((u)=>u.edits),startedAt:i[0].startedAt}}
2
- export{Wr,Ko,Qo,on,Q,Ve,rn,Xo,Yo,Zo,Jo};
1
+ import{h}from"./chunk-7mr1zajc.js";import{codexMessageError as A,nativeTurnId as m,textOf as S,turns as _}from"@nyssance/codex-acp-v2/client";function Wr(t){return t.kind==="tool"&&t.name==="mcp_startup"}function E(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let n=e.phase;return typeof n==="string"?n:null}function w(t){let e=t._meta?.codex;return typeof e==="object"&&e!==null&&e.notice===!0}function Ko(t){return t.user===null&&t.items.length>0&&t.items.every((e)=>e.kind==="assistant"&&w(e))}function T(t,e,n){let o=t.work.at(-1);if(o?.kind==="activity"&&o.items.at(-1)===n){o.items.push(e);return}t.work.push({kind:"activity",key:`activity:${e.kind}:${e.id}`,items:[e]})}function M(t,e,n){if(t.kind!=="tool"){e.push(t);return}let o=n.get(t.id);if(o===void 0)throw Error(`Grouped tool is missing from the session: ${t.id}`);e.push(o);for(let s of t.children)M(s,e,n)}function j(t,e,n,o){switch(e.kind){case"user":break;case"assistant":{if(A(e)!==null){let u=m(e),f=t.errors.findIndex((p)=>u!==null&&m(p)===u);if(f===-1)t.errors.push(e);else t.errors[f]=e;break}let s=E(e),i=e._meta?.codex,d=h(e._meta).length>0||typeof i==="object"&&i!==null&&"delivery"in i&&i.delivery==="async";if(h(e._meta).length>0)t.final.push(e);else if(d)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else if(s==="final_answer")t.final.push(e);else if(s==="commentary"||w(e)||s===null&&n)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else t.final.push(e);break}case"thought":T(t,e,o);break;case"tool":if(T(t,e,o),e.toolKind==="edit")t.edits.push(e);break;case"plan":t.work.push({kind:"plan",key:`plan:${e.id}`,item:e});break;case"compaction":t.work.push({kind:"compaction",key:`compaction:${e.id}`,item:e});break}}function Qo(t,e=[],n=[]){let o=new Map(e.map((r)=>[r.key,r])),s=new Map(t.items.filter((r)=>r.kind==="tool").map((r)=>[r.id,r])),i={...t,items:t.items.filter((r)=>!Wr(r))},d=new Map(n.map((r,a)=>[r.turnId,a])),u=[],f=[u],p,k=null;for(let r of i.items){let a=m(r),l=d.get(a??"");if(a!==null&&k!==null&&a!==k||l!==void 0&&p!==void 0&&l>p+1)u=[],f.push(u);if(u.push(r),a!==null||r.kind==="user")k=a;if(l!==void 0)p=l}return f.flatMap((r)=>_({...i,items:r})).map((r)=>{let a=r.prompt===null?[]:[r.prompt];for(let c of r.entries)M(c,a,s);let l=a[0];if(l===void 0)throw Error("A turn without items");let I=`turn:${l.kind}:${l.id}`,x=r.endedAt??Math.max(...a.map((c)=>c.at)),y=o.get(I);if(y!==void 0&&K(y.items,a)&&y.endedAt===x)return y;let b={key:I,user:r.prompt,work:[],final:[],errors:[],edits:[],startedAt:r.startedAt??l.at,endedAt:x,replayed:a.every(rn),items:a},v=a.findLastIndex((c)=>c.kind!=="user"&&c.kind!=="compaction");return a.forEach((c,g)=>j(b,c,g<v,a[g-1])),b})}function K(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}function rn(t){let e=t._meta?.codex;return t.replayed||typeof e==="object"&&e!==null&&"historyReplay"in e&&e.historyReplay===!0}function Q(t){return S(t.content)}function Ve(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function an(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function Xo(t){let e=(s)=>{for(let i of t.items){let d=i._meta?.codex;if(typeof d!=="object"||d===null)continue;let u=d[s];if(typeof u==="number"&&Number.isFinite(u)&&u>=0)return u}return},n=e("workDurationMs"),o=e("turnDurationMs");return{durationMs:n??o,durationKind:n===void 0&&o!==void 0?"total":"work",startedAt:e("workStartedAt")}}function Yo(t,e,n){if(n?.user==null)return!1;let o=e.items.map(m).find((i)=>i!==null),s=m(n.user);if(o!==void 0&&s!==null)return o===s;return!e.items.some((i)=>{let d=i._meta?.codex;return typeof d==="object"&&d!==null&&"turnCompletedAt"in d&&typeof d.turnCompletedAt==="number"})&&t.state!=="idle"&&(n.user.echo==="pending"||n.user.echo==="acknowledged")&&e.user!==null&&t.turnEndedAt[e.user.id]===void 0&&e.errors.length===0}function Zo(t,e){if(t.state==="idle")return;let n=e.length-1;while(n>0){let o=e[n];if(o.items.some((s)=>s.kind!=="user"))break;if(!Yo(t,e[n-1],o))break;n--}return e[n]?.key}function Jo(t,e,n){let o=n,s=n;while(o>0&&Yo(t,e[o-1],e[o]))o--;while(s+1<e.length&&Yo(t,e[s],e[s+1]))s++;let i=e.slice(o,s+1),d=i.findLast((u)=>u.items.some((f)=>f.kind!=="user"))??i[0];return{continued:e[n]!==d,items:i.flatMap((u)=>u.items),edits:i.flatMap((u)=>u.edits),startedAt:i[0].startedAt}}
2
+ export{Wr,Ko,Qo,rn,Q,Ve,an,Xo,Yo,Zo,Jo};
@@ -1,2 +1,2 @@
1
- import{re}from"./chunk-q6km9nha.js";import{createContext as v,useContext as a,useMemo as l}from"react";import{jsx as r}from"react/jsx-runtime";var i=v(null);function xt({host:n,client:e,children:t}){let s=l(()=>({host:n,client:e}),[n,e]);return r(re,{host:n,client:e,children:r(i,{value:s,children:t})})}function o(){let n=a(i);if(n===null)throw Error("Conversation host is missing");return n}function C(n,e){e.catch((t)=>{if(n.reportError)n.reportError(t);else console.error(t)})}
2
- export{xt,o,C};
1
+ import{re}from"./chunk-q6km9nha.js";import{createContext as v,useContext as a,useMemo as l}from"react";import{jsx as r}from"react/jsx-runtime";var i=v(null);function yt({host:n,client:e,children:t}){let s=l(()=>({host:n,client:e}),[n,e]);return r(re,{host:n,client:e,children:r(i,{value:s,children:t})})}function o(){let n=a(i);if(n===null)throw Error("Conversation host is missing");return n}function C(n,e){e.catch((t)=>{if(n.reportError)n.reportError(t);else console.error(t)})}
2
+ export{yt,o,C};
@@ -1,3 +1,3 @@
1
- import{V,W}from"./chunk-5cnw6yc7.js";import{e}from"./chunk-wpdn3rx8.js";import{u,m,b,K,p,w}from"./chunk-n5xqjct2.js";import{s}from"./chunk-96x0d2vd.js";import{Nt,Mt,Rt,hn,Z}from"./chunk-aarvddmn.js";import{le}from"./chunk-pv35kspb.js";import{g,l,r}from"./chunk-da4m33bg.js";import{se,z,D}from"./chunk-x8kxqtva.js";import{sessionGroup as F}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 h}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";function te({className:f,...n}){return i(hn,{align:"start",alignItemWithTrigger:!1,sideOffset:6,...n,className:fe("max-w-(--available-width) min-w-0 p-1",f)})}function H(f){return f instanceof Error?f.message:String(f)}function Le({children:f}){return i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"flex flex-col gap-8",children:f})})}function dr({Scroll:f=Le}){let{t:n,i18n:B}=g(),v=l(),N=r((t)=>t.archivedSessions),A=r((t)=>t.connection),[O,ie]=h(""),[C,ne]=h("all"),[x,ae]=h("all"),[re,oe]=h(0),[G,Q]=h(!0),[q,U]=h(null),[_,R]=h(null),[I,j]=h(!1),S=ye(!1),[P,y]=h(null),[J,T]=h(null),[ce,M]=h(!1);Se(()=>{if(A!=="ready")return;let t=!1;Q(!0),U(null);async function d(){try{await v.listArchived({reset:!0});let o=new Set;while(!t&&v.state.archivedCursor!==null){let L=v.state.archivedCursor;if(o.has(L))throw Error("Archive pagination returned a repeated cursor");o.add(L),await v.listArchived()}}catch(o){if(!t)U(H(o))}finally{if(!t)Q(!1)}}return d(),()=>{t=!0}},[v,A,re]);let c=r((t)=>t.projectContext),E=!(c!==null&&A==="ready"&&!G&&q===null)||I,k=(t)=>t.title??n("sessionList.untitled"),de=[...new Set(N.filter((t)=>c&&F(c,t).id!==D).map((t)=>c?F(c,t).id:t.cwd))].toSorted(),ue=O.trim().toLocaleLowerCase(B.language),X=N.filter((t)=>{let d=c?F(c,t).id:null,o=d===D;return k(t).toLocaleLowerCase(B.language).includes(ue)&&(C==="all"||(C==="quick"?o:!o))&&(x==="all"||(x==="quick"?o:d===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 v.unarchive(t.sessionId)}catch(d){R(H(d))}finally{S.current=!1,j(!1)}}async function he(){if(S.current||!P)return;S.current=!0,j(!0),T(null);let t=[],d=[];try{for(let o of P){if(!v.state.archivedSessions.some((L)=>L.sessionId===o.sessionId))continue;try{await v.delete(o.sessionId)}catch(L){t.push(o),d.push(`${k(o)}: ${H(L)}`)}}if(t.length)y(t),T(d.join(`
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,{size:"sm",variant:"destructive",className:"h-[30px] text-sm font-normal",disabled:E||N.length===0,onClick:()=>{T(null),M(!0),y([...N])},children:[i(ee,{className:"size-4","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(s,{"aria-label":n("sessionList.archives.search"),placeholder:n("sessionList.archives.search"),value:O,onChange:(t)=>ie(t.target.value),className:"rounded-md ps-9"})]}),a(Nt,{value:C,onValueChange:(t)=>{if(t===null)throw Error("Archive chat type cannot be empty");ne(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.${C==="all"?"allChats":C==="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");ae(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"):z(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:z(t,c??void 0)},t))]})]})]}),a(f,{children:[A!=="ready"?i("p",{role:"status",className:"text-muted-foreground",children:n("sessionList.archives.connecting")}):G?a("div",{role:"status",className:"text-muted-foreground flex items-center gap-2",children:[i(le,{}),n("sessionList.archives.loading")]}):q?i(V,{variant:"destructive",children:a(W,{className:"flex items-center justify-between gap-4",children:[i("span",{children:q}),i(e,{variant:"outline",onClick:()=>oe((t)=>t+1),children:n("sessionList.archives.retry")})]})}):N.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")})]}):X.length===0?i("p",{className:"text-muted-foreground py-12 text-center",children:n("sessionList.archives.noResults")}):(c?se(X,c):[]).filter(([,t])=>t.length>0).map(([t,d])=>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===D?void 0:t,children:[i(Y,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("span",{className:"truncate",children:t===D?n("sessionList.archives.noProject"):z(t,c??void 0)})]}),i("span",{className:"text-muted-foreground shrink-0 text-sm",children:n("sessionList.archives.count",{count:d.length})})]}),i("div",{className:"divide-border divide-y overflow-hidden rounded-lg border",children:d.map((o)=>a("article",{"aria-label":k(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:k(o),children:k(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),M(!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)),_&&i(V,{variant:"destructive",children:i(W,{children:_})})]})]}),i(u,{open:P!==null,onOpenChange:(t)=>{if(!t&&!S.current)y(null)},children:a(m,{showCloseButton:!I,children:[a(b,{children:[i(p,{children:n("sessionList.archives.deleteTitle")}),i(w,{children:n(ce?"sessionList.archives.deleteAllDescription":"sessionList.archives.deleteDescription",{count:P?.length??0})})]}),J&&i(V,{variant:"destructive",children:i(W,{className:"max-h-40 overflow-auto whitespace-pre-wrap",children:J})}),a(K,{children:[i(e,{variant:"outline",disabled:I,onClick:()=>y(null),children:n("sessionList.cancel")}),a(e,{variant:"destructive",className:"text-sm font-normal",disabled:E,onClick:()=>void he(),children:[I&&i(le,{}),n("sessionList.archives.confirmDelete")]})]})]})})]})}
1
+ import{V,W}from"./chunk-jdjk6tf4.js";import{e}from"./chunk-wpdn3rx8.js";import{u,m,b,K,p,w}from"./chunk-n5xqjct2.js";import{s}from"./chunk-96x0d2vd.js";import{Mt,Rt,Et,hn,Z}from"./chunk-gdpa9dp5.js";import{le}from"./chunk-pv35kspb.js";import{g,l,r}from"./chunk-da4m33bg.js";import{se,z,D}from"./chunk-x8kxqtva.js";import{sessionGroup as F}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 h}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";function te({className:f,...n}){return i(hn,{align:"start",alignItemWithTrigger:!1,sideOffset:6,...n,className:fe("max-w-(--available-width) min-w-0 p-1",f)})}function H(f){return f instanceof Error?f.message:String(f)}function Le({children:f}){return i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"flex flex-col gap-8",children:f})})}function dr({Scroll:f=Le}){let{t:n,i18n:B}=g(),v=l(),N=r((t)=>t.archivedSessions),A=r((t)=>t.connection),[O,ie]=h(""),[C,ne]=h("all"),[x,ae]=h("all"),[re,oe]=h(0),[G,Q]=h(!0),[q,U]=h(null),[_,R]=h(null),[I,j]=h(!1),S=ye(!1),[P,y]=h(null),[J,T]=h(null),[ce,M]=h(!1);Se(()=>{if(A!=="ready")return;let t=!1;Q(!0),U(null);async function d(){try{await v.listArchived({reset:!0});let o=new Set;while(!t&&v.state.archivedCursor!==null){let L=v.state.archivedCursor;if(o.has(L))throw Error("Archive pagination returned a repeated cursor");o.add(L),await v.listArchived()}}catch(o){if(!t)U(H(o))}finally{if(!t)Q(!1)}}return d(),()=>{t=!0}},[v,A,re]);let c=r((t)=>t.projectContext),E=!(c!==null&&A==="ready"&&!G&&q===null)||I,k=(t)=>t.title??n("sessionList.untitled"),de=[...new Set(N.filter((t)=>c&&F(c,t).id!==D).map((t)=>c?F(c,t).id:t.cwd))].toSorted(),ue=O.trim().toLocaleLowerCase(B.language),X=N.filter((t)=>{let d=c?F(c,t).id:null,o=d===D;return k(t).toLocaleLowerCase(B.language).includes(ue)&&(C==="all"||(C==="quick"?o:!o))&&(x==="all"||(x==="quick"?o:d===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 v.unarchive(t.sessionId)}catch(d){R(H(d))}finally{S.current=!1,j(!1)}}async function he(){if(S.current||!P)return;S.current=!0,j(!0),T(null);let t=[],d=[];try{for(let o of P){if(!v.state.archivedSessions.some((L)=>L.sessionId===o.sessionId))continue;try{await v.delete(o.sessionId)}catch(L){t.push(o),d.push(`${k(o)}: ${H(L)}`)}}if(t.length)y(t),T(d.join(`
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,{size:"sm",variant:"destructive",className:"h-[30px] text-sm font-normal",disabled:E||N.length===0,onClick:()=>{T(null),M(!0),y([...N])},children:[i(ee,{className:"size-4","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(s,{"aria-label":n("sessionList.archives.search"),placeholder:n("sessionList.archives.search"),value:O,onChange:(t)=>ie(t.target.value),className:"rounded-md ps-9"})]}),a(Mt,{value:C,onValueChange:(t)=>{if(t===null)throw Error("Archive chat type cannot be empty");ne(t)},children:[a(Et,{"aria-label":n("sessionList.archives.chatType"),className:"w-40 rounded-md",children:[i(ge,{"aria-hidden":"true"}),i(Rt,{children:n(`sessionList.archives.${C==="all"?"allChats":C==="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(Mt,{value:x,onValueChange:(t)=>{if(t===null)throw Error("Archive project filter cannot be empty");ae(t)},children:[a(Et,{"aria-label":n("sessionList.archives.project"),className:"w-48 rounded-md",children:[i(Y,{"aria-hidden":"true"}),i(Rt,{className:"truncate",children:x==="all"?n("sessionList.archives.allProjects"):x==="quick"?n("sessionList.archives.noProject"):z(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:z(t,c??void 0)},t))]})]})]}),a(f,{children:[A!=="ready"?i("p",{role:"status",className:"text-muted-foreground",children:n("sessionList.archives.connecting")}):G?a("div",{role:"status",className:"text-muted-foreground flex items-center gap-2",children:[i(le,{}),n("sessionList.archives.loading")]}):q?i(V,{variant:"destructive",children:a(W,{className:"flex items-center justify-between gap-4",children:[i("span",{children:q}),i(e,{variant:"outline",onClick:()=>oe((t)=>t+1),children:n("sessionList.archives.retry")})]})}):N.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")})]}):X.length===0?i("p",{className:"text-muted-foreground py-12 text-center",children:n("sessionList.archives.noResults")}):(c?se(X,c):[]).filter(([,t])=>t.length>0).map(([t,d])=>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===D?void 0:t,children:[i(Y,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("span",{className:"truncate",children:t===D?n("sessionList.archives.noProject"):z(t,c??void 0)})]}),i("span",{className:"text-muted-foreground shrink-0 text-sm",children:n("sessionList.archives.count",{count:d.length})})]}),i("div",{className:"divide-border divide-y overflow-hidden rounded-lg border",children:d.map((o)=>a("article",{"aria-label":k(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:k(o),children:k(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),M(!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)),_&&i(V,{variant:"destructive",children:i(W,{children:_})})]})]}),i(u,{open:P!==null,onOpenChange:(t)=>{if(!t&&!S.current)y(null)},children:a(m,{showCloseButton:!I,children:[a(b,{children:[i(p,{children:n("sessionList.archives.deleteTitle")}),i(w,{children:n(ce?"sessionList.archives.deleteAllDescription":"sessionList.archives.deleteDescription",{count:P?.length??0})})]}),J&&i(V,{variant:"destructive",children:i(W,{className:"max-h-40 overflow-auto whitespace-pre-wrap",children:J})}),a(K,{children:[i(e,{variant:"outline",disabled:I,onClick:()=>y(null),children:n("sessionList.cancel")}),a(e,{variant:"destructive",className:"text-sm font-normal",disabled:E,onClick:()=>void he(),children:[I&&i(le,{}),n("sessionList.archives.confirmDelete")]})]})]})})]})}
3
3
  export{dr};
@@ -1,4 +1,4 @@
1
- import{Go}from"./chunk-vk36fprb.js";import{t}from"./chunk-q6km9nha.js";import{To,So}from"./chunk-1wpdb17m.js";import{B}from"./chunk-y6afvrnv.js";import{Q}from"./chunk-g5gz25jy.js";import{isEmbeddedResource as g,isImage as d,isResourceLink as f,isText as x}from"@nyssance/codex-acp-v2/client";import{memo as p}from"react";import{jsx as r,jsxs as h}from"react/jsx-runtime";var Co=p(function({item:s,messageTime:c}){let l=t(),o=So(s._meta),m=o?o.map((e)=>e.question===void 0?e.text:`${e.question}
1
+ import{Go}from"./chunk-2ahqcs3n.js";import{t}from"./chunk-q6km9nha.js";import{To,So}from"./chunk-1wpdb17m.js";import{B}from"./chunk-y6afvrnv.js";import{Q}from"./chunk-0n3q4g7y.js";import{isEmbeddedResource as g,isImage as d,isResourceLink as f,isText as x}from"@nyssance/codex-acp-v2/client";import{memo as p}from"react";import{jsx as r,jsxs as h}from"react/jsx-runtime";var Co=p(function({item:s,messageTime:c}){let l=t(),o=So(s._meta),m=o?o.map((e)=>e.question===void 0?e.text:`${e.question}
2
2
  ${e.text}`).join(`
3
3
  `):Q(s),a=s.content.filter(d),i=s.content.filter((e)=>f(e)||g(e)),u=o??s.content.filter(x).map((e)=>{let n=To(e._meta);return n?{question:n.question,text:n.answer}:{text:e.text}});if(m.length===0&&a.length===0&&i.length===0)return null;return h("div",{className:"group/codex-user flex min-w-0 flex-col items-end gap-2","data-content-search-unit-key":s.id,children:[i.length>0&&r("div",{className:"codex-user-mentions",children:i.map((e,n)=>r(B,{block:e},`${s.id}:${n}`))}),r(Go,{host:l,message:s,text:m,textParts:u.some((e)=>("question"in e))?u:void 0,images:a,mentions:[],messageTime:c})]})});
4
4
  export{Co};
@@ -1,2 +1,2 @@
1
- import{jo}from"./chunk-a3x74cr0.js";import{CheckIcon as N,ChevronDownIcon as E,CopyIcon as T,FileIcon as w}from"lucide-react";import{useEffect as k,useLayoutEffect as H,useRef as I,useState as f}from"react";import{jsx as e,jsxs as p,Fragment as h}from"react/jsx-runtime";var A=20,L='a[href], area[href], button, input, select, textarea, summary, audio[controls], video[controls], iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function y(n,o,s){if(n.toggleAttribute("inert",!o),!o){n.setAttribute("aria-hidden","true");return}if(s===null)n.removeAttribute("aria-hidden");else n.setAttribute("aria-hidden",s)}function R(n,o){let s=n.getBoundingClientRect(),a=o.getBoundingClientRect();return s.top>=a.top&&s.right<=a.right&&s.bottom<=a.bottom&&s.left>=a.left}function M({text:n,host:o}){let{t:s,Markdown:a}=o,c=I(null),[l,u]=f(!1),[d,x]=f(!1);return H(()=>{let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=()=>{if(r.scrollHeight===0){u(!1);return}let b=Number.parseFloat(getComputedStyle(r).lineHeight);if(!Number.isFinite(b))throw Error("Codex user message line height is invalid");u(r.scrollHeight>A*b+1)};t();let m=new ResizeObserver(t);return m.observe(r),()=>m.disconnect()},[]),k(()=>{if(!l||d)return;let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=new Map,m=typeof IntersectionObserver>"u"?null:new IntersectionObserver((i)=>{for(let g of i){let v=g.target;if(!t.has(v))continue;y(v,g.isIntersecting&&g.intersectionRatio>=1,t.get(v))}},{root:r,rootMargin:"0px",threshold:1}),b=()=>{for(let i of t.keys()){if(r.contains(i))continue;m?.unobserve(i),t.delete(i)}for(let i of r.querySelectorAll(L)){if(t.has(i)||i.hasAttribute("inert"))continue;let g=i.getAttribute("aria-hidden");t.set(i,g),y(i,m===null&&R(i,r),g),m?.observe(i)}};b();let C=new MutationObserver(b);return C.observe(r,{childList:!0,subtree:!0}),()=>{m?.disconnect(),C.disconnect();for(let[i,g]of t)y(i,!0,g)}},[l,d]),p("div",{className:"codex-user-message-content",children:[e("div",{ref:c,className:l&&!d?"codex-user-message-text codex-user-message-text-collapsed":"codex-user-message-text",children:e(a,{text:n,streaming:!1})}),l&&!d&&e("span",{className:"codex-user-message-ellipsis","aria-hidden":"true",children:"…"}),l&&p("button",{type:"button","aria-expanded":d,className:"codex-user-message-collapse-trigger",onClick:()=>{x((r)=>!r)},children:[e("span",{children:d?s("stream.codex.showLess"):s("stream.codex.showMore")}),e(E,{className:d?"codex-user-message-collapse-chevron codex-user-message-collapse-chevron-expanded":"codex-user-message-collapse-chevron","aria-hidden":"true"})]})]})}function nn({text:n,label:o,host:s}){let[a,c]=f(!1),[l,u]=f(null),d=async()=>{c(!1),u(null);try{await(s?.copyText?s.copyText(n):navigator.clipboard.writeText(n)),c(!0),setTimeout(()=>c(!1),2000)}catch(x){u(String(x)),s?.onCopyError?.(x)}};return e("button",{type:"button",className:"codex-message-action","aria-label":o,title:l??o,onClick:()=>void d(),children:a?e(N,{className:"codex-message-action-confirmed"}):e(T,{})})}function S({image:n,openImage:o}){let[s,a]=f(!1),c=`data:${n.mimeType};base64,${n.data}`;return p(h,{children:[e("button",{type:"button",className:"codex-user-image",onClick:()=>o===void 0?a(!0):o(c),children:e("img",{src:c,alt:""})}),s&&e(jo,{src:c,alt:"",onClose:()=>a(!1)})]})}function Go({message:n,text:o,textParts:s,mentions:a,images:c,messageTime:l,host:u,bubbleStyle:d}){let{t:x,openImage:r}=u;return e("div",{"data-content-search-unit-key":n.id,"data-message-id":n.id,className:"timeline-break codex-user-message scroll-mt-4",children:p("div",{className:"group/codex-user codex-user-message-group",children:[a.length>0&&e("div",{className:"codex-user-mentions",children:a.map((t)=>p("span",{className:"codex-user-mention",title:t.title,children:[e(w,{"aria-hidden":"true"}),e("span",{className:"codex-user-mention-label",children:t.label})]},t.key))}),c.length>0&&e("div",{className:"codex-user-images",children:c.map((t)=>e(S,{image:t,openImage:r},`${t.mimeType}:${t.data}`))}),o.length>0&&e(h,{children:e("div",{"data-user-message-bubble":!0,tabIndex:0,className:"codex-user-bubble",style:d,children:s?s.map((t,m)=>e("div",{className:"codex-user-text-part",children:t.question===void 0?e(M,{text:t.text,host:u}):p(h,{children:[e("div",{className:"codex-user-question-summary",title:t.question,children:t.question}),e("div",{className:"codex-user-question-answer",children:t.text})]})},m)):e(M,{text:o,host:u})})}),p("div",{className:"codex-user-actions",children:[e(nn,{text:o,label:x("actions.copy"),host:u}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
2
- export{nn,Go};
1
+ import{jo}from"./chunk-a3x74cr0.js";import{CheckIcon as N,ChevronDownIcon as E,CopyIcon as T,FileIcon as w}from"lucide-react";import{useEffect as k,useLayoutEffect as H,useRef as I,useState as f}from"react";import{jsx as e,jsxs as p,Fragment as h}from"react/jsx-runtime";var A=20,L='a[href], area[href], button, input, select, textarea, summary, audio[controls], video[controls], iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function y(n,o,s){if(n.toggleAttribute("inert",!o),!o){n.setAttribute("aria-hidden","true");return}if(s===null)n.removeAttribute("aria-hidden");else n.setAttribute("aria-hidden",s)}function R(n,o){let s=n.getBoundingClientRect(),a=o.getBoundingClientRect();return s.top>=a.top&&s.right<=a.right&&s.bottom<=a.bottom&&s.left>=a.left}function M({text:n,host:o}){let{t:s,Markdown:a}=o,c=I(null),[l,u]=f(!1),[d,x]=f(!1);return H(()=>{let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=()=>{if(r.scrollHeight===0){u(!1);return}let b=Number.parseFloat(getComputedStyle(r).lineHeight);if(!Number.isFinite(b))throw Error("Codex user message line height is invalid");u(r.scrollHeight>A*b+1)};t();let m=new ResizeObserver(t);return m.observe(r),()=>m.disconnect()},[]),k(()=>{if(!l||d)return;let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=new Map,m=typeof IntersectionObserver>"u"?null:new IntersectionObserver((i)=>{for(let g of i){let v=g.target;if(!t.has(v))continue;y(v,g.isIntersecting&&g.intersectionRatio>=1,t.get(v))}},{root:r,rootMargin:"0px",threshold:1}),b=()=>{for(let i of t.keys()){if(r.contains(i))continue;m?.unobserve(i),t.delete(i)}for(let i of r.querySelectorAll(L)){if(t.has(i)||i.hasAttribute("inert"))continue;let g=i.getAttribute("aria-hidden");t.set(i,g),y(i,m===null&&R(i,r),g),m?.observe(i)}};b();let C=new MutationObserver(b);return C.observe(r,{childList:!0,subtree:!0}),()=>{m?.disconnect(),C.disconnect();for(let[i,g]of t)y(i,!0,g)}},[l,d]),p("div",{className:"codex-user-message-content",children:[e("div",{ref:c,className:l&&!d?"codex-user-message-text codex-user-message-text-collapsed":"codex-user-message-text",children:e(a,{text:n,streaming:!1})}),l&&!d&&e("span",{className:"codex-user-message-ellipsis","aria-hidden":"true",children:"…"}),l&&p("button",{type:"button","aria-expanded":d,className:"codex-user-message-collapse-trigger",onClick:()=>{x((r)=>!r)},children:[e("span",{children:d?s("stream.codex.showLess"):s("stream.codex.showMore")}),e(E,{className:d?"codex-user-message-collapse-chevron codex-user-message-collapse-chevron-expanded":"codex-user-message-collapse-chevron","aria-hidden":"true"})]})]})}function on({text:n,label:o,host:s}){let[a,c]=f(!1),[l,u]=f(null),d=async()=>{c(!1),u(null);try{await(s?.copyText?s.copyText(n):navigator.clipboard.writeText(n)),c(!0),setTimeout(()=>c(!1),2000)}catch(x){u(String(x)),s?.onCopyError?.(x)}};return e("button",{type:"button",className:"codex-message-action","aria-label":o,title:l??o,onClick:()=>void d(),children:a?e(N,{className:"codex-message-action-confirmed"}):e(T,{})})}function S({image:n,openImage:o}){let[s,a]=f(!1),c=`data:${n.mimeType};base64,${n.data}`;return p(h,{children:[e("button",{type:"button",className:"codex-user-image",onClick:()=>o===void 0?a(!0):o(c),children:e("img",{src:c,alt:""})}),s&&e(jo,{src:c,alt:"",onClose:()=>a(!1)})]})}function Go({message:n,text:o,textParts:s,mentions:a,images:c,messageTime:l,host:u,bubbleStyle:d}){let{t:x,openImage:r}=u;return e("div",{"data-content-search-unit-key":n.id,"data-message-id":n.id,className:"timeline-break codex-user-message scroll-mt-4",children:p("div",{className:"group/codex-user codex-user-message-group",children:[a.length>0&&e("div",{className:"codex-user-mentions",children:a.map((t)=>p("span",{className:"codex-user-mention",title:t.title,children:[e(w,{"aria-hidden":"true"}),e("span",{className:"codex-user-mention-label",children:t.label})]},t.key))}),c.length>0&&e("div",{className:"codex-user-images",children:c.map((t)=>e(S,{image:t,openImage:r},`${t.mimeType}:${t.data}`))}),o.length>0&&e(h,{children:e("div",{"data-user-message-bubble":!0,tabIndex:0,className:"codex-user-bubble",style:d,children:s?s.map((t,m)=>e("div",{className:"codex-user-text-part",children:t.question===void 0?e(M,{text:t.text,host:u}):p(h,{children:[e("div",{className:"codex-user-question-summary",title:t.question,children:t.question}),e("div",{className:"codex-user-question-answer",children:t.text})]})},m)):e(M,{text:o,host:u})})}),p("div",{className:"codex-user-actions",children:[e(on,{text:o,label:x("actions.copy"),host:u}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
2
+ export{on,Go};
@@ -1,2 +1,2 @@
1
- import{Zn,y}from"./chunk-7zrnt6zw.js";import{Tn}from"./chunk-56e8naj1.js";import{ne}from"./chunk-bj5ma2sv.js";import{Un,$n,qn,Vn,Wn,G}from"./chunk-r9p03chx.js";import{kn,Cn}from"./chunk-nact4a4b.js";import{Dt}from"./chunk-8e3wcvkd.js";import{t,n}from"./chunk-q6km9nha.js";import{o}from"./chunk-6acs2hzs.js";import{Ot}from"./chunk-afd3bq7v.js";import{i,sr,L,bt}from"./chunk-40d5the9.js";import{dt}from"./chunk-mzh48e09.js";import{de,gt}from"./chunk-61944cv6.js";import{wt,Ct}from"./chunk-4r3ch7fk.js";import{lr}from"./chunk-nbkkfyss.js";import{pt}from"./chunk-cjmjv7pv.js";import{Ln}from"./chunk-2ecx1xed.js";import{ut}from"./chunk-1aeswxaf.js";import{mt}from"./chunk-20mzyay7.js";import{En}from"./chunk-4tff1nyj.js";import{Bn}from"./chunk-zjmqne2f.js";import{ct}from"./chunk-7eje3z81.js";import{hasFuzzyFileSearch as Lt}from"@nyssance/codex-acp-v2/client";import{PlusIcon as zt}from"lucide-react";import{useCallback as O,useEffect as Ut,useLayoutEffect as Q,useMemo as Z,useRef as V,useState as S}from"react";import{jsx as c,jsxs as I}from"react/jsx-runtime";var Wt=["image/png","image/jpeg","image/webp","image/gif"],tt=[];async function jt(e){let d=await(await fetch(e.url)).blob();return new Promise((l,E)=>{let T=new FileReader;T.onerror=()=>E(T.error),T.onload=()=>{let _=T.result;l(_.slice(_.indexOf(",")+1))},T.readAsDataURL(d)})}function Ht(e){let{t:d}=t(),l=y();return c(G,{"aria-label":d("composer.attachImage"),title:d("composer.attachImage"),onClick:()=>l.openFileDialog(),...e,children:c(zt,{className:"size-4"})})}function st({session:e,onSubmit:d,onShellCommand:l,onHandOff:E,modelSelector:T,modelMenu:_,inputHeader:et,actions:vt,children:It,attachmentPolicy:Tt,predictions:At=!0,disabled:Mt=!1,preparing:rt=!1,allowPendingInput:Et=!1}){let{host:F,client:R}=o(),{t:p}=F,k=O((r)=>{if(F.reportError)F.reportError(r);else console.error(r)},[F]),[nt,D]=S(()=>({text:i.get(e.id)?.text??"",revision:0})),{text:b}=nt,[A,Rt]=S(()=>i.get(e.id)?.attachments??tt),[u,z]=S(()=>i.get(e.id)?.mentions??[]),X=A.some((r)=>de(r)&&r.pastedText.status!=="ready"),[M,ot]=S(!1),[U,Nt]=S(!1),[q,at]=S(!1),f=V(null),it=V(null),a=V(nt),W=O((r)=>{it.current?.(),a.current={text:r,revision:a.current.revision+1},D(a.current)},[]),lt=Z(()=>({read:()=>{let s=f.current?.getTextarea(),g=s===null||s===void 0?[a.current.text.length,a.current.text.length]:[s.selectionStart,s.selectionEnd];return{target:e.id,...a.current,selection:g}},compareAndSet(s,g,C){if(s.target!==e.id||s.revision!==a.current.revision)return null;a.current={text:g,revision:a.current.revision+1},D(a.current);let x=f.current?.getTextarea();if(x!==null&&x!==void 0)x.value=g,x.setSelectionRange(C[0],C[1]);return{target:e.id,...a.current,selection:C}}}),[e.id]),B=V(null),ft=O((r)=>(B.current=r,()=>{if(B.current===r)B.current=null}),[]),j=e.state!=="idle",v=l!==void 0&&b.startsWith("!"),h=!Mt&&!rt&&e.attached&&!e.restoring&&!e.readOnly,N=!e.readOnly&&(Et||h),H=mt(e,h&&!M&&!U&&!X&&!q,b.length>0||A.length>0||u.length>0,At&&!v),ht=H.invalidate;Q(()=>{i.set(e.id,{text:b,attachments:A,mentions:u,modelId:i.get(e.id)?.modelId??null})},[e.id,b,A,u]),Q(()=>sr(e.id,Rt),[e.id]),Q(()=>bt(e.id,(r)=>{if(!N||M)throw Error("The composer cannot take text now; try again later");if(b.length||A.length||u.length)throw Error("The composer already has a draft; send or clear it first");W(r)}),[e.id,N,M,b,A,u,W]);let xt=n((r)=>Lt(r.agent)),St=Z(()=>xt&&h?async(r)=>dt((await R.fuzzyFileSearch({query:r,roots:[e.cwd]})).files):void 0,[R,xt,h,e.cwd]),J=O((r)=>{z((s)=>s.includes(r)?s:[...s,r])},[]);Ut(()=>{f.current?.focus()},[]);let yt=O(async({text:r,files:s})=>{let g=l!==void 0&&r.startsWith("!")?r.slice(1):null;if(g!==null){if(g.trim().length===0)return;if(s.length||u.length)throw Error("Shell commands cannot include file references or attachments");if(e.state!=="idle")throw Error("Wait for the current turn before running a shell command")}let C=r.trim();if(C.length===0&&s.length===0&&u.length===0)return;let x=B.current;ot(!0);let w=i.get(e.id),_t=a.current.revision,K=null;try{let P=[];for(let m of u){let Y={kind:"file",absPath:m};P.push({type:"resource_link",uri:wt(Y),name:Ct(Y)})}if(C.length>0)P.push({type:"text",text:C});for(let m of s)if(de(m)){if(m.pastedText.status!=="ready")throw Error("Text attachment is not ready");P.push({type:"resource_link",uri:m.url,name:m.filename??"pasted-text.txt"})}else P.push({type:"image",data:await jt(m),mimeType:m.mediaType});if(a.current.revision===_t&&i.get(e.id)===w)a.current={text:"",revision:a.current.revision+1},K=a.current.revision,D(a.current),z([]),L(e.id,()=>tt),i.set(e.id,{text:"",attachments:tt,mentions:[],modelId:w?.modelId??null}),f.current?.resetHeight();if(g!==null&&l)await l(g);else if(d)if(x===null)await d(P);else await d(P,(m)=>{if(x.signal.aborted||B.current!==x)return;x.accept(m),E?.(e.id,m)});else if(x===null)await R.prompt(e.id,P);else{let m=await R.prompt(e.id,P);x.accept(m)}ht();for(let m of w?.attachments??[])if(m.url.startsWith("blob:")&&!i.get(e.id)?.attachments.some((Y)=>Y.id===m.id))URL.revokeObjectURL(m.url)}catch(P){if(w&&K!==null&&a.current.revision===K&&i.get(e.id)?.attachments.length===0&&i.get(e.id)?.mentions.length===0)a.current={text:w.text,revision:K+1},D(a.current),z(w.mentions),i.set(e.id,w),L(e.id,()=>w.attachments);throw P}finally{ot(!1),f.current?.focus()}},[R,e.id,e.state,u,d,l,E,ht]),Ft=()=>{R.cancel(e.id).catch(k)},kt=O((r)=>{let s=r.code==="max_total_size"?Object.assign(Error(p("composer.imageTooLargeTitle")),{description:p("composer.imageTooLargeDescription",{mb:ne})}):Object.assign(Error(p("composer.unsupportedAttachmentTitle")),{description:p("composer.unsupportedAttachmentDescription")});k(s)},[k,p]),Bt=Z(()=>({session:e,ready:h,inputReady:N,sending:M,textareaRef:f,draft:lt,interruptRef:it,observeReceipts:ft,addMention:J,setAdding:Nt,shellMode:v,handsFree:!v&&(d===void 0||E!==void 0)}),[e,h,N,M,lt,ft,J,d,E,v]),Pt=F.writeTextAttachment;return c(Ot,{value:Bt,children:c("div",{"data-chat-drop-zone":!0,className:"mx-auto w-full max-w-3xl px-6 pb-5",children:I("div",{className:"relative",children:[et&&c("div",{"data-chat-input-header":!0,className:"bg-sidebar dark:bg-foreground/3 relative top-1 z-0 mx-[13px] -mb-[18px] flex min-w-0 items-center gap-2 overflow-hidden rounded-t-2xl px-1.5 pt-1.5 pb-[27px]",children:et}),I(Zn,{attachmentPolicy:Tt,value:b,revision:a.current.revision,onValueChange:W,onSubmittedClear:()=>{a.current={text:"",revision:a.current.revision+1},D(a.current)},attachments:A,onAttachmentsChange:(r)=>L(e.id,()=>r),children:[c(Tn,{bashMode:l!==void 0,handleRef:f,commands:e.commands,searchFiles:St,onMention:J,onSearchError:k,forcedOpen:q,onForcedOpenChange:at,emptyLabel:p("composer.noCommands"),fileStatusLabels:{loading:p("composer.searchingFiles"),empty:p("composer.noMatchingFiles")}}),I(Un,{"data-shell-mode":v||void 0,bashMode:l!==void 0,globalDrop:!0,multiple:!0,accept:Wt.join(","),onError:kt,onSubmit:yt,onSubmitAsync:yt,onSubmitError:k,canSubmit:()=>h&&!M&&!U&&!X&&(!v||!j&&b.slice(1).trim().length>0)?!0:"chat_not_ready",className:"relative z-10",children:[It,I(qn,{className:"px-3 pt-3 pb-0 empty:hidden",children:[U&&c("span",{role:"status",className:"text-muted-foreground text-xs",children:p("composer.addingFiles")}),c(lr,{mentions:u,onRemove:(r)=>z((s)=>s.filter((g)=>g!==r))}),c(Cn,{children:(r)=>de(r)?c(Ln,{data:r,sessionId:e.id}):c(kn,{data:r,t:p})})]}),I($n,{className:"mb-0 min-h-16 px-3 pt-4 pb-2",onKeyDownCapture:(r)=>{if(!H.text||f.current?.isComposing()||r.nativeEvent.isComposing||r.nativeEvent.keyCode===229||r.shiftKey||r.ctrlKey||r.altKey||r.metaKey||r.target!==f.current?.getTextarea())return;if(r.key==="Tab")r.preventDefault(),r.stopPropagation(),W(H.text)},children:[v&&c("span",{"data-shell-prefix":!0,"aria-hidden":"true",className:"text-destructive self-start pt-0.5 text-sm",children:"❗"}),c(Dt,{className:"min-h-10 bg-transparent text-sm font-normal",ref:f,rows:2,bashMode:l!==void 0,disabled:!N,onPasteCapture:Pt?(r)=>gt(r,e.id,p("composer.pastedTextFilename"),Pt):void 0,placeholder:v?"! command":H.text||(j?p("composer.steerPlaceholder"):p("composer.placeholder")),"aria-label":p("composer.placeholder")})]}),c(Vn,{className:"chat-composer-toolbar @container/input-footer mt-0 mb-2 w-full min-w-0 p-0",children:I("div",{className:"grid w-full min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-[5px] px-2",children:[I("div",{className:"flex min-w-0 items-center gap-[5px]",children:[c(Ht,{className:"text-foreground",disabled:!N}),c(En,{textareaRef:f,menuOpen:q,onOpenChange:at,disabled:!h||e.commands.length===0}),c(ut,{sessionId:e.id,options:e.configOptions,disabled:!h})]}),I(Wn,{className:"w-full min-w-0 items-center justify-end gap-1",children:[c(ct,{session:e}),T??c(pt,{..._,sessionId:e.id,options:e.configOptions,disabled:!h}),vt,c(Bn,{active:j,sending:M||rt||U,ready:h&&!X&&(!v||!j&&b.slice(1).trim().length>0),hasMentions:u.length>0,onStop:Ft})]})]})})]})]})]})})})}
1
+ import{Zn,y}from"./chunk-cazdmcwd.js";import{Tn}from"./chunk-6b1hdb25.js";import{ne}from"./chunk-bj5ma2sv.js";import{Un,$n,qn,Vn,Wn,G}from"./chunk-kmhwwzga.js";import{kn,Cn}from"./chunk-t1yzfva7.js";import{_t}from"./chunk-xe3h32y1.js";import{t,n}from"./chunk-q6km9nha.js";import{o}from"./chunk-0ss92kxr.js";import{Ot}from"./chunk-afd3bq7v.js";import{i,sr,L,wt}from"./chunk-2swp3nfs.js";import{dt}from"./chunk-mzh48e09.js";import{de,gt}from"./chunk-59j0p8hy.js";import{kt,Tt}from"./chunk-w1awbykg.js";import{lr}from"./chunk-c1vavp0q.js";import{pt}from"./chunk-bew4srqj.js";import{Ln}from"./chunk-qca5mhqd.js";import{ut}from"./chunk-7jdjdnh6.js";import{mt}from"./chunk-0dnwqm94.js";import{En}from"./chunk-7ap638hx.js";import{Bn}from"./chunk-8bfnjqkg.js";import{ct}from"./chunk-d94rmh12.js";import{hasFuzzyFileSearch as Lt}from"@nyssance/codex-acp-v2/client";import{PlusIcon as zt}from"lucide-react";import{useCallback as O,useEffect as Ut,useLayoutEffect as Q,useMemo as Z,useRef as V,useState as S}from"react";import{jsx as c,jsxs as I}from"react/jsx-runtime";var Wt=["image/png","image/jpeg","image/webp","image/gif"],tt=[];async function jt(e){let d=await(await fetch(e.url)).blob();return new Promise((l,E)=>{let T=new FileReader;T.onerror=()=>E(T.error),T.onload=()=>{let _=T.result;l(_.slice(_.indexOf(",")+1))},T.readAsDataURL(d)})}function Ht(e){let{t:d}=t(),l=y();return c(G,{"aria-label":d("composer.attachImage"),title:d("composer.attachImage"),onClick:()=>l.openFileDialog(),...e,children:c(zt,{className:"size-4"})})}function st({session:e,onSubmit:d,onShellCommand:l,onHandOff:E,modelSelector:T,modelMenu:_,inputHeader:et,actions:bt,children:vt,attachmentPolicy:It,predictions:At=!0,disabled:Mt=!1,preparing:rt=!1,allowPendingInput:Ct=!1}){let{host:F,client:R}=o(),{t:p}=F,k=O((r)=>{if(F.reportError)F.reportError(r);else console.error(r)},[F]),[nt,D]=S(()=>({text:i.get(e.id)?.text??"",revision:0})),{text:b}=nt,[A,Et]=S(()=>i.get(e.id)?.attachments??tt),[u,z]=S(()=>i.get(e.id)?.mentions??[]),X=A.some((r)=>de(r)&&r.pastedText.status!=="ready"),[M,ot]=S(!1),[U,Rt]=S(!1),[q,at]=S(!1),f=V(null),it=V(null),a=V(nt),W=O((r)=>{it.current?.(),a.current={text:r,revision:a.current.revision+1},D(a.current)},[]),lt=Z(()=>({read:()=>{let s=f.current?.getTextarea(),g=s===null||s===void 0?[a.current.text.length,a.current.text.length]:[s.selectionStart,s.selectionEnd];return{target:e.id,...a.current,selection:g}},compareAndSet(s,g,C){if(s.target!==e.id||s.revision!==a.current.revision)return null;a.current={text:g,revision:a.current.revision+1},D(a.current);let x=f.current?.getTextarea();if(x!==null&&x!==void 0)x.value=g,x.setSelectionRange(C[0],C[1]);return{target:e.id,...a.current,selection:C}}}),[e.id]),B=V(null),ft=O((r)=>(B.current=r,()=>{if(B.current===r)B.current=null}),[]),j=e.state!=="idle",v=l!==void 0&&b.startsWith("!"),h=!Mt&&!rt&&e.attached&&!e.restoring&&!e.readOnly,N=!e.readOnly&&(Ct||h),H=mt(e,h&&!M&&!U&&!X&&!q,b.length>0||A.length>0||u.length>0,At&&!v),ht=H.invalidate;Q(()=>{i.set(e.id,{text:b,attachments:A,mentions:u,modelId:i.get(e.id)?.modelId??null})},[e.id,b,A,u]),Q(()=>sr(e.id,Et),[e.id]),Q(()=>wt(e.id,(r)=>{if(!N||M)throw Error("The composer cannot take text now; try again later");if(b.length||A.length||u.length)throw Error("The composer already has a draft; send or clear it first");W(r)}),[e.id,N,M,b,A,u,W]);let xt=n((r)=>Lt(r.agent)),Nt=Z(()=>xt&&h?async(r)=>dt((await R.fuzzyFileSearch({query:r,roots:[e.cwd]})).files):void 0,[R,xt,h,e.cwd]),J=O((r)=>{z((s)=>s.includes(r)?s:[...s,r])},[]);Ut(()=>{f.current?.focus()},[]);let yt=O(async({text:r,files:s})=>{let g=l!==void 0&&r.startsWith("!")?r.slice(1):null;if(g!==null){if(g.trim().length===0)return;if(s.length||u.length)throw Error("Shell commands cannot include file references or attachments");if(e.state!=="idle")throw Error("Wait for the current turn before running a shell command")}let C=r.trim();if(C.length===0&&s.length===0&&u.length===0)return;let x=B.current;ot(!0);let w=i.get(e.id),Bt=a.current.revision,K=null;try{let P=[];for(let m of u){let Y={kind:"file",absPath:m};P.push({type:"resource_link",uri:kt(Y),name:Tt(Y)})}if(C.length>0)P.push({type:"text",text:C});for(let m of s)if(de(m)){if(m.pastedText.status!=="ready")throw Error("Text attachment is not ready");P.push({type:"resource_link",uri:m.url,name:m.filename??"pasted-text.txt"})}else P.push({type:"image",data:await jt(m),mimeType:m.mediaType});if(a.current.revision===Bt&&i.get(e.id)===w)a.current={text:"",revision:a.current.revision+1},K=a.current.revision,D(a.current),z([]),L(e.id,()=>tt),i.set(e.id,{text:"",attachments:tt,mentions:[],modelId:w?.modelId??null}),f.current?.resetHeight();if(g!==null&&l)await l(g);else if(d)if(x===null)await d(P);else await d(P,(m)=>{if(x.signal.aborted||B.current!==x)return;x.accept(m),E?.(e.id,m)});else if(x===null)await R.prompt(e.id,P);else{let m=await R.prompt(e.id,P);x.accept(m)}ht();for(let m of w?.attachments??[])if(m.url.startsWith("blob:")&&!i.get(e.id)?.attachments.some((Y)=>Y.id===m.id))URL.revokeObjectURL(m.url)}catch(P){if(w&&K!==null&&a.current.revision===K&&i.get(e.id)?.attachments.length===0&&i.get(e.id)?.mentions.length===0)a.current={text:w.text,revision:K+1},D(a.current),z(w.mentions),i.set(e.id,w),L(e.id,()=>w.attachments);throw P}finally{ot(!1),f.current?.focus()}},[R,e.id,e.state,u,d,l,E,ht]),St=()=>{R.cancel(e.id).catch(k)},Ft=O((r)=>{let s=r.code==="max_total_size"?Object.assign(Error(p("composer.imageTooLargeTitle")),{description:p("composer.imageTooLargeDescription",{mb:ne})}):Object.assign(Error(p("composer.unsupportedAttachmentTitle")),{description:p("composer.unsupportedAttachmentDescription")});k(s)},[k,p]),Dt=Z(()=>({session:e,ready:h,inputReady:N,sending:M,textareaRef:f,draft:lt,interruptRef:it,observeReceipts:ft,addMention:J,setAdding:Rt,shellMode:v,handsFree:!v&&(d===void 0||E!==void 0)}),[e,h,N,M,lt,ft,J,d,E,v]),Pt=F.writeTextAttachment;return c(Ot,{value:Dt,children:c("div",{"data-chat-drop-zone":!0,className:"mx-auto w-full max-w-3xl px-6 pb-5",children:I("div",{className:"relative",children:[et&&c("div",{"data-chat-input-header":!0,className:"bg-sidebar dark:bg-foreground/3 relative top-1 z-0 mx-[13px] -mb-[18px] flex min-w-0 items-center gap-2 overflow-hidden rounded-t-2xl px-1.5 pt-1.5 pb-[27px]",children:et}),I(Zn,{attachmentPolicy:It,value:b,revision:a.current.revision,onValueChange:W,onSubmittedClear:()=>{a.current={text:"",revision:a.current.revision+1},D(a.current)},attachments:A,onAttachmentsChange:(r)=>L(e.id,()=>r),children:[c(Tn,{bashMode:l!==void 0,handleRef:f,commands:e.commands,searchFiles:Nt,onMention:J,onSearchError:k,forcedOpen:q,onForcedOpenChange:at,emptyLabel:p("composer.noCommands"),fileStatusLabels:{loading:p("composer.searchingFiles"),empty:p("composer.noMatchingFiles")}}),I(Un,{"data-shell-mode":v||void 0,bashMode:l!==void 0,globalDrop:!0,multiple:!0,accept:Wt.join(","),onError:Ft,onSubmit:yt,onSubmitAsync:yt,onSubmitError:k,canSubmit:()=>h&&!M&&!U&&!X&&(!v||!j&&b.slice(1).trim().length>0)?!0:"chat_not_ready",className:"relative z-10",children:[vt,I(qn,{className:"px-3 pt-3 pb-0 empty:hidden",children:[U&&c("span",{role:"status",className:"text-muted-foreground text-xs",children:p("composer.addingFiles")}),c(lr,{mentions:u,onRemove:(r)=>z((s)=>s.filter((g)=>g!==r))}),c(Cn,{children:(r)=>de(r)?c(Ln,{data:r,sessionId:e.id}):c(kn,{data:r,t:p})})]}),I($n,{className:"mb-0 min-h-16 px-3 pt-4 pb-2",onKeyDownCapture:(r)=>{if(!H.text||f.current?.isComposing()||r.nativeEvent.isComposing||r.nativeEvent.keyCode===229||r.shiftKey||r.ctrlKey||r.altKey||r.metaKey||r.target!==f.current?.getTextarea())return;if(r.key==="Tab")r.preventDefault(),r.stopPropagation(),W(H.text)},children:[v&&c("span",{"data-shell-prefix":!0,"aria-hidden":"true",className:"text-destructive self-start pt-0.5 text-sm",children:"❗"}),c(_t,{className:"min-h-10 bg-transparent text-sm font-normal",ref:f,rows:2,bashMode:l!==void 0,disabled:!N,onPasteCapture:Pt?(r)=>gt(r,e.id,p("composer.pastedTextFilename"),Pt):void 0,placeholder:v?"! command":H.text||(j?p("composer.steerPlaceholder"):p("composer.placeholder")),"aria-label":p("composer.placeholder")})]}),c(Vn,{className:"chat-composer-toolbar @container/input-footer mt-0 mb-2 w-full min-w-0 p-0",children:I("div",{className:"grid w-full min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-[5px] px-2",children:[I("div",{className:"flex min-w-0 items-center gap-[5px]",children:[c(Ht,{className:"text-foreground",disabled:!N}),c(En,{textareaRef:f,menuOpen:q,onOpenChange:at,disabled:!h||e.commands.length===0}),c(ut,{sessionId:e.id,options:e.configOptions,disabled:!h})]}),I(Wn,{className:"w-full min-w-0 items-center justify-end gap-1",children:[c(ct,{session:e}),T??c(pt,{..._,sessionId:e.id,options:e.configOptions,disabled:!h}),bt,c(Bn,{active:j,sending:M||rt||U,ready:h&&!X&&(!v||!j&&b.slice(1).trim().length>0),hasMentions:u.length>0,onStop:St})]})]})})]})]})]})})})}
2
2
  export{st};
@@ -1,2 +1,2 @@
1
- var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function Ht(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function Mn(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=Ht(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
2
- export{Ht,Mn};
1
+ var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function Ft(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function Mn(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=Ft(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
2
+ export{Ft,Mn};
@@ -1 +1 @@
1
- import{e}from"./chunk-wpdn3rx8.js";import{s}from"./chunk-96x0d2vd.js";import{k}from"./chunk-da6d6wze.js";import{cva as u}from"class-variance-authority";import{cn as n}from"cn";import{jsx as r}from"react/jsx-runtime";function Xn({className:a,...t}){return r("div",{"data-slot":"input-group",role:"group",className:n("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input 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]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 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-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 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 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pe-1.5 has-[>[data-align=inline-start]]:[&>input]:ps-1.5",a),...t})}var d=u("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground 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 ps-2 has-[>button]:-ms-1 has-[>kbd]:ms-[-0.15rem]","inline-end":"order-last pe-2 has-[>button]:-me-1 has-[>kbd]:me-[-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 zt({className:a,align:t="inline-start",...i}){return r("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:n(d({align:t}),a),onClick:(o)=>{if(o.target.closest("button"))return;o.currentTarget.parentElement?.querySelector("input")?.focus()},...i})}var l=u("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 Ut({className:a,type:t="button",variant:i="ghost",size:o="xs",...p}){return r(e,{type:t,"data-size":o,variant:i,className:n(l({size:o}),a),...p})}function ai({className:a,...t}){return r("span",{className:n("flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",a),...t})}function si({className:a,...t}){return r(s,{"data-slot":"input-group-control",className:n("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",a),...t})}function Yn({className:a,...t}){return r(k,{"data-slot":"input-group-control",className:n("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",a),...t})}export{Xn,zt,Ut,ai,si,Yn};
1
+ import{e}from"./chunk-wpdn3rx8.js";import{s}from"./chunk-96x0d2vd.js";import{k}from"./chunk-da6d6wze.js";import{cva as u}from"class-variance-authority";import{cn as n}from"cn";import{jsx as r}from"react/jsx-runtime";function Xn({className:a,...t}){return r("div",{"data-slot":"input-group",role:"group",className:n("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input 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]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 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-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 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 dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pe-1.5 has-[>[data-align=inline-start]]:[&>input]:ps-1.5",a),...t})}var d=u("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground 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 ps-2 has-[>button]:-ms-1 has-[>kbd]:ms-[-0.15rem]","inline-end":"order-last pe-2 has-[>button]:-me-1 has-[>kbd]:me-[-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 Ut({className:a,align:t="inline-start",...i}){return r("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:n(d({align:t}),a),onClick:(o)=>{if(o.target.closest("button"))return;o.currentTarget.parentElement?.querySelector("input")?.focus()},...i})}var l=u("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 $t({className:a,type:t="button",variant:i="ghost",size:o="xs",...p}){return r(e,{type:t,"data-size":o,variant:i,className:n(l({size:o}),a),...p})}function ai({className:a,...t}){return r("span",{className:n("flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",a),...t})}function si({className:a,...t}){return r(s,{"data-slot":"input-group-control",className:n("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",a),...t})}function Yn({className:a,...t}){return r(k,{"data-slot":"input-group-control",className:n("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent",a),...t})}export{Xn,Ut,$t,ai,si,Yn};
@@ -1,2 +1,2 @@
1
- var i=new Map,a=new Map,f=new Map;function sr(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 L(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 yt(t,r){f.set(t,r),r.finally(()=>{if(f.get(t)===r)f.delete(t)})}async function Tr(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 Sr(t,r){if(r===null)i.delete(t);else i.set(t,r)}var s=new Map;function bt(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 Ir(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,sr,L,yt,Tr,Sr,bt,Ir};
1
+ var i=new Map,a=new Map,f=new Map;function sr(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 L(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 bt(t,r){f.set(t,r),r.finally(()=>{if(f.get(t)===r)f.delete(t)})}async function Tr(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 Sr(t,r){if(r===null)i.delete(t);else i.set(t,r)}var s=new Map;function wt(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 Ir(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,sr,L,bt,Tr,Sr,wt,Ir};
@@ -1,2 +1,2 @@
1
- import{n}from"./chunk-q6km9nha.js";import{e}from"./chunk-wpdn3rx8.js";import{Ue}from"./chunk-z3mp9z01.js";import{he,ve,xe,ye}from"./chunk-d5ga13n0.js";import{o,C}from"./chunk-6acs2hzs.js";import{Loader2Icon as f}from"lucide-react";import{jsx as i,jsxs as m}from"react/jsx-runtime";function vt({session:t,timeline:c}){let{host:s,client:a}=o(),{t:r}=s,l=n((y)=>y.historyPages[t.id]?.cursor!=null),d=()=>C(s,a.open(t.id,t.cwd)),p=i(Ue,{...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(he,{className:"flex-1",children:[m(ve,{children:[i(xe,{children:r("conversation.reopen")}),i(ye,{children:r("conversation.detached")})]}),i(e,{onClick:d,children:r("conversation.reopen")})]});if(t.items.length===0&&t.state==="idle"&&!l)return i(he,{className:"flex-1",children:m(ve,{children:[i(xe,{className:"text-[28px] font-normal",children:r("conversation.welcomeTitle")}),i(ye,{className:"truncate font-mono",children:t.cwd})]})});return p}
1
+ import{n}from"./chunk-q6km9nha.js";import{e}from"./chunk-wpdn3rx8.js";import{Ue}from"./chunk-465r54av.js";import{he,ve,xe,ye}from"./chunk-d5ga13n0.js";import{o,C}from"./chunk-0ss92kxr.js";import{Loader2Icon as f}from"lucide-react";import{jsx as i,jsxs as m}from"react/jsx-runtime";function vt({session:t,timeline:c}){let{host:s,client:a}=o(),{t:r}=s,l=n((y)=>y.historyPages[t.id]?.cursor!=null),d=()=>C(s,a.open(t.id,t.cwd)),p=i(Ue,{...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(he,{className:"flex-1",children:[m(ve,{children:[i(xe,{children:r("conversation.reopen")}),i(ye,{children:r("conversation.detached")})]}),i(e,{onClick:d,children:r("conversation.reopen")})]});if(t.items.length===0&&t.state==="idle"&&!l)return i(he,{className:"flex-1",children:m(ve,{children:[i(xe,{className:"text-[28px] font-normal",children:r("conversation.welcomeTitle")}),i(ye,{className:"truncate font-mono",children:t.cwd})]})});return p}
2
2
  export{vt};
@@ -1,2 +1,2 @@
1
- import{Hn,On}from"./chunk-25bzk1wv.js";import{cn as l}from"cn";import{jsx as t,jsxs as a}from"react/jsx-runtime";function f({value:i,onValueChange:n,options:o,itemClassName:d}){return t(Hn,{value:i,onValueChange:(e)=>n(String(e)),children:o.map((e)=>a(On,{value:e.value,disabled:e.disabled,title:e.title,closeOnClick:!0,className:l("gap-2",e.description?"items-start":"items-center",d),children:[e.icon,e.description?a("div",{className:"min-w-0 flex-1",children:[t("div",{className:"text-xs font-medium",children:e.label}),t("div",{className:"text-muted-foreground text-[11px] font-normal",children:e.description})]}):t("span",{className:"min-w-0 flex-1 truncate text-start",children:e.label})]},e.value))})}
1
+ import{Hn,Fn}from"./chunk-h68f23r0.js";import{cn as l}from"cn";import{jsx as t,jsxs as a}from"react/jsx-runtime";function f({value:i,onValueChange:n,options:o,itemClassName:d}){return t(Hn,{value:i,onValueChange:(e)=>n(String(e)),children:o.map((e)=>a(Fn,{value:e.value,disabled:e.disabled,title:e.title,closeOnClick:!0,className:l("gap-2",e.description?"items-start":"items-center",d),children:[e.icon,e.description?a("div",{className:"min-w-0 flex-1",children:[t("div",{className:"text-xs font-medium",children:e.label}),t("div",{className:"text-muted-foreground text-[11px] font-normal",children:e.description})]}):t("span",{className:"min-w-0 flex-1 truncate text-start",children:e.label})]},e.value))})}
2
2
  export{f};
@@ -1,2 +1,2 @@
1
- import{$e}from"./chunk-h2gng003.js";import{or}from"./chunk-kq8kz0jn.js";import{t}from"./chunk-q6km9nha.js";import{B}from"./chunk-y6afvrnv.js";import{on}from"./chunk-g5gz25jy.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(B,{block:o.content},`${n.id}:${s}`))]})}var Jt=k(function({sessionId:r,items:o,terminals:s,streamingThoughtId:d}){let p=t(),i=o.every(on),c=p.toolBlock,a=v(()=>o.map((e)=>{let m={...or(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($e,{blocks:a,defaultExpanded:!i}),o.map((e)=>e.kind==="tool"&&l(R,{item:e},e.id))]})});
2
- export{Jt};
1
+ import{$e}from"./chunk-bnj58bev.js";import{or}from"./chunk-kq8kz0jn.js";import{t}from"./chunk-q6km9nha.js";import{B}from"./chunk-y6afvrnv.js";import{rn}from"./chunk-0n3q4g7y.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(B,{block:o.content},`${n.id}:${s}`))]})}var en=k(function({sessionId:r,items:o,terminals:s,streamingThoughtId:d}){let p=t(),i=o.every(rn),c=p.toolBlock,a=v(()=>o.map((e)=>{let m={...or(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($e,{blocks:a,defaultExpanded:!i}),o.map((e)=>e.kind==="tool"&&l(R,{item:e},e.id))]})});
2
+ export{en};
@@ -1,2 +1,2 @@
1
- import{fo}from"./chunk-frqg34kq.js";import{e}from"./chunk-wpdn3rx8.js";import{re,t,ie,n,Ge}from"./chunk-q6km9nha.js";import{Qo,Ve,rn,Zo,Jo}from"./chunk-g5gz25jy.js";import{qe}from"./chunk-efcpawhs.js";import{Bo}from"./chunk-cf5mxxyp.js";import{Oo}from"./chunk-0keppemg.js";import{Io,Po}from"./chunk-jzkmsbpe.js";import{wo,ko}from"./chunk-7jyekmy9.js";import{bo}from"./chunk-2qhbm5y9.js";import{Fo}from"./chunk-jkwf97cs.js";import{Co}from"./chunk-6k4mbmg1.js";import{codexExtensionCapabilities as Ce,codexMessageError as Me,codexRetryNotice as ze,codexTurnError as Be,nativeTurnId as ge}from"@nyssance/codex-acp-v2/client";import{ArrowDownIcon as Oe}from"lucide-react";import{useCallback as V,useEffect as A,useLayoutEffect as ve,useMemo as Q,useRef as b,useState as _}from"react";import{flushSync as Te}from"react-dom";import{jsx as a,jsxs as L}from"react/jsx-runtime";var ye=24;function Fe(r){let m=Math.max(0,r.turnTopPx-ye),v=Math.max(0,r.scrollHeightPx-r.viewportHeightPx),c=m-v;return{scrollTopPx:m,spacerPx:c>0?r.spacerPx+c:r.spacerPx}}function Ke({viewportRef:r,viewportProps:m,children:v}){return a("div",{ref:r,...m,className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain outline-none",children:v})}function _e({sessionId:r,turnId:m,root:v,error:c,connected:S}){let C=b(null),w=ie(),{t:N}=t(),R=V(()=>{w.loadHistoryTurn(r,m).catch(()=>{})},[w,r,m]);return A(()=>{if(!v||!C.current||!S||c)return;let B=new IntersectionObserver((T)=>{if(T.some((P)=>P.isIntersecting))B.disconnect(),R()},{root:v,rootMargin:"800px 0px"});return B.observe(C.current),()=>B.disconnect()},[v,S,c,R]),a("div",{ref:C,className:"flex min-h-80 flex-col justify-center gap-3 py-8","data-history-turn":m,"data-markdown-pending":!0,children:c?L("div",{className:"flex flex-col items-center gap-2",children:[a("p",{role:"alert",className:"text-destructive text-xs",children:c}),a(e,{variant:"outline",size:"sm",onClick:R,disabled:!S,children:N("timeline.navigationRetry")})]}):L("div",{role:"status","aria-label":N("timeline.navigationLoading"),className:"space-y-3",children:[a("div",{className:"bg-muted ml-auto h-5 w-1/3 rounded"}),a("div",{className:"bg-muted h-3 w-4/5 rounded"}),a("div",{className:"bg-muted h-3 w-3/5 rounded"})]})})}function $e(r,m){let v=b([]),c=b(null);if(c.current?.items!==r.items||c.current.state!==r.state||c.current.ended!==r.turnEndedAt||c.current.usage!==r.turnUsage||c.current.historyOrder!==m)c.current={state:r.state,items:r.items,ended:r.turnEndedAt,usage:r.turnUsage,historyOrder:m,turns:Qo(r,v.current,m)};let S=c.current.turns;return v.current=S,S}function Ue(r){return a(re,{host:r.host,client:r.client,children:a(De,{...r})})}function De({session:r,leading:m,afterTurn:v,answerActions:c,turnFooter:S,renderUserMessage:C,insert:w,navigation:N,anchorNewTurn:R=!1,Viewport:B=Ke}){let T=ie(),P=t(),y=n((i)=>i.historyNavigation[r.id]),d=$e(r,y?.turns),M=d.at(-1)?.key,xe=Zo(r,d),x=r.state==="running"||r.state==="requires_action",D=Q(()=>Oo(d,y),[d,y]),Y=Q(()=>D.flatMap((i)=>i.turn===void 0?[]:[{...i.turn,key:i.turnKey}]),[D]),he=Q(()=>N===void 0?[]:Io(d,r.turnUsage,y),[N,d,r.turnUsage,y]),Z=w&&w.afterItemId!==null?d.findIndex((i)=>i.items.some((u)=>u.id===w.afterItemId)):-1,j=b(d);j.current=d;let[l,be]=_(null),h=n((i)=>i.historyPages[r.id]),I=n((i)=>i.connection==="ready"),we=n((i)=>Ce(i.agent).sessionRetry),ee=h!==void 0;A(()=>{if(I&&ee&&!r.restoring)T.loadHistoryNavigation(r.id).catch(()=>{})},[T,I,ee,r.id,r.restoring]);let[Re,Se]=_(!1),F=b(null),[Pe,te]=_(!1),ne=b(0),W=b({key:M,running:x});W.current={key:M,running:x};let[oe,K]=_(0),k=b(0),E=b(null);k.current=oe;let Ie=V(()=>{if(E.current!==null)E.current.keepTop=!1},[]),{isFollowing:z,scrollToBottom:X,stopFollowing:q,schedulePin:ae,contentResized:le,beginLocate:ue,cancelLocation:se}=Fo(l,x,Ie),ce=V(()=>{if(l===null||!x)return;let i=d.at(-1)?.key;if(i===void 0)return;let u=ue(!0),s=()=>u.isCurrent()&&W.current.running&&W.current.key===i,o=()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(!s())return;let g=l.querySelector(`[data-codex-turn="${CSS.escape(i)}"]`);if(g===null)return;let f=l.scrollTop+g.getBoundingClientRect().top-l.getBoundingClientRect().top,H=Fe({turnTopPx:f,scrollHeightPx:l.scrollHeight,viewportHeightPx:l.clientHeight,spacerPx:k.current});E.current=H.spacerPx>0?{element:g,heightPx:g.getBoundingClientRect().height+H.spacerPx,keepTop:!0}:null,Te(()=>K(H.spacerPx)),requestAnimationFrame(()=>{if(s())u.finish(H.scrollTopPx)})})),p=F.current;if(p===null)return;p.scrollToKey(i,void 0,{align:"top"}).then(()=>{if(s())o()})},[ue,x,l,d]);ve(()=>{if(!R||x)return;se(),E.current=null,k.current=0,K(0)},[R,se,x]);let G=V(()=>{q(),T.loadOlderHistory(r.id).catch(()=>{})},[T,r.id,q]);A(()=>{if(l===null)return;let i=()=>{let u=l.scrollTop<600;if(Se(u),u&&!y?.complete&&I&&!r.restoring&&!z&&h?.cursor&&!h.loading&&!h.error)G()};return i(),l.addEventListener("scroll",i,{passive:!0}),()=>l.removeEventListener("scroll",i)},[I,h,z,G,l,r.restoring,y?.complete]),A(()=>{wo({sessionId:r.id,turns:Y,api:F.current,beforeReveal:q,terminals:r.terminals})},[r.id,r.terminals,Y,q]),A(()=>()=>ko(r.id),[r.id]);let He=V(async(i,u)=>{let s=++ne.current;te(!0);try{if(i.isLoaded===!1&&i.nativeTurnId!==void 0)await T.loadHistoryTurn(r.id,i.nativeTurnId),await new Promise((f)=>requestAnimationFrame(()=>f()));if(!u())return null;let o=j.current.find((f)=>f.user?.id===(i.messageId??i.id))??j.current.find((f)=>f.user!==null&&i.nativeTurnId!==void 0&&f.items.some((H)=>ge(H)===i.nativeTurnId));if(!o?.user)return null;let p=o.user.id,g=F.current;if(g===null)throw Error("Virtual timeline is not mounted");return await g.scrollToKey(o.key,(f)=>f.querySelector(`[data-content-search-unit-key="${CSS.escape(p)}"]`),{align:"top"}),document.querySelector(`[data-chat-scroll] [data-content-search-unit-key="${CSS.escape(p)}"]`)}finally{if(ne.current===s)te(!1)}},[T,r.id]),Ne=V(async(i)=>{if(i.nativeTurnId!==void 0)await T.previewHistoryTurn(r.id,i.nativeTurnId)},[T,r.id]);A(()=>{if(l===null)return;let i=l.querySelector("[data-codex-timeline]");if(i===null)throw Error("Timeline content element is missing");let u=new ResizeObserver(()=>{let s=E.current,o=null;if(s!==null){let p=Math.max(0,s.heightPx-s.element.getBoundingClientRect().height);if(p!==k.current&&(p<k.current||s.keepTop)){if(k.current=p,Te(()=>K(p)),p===0)E.current=null}if(p>0&&s.keepTop)o=l.scrollTop+s.element.getBoundingClientRect().top-l.getBoundingClientRect().top-ye}le(o)});if(u.observe(i),u.observe(l),M!==void 0){let s=l.querySelector(`[data-codex-turn="${CSS.escape(M)}"]`);if(s===null)throw Error("Latest turn is not mounted");u.observe(s)}return()=>u.disconnect()},[le,M,l]),A(()=>{if(r.items.length===0)return;ae()},[ae,r.items]);let de=b(null);ve(()=>{if(l===null)return;let i=d.at(-1),u=de.current;if(de.current=i===void 0?null:{key:i.key,running:x},i===void 0||u===null||i.user===null||i.replayed)return;if(R){if(x&&r.turnEndedAt[i.user.id]===void 0&&(i.key!==u.key||!u.running))E.current=null,k.current=0,K(0),ce()}else if(i.key!==u.key)X()},[ce,R,x,X,l,r.turnEndedAt,d]);let ke=(i,u)=>{let s=i,o=s.turn;if(o===void 0){if(s.nativeTurnId===void 0)throw Error(`Turn is missing at index ${u}`);return a(_e,{sessionId:r.id,turnId:s.nativeTurnId,root:l,error:y?.turnErrors[s.nativeTurnId],connected:I&&!z&&!Pe})}let p=d.indexOf(o),g=o.key===xe,f=Jo(r,d,p),H=!g&&f.continued,U=o.key===M,O=o.errors.at(-1),me=O===void 0?null:Me(O),J=O===void 0?null:ge(O),Ee=!r.subagent&&U&&!g&&I&&we&&r.attached&&!r.readOnly&&!r.restoring&&O===r.items.at(-1)&&me!==null&&Be(me).category==="overloaded"&&J!==null&&r.lastStopReason!=="end_turn"&&r.lastStopReason!=="cancelled",fe=S?.(o)??null,Ae=o.work.length>0||o.final.length>0||o.errors.length>0||g||fe!==null||Ve(o)||rn(o)||U&&(r.error!==null||r.lastStopReason==="cancelled"),pe=o.user===null?null:qe(o);return L("div",{"data-virtualized-turn-content":!0,"data-codex-turn":o.key,className:"flex flex-col gap-1.5",children:[o.user!==null&&(C===void 0?a(Co,{item:o.user,messageTime:pe}):C(o.user,pe)),Ae&&a(Bo,{sessionId:r.id,turn:o,terminals:r.terminals,active:g,blocked:r.state==="requires_action",continued:H,edits:f.edits,activityItems:f.items,workStartedAt:f.startedAt,isLast:U,error:r.error,retrying:g?ze(r._meta)??void 0:void 0,retry:Ee?{turnId:J,delaySeconds:bo(d),run:(Le)=>T.retrySession(r.id,J,Le)}:void 0,interrupted:rn(o)||!g&&U&&r.lastStopReason==="cancelled",answerActions:c?.(o),footer:fe}),u===Z&&w?.node,v?.(o)]})};return L("div",{className:"relative flex min-h-0 flex-1 flex-col","data-stream-style":"codexUI",children:[a(B,{viewportRef:be,viewportProps:{"data-chat-scroll":"",style:{overflowAnchor:"none"},tabIndex:0,role:"log","aria-label":P.t("timeline.label")},children:a("div",{className:"codex-timeline-content flex min-h-full w-full flex-col",children:L("div",{"data-timeline-user-message-navigation-content":!0,className:"mx-auto flex w-full max-w-3xl shrink-0 flex-col",children:[w&&Z===-1&&w.node,a(fo,{ref:F,entries:D,renderTurn:ke,scrollElement:l,sessionKey:r.id,preserveViewport:!z,leadingInsetPx:12,leadingContent:m===void 0?void 0:a("div",{className:"pt-3",children:m})}),R&&a("div",{"aria-hidden":"true","data-turn-anchor-spacer":!0,className:"shrink-0",style:{height:oe}}),a("div",{"aria-hidden":"true",className:"h-6 shrink-0"})]})})}),a("div",{"aria-hidden":"true",className:"codex-timeline-bottom-fade"}),y?.error&&a("div",{className:"absolute inset-x-0 top-2 z-10 flex justify-center",children:a(e,{variant:"outline",size:"sm",disabled:!I,title:y.error,onClick:()=>{T.loadHistoryNavigation(r.id).catch(()=>{})},children:P.t("timeline.navigationRetry")})}),Re&&h?.cursor&&!y?.complete&&L("div",{className:"absolute inset-x-0 top-2 z-10 flex flex-col items-center gap-1","data-history-loader":!0,children:[a(e,{variant:"outline",size:"sm",disabled:!I||r.restoring||h.loading,onClick:G,children:h.loading?P.t("timeline.loadingEarlier"):P.t("timeline.loadEarlier")}),h.error&&a("p",{role:"alert",className:"bg-background text-destructive max-w-md rounded px-2 py-1 text-xs",children:h.error})]}),N!==void 0&&a(Po,{items:he,audio:N.audio,scrollRoot:l,beforeReveal:q,ensureItemMounted:He,onPreviewItem:Ne,onRevealError:(i)=>Ge(P,i),targetTopMarginPx:16},r.id),a("button",{type:"button",className:z?"codex-scroll-to-bottom codex-scroll-to-bottom-hidden":"codex-scroll-to-bottom",tabIndex:z?-1:void 0,onClick:X,"aria-label":P.t("timeline.scrollToBottom"),children:x?L("span",{className:"codex-scroll-to-bottom-dots","aria-hidden":"true",children:[a("span",{className:"codex-wave-dot"}),a("span",{className:"codex-wave-dot"}),a("span",{className:"codex-wave-dot"})]}):a(Oe,{})})]})}
1
+ import{fo}from"./chunk-txn8v2yc.js";import{e}from"./chunk-wpdn3rx8.js";import{re,t,ie,n,Ge}from"./chunk-q6km9nha.js";import{Qo,Ve,an,Zo,Jo}from"./chunk-0n3q4g7y.js";import{qe}from"./chunk-efcpawhs.js";import{Bo}from"./chunk-ewvhf3wb.js";import{Fo}from"./chunk-as1cvbzm.js";import{Io,Po}from"./chunk-v8cyw9xa.js";import{wo,ko}from"./chunk-yy4tw3nj.js";import{bo}from"./chunk-2qhbm5y9.js";import{Oo}from"./chunk-wrkwz65x.js";import{Co}from"./chunk-1gp5f49d.js";import{codexExtensionCapabilities as Ce,codexMessageError as Me,codexRetryNotice as ze,codexTurnError as Be,nativeTurnId as ge}from"@nyssance/codex-acp-v2/client";import{ArrowDownIcon as Oe}from"lucide-react";import{useCallback as V,useEffect as A,useLayoutEffect as ve,useMemo as Q,useRef as b,useState as _}from"react";import{flushSync as Te}from"react-dom";import{jsx as a,jsxs as L}from"react/jsx-runtime";var ye=24;function Fe(r){let m=Math.max(0,r.turnTopPx-ye),v=Math.max(0,r.scrollHeightPx-r.viewportHeightPx),c=m-v;return{scrollTopPx:m,spacerPx:c>0?r.spacerPx+c:r.spacerPx}}function Ke({viewportRef:r,viewportProps:m,children:v}){return a("div",{ref:r,...m,className:"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain outline-none",children:v})}function _e({sessionId:r,turnId:m,root:v,error:c,connected:S}){let C=b(null),w=ie(),{t:N}=t(),R=V(()=>{w.loadHistoryTurn(r,m).catch(()=>{})},[w,r,m]);return A(()=>{if(!v||!C.current||!S||c)return;let B=new IntersectionObserver((T)=>{if(T.some((P)=>P.isIntersecting))B.disconnect(),R()},{root:v,rootMargin:"800px 0px"});return B.observe(C.current),()=>B.disconnect()},[v,S,c,R]),a("div",{ref:C,className:"flex min-h-80 flex-col justify-center gap-3 py-8","data-history-turn":m,"data-markdown-pending":!0,children:c?L("div",{className:"flex flex-col items-center gap-2",children:[a("p",{role:"alert",className:"text-destructive text-xs",children:c}),a(e,{variant:"outline",size:"sm",onClick:R,disabled:!S,children:N("timeline.navigationRetry")})]}):L("div",{role:"status","aria-label":N("timeline.navigationLoading"),className:"space-y-3",children:[a("div",{className:"bg-muted ml-auto h-5 w-1/3 rounded"}),a("div",{className:"bg-muted h-3 w-4/5 rounded"}),a("div",{className:"bg-muted h-3 w-3/5 rounded"})]})})}function $e(r,m){let v=b([]),c=b(null);if(c.current?.items!==r.items||c.current.state!==r.state||c.current.ended!==r.turnEndedAt||c.current.usage!==r.turnUsage||c.current.historyOrder!==m)c.current={state:r.state,items:r.items,ended:r.turnEndedAt,usage:r.turnUsage,historyOrder:m,turns:Qo(r,v.current,m)};let S=c.current.turns;return v.current=S,S}function Ue(r){return a(re,{host:r.host,client:r.client,children:a(De,{...r})})}function De({session:r,leading:m,afterTurn:v,answerActions:c,turnFooter:S,renderUserMessage:C,insert:w,navigation:N,anchorNewTurn:R=!1,Viewport:B=Ke}){let T=ie(),P=t(),y=n((i)=>i.historyNavigation[r.id]),d=$e(r,y?.turns),M=d.at(-1)?.key,xe=Zo(r,d),x=r.state==="running"||r.state==="requires_action",D=Q(()=>Fo(d,y),[d,y]),Y=Q(()=>D.flatMap((i)=>i.turn===void 0?[]:[{...i.turn,key:i.turnKey}]),[D]),he=Q(()=>N===void 0?[]:Io(d,r.turnUsage,y),[N,d,r.turnUsage,y]),Z=w&&w.afterItemId!==null?d.findIndex((i)=>i.items.some((u)=>u.id===w.afterItemId)):-1,j=b(d);j.current=d;let[l,be]=_(null),h=n((i)=>i.historyPages[r.id]),I=n((i)=>i.connection==="ready"),we=n((i)=>Ce(i.agent).sessionRetry),ee=h!==void 0;A(()=>{if(I&&ee&&!r.restoring)T.loadHistoryNavigation(r.id).catch(()=>{})},[T,I,ee,r.id,r.restoring]);let[Re,Se]=_(!1),F=b(null),[Pe,te]=_(!1),ne=b(0),W=b({key:M,running:x});W.current={key:M,running:x};let[oe,K]=_(0),k=b(0),E=b(null);k.current=oe;let Ie=V(()=>{if(E.current!==null)E.current.keepTop=!1},[]),{isFollowing:z,scrollToBottom:X,stopFollowing:q,schedulePin:ae,contentResized:le,beginLocate:ue,cancelLocation:se}=Oo(l,x,Ie),ce=V(()=>{if(l===null||!x)return;let i=d.at(-1)?.key;if(i===void 0)return;let u=ue(!0),s=()=>u.isCurrent()&&W.current.running&&W.current.key===i,o=()=>requestAnimationFrame(()=>requestAnimationFrame(()=>{if(!s())return;let g=l.querySelector(`[data-codex-turn="${CSS.escape(i)}"]`);if(g===null)return;let f=l.scrollTop+g.getBoundingClientRect().top-l.getBoundingClientRect().top,H=Fe({turnTopPx:f,scrollHeightPx:l.scrollHeight,viewportHeightPx:l.clientHeight,spacerPx:k.current});E.current=H.spacerPx>0?{element:g,heightPx:g.getBoundingClientRect().height+H.spacerPx,keepTop:!0}:null,Te(()=>K(H.spacerPx)),requestAnimationFrame(()=>{if(s())u.finish(H.scrollTopPx)})})),p=F.current;if(p===null)return;p.scrollToKey(i,void 0,{align:"top"}).then(()=>{if(s())o()})},[ue,x,l,d]);ve(()=>{if(!R||x)return;se(),E.current=null,k.current=0,K(0)},[R,se,x]);let G=V(()=>{q(),T.loadOlderHistory(r.id).catch(()=>{})},[T,r.id,q]);A(()=>{if(l===null)return;let i=()=>{let u=l.scrollTop<600;if(Se(u),u&&!y?.complete&&I&&!r.restoring&&!z&&h?.cursor&&!h.loading&&!h.error)G()};return i(),l.addEventListener("scroll",i,{passive:!0}),()=>l.removeEventListener("scroll",i)},[I,h,z,G,l,r.restoring,y?.complete]),A(()=>{wo({sessionId:r.id,turns:Y,api:F.current,beforeReveal:q,terminals:r.terminals})},[r.id,r.terminals,Y,q]),A(()=>()=>ko(r.id),[r.id]);let He=V(async(i,u)=>{let s=++ne.current;te(!0);try{if(i.isLoaded===!1&&i.nativeTurnId!==void 0)await T.loadHistoryTurn(r.id,i.nativeTurnId),await new Promise((f)=>requestAnimationFrame(()=>f()));if(!u())return null;let o=j.current.find((f)=>f.user?.id===(i.messageId??i.id))??j.current.find((f)=>f.user!==null&&i.nativeTurnId!==void 0&&f.items.some((H)=>ge(H)===i.nativeTurnId));if(!o?.user)return null;let p=o.user.id,g=F.current;if(g===null)throw Error("Virtual timeline is not mounted");return await g.scrollToKey(o.key,(f)=>f.querySelector(`[data-content-search-unit-key="${CSS.escape(p)}"]`),{align:"top"}),document.querySelector(`[data-chat-scroll] [data-content-search-unit-key="${CSS.escape(p)}"]`)}finally{if(ne.current===s)te(!1)}},[T,r.id]),Ne=V(async(i)=>{if(i.nativeTurnId!==void 0)await T.previewHistoryTurn(r.id,i.nativeTurnId)},[T,r.id]);A(()=>{if(l===null)return;let i=l.querySelector("[data-codex-timeline]");if(i===null)throw Error("Timeline content element is missing");let u=new ResizeObserver(()=>{let s=E.current,o=null;if(s!==null){let p=Math.max(0,s.heightPx-s.element.getBoundingClientRect().height);if(p!==k.current&&(p<k.current||s.keepTop)){if(k.current=p,Te(()=>K(p)),p===0)E.current=null}if(p>0&&s.keepTop)o=l.scrollTop+s.element.getBoundingClientRect().top-l.getBoundingClientRect().top-ye}le(o)});if(u.observe(i),u.observe(l),M!==void 0){let s=l.querySelector(`[data-codex-turn="${CSS.escape(M)}"]`);if(s===null)throw Error("Latest turn is not mounted");u.observe(s)}return()=>u.disconnect()},[le,M,l]),A(()=>{if(r.items.length===0)return;ae()},[ae,r.items]);let de=b(null);ve(()=>{if(l===null)return;let i=d.at(-1),u=de.current;if(de.current=i===void 0?null:{key:i.key,running:x},i===void 0||u===null||i.user===null||i.replayed)return;if(R){if(x&&r.turnEndedAt[i.user.id]===void 0&&(i.key!==u.key||!u.running))E.current=null,k.current=0,K(0),ce()}else if(i.key!==u.key)X()},[ce,R,x,X,l,r.turnEndedAt,d]);let ke=(i,u)=>{let s=i,o=s.turn;if(o===void 0){if(s.nativeTurnId===void 0)throw Error(`Turn is missing at index ${u}`);return a(_e,{sessionId:r.id,turnId:s.nativeTurnId,root:l,error:y?.turnErrors[s.nativeTurnId],connected:I&&!z&&!Pe})}let p=d.indexOf(o),g=o.key===xe,f=Jo(r,d,p),H=!g&&f.continued,U=o.key===M,O=o.errors.at(-1),me=O===void 0?null:Me(O),J=O===void 0?null:ge(O),Ee=!r.subagent&&U&&!g&&I&&we&&r.attached&&!r.readOnly&&!r.restoring&&O===r.items.at(-1)&&me!==null&&Be(me).category==="overloaded"&&J!==null&&r.lastStopReason!=="end_turn"&&r.lastStopReason!=="cancelled",fe=S?.(o)??null,Ae=o.work.length>0||o.final.length>0||o.errors.length>0||g||fe!==null||Ve(o)||an(o)||U&&(r.error!==null||r.lastStopReason==="cancelled"),pe=o.user===null?null:qe(o);return L("div",{"data-virtualized-turn-content":!0,"data-codex-turn":o.key,className:"flex flex-col gap-1.5",children:[o.user!==null&&(C===void 0?a(Co,{item:o.user,messageTime:pe}):C(o.user,pe)),Ae&&a(Bo,{sessionId:r.id,turn:o,terminals:r.terminals,active:g,blocked:r.state==="requires_action",continued:H,edits:f.edits,activityItems:f.items,workStartedAt:f.startedAt,isLast:U,error:r.error,retrying:g?ze(r._meta)??void 0:void 0,retry:Ee?{turnId:J,delaySeconds:bo(d),run:(Le)=>T.retrySession(r.id,J,Le)}:void 0,interrupted:an(o)||!g&&U&&r.lastStopReason==="cancelled",answerActions:c?.(o),footer:fe}),u===Z&&w?.node,v?.(o)]})};return L("div",{className:"relative flex min-h-0 flex-1 flex-col","data-stream-style":"codexUI",children:[a(B,{viewportRef:be,viewportProps:{"data-chat-scroll":"",style:{overflowAnchor:"none"},tabIndex:0,role:"log","aria-label":P.t("timeline.label")},children:a("div",{className:"codex-timeline-content flex min-h-full w-full flex-col",children:L("div",{"data-timeline-user-message-navigation-content":!0,className:"mx-auto flex w-full max-w-3xl shrink-0 flex-col",children:[w&&Z===-1&&w.node,a(fo,{ref:F,entries:D,renderTurn:ke,scrollElement:l,sessionKey:r.id,preserveViewport:!z,leadingInsetPx:12,leadingContent:m===void 0?void 0:a("div",{className:"pt-3",children:m})}),R&&a("div",{"aria-hidden":"true","data-turn-anchor-spacer":!0,className:"shrink-0",style:{height:oe}}),a("div",{"aria-hidden":"true",className:"h-6 shrink-0"})]})})}),a("div",{"aria-hidden":"true",className:"codex-timeline-bottom-fade"}),y?.error&&a("div",{className:"absolute inset-x-0 top-2 z-10 flex justify-center",children:a(e,{variant:"outline",size:"sm",disabled:!I,title:y.error,onClick:()=>{T.loadHistoryNavigation(r.id).catch(()=>{})},children:P.t("timeline.navigationRetry")})}),Re&&h?.cursor&&!y?.complete&&L("div",{className:"absolute inset-x-0 top-2 z-10 flex flex-col items-center gap-1","data-history-loader":!0,children:[a(e,{variant:"outline",size:"sm",disabled:!I||r.restoring||h.loading,onClick:G,children:h.loading?P.t("timeline.loadingEarlier"):P.t("timeline.loadEarlier")}),h.error&&a("p",{role:"alert",className:"bg-background text-destructive max-w-md rounded px-2 py-1 text-xs",children:h.error})]}),N!==void 0&&a(Po,{items:he,audio:N.audio,scrollRoot:l,beforeReveal:q,ensureItemMounted:He,onPreviewItem:Ne,onRevealError:(i)=>Ge(P,i),targetTopMarginPx:16},r.id),a("button",{type:"button",className:z?"codex-scroll-to-bottom codex-scroll-to-bottom-hidden":"codex-scroll-to-bottom",tabIndex:z?-1:void 0,onClick:X,"aria-label":P.t("timeline.scrollToBottom"),children:x?L("span",{className:"codex-scroll-to-bottom-dots","aria-hidden":"true",children:[a("span",{className:"codex-wave-dot"}),a("span",{className:"codex-wave-dot"}),a("span",{className:"codex-wave-dot"})]}):a(Oe,{})})]})}
2
2
  export{Ue};
@@ -1,2 +1,2 @@
1
- var ki=280;function ho({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 be({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 jt({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 vo({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 xo({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 yo({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{ki,ho,be,jt,vo,xo,yo};
1
+ var ki=280;function ho({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 be({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 Kt({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 vo({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 xo({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 yo({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{ki,ho,be,Kt,vo,xo,yo};
@@ -1 +1 @@
1
- import{v}from"./chunk-kjtd3wc3.js";import{j}from"./chunk-1fm5vx1n.js";import{useMemo as f}from"react";import{cva as p}from"class-variance-authority";import{cn as l}from"cn";import{jsx as t,jsxs as c}from"react/jsx-runtime";function Wt({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 Gt({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 co({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 u=p("group/field flex w-full gap-3 data-[invalid=true]:text-destructive",{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 uo({className:a,orientation:e="vertical",...o}){return t("div",{role:"group","data-slot":"field","data-orientation":e,className:l(u({orientation:e}),a),...o})}function fi({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 mo({className:a,...e}){return t(v,{"data-slot":"field-label",className:l("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border 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-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",a),...e})}function hi({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 ht({className:a,...e}){return t("p",{"data-slot":"field-description",className:l("text-start text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",a),...e})}function vi({children:a,className:e,...o}){return c("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(j,{className:"absolute inset-0 top-1/2"}),a&&t("span",{className:"relative mx-auto block w-fit bg-background px-2 text-muted-foreground","data-slot":"field-separator-content",children:a})]})}function xi({className:a,children:e,errors:o,...s}){let i=f(()=>{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:"ms-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-sm font-normal text-destructive",a),...s,children:i})}export{Wt,Gt,co,uo,fi,mo,hi,ht,vi,xi};
1
+ import{v}from"./chunk-kjtd3wc3.js";import{j}from"./chunk-1fm5vx1n.js";import{useMemo as f}from"react";import{cva as p}from"class-variance-authority";import{cn as l}from"cn";import{jsx as t,jsxs as c}from"react/jsx-runtime";function Gt({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 jt({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 co({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 u=p("group/field flex w-full gap-3 data-[invalid=true]:text-destructive",{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 uo({className:a,orientation:e="vertical",...o}){return t("div",{role:"group","data-slot":"field","data-orientation":e,className:l(u({orientation:e}),a),...o})}function fi({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 mo({className:a,...e}){return t(v,{"data-slot":"field-label",className:l("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border 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-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",a),...e})}function hi({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 ht({className:a,...e}){return t("p",{"data-slot":"field-description",className:l("text-start text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",a),...e})}function vi({children:a,className:e,...o}){return c("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(j,{className:"absolute inset-0 top-1/2"}),a&&t("span",{className:"relative mx-auto block w-fit bg-background px-2 text-muted-foreground","data-slot":"field-separator-content",children:a})]})}function xi({className:a,children:e,errors:o,...s}){let i=f(()=>{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:"ms-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-sm font-normal text-destructive",a),...s,children:i})}export{Gt,jt,co,uo,fi,mo,hi,ht,vi,xi};
@@ -1,2 +1,2 @@
1
- import{i,L,yt}from"./chunk-40d5the9.js";var Fn=5000;function de(t){return"pastedText"in t}function Er(t){return`file://${encodeURI(t).replaceAll("#","%23").replaceAll("?","%3F")}`}function Le(t,e,o){let n=(r,s)=>{for(let[a,x]of i){if(!x.attachments.some((p)=>p.id===e.id))continue;L(a,(p)=>p.map((d)=>d.id===e.id?{...e,url:s===void 0?"":Er(s),pastedText:{text:e.pastedText.text,status:r}}:d))}};if(!i.get(t)?.attachments.some((r)=>r.id===e.id))return;n("pending"),yt(e.id,o("pasted-text.txt",e.pastedText.text).then((r)=>n("ready",r)).catch(()=>n("error")))}function gt(t,e,o,n){if(t.defaultPrevented||t.currentTarget.disabled)return;if([...t.clipboardData.items].some((a)=>a.kind==="file"&&a.type.startsWith("image/")))return;let r=t.clipboardData.getData("text/plain");if(r.length<Fn)return;t.preventDefault(),t.stopPropagation();let s={id:crypto.randomUUID(),type:"file",mediaType:"text/plain",filename:o,url:"",pastedText:{text:r,status:"pending"}};L(e,(a)=>[...a,s]),Le(e,s,n)}
2
- export{Fn,de,Er,Le,gt};
1
+ import{i,L,bt}from"./chunk-2swp3nfs.js";var On=5000;function de(t){return"pastedText"in t}function Er(t){return`file://${encodeURI(t).replaceAll("#","%23").replaceAll("?","%3F")}`}function Le(t,e,o){let n=(r,s)=>{for(let[a,x]of i){if(!x.attachments.some((p)=>p.id===e.id))continue;L(a,(p)=>p.map((d)=>d.id===e.id?{...e,url:s===void 0?"":Er(s),pastedText:{text:e.pastedText.text,status:r}}:d))}};if(!i.get(t)?.attachments.some((r)=>r.id===e.id))return;n("pending"),bt(e.id,o("pasted-text.txt",e.pastedText.text).then((r)=>n("ready",r)).catch(()=>n("error")))}function gt(t,e,o,n){if(t.defaultPrevented||t.currentTarget.disabled)return;if([...t.clipboardData.items].some((a)=>a.kind==="file"&&a.type.startsWith("image/")))return;let r=t.clipboardData.getData("text/plain");if(r.length<On)return;t.preventDefault(),t.stopPropagation();let s={id:crypto.randomUUID(),type:"file",mediaType:"text/plain",filename:o,url:"",pastedText:{text:r,status:"pending"}};L(e,(a)=>[...a,s]),Le(e,s,n)}
2
+ export{On,de,Er,Le,gt};
@@ -1,2 +1,2 @@
1
- import{h,cn,er,dn,tr,un,nr}from"./chunk-en8s7tet.js";import{t,ie,ke,n}from"./chunk-q6km9nha.js";import{oe}from"./chunk-39sbgvd3.js";import{createStore as E}from"@alwith/api/client";import{isText as w,nativeTurnId as Q}from"@nyssance/codex-acp-v2/client";import{jsx as y}from"react/jsx-runtime";var b=E({entries:{}});function p(r,e){b.setState((s)=>({entries:{...s.entries,[r]:e}}))}function v(r,e){let s=Q(e),a=r.items.findLast((i)=>Q(i)!==null);return!e.replayed&&s!==null&&a!==void 0&&Q(a)===s}function M(r,e){for(let s of r.items){if(s.kind!=="user"||s.echo==="pending")continue;for(let a of[...un(s._meta),...s.content.filter(w).flatMap((i)=>un(i._meta))])if(a.questionItemId===e)return a.answer}return}function O({sessionId:r,item:e,question:s,index:a}){let i=ie(),{t:l}=t(),m=cn(e.id,a),c=JSON.stringify([r,m]),u=ke(b,(o)=>o.entries[c]),d=n((o)=>o.sessions[r]),k=n((o)=>o.connection==="ready"),f=u?.draft??er(s),x=d===void 0?u?.accepted:M(d,m)??u?.accepted,A=d!==void 0&&v(d,e),D=!d?.subagent&&k&&d?.attached&&!d.restoring&&!d.readOnly,g=x!==void 0?"answered":u?.skipped?"skipped":u?.pending?"submitting":!A?"closed":!D?"unavailable":"pending",C=async()=>{if(b.getState().entries[c]?.pending||g!=="pending")return;let o=i.state.sessions[r];if(o===void 0||!v(o,e)||!o.attached||o.readOnly||o.restoring)return;let S=dn(s,f);if(!S.trim())return;let q={questionItemId:m,question:s.title,answer:S};p(c,{draft:f,pending:!0});try{await i.prompt(r,[{type:"text",text:tr(q),_meta:{codex:{questionReply:q}}}]),p(c,{draft:f,accepted:S})}catch(I){p(c,{draft:f,error:I instanceof Error?I.message:String(I)})}};if(g==="closed")return null;return y(nr,{question:s,draft:f,status:g,answer:x,error:g==="pending"?u?.error:void 0,t:l,onChange:(o)=>p(c,{draft:o}),onSkip:()=>p(c,{draft:f,skipped:!0}),onSubmit:()=>{C()}})}function ln({sessionId:r,item:e}){let s=n((i)=>i.sessions[r]),a=h(e._meta);if(s===void 0||s.subagent!==void 0||s.readOnly||!v(s,e))return y(oe,{content:e.content.some((i)=>!w(i)||i.text.trim().length>0)?e.content:a.map((i)=>({type:"text",text:i.title})),messageId:e.id,streaming:!1});return y("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":e.id,children:a.map((i,l)=>y(O,{sessionId:r,item:e,question:i,index:l},cn(e.id,l)))})}
2
- export{ln};
1
+ import{h,dn,er,xt,tr,un,nr}from"./chunk-7mr1zajc.js";import{t,ie,ke,n}from"./chunk-q6km9nha.js";import{oe}from"./chunk-39sbgvd3.js";import{createStore as E}from"@alwith/api/client";import{isText as w,nativeTurnId as Q}from"@nyssance/codex-acp-v2/client";import{jsx as y}from"react/jsx-runtime";var b=E({entries:{}});function p(r,e){b.setState((s)=>({entries:{...s.entries,[r]:e}}))}function v(r,e){let s=Q(e),a=r.items.findLast((i)=>Q(i)!==null);return!e.replayed&&s!==null&&a!==void 0&&Q(a)===s}function M(r,e){for(let s of r.items){if(s.kind!=="user"||s.echo==="pending")continue;for(let a of[...un(s._meta),...s.content.filter(w).flatMap((i)=>un(i._meta))])if(a.questionItemId===e)return a.answer}return}function O({sessionId:r,item:e,question:s,index:a}){let i=ie(),{t:l}=t(),m=dn(e.id,a),c=JSON.stringify([r,m]),u=ke(b,(o)=>o.entries[c]),d=n((o)=>o.sessions[r]),k=n((o)=>o.connection==="ready"),f=u?.draft??er(s),x=d===void 0?u?.accepted:M(d,m)??u?.accepted,A=d!==void 0&&v(d,e),D=!d?.subagent&&k&&d?.attached&&!d.restoring&&!d.readOnly,g=x!==void 0?"answered":u?.skipped?"skipped":u?.pending?"submitting":!A?"closed":!D?"unavailable":"pending",C=async()=>{if(b.getState().entries[c]?.pending||g!=="pending")return;let o=i.state.sessions[r];if(o===void 0||!v(o,e)||!o.attached||o.readOnly||o.restoring)return;let S=xt(s,f);if(!S.trim())return;let q={questionItemId:m,question:s.title,answer:S};p(c,{draft:f,pending:!0});try{await i.prompt(r,[{type:"text",text:tr(q),_meta:{codex:{questionReply:q}}}]),p(c,{draft:f,accepted:S})}catch(I){p(c,{draft:f,error:I instanceof Error?I.message:String(I)})}};if(g==="closed")return null;return y(nr,{question:s,draft:f,status:g,answer:x,error:g==="pending"?u?.error:void 0,t:l,onChange:(o)=>p(c,{draft:o}),onSkip:()=>p(c,{draft:f,skipped:!0}),onSubmit:()=>{C()}})}function cn({sessionId:r,item:e}){let s=n((i)=>i.sessions[r]),a=h(e._meta);if(s===void 0||s.subagent!==void 0||s.readOnly||!v(s,e))return y(oe,{content:e.content.some((i)=>!w(i)||i.text.trim().length>0)?e.content:a.map((i)=>({type:"text",text:i.title})),messageId:e.id,streaming:!1});return y("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":e.id,children:a.map((i,l)=>y(O,{sessionId:r,item:e,question:i,index:l},dn(e.id,l)))})}
2
+ export{cn};
@@ -1,2 +1,2 @@
1
- import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function Ft({name:p,value:M,levels:h,disabled:c,onChange:P}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===M)),[v,d]=k(null),l=y(null),[I,x]=k(null),b=y(0),s=v??I??g,w=(t)=>{let n=++b.current;x(t);let e=()=>{if(b.current===n)x(null)};try{Promise.resolve(P(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=100,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/Math.max(1,n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/Math.max(1,n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
2
- export{Ft};
1
+ import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function Bt({name:p,value:M,levels:h,disabled:c,onChange:P}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===M)),[v,d]=k(null),l=y(null),[I,x]=k(null),b=y(0),s=v??I??g,w=(t)=>{let n=++b.current;x(t);let e=()=>{if(b.current===n)x(null)};try{Promise.resolve(P(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=100,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/Math.max(1,n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/Math.max(1,n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
2
+ export{Bt};
@@ -1,4 +1,4 @@
1
- import{e}from"./chunk-wpdn3rx8.js";import{j}from"./chunk-1fm5vx1n.js";import{_t}from"./chunk-10j68dch.js";import{Sn}from"./chunk-w38vbf7h.js";import{_e}from"./chunk-7zrnt6zw.js";import{autoUpdate as rt}from"@floating-ui/dom";import{cn as X}from"cn";import{BookOpenTextIcon as st,FileIcon as it,StoreIcon as lt}from"lucide-react";import{useCallback as ut,useEffect as v,useLayoutEffect as Y,useMemo as Z,useRef as _,useState as g}from"react";import{createPortal as at}from"react-dom";import{jsx as p,jsxs as E,Fragment as ct}from"react/jsx-runtime";function Tn({handleRef:a,anchorRef:c,commands:C,searchFiles:u,onMention:R,onSearchError:H,fileSearchDebounceMs:M=0,bashMode:A=!1,forcedOpen:i=!1,onForcedOpenChange:f,emptyLabel:F,fileStatusLabels:h,morePlugins:D}){let z=_e(),l=z.textInput.value,[K,U]=g(0),[y,P]=g(null),[b,L]=g(0),V=_(null);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>U(t.selectionStart??0),o=()=>{if(document.activeElement===t)n()};return t.addEventListener("keyup",n),t.addEventListener("click",n),t.addEventListener("input",n),t.addEventListener("select",n),t.addEventListener("focus",n),document.addEventListener("selectionchange",o),()=>{t.removeEventListener("keyup",n),t.removeEventListener("click",n),t.removeEventListener("input",n),t.removeEventListener("select",n),t.removeEventListener("focus",n),document.removeEventListener("selectionchange",o)}});let W=Z(()=>A&&l.startsWith("!")?null:Sn(l,K),[l,K,A]),r=W?.kind==="at"&&!u?null:W,q=`${r?.kind??"forced"}:${r?.query??""}:${i}`,[O,tt]=g(q);if(O!==q)tt(q),L(0);let I=_(null);v(()=>{if(!i){I.current=null;return}if(I.current===null)I.current=l;else if(l!==I.current)f?.(!1)},[i,l,f]);let x=r?.kind==="at"?r.query:null;v(()=>{if(x===null||!u){P(null);return}let t=!0,n=()=>{u(x).then((s)=>{if(t)P({query:x,search:u,items:s})},(s)=>{if(t)P({query:x,search:u,items:[]}),H(s)})},o=M>0?window.setTimeout(n,M):null;if(o===null)n();return()=>{if(t=!1,o!==null)window.clearTimeout(o)}},[x,u,M,H]);let d=Z(()=>{if(r?.kind==="at")return y?.query===r.query&&y.search===u?y.items:[];if(r)return _t(C,r.query);if(i)return _t(C,"");return[]},[r,i,C,y,u]),[et,N]=g(!1);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>N(!0),o=()=>{if(N(!1),i)f?.(!1)};return N(document.activeElement===t),t.addEventListener("focus",n),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",n),t.removeEventListener("blur",o)}},[a,i,f]),v(()=>{if(i)a.current?.getTextarea()?.focus()},[i,a]);let m=et&&(r!==null?r.kind==="slash"||d.length>0||!!h:i);v(()=>{if(!m)return;V.current?.querySelector(`[data-idx="${b}"]`)?.scrollIntoView({block:"nearest"})},[b,m]);function Q(t){let n=a.current?.getTextarea();if(!n)return;let o,s;if(r){let B=r.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(o=l.slice(0,r.start)+B+l.slice(r.end),r.kind==="at")R?.(t.payload);s=r.start+B.length}else if(i)o=`${l.length===0||l.endsWith(`
1
+ import{e}from"./chunk-wpdn3rx8.js";import{j}from"./chunk-1fm5vx1n.js";import{Ht}from"./chunk-tz96pyvx.js";import{Sn}from"./chunk-w38vbf7h.js";import{_e}from"./chunk-cazdmcwd.js";import{autoUpdate as rt}from"@floating-ui/dom";import{cn as X}from"cn";import{BookOpenTextIcon as st,FileIcon as it,StoreIcon as lt}from"lucide-react";import{useCallback as ut,useEffect as v,useLayoutEffect as Y,useMemo as Z,useRef as _,useState as g}from"react";import{createPortal as at}from"react-dom";import{jsx as p,jsxs as E,Fragment as ct}from"react/jsx-runtime";function Tn({handleRef:a,anchorRef:c,commands:C,searchFiles:u,onMention:R,onSearchError:H,fileSearchDebounceMs:M=0,bashMode:A=!1,forcedOpen:i=!1,onForcedOpenChange:f,emptyLabel:F,fileStatusLabels:h,morePlugins:D}){let z=_e(),l=z.textInput.value,[K,U]=g(0),[y,P]=g(null),[b,L]=g(0),V=_(null);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>U(t.selectionStart??0),o=()=>{if(document.activeElement===t)n()};return t.addEventListener("keyup",n),t.addEventListener("click",n),t.addEventListener("input",n),t.addEventListener("select",n),t.addEventListener("focus",n),document.addEventListener("selectionchange",o),()=>{t.removeEventListener("keyup",n),t.removeEventListener("click",n),t.removeEventListener("input",n),t.removeEventListener("select",n),t.removeEventListener("focus",n),document.removeEventListener("selectionchange",o)}});let W=Z(()=>A&&l.startsWith("!")?null:Sn(l,K),[l,K,A]),r=W?.kind==="at"&&!u?null:W,q=`${r?.kind??"forced"}:${r?.query??""}:${i}`,[O,tt]=g(q);if(O!==q)tt(q),L(0);let I=_(null);v(()=>{if(!i){I.current=null;return}if(I.current===null)I.current=l;else if(l!==I.current)f?.(!1)},[i,l,f]);let x=r?.kind==="at"?r.query:null;v(()=>{if(x===null||!u){P(null);return}let t=!0,n=()=>{u(x).then((s)=>{if(t)P({query:x,search:u,items:s})},(s)=>{if(t)P({query:x,search:u,items:[]}),H(s)})},o=M>0?window.setTimeout(n,M):null;if(o===null)n();return()=>{if(t=!1,o!==null)window.clearTimeout(o)}},[x,u,M,H]);let d=Z(()=>{if(r?.kind==="at")return y?.query===r.query&&y.search===u?y.items:[];if(r)return Ht(C,r.query);if(i)return Ht(C,"");return[]},[r,i,C,y,u]),[et,N]=g(!1);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>N(!0),o=()=>{if(N(!1),i)f?.(!1)};return N(document.activeElement===t),t.addEventListener("focus",n),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",n),t.removeEventListener("blur",o)}},[a,i,f]),v(()=>{if(i)a.current?.getTextarea()?.focus()},[i,a]);let m=et&&(r!==null?r.kind==="slash"||d.length>0||!!h:i);v(()=>{if(!m)return;V.current?.querySelector(`[data-idx="${b}"]`)?.scrollIntoView({block:"nearest"})},[b,m]);function Q(t){let n=a.current?.getTextarea();if(!n)return;let o,s;if(r){let B=r.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(o=l.slice(0,r.start)+B+l.slice(r.end),r.kind==="at")R?.(t.payload);s=r.start+B.length}else if(i)o=`${l.length===0||l.endsWith(`
2
2
  `)?l:`${l}
3
3
  `}/${t.payload} `,s=o.length,f?.(!1);else return;z.textInput.setInput(o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s,s)})}v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=(o)=>{if(!m)return;if(a.current?.isComposing()||o.isComposing||o.keyCode===229)return;if(o.key==="ArrowDown")o.preventDefault(),o.stopPropagation(),L((s)=>d.length===0?0:Math.min(d.length-1,s+1));else if(o.key==="ArrowUp")o.preventDefault(),o.stopPropagation(),L((s)=>Math.max(0,s-1));else if(o.key==="Enter"||o.key==="Tab"){o.preventDefault(),o.stopPropagation();let s=d[b];if(s)Q(s)}else if(o.key==="Escape")if(o.preventDefault(),o.stopPropagation(),r)U(Math.max(0,r.start-1)),t.setSelectionRange(r.start,r.start);else f?.(!1)};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)});let[k,G]=g(null),[S,nt]=g(null),T=ut(()=>{let t=c?.current;if(!t)return;let n=t.getBoundingClientRect();G({left:n.left,width:n.width,bottom:window.innerHeight-n.top+8})},[c]);if(Y(()=>{if(!m){G(null);return}T()},[m,T]),Y(()=>{let t=c?.current;if(!m||!t||!S)return;return rt(t,S,T,{animationFrame:!0})},[m,S,c,T]),!m||c&&!k)return null;let w=r?r.kind==="slash":i,ot=w?st:it,J=p("div",{ref:nt,className:c?"fixed z-50":"absolute inset-x-0 bottom-full z-50 mb-2",style:c&&k?{left:k.left,width:k.width,bottom:k.bottom}:void 0,children:E("div",{ref:V,role:"listbox",onMouseDown:(t)=>t.preventDefault(),className:"bg-popover text-popover-foreground ring-foreground/10 pointer-events-auto w-full overflow-hidden rounded-lg p-1 shadow-md ring-1 outline-hidden",children:[E("div",{className:"max-h-72 overflow-y-auto",children:[d.length===0&&w&&p("div",{className:"text-muted-foreground px-2 py-3 text-xs",children:F}),d.length===0&&!w&&h&&p("div",{role:"status",className:"text-muted-foreground px-2 py-3 text-xs",children:y?.query===x&&y.search===u?h.empty:h.loading}),d.map((t,n)=>E(e,{type:"button",variant:"ghost",role:"option","aria-selected":n===b,"data-idx":n,onMouseDown:(o)=>{o.preventDefault(),Q(t)},onMouseEnter:()=>L(n),className:X("flex h-auto w-full items-center justify-start gap-2.5 rounded-md px-2.5 py-2 text-start",n===b&&"bg-muted"),children:[p(ot,{className:X("size-4 shrink-0",w?"text-blue-500":"text-muted-foreground")}),p("span",{className:"text-foreground shrink-0 text-sm font-medium",children:t.label}),t.description&&p("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:t.description})]},t.key))]}),w&&D&&E(ct,{children:[p(j,{}),E(e,{type:"button",variant:"ghost",onMouseDown:(t)=>{t.preventDefault(),f?.(!1),D.open()},className:"h-auto w-full justify-start px-2.5 py-2",children:[p(lt,{"data-icon":"inline-start"}),D.label]})]})]})});return c?at(J,document.body):J}
4
4
  export{Tn};
@@ -1,2 +1,2 @@
1
- import{CacheStorage as I,Soundfont as M}from"smplr";var T=4,y=21,l=88,s=[39,41,43,44,46,48,50],p=0.035,b=0.16,S=88,E=50,h="acoustic_grand_piano",O="MusyngKite",w="FluidR3_GM",f=[0,2,4,5,7,9,11],U=2,C=5,m=globalThis;if(m.__alwithTimelineUserMessageNavigationAudio?.version!==T)m.__alwithTimelineUserMessageNavigationAudio={version:T,context:null,storage:I("alwith-timeline-navigation-instruments"),players:new Map,nextNoteTime:0,unlockConsumerCount:0};var r=m.__alwithTimelineUserMessageNavigationAudio;function d(){return r.context??=new AudioContext,r.context}function c(){let e=d();if(e.state==="running"){r.nextNoteTime=e.currentTime;return}e.resume().then(()=>{r.nextNoteTime=e.currentTime},(n)=>{if(n instanceof DOMException&&n.name==="NotAllowedError")return;console.error("Failed to unlock timeline navigation audio",n)})}function k(e){let n=d();return M(n,{instrument:e,kit:e===h?O:w,storage:r.storage,volume:E})}function g(e){let n=r.players.get(e);if(n!==void 0)return n;let t=k(e),i={player:t,ready:t.ready};return r.players.set(e,i),i}function Eo(e){g(e).ready.catch((n)=>{console.error(`Failed to load navigation instrument "${e}"`,n)})}function Ti(){c()}function Ao(){if(r.unlockConsumerCount===0)window.addEventListener("pointerdown",c,{capture:!0}),window.addEventListener("keydown",c,{capture:!0});return r.unlockConsumerCount++,()=>{if(r.unlockConsumerCount--,r.unlockConsumerCount===0)window.removeEventListener("pointerdown",c,{capture:!0}),window.removeEventListener("keydown",c,{capture:!0})}}function Lo(e,n,t,i,o){if(o==="none")return;let a=Math.sign(n-e),u=Math.abs(n-e),x=Array.from({length:u},(L,A)=>{let N=e+a*(A+1),v=t[N];return wr(N,t.length,v.inputTokens,v.outputTokens,o)});_(i,x)}function Si(e,n,t,i,o,a){if(a==="none")return;_(o,[wr(e,n,t,i,a)])}function wr(e,n,t,i,o){if(o==="none")throw Error("navigationMidiNote: 声音已关闭,不该求音符");if(o==="auto")return Or(t,i);return kr(e,n)}function Or(e,n){let t=Math.imul(e,5)+Math.imul(n,3)>>>0,i=(Math.imul(e,11)^Math.imul(n,13))>>>0,o=t%f.length;return 12*(U+i%C+1)+f[o]}function kr(e,n){return y+Fr(e,n)}function Ii(e,n){return D(kr(e,n))}function Fr(e,n){if(n<=l)return Br(n)[n-e-1];return Math.round((n-e-1)/(n-1)*(l-1))}function Br(e){if(e<=s.length)return s.slice(0,e);let n=new Set(s),t=s[0]-1,i=s.at(-1)+1;while(n.size<e&&(t>=0||i<l)){if(t>=0&&n.size<e)n.add(t--);if(i<l&&n.size<e)n.add(i++)}for(let o=0;n.size<e&&o<l;o++)n.add(o);return[...n].toSorted((o,a)=>o-a)}function D(e){return 440*2**((e-69)/12)}function _(e,n){let t=d();if(t.state!=="running")return;let{player:i,ready:o}=g(e);o.then(()=>{let a=Math.max(t.currentTime,r.nextNoteTime);for(let u=0;u<n.length;u++)i.start({note:n[u],time:a+u*p,duration:b,velocity:S});r.nextNoteTime=a+n.length*p}).catch((a)=>{console.error(`Failed to play navigation instrument "${e}"`,a)})}function Pi(){return r.context?.state}function Ni(e){return g(e).ready}
2
- export{Eo,Ti,Ao,Lo,Si,wr,Or,kr,Ii,Fr,Br,Pi,Ni};
1
+ import{CacheStorage as I,Soundfont as M}from"smplr";var T=4,y=21,l=88,s=[39,41,43,44,46,48,50],p=0.035,b=0.16,S=88,E=50,h="acoustic_grand_piano",O="MusyngKite",w="FluidR3_GM",f=[0,2,4,5,7,9,11],U=2,C=5,m=globalThis;if(m.__alwithTimelineUserMessageNavigationAudio?.version!==T)m.__alwithTimelineUserMessageNavigationAudio={version:T,context:null,storage:I("alwith-timeline-navigation-instruments"),players:new Map,nextNoteTime:0,unlockConsumerCount:0};var r=m.__alwithTimelineUserMessageNavigationAudio;function d(){return r.context??=new AudioContext,r.context}function c(){let e=d();if(e.state==="running"){r.nextNoteTime=e.currentTime;return}e.resume().then(()=>{r.nextNoteTime=e.currentTime},(n)=>{if(n instanceof DOMException&&n.name==="NotAllowedError")return;console.error("Failed to unlock timeline navigation audio",n)})}function k(e){let n=d();return M(n,{instrument:e,kit:e===h?O:w,storage:r.storage,volume:E})}function g(e){let n=r.players.get(e);if(n!==void 0)return n;let t=k(e),i={player:t,ready:t.ready};return r.players.set(e,i),i}function Eo(e){g(e).ready.catch((n)=>{console.error(`Failed to load navigation instrument "${e}"`,n)})}function Ti(){c()}function Ao(){if(r.unlockConsumerCount===0)window.addEventListener("pointerdown",c,{capture:!0}),window.addEventListener("keydown",c,{capture:!0});return r.unlockConsumerCount++,()=>{if(r.unlockConsumerCount--,r.unlockConsumerCount===0)window.removeEventListener("pointerdown",c,{capture:!0}),window.removeEventListener("keydown",c,{capture:!0})}}function Lo(e,n,t,i,o){if(o==="none")return;let a=Math.sign(n-e),u=Math.abs(n-e),x=Array.from({length:u},(L,A)=>{let N=e+a*(A+1),v=t[N];return wr(N,t.length,v.inputTokens,v.outputTokens,o)});_(i,x)}function Si(e,n,t,i,o,a){if(a==="none")return;_(o,[wr(e,n,t,i,a)])}function wr(e,n,t,i,o){if(o==="none")throw Error("navigationMidiNote: 声音已关闭,不该求音符");if(o==="auto")return Fr(t,i);return kr(e,n)}function Fr(e,n){let t=Math.imul(e,5)+Math.imul(n,3)>>>0,i=(Math.imul(e,11)^Math.imul(n,13))>>>0,o=t%f.length;return 12*(U+i%C+1)+f[o]}function kr(e,n){return y+Or(e,n)}function Ii(e,n){return D(kr(e,n))}function Or(e,n){if(n<=l)return Br(n)[n-e-1];return Math.round((n-e-1)/(n-1)*(l-1))}function Br(e){if(e<=s.length)return s.slice(0,e);let n=new Set(s),t=s[0]-1,i=s.at(-1)+1;while(n.size<e&&(t>=0||i<l)){if(t>=0&&n.size<e)n.add(t--);if(i<l&&n.size<e)n.add(i++)}for(let o=0;n.size<e&&o<l;o++)n.add(o);return[...n].toSorted((o,a)=>o-a)}function D(e){return 440*2**((e-69)/12)}function _(e,n){let t=d();if(t.state!=="running")return;let{player:i,ready:o}=g(e);o.then(()=>{let a=Math.max(t.currentTime,r.nextNoteTime);for(let u=0;u<n.length;u++)i.start({note:n[u],time:a+u*p,duration:b,velocity:S});r.nextNoteTime=a+n.length*p}).catch((a)=>{console.error(`Failed to play navigation instrument "${e}"`,a)})}function Pi(){return r.context?.state}function Ni(e){return g(e).ready}
2
+ export{Eo,Ti,Ao,Lo,Si,wr,Fr,kr,Ii,Or,Br,Pi,Ni};
@@ -1,2 +1,2 @@
1
- import{n}from"./chunk-q6km9nha.js";import{V,Lt,W}from"./chunk-5cnw6yc7.js";import{e}from"./chunk-wpdn3rx8.js";import{he,ve,xe,ye}from"./chunk-d5ga13n0.js";import{xt,o,C}from"./chunk-6acs2hzs.js";import{st}from"./chunk-7f89k828.js";import{vt}from"./chunk-zzhwfrzb.js";import{rt,it}from"./chunk-xfx689xm.js";import{at}from"./chunk-2mkqpzzx.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 hr({host:t,client:l,...c}){let s=R(()=>t.openDiff?t:{...t,openDiff:rt},[t]);return i(xt,{host:s,client:l,children:[r(E,{...c}),!t.openDiff&&r(it,{})]})}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}=o(),{t:a}=d,p=n((m)=>m.connection==="ready"),f=n((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(V,{children:[r(A,{}),r(Lt,{children:a("conversation.stopped")}),r(W,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),D?u??r(he,{className:"flex-1",children:i(ve,{children:[r(xe,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(ye,{children:a("conversation.welcomeDescription")})]})}):r(vt,{session:t,timeline:s}),r(at,{sessionId:t.id}),t.readOnly?r("div",{className:"mx-auto w-full max-w-3xl shrink-0 px-6 pb-5","data-readonly-composer":!0,children:i(V,{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(Lt,{children:a("conversation.readOnlyTitle")}),r(W,{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(st,{session:t})]}),N]})}
1
+ import{n}from"./chunk-q6km9nha.js";import{V,Dt,W}from"./chunk-jdjk6tf4.js";import{e}from"./chunk-wpdn3rx8.js";import{he,ve,xe,ye}from"./chunk-d5ga13n0.js";import{yt,o,C}from"./chunk-0ss92kxr.js";import{st}from"./chunk-2cbya1f5.js";import{vt}from"./chunk-3ebdnbcj.js";import{rt,it}from"./chunk-xfx689xm.js";import{at}from"./chunk-jfb6a7tz.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 hr({host:t,client:l,...c}){let s=R(()=>t.openDiff?t:{...t,openDiff:rt},[t]);return i(yt,{host:s,client:l,children:[r(E,{...c}),!t.openDiff&&r(it,{})]})}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}=o(),{t:a}=d,p=n((m)=>m.connection==="ready"),f=n((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(V,{children:[r(A,{}),r(Dt,{children:a("conversation.stopped")}),r(W,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),D?u??r(he,{className:"flex-1",children:i(ve,{children:[r(xe,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(ye,{children:a("conversation.welcomeDescription")})]})}):r(vt,{session:t,timeline:s}),r(at,{sessionId:t.id}),t.readOnly?r("div",{className:"mx-auto w-full max-w-3xl shrink-0 px-6 pb-5","data-readonly-composer":!0,children:i(V,{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(Dt,{children:a("conversation.readOnlyTitle")}),r(W,{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(st,{session:t})]}),N]})}
2
2
  export{hr};
@@ -1,2 +1,2 @@
1
- import{G}from"./chunk-r9p03chx.js";import{t}from"./chunk-q6km9nha.js";import{SquareSlashIcon as s}from"lucide-react";import{useRef as l}from"react";import{jsx as r}from"react/jsx-runtime";function En({textareaRef:a,onOpenChange:p,menuOpen:e,disabled:m}){let{t:o}=t(),n=l(!1);return r(G,{"aria-label":o("composer.commands"),title:o("composer.commands"),disabled:m,"aria-pressed":e,onPointerDown:()=>{n.current=e},onClick:()=>{p(!n.current),a.current?.getTextarea()?.focus()},children:r(s,{className:"size-4"})})}
1
+ import{G}from"./chunk-kmhwwzga.js";import{t}from"./chunk-q6km9nha.js";import{SquareSlashIcon as s}from"lucide-react";import{useRef as l}from"react";import{jsx as r}from"react/jsx-runtime";function En({textareaRef:a,onOpenChange:p,menuOpen:e,disabled:m}){let{t:o}=t(),n=l(!1);return r(G,{"aria-label":o("composer.commands"),title:o("composer.commands"),disabled:m,"aria-pressed":e,onPointerDown:()=>{n.current=e},onClick:()=>{p(!n.current),a.current?.getTextarea()?.focus()},children:r(s,{className:"size-4"})})}
2
2
  export{En};
@@ -1,2 +1,2 @@
1
- import{Dn}from"./chunk-nt224frq.js";import{o,C}from"./chunk-6acs2hzs.js";import{N,c}from"./chunk-n1tjf64a.js";import{createLucideIcon as w,HandIcon as y,ShieldAlertIcon as S,ShieldCheckIcon as r}from"lucide-react";import{jsx as t}from"react/jsx-runtime";var O=w("ApprovalShield",[["path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11",key:"shield"}],["path",{d:"m8 8 3 3-3 3M13 15h3",key:"terminal"}]]),u={"read-only":y,"workspace-write":r,agent:O,"agent-full-access":S},b={"read-only":"readOnly","workspace-write":"workspaceAccess",agent:"agent","agent-full-access":"fullAccess"};function ut({sessionId:g,options:m,disabled:f,onConfigChange:l}){let{host:p,client:h}=o(),{t:a}=p,s=c(m,"mode");if(!s)return null;let n=s.currentValue,d=N(s).map((e)=>{let i=b[e.value];return i?{...e,name:a(`permissionModes.${i}.name`),description:a(`permissionModes.${i}.description`)}:e}),I=d.find((e)=>e.value===n),M=u[n]??r,v=(e)=>{if(e===n)return;C(p,l?l(s.configId,e):h.setConfig(g,s.configId,e))};return t(Dn,{value:n,warning:n==="agent-full-access",currentName:I?.name??n,icon:t(M,{className:"size-3.5 shrink-0"}),header:a("permissionModes.heading"),disabled:f,label:a("composer.switchPermissionMode"),onValueChange:v,options:d.map((e)=>{let i=u[e.value]??r,k=e.value==="agent-full-access";return{value:e.value,label:t("span",{"data-permission-warning":k?"":void 0,children:e.name}),description:e.description?t("span",{className:"whitespace-normal",children:e.description}):void 0,icon:t(i,{className:"size-3.5 shrink-0"})}})})}
1
+ import{Dn}from"./chunk-sf6ze845.js";import{o,C}from"./chunk-0ss92kxr.js";import{N,c}from"./chunk-n1tjf64a.js";import{createLucideIcon as w,HandIcon as y,ShieldAlertIcon as S,ShieldCheckIcon as r}from"lucide-react";import{jsx as t}from"react/jsx-runtime";var O=w("ApprovalShield",[["path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11",key:"shield"}],["path",{d:"m8 8 3 3-3 3M13 15h3",key:"terminal"}]]),u={"read-only":y,"workspace-write":r,agent:O,"agent-full-access":S},b={"read-only":"readOnly","workspace-write":"workspaceAccess",agent:"agent","agent-full-access":"fullAccess"};function ut({sessionId:g,options:m,disabled:f,onConfigChange:l}){let{host:p,client:h}=o(),{t:a}=p,s=c(m,"mode");if(!s)return null;let n=s.currentValue,d=N(s).map((e)=>{let i=b[e.value];return i?{...e,name:a(`permissionModes.${i}.name`),description:a(`permissionModes.${i}.description`)}:e}),I=d.find((e)=>e.value===n),M=u[n]??r,v=(e)=>{if(e===n)return;C(p,l?l(s.configId,e):h.setConfig(g,s.configId,e))};return t(Dn,{value:n,warning:n==="agent-full-access",currentName:I?.name??n,icon:t(M,{className:"size-3.5 shrink-0"}),header:a("permissionModes.heading"),disabled:f,label:a("composer.switchPermissionMode"),onValueChange:v,options:d.map((e)=>{let i=u[e.value]??r,k=e.value==="agent-full-access";return{value:e.value,label:t("span",{"data-permission-warning":k?"":void 0,children:e.name}),description:e.description?t("span",{className:"whitespace-normal",children:e.description}):void 0,icon:t(i,{className:"size-3.5 shrink-0"})}})})}
2
2
  export{ut};