@alwith/module-chat 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-host.js +1 -1
- package/dist/approval/choice-elicitation-form.js +1 -1
- package/dist/approval/choice-schema.js +1 -1
- package/dist/approval/permission-options.js +1 -1
- package/dist/approval/permission-view.js +1 -1
- package/dist/approval/schema-elicitation-form.js +1 -1
- package/dist/approval/url-elicitation-card.js +1 -1
- package/dist/chunk-00sds3wb.js +2 -0
- package/dist/{chunk-m5jhw1e6.js → chunk-0h993cve.js} +2 -2
- package/dist/{chunk-61vxy6yd.js → chunk-0jw4ffzj.js} +1 -1
- package/dist/{chunk-a2ftkzak.js → chunk-0vy9fzs3.js} +1 -1
- package/dist/{chunk-1drkvxzk.js → chunk-11v81zha.js} +1 -1
- package/dist/chunk-1dce9zt8.js +2 -0
- package/dist/{chunk-rdtj6bad.js → chunk-1mnc7200.js} +2 -2
- package/dist/chunk-1mv3y3cs.js +2 -0
- package/dist/{chunk-zjg9n6zj.js → chunk-1q1hyka4.js} +2 -2
- package/dist/chunk-1tz8afx9.js +2 -0
- package/dist/{chunk-76tkqx9n.js → chunk-1v3wc4cv.js} +2 -2
- package/dist/chunk-29wvjf38.js +2 -0
- package/dist/{chunk-93q2dm10.js → chunk-2q71dv8k.js} +1 -1
- package/dist/chunk-2w9f1q84.js +4 -0
- package/dist/{chunk-3wsg6710.js → chunk-34xzrr3s.js} +2 -2
- package/dist/{chunk-wjs8bwpk.js → chunk-39f0d44a.js} +2 -2
- package/dist/{chunk-0k654tyt.js → chunk-3d58k7fn.js} +2 -2
- package/dist/{chunk-y6r6tzfh.js → chunk-3p9j3gmw.js} +2 -2
- package/dist/{chunk-0mf7yh69.js → chunk-3zj0ka21.js} +2 -2
- package/dist/{chunk-0habpww5.js → chunk-42fw8maa.js} +1 -1
- package/dist/{chunk-78ew0821.js → chunk-48av28r4.js} +5 -5
- package/dist/{chunk-jd61cfkk.js → chunk-494jkxv9.js} +2 -2
- package/dist/chunk-52y4pyr1.js +2 -0
- package/dist/{chunk-q3hdevem.js → chunk-5nemwzzv.js} +2 -2
- package/dist/{chunk-6j4g51ff.js → chunk-5s5tedyw.js} +2 -2
- package/dist/{chunk-ehh31hzz.js → chunk-5w48y2ad.js} +1 -1
- package/dist/{chunk-qgfq5vrz.js → chunk-5xjm1hab.js} +1 -1
- package/dist/{chunk-0fvpmcps.js → chunk-6bdd2cgs.js} +2 -2
- package/dist/{chunk-tpx841s3.js → chunk-6jyd3a7v.js} +2 -2
- package/dist/{chunk-0grd0g0x.js → chunk-76fxyvb0.js} +2 -2
- package/dist/chunk-7w4tjrdw.js +2 -0
- package/dist/{chunk-hrexfky6.js → chunk-812n3qd8.js} +2 -2
- package/dist/{chunk-8p0074ye.js → chunk-85gdavf5.js} +2 -2
- package/dist/{chunk-n4cseazv.js → chunk-8fd8jhbf.js} +3 -3
- package/dist/chunk-8w6ze6pw.js +4 -0
- package/dist/{chunk-ttk21631.js → chunk-91qp7sps.js} +2 -2
- package/dist/chunk-932ykb37.js +2 -0
- package/dist/{chunk-fzetrkvd.js → chunk-9d0vkezs.js} +2 -2
- package/dist/{chunk-hhw1pjz6.js → chunk-9mcfd41e.js} +2 -2
- package/dist/{chunk-xw0gvwh5.js → chunk-9yv5c2s3.js} +2 -2
- package/dist/{chunk-yg42bpjr.js → chunk-ad32h099.js} +3 -3
- package/dist/{chunk-yegh80h4.js → chunk-ap1br099.js} +2 -2
- package/dist/{chunk-8bzk9e4v.js → chunk-at0v48cp.js} +2 -2
- package/dist/chunk-azp1438s.js +2 -0
- package/dist/{chunk-wf4tq3fn.js → chunk-b0v983ch.js} +1 -1
- package/dist/chunk-bafntrka.js +3 -0
- package/dist/{chunk-twwqgd8e.js → chunk-bje0nmh9.js} +2 -2
- package/dist/chunk-bse4zh1d.js +2 -0
- package/dist/chunk-bx1x7t6v.js +3 -0
- package/dist/{chunk-yf2p44mq.js → chunk-c7b8rscf.js} +2 -2
- package/dist/{chunk-r7c0tca8.js → chunk-cbbr9m3a.js} +2 -2
- package/dist/{chunk-nb5wjv92.js → chunk-cka09jf6.js} +2 -2
- package/dist/chunk-dgx31pdr.js +2 -0
- package/dist/{chunk-17wjmyj7.js → chunk-dhvpffgf.js} +2 -2
- package/dist/chunk-dkbtw3g9.js +2 -0
- package/dist/{chunk-z4zm74ge.js → chunk-eyqbvc19.js} +2 -2
- package/dist/{chunk-8fn5n4yv.js → chunk-ez1ac611.js} +2 -2
- package/dist/{chunk-4jagfjhm.js → chunk-f3xhtnkz.js} +2 -2
- package/dist/chunk-f59aepmd.js +2 -0
- package/dist/{chunk-bwas6kp2.js → chunk-fv7tp8pr.js} +2 -2
- package/dist/chunk-gdbzk1kt.js +2 -0
- package/dist/{chunk-rgkhm4s4.js → chunk-gdhkb2rz.js} +2 -2
- package/dist/{chunk-gtddnhdy.js → chunk-h2nvgcbs.js} +2 -2
- package/dist/{chunk-hmze7f10.js → chunk-h3s5e0c5.js} +2 -2
- package/dist/{chunk-p2s04v76.js → chunk-haf9qn5a.js} +2 -2
- package/dist/chunk-hd682pax.js +2 -0
- package/dist/{chunk-epqjzw63.js → chunk-hw5n7sqm.js} +2 -2
- package/dist/chunk-jf5651fz.js +2 -0
- package/dist/{chunk-xfjcwypy.js → chunk-jh46xzr6.js} +3 -3
- package/dist/{chunk-jwb3723b.js → chunk-jhxjbpt3.js} +2 -2
- package/dist/chunk-jmcb7an2.js +2 -0
- package/dist/{chunk-cywx4qmv.js → chunk-jtafw6h4.js} +2 -2
- package/dist/{chunk-5s2wpbdt.js → chunk-k6b4cf05.js} +1 -1
- package/dist/{chunk-91trh8rj.js → chunk-kc9rzb07.js} +2 -2
- package/dist/{chunk-pkgrt90z.js → chunk-key9msc9.js} +2 -2
- package/dist/{chunk-nx91ewps.js → chunk-kjtd3wc3.js} +1 -1
- package/dist/{chunk-xp0nfvxg.js → chunk-kk2nr6dd.js} +2 -2
- package/dist/{chunk-py1t2v6e.js → chunk-m3cbbk3v.js} +2 -2
- package/dist/{chunk-94k9byb1.js → chunk-m92evp24.js} +2 -2
- package/dist/{chunk-sqh158m4.js → chunk-mme37xva.js} +1 -1
- package/dist/{chunk-gmhbqxcg.js → chunk-mwkr9pvg.js} +2 -2
- package/dist/{chunk-z75zbdq8.js → chunk-mxj4s2r8.js} +1 -1
- package/dist/{chunk-0d8k5bmd.js → chunk-mzc51shd.js} +2 -2
- package/dist/chunk-n514z4we.js +2 -0
- package/dist/chunk-n6xa65sp.js +2 -0
- package/dist/{chunk-sj7jdb7m.js → chunk-nhsbjys5.js} +1 -1
- package/dist/{chunk-1txn4b0v.js → chunk-p0ebmb2m.js} +1 -1
- package/dist/{chunk-zc2hdmk1.js → chunk-p2khnrm1.js} +2 -2
- package/dist/{chunk-tzjk7zkc.js → chunk-p8n6rm5h.js} +2 -2
- package/dist/{chunk-2ysnmwx1.js → chunk-q53h2y2a.js} +2 -2
- package/dist/{chunk-gsq8mzr7.js → chunk-q989x2x5.js} +2 -2
- package/dist/chunk-qqv0bewt.js +2 -0
- package/dist/{chunk-acrrwrzy.js → chunk-qsqyf4y3.js} +2 -2
- package/dist/chunk-r22h488a.js +3 -0
- package/dist/{chunk-3ryhmzsq.js → chunk-r8k9jd0z.js} +2 -2
- package/dist/{chunk-f0sbnmcs.js → chunk-raz9hb3h.js} +4 -4
- package/dist/{chunk-367b1yab.js → chunk-rd2n48s1.js} +2 -2
- package/dist/{chunk-2s4y2v50.js → chunk-rmv0t2ee.js} +2 -2
- package/dist/chunk-s1vxbxzr.js +2 -0
- package/dist/chunk-s3mx42dt.js +2 -0
- package/dist/chunk-seg9xzjy.js +2 -0
- package/dist/{chunk-q4y1q1na.js → chunk-sq5zstzq.js} +2 -2
- package/dist/{chunk-y438yezf.js → chunk-t794afpy.js} +3 -3
- package/dist/{chunk-v5wwv2t9.js → chunk-t9nky8ka.js} +3 -3
- package/dist/{chunk-c6w4bp15.js → chunk-ta45etnd.js} +1 -1
- package/dist/{chunk-q98941j2.js → chunk-tcgx9yxg.js} +2 -2
- package/dist/{chunk-3nj26hhf.js → chunk-tjykfxrd.js} +2 -2
- package/dist/{chunk-9c41y5hw.js → chunk-tp5y8cc7.js} +2 -2
- package/dist/{chunk-hjm26kwf.js → chunk-tv9wdbxr.js} +1 -1
- package/dist/{chunk-69yx37pv.js → chunk-v8rqevms.js} +3 -3
- package/dist/{chunk-rd94eyan.js → chunk-v958q8hh.js} +2 -2
- package/dist/chunk-vmywavgm.js +2 -0
- package/dist/{chunk-gy63n5pz.js → chunk-w3z37qwe.js} +2 -2
- package/dist/{chunk-syv6gady.js → chunk-w522gwhm.js} +2 -2
- package/dist/chunk-w5wzxdbk.js +2 -0
- package/dist/{chunk-scddkjv8.js → chunk-w9nr7saa.js} +1 -1
- package/dist/{chunk-m4mfw5s4.js → chunk-wpx2bvd0.js} +7 -7
- package/dist/{chunk-dsdxw9s8.js → chunk-wthttnkz.js} +2 -2
- package/dist/{chunk-mgt5j803.js → chunk-x8vd2d2g.js} +1 -1
- package/dist/{chunk-rkqe8p8n.js → chunk-xf91jp39.js} +2 -2
- package/dist/{chunk-x053g6f2.js → chunk-xnmjg8r1.js} +2 -2
- package/dist/chunk-xrek8rbm.js +2 -0
- package/dist/{chunk-z3e38981.js → chunk-xttthm0n.js} +2 -2
- package/dist/{chunk-5wyxvpgt.js → chunk-y6v59cgf.js} +1 -1
- package/dist/{chunk-an03g9e8.js → chunk-y8qmxd0j.js} +2 -2
- package/dist/{chunk-qbdqh38y.js → chunk-ygebvrv5.js} +1 -1
- package/dist/{chunk-68y66m3v.js → chunk-z79xmq12.js} +2 -2
- package/dist/{chunk-3x1eq95a.js → chunk-zw2q13qg.js} +2 -2
- package/dist/codex/activity-group.js +1 -1
- package/dist/codex/assistant-message.js +1 -1
- package/dist/codex/async-question-card.js +1 -1
- package/dist/codex/disclosure-state.js +1 -1
- package/dist/codex/edited-files-card.js +1 -1
- package/dist/codex/image-view-activity.js +1 -1
- package/dist/codex/markdown-renderer.js +1 -1
- package/dist/codex/navigation-audio.js +1 -1
- package/dist/codex/navigation-preview.js +1 -1
- package/dist/codex/navigation-rail.js +1 -1
- package/dist/codex/patch-view.js +1 -1
- package/dist/codex/plan.js +1 -1
- package/dist/codex/timeline-virtualizer.js +1 -1
- package/dist/codex/turn-activity.js +1 -1
- package/dist/codex/user-message.js +1 -1
- package/dist/codex/virtualized-turn-list.js +1 -1
- package/dist/composer/completion-filter.js +1 -1
- package/dist/composer/completion-menu.js +1 -1
- package/dist/composer/completion-trigger.js +1 -1
- package/dist/composer/effort-slider.js +1 -1
- package/dist/composer/menu-radio.js +1 -1
- package/dist/composer/model-select.js +1 -1
- package/dist/composer/permission-mode-select.js +1 -1
- package/dist/composer/prompt-input-attachments.js +1 -1
- package/dist/composer/prompt-input-clipboard.js +1 -1
- package/dist/composer/prompt-input-context.js +1 -1
- package/dist/composer/prompt-input-textarea.js +1 -1
- package/dist/composer/prompt-input.js +1 -1
- package/dist/conversation/action-card.js +1 -1
- package/dist/conversation/composer/composer.js +1 -1
- package/dist/conversation/composer/config-options.js +1 -1
- package/dist/conversation/composer/context.js +1 -1
- package/dist/conversation/composer/drafts.js +1 -1
- package/dist/conversation/composer/file-items.js +1 -1
- package/dist/conversation/composer/long-text.js +1 -1
- package/dist/conversation/composer/mention-chips.js +1 -1
- package/dist/conversation/composer/mention-uri.js +1 -1
- package/dist/conversation/composer/model-menu.js +1 -1
- package/dist/conversation/composer/pasted-text-attachment.js +1 -1
- package/dist/conversation/composer/permission-mode-menu.js +1 -1
- package/dist/conversation/composer/prediction.js +1 -1
- package/dist/conversation/composer/slash-command-button.js +1 -1
- package/dist/conversation/composer/submit-button.js +1 -1
- package/dist/conversation/composer/usage-meter.js +1 -1
- package/dist/conversation/context.js +1 -1
- package/dist/conversation/conversation-body.js +1 -1
- package/dist/conversation/conversation-view.js +1 -1
- package/dist/conversation/conversation.js +1 -1
- package/dist/conversation/diff-modal.js +1 -1
- package/dist/conversation/session-actions.js +1 -1
- package/dist/image-lightbox.js +1 -1
- package/dist/image-preview-dialog.js +1 -1
- package/dist/lib/code-highlighter.js +1 -1
- package/dist/lib/fuzzy.js +1 -1
- package/dist/lib/group-blocks.js +1 -1
- package/dist/lib/image-encode.js +1 -1
- package/dist/lib/limits.js +1 -1
- package/dist/lib/markdown-parser.js +1 -1
- package/dist/lib/markdown-rules.js +1 -1
- package/dist/lib/model-name.js +1 -1
- package/dist/lib/pointer-centered-zoom.js +1 -1
- package/dist/lib/prepare-prompt-files.js +1 -1
- package/dist/lib/stream-style.js +1 -1
- package/dist/lib/streaming-markdown.js +1 -1
- package/dist/search/chat-search.js +1 -1
- package/dist/search/dom-matches.js +1 -1
- package/dist/search/find-bar.js +1 -1
- package/dist/search/literal-matches.js +1 -1
- package/dist/session-list/archived-sessions.js +1 -1
- package/dist/session-list/highlight.js +1 -1
- package/dist/session-list/host.js +1 -1
- package/dist/session-list/hover-info-card.js +1 -1
- package/dist/session-list/navigation.js +1 -1
- package/dist/session-list/overflow-marquee.js +1 -1
- package/dist/session-list/row-stop-button.js +1 -1
- package/dist/session-list/session-groups.js +1 -1
- package/dist/session-list/session-info-card.js +1 -1
- package/dist/session-list/session-list.js +1 -1
- package/dist/session-list/session-row.js +1 -1
- package/dist/session-list/session-state-dot.js +1 -1
- package/dist/session-list/sidebar-overlay.js +1 -1
- package/dist/session-list/trailing-swap.js +1 -1
- package/dist/session-list/use-activity-preview.js +1 -1
- package/dist/session-list/use-project-sessions.js +1 -1
- package/dist/session-list/virtual-session-rows.js +1 -1
- package/dist/session-timeline/activity-group.js +1 -1
- package/dist/session-timeline/activity-projection.js +1 -1
- package/dist/session-timeline/assistant-content.js +1 -1
- package/dist/session-timeline/assistant-turn.js +1 -1
- package/dist/session-timeline/async-questions.js +1 -1
- package/dist/session-timeline/edited-files-card.js +1 -1
- package/dist/session-timeline/history-timeline.js +1 -1
- package/dist/session-timeline/host.js +1 -1
- package/dist/session-timeline/navigation-rail.js +1 -1
- package/dist/session-timeline/plan.js +1 -1
- package/dist/session-timeline/question-reply.js +1 -1
- package/dist/session-timeline/resource-content.js +1 -1
- package/dist/session-timeline/session-timeline.js +1 -1
- package/dist/session-timeline/timeline-registry.js +1 -1
- package/dist/session-timeline/turn-activity.js +1 -1
- package/dist/session-timeline/turn-error.js +1 -1
- package/dist/session-timeline/turn-retry.js +1 -1
- package/dist/session-timeline/turn-time.js +1 -1
- package/dist/session-timeline/turns.js +1 -1
- package/dist/session-timeline/use-timeline-scroll.js +1 -1
- package/dist/session-timeline/user-message.js +1 -1
- package/dist/ui/alert.js +1 -1
- package/dist/ui/badge.js +1 -1
- package/dist/ui/card.js +1 -1
- package/dist/ui/checkbox.js +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dropdown-menu.js +1 -1
- package/dist/ui/empty.js +1 -1
- package/dist/ui/field.js +1 -1
- package/dist/ui/hover-card.js +1 -1
- package/dist/ui/input-group-textarea.js +1 -1
- package/dist/ui/input-group.js +1 -1
- package/dist/ui/kbd.js +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/radio-group.js +1 -1
- package/dist/ui/select.js +1 -1
- package/dist/ui/separator.js +1 -1
- package/dist/ui/skeleton.js +1 -1
- package/dist/ui/spinner.js +1 -1
- package/dist/ui/switch.js +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-0hpww4x3.js +0 -2
- package/dist/chunk-4pbh3fph.js +0 -2
- package/dist/chunk-5t3rrnfd.js +0 -2
- package/dist/chunk-65jedxc3.js +0 -4
- package/dist/chunk-6d38ff76.js +0 -2
- package/dist/chunk-6pq1xmwg.js +0 -2
- package/dist/chunk-6vqnsdgc.js +0 -2
- package/dist/chunk-7e1m1d9x.js +0 -2
- package/dist/chunk-88vkk9s3.js +0 -2
- package/dist/chunk-d2rrvka6.js +0 -2
- package/dist/chunk-dcxprfnp.js +0 -2
- package/dist/chunk-fwd1zewt.js +0 -2
- package/dist/chunk-gb2dmt6b.js +0 -2
- package/dist/chunk-gwav4k8b.js +0 -2
- package/dist/chunk-h05s12jn.js +0 -3
- package/dist/chunk-h7gq5y52.js +0 -2
- package/dist/chunk-h9tnsvjr.js +0 -2
- package/dist/chunk-hmj7yqyb.js +0 -3
- package/dist/chunk-k2zg8xva.js +0 -2
- package/dist/chunk-kg1gk77d.js +0 -2
- package/dist/chunk-kh1tc15g.js +0 -2
- package/dist/chunk-mv8jmv1e.js +0 -2
- package/dist/chunk-q2ppgpfd.js +0 -2
- package/dist/chunk-qbj5s8qa.js +0 -2
- package/dist/chunk-qqdca2rm.js +0 -2
- package/dist/chunk-r8z8f31m.js +0 -2
- package/dist/chunk-s44rx1sz.js +0 -3
- package/dist/chunk-spt7tnqx.js +0 -2
- package/dist/chunk-wrs447cs.js +0 -2
- package/dist/chunk-xf14bg2v.js +0 -4
- package/dist/chunk-yhmb3z56.js +0 -2
package/dist/activity-host.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{wo,a,g}from"./chunk-3p9j3gmw.js";export{wo as ActivityHostProvider,g as ActivityMarkdown,a as useActivityHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ze}from"../chunk-tv9wdbxr.js";import{e}from"../chunk-cg97byvk.js";import{ce}from"../chunk-11v81zha.js";import{l}from"../chunk-1hy64ewz.js";import{v}from"../chunk-kjtd3wc3.js";import{U,R}from"../chunk-5w48y2ad.js";import{C}from"../chunk-xjtqdp82.js";import{kn,Tt,oe,lt}from"../chunk-gdbzk1kt.js";import{autoUpdate as G}from"@floating-ui/dom";import{cn as M}from"cn";import{useCallback as F,useEffect as O,useLayoutEffect as _,useMemo as z,useRef as V,useState as A}from"react";import{createPortal as W}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function le({current:r,total:I,anchorRef:N,t:p,onAccept:L,onDecline:q}){let x=z(()=>r?kn(r.requestedSchema):[],[r]),[S,b]=A({}),E=V(null);O(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!oe(o)){let u=lt(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),O(()=>{if(r?.elicitationId!==void 0&&E.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")E.current.focus()},[r?.elicitationId]);let[k,B]=A(null),[T,D]=A(null),y=F(()=>{let t=N.current;if(!t)return;let a=t.getBoundingClientRect();if(a.width===0){let o=Math.min(640,window.innerWidth*0.9);B({left:(window.innerWidth-o)/2,width:o,bottom:24});return}B({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);_(()=>{if(!r)return;let t=0,a=()=>{if(N.current){y();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,y,N]),_(()=>{let t=N.current;if(!r||!t||!T)return;return G(t,T,y,{animationFrame:!0})},[r,T,N,y]);let P=z(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=S[t];if(!o)return!1;if(oe(a)){if(!o.selectedSet||o.selectedSet.size===0)return!1;if(o.selectedSet.has(c)&&!o.otherText?.trim())return!1}else{if(!o.selected)return!1;if(o.selected===c&&!o.otherText?.trim())return!1}}return!0},[r,x,S]),j=F(async()=>{if(!r)return;if(!P)return;let t={},a={};for(let{key:o,property:u}of x){let d=S[o];if(!d)continue;let g;if(oe(u))t[o]=[...d.selectedSet??[]].map((f)=>f===c?(d.otherText??"").trim():f).filter(Boolean);else{let f=d.selected??"";if(t[o]=f===c?(d.otherText??"").trim():f,f!==c)g=lt(u).find((s)=>s.value===f)?.preview}let h=d.notes?.trim();if(g||h)a[o]={...g&&{preview:g},...h&&{notes:h}}}await L(r.elicitationId,t,a)},[r,x,S,P,L]),H=F(async()=>{if(r)await q(r.elicitationId)},[r,q]);if(!r||!k)return null;return W(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),H()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:k.left,width:k.width,bottom:k.bottom,maxHeight:"70vh"},ref:(t)=>{E.current=t,D(t)},children:[m("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:p("askUserQuestion.title")}),I>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${I}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:a},o)=>{let u=S[t],d=u?.selected,g=u?.selectedSet??new Set,h=lt(a),f=oe(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(ze,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:Tt(a).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:Tt(a).description})]}),f?m("div",{className:"space-y-1.5 ps-1",children:[h.map((s)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ce,{checked:g.has(s.value),onCheckedChange:(n)=>{b((w)=>{let Q=new Set(w[t]?.selectedSet??new Set);if(n)Q.add(s.value);else Q.delete(s.value);return{...w,[t]:{...w[t],selectedSet:Q}}})}}),m("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ce,{checked:g.has(c),onCheckedChange:(s)=>{b((n)=>{let w=new Set(n[t]?.selectedSet??new Set);if(s)w.add(c);else w.delete(c);return{...n,[t]:{...n[t],selectedSet:w}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:p("askUserQuestion.other")})]}),g.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}):m(U,{value:d??"",onValueChange:(s)=>b((n)=>({...n,[t]:{...n[t],selected:s}})),className:"space-y-1.5 ps-1",children:[h.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:M("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",d===s.value&&"bg-muted/60"),children:[i(R,{value:s.value,id:n}),m(v,{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),m("div",{className:M("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",d===c&&"bg-muted/60"),children:[i(R,{value:c,id:`${o}:other`,className:"mt-0.5"}),i(v,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:p("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:p("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!f&&d&&d!==c&&(()=>{let s=h.find((n)=>n.value===d)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),h.some((s)=>s.preview)&&i(C,{placeholder:p("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),m("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void H(),children:p("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!P,onClick:()=>void j(),children:p("askUserQuestion.submit")})]})]}),document.body)}export{le as ChoiceElicitationForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{kn,Tt,oe,lt}from"../chunk-gdbzk1kt.js";export{kn as elicitationFields,Tt as elicitationLabels,lt as elicitationOptions,oe as isMultiSelect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{gr,wn,Gr,Wr}from"../chunk-hd682pax.js";export{gr as PERMISSION_KIND_GROUP_ORDER,Gr as isAllowKind,Wr as isAlwaysKind,wn as sortPermissionOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{bn}from"../chunk-h3s5e0c5.js";import"../chunk-hd682pax.js";export{bn as PermissionView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ir,fr,Pr,Cn}from"../chunk-wthttnkz.js";import"../chunk-11v81zha.js";import"../chunk-1hy64ewz.js";import"../chunk-y6v59cgf.js";import"../chunk-5w48y2ad.js";import"../chunk-p0ebmb2m.js";import"../chunk-cg97byvk.js";import"../chunk-xjtqdp82.js";import"../chunk-nhsbjys5.js";import"../chunk-ygebvrv5.js";import"../chunk-kjtd3wc3.js";export{Cn as SchemaElicitationForm,Ir as elicitationFields,fr as initialValues,Pr as isAnswered};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{yn}from"../chunk-hw5n7sqm.js";import"../chunk-w9nr7saa.js";import"../chunk-cg97byvk.js";export{yn as UrlElicitationCard};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-cg97byvk.js";import{ue,me,J}from"./chunk-k6b4cf05.js";import{f}from"./chunk-jtafw6h4.js";import{useState as g}from"react";import{jsx as o,jsxs as t}from"react/jsx-runtime";function qo({value:p,currentName:n,icon:r,options:s,label:i,header:a,onValueChange:d,showLabel:l=!1,disabled:u=!1}){let[m,c]=g(!1);return t(ue,{open:m,onOpenChange:c,children:[o(me,{render:t(e,{disabled:u,variant:"ghost","aria-label":`${i}: ${n}`,title:n,className:"text-muted-foreground data-popup-open:hover:bg-muted h-7 gap-1.5 rounded-full bg-transparent px-2 text-xs font-normal whitespace-nowrap data-popup-open:bg-transparent",children:[r,o("span",{className:l?"max-w-40 truncate":"hidden max-w-40 truncate @[40rem]/input-footer:inline-block",children:n})]})}),t(J,{align:"start",sideOffset:4,className:"permission-mode-menu z-100 w-auto max-w-[calc(100vw-2rem)] min-w-72 rounded-xl p-1.5",children:[a&&o("div",{className:"text-muted-foreground flex items-center px-1.5 pt-0.5 pb-1 text-[11px] leading-4",children:o("span",{children:a})}),o(f,{value:p,onValueChange:d,itemClassName:"items-center gap-2 py-1 pr-6 pl-2 whitespace-nowrap",options:s})]})]})}
|
|
2
|
+
export{qo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function
|
|
2
|
-
export{
|
|
1
|
+
var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function Vt(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function To(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=Vt(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
|
|
2
|
+
export{Vt,To};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as a}from"cn";import{Loader2Icon as r}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function
|
|
1
|
+
import{cn as a}from"cn";import{Loader2Icon as r}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function de({className:o,...n}){return e(r,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:a("size-4 animate-spin",o),...n})}export{de};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cva as s}from"class-variance-authority";import{cn as a}from"cn";import{jsx as r}from"react/jsx-runtime";var n=s("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function
|
|
1
|
+
import{cva as s}from"class-variance-authority";import{cn as a}from"cn";import{jsx as r}from"react/jsx-runtime";var n=s("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function B({className:t,variant:e,...o}){return r("div",{"data-slot":"alert",role:"alert",className:a(n({variant:e}),t),...o})}function rn({className:t,...e}){return r("div",{"data-slot":"alert-title",className:a("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function z({className:t,...e}){return r("div",{"data-slot":"alert-description",className:a("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}function hi({className:t,...e}){return r("div",{"data-slot":"alert-action",className:a("absolute top-2.5 end-3",t),...e})}export{B,rn,z,hi};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Checkbox as i}from"@base-ui/react/checkbox";import{cn as o}from"cn";import{CheckIcon as t}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function
|
|
1
|
+
import{Checkbox as i}from"@base-ui/react/checkbox";import{cn as o}from"cn";import{CheckIcon as t}from"lucide-react";import{jsx as e}from"react/jsx-runtime";function ce({className:r,...a}){return e(i.Root,{"data-slot":"checkbox",className:o("peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:e(i.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e(t,{})})})}export{ce};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{l}from"./chunk-1hy64ewz.js";import{V}from"./chunk-ygebvrv5.js";import{h}from"./chunk-bse4zh1d.js";import{wt}from"./chunk-cbbr9m3a.js";import{L}from"./chunk-tjykfxrd.js";import{gt,ft}from"./chunk-fv7tp8pr.js";import{formatDistanceToNowStrict as x}from"date-fns";import{enUS as z,zhCN as E}from"date-fns/locale";import{ClockIcon as w,MessageSquareIcon as A}from"lucide-react";import{useEffect as g,useState as D}from"react";import{jsx as o,jsxs as C,Fragment as M}from"react/jsx-runtime";var S={en:z,"zh-CN":E};function Ae(t,a){let i=a==="zh-CN"?S["zh-CN"]:S.en;return x(new Date(t),{locale:i})}function mt({sessionRow:t,actions:a,shortcut:i,renaming:n=!1,onRename:m}){let{t:r,i18n:I,PathAction:u}=h(),f=ft(),y=gt();g(()=>{f(n)},[n,f]);let[H,p]=D(t.title??"");g(()=>{if(n)p(t.title??"")},[n,t.title]);let d=(e)=>{let c=e.trim();m?.(c!==""&&c!==t.title?c:null)},N=t.archived?r("sessionList.archived"):t.updatedAt!==null?Ae(t.updatedAt,I.language):null,v=[];if(N!==null)v.push({icon:o(w,{className:"size-3.5"}),text:N});let s=u&&o(u,{cwd:t.cwd,onOpened:y});return o(wt,{title:n?o(l,{autoFocus:!0,value:H,className:"h-7 text-sm","aria-label":r("sessionList.rename"),onChange:(e)=>p(e.target.value),onKeyDown:(e)=>{if(e.stopPropagation(),e.key==="Enter")d(e.target.value);if(e.key==="Escape")m?.(null)},onBlur:(e)=>d(e.target.value)}):C("span",{className:"flex items-center gap-2",children:[o("span",{className:"min-w-0",children:o(L,{className:"min-w-0 flex-1",children:t.title??r("sessionList.untitled")})}),i]}),titleIcon:o(A,{className:"size-3.5"}),details:v,actions:s||a!==void 0?C(M,{children:[s,s&&a!==void 0&&o(V,{}),a]}):void 0})}
|
|
2
|
+
export{Ae,mt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function
|
|
2
|
-
export{
|
|
1
|
+
import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function Wt({name:p,value:P,levels:h,disabled:c,onChange:v}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===P)),[M,d]=k(null),l=y(null),[I,b]=k(null),x=y(0),s=M??I??g,w=(t)=>{let n=++x.current;b(t);let e=()=>{if(x.current===n)b(null)};try{Promise.resolve(v(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=76,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
|
|
2
|
+
export{Wt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t}from"./chunk-vmywavgm.js";import{ze}from"./chunk-tv9wdbxr.js";import{e}from"./chunk-cg97byvk.js";import{tt}from"./chunk-jf5651fz.js";import{FileIcon as m,XIcon as r}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function fn({mentions:n,onRemove:s}){let{t:i}=t();if(n.length===0)return null;return a("div",{className:"mb-1.5 flex flex-wrap items-center gap-1.5",children:n.map((o)=>l(ze,{variant:"secondary",className:"gap-1 pe-0.5",title:o,children:[a(m,{className:"size-3"}),a("span",{className:"max-w-40 truncate",children:tt(o)}),a(e,{type:"button",variant:"ghost",size:"icon-xs",className:"size-4","aria-label":i("composer.removeMention",{name:tt(o)}),onClick:()=>s(o),children:a(r,{className:"size-3"})})]},o))})}
|
|
2
|
+
export{fn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useCallback as S,useLayoutEffect as C,useRef as I,useState as f}from"react";import{jsx as b}from"react/jsx-runtime";var y=30,s=32,g=6;function
|
|
2
|
-
export{
|
|
1
|
+
import{useCallback as S,useLayoutEffect as C,useRef as I,useState as f}from"react";import{jsx as b}from"react/jsx-runtime";var y=30,s=32,g=6;function Xt({sessionRows:t,viewport:r,renderRow:u}){let o=I(null),[c,m]=f({start:0,end:g}),[d,R]=f(()=>new Set),[E,M]=f(null),v=S((e,n)=>{R((a)=>{if(a.has(e)===n)return a;let l=new Set(a);if(n)l.add(e);else l.delete(e);return l})},[]),h=S(()=>{if(o.current===null||r===null)return;let e=r.getBoundingClientRect().top+r.clientTop-o.current.getBoundingClientRect().top,n=Math.max(0,Math.min(t.length,Math.floor(e/s)-g)),a=Math.max(n,Math.min(t.length,Math.ceil((e+r.clientHeight)/s)+g));m((l)=>l.start===n&&l.end===a?l:{start:n,end:a})},[t.length,r]);C(()=>h()),C(()=>{if(r===null)return;let e,n=()=>{if(e!==void 0)return;e=requestAnimationFrame(()=>{e=void 0,h()})},a=new ResizeObserver(n);if(a.observe(r),r.firstElementChild)a.observe(r.firstElementChild);return r.addEventListener("scroll",n,{passive:!0}),()=>{if(a.disconnect(),r.removeEventListener("scroll",n),e!==void 0)cancelAnimationFrame(e)}},[h,r]);let i=new Set;for(let e=c.start;e<Math.min(c.end,t.length);e++)i.add(e);if(t.length>0)i.add(0),i.add(t.length-1);if(t.forEach((e,n)=>{if(d.has(e.sessionId))i.add(n);if(E===e.sessionId)for(let a=Math.max(0,n-1);a<=Math.min(t.length-1,n+1);a++)i.add(a)}),t.length===0)return null;return b("div",{ref:o,"data-slot":"virtual-session-rows","data-count":t.length,className:"relative w-full",style:{height:t.length*s-(s-y)},children:[...i].toSorted((e,n)=>e-n).map((e)=>{let n=t[e];return b(T,{sessionRow:n,index:e,retainCard:v,onFocus:M,renderRow:u},n.sessionId)})})}function T({sessionRow:t,index:r,retainCard:u,onFocus:o,renderRow:c}){let m=S((d)=>u(t.sessionId,d),[u,t.sessionId]);return b("div",{"data-slot":"virtual-session-row",className:"absolute inset-x-0",style:{top:r*s,height:y},onFocusCapture:()=>o(t.sessionId),onBlurCapture:(d)=>{if(!d.currentTarget.contains(d.relatedTarget))o(null)},children:c(t,m)})}
|
|
2
|
+
export{Xt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function Or(t,e){if(t.type||!e.type)return t;let o=e.type.split("/")[1],i=o!==void 0&&o!==""?`pasted-${Date.now()}.${o==="jpeg"?"jpg":o}`:"";return new File([t],t.name||i||`pasted-${Date.now()}`,{type:e.type})}function Io(t){let e=[],o=!1;for(let i of t){if(i.kind!=="file")continue;let n=i.getAsFile();if(!n)continue;if(!(n.type||i.type).startsWith("image/")){o=!0;continue}e.push(Or(n,i))}return{imageFiles:e,sawNonImageFile:o}}function Po(t){return[...t].some((e)=>e.kind==="string")}function s(t){let e=t.codePointAt(0);return e<32&&e!==9&&e!==10&&e!==13||e===127}function Fr(t){return[...t].filter((e)=>!s(e)).join("")}function yr(t,e){let o=0;for(let i=0;i<e;i++){let n=t.charCodeAt(i);if(n>=0&&n<=8||n===11||n===12||n>=14&&n<=31||n===127)o++}return o}function dt(t){let{value:e,selectionStart:o,selectionEnd:i}=t,n=Fr(e);if(n===e)return n;if(t.value=n,o!==null&&i!==null){let a=Math.max(0,o-yr(e,o)),r=Math.max(0,i-yr(e,i));requestAnimationFrame(()=>{t.setSelectionRange(a,r)})}return n}
|
|
2
|
+
export{Or,Io,Po,Fr,yr,dt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{j}from"./chunk-vmywavgm.js";import{createContext as v,useContext as C,useMemo as a}from"react";import{jsx as r}from"react/jsx-runtime";var i=v(null);function rt({host:o,client:e,children:t}){let s=a(()=>({host:o,client:e}),[o,e]);return r(j,{host:o,client:e,children:r(i,{value:s,children:t})})}function n(){let o=C(i);if(o===null)throw Error("Conversation host is missing");return o}function b(o,e){e.catch((t)=>{if(o.reportError)o.reportError(t);else console.error(t)})}
|
|
2
|
+
export{rt,n,b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function
|
|
1
|
+
import{cn as e}from"cn";import{jsx as o}from"react/jsx-runtime";function Yo({className:t,...n}){return o("kbd",{"data-slot":"kbd",className:e("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",t),...n})}function vi({className:t,...n}){return o("kbd",{"data-slot":"kbd-group",className:e("inline-flex items-center gap-1",t),...n})}export{Yo,vi};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{e}from"./chunk-cg97byvk.js";import{v}from"./chunk-kjtd3wc3.js";import{U,R}from"./chunk-5w48y2ad.js";import{C}from"./chunk-xjtqdp82.js";import{useId as w}from"react";import{jsx as r,jsxs as c,Fragment as Q}from"react/jsx-runtime";function a(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function p(n){if(!a(n)||!a(n.codex))return[];let s=n.codex,i=s.questions;if(s.delivery!=="async"||!Array.isArray(i))return[];if(!i.every((t)=>a(t)&&typeof t.title==="string"&&t.title.trim().length>0&&(t.options===null||Array.isArray(t.options)&&t.options.every((l)=>typeof l==="string"))))return[];return i}function Lt(n,s){return JSON.stringify(["request_user_input_async",n,s])}function io(n){return{selected:n.options?.length?0:null,text:""}}function Dt(n,s){return s.selected===null?s.text:n.options?.[s.selected]??""}function ao(n){return`<send_user_message_question_reply>
|
|
2
|
+
${JSON.stringify([n])}
|
|
3
|
+
</send_user_message_question_reply>`}function _t(n){if(!a(n)||!a(n.codex))return[];let s=n.codex;return(Array.isArray(s.questionReplyParts)?s.questionReplyParts.map((t)=>a(t)?{...t,answer:t.text}:t):[s.questionReply]).filter((t)=>a(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:l,answer:d})=>({questionItemId:t,question:l,answer:d}))}function so({question:n,draft:s,status:i,answer:t,error:l,onChange:d,onSubmit:x,onSkip:f,t:o}){let g=w(),y=i==="pending",b=i==="answered"||i==="skipped";return c("section",{"aria-labelledby":`${g}-title`,className:"border-border bg-card text-card-foreground flex min-w-0 flex-col gap-3 rounded-xl border p-4",children:[r("h3",{id:`${g}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title}),b?r("p",{className:"text-sm whitespace-pre-wrap",children:i==="answered"?t:o("asyncQuestion.skipped")}):c(Q,{children:[(n.options?.length??0)>0&&c(U,{"aria-labelledby":`${g}-title`,disabled:!y,value:s.selected===null?"other":String(s.selected),onValueChange:(u)=>d({...s,selected:u==="other"?null:Number(u)}),children:[n.options?.map((u,m)=>c(v,{className:"flex items-start gap-2 text-sm",children:[r(R,{value:String(m)}),r("span",{className:"whitespace-pre-wrap",children:u})]},m)),c(v,{className:"flex items-center gap-2 text-sm",children:[r(R,{value:"other"}),o("asyncQuestion.other")]})]}),r(C,{"aria-label":o("asyncQuestion.answer"),placeholder:o("asyncQuestion.answer"),value:s.text,readOnly:!y,onChange:(u)=>d({selected:null,text:u.target.value})}),l&&r("p",{role:"alert",className:"text-destructive text-sm",children:l}),c("div",{className:"flex flex-wrap items-center gap-2",children:[r(e,{size:"sm",disabled:!y||Dt(n,s).trim().length===0,onClick:x,children:o(i==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")}),r(e,{size:"sm",variant:"ghost",disabled:!y,onClick:f,children:o("asyncQuestion.skip")}),(i==="closed"||i==="unavailable")&&r("span",{role:"status",className:"text-muted-foreground text-xs",children:o(`asyncQuestion.${i}`)})]})]})]})}
|
|
4
|
+
export{p,Lt,io,Dt,ao,_t,so};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{g}from"./chunk-3p9j3gmw.js";import{t}from"./chunk-vmywavgm.js";import{M}from"./chunk-zw2q13qg.js";import{ContentBlock as i}from"@agentclientprotocol/sdk/experimental/v2/unstable";import{isEmbeddedResource as m,isResourceLink as u}from"@alwith/api";import{jsx as n}from"react/jsx-runtime";function d({block:e,streaming:o}){let r=t();if(i.isText(e)){if(e.text.length===0)return null;return n("div",{className:"codex-assistant-message",children:n(g,{text:e.text,streaming:o})})}if(i.isImage(e))return n(M,{block:e,generated:!0});if(i.isAudio(e))return n("audio",{controls:!0,src:`data:${e.mimeType};base64,${e.data}`});if(u(e)||m(e))return n(M,{block:e,generated:!0});return n("div",{className:"text-muted-foreground",children:r.t("timeline.unsupportedContent",{type:e.type})})}function W({content:e,messageId:o,streaming:r}){return e.map((s,a)=>n(d,{block:s,streaming:r},`${o}:${a}`))}
|
|
2
|
+
export{W};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
async function
|
|
2
|
-
export{
|
|
1
|
+
async function _o(g,u){try{let a=await(await fetch(g)).blob(),s=u??a.type??"";if(!s.startsWith("image/"))return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(a)});let w=s.includes("svg"),n,r,o;if(w){let e=new Image,t=URL.createObjectURL(a);e.src=t;try{await new Promise((h,f)=>{e.onload=()=>h(),e.onerror=()=>f(Error("svg load failed"))})}finally{URL.revokeObjectURL(t)}r=e.naturalWidth||1024,o=e.naturalHeight||1024,n=e}else{let e=await createImageBitmap(a);r=e.width,o=e.height,n=e}let i=Math.min(1,2000/Math.max(r,o)),c=Math.round(r*i),l=Math.round(o*i),d=new OffscreenCanvas(c,l),m=d.getContext("2d");if(!m)throw Error("image-encode: OffscreenCanvas 2d context 不可用");if(m.drawImage(n,0,0,c,l),n instanceof ImageBitmap)n.close();let b=await d.convertToBlob({type:"image/webp",quality:0.85});return new Promise((e)=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(b)})}catch{return null}}
|
|
2
|
+
export{_o};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{$o}from"./chunk-y8qmxd0j.js";import{d,Zo,u,m}from"./chunk-p0ebmb2m.js";import{cn as M}from"cn";import{XIcon as L}from"lucide-react";import{useCallback as O,useEffect as z,useMemo as j,useRef as H,useState as S}from"react";import{jsx as i,jsxs as A}from"react/jsx-runtime";function Uo({open:l,onOpenChange:P,url:h,filename:x,scale:v,onScaleChange:p,containerRef:T,containerClassName:I,dialogContentClassName:R,imageClassName:W}){let g=O((e)=>Math.min(4,Math.max(0.25,e)),[]),[Z,C]=S(1),o=g(v??Z),k=H(null),s=T??k,D=H(null),[f,N]=S({width:0,height:0}),[y,E]=S({width:0,height:0}),b=O((e)=>{let n=g(e);if(typeof p==="function"){p(n);return}C(n)},[p,g]);z(()=>{if(!l)return;if(!h)return;if(typeof v==="number")return;C(1)},[l,h,v]),z(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{N({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let X=O(()=>{b(1)},[b]),r=j(()=>{let{width:e,height:n}=y,{width:t,height:a}=f;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),w=e*c,_=n*c;return{width:w*o,height:_*o}},[o,y,f]);if(!h)return null;return i(d,{open:l,onOpenChange:P,children:A(u,{className:M("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",R),showCloseButton:!1,children:[i(m,{className:"sr-only",children:x||"Image preview"}),i(Zo,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(L,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=D.current,w=a&&c?$o({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(b(t),a&&w)requestAnimationFrame(()=>{a.scrollTo(w)})},className:M("h-full w-full scrollbar-thin overflow-auto",I),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(f.width,r.width),height:Math.max(f.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:x||"image preview",className:M("block object-contain select-none",W),decoding:"async",draggable:!1,ref:D,onDoubleClick:X,onLoad:(e)=>{let n=e.currentTarget;E({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))N({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
|
|
2
|
+
export{Uo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createContext as i,useContext as r}from"react";import{jsx as e}from"react/jsx-runtime";var n=i(null);function
|
|
2
|
-
export{
|
|
1
|
+
import{createContext as i,useContext as r}from"react";import{jsx as e}from"react/jsx-runtime";var n=i(null);function wo({host:t,children:o}){return e(n.Provider,{value:t,children:o})}function a(){let t=r(n);if(t===null)throw Error("Activity host is missing");return t}function g(t){let{Markdown:o}=a();return e(o,{...t})}
|
|
2
|
+
export{wo,a,g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{yo}from"./chunk-dhvpffgf.js";import{useCallback as xe,useEffect as P,useLayoutEffect as ye,useMemo as X,useRef as I,useState as E}from"react";import"@alwith/module-chat/navigation-rail.css";import{jsx as T,jsxs as Ne,Fragment as ke}from"react/jsx-runtime";var Se=4,ge=10;function we(h,x){let v=new Map(x.flatMap((c)=>c.itemIds.map((S)=>[S,c.key]))),p=Array(h.length),C;for(let c=h.length-1;c>=0;c--)C=v.get(h[c])??C,p[c]=C;let A=Math.max(-1,...x.map((c)=>c.key))+1,B=new Set,n=[];for(let[c,S]of h.entries()){let w=v.get(S),m=n.at(-1);if(!m||w!==void 0&&w!==m.key||w===void 0&&m.itemIds.length>=64&&p[c]!==m.key){let y=w!==void 0&&!B.has(w)?w:A++;m={key:y,startIndex:c,itemIds:[]},n.push(m),B.add(y)}m.itemIds.push(S)}return n}function fe(h,x){if(h.size!==x.size)return!1;for(let v of h)if(!x.has(v))return!1;return!0}function go({audio:h,beforeReveal:x,ensureItemMounted:v,items:p,onPreviewItem:C,renderPreview:A,onRevealError:B,scrollRoot:n,targetTopMarginPx:c=16}){let[S,w]=E(()=>{let e=p.at(-1);return new Set(e===void 0?[]:[e.id])}),[m,y]=E(null),[_,O]=E(null),[Z,R]=E(!1),[j,pe]=E(()=>new Set),[ve,be]=E(!0),[Ie,F]=E(null),{installUnlock:ee,preload:te,playSequence:ne}=h,K=I(null),M=I(null),U=I(!1),H=I(null),L=I(0),G=I(null),k=I(null),V=I(new Set),z=X(()=>p.map((e)=>e.id).join("\x00"),[p]),J=I(p);J.current=p;let ie=I(j),re=I(S),se=I({itemIdsKey:z,scrollRoot:n});if(se.current.scrollRoot!==n)L.current+=1,se.current={itemIdsKey:z,scrollRoot:n};let g=X(()=>v===void 0?p.filter((e)=>j.has(e.id)):p,[v,p,j]),ae=X(()=>g.map((e)=>({inputTokens:e.inputTokens,outputTokens:e.outputTokens})),[g]),D=I({ids:"",groups:[]}),oe=g.map((e)=>e.id).join("\x00");if(D.current.ids!==oe)D.current={ids:oe,groups:we(g.map((e)=>e.id),D.current.groups)};P(()=>ee(),[ee]),P(()=>()=>{if(L.current+=1,G.current?.cancel(),k.current!==null)clearTimeout(k.current)},[]),P(()=>{y(null),R(!1),O(null),M.current=null,U.current=!1,H.current=null,F(null),V.current.clear()},[n]),P(()=>{te()},[te]),P(()=>{if(n===null)return;let e=new Set,t=new Map,i=new Set(J.current.map((s)=>s.id)),r=()=>{let s=new Set(t.values()),d=J.current.filter((f)=>s.has(f.id)).map((f)=>f.id),o=d.findIndex((f)=>e.has(f));if(o===-1)return;let b=o;for(let f=o+1;f<d.length;f++)if(e.has(d[f]))b=f;let N=new Set(d.slice(o,b+1));if(fe(re.current,N))return;re.current=N,w(N)},a=new IntersectionObserver((s)=>{for(let d of s){let o=t.get(d.target);if(d.isIntersecting)e.add(o);else e.delete(o)}r()},{root:n,rootMargin:`-${c}px 0px 0px 0px`}),u=()=>{let s=new Set,d=new Set;for(let o of n.querySelectorAll("[data-content-search-unit-key]")){let b=o.dataset.contentSearchUnitKey;if(b===void 0||!i.has(b)||s.has(b))continue;s.add(b);let N=o.closest("[data-turn-key]"),f=N===null||d.has(N)?o:N;if(d.add(f),t.has(f))continue;t.set(f,b),a.observe(f)}for(let o of t.keys()){if(d.has(o))continue;a.unobserve(o),e.delete(t.get(o)),t.delete(o)}if(r(),fe(ie.current,s))return;ie.current=s,pe(s)};u();let l=new MutationObserver((s)=>{if(s.some((o)=>[...o.addedNodes,...o.removedNodes].some((b)=>b instanceof Element&&(b.matches("[data-turn-key], [data-content-search-unit-key]")||b.querySelector("[data-turn-key], [data-content-search-unit-key]")!==null))))u()});return l.observe(n,{childList:!0,subtree:!0}),()=>{l.disconnect(),a.disconnect()}},[z,n,c]);let Y=g.find((e)=>S.has(e.id))?.id??g.at(-1)?.id;ye(()=>{let e=K.current;if(e===null||M.current!==null||Y===void 0)return;let t=e.querySelector(`[data-timeline-user-message-navigation-item-id="${CSS.escape(Y)}"]`);if(t===null)return;let i=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(r.top<i.top)e.scrollTop+=r.top-i.top;else if(r.bottom>i.bottom)e.scrollTop+=r.bottom-i.bottom+1},[Y,z]),P(()=>{let e=n?.querySelector("[data-timeline-user-message-navigation-content]");if(!n||!e)return;let t=()=>{let r=n.getBoundingClientRect(),a=e.getBoundingClientRect();if(r.width===0||a.width===0)return;let u=n.offsetWidth>0?r.width/n.offsetWidth:1;be((a.left-r.left)/u>=48)},i=new ResizeObserver(t);return i.observe(n),i.observe(e),t(),()=>i.disconnect()},[n]);let he=xe(async(e,t="smooth")=>{if(n===null)throw Error("Thread user-message navigation scroll root is missing");let i=L.current+1;L.current=i,x();let r=()=>n.querySelector(`[data-content-search-unit-key="${CSS.escape(e.id)}"]`),a=r(),u=a!==null&&n.clientHeight>0&&a.closest("[data-turn-key]")!==null&&Math.abs(a.getBoundingClientRect().top-n.getBoundingClientRect().top)>n.clientHeight*2;if((a===null||u)&&v!==void 0){if(t==="instant"&&e.isLoaded===!1)return;a=await v(e,()=>L.current===i)??r(),t="instant"}if(L.current!==i)return;if(a===null)return;let l=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;a.scrollIntoView({behavior:l?"instant":t,block:"start"});let s=a.querySelector("[data-user-message-bubble], [data-composer-attachment-pill]");if(G.current?.cancel(),G.current=null,s===null)return;let d=getComputedStyle(s).backgroundColor,o=`color-mix(in srgb, var(--foreground) 14%, ${d})`;G.current=s.animate?.([{backgroundColor:o},{backgroundColor:o,offset:0.35},{backgroundColor:d}],{duration:l?0:1000,easing:"cubic-bezier(0.23, 1, 0.32, 1)"})??null},[x,v,n]);if(g.length<Se||!ve)return null;let Q=()=>{if(k.current!==null)clearTimeout(k.current);k.current=null},ue=(e,t=!1)=>{if(Q(),C===void 0||e.isLoaded!==!1||V.current.has(e.turnKey))return;let i=()=>{k.current=null,V.current.add(e.turnKey),C(e).catch(()=>V.current.delete(e.turnKey))};if(t)i();else k.current=setTimeout(i,150)},q=m===null?null:g.find((e)=>e.id===m.item.id)??g.find((e)=>e.nativeTurnId!==void 0&&e.nativeTurnId===m.item.nativeTurnId)??m.item,le=(e,t="smooth")=>{he(e,t).catch((i)=>{if(B)B(i);else throw i})},de=g.findIndex((e)=>e.id===(_??Ie)),ce=K.current,Te=m===null||!ce?.contains(m.button)?0:Me(ce,m.button),me=(e)=>{let t=e?.closest("[data-timeline-user-message-navigation-item-id]"),i=K.current;if(t===void 0||t===null||!i.contains(t))return null;let r=t.dataset.timelineUserMessageNavigationItemId,a=g.findIndex((u)=>u.id===r);return{button:t,item:g[a],index:a}},W=(e)=>{let t=M.current;if(t?.pointerId!==e.pointerId)return;if(M.current=null,O(null),t.captureTarget.hasPointerCapture(e.pointerId))t.captureTarget.releasePointerCapture(e.pointerId)};return T("nav",{"aria-label":"User messages",className:"timeline-user-message-navigation absolute start-4 top-1/2 z-20 -translate-y-1/2",children:T(yo,{open:Z,onOpenChange:R,side:"inline-end",sideOffset:0,align:"center",alignOffset:Te,trigger:T("div",{ref:K,"data-timeline-user-message-navigation-rail-list":!0,"data-scrubbing":_===null?void 0:"",className:"timeline-user-message-navigation-rail-list",onPointerEnter:()=>{H.current=null},onPointerDown:(e)=>{if(e.button!==0)return;Q();let t=me(e.target instanceof Element?e.target:null);if(t===null)return;U.current=!1,M.current={pointerId:e.pointerId,itemId:t.item.id,itemIndex:t.index,captureTarget:t.button},t.button.setPointerCapture(e.pointerId),O(t.item.id),y(t),R(!0)},onPointerMove:(e)=>{let t=M.current;if(t===null){let l=me(e.target instanceof Element?e.target:null);if(l!==null){F(l.item.id);let s=H.current;if(s!==null&&s!==l.index)ne(s,l.index,ae);H.current=l.index,y((d)=>d?.item.id===l.item.id?d:l),ue(l.item)}return}if(t.pointerId!==e.pointerId)return;if((e.buttons&1)===0){W(e);return}let i=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(g.length-1,Math.floor((e.clientY-i.top+e.currentTarget.scrollTop)/ge))),u={button:e.currentTarget.querySelectorAll("[data-timeline-user-message-navigation-item-id]")[r],item:g[r],index:r};if(u.item.id===t.itemId)return;ne(t.itemIndex,u.index,ae),H.current=u.index,M.current={...t,itemId:u.item.id,itemIndex:u.index},U.current=!0,O(u.item.id),y(u),le(u.item,"instant")},onPointerUp:W,onPointerCancel:W,onLostPointerCapture:W,onPointerLeave:()=>{if(Q(),F(null),H.current=null,M.current===null&&!Z)y(null)},children:T("div",{className:"flex flex-col",children:D.current.groups.map((e)=>T("div",{className:"flex w-9 shrink-0 flex-col [content-visibility:auto]",style:{height:e.itemIds.length*ge},children:g.slice(e.startIndex,e.startIndex+e.itemIds.length).map((t,i)=>{let r=e.startIndex+i,a=Math.abs(r-de),u=de===-1||a>3?void 0:[1,0.7,0.4,0.2][a];return T("button",{type:"button","data-timeline-user-message-navigation-item-id":t.id,"data-scrub-target":_===t.id?"":void 0,"aria-current":S.has(t.id)?"true":void 0,"aria-label":`Jump to user message ${r+1}`,className:"timeline-user-message-navigation-row",onClick:(l)=>{if(U.current){U.current=!1;return}let s={button:l.currentTarget,item:t,index:r};y(s),R(!0),le(t)},onFocus:(l)=>{ue(t,!0),y({button:l.currentTarget,item:t,index:r}),R(!0)},children:T("span",{className:"flex h-0.5 w-[30px] items-center",children:T("span",{className:"timeline-user-message-navigation-marker",style:u===void 0?void 0:{"--marker-progress":u}})})},t.id)})},e.key))})}),children:q!==null&&T("div",{className:"bg-popover/95 text-popover-foreground ring-border w-80 max-w-[calc(100vw-1rem)] overflow-hidden rounded-xl p-2 text-sm leading-5 shadow-xl ring-[0.5px] backdrop-blur-sm",children:A?A(q):Ne(ke,{children:[T("div",{className:"min-w-0 truncate font-medium",children:q.label}),q.response.length>0&&T("div",{className:"text-muted-foreground mt-1 line-clamp-3",children:q.response})]})})})})}function Me(h,x){let v=h.getBoundingClientRect(),p=x.getBoundingClientRect();return p.top+p.height/2-(v.top+v.height/2)}
|
|
2
|
+
export{go};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o}from"./chunk-
|
|
1
|
+
import{o}from"./chunk-vmywavgm.js";import{B,rn,z}from"./chunk-0vy9fzs3.js";import{e}from"./chunk-cg97byvk.js";import{fe,he,ve,xe}from"./chunk-5xjm1hab.js";import{rt,n,b}from"./chunk-1v3wc4cv.js";import{Qe}from"./chunk-dgx31pdr.js";import{je}from"./chunk-f59aepmd.js";import{Ge,We}from"./chunk-v8rqevms.js";import{Ve}from"./chunk-n514z4we.js";import{LockIcon as D,UnplugIcon as g}from"lucide-react";import{useMemo as A}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";function cr({host:t,client:l,...s}){let c=A(()=>t.openDiff?t:{...t,openDiff:Ge},[t]);return i(rt,{host:c,client:l,children:[r(R,{...s}),!t.openDiff&&r(We,{})]})}function R({session:t,header:l,overlay:s,timeline:c,composer:y,readOnlyActions:x,welcome:u,children:C,rootRef:N}){let{host:d,client:w}=n(),{t:a}=d,p=o((m)=>m.connection==="ready"),f=o((m)=>m.historyPages[t.id]?.error),v=()=>b(d,w.open(t.id,t.cwd)),h=t.items.length===0&&t.attached&&!t.restoring&&t.state==="idle";return i("div",{"data-chat-drop-zone":!0,ref:N,className:"flex h-full min-h-0 flex-col",children:[l,i("div",{className:"relative flex min-h-0 flex-1 flex-col","data-chat-content":!0,children:[s,p&&!t.attached&&!t.restoring&&!t.readOnly&&r("div",{className:"mx-auto my-3 w-full max-w-4xl px-4",children:i(B,{children:[r(g,{}),r(rn,{children:a("conversation.stopped")}),r(z,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),h?u??r(fe,{className:"flex-1",children:i(he,{children:[r(ve,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(xe,{children:a("conversation.welcomeDescription")})]})}):r(je,{session:t,timeline:c}),r(Ve,{sessionId:t.id}),t.readOnly?r("div",{className:"mx-auto w-full max-w-3xl shrink-0 px-6 pb-5","data-readonly-composer":!0,children:i(B,{className:"flex items-center justify-between gap-4 rounded-3xl px-5 py-4",children:[i("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[r(D,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("div",{className:"min-w-0 space-y-1",children:[r(rn,{children:a("conversation.readOnlyTitle")}),r(z,{children:a("conversation.readOnlyDescription")}),f&&r("p",{role:"alert",className:"text-destructive break-words",children:f})]})]}),i("div",{className:"border-border flex shrink-0 items-center gap-1 border-s ps-3","data-readonly-actions":!0,children:[r(e,{size:"sm",variant:"outline",className:"text-foreground cursor-pointer disabled:cursor-not-allowed",onClick:v,disabled:!p||t.restoring,children:a(t.restoring?"conversation.restoring":"conversation.readOnlyRetry")}),x]})]})}):y??r(Qe,{session:t})]}),C]})}
|
|
2
2
|
export{cr};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`,1)[0]??"";return a.endsWith(` b/${s}`)||a.endsWith(` ${s}`)||a.includes(`/${s} `)})??o}function
|
|
3
|
-
`)){if(n.startsWith("diff --git ")){e=null;continue}if(n.startsWith("+++ ")){let i=n.slice(4).trim(),a=i==="/dev/null"?null:i.replace(/^b\//,"");if(a!==null)e={additions:0,deletions:0},s.set(a,e);continue}if(n.startsWith("--- ")){let i=n.slice(4).trim();if(i!=="/dev/null"&&e===null)e={additions:0,deletions:0},s.set(i.replace(/^a\//,""),e);continue}if(e===null)continue;if(n.startsWith("+"))e.additions+=1;else if(n.startsWith("-"))e.deletions+=1}return s}function u(o,s){let e=s.replaceAll("\\","/");for(let[n,i]of o)if(e===n||e.endsWith(`/${n}`))return i;return{additions:0,deletions:0}}function
|
|
4
|
-
${d}`:d;else s.set(r,{path:r,patch:d,...c})}}return[...s.values()]}function
|
|
5
|
-
export{
|
|
1
|
+
import{zt}from"./chunk-ad32h099.js";import{t}from"./chunk-vmywavgm.js";import{isDiffEntry as p}from"@alwith/api";import{jsx as f,jsxs as g,Fragment as h}from"react/jsx-runtime";function Sr(o,s){let e=o.split(/^(?=diff --git )/m).filter((i)=>i.length>0);if(e.length<=1)return o;return e.find((i)=>{let a=i.split(`
|
|
2
|
+
`,1)[0]??"";return a.endsWith(` b/${s}`)||a.endsWith(` ${s}`)||a.includes(`/${s} `)})??o}function Nr(o){let s=new Map,e=null;for(let n of o.split(`
|
|
3
|
+
`)){if(n.startsWith("diff --git ")){e=null;continue}if(n.startsWith("+++ ")){let i=n.slice(4).trim(),a=i==="/dev/null"?null:i.replace(/^b\//,"");if(a!==null)e={additions:0,deletions:0},s.set(a,e);continue}if(n.startsWith("--- ")){let i=n.slice(4).trim();if(i!=="/dev/null"&&e===null)e={additions:0,deletions:0},s.set(i.replace(/^a\//,""),e);continue}if(e===null)continue;if(n.startsWith("+"))e.additions+=1;else if(n.startsWith("-"))e.deletions+=1}return s}function u(o,s){let e=s.replaceAll("\\","/");for(let[n,i]of o)if(e===n||e.endsWith(`/${n}`))return i;return{additions:0,deletions:0}}function Rr(o){let s=new Map;for(let e of o)for(let n of e.content){if(!p(n))continue;let i=n.patch?Nr(n.patch.text):new Map;for(let a of n.changes){let r=typeof a.path==="string"?a.path:null;if(r===null)continue;let c=u(i,r),d=n.patch?Sr(n.patch.text,r):"",l=s.get(r);if(l)l.additions+=c.additions,l.deletions+=c.deletions,l.patch=l.patch?`${l.patch}
|
|
4
|
+
${d}`:d;else s.set(r,{path:r,patch:d,...c})}}return[...s.values()]}function Ln({items:o}){let s=t(),{openDiff:e,FileIcon:n}=s;return f(zt,{files:Rr(o),onOpen:e===void 0?void 0:(i)=>e({path:i.path,patch:i.patch}),renderPath:n===void 0?void 0:(i)=>g(h,{children:[f(n,{path:i.path,className:"codex-edited-file-icon"}),f("span",{className:"codex-edited-file-name",children:i.path})]})})}
|
|
5
|
+
export{Sr,Nr,Rr,Ln};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{nativeTurnId as a}from"@nyssance/codex-acp-v2/client";function
|
|
2
|
-
export{
|
|
1
|
+
import{nativeTurnId as a}from"@nyssance/codex-acp-v2/client";function Sn(o,i){let u=new Set,s=(e)=>{let t=e.items.map(a).find((r)=>r!==null),n=e.items.every((r)=>r.replayed);if(t===void 0||u.has(t))return{turnKey:e.key,turn:e,deferUntilReady:n};return u.add(t),{turnKey:`history:${t}`,aliases:[e.key],turn:e,deferUntilReady:n}};if(!i?.complete)return o.map(s);let d=new Map;for(let e of o){let t=e.items.map(a).find((r)=>r!==null);if(t===void 0)continue;let n=d.get(t)??[];n.push(e),d.set(t,n)}let l=new Set(i.turns.map((e)=>e.turnId)),y=new Set(i.loadedTurnIds);return[...i.turns.flatMap((e)=>{let t=d.get(e.turnId);if(t)return t.map(s);return y.has(e.turnId)?[]:[{turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,estimatedHeightPx:320,placeholder:!0}]}),...o.filter((e)=>!e.items.some((t)=>l.has(a(t)??""))).map(s)]}
|
|
2
|
+
export{Sn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h,s,vt,r,S}from"./chunk-bse4zh1d.js";import{F}from"./chunk-cbbr9m3a.js";import{ht}from"./chunk-fv7tp8pr.js";import{ut}from"./chunk-key9msc9.js";import{Ae,mt}from"./chunk-1dce9zt8.js";import{hasRename as D}from"@nyssance/codex-acp-v2/client";import{ArchiveIcon as A,ArchiveRestoreIcon as H,GitForkIcon as N,PencilIcon as x,Trash2Icon as R}from"lucide-react";import{useRef as B,useState as y}from"react";import{jsx as n,jsxs as b,Fragment as C}from"react/jsx-runtime";function Yt({sessionRow:e,active:f,onSelect:u,onForked:p=u,onHoverCardOpenChange:a,actions:c}){let i=h(),{t:m,i18n:v}=i,k=s(),l=r((o)=>o.runStates[e.sessionId]),I=vt(),d=()=>u(e);return n(ht,{"data-session-id":e.sessionId,role:"button",tabIndex:0,active:f,onClick:d,onKeyDown:(o)=>{if(o.key==="Enter"||o.key===" ")o.preventDefault(),d()},state:l?.state,interruption:l?.interruption??null,title:e.title??m("sessionList.untitled"),onHoverCardOpenChange:a,hoverCard:n(E,{sessionRow:e,onDelete:()=>I(e),onForked:p,actions:c}),meta:e.updatedAt!==null?n("span",{className:"text-muted-foreground shrink-0 text-xs",children:Ae(e.updatedAt,v.language)}):void 0,actions:l!=null?n(ut,{title:m("sessionList.stop"),onStop:()=>S(i,k.stopSession(e.sessionId))}):void 0})}function E({sessionRow:e,onDelete:f,onForked:u,actions:p}){let a=h(),{t:c}=a,i=s(),m=r((t)=>D(t.agent)),v=r((t)=>t.connection==="ready"&&t.agent?.capabilities?.session?.fork!=null),[k,l]=y(!1),[I,d]=y(!1),o=B(!1);return n(mt,{sessionRow:e,renaming:k,onRename:(t)=>{if(l(!1),t!==null)S(a,i.renameSession(e.sessionId,t))},actions:b(C,{children:[m&&n(F,{icon:n(x,{}),label:c("sessionList.rename"),onClick:()=>l(!0)}),p,e.archived?n(F,{icon:n(H,{}),label:c("sessionList.unarchive"),onClick:()=>void S(a,i.unarchive(e.sessionId))}):b(C,{children:[n(F,{icon:n(N,{}),label:c("sessionList.fork"),disabled:!v||I,onClick:()=>{if(o.current)return;o.current=!0,d(!0),S(a,i.fork(e.sessionId,e.cwd).then((t)=>{let g=i.state.sessionList.find((L)=>L.sessionId===t);if(!g)throw Error("Forked chat is missing from the session list");u(g)}).finally(()=>{o.current=!1,d(!1)}))}}),n(F,{icon:n(A,{}),label:c("sessionList.archive"),onClick:()=>void S(a,i.archive(e.sessionId))})]}),n(F,{variant:"destructive",icon:n(R,{}),label:c("sessionList.delete"),onClick:f})]})})}
|
|
2
|
+
export{Yt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{Et}from"./chunk-s1vxbxzr.js";async function Zn(i,c){let s=new WeakSet;while(!c.aborted){let r=Array.from(i.querySelectorAll('[data-codex-disclosure][aria-expanded="false"]')).filter((e)=>!s.has(e)&&!e.matches(":disabled"));for(let e of r)s.add(e),e.click();if(r.length===0&&i.querySelector("[data-markdown-pending]")===null)return;await new Promise((e)=>requestAnimationFrame(()=>e()))}}function ct(i,c){if(!c)return[];let s=[],r="",e=[],o=()=>{let t=0,n=0;for(let{start:a,end:l}of Et(r,c)){while(t<e.length&&e[t].end<=a)t++;n=Math.max(n,t);while(n<e.length&&e[n].end<l)n++;let d=e[t],f=e[n];if(!d||!f)throw Error("Search text offset has no DOM node");let h=document.createRange();h.setStart(d.node,a-d.start),h.setEnd(f.node,l-f.start),s.push(h)}r="",e=[]},m=new Set(["ADDRESS","ARTICLE","ASIDE","BLOCKQUOTE","DIV","DL","DT","DD","FIGCAPTION","FIGURE","FOOTER","FORM","H1","H2","H3","H4","H5","H6","HEADER","HR","LI","MAIN","NAV","OL","P","PRE","SECTION","TABLE","TD","TH","TR","UL"]),u=(t)=>{if(t.nodeType===Node.TEXT_NODE){let a=t.parentElement;if(!a||a.offsetParent===null&&a.tagName!=="BODY")return;let l=t.nodeValue??"";e.push({node:t,start:r.length,end:r.length+l.length}),r+=l;return}if(!(t instanceof Element))return;if(t.matches("script, style, [hidden], [aria-hidden='true']")){o();return}if(t.tagName==="BR"){o();return}let n=m.has(t.tagName);if(n)o();for(let a of t.childNodes)u(a);if(n)o()};return u(i),o(),s}
|
|
2
|
+
export{Zn,ct};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{html as n}from"diff2html";import{ColorSchemeType as r}from"diff2html/lib/types";import{useMemo as s}from"react";import{jsx as a}from"react/jsx-runtime";function
|
|
1
|
+
import{html as n}from"diff2html";import{ColorSchemeType as r}from"diff2html/lib/types";import{useMemo as s}from"react";import{jsx as a}from"react/jsx-runtime";function oo(e){let t=0,i=0;for(let o of e.split(`
|
|
2
2
|
`)){if(o.startsWith("+++")||o.startsWith("---"))continue;if(o.startsWith("+"))t+=1;else if(o.startsWith("-"))i+=1}return{additions:t,deletions:i}}function Se({patch:e,theme:t}){let i=s(()=>n(e,{drawFileList:!1,outputFormat:"line-by-line",matching:"lines",colorScheme:t==="dark"?r.DARK:r.LIGHT}),[e,t]);return a("div",{className:"codex-patch-view",dangerouslySetInnerHTML:{__html:i}})}
|
|
3
|
-
export{
|
|
3
|
+
export{oo,Se};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function
|
|
1
|
+
import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function U({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function R({className:r,...a}){return i(e.Root,{"data-slot":"radio-group-item",className:o("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:i(e.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{U,R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cva as o}from"class-variance-authority";import{cn as n}from"cn";import{jsx as a}from"react/jsx-runtime";function
|
|
1
|
+
import{cva as o}from"class-variance-authority";import{cn as n}from"cn";import{jsx as a}from"react/jsx-runtime";function fe({className:e,...t}){return a("div",{"data-slot":"empty",className:n("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-lg border-dashed p-12 text-center text-balance",e),...t})}function he({className:e,...t}){return a("div",{"data-slot":"empty-header",className:n("flex max-w-sm flex-col items-center gap-2",e),...t})}var i=o("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",icon:"flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"}},defaultVariants:{variant:"default"}});function Ii({className:e,variant:t="default",...r}){return a("div",{"data-slot":"empty-icon","data-variant":t,className:n(i({variant:t,className:e})),...r})}function ve({className:e,...t}){return a("div",{"data-slot":"empty-title",className:n("font-heading text-lg font-medium tracking-tight",e),...t})}function xe({className:e,...t}){return a("div",{"data-slot":"empty-description",className:n("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function Pi({className:e,...t}){return a("div",{"data-slot":"empty-content",className:n("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",e),...t})}export{fe,he,Ii,ve,xe,Pi};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{p}from"./chunk-2w9f1q84.js";import{textOf as A,turns as S}from"@alwith/api";import{codexMessageError as _,nativeTurnId as y}from"@nyssance/codex-acp-v2/client";function Er(t){return t.kind==="tool"&&t.name==="mcp_startup"}function E(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let n=e.phase;return typeof n==="string"?n:null}function w(t){let e=t._meta?.codex;return typeof e==="object"&&e!==null&&e.notice===!0}function Hn(t){return t.user===null&&t.items.length>0&&t.items.every((e)=>e.kind==="assistant"&&w(e))}function T(t,e,n){let o=t.work.at(-1);if(o?.kind==="activity"&&o.items.at(-1)===n){o.items.push(e);return}t.work.push({kind:"activity",key:`activity:${e.kind}:${e.id}`,items:[e]})}function M(t,e,n){if(t.kind!=="tool"){e.push(t);return}let o=n.get(t.id);if(o===void 0)throw Error(`Grouped tool is missing from the session: ${t.id}`);e.push(o);for(let s of t.children)M(s,e,n)}function j(t,e,n,o){switch(e.kind){case"user":break;case"assistant":{if(_(e)!==null){let u=y(e),f=t.errors.findIndex((m)=>u!==null&&y(m)===u);if(f===-1)t.errors.push(e);else t.errors[f]=e;break}let s=E(e),i=e._meta?.codex,d=p(e._meta).length>0||typeof i==="object"&&i!==null&&"delivery"in i&&i.delivery==="async";if(p(e._meta).length>0)t.final.push(e);else if(d)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else if(s==="final_answer")t.final.push(e);else if(s==="commentary"||w(e)||s===null&&n)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else t.final.push(e);break}case"thought":T(t,e,o);break;case"tool":if(T(t,e,o),e.toolKind==="edit")t.edits.push(e);break;case"plan":t.work.push({kind:"plan",key:`plan:${e.id}`,item:e});break;case"compaction":t.work.push({kind:"compaction",key:`compaction:${e.id}`,item:e});break}}function On(t,e=[],n=[]){let o=new Map(e.map((r)=>[r.key,r])),s=new Map(t.items.filter((r)=>r.kind==="tool").map((r)=>[r.id,r])),i={...t,items:t.items.filter((r)=>!Er(r))},d=new Map(n.map((r,a)=>[r.turnId,a])),u=[],f=[u],m,I=null;for(let r of i.items){let a=y(r),l=d.get(a??"");if(a!==null&&I!==null&&a!==I||l!==void 0&&m!==void 0&&l>m+1)u=[],f.push(u);if(u.push(r),a!==null||r.kind==="user")I=a;if(l!==void 0)m=l}return f.flatMap((r)=>S({...i,items:r})).map((r)=>{let a=r.prompt===null?[]:[r.prompt];for(let c of r.entries)M(c,a,s);let l=a[0];if(l===void 0)throw Error("A turn without items");let h=`turn:${l.kind}:${l.id}`,b=r.endedAt??Math.max(...a.map((c)=>c.at)),k=o.get(h);if(k!==void 0&&K(k.items,a)&&k.endedAt===b)return k;let g={key:h,user:r.prompt,work:[],final:[],errors:[],edits:[],startedAt:r.startedAt??l.at,endedAt:b,replayed:a.every(Nt),items:a},v=a.findLastIndex((c)=>c.kind!=="user"&&c.kind!=="compaction");return a.forEach((c,x)=>j(g,c,x<v,a[x-1])),g})}function K(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}function Nt(t){let e=t._meta?.codex;return t.replayed||typeof e==="object"&&e!==null&&"historyReplay"in e&&e.historyReplay===!0}function D(t){return A(t.content)}function Ie(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function Rt(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function Fn(t){let e=(s)=>{for(let i of t.items){let d=i._meta?.codex;if(typeof d!=="object"||d===null)continue;let u=d[s];if(typeof u==="number"&&Number.isFinite(u)&&u>=0)return u}return},n=e("workDurationMs"),o=e("turnDurationMs");return{durationMs:n??o,durationKind:n===void 0&&o!==void 0?"total":"work",startedAt:e("workStartedAt")}}function Bn(t,e,n){if(n?.user==null)return!1;let o=e.items.map(y).find((i)=>i!==null),s=y(n.user);if(o!==void 0&&s!==null)return o===s;return!e.items.some((i)=>{let d=i._meta?.codex;return typeof d==="object"&&d!==null&&"turnCompletedAt"in d&&typeof d.turnCompletedAt==="number"})&&t.state!=="idle"&&(n.user.echo==="pending"||n.user.echo==="acknowledged")&&e.user!==null&&t.turnEndedAt[e.user.id]===void 0&&e.errors.length===0}function zn(t,e){if(t.state==="idle")return;let n=e.length-1;while(n>0){let o=e[n];if(o.items.some((s)=>s.kind!=="user"))break;if(!Bn(t,e[n-1],o))break;n--}return e[n]?.key}function Un(t,e,n){let o=n,s=n;while(o>0&&Bn(t,e[o-1],e[o]))o--;while(s+1<e.length&&Bn(t,e[s],e[s+1]))s++;let i=e.slice(o,s+1),d=i.findLast((u)=>u.items.some((f)=>f.kind!=="user"))??i[0];return{continued:e[n]!==d,items:i.flatMap((u)=>u.items),edits:i.flatMap((u)=>u.edits),startedAt:i[0].startedAt}}
|
|
2
|
+
export{Er,Hn,On,Nt,D,Ie,Rt,Fn,Bn,zn,Un};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createContext as d,useCallback as n,useContext as i,useEffect as V,useMemo as q,useRef as g,useState as z}from"react";import{jsx as D}from"react/jsx-runtime";var F=d(null),
|
|
2
|
-
export{
|
|
1
|
+
import{createContext as d,useCallback as n,useContext as i,useEffect as V,useMemo as q,useRef as g,useState as z}from"react";import{jsx as D}from"react/jsx-runtime";var F=d(null),jt=d(null);function li(){return i(jt)}var Kt=d(null);function ci(){return i(Kt)}var Re=d(null);function Me(){let r=i(F);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var Ee=()=>i(F);function di(){let r=i(Re);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var X=()=>i(Re);function zo({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:A,attachmentPolicy:f,value:R,onValueChange:y,attachments:U,onAttachmentsChange:L,children:B}){let S=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),T=R!==void 0,[G,J]=z(r),p=R??G,o=g({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let W=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,T)y?.(t);else J(t)},[T,y]),h=n(()=>P(""),[P]),v=U!==void 0,[K,N]=z([]),I=U??K,b=g(I);b.current=I;let s=n((t)=>{let e=typeof t==="function"?t(b.current):t;if(v)L?.(e);else N(e)},[v,L]),j=g(null),w=g(()=>{}),O=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let _=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:S(u),filename:u.name,size:u.size,lastModified:u.lastModified,..._===void 0?{}:{sourcePath:_}}})]})},[f,S,s]),M=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),A?.()},[A,s]),E=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);V(()=>{if(v)return;return()=>{for(let t of b.current)if(t.url)URL.revokeObjectURL(t.url)}},[v]);let k=n(()=>{w.current?.()},[]),C=q(()=>({files:I,add:O,remove:M,clear:E,openFileDialog:k,fileInputRef:j}),[I,O,M,E,k]),H=n((t,e)=>{j.current=t.current,w.current=e},[]),Q=q(()=>({textInput:{value:p,setInput:P,clear:h,getRevision:W,clearSubmitted:c??h},attachments:C,__registerFileInput:H}),[p,P,h,W,c,C,H]);return D(F.Provider,{value:Q,children:D(Re.Provider,{value:C,children:B})})}var Qt=d(null);function x(){let r=X(),l=i(Qt),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
|
|
2
|
+
export{jt,li,Kt,ci,Re,Me,Ee,di,zo,Qt,x};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class s{worker=new Worker(new URL("@alwith/module-chat/code-highlighter.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(i)=>{let e=this.active,t=i.data;if(t.clientId!==e?.clientId||t.revision!==e.revision){this.fail(Error("Code highlighting worker returned an unexpected request"));return}if(this.active=null,!t.ok){this.fail(Error(t.error));return}let r=this.clients.get(e.clientId);if(r?.revision===e.revision)r.onResult({code:e.code,language:e.language,html:t.html});this.dispatch()},this.worker.onerror=(i)=>this.fail(Error(i.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize code highlighting result"))}fail(i){this.failure=i,this.worker.terminate(),this.pending.clear(),this.active=null;for(let e of this.clients.values())e.onError(i)}dispatch(){if(this.active!==null||this.pending.size===0)return;let i=this.pending.values().next().value;this.pending.delete(i.clientId),this.active=i;try{this.worker.postMessage(i)}catch(e){this.fail(e instanceof Error?e:Error(String(e)))}}connect(i,e){if(this.failure!==null)throw this.failure;let t=++this.nextClientId,r={revision:0,onResult:i,onError:e};return this.clients.set(t,r),{update:(o,l)=>{if(this.failure!==null)throw this.failure;r.revision+=1,this.pending.set(t,{clientId:t,revision:r.revision,code:o,language:l}),this.dispatch()},dispose:()=>{if(this.clients.delete(t),this.pending.delete(t),this.clients.size===0)this.worker.terminate(),n=void 0}}}}var n;function
|
|
2
|
-
export{
|
|
1
|
+
class s{worker=new Worker(new URL("@alwith/module-chat/code-highlighter.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(i)=>{let e=this.active,t=i.data;if(t.clientId!==e?.clientId||t.revision!==e.revision){this.fail(Error("Code highlighting worker returned an unexpected request"));return}if(this.active=null,!t.ok){this.fail(Error(t.error));return}let r=this.clients.get(e.clientId);if(r?.revision===e.revision)r.onResult({code:e.code,language:e.language,html:t.html});this.dispatch()},this.worker.onerror=(i)=>this.fail(Error(i.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize code highlighting result"))}fail(i){this.failure=i,this.worker.terminate(),this.pending.clear(),this.active=null;for(let e of this.clients.values())e.onError(i)}dispatch(){if(this.active!==null||this.pending.size===0)return;let i=this.pending.values().next().value;this.pending.delete(i.clientId),this.active=i;try{this.worker.postMessage(i)}catch(e){this.fail(e instanceof Error?e:Error(String(e)))}}connect(i,e){if(this.failure!==null)throw this.failure;let t=++this.nextClientId,r={revision:0,onResult:i,onError:e};return this.clients.set(t,r),{update:(o,l)=>{if(this.failure!==null)throw this.failure;r.revision+=1,this.pending.set(t,{clientId:t,revision:r.revision,code:o,language:l}),this.dispatch()},dispose:()=>{if(this.clients.delete(t),this.pending.delete(t),this.clients.size===0)this.worker.terminate(),n=void 0}}}}var n;function vo(i,e){return n??=new s,n.connect(i,e)}
|
|
2
|
+
export{vo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{p,Lt,io,Dt,ao,_t,so}from"./chunk-2w9f1q84.js";import{t,K,re,o}from"./chunk-vmywavgm.js";import{W}from"./chunk-34xzrr3s.js";import{isText as k}from"@alwith/api";import{createStore as E}from"@alwith/api/client";import{nativeTurnId as v}from"@nyssance/codex-acp-v2/client";import{jsx as g}from"react/jsx-runtime";var x=E({entries:{}});function l(i,e){x.setState((n)=>({entries:{...n.entries,[i]:e}}))}function q(i,e){let n=v(e),a=i.items.findLast((s)=>v(s)!==null);return!e.replayed&&n!==null&&a!==void 0&&v(a)===n}function M(i,e){for(let n of i.items){if(n.kind!=="user"||n.echo==="pending")continue;for(let a of[..._t(n._meta),...n.content.filter(k).flatMap((s)=>_t(s._meta))])if(a.questionItemId===e)return a.answer}return}function O({sessionId:i,item:e,question:n,index:a}){let s=K(),{t:m}=t(),S=Lt(e.id,a),d=JSON.stringify([i,S]),u=re(x,(r)=>r.entries[d]),c=o((r)=>r.sessions[i]),A=o((r)=>r.connection==="ready"),f=u?.draft??io(n),b=c===void 0?u?.accepted:M(c,S)??u?.accepted,h=c!==void 0&&q(c,e),D=A&&c?.attached&&!c.restoring&&!c.readOnly,y=b!==void 0?"answered":u?.skipped?"skipped":u?.pending?"submitting":!h?"closed":!D?"unavailable":"pending",C=async()=>{if(x.getState().entries[d]?.pending||y!=="pending")return;let r=s.state.sessions[i];if(r===void 0||!q(r,e)||!r.attached||r.readOnly||r.restoring)return;let I=Dt(n,f);if(!I.trim())return;let w={questionItemId:S,question:n.title,answer:I};l(d,{draft:f,pending:!0});try{await s.prompt(i,[{type:"text",text:ao(w),_meta:{codex:{questionReply:w}}}]),l(d,{draft:f,accepted:I})}catch(Q){l(d,{draft:f,error:Q instanceof Error?Q.message:String(Q)})}};if(y==="closed")return null;return g(so,{question:n,draft:f,status:y,answer:b,error:y==="pending"?u?.error:void 0,t:m,onChange:(r)=>l(d,{draft:r}),onSkip:()=>l(d,{draft:f,skipped:!0}),onSubmit:()=>{C()}})}function It({sessionId:i,item:e}){let n=o((s)=>s.sessions[i]),a=p(e._meta);if(n===void 0||n.readOnly||!q(n,e))return g(W,{content:e.content.some((s)=>!k(s)||s.text.trim().length>0)?e.content:a.map((s)=>({type:"text",text:s.title})),messageId:e.id,streaming:!1});return g("div",{className:"flex min-w-0 flex-col gap-3","data-async-questions":e.id,children:a.map((s,m)=>g(O,{sessionId:i,item:e,question:s,index:m},Lt(e.id,m)))})}
|
|
2
|
+
export{It};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{Lo,Q}from"./chunk-seg9xzjy.js";import{Do}from"./chunk-9d0vkezs.js";import{ir,an,sn}from"./chunk-x8vd2d2g.js";import{jt,Kt,Re,Ee,Qt}from"./chunk-6jyd3a7v.js";import{cn as P}from"cn";import{ArrowUpIcon as fe,Loader2Icon as ge,SquareIcon as be,XIcon as ve}from"lucide-react";import{Children as Z,useCallback as h,useEffect as F,useMemo as he,useRef as M,useState as Pe}from"react";import{flushSync as Ie}from"react-dom";import{jsx as a,jsxs as ye}from"react/jsx-runtime";function ee(u){let o=new FormData(u).get("message");return typeof o==="string"?o:""}var So=({className:u,bashMode:o=!1,attachmentPolicy:I,onCommand:d,onSubmitError:y,canSubmit:f,onSubmitAsync:g,accept:E,multiple:te,globalDrop:C,syncHiddenInput:U,maxFiles:z,maxFileSize:k,onError:b,onSubmit:re,children:ne,...oe})=>{let s=Ee(),l=!!s,se=o&&l&&s.textInput.value.startsWith("!"),x=M(null),A=M(null),D=M(!1),[ie,N]=Pe([]),c=l?s.attachments.files:ie,B=M(c);B.current=c;let ae=h(()=>{x.current?.click()},[]),O=h((e)=>{if(!E||E.trim()==="")return!0;return E.split(",").map((t)=>t.trim()).filter(Boolean).some((t)=>{if(t.endsWith("/*")){let n=t.slice(0,-1);return e.type.startsWith(n)}return e.type===t})},[E]),W=h((e)=>{if(e.type)return e.type;let r=(e.name||"").toLowerCase();if(r.endsWith(".png"))return"image/png";if(r.endsWith(".jpg")||r.endsWith(".jpeg"))return"image/jpeg";if(r.endsWith(".webp"))return"image/webp";if(r.endsWith(".gif"))return"image/gif";if(r.endsWith(".bmp"))return"image/bmp";if(r.endsWith(".svg"))return"image/svg+xml";return""},[]),ue=h((e)=>{let r=[...e],t=r.filter((i)=>O(i));if(r.length&&t.length===0){b?.({code:"accept",message:"No files match the accepted types."});return}let n=(i)=>k?i.size<=k:!0,m=t.filter(n);if(t.length>0&&m.length===0){b?.({code:"max_file_size",message:"All files exceed the maximum size."});return}N((i)=>{let v=I?I.uniqueFiles(m,i):m,p=typeof z==="number"?Math.max(0,z-i.length):void 0,_=typeof p==="number"?v.slice(0,p):v;if(typeof p==="number"&&v.length>p)b?.({code:"max_files",message:"Too many files. Some were not added."});let V=[];for(let T of _){let Y=I?.sourcePath(T);V.push({id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(T),mediaType:W(T),filename:T.name,size:T.size,lastModified:T.lastModified,...Y===void 0?{}:{sourcePath:Y}})}return[...i,...V]})},[I,W,O,z,k,b]),le=h((e)=>N((r)=>{let t=r.find((n)=>n.id===e);if(t?.url)URL.revokeObjectURL(t.url);return r.filter((n)=>n.id!==e)}),[]),pe=h(()=>N((e)=>{for(let r of e)if(r.url)URL.revokeObjectURL(r.url);return[]}),[]),G=l?s.attachments.add:ue,L=h((e)=>{let r=[...e],t=r.filter((m)=>!(m.type??"").toLowerCase().startsWith("image/"));if(t.length>0){b?.({code:"unsupported_type",message:`Only image attachments are supported. ${t.length} non-image file(s) were ignored.`});return}let n=r.reduce((m,i)=>m+i.size,0);if(n>0){let m=c.filter((i)=>(i.mediaType??"").toLowerCase().startsWith("image/")).reduce((i,v)=>i+(v.size??0),0);if(Lo(m,n)){b?.({code:"max_total_size",message:`Total image size must not exceed ${Q}MB.`});return}}G(r)},[c,G,b]),j=l?s.attachments.remove:le,R=l?s.attachments.clear:pe,q=l?s.attachments.openFileDialog:ae;F(()=>{if(!l)return;s.__registerFileInput(x,()=>x.current?.click())},[l,s]),F(()=>{if(U&&x.current&&c.length===0)x.current.value=""},[c,U]),F(()=>{let e=A.current;if(!e)return;if(C)return;let r=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault()},t=(n)=>{if(n.dataTransfer?.types?.includes("Files"))n.preventDefault();if(n.dataTransfer?.files&&n.dataTransfer.files.length>0)L(n.dataTransfer.files)};return e.addEventListener("dragover",r),e.addEventListener("drop",t),()=>{e.removeEventListener("dragover",r),e.removeEventListener("drop",t)}},[L,C]),F(()=>{if(!C)return;let e=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault()},r=(t)=>{if(t.dataTransfer?.types?.includes("Files"))t.preventDefault();if(t.dataTransfer?.files&&t.dataTransfer.files.length>0)L(t.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",r),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",r)}},[L,C]),F(()=>()=>{if(!l){for(let e of B.current)if(e.url)URL.revokeObjectURL(e.url)}},[l]);let me=(e)=>{if(e.currentTarget.files)L(e.currentTarget.files);e.currentTarget.value=""},X=he(()=>({files:c.map((e)=>({...e,id:e.id})),add:L,remove:j,clear:R,openFileDialog:q,fileInputRef:x}),[c,L,j,R,q]),w=M({controller:s,files:c,canSubmit:f});w.current={controller:s,files:c,canSubmit:f};let S=M(!0);F(()=>(S.current=!0,()=>{S.current=!1}),[]);let J=async(e)=>{let r=f===void 0?!0:f();if(r!==!0)return{status:"blocked",reason:r};if(D.current)return{status:"blocked",reason:"submission_pending"};if(e===null&&g===void 0)throw Error("Awaitable submission requires onSubmitAsync");let t=A.current;if(t===null)return{status:"blocked",reason:"form_unmounted"};let n=l?s.textInput.value:ee(t),m=s?.textInput.getRevision?.(),i=c,v=()=>{if(!S.current)return;let p=w.current;if(p.files!==i)return;if(l){if(m===void 0||p.controller===null||p.controller.textInput.getRevision?.()!==m)return;if(p.controller.textInput.clearSubmitted===void 0)p.controller.textInput.clear();else p.controller.textInput.clearSubmitted()}else if(ee(t)===n)t.reset();R()};D.current=!0;try{if(d?.(n.trim()))return v(),{status:"accepted"};let p=await Do(i),_=w.current.canSubmit===void 0?!0:w.current.canSubmit();if(_!==!0)return{status:"blocked",reason:_};if(!S.current)return{status:"blocked",reason:"form_unmounted"};if(p.rejectedCount>0)b?.({code:"accept",message:"One or more images are corrupted and were removed before sending."});if(g!==void 0)await g({text:n,files:p.files});else if(e!==null)await re({text:n,files:p.files},e);return v(),{status:"accepted"}}finally{D.current=!1}},ce=(e)=>{e.preventDefault(),J(e).catch(y)},de=h((e)=>{if(!e.trim())return;if(l&&s)Ie(()=>{s.textInput.setInput(e)});A.current?.requestSubmit()},[s,l]),K=a(Kt.Provider,{value:()=>J(null),children:ye(jt.Provider,{value:de,children:[a("input",{accept:E,"aria-label":"Upload files",className:"hidden",multiple:te,onChange:me,ref:x,title:"Upload files",type:"file"}),a("form",{className:P("w-full",u),onSubmit:ce,ref:A,"data-tour":"chat-input",...oe,children:a(ir,{className:P("codex-composer-surface overflow-y-auto has-[[data-slot=input-group-control]:focus-visible]:ring-0",se&&"border! border-[rgb(255,0,135)] has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(255,0,135)] dark:border-[rgb(253,93,177)] dark:has-[[data-slot=input-group-control]:focus-visible]:border-[rgb(253,93,177)]"),children:ne})})]})});return l?a(Re.Provider,{value:X,children:K}):a(Qt.Provider,{value:X,children:K})};function No({className:u,...o}){return a("div",{className:P("flex w-full min-w-0 flex-row items-end gap-2",u),...o})}function Ro({className:u,...o}){return a(an,{align:"block-end",className:P("order-first flex-wrap gap-1 p-2 pb-1.5",u),...o})}function Mo({className:u,...o}){return a(an,{align:"block-end",className:P("mt-3.5 justify-between gap-1 p-0",u),...o})}function Eo({className:u,...o}){return a("div",{className:P("flex items-center gap-1",u),...o})}var H=({variant:u="ghost",className:o,size:I,collapsed:d=!1,...y})=>{let f=d||Z.count(y.children)<=1?"icon-xs":"xs";return a(sn,{className:P("h-7 rounded-full text-xs font-medium hover:bg-transparent dark:hover:bg-transparent",(d||Z.count(y.children)<=1)&&"size-7",o),size:f,type:"button",variant:u,...y})},Ao=({className:u,variant:o="ghost",size:I="icon-xs",status:d,children:y,...f})=>{let g=a(fe,{className:"size-4"});if(d==="submitted")g=a(ge,{className:"size-4 animate-spin"});else if(d==="streaming")g=a(be,{className:"size-3 fill-current"});else if(d==="error")g=a(ve,{className:"size-4"});return a(sn,{"aria-label":"Submit",className:P("bg-foreground text-background hover:bg-foreground/70 size-7 rounded-full p-0 transition-opacity disabled:opacity-50",u),size:I,type:"submit",variant:o,...f,children:y??g})};
|
|
2
|
+
export{So,No,Ro,Mo,Eo,H,Ao};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{ro}from"./chunk-sq5zstzq.js";import{isPlanItems as o}from"@alwith/api";function Pn(s,r){let n=s.items.findLast((e)=>e.kind!=="user"),a=s.items.map((e)=>{switch(e.kind){case"user":return{key:e.id,kind:"user",active:!1};case"tool":return{key:e.id,kind:"tool",active:e.status==="pending"||e.status==="in_progress"};case"compaction":return{key:e.id,kind:"compaction",active:e.status==="in_progress"};case"plan":return{key:e.id,kind:"plan",active:o(e.plan)&&e.plan.entries.some((t)=>t.status==="in_progress")};case"thought":return{key:e.id,kind:"reasoning",active:e===n};case"assistant":{let t=e._meta?.codex,i=typeof t==="object"&&t!==null&&(("messageCompleted"in t)&&t.messageCompleted===!0||("messageCompletedAt"in t)&&typeof t.messageCompletedAt==="number");return{key:e.id,kind:s.final.includes(e)?"answer":"text",active:e===n&&!i}}}});return ro(a,r)}
|
|
2
|
+
export{Pn};
|