@alwith/module-chat 0.5.5 → 0.5.6
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-mzc51shd.js → chunk-0d8k5bmd.js} +2 -2
- package/dist/{chunk-6bdd2cgs.js → chunk-0fvpmcps.js} +2 -2
- package/dist/{chunk-76fxyvb0.js → chunk-0grd0g0x.js} +2 -2
- package/dist/chunk-0hpww4x3.js +2 -0
- package/dist/{chunk-3d58k7fn.js → chunk-0k654tyt.js} +2 -2
- package/dist/{chunk-3zj0ka21.js → chunk-0mf7yh69.js} +2 -2
- package/dist/chunk-0rxpyf0k.js +2 -0
- package/dist/{chunk-dhvpffgf.js → chunk-17wjmyj7.js} +2 -2
- package/dist/{chunk-11v81zha.js → chunk-1drkvxzk.js} +1 -1
- package/dist/{chunk-p0ebmb2m.js → chunk-1txn4b0v.js} +1 -1
- package/dist/{chunk-rmv0t2ee.js → chunk-2s4y2v50.js} +2 -2
- package/dist/{chunk-q53h2y2a.js → chunk-2ysnmwx1.js} +2 -2
- package/dist/{chunk-tjykfxrd.js → chunk-3nj26hhf.js} +2 -2
- package/dist/{chunk-r8k9jd0z.js → chunk-3ryhmzsq.js} +2 -2
- package/dist/{chunk-34xzrr3s.js → chunk-3wsg6710.js} +2 -2
- package/dist/{chunk-zw2q13qg.js → chunk-3x1eq95a.js} +2 -2
- package/dist/{chunk-42fw8maa.js → chunk-470vq7d1.js} +1 -1
- package/dist/{chunk-f3xhtnkz.js → chunk-4jagfjhm.js} +2 -2
- package/dist/chunk-4pbh3fph.js +2 -0
- package/dist/{chunk-k6b4cf05.js → chunk-5s2wpbdt.js} +1 -1
- package/dist/chunk-5t3rrnfd.js +2 -0
- package/dist/{chunk-y6v59cgf.js → chunk-5wyxvpgt.js} +1 -1
- package/dist/{chunk-0jw4ffzj.js → chunk-61vxy6yd.js} +1 -1
- package/dist/chunk-65ajc856.js +2 -0
- package/dist/chunk-65jedxc3.js +4 -0
- package/dist/{chunk-z79xmq12.js → chunk-68y66m3v.js} +2 -2
- package/dist/{chunk-v8rqevms.js → chunk-69yx37pv.js} +3 -3
- package/dist/chunk-6d38ff76.js +2 -0
- package/dist/{chunk-5s5tedyw.js → chunk-6j4g51ff.js} +2 -2
- package/dist/chunk-6pq1xmwg.js +2 -0
- package/dist/chunk-6vqnsdgc.js +2 -0
- package/dist/chunk-6ym3w4kf.js +2 -0
- package/dist/{chunk-1v3wc4cv.js → chunk-76tkqx9n.js} +2 -2
- package/dist/{chunk-48av28r4.js → chunk-78ew0821.js} +5 -5
- package/dist/chunk-7e1m1d9x.js +2 -0
- package/dist/chunk-88vkk9s3.js +2 -0
- package/dist/{chunk-at0v48cp.js → chunk-8bzk9e4v.js} +2 -2
- package/dist/{chunk-ez1ac611.js → chunk-8fn5n4yv.js} +2 -2
- package/dist/{chunk-85gdavf5.js → chunk-8p0074ye.js} +2 -2
- package/dist/{chunk-kc9rzb07.js → chunk-91trh8rj.js} +2 -2
- package/dist/{chunk-2q71dv8k.js → chunk-93q2dm10.js} +1 -1
- package/dist/{chunk-m92evp24.js → chunk-94k9byb1.js} +2 -2
- package/dist/{chunk-tp5y8cc7.js → chunk-9c41y5hw.js} +2 -2
- package/dist/{chunk-rd2n48s1.js → chunk-9eh80kxk.js} +2 -2
- package/dist/{chunk-0vy9fzs3.js → chunk-a2ftkzak.js} +1 -1
- package/dist/{chunk-qsqyf4y3.js → chunk-acrrwrzy.js} +2 -2
- package/dist/{chunk-y8qmxd0j.js → chunk-an03g9e8.js} +2 -2
- package/dist/{chunk-fv7tp8pr.js → chunk-bwas6kp2.js} +2 -2
- package/dist/{chunk-ta45etnd.js → chunk-c6w4bp15.js} +1 -1
- package/dist/{chunk-jtafw6h4.js → chunk-cywx4qmv.js} +2 -2
- package/dist/chunk-d2rrvka6.js +2 -0
- package/dist/chunk-dcxprfnp.js +2 -0
- package/dist/{chunk-wthttnkz.js → chunk-dsdxw9s8.js} +2 -2
- package/dist/{chunk-5w48y2ad.js → chunk-ehh31hzz.js} +1 -1
- package/dist/{chunk-hw5n7sqm.js → chunk-epqjzw63.js} +2 -2
- package/dist/{chunk-9d0vkezs.js → chunk-fzetrkvd.js} +2 -2
- package/dist/chunk-gb2dmt6b.js +2 -0
- package/dist/{chunk-mwkr9pvg.js → chunk-gmhbqxcg.js} +2 -2
- package/dist/{chunk-q989x2x5.js → chunk-gsq8mzr7.js} +2 -2
- package/dist/{chunk-h2nvgcbs.js → chunk-gtddnhdy.js} +2 -2
- package/dist/chunk-gwav4k8b.js +2 -0
- package/dist/{chunk-w3z37qwe.js → chunk-gy63n5pz.js} +2 -2
- package/dist/chunk-h05s12jn.js +3 -0
- package/dist/chunk-hf65xscb.js +2 -0
- package/dist/{chunk-9mcfd41e.js → chunk-hhw1pjz6.js} +2 -2
- package/dist/{chunk-tv9wdbxr.js → chunk-hjm26kwf.js} +1 -1
- package/dist/chunk-hmj7yqyb.js +3 -0
- package/dist/{chunk-h3s5e0c5.js → chunk-hmze7f10.js} +2 -2
- package/dist/{chunk-812n3qd8.js → chunk-hrexfky6.js} +2 -2
- package/dist/{chunk-494jkxv9.js → chunk-jd61cfkk.js} +2 -2
- package/dist/{chunk-jhxjbpt3.js → chunk-jwb3723b.js} +2 -2
- package/dist/chunk-k2zg8xva.js +2 -0
- package/dist/chunk-kg1gk77d.js +2 -0
- package/dist/chunk-kh1tc15g.js +2 -0
- package/dist/{chunk-wpx2bvd0.js → chunk-m4mfw5s4.js} +7 -7
- package/dist/{chunk-0h993cve.js → chunk-m5jhw1e6.js} +2 -2
- package/dist/{chunk-x8vd2d2g.js → chunk-mgt5j803.js} +1 -1
- package/dist/chunk-mj5720c4.js +2 -0
- package/dist/chunk-mv8jmv1e.js +2 -0
- package/dist/chunk-n3m7t85x.js +2 -0
- package/dist/{chunk-8fd8jhbf.js → chunk-n4cseazv.js} +3 -3
- package/dist/{chunk-cka09jf6.js → chunk-nb5wjv92.js} +2 -2
- package/dist/{chunk-kjtd3wc3.js → chunk-nx91ewps.js} +1 -1
- package/dist/{chunk-haf9qn5a.js → chunk-p2s04v76.js} +2 -2
- package/dist/{chunk-key9msc9.js → chunk-pkgrt90z.js} +2 -2
- package/dist/{chunk-m3cbbk3v.js → chunk-py1t2v6e.js} +2 -2
- package/dist/{chunk-5nemwzzv.js → chunk-q3hdevem.js} +2 -2
- package/dist/{chunk-sq5zstzq.js → chunk-q4y1q1na.js} +2 -2
- package/dist/{chunk-tcgx9yxg.js → chunk-q98941j2.js} +2 -2
- package/dist/{chunk-ygebvrv5.js → chunk-qbdqh38y.js} +1 -1
- package/dist/chunk-qbj5s8qa.js +2 -0
- package/dist/{chunk-5xjm1hab.js → chunk-qgfq5vrz.js} +1 -1
- package/dist/chunk-qqdca2rm.js +2 -0
- package/dist/{chunk-cbbr9m3a.js → chunk-r7c0tca8.js} +2 -2
- package/dist/chunk-r8z8f31m.js +2 -0
- package/dist/{chunk-v958q8hh.js → chunk-rd94eyan.js} +2 -2
- package/dist/{chunk-1mnc7200.js → chunk-rdtj6bad.js} +2 -2
- package/dist/{chunk-gdhkb2rz.js → chunk-rgkhm4s4.js} +2 -2
- package/dist/{chunk-xf91jp39.js → chunk-rkqe8p8n.js} +2 -2
- package/dist/chunk-s44rx1sz.js +3 -0
- package/dist/{chunk-w9nr7saa.js → chunk-scddkjv8.js} +1 -1
- package/dist/{chunk-nhsbjys5.js → chunk-sj7jdb7m.js} +1 -1
- package/dist/chunk-spt7tnqx.js +2 -0
- package/dist/{chunk-mme37xva.js → chunk-sqh158m4.js} +1 -1
- package/dist/{chunk-w522gwhm.js → chunk-syv6gady.js} +2 -2
- package/dist/{chunk-6jyd3a7v.js → chunk-tpx841s3.js} +2 -2
- package/dist/{chunk-raz9hb3h.js → chunk-ttdxc6mg.js} +5 -5
- package/dist/{chunk-91qp7sps.js → chunk-ttk21631.js} +2 -2
- package/dist/{chunk-bje0nmh9.js → chunk-twwqgd8e.js} +2 -2
- package/dist/{chunk-p8n6rm5h.js → chunk-tzjk7zkc.js} +2 -2
- package/dist/{chunk-t9nky8ka.js → chunk-v5wwv2t9.js} +3 -3
- package/dist/{chunk-b0v983ch.js → chunk-wf4tq3fn.js} +1 -1
- package/dist/{chunk-39f0d44a.js → chunk-wjs8bwpk.js} +2 -2
- package/dist/{chunk-xnmjg8r1.js → chunk-x053g6f2.js} +2 -2
- package/dist/chunk-xf14bg2v.js +4 -0
- package/dist/{chunk-jh46xzr6.js → chunk-xfjcwypy.js} +3 -3
- package/dist/{chunk-kk2nr6dd.js → chunk-xp0nfvxg.js} +2 -2
- package/dist/{chunk-9yv5c2s3.js → chunk-xw0gvwh5.js} +2 -2
- package/dist/{chunk-t794afpy.js → chunk-y438yezf.js} +3 -3
- package/dist/{chunk-3p9j3gmw.js → chunk-y6r6tzfh.js} +2 -2
- package/dist/{chunk-ap1br099.js → chunk-yegh80h4.js} +2 -2
- package/dist/{chunk-c7b8rscf.js → chunk-yf2p44mq.js} +2 -2
- package/dist/{chunk-ad32h099.js → chunk-yg42bpjr.js} +3 -3
- package/dist/{chunk-xttthm0n.js → chunk-z3e38981.js} +2 -2
- package/dist/{chunk-eyqbvc19.js → chunk-z4zm74ge.js} +2 -2
- package/dist/{chunk-mxj4s2r8.js → chunk-z75zbdq8.js} +1 -1
- package/dist/{chunk-p2khnrm1.js → chunk-zc2hdmk1.js} +2 -2
- package/dist/{chunk-1q1hyka4.js → chunk-zjg9n6zj.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.d.ts +2 -0
- 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.d.ts +2 -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-00sds3wb.js +0 -2
- package/dist/chunk-1dce9zt8.js +0 -2
- package/dist/chunk-1mv3y3cs.js +0 -2
- package/dist/chunk-1tz8afx9.js +0 -2
- package/dist/chunk-29wvjf38.js +0 -2
- package/dist/chunk-2w9f1q84.js +0 -4
- package/dist/chunk-52y4pyr1.js +0 -2
- package/dist/chunk-7w4tjrdw.js +0 -2
- package/dist/chunk-8w6ze6pw.js +0 -4
- package/dist/chunk-932ykb37.js +0 -2
- package/dist/chunk-azp1438s.js +0 -2
- package/dist/chunk-bafntrka.js +0 -3
- package/dist/chunk-bse4zh1d.js +0 -2
- package/dist/chunk-bx1x7t6v.js +0 -3
- package/dist/chunk-dgx31pdr.js +0 -2
- package/dist/chunk-dkbtw3g9.js +0 -2
- package/dist/chunk-f59aepmd.js +0 -2
- package/dist/chunk-gdbzk1kt.js +0 -2
- package/dist/chunk-hd682pax.js +0 -2
- package/dist/chunk-jf5651fz.js +0 -2
- package/dist/chunk-jmcb7an2.js +0 -2
- package/dist/chunk-n514z4we.js +0 -2
- package/dist/chunk-n6xa65sp.js +0 -2
- package/dist/chunk-qqv0bewt.js +0 -2
- package/dist/chunk-r22h488a.js +0 -3
- package/dist/chunk-s1vxbxzr.js +0 -2
- package/dist/chunk-s3mx42dt.js +0 -2
- package/dist/chunk-seg9xzjy.js +0 -2
- package/dist/chunk-vmywavgm.js +0 -2
- package/dist/chunk-w5wzxdbk.js +0 -2
- package/dist/chunk-xrek8rbm.js +0 -2
package/dist/activity-host.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{lr,a,v}from"./chunk-y6r6tzfh.js";export{lr as ActivityHostProvider,v as ActivityMarkdown,a as useActivityHost};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ae}from"../chunk-hjm26kwf.js";import{e}from"../chunk-cg97byvk.js";import{ue}from"../chunk-1drkvxzk.js";import{l}from"../chunk-1hy64ewz.js";import{h}from"../chunk-nx91ewps.js";import{V,R}from"../chunk-ehh31hzz.js";import{C}from"../chunk-xjtqdp82.js";import{$n,Et,de,dt}from"../chunk-qbj5s8qa.js";import{autoUpdate as j}from"@floating-ui/dom";import{cn as H}from"cn";import{useCallback as Q,useEffect as M,useLayoutEffect as O,useMemo as _,useRef as G,useState as F}from"react";import{createPortal as W}from"react-dom";import{jsx as i,jsxs as m}from"react/jsx-runtime";var c="__other__";function ae({current:r,total:A,anchorRef:N,t:v,onAccept:I,onDecline:L}){let x=_(()=>r?$n(r.requestedSchema):[],[r]),[S,b]=F({}),E=G(null);M(()=>{if(r?.elicitationId===void 0)return;let t={};for(let{key:a,property:o}of x)if(!de(o)){let u=dt(o)[0];if(u)t[a]={selected:u.value}}b(t)},[r?.elicitationId,x]),M(()=>{if(r?.elicitationId!==void 0&&E.current&&document.activeElement?.tagName!=="INPUT"&&document.activeElement?.tagName!=="TEXTAREA")E.current.focus()},[r?.elicitationId]);let[k,q]=F(null),[T,z]=F(null),y=Q(()=>{let t=N.current;if(!t)return;let a=t.getBoundingClientRect();if(a.width===0){let o=Math.min(640,window.innerWidth*0.9);q({left:(window.innerWidth-o)/2,width:o,bottom:24});return}q({left:a.left,width:a.width,bottom:window.innerHeight-a.bottom+20})},[N]);O(()=>{if(!r)return;let t=0,a=()=>{if(N.current){y();return}t=requestAnimationFrame(a)};return a(),()=>cancelAnimationFrame(t)},[r,y,N]),O(()=>{let t=N.current;if(!r||!t||!T)return;return j(t,T,y,{animationFrame:!0})},[r,T,N,y]);let U=_(()=>{if(!r)return!1;for(let{key:t,property:a}of x){let o=S[t];if(!o)return!1;if(de(a)){if(!o.selectedSet||o.selectedSet.size===0)return!1;if(o.selectedSet.has(c)&&!o.otherText?.trim())return!1}else{if(!o.selected)return!1;if(o.selected===c&&!o.otherText?.trim())return!1}}return!0},[r,x,S]),D=Q(async()=>{if(!r)return;if(!U)return;let t={},a={};for(let{key:o,property:u}of x){let d=S[o];if(!d)continue;let p;if(de(u))t[o]=[...d.selectedSet??[]].map((f)=>f===c?(d.otherText??"").trim():f).filter(Boolean);else{let f=d.selected??"";if(t[o]=f===c?(d.otherText??"").trim():f,f!==c)p=dt(u).find((s)=>s.value===f)?.preview}let g=d.notes?.trim();if(p||g)a[o]={...p&&{preview:p},...g&&{notes:g}}}await I(r.elicitationId,t,a)},[r,x,S,U,I]),B=Q(async()=>{if(r)await L(r.elicitationId)},[r,L]);if(!r||!k)return null;return W(m("div",{"data-overlay":"ask-user-question",tabIndex:0,onKeyDown:(t)=>{if(t.key==="Escape")t.preventDefault(),B()},className:"bg-card border-border fixed z-50 flex flex-col overflow-hidden rounded-lg border shadow-lg outline-none",style:{left:k.left,width:k.width,bottom:k.bottom,maxHeight:"70vh"},ref:(t)=>{E.current=t,z(t)},children:[m("div",{className:"border-border flex shrink-0 items-center justify-between gap-2 border-b px-3 py-2",children:[i("div",{className:"text-foreground text-sm font-medium",children:v("askUserQuestion.title")}),A>1&&i("span",{className:"text-muted-foreground shrink-0 text-xs",children:`1 / ${A}`})]}),i("div",{className:"min-h-0 flex-1 overflow-y-auto",children:i("div",{className:"space-y-4 px-3 py-3",children:x.map(({key:t,property:a},o)=>{let u=S[t],d=u?.selected,p=u?.selectedSet??new Set,g=dt(a),f=de(a);return m("div",{className:"space-y-2",children:[m("div",{className:"flex items-center gap-2",children:[i(Ae,{variant:"secondary",className:"font-mono text-[10px] tracking-wide uppercase",children:Et(a).title??t}),i("div",{className:"text-foreground text-sm font-medium",children:Et(a).description})]}),f?m("div",{className:"space-y-1.5 ps-1",children:[g.map((s)=>m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ue,{checked:p.has(s.value),onCheckedChange:(n)=>{b((w)=>{let P=new Set(w[t]?.selectedSet??new Set);if(n)P.add(s.value);else P.delete(s.value);return{...w,[t]:{...w[t],selectedSet:P}}})}}),m("div",{className:"min-w-0 flex-1",children:[i("div",{className:"text-foreground text-sm",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs",children:s.description})]})]},s.value)),m("label",{className:"hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",children:[i(ue,{checked:p.has(c),onCheckedChange:(s)=>{b((n)=>{let w=new Set(n[t]?.selectedSet??new Set);if(s)w.add(c);else w.delete(c);return{...n,[t]:{...n[t],selectedSet:w}}})}}),i("div",{className:"text-foreground min-w-0 flex-1 text-sm",children:v("askUserQuestion.other")})]}),p.has(c)&&i("div",{className:"ps-7",children:i(l,{placeholder:v("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}):m(V,{value:d??"",onValueChange:(s)=>b((n)=>({...n,[t]:{...n[t],selected:s}})),className:"space-y-1.5 ps-1",children:[g.map((s)=>{let n=`${o}:${s.value}`;return m("div",{className:H("hover:bg-muted/40 flex cursor-pointer items-center gap-2 rounded-sm px-1.5 py-1",d===s.value&&"bg-muted/60"),children:[i(R,{value:s.value,id:n}),m(h,{htmlFor:n,className:"min-w-0 flex-1 cursor-pointer",children:[i("div",{className:"text-foreground text-sm font-normal",children:s.label}),s.description&&i("div",{className:"text-muted-foreground text-xs font-normal",children:s.description})]})]},s.value)}),m("div",{className:H("hover:bg-muted/40 flex items-center gap-2 rounded-sm px-1.5 py-1",d===c&&"bg-muted/60"),children:[i(R,{value:c,id:`${o}:other`,className:"mt-0.5"}),i(h,{htmlFor:`${o}:other`,className:"text-foreground min-w-0 flex-1 cursor-pointer text-sm font-normal",children:v("askUserQuestion.other")})]}),d===c&&i("div",{className:"ps-7",children:i(l,{placeholder:v("askUserQuestion.otherPlaceholder"),value:u?.otherText??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],otherText:s.target.value}}))})})]}),!f&&d&&d!==c&&(()=>{let s=g.find((n)=>n.value===d)?.preview;if(!s)return null;return i("pre",{className:"bg-muted/50 text-muted-foreground ms-1 mt-1 overflow-auto rounded-sm px-2 py-1.5 font-mono text-[11px] whitespace-pre-wrap",children:s})})(),g.some((s)=>s.preview)&&i(C,{placeholder:v("askUserQuestion.notesPlaceholder"),value:u?.notes??"",onChange:(s)=>b((n)=>({...n,[t]:{...n[t],notes:s.target.value}})),rows:1,className:"min-h-0 resize-none text-xs"})]},t)})})}),m("div",{className:"border-border bg-card flex shrink-0 items-center justify-end gap-2 border-t px-3 py-2",children:[i(e,{variant:"ghost",size:"sm",onClick:()=>void B(),children:v("askUserQuestion.cancel")}),i(e,{size:"sm",disabled:!U,onClick:()=>void D(),children:v("askUserQuestion.submit")})]})]}),document.body)}export{ae as ChoiceElicitationForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{$n,Et,de,dt}from"../chunk-qbj5s8qa.js";export{$n as elicitationFields,Et as elicitationLabels,dt as elicitationOptions,de as isMultiSelect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{fr,Hn,Qr,Xr}from"../chunk-gwav4k8b.js";export{fr as PERMISSION_KIND_GROUP_ORDER,Qr as isAllowKind,Xr as isAlwaysKind,Hn as sortPermissionOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_n}from"../chunk-hmze7f10.js";import"../chunk-gwav4k8b.js";export{_n as PermissionView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Sr,hr,Nr,On}from"../chunk-dsdxw9s8.js";import"../chunk-5wyxvpgt.js";import"../chunk-sj7jdb7m.js";import"../chunk-1drkvxzk.js";import"../chunk-qbdqh38y.js";import"../chunk-1hy64ewz.js";import"../chunk-1txn4b0v.js";import"../chunk-nx91ewps.js";import"../chunk-ehh31hzz.js";import"../chunk-xjtqdp82.js";import"../chunk-cg97byvk.js";export{On as SchemaElicitationForm,Sr as elicitationFields,hr as initialValues,Nr as isAnswered};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Fn}from"../chunk-epqjzw63.js";import"../chunk-scddkjv8.js";import"../chunk-cg97byvk.js";export{Fn as UrlElicitationCard};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{ho,ye,jt,vo,xo,yo}from"./chunk-hhw1pjz6.js";import{forwardRef as ve,useCallback as K,useEffect as ge,useImperativeHandle as pe,useLayoutEffect as w,useMemo as ne,useRef as s,useState as F}from"react";import{jsx as R,jsxs as re}from"react/jsx-runtime";var Re=12,X=2,V=800,he=new Map;function He({turnKey:q,heightPx:x,placeholder:W=!1,deferUntilReady:n=!1,observe:H,onReady:L,children:z}){let h=s(null),[T,_]=F(!1),U=K((m)=>{h.current=m,H(q,m)},[H,q]);return w(()=>{let m=h.current;if(m===null)throw Error("Codex turn element is missing");let b=()=>{L(m),_(!0)};if(m.querySelector("[data-markdown-pending]")===null){b();return}let d=new MutationObserver(()=>{if(m.querySelector("[data-markdown-pending]")!==null)return;d.disconnect(),b()});return d.observe(m,{childList:!0,subtree:!0}),()=>d.disconnect()},[L]),re("div",{style:T?void 0:{position:"relative",height:x,overflow:"hidden"},children:[R("div",{ref:U,className:"[&_[data-virtualized-turn-content]]:[content-visibility:visible]","data-turn-key":q,"aria-busy":!T||void 0,style:!T&&!W&&n?{visibility:"hidden"}:void 0,"data-turn-ready":T?"":void 0,children:z}),!T&&!W&&n&&R("div",{"aria-hidden":"true",className:"codex-turn-loading",children:re("div",{className:"codex-turn-loading-lines",children:[R("span",{}),R("span",{}),R("span",{})]})})]})}var fo=ve(function({entries:x,renderTurn:W,scrollElement:n,sessionKey:H,leadingContent:L,leadingInsetPx:z=0,preserveViewport:h=!1},T){let _=s(null),[U,m]=F(z),b=L!==void 0&&L!==null;w(()=>{let e=_.current;if(e===null)return;let t=()=>m(e.getBoundingClientRect().height);t();let o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[b]);let d=ne(()=>he.get(H),[H]),[j,J]=F(()=>d?.turnHeightsByKey??{}),i=ne(()=>ho({entries:x,gapPx:Re,measuredHeightsByKey:j,leadingInsetPx:b?U:z}),[x,j,b,U,z]),me=ne(()=>{let e=ye({distanceFromBottomPx:d?.distanceFromBottomPx??0,layout:i,overscanCount:X,viewportHeightPx:V}),t=d?.renderedWindow;if(t===void 0||t===null)return e;return jt({anchorKey:t.anchorKey,layout:i,previousRange:{startIndex:0,endIndex:Math.min(t.count,e.endIndex-e.startIndex)}})??e},[d,i]),[M,ie]=F(me),[y,oe]=F(V),[c,ue]=F(null),N=s(d?.distanceFromBottomPx??0),k=s(M),ae=s(i.turnKeys),l=s(j),S=s(i),se=s(i),P=s(new Map),v=s(null),C=s(null),E=s(null),D=s(new Map),Q=s(!1),ce=s(()=>{}),O=s(null),de=K(()=>{if(!h||n===null||v.current!==null||O.current!==null)return;let e=n.getBoundingClientRect();if(e.height<=0)return;let t=[...P.current].filter(([,r])=>r.hasAttribute("data-turn-ready")).map(([r,u])=>{let a=u.getBoundingClientRect(),g=S.current.turnIndexByKey.get(r),B=g===void 0?a.height:S.current.heightsPx[g];return{key:r,element:u,rect:a,bottom:a.top+B}}).filter(({rect:r,bottom:u})=>u>e.top&&r.top<e.bottom).toSorted((r,u)=>r.rect.top-u.rect.top),o=t.flatMap((r)=>[...r.element.querySelectorAll("[data-user-message-bubble], .codex-markdown-root > *")].filter((u)=>!u.closest('[aria-hidden="true"], [inert]')).map((u)=>({key:r.key,element:u,rect:u.getBoundingClientRect()})).filter(({rect:u})=>u.height>0&&u.top>=e.top&&u.top<e.bottom)).toSorted((r,u)=>r.rect.top-u.rect.top)[0]??t[0];if(o)O.current={key:o.key,element:o.element,top:o.rect.top-e.top,scrollTop:n.scrollTop}},[h,n]),Y=s(de);Y.current=de;let p=K((e,t)=>{let o=Math.min(e,i.totalHeightPx),r=ye({distanceFromBottomPx:o,layout:i,overscanCount:X,viewportHeightPx:t}),u=k.current,a=u.startIndex<=r.startIndex&&u.endIndex>=r.endIndex?u:r;if(N.current=o,k.current=a,ae.current=i.turnKeys,oe(t),a!==u)ie(a)},[i]),A=K((e)=>{let t=Math.max(0,e.scrollHeight-i.totalHeightPx);return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop-t)},[i.totalHeightPx]),fe=K((e)=>{let t=e.dataset.turnKey;if(t===void 0)throw Error("Codex measured turn is missing its key");let o=Math.max(1,e.getBoundingClientRect().height);if(l.current[t]===o)return;Y.current();let r={...l.current,[t]:o};l.current=r,J(r)},[]),Z=K(()=>{if(C.current!==null)return C.current;return C.current=new ResizeObserver((e)=>{for(let t of e){let o=t.target;if(!("turnReady"in o.dataset)&&o.querySelector("[data-markdown-pending]")!==null)continue;let r=o.dataset.turnKey;if(r===void 0)throw Error("Codex measured turn is missing its key");let u=Math.max(1,t.borderBoxSize[0]?.blockSize??t.contentRect.height);D.current.set(r,u)}if(E.current!==null||D.current.size===0)return;E.current=requestAnimationFrame(()=>{E.current=null;let t=[...D.current].filter(([r,u])=>l.current[r]!==u);if(D.current.clear(),t.length===0)return;Y.current();let o={...l.current,...Object.fromEntries(t)};l.current=o,J(o)})}),C.current},[]),xe=K((e,t)=>{let o=P.current.get(e);if(o!==void 0)Z().unobserve(o),P.current.delete(e);if(t===null)return;if(t.dataset.turnKey!==e)throw Error(`Codex turn key does not match its element: ${e}`);P.current.set(e,t),Z().observe(t)},[Z]);ge(()=>()=>{if(C.current?.disconnect(),E.current!==null)cancelAnimationFrame(E.current);D.current.clear(),C.current=null,P.current.clear()},[]),w(()=>{ce.current=()=>{if(n===null)return;let e=A(n);if(v.current!==null){N.current=e,oe(n.clientHeight||V);return}p(e,n.clientHeight||V)}},[A,n,p]),w(()=>{if(n===null)return;if(!Q.current){Q.current=!0;let o=d?.distanceFromBottomPx??0;n.scrollTo({behavior:"instant",top:Math.max(0,o>0?S.current.totalHeightPx-n.clientHeight-o:n.scrollHeight-n.clientHeight)})}let e=()=>ce.current();e(),n.addEventListener("scroll",e,{passive:!0});let t=new ResizeObserver(e);return t.observe(n),()=>{n.removeEventListener("scroll",e),t.disconnect()}},[d,n]),w(()=>{if(n===null||c===null)return;let e=P.current.get(c.turnKey);if(e?.querySelector("[data-markdown-pending]")!==null)return;let t=e.offsetHeight;if(t<=0)return;if(l.current[c.turnKey]!==t){let g={...l.current,[c.turnKey]:t};l.current=g,J(g);return}let o=c.getTargetElement(e)??e,r=e.getBoundingClientRect(),u=o.getBoundingClientRect(),a=yo({align:c.align,layout:i,targetHeightPx:u.height,targetOffsetPx:u.top-r.top,turnKey:c.turnKey,viewportHeightPx:n.clientHeight});if(a===null)throw Error(`Codex virtual turn is missing: ${c.turnKey}`);n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-a)}),p(a,n.clientHeight||V),queueMicrotask(()=>{if(v.current!==c)return;c.complete(),v.current=null,ue(null)})},[i,c,n,p]),w(()=>{let e=se.current;if(se.current=i,S.current=i,n===null||c!==null){O.current=null;return}let t=O.current;O.current=null;let o=t===null?void 0:n.contains(t.element)?t.element:P.current.get(t.key);if(h&&e!==i&&t!==null&&o!==void 0){let u=o.getBoundingClientRect().top-n.getBoundingClientRect().top,a=n.scrollTop-t.scrollTop;n.scrollTop+=u-t.top+a,p(A(n),n.clientHeight);return}let r=N.current;if(h&&e!==i&&Q.current)r=Math.max(0,e.totalHeightPx-n.clientHeight-n.scrollTop);if((r>24||h)&&e!==i){let u=A(n);if(u<=96&&!h){p(u,y);return}let a=ye({distanceFromBottomPx:r,layout:e,overscanCount:0,viewportHeightPx:y}),g=e.turnKeys.slice(a.startIndex,a.endIndex).filter((f)=>i.turnIndexByKey.has(f)),B=g.find((f)=>l.current[f]!==void 0)??g[0];if(B!==void 0){let f=vo({anchorKey:B,distanceFromBottomPx:r,nextLayout:i,previousLayout:e});if(f===null)throw Error(`Codex viewport anchor is missing: ${B}`);r=f,n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-r)})}}p(r,y)},[i,c,A,n,p,y,h]),w(()=>{k.current=M},[M]),ge(()=>()=>{v.current?.complete(),v.current=null;let e=k.current,o=S.current.turnKeys[e.startIndex];he.set(H,{distanceFromBottomPx:N.current,renderedWindow:o===void 0?null:{anchorKey:o,count:e.endIndex-e.startIndex},turnHeightsByKey:l.current})},[H]),pe(T,()=>({scrollToKey(e,t=(r)=>r,o={align:"center"}){v.current?.complete();let r=i.turnIndexByKey.get(e);if(r===void 0)throw Error(`Codex virtual turn is missing: ${e}`);let u=i.turnKeys[r],a=xo({layout:i,turnKey:e,viewportHeightPx:y});if(a===null)throw Error(`Codex virtual turn is missing: ${e}`);let g=ye({distanceFromBottomPx:a,layout:i,overscanCount:X,viewportHeightPx:y});return k.current=g,ie(g),new Promise((B)=>{let f={align:o.align,complete:B,getTargetElement:t,turnKey:u};v.current=f,ue(f)})}}),[i,y]);let I=M,G=ae.current;if(!(G===i.turnKeys||G.length===i.turnKeys.length&&G.every((e,t)=>e===i.turnKeys[t]))){let e=G[M.startIndex];I=(e===void 0?null:jt({anchorKey:e,layout:i,previousRange:M}))??ye({distanceFromBottomPx:N.current,layout:i,overscanCount:X,viewportHeightPx:y})}let ee=x.length-1,le=x[ee],te=x.slice(I.startIndex,Math.min(I.endIndex,ee)).map((e,t)=>({entry:e,index:I.startIndex+t}));if(le!==void 0)te.push({entry:le,index:ee});return re("div",{"data-codex-timeline":!0,"data-codex-virtualized-pending-key":c?.turnKey,"data-codex-virtualized-range":`${I.startIndex}:${I.endIndex}`,"data-codex-virtualized-total-count":x.length,"data-codex-virtualized-turn-count":te.length,className:"relative shrink-0",style:{height:i.totalHeightPx},children:[b&&R("div",{ref:_,"data-codex-timeline-leading":!0,className:"absolute inset-x-0 top-0",children:L}),te.map(({entry:e,index:t})=>R("div",{className:"absolute inset-x-0",style:{top:i.topOffsetsPx[t]??0},children:R(He,{turnKey:e.turnKey,heightPx:i.heightsPx[t],placeholder:e.placeholder,deferUntilReady:e.deferUntilReady,observe:xe,onReady:fe,children:W(e,t)})},e.turnKey))]})});
|
|
2
|
+
export{fo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{f}from"./chunk-xf14bg2v.js";import{textOf as A,turns as S}from"@alwith/api";import{codexMessageError as _,nativeTurnId as y}from"@nyssance/codex-acp-v2/client";function qr(t){return t.kind==="tool"&&t.name==="mcp_startup"}function E(t){let e=t._meta?.codex;if(typeof e!=="object"||e===null)return null;let n=e.phase;return typeof n==="string"?n:null}function w(t){let e=t._meta?.codex;return typeof e==="object"&&e!==null&&e.notice===!0}function Jo(t){return t.user===null&&t.items.length>0&&t.items.every((e)=>e.kind==="assistant"&&w(e))}function T(t,e,n){let o=t.work.at(-1);if(o?.kind==="activity"&&o.items.at(-1)===n){o.items.push(e);return}t.work.push({kind:"activity",key:`activity:${e.kind}:${e.id}`,items:[e]})}function M(t,e,n){if(t.kind!=="tool"){e.push(t);return}let o=n.get(t.id);if(o===void 0)throw Error(`Grouped tool is missing from the session: ${t.id}`);e.push(o);for(let s of t.children)M(s,e,n)}function j(t,e,n,o){switch(e.kind){case"user":break;case"assistant":{if(_(e)!==null){let u=y(e),p=t.errors.findIndex((m)=>u!==null&&y(m)===u);if(p===-1)t.errors.push(e);else t.errors[p]=e;break}let s=E(e),i=e._meta?.codex,d=f(e._meta).length>0||typeof i==="object"&&i!==null&&"delivery"in i&&i.delivery==="async";if(f(e._meta).length>0)t.final.push(e);else if(d)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else if(s==="final_answer")t.final.push(e);else if(s==="commentary"||w(e)||s===null&&n)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else t.final.push(e);break}case"thought":T(t,e,o);break;case"tool":if(T(t,e,o),e.toolKind==="edit")t.edits.push(e);break;case"plan":t.work.push({kind:"plan",key:`plan:${e.id}`,item:e});break;case"compaction":t.work.push({kind:"compaction",key:`compaction:${e.id}`,item:e});break}}function er(t,e=[],n=[]){let o=new Map(e.map((r)=>[r.key,r])),s=new Map(t.items.filter((r)=>r.kind==="tool").map((r)=>[r.id,r])),i={...t,items:t.items.filter((r)=>!qr(r))},d=new Map(n.map((r,a)=>[r.turnId,a])),u=[],p=[u],m,I=null;for(let r of i.items){let a=y(r),l=d.get(a??"");if(a!==null&&I!==null&&a!==I||l!==void 0&&m!==void 0&&l>m+1)u=[],p.push(u);if(u.push(r),a!==null||r.kind==="user")I=a;if(l!==void 0)m=l}return p.flatMap((r)=>S({...i,items:r})).map((r)=>{let a=r.prompt===null?[]:[r.prompt];for(let c of r.entries)M(c,a,s);let l=a[0];if(l===void 0)throw Error("A turn without items");let h=`turn:${l.kind}:${l.id}`,b=r.endedAt??Math.max(...a.map((c)=>c.at)),k=o.get(h);if(k!==void 0&&K(k.items,a)&&k.endedAt===b)return k;let g={key:h,user:r.prompt,work:[],final:[],errors:[],edits:[],startedAt:r.startedAt??l.at,endedAt:b,replayed:a.every(an),items:a},v=a.findLastIndex((c)=>c.kind!=="user"&&c.kind!=="compaction");return a.forEach((c,x)=>j(g,c,x<v,a[x-1])),g})}function K(t,e){return t.length===e.length&&t.every((n,o)=>n===e[o])}function an(t){let e=t._meta?.codex;return t.replayed||typeof e==="object"&&e!==null&&"historyReplay"in e&&e.historyReplay===!0}function q(t){return A(t.content)}function $e(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function sn(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function tr(t){let e=(s)=>{for(let i of t.items){let d=i._meta?.codex;if(typeof d!=="object"||d===null)continue;let u=d[s];if(typeof u==="number"&&Number.isFinite(u)&&u>=0)return u}return},n=e("workDurationMs"),o=e("turnDurationMs");return{durationMs:n??o,durationKind:n===void 0&&o!==void 0?"total":"work",startedAt:e("workStartedAt")}}function nr(t,e,n){if(n?.user==null)return!1;let o=e.items.map(y).find((i)=>i!==null),s=y(n.user);if(o!==void 0&&s!==null)return o===s;return!e.items.some((i)=>{let d=i._meta?.codex;return typeof d==="object"&&d!==null&&"turnCompletedAt"in d&&typeof d.turnCompletedAt==="number"})&&t.state!=="idle"&&(n.user.echo==="pending"||n.user.echo==="acknowledged")&&e.user!==null&&t.turnEndedAt[e.user.id]===void 0&&e.errors.length===0}function or(t,e){if(t.state==="idle")return;let n=e.length-1;while(n>0){let o=e[n];if(o.items.some((s)=>s.kind!=="user"))break;if(!nr(t,e[n-1],o))break;n--}return e[n]?.key}function rr(t,e,n){let o=n,s=n;while(o>0&&nr(t,e[o-1],e[o]))o--;while(s+1<e.length&&nr(t,e[s],e[s+1]))s++;let i=e.slice(o,s+1),d=i.findLast((u)=>u.items.some((p)=>p.kind!=="user"))??i[0];return{continued:e[n]!==d,items:i.flatMap((u)=>u.items),edits:i.flatMap((u)=>u.edits),startedAt:i[0].startedAt}}
|
|
2
|
+
export{qr,Jo,er,an,q,$e,sn,tr,nr,or,rr};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class s{worker=new Worker(new URL("@alwith/module-chat/code-highlighter.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(i)=>{let e=this.active,t=i.data;if(t.clientId!==e?.clientId||t.revision!==e.revision){this.fail(Error("Code highlighting worker returned an unexpected request"));return}if(this.active=null,!t.ok){this.fail(Error(t.error));return}let r=this.clients.get(e.clientId);if(r?.revision===e.revision)r.onResult({code:e.code,language:e.language,html:t.html});this.dispatch()},this.worker.onerror=(i)=>this.fail(Error(i.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize code highlighting result"))}fail(i){this.failure=i,this.worker.terminate(),this.pending.clear(),this.active=null;for(let e of this.clients.values())e.onError(i)}dispatch(){if(this.active!==null||this.pending.size===0)return;let i=this.pending.values().next().value;this.pending.delete(i.clientId),this.active=i;try{this.worker.postMessage(i)}catch(e){this.fail(e instanceof Error?e:Error(String(e)))}}connect(i,e){if(this.failure!==null)throw this.failure;let t=++this.nextClientId,r={revision:0,onResult:i,onError:e};return this.clients.set(t,r),{update:(o,l)=>{if(this.failure!==null)throw this.failure;r.revision+=1,this.pending.set(t,{clientId:t,revision:r.revision,code:o,language:l}),this.dispatch()},dispose:()=>{if(this.clients.delete(t),this.pending.delete(t),this.clients.size===0)this.worker.terminate(),n=void 0}}}}var n;function
|
|
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 Yo(i,e){return n??=new s,n.connect(i,e)}
|
|
2
|
+
export{Yo};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function Tr(t,e){if(t.type||!e.type)return t;let o=e.type.split("/")[1],i=o!==void 0&&o!==""?`pasted-${Date.now()}.${o==="jpeg"?"jpg":o}`:"";return new File([t],t.name||i||`pasted-${Date.now()}`,{type:e.type})}function pn(t){let e=[],o=!1;for(let i of t){if(i.kind!=="file")continue;let n=i.getAsFile();if(!n)continue;if(!(n.type||i.type).startsWith("image/")){o=!0;continue}e.push(Tr(n,i))}return{imageFiles:e,sawNonImageFile:o}}function gn(t){return[...t].some((e)=>e.kind==="string")}function s(t){let e=t.codePointAt(0);return e<32&&e!==9&&e!==10&&e!==13||e===127}function Ir(t){return[...t].filter((e)=>!s(e)).join("")}function dr(t,e){let o=0;for(let i=0;i<e;i++){let n=t.charCodeAt(i);if(n>=0&&n<=8||n===11||n===12||n>=14&&n<=31||n===127)o++}return o}function We(t){let{value:e,selectionStart:o,selectionEnd:i}=t,n=Ir(e);if(n===e)return n;if(t.value=n,o!==null&&i!==null){let a=Math.max(0,o-dr(e,o)),r=Math.max(0,i-dr(e,i));requestAnimationFrame(()=>{t.setSelectionRange(a,r)})}return n}
|
|
2
|
+
export{Tr,pn,gn,Ir,dr,We};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{uo}from"./chunk-an03g9e8.js";import{d,lo,u,m}from"./chunk-1txn4b0v.js";import{cn as M}from"cn";import{XIcon as L}from"lucide-react";import{useCallback as O,useEffect as z,useMemo as j,useRef as H,useState as S}from"react";import{jsx as i,jsxs as A}from"react/jsx-runtime";function no({open:l,onOpenChange:P,url:h,filename:x,scale:v,onScaleChange:p,containerRef:T,containerClassName:I,dialogContentClassName:R,imageClassName:W}){let g=O((e)=>Math.min(4,Math.max(0.25,e)),[]),[Z,C]=S(1),o=g(v??Z),k=H(null),s=T??k,D=H(null),[f,N]=S({width:0,height:0}),[y,E]=S({width:0,height:0}),b=O((e)=>{let n=g(e);if(typeof p==="function"){p(n);return}C(n)},[p,g]);z(()=>{if(!l)return;if(!h)return;if(typeof v==="number")return;C(1)},[l,h,v]),z(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{N({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let X=O(()=>{b(1)},[b]),r=j(()=>{let{width:e,height:n}=y,{width:t,height:a}=f;if(e===0||n===0)return{width:0,height:0};if(t===0||a===0)return{width:0,height:0};let c=Math.min(t/e,a/n,1),w=e*c,_=n*c;return{width:w*o,height:_*o}},[o,y,f]);if(!h)return null;return i(d,{open:l,onOpenChange:P,children:A(u,{className:M("top-1/2 left-1/2 h-[90vh] max-h-[90vh] w-[90vw]! max-w-[90vw]! -translate-x-1/2 -translate-y-1/2 gap-0 rounded-none bg-transparent p-0 ring-0 sm:w-[90vw]! sm:max-w-[90vw]!",R),showCloseButton:!1,children:[i(m,{className:"sr-only",children:x||"Image preview"}),i(lo,{"aria-label":"Close",className:"absolute top-3 right-3 z-10 flex size-10 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur-sm transition-colors hover:bg-black/75",children:i(L,{className:"size-5"})}),i("div",{ref:s,onWheel:(e)=>{if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();let n=e.deltaY>0?o-0.2:o+0.2,t=g(Number.parseFloat(n.toFixed(2)));if(t===o)return;let a=s.current,c=D.current,w=a&&c?uo({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(b(t),a&&w)requestAnimationFrame(()=>{a.scrollTo(w)})},className:M("h-full w-full scrollbar-thin overflow-auto",I),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(f.width,r.width),height:Math.max(f.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:x||"image preview",className:M("block object-contain select-none",W),decoding:"async",draggable:!1,ref:D,onDoubleClick:X,onLoad:(e)=>{let n=e.currentTarget;E({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))N({width:t.clientWidth,height:t.clientHeight})},style:{imageRendering:"auto",width:r.width||void 0,height:r.height||void 0,maxWidth:r.width?"none":"90vw",maxHeight:r.height?"none":"90vh"},src:h})})})})]})})}
|
|
2
|
+
export{no};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{Qo}from"./chunk-17wjmyj7.js";import{useCallback as xe,useEffect as P,useLayoutEffect as ye,useMemo as X,useRef as I,useState as E}from"react";import"@alwith/module-chat/navigation-rail.css";import{jsx as T,jsxs as Ne,Fragment as ke}from"react/jsx-runtime";var Se=4,ge=10;function we(h,x){let v=new Map(x.flatMap((c)=>c.itemIds.map((S)=>[S,c.key]))),p=Array(h.length),C;for(let c=h.length-1;c>=0;c--)C=v.get(h[c])??C,p[c]=C;let A=Math.max(-1,...x.map((c)=>c.key))+1,B=new Set,n=[];for(let[c,S]of h.entries()){let w=v.get(S),m=n.at(-1);if(!m||w!==void 0&&w!==m.key||w===void 0&&m.itemIds.length>=64&&p[c]!==m.key){let y=w!==void 0&&!B.has(w)?w:A++;m={key:y,startIndex:c,itemIds:[]},n.push(m),B.add(y)}m.itemIds.push(S)}return n}function fe(h,x){if(h.size!==x.size)return!1;for(let v of h)if(!x.has(v))return!1;return!0}function Ko({audio:h,beforeReveal:x,ensureItemMounted:v,items:p,onPreviewItem:C,renderPreview:A,onRevealError:B,scrollRoot:n,targetTopMarginPx:c=16}){let[S,w]=E(()=>{let e=p.at(-1);return new Set(e===void 0?[]:[e.id])}),[m,y]=E(null),[_,O]=E(null),[Z,R]=E(!1),[j,pe]=E(()=>new Set),[ve,be]=E(!0),[Ie,F]=E(null),{installUnlock:ee,preload:te,playSequence:ne}=h,K=I(null),M=I(null),U=I(!1),H=I(null),L=I(0),G=I(null),k=I(null),V=I(new Set),z=X(()=>p.map((e)=>e.id).join("\x00"),[p]),J=I(p);J.current=p;let ie=I(j),re=I(S),se=I({itemIdsKey:z,scrollRoot:n});if(se.current.scrollRoot!==n)L.current+=1,se.current={itemIdsKey:z,scrollRoot:n};let g=X(()=>v===void 0?p.filter((e)=>j.has(e.id)):p,[v,p,j]),ae=X(()=>g.map((e)=>({inputTokens:e.inputTokens,outputTokens:e.outputTokens})),[g]),D=I({ids:"",groups:[]}),oe=g.map((e)=>e.id).join("\x00");if(D.current.ids!==oe)D.current={ids:oe,groups:we(g.map((e)=>e.id),D.current.groups)};P(()=>ee(),[ee]),P(()=>()=>{if(L.current+=1,G.current?.cancel(),k.current!==null)clearTimeout(k.current)},[]),P(()=>{y(null),R(!1),O(null),M.current=null,U.current=!1,H.current=null,F(null),V.current.clear()},[n]),P(()=>{te()},[te]),P(()=>{if(n===null)return;let e=new Set,t=new Map,i=new Set(J.current.map((s)=>s.id)),r=()=>{let s=new Set(t.values()),d=J.current.filter((f)=>s.has(f.id)).map((f)=>f.id),o=d.findIndex((f)=>e.has(f));if(o===-1)return;let b=o;for(let f=o+1;f<d.length;f++)if(e.has(d[f]))b=f;let N=new Set(d.slice(o,b+1));if(fe(re.current,N))return;re.current=N,w(N)},a=new IntersectionObserver((s)=>{for(let d of s){let o=t.get(d.target);if(d.isIntersecting)e.add(o);else e.delete(o)}r()},{root:n,rootMargin:`-${c}px 0px 0px 0px`}),u=()=>{let s=new Set,d=new Set;for(let o of n.querySelectorAll("[data-content-search-unit-key]")){let b=o.dataset.contentSearchUnitKey;if(b===void 0||!i.has(b)||s.has(b))continue;s.add(b);let N=o.closest("[data-turn-key]"),f=N===null||d.has(N)?o:N;if(d.add(f),t.has(f))continue;t.set(f,b),a.observe(f)}for(let o of t.keys()){if(d.has(o))continue;a.unobserve(o),e.delete(t.get(o)),t.delete(o)}if(r(),fe(ie.current,s))return;ie.current=s,pe(s)};u();let l=new MutationObserver((s)=>{if(s.some((o)=>[...o.addedNodes,...o.removedNodes].some((b)=>b instanceof Element&&(b.matches("[data-turn-key], [data-content-search-unit-key]")||b.querySelector("[data-turn-key], [data-content-search-unit-key]")!==null))))u()});return l.observe(n,{childList:!0,subtree:!0}),()=>{l.disconnect(),a.disconnect()}},[z,n,c]);let Y=g.find((e)=>S.has(e.id))?.id??g.at(-1)?.id;ye(()=>{let e=K.current;if(e===null||M.current!==null||Y===void 0)return;let t=e.querySelector(`[data-timeline-user-message-navigation-item-id="${CSS.escape(Y)}"]`);if(t===null)return;let i=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(r.top<i.top)e.scrollTop+=r.top-i.top;else if(r.bottom>i.bottom)e.scrollTop+=r.bottom-i.bottom+1},[Y,z]),P(()=>{let e=n?.querySelector("[data-timeline-user-message-navigation-content]");if(!n||!e)return;let t=()=>{let r=n.getBoundingClientRect(),a=e.getBoundingClientRect();if(r.width===0||a.width===0)return;let u=n.offsetWidth>0?r.width/n.offsetWidth:1;be((a.left-r.left)/u>=48)},i=new ResizeObserver(t);return i.observe(n),i.observe(e),t(),()=>i.disconnect()},[n]);let he=xe(async(e,t="smooth")=>{if(n===null)throw Error("Thread user-message navigation scroll root is missing");let i=L.current+1;L.current=i,x();let r=()=>n.querySelector(`[data-content-search-unit-key="${CSS.escape(e.id)}"]`),a=r(),u=a!==null&&n.clientHeight>0&&a.closest("[data-turn-key]")!==null&&Math.abs(a.getBoundingClientRect().top-n.getBoundingClientRect().top)>n.clientHeight*2;if((a===null||u)&&v!==void 0){if(t==="instant"&&e.isLoaded===!1)return;a=await v(e,()=>L.current===i)??r(),t="instant"}if(L.current!==i)return;if(a===null)return;let l=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;a.scrollIntoView({behavior:l?"instant":t,block:"start"});let s=a.querySelector("[data-user-message-bubble], [data-composer-attachment-pill]");if(G.current?.cancel(),G.current=null,s===null)return;let d=getComputedStyle(s).backgroundColor,o=`color-mix(in srgb, var(--foreground) 14%, ${d})`;G.current=s.animate?.([{backgroundColor:o},{backgroundColor:o,offset:0.35},{backgroundColor:d}],{duration:l?0:1000,easing:"cubic-bezier(0.23, 1, 0.32, 1)"})??null},[x,v,n]);if(g.length<Se||!ve)return null;let Q=()=>{if(k.current!==null)clearTimeout(k.current);k.current=null},ue=(e,t=!1)=>{if(Q(),C===void 0||e.isLoaded!==!1||V.current.has(e.turnKey))return;let i=()=>{k.current=null,V.current.add(e.turnKey),C(e).catch(()=>V.current.delete(e.turnKey))};if(t)i();else k.current=setTimeout(i,150)},q=m===null?null:g.find((e)=>e.id===m.item.id)??g.find((e)=>e.nativeTurnId!==void 0&&e.nativeTurnId===m.item.nativeTurnId)??m.item,le=(e,t="smooth")=>{he(e,t).catch((i)=>{if(B)B(i);else throw i})},de=g.findIndex((e)=>e.id===(_??Ie)),ce=K.current,Te=m===null||!ce?.contains(m.button)?0:Me(ce,m.button),me=(e)=>{let t=e?.closest("[data-timeline-user-message-navigation-item-id]"),i=K.current;if(t===void 0||t===null||!i.contains(t))return null;let r=t.dataset.timelineUserMessageNavigationItemId,a=g.findIndex((u)=>u.id===r);return{button:t,item:g[a],index:a}},W=(e)=>{let t=M.current;if(t?.pointerId!==e.pointerId)return;if(M.current=null,O(null),t.captureTarget.hasPointerCapture(e.pointerId))t.captureTarget.releasePointerCapture(e.pointerId)};return T("nav",{"aria-label":"User messages",className:"timeline-user-message-navigation absolute start-4 top-1/2 z-20 -translate-y-1/2",children:T(Qo,{open:Z,onOpenChange:R,side:"inline-end",sideOffset:0,align:"center",alignOffset:Te,trigger:T("div",{ref:K,"data-timeline-user-message-navigation-rail-list":!0,"data-scrubbing":_===null?void 0:"",className:"timeline-user-message-navigation-rail-list",onPointerEnter:()=>{H.current=null},onPointerDown:(e)=>{if(e.button!==0)return;Q();let t=me(e.target instanceof Element?e.target:null);if(t===null)return;U.current=!1,M.current={pointerId:e.pointerId,itemId:t.item.id,itemIndex:t.index,captureTarget:t.button},t.button.setPointerCapture(e.pointerId),O(t.item.id),y(t),R(!0)},onPointerMove:(e)=>{let t=M.current;if(t===null){let l=me(e.target instanceof Element?e.target:null);if(l!==null){F(l.item.id);let s=H.current;if(s!==null&&s!==l.index)ne(s,l.index,ae);H.current=l.index,y((d)=>d?.item.id===l.item.id?d:l),ue(l.item)}return}if(t.pointerId!==e.pointerId)return;if((e.buttons&1)===0){W(e);return}let i=e.currentTarget.getBoundingClientRect(),r=Math.max(0,Math.min(g.length-1,Math.floor((e.clientY-i.top+e.currentTarget.scrollTop)/ge))),u={button:e.currentTarget.querySelectorAll("[data-timeline-user-message-navigation-item-id]")[r],item:g[r],index:r};if(u.item.id===t.itemId)return;ne(t.itemIndex,u.index,ae),H.current=u.index,M.current={...t,itemId:u.item.id,itemIndex:u.index},U.current=!0,O(u.item.id),y(u),le(u.item,"instant")},onPointerUp:W,onPointerCancel:W,onLostPointerCapture:W,onPointerLeave:()=>{if(Q(),F(null),H.current=null,M.current===null&&!Z)y(null)},children:T("div",{className:"flex flex-col",children:D.current.groups.map((e)=>T("div",{className:"flex w-9 shrink-0 flex-col [content-visibility:auto]",style:{height:e.itemIds.length*ge},children:g.slice(e.startIndex,e.startIndex+e.itemIds.length).map((t,i)=>{let r=e.startIndex+i,a=Math.abs(r-de),u=de===-1||a>3?void 0:[1,0.7,0.4,0.2][a];return T("button",{type:"button","data-timeline-user-message-navigation-item-id":t.id,"data-scrub-target":_===t.id?"":void 0,"aria-current":S.has(t.id)?"true":void 0,"aria-label":`Jump to user message ${r+1}`,className:"timeline-user-message-navigation-row",onClick:(l)=>{if(U.current){U.current=!1;return}let s={button:l.currentTarget,item:t,index:r};y(s),R(!0),le(t)},onFocus:(l)=>{ue(t,!0),y({button:l.currentTarget,item:t,index:r}),R(!0)},children:T("span",{className:"flex h-0.5 w-[30px] items-center",children:T("span",{className:"timeline-user-message-navigation-marker",style:u===void 0?void 0:{"--marker-progress":u}})})},t.id)})},e.key))})}),children:q!==null&&T("div",{className:"bg-popover/95 text-popover-foreground ring-border w-80 max-w-[calc(100vw-1rem)] overflow-hidden rounded-xl p-2 text-sm leading-5 shadow-xl ring-[0.5px] backdrop-blur-sm",children:A?A(q):Ne(ke,{children:[T("div",{className:"min-w-0 truncate font-medium",children:q.label}),q.response.length>0&&T("div",{className:"text-muted-foreground mt-1 line-clamp-3",children:q.response})]})})})})}function Me(h,x){let v=h.getBoundingClientRect(),p=x.getBoundingClientRect();return p.top+p.height/2-(v.top+v.height/2)}
|
|
2
|
+
export{Ko};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{vn}from"./chunk-hf65xscb.js";import{n,b}from"./chunk-76tkqx9n.js";import{I,y}from"./chunk-9c41y5hw.js";import{createLucideIcon as k,HandIcon as w,ShieldAlertIcon as S,ShieldCheckIcon as c}from"lucide-react";import{jsx as t}from"react/jsx-runtime";var O=k("ApprovalShield",[["path",{d:"M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11",key:"shield"}],["path",{d:"m8 8 3 3-3 3M13 15h3",key:"terminal"}]]),d={"read-only":w,"workspace-write":c,agent:O,"agent-full-access":S},A={"read-only":"readOnly","workspace-write":"workspaceAccess",agent:"agent","agent-full-access":"fullAccess"};function je({sessionId:u,options:g,disabled:m,onConfigChange:r}){let{host:l,client:f}=n(),{t:a}=l,o=y(g,"mode");if(!o)return null;let s=o.currentValue,p=I(o).map((e)=>{let i=A[e.value];return i?{...e,name:a(`permissionModes.${i}.name`),description:a(`permissionModes.${i}.description`)}:e}),h=p.find((e)=>e.value===s),M=d[s]??c,v=(e)=>{if(e===s)return;b(l,r?r(o.configId,e):f.setConfig(u,o.configId,e))};return t(vn,{value:s,warning:s==="agent-full-access",currentName:h?.name??s,icon:t(M,{className:"size-3.5 shrink-0"}),header:a("permissionModes.heading"),disabled:m,label:a("composer.switchPermissionMode"),onValueChange:v,options:p.map((e)=>{let i=d[e.value]??c,C=e.value==="agent-full-access";return{value:e.value,label:t("span",{"data-permission-warning":C?"":void 0,children:e.name}),description:e.description?t("span",{className:"whitespace-normal",children:e.description}):void 0,icon:t(i,{className:"size-3.5 shrink-0"})}})})}
|
|
2
|
+
export{je};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{PreviewCard as e}from"@base-ui/react/preview-card";import{jsx as o,jsxs as d}from"react/jsx-runtime";function
|
|
2
|
-
export{
|
|
1
|
+
import{PreviewCard as e}from"@base-ui/react/preview-card";import{jsx as o,jsxs as d}from"react/jsx-runtime";function Qo({open:r,onOpenChange:a,trigger:i,children:t,...n}){return d(e.Root,{open:r,onOpenChange:a,children:[o(e.Trigger,{render:i,delay:700,closeDelay:100}),o(e.Portal,{children:o(e.Positioner,{...n,className:"isolate z-50",children:o(e.Popup,{"data-slot":"codex-hover-card",className:"m-0 outline-hidden",children:t})})})]})}
|
|
2
|
+
export{Qo};
|
|
@@ -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 ue({className:r,...a}){return e(i.Root,{"data-slot":"checkbox",className:o("peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border shadow-xs transition-shadow outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:e(i.Indicator,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e(t,{})})})}export{ue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e}from"./chunk-cg97byvk.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as g}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function d({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function
|
|
1
|
+
import{e}from"./chunk-cg97byvk.js";import{Dialog as i}from"@base-ui/react/dialog";import{cn as r}from"cn";import{XIcon as g}from"lucide-react";import{jsx as a,jsxs as l}from"react/jsx-runtime";function d({...o}){return a(i.Root,{"data-slot":"dialog",...o})}function gi({...o}){return a(i.Trigger,{"data-slot":"dialog-trigger",...o})}function Ar({...o}){return a(i.Portal,{"data-slot":"dialog-portal",...o})}function lo({...o}){return a(i.Close,{"data-slot":"dialog-close",...o})}function Lr({className:o,...t}){return a(i.Backdrop,{"data-slot":"dialog-overlay",className:r("data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0 fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs",o),...t})}function u({className:o,children:t,showCloseButton:n=!0,...s}){return l(Ar,{children:[a(Lr,{}),l(i.Popup,{"data-slot":"dialog-content",className:r("bg-popover text-popover-foreground ring-foreground/10 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl p-6 text-sm ring-1 duration-100 outline-none sm:max-w-md",o),...s,children:[t,n&&l(i.Close,{"data-slot":"dialog-close",render:a(e,{variant:"ghost",className:"absolute top-4 right-4",size:"icon-sm"}),children:[a(g,{}),a("span",{className:"sr-only",children:"Close"})]})]})]})}function w({className:o,...t}){return a("div",{"data-slot":"dialog-header",className:r("flex flex-col gap-2",o),...t})}function z({className:o,showCloseButton:t=!1,children:n,...s}){return l("div",{"data-slot":"dialog-footer",className:r("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",o),...s,children:[n,t&&a(i.Close,{render:a(e,{variant:"outline"}),children:"Close"})]})}function m({className:o,...t}){return a(i.Title,{"data-slot":"dialog-title",className:r("font-heading leading-none font-medium",o),...t})}function k({className:o,...t}){return a(i.Description,{"data-slot":"dialog-description",className:r("text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",o),...t})}export{d,gi,Ar,lo,Lr,u,w,z,m,k};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function mn(t,e){if(e===0)return null;let r=e-1;while(r>=0){let n=t[r];if(n===" "||n==="\t"||n===`
|
|
2
2
|
`)return null;if(n==="@"||n==="/"){let i=r===0?"":t[r-1],s=r===0||i===`
|
|
3
3
|
`;if(n==="/"?s&&!/[/\\]/.test(t.slice(r+1,e)):s||i===" "||i==="\t")return{kind:n==="/"?"slash":"at",start:r,end:e,query:t.slice(r+1,e)}}r-=1}return null}
|
|
4
|
-
export{
|
|
4
|
+
export{mn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-cg97byvk.js";import{
|
|
2
|
-
export{
|
|
1
|
+
import{e}from"./chunk-cg97byvk.js";import{no}from"./chunk-0k654tyt.js";import{Re,Me,Ee}from"./chunk-sqh158m4.js";import{x}from"./chunk-tpx841s3.js";import{cn as f}from"cn";import{PaperclipIcon as k,XIcon as T}from"lucide-react";import{Fragment as M,useEffect as L,useRef as z,useState as N}from"react";import{jsx as t,jsxs as o,Fragment as R}from"react/jsx-runtime";function E(n){return t(Ee,{align:"start",...n})}function fn({data:n,t:r,className:u,...c}){let p=x(),[d,h]=N(!1),[I,v]=N(1),C=z(null),s=n.filename||"",i=(n.mediaType?.startsWith("image/")&&n.url?"image":"file")==="image",A=s||(i?r("input.image"):r("input.attachment"));return L(()=>{if(!d)return;let l=0.1,g=(a)=>Math.min(10,Math.max(0.1,a)),y=(a)=>{if(!(a.ctrlKey||a.metaKey))return;let m=a.key,w=m==="+"||m==="=",H=m==="-"||m==="_",b=m==="0";if(!w&&!H&&!b)return;a.preventDefault(),v((P)=>{if(b)return 1;if(w)return g(P+l);return g(P-l)})};return window.addEventListener("keydown",y,{passive:!1}),()=>window.removeEventListener("keydown",y)},[d]),o(R,{children:[o(Re,{children:[t(Me,{render:o("div",{className:f("group border-border hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent relative flex h-8 cursor-pointer items-center gap-1.5 rounded-md border px-1.5 text-sm font-medium transition-all select-none",u),...c,children:[o("div",{className:"relative size-5 shrink-0",children:[i?t(e,{type:"button",variant:"ghost",size:"icon-xs","aria-label":r("input.image"),className:"bg-background absolute inset-0 size-5 overflow-hidden rounded p-0 transition-opacity group-hover:opacity-0",onClick:()=>{v(1),h(!0)},children:t("img",{alt:s||"attachment",className:"size-5 object-cover",height:20,src:n.url,width:20})}):t("div",{className:"bg-background text-muted-foreground absolute inset-0 flex size-5 items-center justify-center overflow-hidden rounded transition-opacity group-hover:opacity-0",children:t(k,{className:"size-3"})}),o(e,{"aria-label":r("input.removeAttachment"),className:f("absolute -top-1 -right-1 size-4 rounded-full p-0 opacity-0 transition-opacity [&>svg]:size-3","pointer-events-none group-hover:pointer-events-auto group-hover:opacity-100"),onClick:(l)=>{l.stopPropagation(),p.remove(n.id)},type:"button",variant:"ghost",children:[t(T,{}),t("span",{className:"sr-only",children:r("input.removeAttachment")})]})]}),!i&&t("span",{className:"max-w-40 flex-1 truncate text-xs",children:A})]})}),t(E,{className:"w-auto p-2",children:o("div",{className:"w-auto space-y-3",children:[i&&t("div",{className:"flex max-h-96 w-96 items-center justify-center overflow-hidden rounded-md border",children:t("img",{alt:s||"attachment preview",className:"max-h-full max-w-full object-contain",height:384,src:n.url,width:448})}),t("div",{className:"flex items-center gap-2.5",children:o("div",{className:"min-w-0 flex-1 space-y-1 px-0.5",children:[t("h4",{className:"truncate text-sm leading-none font-semibold",children:s||(i?"Image":"Attachment")}),n.mediaType&&t("p",{className:"text-muted-foreground truncate font-mono text-xs",children:n.mediaType})]})})]})})]}),i&&n.url&&t(no,{containerRef:C,filename:s||r("input.image"),onOpenChange:h,onScaleChange:v,open:d,scale:I,url:n.url})]})}function hn({children:n,className:r,...u}){let c=x();if(!c.files.length)return null;return t("div",{className:f("flex w-full flex-wrap items-center gap-1",r),...u,children:c.files.map((p)=>t(M,{children:n(p)},p.id))})}
|
|
2
|
+
export{fn,hn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cn as a}from"cn";import{useRef as u,useState as E}from"react";import{jsx as l}from"react/jsx-runtime";var
|
|
2
|
-
export{
|
|
1
|
+
import{cn as a}from"cn";import{useRef as u,useState as E}from"react";import{jsx as l}from"react/jsx-runtime";var d=45,w=8;function M({className:i,children:p,onMouseEnter:c,onMouseLeave:f,...m}){let s=u(null),[t,r]=E(0);return l("span",{className:a("min-w-0 overflow-hidden",i),onMouseEnter:(e)=>{let n=s.current;if(!n)return;let o=n.scrollWidth-n.clientWidth;if(o>w)r(getComputedStyle(n).direction==="rtl"?o:-o);c?.(e)},onMouseLeave:(e)=>{r(0),f?.(e)},...m,children:l("span",{ref:s,className:a("block whitespace-nowrap",t===0?"truncate":"overflow-visible"),style:{transform:`translateX(${t}px)`,transition:`transform ${Math.abs(t)/d}s linear`},children:p})})}
|
|
2
|
+
export{M};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
export{
|
|
1
|
+
function Bo(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReply"in o))return null;let n=o.questionReply;if(!n||typeof n!=="object"||!("question"in n)||!("answer"in n))return null;return typeof n.question==="string"&&typeof n.answer==="string"?{question:n.question,answer:n.answer}:null}function zo(t){if(!t||typeof t!=="object"||!("codex"in t))return null;let o=t.codex;if(!o||typeof o!=="object"||!("questionReplyParts"in o))return null;let n=o.questionReplyParts;if(!Array.isArray(n)||n.length===0)return null;let i=n;if(!i.every((e)=>!!e&&typeof e==="object"&&("text"in e)&&typeof e.text==="string"&&(!("question"in e)||e.question===void 0||typeof e.question==="string")))return null;return i.map((e)=>({text:e.text,...e.question===void 0?{}:{question:e.question}}))}
|
|
2
|
+
export{Bo,zo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{v}from"./chunk-y6r6tzfh.js";import{t}from"./chunk-6d38ff76.js";import{L}from"./chunk-3x1eq95a.js";import{ContentBlock as i}from"@agentclientprotocol/sdk/experimental/v2/unstable";import{isEmbeddedResource as m,isResourceLink as u}from"@alwith/api";import{jsx as n}from"react/jsx-runtime";function d({block:e,streaming:o}){let r=t();if(i.isText(e)){if(e.text.length===0)return null;return n("div",{className:"codex-assistant-message",children:n(v,{text:e.text,streaming:o})})}if(i.isImage(e))return n(L,{block:e,generated:!0});if(i.isAudio(e))return n("audio",{controls:!0,src:`data:${e.mimeType};base64,${e.data}`});if(u(e)||m(e))return n(L,{block:e,generated:!0});return n("div",{className:"text-muted-foreground",children:r.t("timeline.unsupportedContent",{type:e.type})})}function Z({content:e,messageId:o,streaming:r}){return e.map((s,a)=>n(d,{block:s,streaming:r},`${o}:${a}`))}
|
|
2
|
+
export{Z};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-cg97byvk.js";import{t,
|
|
2
|
-
export{
|
|
1
|
+
import{e}from"./chunk-cg97byvk.js";import{t,qe}from"./chunk-6d38ff76.js";import{isEmbeddedResource as B,isImage as h,isResourceLink as E}from"@alwith/api";import{DownloadIcon as T,FileIcon as N,ImageOffIcon as F,LoaderCircleIcon as U}from"lucide-react";import{useState as y}from"react";import{jsx as i,jsxs as r}from"react/jsx-runtime";function wr(a){let o=a.split(/[\\/]/).at(-1)??a;if(a.startsWith("file:")||/^https?:/.test(a))o=new URL(a).pathname.split("/").at(-1)??"";try{return decodeURIComponent(o)||"attachment"}catch(n){if(n instanceof URIError)return o||"attachment";throw n}}function b(a,o){let n=document.createElement("a");n.href=o,n.download=a,n.click()}function L({block:a,generated:o=!1}){let n=t(),[p,d]=y(!1),[I,C]=y(null);if(E(a)){if(a.uri==="codex-image:unavailable")return r("span",{className:"text-muted-foreground flex items-center gap-2 rounded-lg border p-3 text-sm",children:[i(F,{className:"size-4"}),n.t("timeline.imageUnavailable")]});let u=wr(a.uri);return r(e,{variant:"outline",className:"h-auto max-w-full min-w-0 justify-start gap-3 overflow-hidden p-3","aria-label":a.title??a.name,title:a.uri,onClick:()=>n.openLink(a.uri),children:[i(N,{}),r("span",{className:"min-w-0 flex-1 text-start",children:[i("span",{className:"block truncate",children:a.title??a.name}),r("span",{className:"text-muted-foreground block truncate text-xs",children:[(a.title??a.name)!==u&&`${u} · `,a.mimeType??u.split(".").at(-1)?.toUpperCase()]})]})]})}if(!B(a)&&!h(a))return null;let s=h(a)?{uri:a.uri??`image.${a.mimeType.split("/")[1]??"png"}`,mimeType:a.mimeType,blob:a.data}:a.resource,l=wr(s.uri);if("text"in s)return r("div",{className:"min-w-0",children:[i("pre",{className:"overflow-x-auto whitespace-pre-wrap",children:s.text}),r(e,{variant:"link",size:"sm",className:"max-w-full min-w-0",title:s.uri,onClick:()=>n.openLink(s.uri),children:[i(N,{}),i("span",{className:"truncate",children:l})]})]});let m=`data:${s.mimeType??"application/octet-stream"};base64,${s.blob}`,f=s.mimeType?.toLowerCase().startsWith("image/")&&I!==m,{openImage:g,openImageGallery:w}=n,x=w?()=>w([{src:m,alt:l,uri:s.uri}],0):g&&(()=>g(m)),c=o&&f,R=async()=>{d(!0);try{if(n.saveFile)await n.saveFile(l,s.blob);else b(l,m)}catch(u){qe(n,u)}finally{d(!1)}},v=i("img",{src:m,alt:"",className:o?"max-h-[40rem] max-w-full object-contain":"max-h-96 max-w-full rounded object-contain",onError:()=>C(m)});return r("div",{className:c?"codex-generated-image":"flex max-w-full min-w-0 flex-col items-start gap-1",children:[f&&(x===void 0?v:i(e,{variant:"ghost",className:o?"codex-generated-image-preview h-auto max-w-full p-0":"h-auto max-w-full p-0","aria-label":n.t("timeline.viewImage"),onClick:x,children:v})),r(e,{variant:c?"secondary":"link",size:c?"icon":"sm",className:c?"codex-generated-image-download":"max-w-full min-w-0",disabled:p,title:n.t("timeline.download",{name:l}),"aria-label":n.t("timeline.download",{name:l}),onClick:()=>{R()},children:[p?i(U,{className:"motion-safe:animate-spin"}):i(T,{}),!c&&i("span",{className:"truncate",children:l})]})]})}
|
|
2
|
+
export{wr,L};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{o}from"./chunk-
|
|
1
|
+
import{o}from"./chunk-6d38ff76.js";import{O,$t,F}from"./chunk-a2ftkzak.js";import{e}from"./chunk-cg97byvk.js";import{oe,re,ie,ae}from"./chunk-qgfq5vrz.js";import{lt,n,b}from"./chunk-76tkqx9n.js";import{Ge}from"./chunk-65ajc856.js";import{Ve}from"./chunk-6ym3w4kf.js";import{rt,it}from"./chunk-69yx37pv.js";import{at}from"./chunk-88vkk9s3.js";import{LockIcon as D,UnplugIcon as g}from"lucide-react";import{useMemo as A}from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";function cr({host:t,client:l,...s}){let c=A(()=>t.openDiff?t:{...t,openDiff:rt},[t]);return i(lt,{host:c,client:l,children:[r(R,{...s}),!t.openDiff&&r(it,{})]})}function R({session:t,header:l,overlay:s,timeline:c,composer:y,readOnlyActions:x,welcome:u,children:C,rootRef:N}){let{host:d,client:w}=n(),{t:a}=d,p=o((m)=>m.connection==="ready"),f=o((m)=>m.historyPages[t.id]?.error),v=()=>b(d,w.open(t.id,t.cwd)),h=t.items.length===0&&t.attached&&!t.restoring&&t.state==="idle";return i("div",{"data-chat-drop-zone":!0,ref:N,className:"flex h-full min-h-0 flex-col",children:[l,i("div",{className:"relative flex min-h-0 flex-1 flex-col","data-chat-content":!0,children:[s,p&&!t.attached&&!t.restoring&&!t.readOnly&&r("div",{className:"mx-auto my-3 w-full max-w-4xl px-4",children:i(O,{children:[r(g,{}),r($t,{children:a("conversation.stopped")}),r(F,{children:r(e,{size:"sm",variant:"outline",onClick:v,children:a("conversation.reconnect")})})]})}),h?u??r(oe,{className:"flex-1",children:i(re,{children:[r(ie,{className:"text-[28px] font-normal",children:a("conversation.welcomeTitle")}),r(ae,{children:a("conversation.welcomeDescription")})]})}):r(Ve,{session:t,timeline:c}),r(at,{sessionId:t.id}),t.readOnly?r("div",{className:"mx-auto w-full max-w-3xl shrink-0 px-6 pb-5","data-readonly-composer":!0,children:i(O,{className:"flex items-center justify-between gap-4 rounded-3xl px-5 py-4",children:[i("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[r(D,{"aria-hidden":"true",className:"size-4 shrink-0"}),i("div",{className:"min-w-0 space-y-1",children:[r($t,{children:a("conversation.readOnlyTitle")}),r(F,{children:a("conversation.readOnlyDescription")}),f&&r("p",{role:"alert",className:"text-destructive break-words",children:f})]})]}),i("div",{className:"border-border flex shrink-0 items-center gap-1 border-s ps-3","data-readonly-actions":!0,children:[r(e,{size:"sm",variant:"outline",className:"text-foreground cursor-pointer disabled:cursor-not-allowed",onClick:v,disabled:!p||t.restoring,children:a(t.restoring?"conversation.restoring":"conversation.readOnlyRetry")}),x]})]})}):y??r(Ge,{session:t})]}),C]})}
|
|
2
2
|
export{cr};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var a=(e)=>String(e).padStart(2,"0");function
|
|
2
|
-
export{
|
|
1
|
+
var a=(e)=>String(e).padStart(2,"0");function Ue(e,l="user"){let r=e.replayed||e.items.some((t)=>t._meta?.codex&&typeof t._meta.codex==="object"&&("historyReplay"in t._meta.codex)&&t._meta.codex.historyReplay===!0),n=l==="user"?s(e.user?._meta,"messageSentAt")??(!r?e.user?.at??null:null):s(e.final.at(-1)?._meta,"messageCompletedAt")??e.items.map((t)=>s(t._meta,"turnCompletedAt")).find((t)=>t!==null)??(!r&&e.final.length>0?e.endedAt:null);if(n===null)return null;let o=new Date(n),u=o.toDateString()===new Date().toDateString();return{short:new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",...u?{}:{month:"short",day:"numeric"}}).format(o),full:`${o.getFullYear()}-${a(o.getMonth()+1)}-${a(o.getDate())} ${a(o.getHours())}:${a(o.getMinutes())}`}}function s(e,l){let r=e?.codex;if(typeof r!=="object"||r===null)return null;let n=r[l];return typeof n==="number"&&Number.isFinite(n)&&Math.abs(n)<=8640000000000000?n:null}
|
|
2
|
+
export{Ue};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-cg97byvk.js";import{me,pe,W,ge,mt,fe,Le,De,_e,Ot,P}from"./chunk-5s2wpbdt.js";import{Ne}from"./chunk-5wyxvpgt.js";import{se,le,ce}from"./chunk-z75zbdq8.js";import{Pt}from"./chunk-rdtj6bad.js";import{p}from"./chunk-cywx4qmv.js";import{cn as m}from"cn";import{ArrowUpRight as E,ChevronUp as L,Loader2Icon as j,Zap as B}from"lucide-react";import{Fragment as ee,useState as G}from"react";import{jsx as n,jsxs as s,Fragment as c}from"react/jsx-runtime";function kn({value:h,onChange:F,models:v,modelGroups:f,compactCatalog:l,effortPresentation:V="slider",unavailableEffort:N,providerMenu:w,header:g,className:z,condensed:S,stripLabelPrefix:C,showDescription:U,showModelList:Z=!0,loading:q,switching:_,isLoading:H,effortConfig:i,booleanOptions:y,onBooleanChange:T,selectOptions:J=[],t:u,...r}){let[K,Q]=G(!1),[X,Y]=G(!1),d=y?.find((a)=>a.id==="fast_mode"),O=l?y?.filter((a)=>a!==d):y,R=(a)=>C&&a.startsWith(C)?a.slice(C.length):a;if(q)return n("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:s(e,{variant:"ghost",disabled:!0,className:m("h-7 min-w-0 shrink gap-1.5 rounded-md px-2 text-xs font-normal",z),children:[n(j,{className:"size-3 animate-spin"}),n("span",{className:"text-muted-foreground truncate",children:u("model.loadingModels")})]})});return s("div",{className:"inline-flex min-w-0 items-center gap-1.5",children:[w&&s(me,{open:K,onOpenChange:Q,children:[s(se,{children:[n(le,{render:n(pe,{render:s(e,{"data-testid":"provider-trigger",variant:"ghost",disabled:r.disabled,className:m("h-7 shrink-0 gap-1 rounded-md px-1.5","hover:bg-accent"),children:[w.icon,n(L,{className:"size-2.5 shrink-0 opacity-60"})]})})}),n(ce,{children:u("model.switchProvider")})]}),s(W,{side:"top",align:"end",sideOffset:4,className:"z-100 min-w-[10rem]",children:[w.groups.map((a,t)=>s(ee,{children:[t>0&&a.length>0&&n(P,{}),n(p,{value:w.value,onValueChange:w.onChange,options:a})]},t)),w.moreAction&&s(c,{children:[n(P,{}),s(fe,{onClick:w.moreAction,className:"whitespace-nowrap",children:[n("span",{className:"min-w-0 flex-1 truncate",children:u("model.moreModels")}),n(E,{className:"size-4"})]})]})]})]}),s(me,{open:X,onOpenChange:Y,children:[s(se,{children:[n(le,{render:n(pe,{render:s(e,{"data-testid":"model-trigger","aria-busy":_,variant:"ghost",className:m("h-7 gap-1.5 rounded-md px-2 text-xs font-normal","hover:bg-accent","max-w-full min-w-0 shrink",S&&"h-7 gap-1 px-1.5 text-[11px]",z),...r,children:[h.icon,y?.some((a)=>a.id==="fast_mode"&&a.currentValue&&!a.disabled)&&n(B,{"aria-hidden":"true",className:"size-3 shrink-0 fill-current"}),n("span",{className:m("min-w-0 flex-1 truncate text-start",S&&"text-[11px]"),children:R(h.label)||u("model.selectModel")}),i&&s("span",{className:"text-muted-foreground grid shrink-0 justify-items-center",children:[n("span",{className:"invisible col-start-1 row-start-1",children:i.sizer??i.levels.reduce((a,t)=>t.name.length>a.length?t.name:a,"")}),n("span",{className:"col-start-1 row-start-1",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),_?n(j,{"data-testid":"model-switch-loading",className:"size-3 shrink-0 animate-spin"}):n(L,{className:m("size-3 shrink-0",S&&"size-2.5")})]})})}),n(ce,{children:u("model.switchModel")})]}),s(W,{side:"top",align:"end",sideOffset:4,className:m("z-100 w-auto max-w-[min(24rem,calc(100vw-1rem))] min-w-[14rem]",l&&"flex h-[350px] w-80 min-w-0 flex-col overflow-hidden rounded-xl p-1.5"),children:[l&&s(c,{children:[s(ge,{"data-model-menu-header":!0,className:"flex shrink-0 items-center justify-between gap-2 px-1 py-1",children:[i?V==="slider"?n("div",{role:"menuitem","aria-label":i.name,className:"min-w-0 [&>div]:justify-start [&>div]:gap-3 [&>div]:px-2 [&>div]:py-1.5",children:n(Pt,{...i,disabled:r.disabled})}):s(Le,{children:[s(De,{disabled:r.disabled,className:"h-8 min-w-0 flex-1 gap-2 rounded-md",children:[n("span",{children:i.name}),n("span",{className:"text-muted-foreground min-w-0 truncate text-xs",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),n(_e,{children:n(p,{value:i.value,onValueChange:i.onChange,options:i.levels.map((a)=>({value:a.value,label:a.name}))})})]}):N?s(fe,{disabled:!0,className:"h-8 min-w-0 flex-1 gap-2",children:[n("span",{children:N.name}),n("span",{className:"text-muted-foreground truncate text-xs",children:N.label})]}):n(mt,{className:"min-w-0 flex-1 truncate",children:g?.name}),d&&n(Ot,{"aria-label":d.name,title:d.title??d.name,disabled:r.disabled||d.disabled,checked:d.currentValue,closeOnClick:!1,onCheckedChange:(a)=>T?.(d.id,a),className:m("hover:bg-accent focus:hover:bg-accent focus-visible:bg-accent ml-auto size-8 shrink-0 justify-center rounded-md p-0 focus:bg-transparent [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",d.currentValue&&!d.disabled?"text-foreground [&_svg]:fill-current":"text-muted-foreground"),children:d.icon??n(B,{className:"size-4","aria-hidden":"true"})})]}),n(P,{className:"shrink-0"})]}),g&&!l&&s(c,{children:[s("div",{className:"flex items-center gap-2 px-2 py-2",children:[g.icon,n("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:g.name}),g.action]}),n(P,{})]}),s(ge,{"data-model-menu-list":l?"":void 0,className:l?"min-h-0 min-w-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain":void 0,children:[Z&&(H?n(fe,{disabled:!0,className:"text-muted-foreground",children:u("model.loadingModels")}):v.length===0?n(fe,{disabled:!0,className:"text-muted-foreground",children:u("model.noModelsAvailable")}):(()=>{let a=v.filter((o)=>!o.more),t=v.filter((o)=>o.more),I=a.length>0&&t.length>0,M=(o,b)=>({disabled:r.disabled,icon:o.icon,value:o.api_id,label:R(o.label),description:b?.noDescription?void 0:U?o.description:void 0}),D=(o)=>{let b=v.find((k)=>k.api_id===o);if(b)F(b)};if(l)return n(p,{value:h.api_id,onValueChange:D,itemClassName:"min-w-0 max-w-full font-normal whitespace-nowrap",options:v.map((o)=>M(o))});return s(c,{children:[f?f.map((o)=>{let b=o.models.filter((x)=>!x.more),k=o.models.filter((x)=>x.more),A=b.length>0&&k.length>0;return s(ge,{children:[n(mt,{className:"text-muted-foreground text-xs font-normal",children:o.name}),n(p,{value:h.api_id,onValueChange:D,itemClassName:"font-medium whitespace-nowrap",options:(A?b:o.models).map((x)=>M(x))}),A&&s(Le,{children:[n(De,{className:"font-medium whitespace-nowrap",children:u("model.moreModels")}),n(_e,{children:n(p,{value:h.api_id,onValueChange:D,itemClassName:"font-medium whitespace-nowrap",options:k.map((x)=>M(x,{noDescription:!0}))})})]})]},o.id)}):n(p,{value:h.api_id,onValueChange:D,itemClassName:"font-medium whitespace-nowrap",options:(I?a:v).map((o)=>M(o))}),!f&&I&&s(Le,{children:[n(De,{className:"font-medium whitespace-nowrap",children:u("model.moreModels")}),n(_e,{children:n(p,{value:h.api_id,onValueChange:D,itemClassName:"font-medium whitespace-nowrap",options:t.map((o)=>M(o,{noDescription:!0}))})})]})]})})()),!l&&i&&s(c,{children:[n(P,{}),V==="menu"?s(Le,{children:[s(De,{disabled:r.disabled,children:[n("span",{className:"flex-1",children:i.name}),n("span",{className:"text-muted-foreground",children:i.levels.find((a)=>a.value===i.value)?.name??i.value})]}),n(_e,{children:n(p,{value:i.value,onValueChange:i.onChange,options:i.levels.map((a)=>({value:a.value,label:a.name}))})})]}):n(Pt,{...i,disabled:r.disabled})]}),!l&&!i&&N&&s(c,{children:[n(P,{}),s(fe,{disabled:!0,children:[n("span",{className:"flex-1",children:N.name}),n("span",{children:N.label})]})]}),J.map((a)=>s(ge,{children:[n(P,{}),n(mt,{children:a.name}),n(p,{value:a.value,onValueChange:a.onChange,options:a.options,itemClassName:"whitespace-nowrap"})]},a.id)),O&&O.length>0&&s(c,{children:[!i&&n(P,{}),O.map((a)=>l?s(Ot,{"aria-label":a.name,title:a.title,disabled:r.disabled||a.disabled,checked:a.currentValue,closeOnClick:!1,onCheckedChange:(t)=>T?.(a.id,t),className:"justify-between gap-3 py-2.5 pr-2 [&_[data-slot=dropdown-menu-checkbox-item-indicator]]:hidden",children:[s("span",{className:"flex items-center gap-2",children:[a.icon,a.name]}),n("span",{"aria-hidden":"true",className:m("flex h-[18px] w-8 shrink-0 items-center rounded-full p-0.5",a.currentValue?"bg-primary":"bg-input"),children:n("span",{className:m("bg-background size-3.5 rounded-full shadow-xs transition-transform",a.currentValue&&"translate-x-3.5")})})]},a.id):s("div",{title:a.title,className:m("flex items-center justify-between gap-3 px-2 py-2.5",a.disabled&&"opacity-50"),children:[s("span",{className:"flex items-center gap-2 text-sm font-medium",children:[a.icon,a.name]}),n(Ne,{"aria-label":a.name,disabled:r.disabled||a.disabled,checked:a.currentValue,onCheckedChange:(t)=>T?.(a.id,t)})]},a.id))]})]}),l&&g?.action&&s(c,{children:[n(P,{className:"shrink-0"}),n(ge,{"data-model-menu-footer":!0,className:"shrink-0",children:g.action})]})]})]})]})}
|
|
2
|
+
export{kn};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Menu as n}from"@base-ui/react/menu";import{cn as i}from"cn";import{CheckIcon as c,ChevronRightIcon as p}from"lucide-react";import{jsx as t,jsxs as u}from"react/jsx-runtime";function
|
|
1
|
+
import{Menu as n}from"@base-ui/react/menu";import{cn as i}from"cn";import{CheckIcon as c,ChevronRightIcon as p}from"lucide-react";import{jsx as t,jsxs as u}from"react/jsx-runtime";function me({...e}){return t(n.Root,{"data-slot":"dropdown-menu",...e})}function li({...e}){return t(n.Portal,{"data-slot":"dropdown-menu-portal",...e})}function pe({...e}){return t(n.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function W({align:e="start",alignOffset:o=0,side:a="bottom",sideOffset:r=4,className:d,...s}){return t(n.Portal,{children:t(n.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:o,side:a,sideOffset:r,children:t(n.Popup,{"data-slot":"dropdown-menu-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 duration-100 outline-none data-closed:overflow-hidden",d),...s})})})}function ge({...e}){return t(n.Group,{"data-slot":"dropdown-menu-group",...e})}function mt({className:e,inset:o,...a}){return t(n.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":o,className:i("text-muted-foreground px-2 py-1.5 text-xs font-medium data-inset:pl-8",e),...a})}function fe({className:e,inset:o,variant:a="default",...r}){return t(n.Item,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":a,className:i("group/dropdown-menu-item focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:*:[svg]:text-destructive relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function Le({...e}){return t(n.SubmenuRoot,{"data-slot":"dropdown-menu-sub",...e})}function De({className:e,inset:o,children:a,...r}){return u(n.SubmenuTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:i("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-popup-open:bg-accent data-popup-open:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[a,t(p,{className:"ml-auto"})]})}function _e({align:e="start",alignOffset:o=-3,side:a="right",sideOffset:r=0,className:d,...s}){return t(W,{"data-slot":"dropdown-menu-sub-content",className:i("bg-popover text-popover-foreground ring-foreground/10 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 w-auto min-w-[96px] rounded-md p-1 shadow-lg ring-1 duration-100",d),align:e,alignOffset:o,side:a,sideOffset:r,...s})}function Ot({className:e,children:o,checked:a,inset:r,...d}){return u(n.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item","data-inset":r,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:a,...d,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:t(n.CheckboxItemIndicator,{children:t(c,{})})}),o]})}function Jn({...e}){return t(n.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...e})}function eo({className:e,children:o,inset:a,...r}){return u(n.RadioItem,{"data-slot":"dropdown-menu-radio-item","data-inset":a,className:i("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[t("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:t(n.RadioItemIndicator,{children:t(c,{})})}),o]})}function P({className:e,...o}){return t(n.Separator,{"data-slot":"dropdown-menu-separator",className:i("bg-border -mx-1 my-1 h-px",e),...o})}function ci({className:e,...o}){return t("span",{"data-slot":"dropdown-menu-shortcut",className:i("text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground ml-auto text-xs tracking-widest",e),...o})}export{me,li,pe,W,ge,mt,fe,Le,De,_e,Ot,Jn,eo,P,ci};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{D}from"./chunk-hrexfky6.js";import{t}from"./chunk-6d38ff76.js";import{SquareSlashIcon as s}from"lucide-react";import{useRef as l}from"react";import{jsx as r}from"react/jsx-runtime";function yn({textareaRef:a,onOpenChange:p,menuOpen:e,disabled:m}){let{t:o}=t(),n=l(!1);return r(D,{"aria-label":o("composer.commands"),title:o("composer.commands"),disabled:m,"aria-pressed":e,onPointerDown:()=>{n.current=e},onClick:()=>{p(!n.current),a.current?.getTextarea()?.focus()},children:r(s,{className:"size-4"})})}
|
|
2
|
+
export{yn};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Switch as a}from"@base-ui/react/switch";import{cn as d}from"cn";import{jsx as e}from"react/jsx-runtime";function
|
|
1
|
+
import{Switch as a}from"@base-ui/react/switch";import{cn as d}from"cn";import{jsx as e}from"react/jsx-runtime";function Ne({className:i,size:t="default",...r}){return e(a.Root,{"data-slot":"switch","data-size":t,className:d("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",i),...r,children:e(a.Thumb,{"data-slot":"switch-thumb",className:"bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"})})}export{Ne};
|
|
@@ -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 ve({className:o,...n}){return e(r,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:a("size-4 animate-spin",o),...n})}export{ve};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Mn,x}from"./chunk-tpx841s3.js";import{un}from"./chunk-v5wwv2t9.js";import{Y}from"./chunk-d2rrvka6.js";import{Tn,In,Pn,Sn,Nn,D}from"./chunk-hrexfky6.js";import{fn,hn}from"./chunk-2ysnmwx1.js";import{Ct}from"./chunk-xfjcwypy.js";import{t,o}from"./chunk-6d38ff76.js";import{n}from"./chunk-76tkqx9n.js";import{It}from"./chunk-spt7tnqx.js";import{i,An,T,et}from"./chunk-z3e38981.js";import{Qe}from"./chunk-yegh80h4.js";import{te,Ye}from"./chunk-mv8jmv1e.js";import{tt,ot}from"./chunk-7e1m1d9x.js";import{xn}from"./chunk-k2zg8xva.js";import{Xe}from"./chunk-mj5720c4.js";import{wn}from"./chunk-jwb3723b.js";import{je}from"./chunk-0rxpyf0k.js";import{Ze}from"./chunk-91trh8rj.js";import{yn}from"./chunk-5t3rrnfd.js";import{Cn}from"./chunk-kg1gk77d.js";import{Ke}from"./chunk-8bzk9e4v.js";import{hasFuzzyFileSearch as Et}from"@nyssance/codex-acp-v2/client";import{PlusIcon as St}from"lucide-react";import{useCallback as S,useEffect as Nt,useLayoutEffect as q,useMemo as J,useRef as K,useState as N}from"react";import{jsx as c,jsxs as v}from"react/jsx-runtime";var Ot=["image/png","image/jpeg","image/webp","image/gif"],Q=[];async function Ft(e){let d=await(await fetch(e.url)).blob();return new Promise((b,G)=>{let I=new FileReader;I.onerror=()=>G(I.error),I.onload=()=>{let O=I.result;b(O.slice(O.indexOf(",")+1))},I.readAsDataURL(d)})}function kt(e){let{t:d}=t(),b=x();return c(D,{"aria-label":d("composer.attachImage"),title:d("composer.attachImage"),onClick:()=>b.openFileDialog(),...e,children:c(St,{className:"size-4"})})}function Ge({session:e,onSubmit:d,onHandOff:b,modelSelector:G,modelMenu:I,inputHeader:O,actions:ft,children:ht,attachmentPolicy:gt,predictions:xt=!0,disabled:yt=!1,preparing:Z=!1,allowPendingInput:Pt=!1}){let{host:F,client:A}=n(),{t:s}=F,k=S((r)=>{if(F.reportError)F.reportError(r);else console.error(r)},[F]),[rt,B]=N(()=>({text:i.get(e.id)?.text??"",revision:0})),{text:M}=rt,[w,bt]=N(()=>i.get(e.id)?.attachments??Q),[h,L]=N(()=>i.get(e.id)?.mentions??[]),W=w.some((r)=>te(r)&&r.pastedText.status!=="ready"),[C,nt]=N(!1),[z,vt]=N(!1),[V,at]=N(!1),u=K(null),it=K(null),a=K(rt),U=S((r)=>{it.current?.(),a.current={text:r,revision:a.current.revision+1},B(a.current)},[]),ct=J(()=>({read:()=>{let p=u.current?.getTextarea(),g=p===null||p===void 0?[a.current.text.length,a.current.text.length]:[p.selectionStart,p.selectionEnd];return{target:e.id,...a.current,selection:g}},compareAndSet(p,g,y){if(p.target!==e.id||p.revision!==a.current.revision)return null;a.current={text:g,revision:a.current.revision+1},B(a.current);let l=u.current?.getTextarea();if(l!==null&&l!==void 0)l.value=g,l.setSelectionRange(y[0],y[1]);return{target:e.id,...a.current,selection:y}}}),[e.id]),_=K(null),pt=S((r)=>(_.current=r,()=>{if(_.current===r)_.current=null}),[]),mt=e.state!=="idle",f=!yt&&!Z&&e.attached&&!e.restoring&&!e.readOnly,R=!e.readOnly&&(Pt||f),E=Ze(e,f&&!C&&!z&&!W&&!V,M.length>0||w.length>0||h.length>0,xt),st=E.invalidate;q(()=>{i.set(e.id,{text:M,attachments:w,mentions:h,modelId:i.get(e.id)?.modelId??null})},[e.id,M,w,h]),q(()=>An(e.id,bt),[e.id]),q(()=>et(e.id,(r)=>{if(!R||C)throw Error("The composer cannot take text now; try again later");if(M.length||w.length||h.length)throw Error("The composer already has a draft; send or clear it first");U(r)}),[e.id,R,C,M,w,h,U]);let lt=o((r)=>Et(r.agent)),wt=J(()=>lt&&f?async(r)=>Qe((await A.fuzzyFileSearch({query:r,roots:[e.cwd]})).files):void 0,[A,lt,f,e.cwd]),X=S((r)=>{L((p)=>p.includes(r)?p:[...p,r])},[]);Nt(()=>{u.current?.focus()},[]);let dt=S(async({text:r,files:p})=>{let g=r.trim();if(g.length===0&&p.length===0&&h.length===0)return;let y=_.current;nt(!0);let l=i.get(e.id),Rt=a.current.revision,j=null;try{let P=[];for(let m of h){let H={kind:"file",absPath:m};P.push({type:"resource_link",uri:tt(H),name:ot(H)})}if(g.length>0)P.push({type:"text",text:g});for(let m of p)if(te(m)){if(m.pastedText.status!=="ready")throw Error("Text attachment is not ready");P.push({type:"resource_link",uri:m.url,name:m.filename??"pasted-text.txt"})}else P.push({type:"image",data:await Ft(m),mimeType:m.mediaType});if(a.current.revision===Rt&&i.get(e.id)===l)a.current={text:"",revision:a.current.revision+1},j=a.current.revision,B(a.current),L([]),T(e.id,()=>Q),i.set(e.id,{text:"",attachments:Q,mentions:[],modelId:l?.modelId??null}),u.current?.resetHeight();if(d)if(y===null)await d(P);else await d(P,(m)=>{if(y.signal.aborted||_.current!==y)return;y.accept(m),b?.(e.id,m)});else if(y===null)await A.prompt(e.id,P);else{let m=await A.prompt(e.id,P);y.accept(m)}st();for(let m of l?.attachments??[])if(m.url.startsWith("blob:")&&!i.get(e.id)?.attachments.some((H)=>H.id===m.id))URL.revokeObjectURL(m.url)}catch(P){if(l&&j!==null&&a.current.revision===j&&i.get(e.id)?.attachments.length===0&&i.get(e.id)?.mentions.length===0)a.current={text:l.text,revision:j+1},B(a.current),L(l.mentions),i.set(e.id,l),T(e.id,()=>l.attachments);throw P}finally{nt(!1),u.current?.focus()}},[A,e.id,h,d,b,st]),Tt=()=>{A.cancel(e.id).catch(k)},At=S((r)=>{let p=r.code==="max_total_size"?Object.assign(Error(s("composer.imageTooLargeTitle")),{description:s("composer.imageTooLargeDescription",{mb:Y})}):Object.assign(Error(s("composer.unsupportedAttachmentTitle")),{description:s("composer.unsupportedAttachmentDescription")});k(p)},[k,s]),Mt=J(()=>({session:e,ready:f,inputReady:R,sending:C,textareaRef:u,draft:ct,interruptRef:it,observeReceipts:pt,addMention:X,setAdding:vt,handsFree:d===void 0||b!==void 0}),[e,f,R,C,ct,pt,X,d,b]),ut=F.writeTextAttachment;return c(It,{value:Mt,children:c("div",{"data-chat-drop-zone":!0,className:"mx-auto w-full max-w-3xl px-6 pb-5",children:v("div",{className:"relative",children:[O&&c("div",{"data-chat-input-header":!0,className:"bg-sidebar dark:bg-foreground/3 relative top-1 z-0 mx-[13px] -mb-[18px] flex min-w-0 items-center gap-2 overflow-hidden rounded-t-2xl px-1.5 pt-1.5 pb-[27px]",children:O}),v(Mn,{attachmentPolicy:gt,value:M,revision:a.current.revision,onValueChange:U,onSubmittedClear:()=>{a.current={text:"",revision:a.current.revision+1},B(a.current)},attachments:w,onAttachmentsChange:(r)=>T(e.id,()=>r),children:[c(un,{handleRef:u,commands:e.commands,searchFiles:wt,onMention:X,onSearchError:k,forcedOpen:V,onForcedOpenChange:at,emptyLabel:s("composer.noCommands"),fileStatusLabels:{loading:s("composer.searchingFiles"),empty:s("composer.noMatchingFiles")}}),v(Tn,{globalDrop:!0,multiple:!0,accept:Ot.join(","),onError:At,onSubmit:dt,onSubmitAsync:dt,onSubmitError:k,canSubmit:()=>f&&!C&&!z&&!W?!0:"chat_not_ready",className:"relative z-10",children:[ht,v(Pn,{className:"px-3 pt-3 pb-0 empty:hidden",children:[z&&c("span",{role:"status",className:"text-muted-foreground text-xs",children:s("composer.addingFiles")}),c(xn,{mentions:h,onRemove:(r)=>L((p)=>p.filter((g)=>g!==r))}),c(hn,{children:(r)=>te(r)?c(wn,{data:r,sessionId:e.id}):c(fn,{data:r,t:s})})]}),v(In,{className:"mb-0 min-h-16 px-3 pt-4 pb-2",onKeyDownCapture:(r)=>{if(!E.text||u.current?.isComposing()||r.nativeEvent.isComposing||r.nativeEvent.keyCode===229||r.shiftKey||r.ctrlKey||r.altKey||r.metaKey||r.target!==u.current?.getTextarea())return;if(r.key==="Tab")r.preventDefault(),r.stopPropagation(),U(E.text)},children:[c(Ct,{className:"min-h-10 bg-transparent text-sm font-normal",ref:u,rows:2,bashMode:!1,disabled:!R,onPasteCapture:ut?(r)=>Ye(r,e.id,s("composer.pastedTextFilename"),ut):void 0,placeholder:E.text||(mt?s("composer.steerPlaceholder"):s("composer.placeholder")),"aria-label":s("composer.placeholder")}),E.error&&c("span",{className:"text-muted-foreground text-xs",role:"status",title:E.error,children:s("composer.predictionUnavailable")})]}),c(Sn,{className:"chat-composer-toolbar @container/input-footer mt-0 mb-2 w-full min-w-0 p-0",children:v("div",{className:"grid w-full min-w-0 grid-cols-[auto_minmax(0,1fr)] items-center gap-x-[5px] px-2",children:[v("div",{className:"flex min-w-0 items-center gap-[5px]",children:[c(kt,{className:"text-foreground",disabled:!R}),c(yn,{textareaRef:u,menuOpen:V,onOpenChange:at,disabled:!f||e.commands.length===0}),c(je,{sessionId:e.id,options:e.configOptions,disabled:!f})]}),v(Nn,{className:"w-full min-w-0 items-center justify-end gap-1",children:[c(Ke,{session:e}),G??c(Xe,{...I,sessionId:e.id,options:e.configOptions,disabled:!f}),ft,c(Cn,{active:mt,sending:C||Z||z,ready:f&&!W,hasMentions:h.length>0,onStop:Tt})]})]})})]})]})]})})})}
|
|
2
|
+
export{Ge};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{No}from"./chunk-gsq8mzr7.js";import{t}from"./chunk-6d38ff76.js";import{Bo,zo}from"./chunk-3ryhmzsq.js";import{L}from"./chunk-3x1eq95a.js";import{q}from"./chunk-0fvpmcps.js";import{isEmbeddedResource as g,isImage as d,isResourceLink as f,isText as x}from"@alwith/api";import{memo as p}from"react";import{jsx as r,jsxs as h}from"react/jsx-runtime";var So=p(function({item:s,messageTime:c}){let l=t(),o=zo(s._meta),m=o?o.map((e)=>e.question===void 0?e.text:`${e.question}
|
|
2
|
+
${e.text}`).join(`
|
|
3
|
+
`):q(s),a=s.content.filter(d),i=s.content.filter((e)=>f(e)||g(e)),u=o??s.content.filter(x).map((e)=>{let n=Bo(e._meta);return n?{question:n.question,text:n.answer}:{text:e.text}});if(m.length===0&&a.length===0&&i.length===0)return null;return h("div",{className:"group/codex-user flex min-w-0 flex-col items-end gap-2","data-content-search-unit-key":s.id,children:[i.length>0&&r("div",{className:"codex-user-mentions",children:i.map((e,n)=>r(L,{block:e},`${s.id}:${n}`))}),r(No,{host:l,message:s,text:m,textParts:u.some((e)=>("question"in e))?u:void 0,images:a,mentions:[],messageTime:c})]})});
|
|
4
|
+
export{So};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
export{
|
|
1
|
+
var Q="quick-chats";function E(e){let t=n(e);if(/^[a-z]:\//i.test(t)||t.startsWith("//"))return/^[a-z]:\/users\/[^/]+\/documents\/(codex(?:\/.*)?|alwith)$/.test(t);return/^\/Users\/[^/]+\/Documents\/(Codex(?:\/.*)?|ALwith)$/.test(e.replace(/\/+$/,""))}function n(e){return e.replaceAll("\\","/").replace(/^\/\/\?\/UNC\//i,"//").replace(/^\/\/\?\//,"").replace(/\/+$/,"").toLowerCase()}function xe(e){let t=new Map([["quick-chats",[]]]);for(let r of[...e].toSorted((s,o)=>(o.updatedAt??"").localeCompare(s.updatedAt??""))){let s=E(r.cwd)?"quick-chats":r.cwd,o=t.get(s);if(o)o.push(r);else t.set(s,[r])}return[...t]}function B(e){let t=e.replaceAll("\\","/").replace(/\/+$/,"").split("/").pop();return t?t:e}
|
|
2
|
+
export{Q,E,xe,B};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`,1)[0]??"";return r.endsWith(` b/${a}`)||r.endsWith(` ${a}`)||r.includes(`/${a} `)})??e}function
|
|
3
|
-
export{
|
|
1
|
+
import{Dn,Se}from"./chunk-6j4g51ff.js";import{t,we}from"./chunk-6d38ff76.js";import{d,u,w,m,k}from"./chunk-1txn4b0v.js";import{createStore as f}from"@alwith/api/client";import{jsx as i,jsxs as l}from"react/jsx-runtime";var c=f({request:null});function rt(e){c.setState({request:{path:e.path,patch:Ln(e.patch,e.path)}})}function Ln(e,a){let n=e.split(/^(?=diff --git )/m).filter((o)=>o.length>0);if(n.length<=1)return e;return n.find((o)=>{let r=o.split(`
|
|
2
|
+
`,1)[0]??"";return r.endsWith(` b/${a}`)||r.endsWith(` ${a}`)||r.includes(`/${a} `)})??e}function it(){let{t:e,theme:a}=t(),n=we(c,(o)=>o.request),s=n===null?null:Dn(n.patch);return i(d,{open:n!==null,onOpenChange:(o)=>!o&&c.setState({request:null}),children:l(u,{className:"flex h-[calc(100vh-2.5rem)] max-h-[900px] flex-col gap-3 sm:max-w-[min(1400px,calc(100vw-2.5rem))]",children:[l(w,{children:[i(m,{className:"truncate pe-8 font-mono text-sm font-normal",children:n?.path}),s!==null&&l(k,{children:[l("span",{className:"codex-diff-additions",children:["+",s.additions]})," ",l("span",{className:"codex-diff-deletions",children:["-",s.deletions]})," ",i("span",{children:e("conversation.changedLines")})]})]}),i("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden rounded-lg border [&>.codex-patch-view]:h-full","data-stream-style":"codexUI",children:n!==null&&i(Se,{patch:n.patch,theme:a})})]})})}
|
|
3
|
+
export{rt,Ln,it};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{lr}from"./chunk-y6r6tzfh.js";import{createContext as s,useContext as l,useSyncExternalStore as m}from"react";import{jsx as r}from"react/jsx-runtime";var c=s(null),u=s(null);function J({host:e,client:n,children:i}){return r(lr,{host:e,children:r(c,{value:e,children:r(u,{value:n,children:i})})})}function t(){let e=l(c);if(e===null)throw Error("Timeline host is missing");return e}function ee(){let e=l(u);if(e===null)throw Error("Timeline client is missing");return e}function we(e,n){return m((i)=>e.subscribe(i),()=>n(e.getState()),()=>n(e.getState()))}function o(e){let n=ee();return we(n.store,e)}function qe(e,n){if(e.reportError)e.reportError(n);else console.error(n)}
|
|
2
|
+
export{J,t,ee,we,o,qe};
|
|
@@ -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 Dn(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{Dn,Se};
|