@alwith/module-chat 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -10
- package/dist/activity-host.d.ts +1 -0
- 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-15nwm04a.js +2 -0
- package/dist/chunk-16y5rmm5.js +2 -0
- package/dist/chunk-1d4c9j8w.js +2 -0
- package/dist/chunk-20zcgxa5.js +4 -0
- package/dist/{chunk-kaeqvcew.js → chunk-2epnn4sq.js} +1 -1
- package/dist/chunk-2f19pcpn.js +2 -0
- package/dist/chunk-3vt71emt.js +2 -0
- package/dist/{chunk-1yy2jsnh.js → chunk-42zr8zpv.js} +2 -2
- package/dist/{chunk-k7s0drzk.js → chunk-4svwa5p8.js} +3 -3
- package/dist/chunk-4tkxmh52.js +2 -0
- package/dist/chunk-5grywgpq.js +4 -0
- package/dist/chunk-5h13saah.js +2 -0
- package/dist/chunk-5j3wnans.js +2 -0
- package/dist/{chunk-yw4e2tcz.js → chunk-6p5hgnpq.js} +1 -1
- package/dist/{chunk-kget6qfz.js → chunk-6qa5dt1k.js} +1 -1
- package/dist/{chunk-341yykkp.js → chunk-6qn5srgg.js} +1 -1
- package/dist/{chunk-1cy1j8gj.js → chunk-6vky4fcv.js} +2 -2
- package/dist/{chunk-p9wpghey.js → chunk-7kcdf82d.js} +2 -2
- package/dist/{chunk-1hy64ewz.js → chunk-7q7c0mds.js} +1 -1
- package/dist/{chunk-wjejhpgw.js → chunk-801v0awm.js} +1 -1
- package/dist/{chunk-evcrrxfp.js → chunk-8e7xf2tb.js} +1 -1
- package/dist/chunk-8k7wzkna.js +2 -0
- package/dist/chunk-8vvn71rf.js +2 -0
- package/dist/{chunk-0e1pdbec.js → chunk-9ab18v07.js} +2 -2
- package/dist/{chunk-ph7bk34y.js → chunk-9dsa5vm7.js} +2 -2
- package/dist/chunk-9pdj44jr.js +2 -0
- package/dist/{chunk-m5pbe513.js → chunk-9s1cgt7s.js} +1 -1
- package/dist/chunk-aqj0v5a9.js +7 -0
- package/dist/chunk-azmqtycn.js +2 -0
- package/dist/{chunk-3eg720sa.js → chunk-b5mkvr4d.js} +2 -2
- package/dist/chunk-bfe7xk9m.js +3 -0
- package/dist/{chunk-k1pd257q.js → chunk-bkbemt8g.js} +2 -2
- package/dist/{chunk-d0ptk8x8.js → chunk-c4621n0b.js} +1 -1
- package/dist/chunk-cw9tg2sz.js +1 -0
- package/dist/{chunk-25na55ve.js → chunk-d675nr2b.js} +2 -2
- package/dist/{chunk-y2xbq7rb.js → chunk-d8gwsw6j.js} +3 -3
- package/dist/{chunk-1twg3evk.js → chunk-dgp9q950.js} +1 -1
- package/dist/chunk-dm31xvh3.js +2 -0
- package/dist/chunk-dr6z453e.js +2 -0
- package/dist/{chunk-4gayxp21.js → chunk-ea7zsd2s.js} +2 -2
- package/dist/chunk-fgsd4fsd.js +2 -0
- package/dist/chunk-fvnb8ds4.js +2 -0
- package/dist/{chunk-qj8r5xvx.js → chunk-h0dq9ztv.js} +2 -2
- package/dist/{chunk-66headm4.js → chunk-h38yw8y3.js} +1 -1
- package/dist/{chunk-hnt4tt1n.js → chunk-h6df4xfd.js} +2 -2
- package/dist/chunk-h87xp1gv.js +2 -0
- package/dist/{chunk-bwzjm3g8.js → chunk-hx6wfscz.js} +1 -1
- package/dist/chunk-j2mcvb68.js +7 -0
- package/dist/chunk-jeyvacx6.js +5 -0
- package/dist/chunk-jh8jske0.js +2 -0
- package/dist/chunk-jn2pj92h.js +2 -0
- package/dist/{chunk-r5d37dc0.js → chunk-jrrvpnf3.js} +1 -1
- package/dist/chunk-jsb0zged.js +2 -0
- package/dist/chunk-k2y4cpra.js +2 -0
- package/dist/{chunk-zt7a6b1m.js → chunk-k7zzrns3.js} +1 -1
- package/dist/chunk-m2myfd89.js +2 -0
- package/dist/chunk-m2wxz0sj.js +2 -0
- package/dist/chunk-nxarfyj2.js +2 -0
- package/dist/chunk-p1pd1twf.js +2 -0
- package/dist/chunk-p6558tbk.js +2 -0
- package/dist/{chunk-e9zndx26.js → chunk-phe3an96.js} +2 -2
- package/dist/{chunk-ftka421d.js → chunk-q7e2bdav.js} +2 -2
- package/dist/chunk-qh5fhcrh.js +3 -0
- package/dist/chunk-sky795ex.js +1 -0
- package/dist/chunk-t3vgbc9s.js +2 -0
- package/dist/{chunk-90rwhxdf.js → chunk-t5nstx0k.js} +2 -2
- package/dist/chunk-trgq8rq1.js +2 -0
- package/dist/{chunk-bf5fh35b.js → chunk-v0zn87k5.js} +2 -2
- package/dist/chunk-v72t4sf9.js +2 -0
- package/dist/chunk-vhat5rbz.js +2 -0
- package/dist/chunk-vw2hv2sq.js +2 -0
- package/dist/{chunk-3496tgga.js → chunk-w3yddw6n.js} +2 -2
- package/dist/chunk-x9pramem.js +2 -0
- package/dist/{chunk-arge74eh.js → chunk-xjen1yt6.js} +2 -2
- package/dist/{chunk-g20b01rn.js → chunk-ypvjzkfb.js} +2 -2
- package/dist/codex/activity-group.js +1 -1
- package/dist/codex/assistant-message.js +1 -2
- package/dist/codex/async-question-card.js +1 -3
- package/dist/codex/disclosure-state.js +1 -1
- package/dist/codex/edited-files-card.js +1 -1
- package/dist/codex/image-view-activity.js +1 -1
- package/dist/codex/markdown-renderer.js +1 -6
- package/dist/codex/navigation-audio.d.ts +5 -5
- 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/plan.js +1 -1
- package/dist/codex/styles.css +176 -0
- package/dist/codex/timeline-virtualizer.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 +2 -2
- package/dist/composer/completion-trigger.js +1 -1
- package/dist/composer/effort-slider.js +1 -1
- package/dist/composer/menu-radio.js +1 -1
- package/dist/composer/model-select.js +1 -1
- package/dist/composer/permission-mode-select.js +1 -1
- package/dist/composer/prompt-input-attachments.js +1 -1
- package/dist/composer/prompt-input-clipboard.js +1 -1
- package/dist/composer/prompt-input-context.js +1 -1
- package/dist/composer/prompt-input-textarea.js +3 -3
- package/dist/composer/prompt-input.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/locales.d.ts +312 -0
- package/dist/locales.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-timeline/activity-group.d.ts +7 -0
- package/dist/session-timeline/activity-group.js +1 -0
- package/dist/session-timeline/activity-projection.d.ts +3 -0
- package/dist/session-timeline/activity-projection.js +1 -0
- package/dist/session-timeline/assistant-content.d.ts +7 -0
- package/dist/session-timeline/assistant-content.js +1 -0
- package/dist/session-timeline/assistant-turn.d.ts +28 -0
- package/dist/session-timeline/assistant-turn.js +1 -0
- package/dist/session-timeline/async-questions.d.ts +5 -0
- package/dist/session-timeline/async-questions.js +1 -0
- package/dist/session-timeline/edited-files-card.d.ts +18 -0
- package/dist/session-timeline/edited-files-card.js +1 -0
- package/dist/session-timeline/history-timeline.d.ts +12 -0
- package/dist/session-timeline/history-timeline.js +1 -0
- package/dist/session-timeline/host.d.ts +14 -0
- package/dist/session-timeline/host.js +1 -0
- package/dist/session-timeline/navigation-rail.d.ts +10 -0
- package/dist/session-timeline/navigation-rail.js +1 -0
- package/dist/session-timeline/plan.d.ts +4 -0
- package/dist/session-timeline/plan.js +1 -0
- package/dist/session-timeline/question-reply.d.ts +8 -0
- package/dist/session-timeline/question-reply.js +1 -0
- package/dist/session-timeline/resource-content.d.ts +7 -0
- package/dist/session-timeline/resource-content.js +1 -0
- package/dist/session-timeline/session-timeline.d.ts +40 -0
- package/dist/session-timeline/session-timeline.js +1 -0
- package/dist/session-timeline/timeline-registry.d.ts +12 -0
- package/dist/session-timeline/timeline-registry.js +1 -0
- package/dist/session-timeline/turn-error.d.ts +14 -0
- package/dist/session-timeline/turn-error.js +1 -0
- package/dist/session-timeline/turn-retry.d.ts +2 -0
- package/dist/session-timeline/turn-retry.js +1 -0
- package/dist/session-timeline/turn-time.d.ts +5 -0
- package/dist/session-timeline/turn-time.js +1 -0
- package/dist/session-timeline/turns.d.ts +51 -0
- package/dist/session-timeline/turns.js +1 -0
- package/dist/session-timeline/types.d.ts +31 -0
- package/dist/session-timeline/types.js +0 -0
- package/dist/session-timeline/use-timeline-scroll.d.ts +12 -0
- package/dist/session-timeline/use-timeline-scroll.js +1 -0
- package/dist/session-timeline/user-message.d.ts +8 -0
- package/dist/session-timeline/user-message.js +1 -0
- package/dist/ui/badge.js +1 -1
- package/dist/ui/button.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/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/input.js +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/radio-group.js +1 -1
- package/dist/ui/separator.js +1 -1
- package/dist/ui/switch.js +1 -1
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/package.json +32 -4
- package/dist/chunk-2q9rzxbj.js +0 -2
- package/dist/chunk-36h9z1mt.js +0 -1
- package/dist/chunk-7tj0a2na.js +0 -2
- package/dist/chunk-8z8va1ws.js +0 -2
- package/dist/chunk-91nk8n6w.js +0 -2
- package/dist/chunk-c4cqqqqh.js +0 -2
- package/dist/chunk-cp20nzhv.js +0 -2
- package/dist/chunk-gfj69sqc.js +0 -2
- package/dist/chunk-mbrd76nh.js +0 -2
- package/dist/chunk-pc1yzf1x.js +0 -1
- package/dist/chunk-pqgtv07g.js +0 -2
- package/dist/chunk-reqrpvyy.js +0 -2
- package/dist/chunk-rgy601b7.js +0 -2
- package/dist/chunk-svmc952q.js +0 -7
- package/dist/chunk-tzdd96d0.js +0 -2
- package/dist/chunk-yvj5y06y.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{CheckCircleIcon as c,CircleIcon as o,LoaderIcon as i}from"lucide-react";import{jsx as n,jsxs as e}from"react/jsx-runtime";function
|
|
2
|
-
export{
|
|
1
|
+
import{CheckCircleIcon as c,CircleIcon as o,LoaderIcon as i}from"lucide-react";import{jsx as n,jsxs as e}from"react/jsx-runtime";function f({entries:s}){let d=s.filter((a)=>a.status==="completed").length,t=s.find((a)=>a.status==="in_progress");return e("div",{className:"codex-plan",children:[e("div",{className:"codex-plan-summary",children:[e("span",{children:[d,"/",s.length]}),t!==void 0&&e("span",{className:"codex-plan-active",children:["· ",t.content]})]}),n("div",{className:"codex-plan-entries",children:s.map((a)=>e("div",{className:"codex-plan-entry","data-status":a.status,children:[a.status==="completed"&&n(c,{"aria-hidden":"true"}),a.status==="in_progress"&&n(i,{className:"codex-plan-spinner","aria-hidden":"true"}),a.status==="pending"&&n(o,{"aria-hidden":"true"}),n("span",{children:a.content})]},a.content))})]})}
|
|
2
|
+
export{f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Ot}from"./chunk-j2mcvb68.js";import{Ft,Dt,Bt}from"./chunk-2f19pcpn.js";import{zt}from"./chunk-jn2pj92h.js";import{t}from"./chunk-vw2hv2sq.js";import{h}from"./chunk-fvnb8ds4.js";import{textOf as f}from"@alwith/api";import{nativeTurnId as I}from"@nyssance/codex-acp-v2/client";import{useMemo as N}from"react";import{jsx as r,jsxs as v,Fragment as y}from"react/jsx-runtime";function sn(i,n){return{installUnlock:n==="none"?()=>()=>{}:Dt,preload:()=>{if(n!=="none")Ft(i)},playSequence:(a,d,l)=>Bt(a,d,l,i,n)}}function _t(i,n={},a){let d=[];for(let e of i){if(e.user===null)continue;let o="";for(let m of e.final){let p=f(m.content).trim();if(p.length===0)continue;o=p}let u=n[e.user.id],s=e.items.map(I).find((m)=>m!==null);d.push({id:e.user.id,turnKey:e.key,label:h(e.user),response:o,inputTokens:u?.inputTokens??0,outputTokens:u?.outputTokens??0,...s===void 0?{}:{nativeTurnId:s}})}if(!a?.complete)return d;let l=new Map;for(let e of d){if(e.nativeTurnId===void 0)continue;let o=l.get(e.nativeTurnId)??[];o.push(e),l.set(e.nativeTurnId,o)}let c=new Set(a.turns.map((e)=>e.turnId)),g=new Set(a.loadedTurnIds);return[...a.turns.flatMap((e)=>{let o=l.get(e.turnId);if(o)return o;if(g.has(e.turnId))return[];let u=a.previews[e.turnId];return((u?.messages.length)?u.messages:[{id:"",label:"",response:""}]).map((s,m)=>({id:`history:${e.turnId}:${m===0?"0":s.id}`,messageId:s.id||void 0,turnKey:`history:${e.turnId}`,nativeTurnId:e.turnId,isLoaded:!1,previewState:u?.state??"loading",label:s.label,response:s.response,inputTokens:0,outputTokens:0}))}),...d.filter((e)=>e.nativeTurnId===void 0||!c.has(e.nativeTurnId))]}function T({item:i}){let n=t(),a=N(()=>({theme:n.theme,copyLabel:n.t("actions.copy"),openLink:()=>{},preview:!0}),[n]);if(i.previewState==="loading")return v("div",{role:"status",className:"animate-pulse space-y-2 py-1","aria-label":n.t("timeline.navigationLoading"),children:[r("div",{className:"bg-muted h-3 w-3/5 rounded"}),r("div",{className:"bg-muted h-3 rounded"}),r("div",{className:"bg-muted h-3 w-4/5 rounded"})]});return v(y,{children:[r("div",{className:"min-w-0 truncate font-medium",children:i.previewState==="unavailable"?n.t("timeline.navigationUnavailable"):i.label||n.t("timeline.navigationEmpty")}),i.response&&r("div",{className:"text-muted-foreground pointer-events-none mt-1 line-clamp-3 [&_img]:hidden [&_pre]:max-h-20 [&_table]:table-fixed","data-navigation-response":!0,children:r(Ot,{text:i.response,host:a})})]})}function Ht(i){return r(zt,{...i,renderPreview:(n)=>r(T,{item:n})})}
|
|
2
|
+
export{sn,_t,Ht};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{en}from"./chunk-azmqtycn.js";import{createContext as r,useContext as s,useSyncExternalStore as u}from"react";import{jsx as o}from"react/jsx-runtime";var l=r(null),c=r(null);function Me({host:e,client:n,children:i}){return o(en,{host:e,children:o(l,{value:e,children:o(c,{value:n,children:i})})})}function t(){let e=s(l);if(e===null)throw Error("Timeline host is missing");return e}function b(){let e=s(c);if(e===null)throw Error("Timeline client is missing");return e}function Se(e,n){return u((i)=>e.subscribe(i),()=>n(e.getState()),()=>n(e.getState()))}function g(e){let n=b();return Se(n.store,e)}function V(e,n){if(e.reportError)e.reportError(n);else console.error(n)}
|
|
2
|
+
export{Me,t,b,Se,g,V};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{Ct}from"./chunk-q7e2bdav.js";import{CheckIcon as N,ChevronDownIcon as E,CopyIcon as w,FileIcon as k}from"lucide-react";import{useEffect as H,useLayoutEffect as I,useRef as T,useState as b}from"react";import{jsx as e,jsxs as g,Fragment as y}from"react/jsx-runtime";var A=20,L='a[href], area[href], button, input, select, textarea, summary, audio[controls], video[controls], iframe, [contenteditable]:not([contenteditable="false"]), [tabindex]:not([tabindex="-1"])';function h(n,o,s){if(n.toggleAttribute("inert",!o),!o){n.setAttribute("aria-hidden","true");return}if(s===null)n.removeAttribute("aria-hidden");else n.setAttribute("aria-hidden",s)}function R(n,o){let s=n.getBoundingClientRect(),i=o.getBoundingClientRect();return s.top>=i.top&&s.right<=i.right&&s.bottom<=i.bottom&&s.left>=i.left}function M({text:n,host:o}){let{t:s,Markdown:i}=o,c=T(null),[l,p]=b(!1),[d,f]=b(!1);return I(()=>{let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=()=>{if(r.scrollHeight===0){p(!1);return}let x=Number.parseFloat(getComputedStyle(r).lineHeight);if(!Number.isFinite(x))throw Error("Codex user message line height is invalid");p(r.scrollHeight>A*x+1)};t();let u=new ResizeObserver(t);return u.observe(r),()=>u.disconnect()},[]),H(()=>{if(!l||d)return;let r=c.current;if(!r)throw Error("Codex user message content is missing");let t=new Map,u=typeof IntersectionObserver>"u"?null:new IntersectionObserver((a)=>{for(let m of a){let v=m.target;if(!t.has(v))continue;h(v,m.isIntersecting&&m.intersectionRatio>=1,t.get(v))}},{root:r,rootMargin:"0px",threshold:1}),x=()=>{for(let a of t.keys()){if(r.contains(a))continue;u?.unobserve(a),t.delete(a)}for(let a of r.querySelectorAll(L)){if(t.has(a)||a.hasAttribute("inert"))continue;let m=a.getAttribute("aria-hidden");t.set(a,m),h(a,u===null&&R(a,r),m),u?.observe(a)}};x();let C=new MutationObserver(x);return C.observe(r,{childList:!0,subtree:!0}),()=>{u?.disconnect(),C.disconnect();for(let[a,m]of t)h(a,!0,m)}},[l,d]),g("div",{className:"codex-user-message-content",children:[e("div",{ref:c,className:l&&!d?"codex-user-message-text codex-user-message-text-collapsed":"codex-user-message-text",children:e(i,{text:n,streaming:!1})}),l&&!d&&e("span",{className:"codex-user-message-ellipsis","aria-hidden":"true",children:"…"}),l&&g("button",{type:"button","aria-expanded":d,className:"codex-user-message-collapse-trigger",onClick:()=>{f((r)=>!r)},children:[e("span",{children:d?s("stream.codex.showLess"):s("stream.codex.showMore")}),e(E,{className:d?"codex-user-message-collapse-chevron codex-user-message-collapse-chevron-expanded":"codex-user-message-collapse-chevron","aria-hidden":"true"})]})]})}function xe({text:n,label:o}){let[s,i]=b(!1);return e("button",{type:"button",className:"codex-message-action","aria-label":o,title:o,onClick:()=>{navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2000)},children:s?e(N,{className:"codex-message-action-confirmed"}):e(w,{})})}function S({image:n,openImage:o}){let[s,i]=b(!1),c=`data:${n.mimeType};base64,${n.data}`;return g(y,{children:[e("button",{type:"button",className:"codex-user-image",onClick:()=>o===void 0?i(!0):o(c),children:e("img",{src:c,alt:""})}),s&&e(Ct,{src:c,alt:"",onClose:()=>i(!1)})]})}function kt({message:n,text:o,textParts:s,mentions:i,images:c,messageTime:l,host:p,bubbleStyle:d}){let{t:f,openImage:r}=p;return e("div",{"data-content-search-unit-key":n.id,"data-message-id":n.id,className:"timeline-break codex-user-message scroll-mt-4",children:g("div",{className:"group/codex-user codex-user-message-group",children:[i.length>0&&e("div",{className:"codex-user-mentions",children:i.map((t)=>g("span",{className:"codex-user-mention",title:t.title,children:[e(k,{"aria-hidden":"true"}),e("span",{className:"codex-user-mention-label",children:t.label})]},t.key))}),c.length>0&&e("div",{className:"codex-user-images",children:c.map((t)=>e(S,{image:t,openImage:r},`${t.mimeType}:${t.data}`))}),o.length>0&&e(y,{children:e("div",{"data-user-message-bubble":!0,tabIndex:0,className:"codex-user-bubble",style:d,children:s?s.map((t,u)=>e("div",{className:"codex-user-text-part",children:t.question===void 0?e(M,{text:t.text,host:p}):g(y,{children:[e("div",{className:"codex-user-question-summary",title:t.question,children:t.question}),e("div",{className:"codex-user-question-answer",children:t.text})]})},u)):e(M,{text:o,host:p})})}),g("div",{className:"codex-user-actions",children:[e(xe,{text:o,label:f("actions.copy")}),l&&e("span",{className:"codex-user-time",title:l.full,children:l.short})]})]})})}
|
|
2
|
+
export{xe,kt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createStore as l}from"@alwith/api/client";var Ee=l({sessionId:null,turns:[],api:null,beforeReveal:null});function tn(e){Ee.setState(e)}function nn(e){if(Ee.getState().sessionId===e)Ee.setState({sessionId:null,turns:[],api:null,beforeReveal:null})}async function tr(e,t,n){let i=Ee.getState();if(n.aborted||e===null||i.sessionId!==e||i.api===null)return;if(i.beforeReveal===null)throw Error("Mounted timeline has no navigation lifecycle");i.beforeReveal(),await i.api.scrollToKey(t,void 0,{align:"top"})}
|
|
2
|
+
export{Ee,tn,nn,tr};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{pe,lt}from"./chunk-h6df4xfd.js";function c(t){return{key:t.name,label:t.name,description:t.description??void 0,payload:t.name}}function X(t,s,o=50){let i=new Set,r=t.filter((n)=>{if(i.has(n.name))return!1;return i.add(n.name),!0});if(!s)return r.slice(0,o).map(c);let l=s.toLowerCase(),e=[];for(let n of r){let a=pe(n.name,s);if(a)e.push({c:n,score:a.score});else if(n.description?.toLowerCase().includes(l))e.push({c:n,score:-1})}return e.sort((n,a)=>a.score-n.score),e.slice(0,o).map((n)=>c(n.c))}function In(t,s,o,i=50){let r=o?`${o.replace(/\/$/,"")}/`:"",l=t.map((e)=>({abs:e,rel:r&&e.startsWith(r)?e.slice(r.length):e}));return lt(l,s,(e)=>e.rel,i).map(({item:e})=>({key:e.abs,label:e.rel,payload:e.abs}))}
|
|
2
|
+
export{X,In};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t=new Map;var a=0;function
|
|
2
|
-
export{
|
|
1
|
+
var t=new Map;var a=0;function Ce(e,n){let r=n?void 0:t.get(e);if(r===void 0)return null;return t.delete(e),t.set(e,r),{...r,tokens:structuredClone(r.tokens)}}function c(e){if(e.isStreaming||e.text.length>1048576)return;if(t.delete(e.text))a-=e.text.length;t.set(e.text,{...e,tokens:structuredClone(e.tokens)}),a+=e.text.length;while(a>2097152||t.size>200){let n=t.keys().next().value;a-=n.length,t.delete(n)}}class l{worker=new Worker(new URL("@alwith/module-chat/markdown-parser.worker",import.meta.url),{type:"module"});clients=new Map;pending=new Map;active=null;failure=null;nextClientId=0;constructor(){this.worker.onmessage=(e)=>{let n=e.data,r=this.active;if(n.clientId!==r?.clientId||n.revision!==r.revision){this.fail(Error("Markdown worker returned an unexpected request"));return}if(this.active=null,!n.ok){this.fail(Error(n.error));return}let i={...r.input,tokens:n.tokens};c(i);let s=this.clients.get(r.clientId),o=this.pending.get(r.clientId),u=o!==void 0&&r.input.isStreaming&&o.input.isStreaming&&o.input.text.startsWith(r.input.text);if(s!==void 0&&(s.revision===r.revision||u))s.onResult(i);this.dispatch()},this.worker.onerror=(e)=>this.fail(Error(e.message)),this.worker.onmessageerror=()=>this.fail(Error("Cannot deserialize Markdown parsing result"))}fail(e){this.failure=e,this.worker.terminate(),this.pending.clear(),this.active=null;for(let n of this.clients.values())n.onError(e)}send(e){try{this.worker.postMessage(e)}catch(n){this.fail(n instanceof Error?n:Error(String(n)))}}dispatch(){if(this.active!==null||this.pending.size===0)return;let e=this.pending.values().next().value;this.pending.delete(e.clientId),this.active=e,this.send({type:"parse",clientId:e.clientId,revision:e.revision,source:e.input.source})}connect(e,n){if(this.failure!==null)throw this.failure;let r=++this.nextClientId,i={revision:0,onResult:e,onError:n};return this.clients.set(r,i),{update:(s)=>{if(this.failure!==null)throw this.failure;i.revision+=1;let o=Ce(s.text,s.isStreaming);if(o!==null){this.pending.delete(r),i.onResult(o);return}this.pending.set(r,{clientId:r,revision:i.revision,input:s}),this.dispatch()},dispose:()=>{if(!this.clients.delete(r))return;if(this.pending.delete(r),this.clients.size===0)this.worker.terminate(),d=void 0;else if(this.failure===null)this.send({type:"dispose",clientId:r})}}}}var d;function qt(e,n){return d??=new l,d.connect(e,n)}
|
|
2
|
+
export{Ce,qt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Pt,O}from"../chunk-aqj0v5a9.js";import"../chunk-m2wxz0sj.js";import"../chunk-trgq8rq1.js";import"../chunk-d8gwsw6j.js";import"../chunk-7kcdf82d.js";import"../chunk-v0zn87k5.js";import"../chunk-azmqtycn.js";export{O as CodexActivityGroup,Pt as CodexWorkSection};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`),b=!e.streaming&&h.trim().length>0?n(O,{text:h,isMostRecentTurn:s,beforeCopy:a,afterCopy:x,time:r}):null,l=ze(e.content,"compact"),f=l.reduce((o,c,p)=>c.kind==="codexActivityGroup"?p:o,-1),k=l.findIndex((o,c)=>c>f&&o.kind==="block"&&o.block.type==="text"),w=[...e.content].toReversed().find((o)=>o.type==="text"),m=e.content.filter((o)=>o.type==="tool_use"&&d(o).category==="edit"),v=(o)=>{if(o.kind==="codexActivityGroup"){let c=o.blocks.filter((p)=>p.type!=="tool_use"||!i.has(p.name));return c.length===0?null:n(be,{blocks:c},`activity:${N(c[0])}`)}if(o.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${o.kind}`);return n(_,{block:o.block,streaming:Boolean(e.streaming),actions:o.block===w?b:void 0,renderText:M},N(o.block))},g=f===-1?0:k===-1?l.length:k;return n(U,{stateKey:e.id,active:Boolean(e.streaming),startedAt:e.startedAt,durationMs:e.durationMs,providerId:e.providerId,providerIcon:B,work:l.slice(0,g).map(v),answer:l.length>g?l.slice(g).map(v):null,footer:f!==-1&&m.length>0&&(C===void 0?n(he,{blocks:m}):C(m))})}function O({text:e,isMostRecentTurn:s=!1,beforeCopy:i,afterCopy:r,time:a}){let{t:x}=t();return y("div",{className:P("mt-1.5 flex h-5 w-fit -translate-x-1 items-center justify-start gap-0.5 [&_*]:transition-none",s?"opacity-100":"opacity-0 group-focus-within/am:opacity-100 group-hover/am:opacity-100"),children:[i,n(W,{text:e,label:x("actions.copy")}),r,a&&n("span",{className:"codex-user-time ms-1",title:a.full,children:a.short})]})}function A(){let{t:e}=t();return n("div",{className:"codex-pending-message py-2",role:"status",children:n("span",{className:"codex-activity-running",children:e("message.thinking")})})}function U({work:e,answer:s,footer:i,loading:r=!1,...a}){if(r)return n(A,{});return y("div",{className:"group/am codex-assistant-turn",children:[e.length>0&&n(xe,{...a,children:e}),s!==null&&(e.length===0?s:n("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:s})),i]})}export{z as CodexAssistantMessage,U as CodexAssistantTurn,O as CodexMessageActions};
|
|
1
|
+
import{Wn,fe,he}from"../chunk-bfe7xk9m.js";import"../chunk-t5nstx0k.js";import"../chunk-4svwa5p8.js";import"../chunk-w3yddw6n.js";import"../chunk-q7e2bdav.js";import"../chunk-aqj0v5a9.js";import"../chunk-m2wxz0sj.js";import"../chunk-trgq8rq1.js";import"../chunk-d8gwsw6j.js";import"../chunk-7kcdf82d.js";import"../chunk-v0zn87k5.js";import"../chunk-azmqtycn.js";export{Wn as CodexAssistantMessage,he as CodexAssistantTurn,fe as CodexMessageActions};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
${JSON.stringify([n])}
|
|
3
|
-
</send_user_message_question_reply>`}function G(n){if(!p(n)||!p(n.codex))return[];let s=n.codex;return(Array.isArray(s.questionReplyParts)?s.questionReplyParts.map((t)=>p(t)?{...t,answer:t.text}:t):[s.questionReply]).filter((t)=>p(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:d,answer:m})=>({questionItemId:t,question:d,answer:m}))}function L({question:n,draft:s,status:i,answer:t,error:d,onChange:m,onSubmit:w,onSkip:Q,t:u}){let f=h(),x=i==="pending",k=i==="answered"||i==="skipped";return g("section",{"aria-labelledby":`${f}-title`,className:"border-border bg-card text-card-foreground flex min-w-0 flex-col gap-3 rounded-xl border p-4",children:[l("h3",{id:`${f}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title}),k?l("p",{className:"text-sm whitespace-pre-wrap",children:i==="answered"?t:u("asyncQuestion.skipped")}):g(A,{children:[(n.options?.length??0)>0&&g(c,{"aria-labelledby":`${f}-title`,disabled:!x,value:s.selected===null?"other":String(s.selected),onValueChange:(y)=>m({...s,selected:y==="other"?null:Number(y)}),children:[n.options?.map((y,b)=>g(r,{className:"flex items-start gap-2 text-sm",children:[l(a,{value:String(b)}),l("span",{className:"whitespace-pre-wrap",children:y})]},b)),g(r,{className:"flex items-center gap-2 text-sm",children:[l(a,{value:"other"}),u("asyncQuestion.other")]})]}),l(o,{"aria-label":u("asyncQuestion.answer"),placeholder:u("asyncQuestion.answer"),value:s.text,readOnly:!x,onChange:(y)=>m({selected:null,text:y.target.value})}),d&&l("p",{role:"alert",className:"text-destructive text-sm",children:d}),g("div",{className:"flex flex-wrap items-center gap-2",children:[l(e,{size:"sm",disabled:!x||v(n,s).trim().length===0,onClick:w,children:u(i==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")}),l(e,{size:"sm",variant:"ghost",disabled:!x,onClick:Q,children:u("asyncQuestion.skip")}),(i==="closed"||i==="unavailable")&&l("span",{role:"status",className:"text-muted-foreground text-xs",children:u(`asyncQuestion.${i}`)})]})]})]})}export{L as AsyncQuestionCard,S as asyncQuestionId,D as asyncQuestions,C as initialQuestionDraft,v as questionAnswer,G as questionReplies,B as questionReplyEnvelope};
|
|
1
|
+
import{a,Ie,Yt,Pe,Zt,Ne,Jt}from"../chunk-5grywgpq.js";import"../chunk-k7zzrns3.js";import"../chunk-hx6wfscz.js";import"../chunk-c4621n0b.js";import"../chunk-801v0awm.js";export{Jt as AsyncQuestionCard,Ie as asyncQuestionId,a as asyncQuestions,Yt as initialQuestionDraft,Pe as questionAnswer,Ne as questionReplies,Zt as questionReplyEnvelope};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{d}from"../chunk-trgq8rq1.js";export{d as useCodexDisclosureState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{xn,yt,ve}from"../chunk-4svwa5p8.js";import"../chunk-azmqtycn.js";export{yt as CodexEditedFilesCard,ve as EditedFilesCard,xn as fileChanges};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{M,Nt}from"../chunk-m2wxz0sj.js";import"../chunk-trgq8rq1.js";import"../chunk-azmqtycn.js";export{Nt as ImageViewActivity,M as isImageView};
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)?`${e}\`\`\``:`${e}
|
|
3
|
-
\`\`\``}function H(e,n){if(!e.includes(n)||Ce(e,n)%2===0)return e;let t=ye(e,n);if(t<0)return e;let r=e.slice(t+n.length);if(r.length===0||/^\s/.test(r)||r.includes(`
|
|
4
|
-
`)||V(r))return e;return`${e}${n}`}function Ee(e){return e.startsWith("/")&&!e.startsWith("//")||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)||/^\/\/[^/]+\/[^/]+/.test(e)}function Z(e){let n=e.replaceAll("`","").trim(),t=n.match(/^(.*?):(\d+)(?::(\d+))?(?:[-–](\d+)(?::(\d+))?)?$/);if(t!==null){let[,o,s,i,c,d]=t;if(o===void 0||s===void 0)throw Error("Codex file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}let r=n.match(/^(.*?)#L(\d+)(?:C(\d+))?(?:-L(\d+)(?:C(\d+))?)?$/);if(r!==null){let[,o,s,i,c,d]=r;if(o===void 0||s===void 0)throw Error("Codex hash file location is incomplete");return{path:o,line:Number.parseInt(s,10),column:i===void 0?void 0:Number.parseInt(i,10),endLine:c===void 0?void 0:Number.parseInt(c,10),endColumn:d===void 0?void 0:Number.parseInt(d,10)}}return{path:n}}function Ie(e){let{path:n,line:t,column:r,endLine:o,endColumn:s}=Z(e);if(/^[a-z][a-z0-9+.-]*:\/\//i.test(n)||/^www\./i.test(n)||/^(mailto|tel):/i.test(n))return!1;if(t!==void 0||r!==void 0||o!==void 0||s!==void 0)return!0;if(!/(?:^|[\\/])[^\\/]+\.(?!\d+$)[^\\/.]+$/i.test(n))return!1;let i=/[\\/]/.test(n),c=n.split(/[\\/]/).at(-1);if(c===void 0)throw Error("Codex streaming link target has no file name");let d=c.split(".").at(-1);if(d===void 0||d.length===0)return!1;if(!i&&/[a-z]/.test(d)&&/[A-Z]/.test(d.slice(1)))return!1;if(!i){let u=d.toLowerCase();if(u.length>Te&&!ve.has(u))return!1}return!0}function $e(e){let{path:n}=Z(e);if(Ee(n))return!0;try{return new URL(n).protocol==="file:"}catch{return!1}}function Re(e){let n=e.match(A);if(n===null)return e;let t=n[2];if(t===void 0)throw Error("Codex streaming link target is missing");return Ie(t)||$e(t)?e.replace(A,"$1"):`${e})`}function Pe(e){let n=e.replace(xe,"");if(n.length===0||n.includes("`")&&V(n))return{isCodeFenceOpen:!1,markdown:n};if(n.includes("```")&&Me(n))return{isCodeFenceOpen:!0,markdown:Le(n)};if(n.includes(")n=Re(n);return n=H(n,"**"),n=H(n,"*"),{isCodeFenceOpen:!1,markdown:n}}function Se(e){return e?.type==="paragraph"&&"tokens"in e&&Array.isArray(e.tokens)}function _(e){return Se(e)&&e.tokens.length===1&&e.tokens[0]?.type==="image"}function Y(e){for(let n=0;n<e.length;n+=1){let t=e[n];if(t===void 0)throw Error(`Codex Markdown token is missing at index ${n}`);if("tokens"in t&&Array.isArray(t.tokens))Y(t.tokens);if(!_(t))continue;let r=[...t.tokens],o=n+1,s=o;for(;;){while(e[o]?.type==="space")o+=1;let i=e[o];if(!_(i))break;r.push(...i.tokens),o+=1,s=o}if(s===n+1)continue;t.tokens=r,t.text=r.map((i)=>i.raw).join(`
|
|
5
|
-
`),t.raw=e.slice(n,s).map((i)=>i.raw).join(""),e.splice(n+1,s-n-1)}}function O(e){return{type:"text",raw:e,text:e}}function Fe(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function E(e){for(let n of e){if(n.type==="list")for(let t of n.items){let r=t.tokens[0];if(r?.type==="heading"){let o=r,s=o.raw.trimEnd(),i=s.match(/^#{1,6}\s+/)?.[0];if(i!==void 0)t.tokens[0]={type:"paragraph",raw:o.raw,text:s,tokens:o.tokens===void 0?[O(s)]:[O(i),...o.tokens]}}if(t.loose)t.tokens=t.tokens.map((o)=>o.type==="text"?Fe(o):o);E(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))E(n.tokens)}}function Ae(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function He(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function _e(e){let n=He(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function Oe({href:e}){let n=X(()=>_e(e),[e]),[t,r]=h(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?ge:o?ue:me;return g("span",{className:"codex-markdown-favicon",children:[t===void 0?a("span",{className:"codex-markdown-favicon-fallback",children:a(s,{"aria-hidden":!0})}):null,n.map((i)=>a("img",{alt:"",className:t===i?"codex-markdown-favicon-image-loaded":void 0,decoding:"async",draggable:!1,referrerPolicy:"no-referrer",src:i,onLoad:()=>r((c)=>c!==void 0&&n.includes(c)?c:i)},i))]})}function je({children:e,href:n,title:t}){let r=C();if(r.preview)return a("span",{children:e});return a("a",{className:"codex-markdown-link","data-inline-mention-interactive":"",href:n,title:t,onClick:(o)=>Ae(o,n,r),children:g("span",{className:"codex-markdown-link-mention","data-layout":"inline-flow","data-interactive":"","data-underline-on-hover":"",children:[a("span",{className:"codex-markdown-link-icon-container","data-markdown-copy":"exclude",children:a(Oe,{href:n})}),a("span",{className:"codex-markdown-link-label",children:e})]})})}function We({code:e,language:n}){let{theme:t,copyLabel:r}=C(),o=k(null),[s,i]=h(null),[c,d]=h(null),[u,w]=h(!1);if(p(()=>{let f=tt(i,d);return o.current=f,()=>{f.dispose(),o.current=null}},[]),p(()=>{let f=o.current;if(f===null)throw Error("Code highlighter is not mounted");f.update(e,n)},[e,n]),c!==null)throw c;let x=s!==null&&s.code===e&&s.language===n?s.html:null;return g("div",{className:"codex-markdown-code-block","data-markdown-copy":"code-block","data-markdown-copy-text":e,"data-theme":t==="dark"?"dark":"light",children:[g("div",{className:"codex-markdown-code-header","data-markdown-copy":"exclude",children:[a("div",{className:"codex-markdown-code-title",children:n}),a("div",{className:"codex-markdown-code-actions",children:a("button",{type:"button",className:"codex-markdown-code-copy",title:r,onClick:()=>{navigator.clipboard.writeText(e),w(!0),window.setTimeout(()=>w(!1),2000)},children:u?a(z,{}):a(de,{})})})]}),a("div",{className:"codex-markdown-code-container",dir:"ltr",children:a("code",{className:"codex-markdown-code-content hljs",...x===null?{children:e}:{dangerouslySetInnerHTML:{__html:x}}})})]})}function qe({code:e,language:n}){return C().preview?a("span",{children:e}):a(Ke,{code:e,language:n})}function Ke({code:e,language:n}){let t=k(null),[r,o]=h(!1);if(p(()=>{if(r)return;let s=t.current;if(s===null)throw Error("Codex code block placeholder is not mounted");if(typeof IntersectionObserver>"u"){let c=window.setTimeout(()=>o(!0),0);return()=>window.clearTimeout(c)}let i=new IntersectionObserver((c)=>{if(!c.some((d)=>d.isIntersecting))return;o(!0),i.disconnect()},{rootMargin:"600px 0px"});return i.observe(s),()=>i.disconnect()},[r]),r)return a(We,{code:e,language:n});return a("div",{ref:t,className:"codex-markdown-code-block",children:a("pre",{className:"codex-markdown-code-placeholder",children:a("code",{children:e})})})}function ze(e){let n=[...document.body.querySelectorAll('[data-markdown-image-preview-trigger="true"]')],t=n.map((o)=>{let s=o.querySelector("img");if(s===null)throw Error("Codex image preview trigger has no image");return{src:s.currentSrc||s.src,alt:s.alt}}),r=n.indexOf(e);if(r===-1)throw Error("Codex image preview trigger is outside the document");return{images:t,index:r}}function Ue({preview:e,setPreview:n}){let t=e.images[e.index];if(t===void 0)throw Error(`Codex image preview index is out of range: ${e.index}`);return g("div",{className:"codex-markdown-image-preview",children:[a("img",{src:t.src,alt:t.alt}),g("div",{className:"codex-markdown-image-preview-actions",children:[a("button",{type:"button","aria-label":"Previous image",disabled:e.index===0,onClick:()=>n({...e,index:e.index-1}),children:a(se,{})}),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(le,{})}),a("button",{type:"button","aria-label":"Next image",disabled:e.index===e.images.length-1,onClick:()=>n({...e,index:e.index+1}),children:a(ce,{})}),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(fe,{})})]})]})}function Be(e){return C().preview?a(re,{children:e.alt}):a(De,{...e})}function De({src:e,alt:n,title:t,allowWide:r}){let o=k(null),[s,i]=h();p(()=>{let d=o.current;if(d===null)throw Error("Codex image preview dialog is not mounted");if(s===void 0){if(d.open)d.close();return}if(!d.open)d.showModal()},[s]);let c=n.length===0?"Open image preview":n;return g(re,{children:[a("button",{type:"button",className:`codex-markdown-image-trigger${r?"codex-markdown-image-trigger-wide":""}`,"aria-label":c,"data-markdown-image-preview-trigger":"true",onClick:(d)=>i(ze(d.currentTarget)),children:a("img",{className:`codex-markdown-image${r?"codex-markdown-image-wide":""}`,src:e,alt:n,title:t,loading:"lazy"})}),a("dialog",{ref:o,className:"codex-markdown-image-dialog","aria-label":c,onClose:()=>i(void 0),children:s===void 0?null:a(Ue,{preview:s,setPreview:i})})]})}function Ge({value:e,display:n}){let t=k(null);return D(()=>{if(t.current===null)throw Error("Codex math root is not mounted");ae.render(e,t.current,{displayMode:n,throwOnError:!1})},[n,e]),a("span",{ref:t,className:n?"codex-markdown-math-block":"codex-markdown-inline-math"})}var Je=150,T=null;function j(e,n){let t=T;if(t===null)return e;let r=t.cursor,o=r+e.length;t.cursor=o;let s=[],i=r;for(let c of t.runs){if(c.end<=r)continue;if(c.start>=o)break;let d=Math.max(r,c.start),u=Math.min(o,c.end);if(i<d)s.push(e.slice(i-r,d-r));s.push(a("span",{className:"codex-markdown-fade",children:e.slice(d-r,u-r)},`${n}:${t.generation}:${c.start}`)),i=u}if(i<o)s.push(e.slice(i-r));return s}function Q(e){let n=5381;for(let t=0;t<e.length;t+=1)n=(n*33+e.charCodeAt(t))%4294967296;return n.toString(36)}function W(e){let n=e.trim();if(n.length===0)return"";let t=n.split(`
|
|
6
|
-
`,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,we)}function Ve(e){switch(e.type){case"code":return e.raw.trimStart().match(/^(```|~~~)/)?.[1]??"";case"link":return e.href;case"image":{let n=e;return`${n.href}:${W(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return W(e.text);default:return""}}function ee(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Q(Ve(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=ee(r),s=t.get(o)??0;return t.set(o,s+1),te(r,`${n}-${o}-${s}`)})}function Ze(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return g("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?g("div",{className:"codex-markdown-task-checkbox",children:[a("input",{type:"checkbox",className:"codex-markdown-checkbox",checked:e.checked,"data-state":e.checked?"checked":"unchecked",readOnly:!0,disabled:!0}),e.checked?a(z,{}):null]}):null,m(t,n)]},n)}function Ye(e,n){let r=`codex-markdown-list ${e.items.some((s)=>s.task)?"codex-markdown-task-list":e.ordered?"codex-markdown-ordered-list":"codex-markdown-unordered-list"}`,o=m(e.items,n);return e.ordered?a("ol",{className:r,start:e.start===""?void 0:e.start,children:o},n):a("ul",{className:r,children:o},n)}function q(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return U(r,{key:n,className:`${t?"codex-markdown-table-header":"codex-markdown-table-cell"}${o?" codex-markdown-numeric-table-cell":""}`,align:e.align??void 0},...m(e.tokens,n))}function Qe(e,n){let t=new Map;return a("div",{className:"codex-markdown-table-container","data-markdown-table":!0,tabIndex:-1,children:a("div",{className:"codex-markdown-table-scroller",children:a("div",{className:"codex-markdown-table-wrapper",children:g("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>q(r,`${n}-header-${o}`,!0))})}),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Q(r.map((c)=>c.text).join("\x00")),s=t.get(o)??0;t.set(o,s+1);let i=`${n}-row-${o}-${s}`;return a("tr",{className:"codex-markdown-table-row",children:r.map((c,d)=>q(c,`${i}-cell-${d}`,!1))},i)})})]})})})},n)}function K(e,n,t){let r=v(e.href);if(!ne(r))return null;return a(Be,{src:r,alt:I(e.text),title:e.title==null?void 0:v(e.title),allowWide:t},n)}function te(e,n){switch(e.type){case"space":case"def":case"internalMessage":return null;case"hr":return a("hr",{className:"codex-markdown-horizontal-rule"},n);case"heading":{let t=e,o={1:"h1",2:"h2",3:"h3",4:"h4",5:"h5",6:"h6"}[t.depth];if(o===void 0)throw Error(`Unsupported Codex Markdown heading depth: ${t.depth}`);return U(o,{key:n,className:`codex-markdown-heading codex-markdown-heading-${t.depth}`},...m(t.tokens,n))}case"paragraph":{let t=e,r=t.tokens.filter((i)=>i.type!=="space"&&i.type!=="br"),o=r.length>0&&r.every((i)=>i.type==="image"),s=o&&r.length>1;return a("p",{className:`codex-markdown-paragraph${o?"codex-markdown-media-paragraph codex-markdown-media-wide-block":""}${s?"codex-markdown-media-grid-paragraph":""}`,"data-markdown-image-grid":s?"true":void 0,"data-wide-markdown-block":o?"true":void 0,"data-wide-markdown-block-kind":o?"image":void 0,children:o?r.map((i,c)=>K(i,`${n}-image-${c}`,!0)):m(t.tokens,n)},n)}case"text":{let t=e;return t.tokens===void 0?j(I(t.text),n):m(t.tokens,n)}case"escape":return j(e.text,n);case"strong":return a("strong",{className:"codex-markdown-strong",children:m(e.tokens,n)},n);case"em":return a("em",{children:m(e.tokens,n)},n);case"del":return a("del",{children:m(e.tokens,n)},n);case"codespan":return a("span",{className:"codex-markdown-inline-code",dir:"ltr","data-markdown-copy":"inline-code",children:e.text},n);case"br":return a("br",{},n);case"link":{let t=e,r=m(t.tokens,n),o=v(t.href);return ne(o)?a(je,{href:o,title:t.title==null?void 0:v(t.title),children:r},n):a("span",{children:r},n)}case"image":return K(e,n,!1);case"code":{let t=e;return a(qe,{code:t.text,language:t.lang},n)}case"blockquote":return a("blockquote",{className:"codex-markdown-blockquote",children:m(e.tokens,n)},n);case"list":return Ye(e,n);case"list_item":return Ze(e,n);case"table":return Qe(e,n);case"html":{let t=e;return/^<br\s*\/?>$/i.test(t.raw.trim())?a("br",{},n):t.raw}case"math":{let t=e;return a(Ge,{value:t.text,display:t.display},n)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function b(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?I(n.text):n.tokens.map(b).join("")}case"escape":return e.text;case"paragraph":case"heading":case"strong":case"em":case"del":case"link":case"blockquote":case"list_item":return e.tokens.map(b).join("");case"list":return e.items.map(b).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(b).join("")).join("")).join("")}default:return""}}function en({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=T;try{return T={cursor:t,runs:r,generation:o},te(e,n)}finally{T=s}}var nn=B(function({result:n}){let{text:t,isStreaming:r}=n,o=X(()=>{let l=n.tokens;if(n.source.includes("!["))Y(l);E(l);let R=new Map,P=0;return l.map((M)=>{let L=ee(M),S=R.get(L)??0;R.set(L,S+1);let F=b(M),oe={token:M,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,oe})},[n]),s=o.map((l)=>l.visibleText).join(""),i=k({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,w=performance.now(),x=r&&d?c.runs.filter((l)=>w-l.firstSeenAtMs<Je):[],N=c.generation+(d?0:1),f={text:t,visibleText:s,runs:x.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:N};if(r&&s.length>u)f.runs.push({start:u,end:s.length,firstSeenAtMs:w});return D(()=>{i.current=f}),a("div",{dir:"auto",className:"codex-markdown-content codex-markdown-root","data-streaming":r?"true":void 0,children:o.map((l)=>a(en,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:f.runs,generation:N},l.tokenKey))})}),tn=B(function({text:n,isStreaming:t}){let r=k(null),[o,s]=h(()=>ie(n,t)),[i,c]=h(null);if(p(()=>{let d=Xe((u)=>{pe(()=>s(u))},c);return r.current=d,()=>{d.dispose(),r.current=null}},[]),p(()=>{let d=r.current;if(d===null)throw Error("Markdown parser is not mounted");let u=t?Pe(n).markdown:n;d.update({source:u,text:n,isStreaming:t})},[t,n]),i!==null)throw i;return o===null?a("div",{"data-markdown-pending":!0}):a(nn,{result:o})});function mn({text:e,streaming:n,host:t}){let r=n===!0,[o,s]=h(e);return p(()=>{if(o===e)return;if(!r){s(e);return}let i=requestAnimationFrame(()=>s(e));return()=>cancelAnimationFrame(i)},[o,r,e]),a(G.Provider,{value:t,children:a(tn,{text:r?o:e,isStreaming:r})})}export{mn as CodexMarkdownRenderer};
|
|
1
|
+
import{Ot}from"../chunk-j2mcvb68.js";import"../chunk-d675nr2b.js";import"../chunk-bkbemt8g.js";import"../chunk-ypvjzkfb.js";export{Ot as CodexMarkdownRenderer};
|
|
@@ -3,11 +3,11 @@ export interface NavigationTokenPair {
|
|
|
3
3
|
inputTokens: number;
|
|
4
4
|
outputTokens: number;
|
|
5
5
|
}
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
6
|
+
export declare function preloadTimelineUserMessageNavigationInstrument(instrument: NavigationInstrument): void;
|
|
7
|
+
export declare function armTimelineUserMessageNavigationAudio(): void;
|
|
8
|
+
export declare function installTimelineUserMessageNavigationAudioUnlock(): () => void;
|
|
9
|
+
export declare function playTimelineUserMessageNavigationSequence(fromIndex: number, toIndex: number, tokenPairs: NavigationTokenPair[], instrument: NavigationInstrument, mode: NavigationSoundMode): void;
|
|
10
|
+
export declare function playTimelineUserMessageNavigationNote(itemIndex: number, itemCount: number, inputTokens: number, outputTokens: number, instrument: NavigationInstrument, mode: NavigationSoundMode): void;
|
|
11
11
|
export declare function navigationMidiNote(itemIndex: number, itemCount: number, inputTokens: number, outputTokens: number, mode: NavigationSoundMode): number;
|
|
12
12
|
export declare function automaticNavigationMidiNote(inputTokens: number, outputTokens: number): number;
|
|
13
13
|
export declare function pianoKeyMidiNote(itemIndex: number, itemCount: number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ft,Xn,Dt,Bt,Yn,ln,yn,dn,Zn,wn,kn,Jn,er}from"../chunk-2f19pcpn.js";export{Xn as armTimelineUserMessageNavigationAudio,yn as automaticNavigationMidiNote,Jn as getNavigationAudioContextState,er as getNavigationInstrumentReady,Dt as installTimelineUserMessageNavigationAudioUnlock,wn as itemPianoKeyIndex,ln as navigationMidiNote,kn as navigationPianoKeyIndexes,Zn as pianoKeyFrequency,dn as pianoKeyMidiNote,Yn as playTimelineUserMessageNavigationNote,Bt as playTimelineUserMessageNavigationSequence,Ft as preloadTimelineUserMessageNavigationInstrument};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{$t}from"../chunk-9dsa5vm7.js";export{$t as NavigationPreview};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{zt}from"../chunk-jn2pj92h.js";import"../chunk-9dsa5vm7.js";export{zt as TimelineUserMessageNavigationRail};
|
package/dist/codex/plan.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f}from"../chunk-v0zn87k5.js";export{f as CodexPlan};
|
package/dist/codex/styles.css
CHANGED
|
@@ -1501,3 +1501,179 @@
|
|
|
1501
1501
|
.codex-image-chevron-open {
|
|
1502
1502
|
transform: rotate(90deg);
|
|
1503
1503
|
}
|
|
1504
|
+
|
|
1505
|
+
/* Session timeline (session-timeline entry). */
|
|
1506
|
+
.codex-timeline-content {
|
|
1507
|
+
padding-inline: var(--codex-timeline-inline-padding, 20px);
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
.codex-turn-errors {
|
|
1511
|
+
display: flex;
|
|
1512
|
+
flex-direction: column;
|
|
1513
|
+
gap: 16px;
|
|
1514
|
+
margin-block: 16px;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
/* Keep the fade in viewport coordinates so compositor scrolling cannot outrun it. */
|
|
1518
|
+
.codex-timeline-bottom-fade {
|
|
1519
|
+
position: absolute;
|
|
1520
|
+
inset-inline: 0 calc(var(--app-scrollbar-size, 0px) + var(--app-scrollbar-edge-gap, 0px));
|
|
1521
|
+
bottom: 0;
|
|
1522
|
+
height: 24px;
|
|
1523
|
+
pointer-events: none;
|
|
1524
|
+
background: linear-gradient(to bottom, transparent, var(--background));
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
/* Scrollers inside a turn show their bar on hover only; the viewport has its own. */
|
|
1528
|
+
.codex-assistant-turn
|
|
1529
|
+
:is(
|
|
1530
|
+
.codex-markdown-table-scroller,
|
|
1531
|
+
.codex-markdown-code-placeholder,
|
|
1532
|
+
.codex-markdown-code-container,
|
|
1533
|
+
.codex-markdown-math-block,
|
|
1534
|
+
.codex-activity-group-body,
|
|
1535
|
+
.codex-activity-details,
|
|
1536
|
+
.codex-command-output,
|
|
1537
|
+
.codex-reasoning-details
|
|
1538
|
+
) {
|
|
1539
|
+
&::-webkit-scrollbar {
|
|
1540
|
+
width: 0;
|
|
1541
|
+
height: 0;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
&:hover::-webkit-scrollbar {
|
|
1545
|
+
width: var(--codex-hover-scrollbar-size, 6px);
|
|
1546
|
+
height: var(--codex-hover-scrollbar-size, 6px);
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
&::-webkit-scrollbar-track {
|
|
1550
|
+
background: transparent;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
&::-webkit-scrollbar-thumb {
|
|
1554
|
+
border-radius: 999px;
|
|
1555
|
+
background-color: color-mix(in oklab, var(--foreground) 18%, transparent);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
.codex-edited-file-path {
|
|
1560
|
+
display: inline-flex;
|
|
1561
|
+
align-items: center;
|
|
1562
|
+
gap: 6px;
|
|
1563
|
+
min-width: 0;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
.codex-edited-file-icon {
|
|
1567
|
+
flex: 0 0 auto;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
.codex-edited-file-name {
|
|
1571
|
+
min-width: 0;
|
|
1572
|
+
overflow: hidden;
|
|
1573
|
+
text-overflow: ellipsis;
|
|
1574
|
+
white-space: nowrap;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
.codex-user-image {
|
|
1578
|
+
padding: 0;
|
|
1579
|
+
border: 0;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
/* Image generation: a placeholder while the tool runs, then the result as a preview card. */
|
|
1583
|
+
.codex-image-generation {
|
|
1584
|
+
position: relative;
|
|
1585
|
+
width: min(20rem, 100%);
|
|
1586
|
+
aspect-ratio: 1;
|
|
1587
|
+
overflow: hidden;
|
|
1588
|
+
border-radius: 1.75rem;
|
|
1589
|
+
background: var(--muted);
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
.codex-image-generation-texture {
|
|
1593
|
+
position: absolute;
|
|
1594
|
+
inset: 0;
|
|
1595
|
+
background-image: radial-gradient(
|
|
1596
|
+
circle,
|
|
1597
|
+
color-mix(in srgb, var(--muted-foreground) 25%, transparent) 1px,
|
|
1598
|
+
transparent 1px
|
|
1599
|
+
);
|
|
1600
|
+
background-size: 12px 12px;
|
|
1601
|
+
mask-image: radial-gradient(ellipse at 35% 20%, black, transparent 75%);
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
.codex-image-generation[aria-busy="true"] .codex-image-generation-texture {
|
|
1605
|
+
animation: codex-image-breathe 2.5s ease-in-out infinite alternate;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
.codex-image-generation-status {
|
|
1609
|
+
position: absolute;
|
|
1610
|
+
inset-inline-end: 1rem;
|
|
1611
|
+
bottom: 1rem;
|
|
1612
|
+
display: flex;
|
|
1613
|
+
align-items: center;
|
|
1614
|
+
gap: 0.5rem;
|
|
1615
|
+
padding: 0.65rem 1rem;
|
|
1616
|
+
border: 1px solid var(--border);
|
|
1617
|
+
border-radius: 999px;
|
|
1618
|
+
background: var(--background);
|
|
1619
|
+
color: var(--foreground);
|
|
1620
|
+
font-size: 0.875rem;
|
|
1621
|
+
font-weight: 500;
|
|
1622
|
+
box-shadow: 0 2px 5px color-mix(in srgb, var(--foreground) 6%, transparent);
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
.codex-generated-image {
|
|
1626
|
+
position: relative;
|
|
1627
|
+
width: fit-content;
|
|
1628
|
+
max-width: min(40rem, 100%);
|
|
1629
|
+
overflow: hidden;
|
|
1630
|
+
border-radius: 1.5rem;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
.codex-generated-image-preview {
|
|
1634
|
+
display: block;
|
|
1635
|
+
overflow: hidden;
|
|
1636
|
+
border-radius: inherit;
|
|
1637
|
+
cursor: zoom-in;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
.codex-generated-image-download {
|
|
1641
|
+
position: absolute;
|
|
1642
|
+
inset-inline-start: 0.75rem;
|
|
1643
|
+
bottom: 0.75rem;
|
|
1644
|
+
border-radius: 999px;
|
|
1645
|
+
background: var(--background);
|
|
1646
|
+
color: var(--foreground);
|
|
1647
|
+
border: 1px solid var(--border);
|
|
1648
|
+
box-shadow: 0 2px 6px color-mix(in srgb, var(--foreground) 10%, transparent);
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
@media (hover: hover) and (pointer: fine) {
|
|
1652
|
+
.codex-generated-image-download {
|
|
1653
|
+
opacity: 0;
|
|
1654
|
+
transition: opacity 150ms ease;
|
|
1655
|
+
}
|
|
1656
|
+
.codex-generated-image:hover .codex-generated-image-download,
|
|
1657
|
+
.codex-generated-image:focus-within .codex-generated-image-download,
|
|
1658
|
+
.codex-generated-image-download:disabled {
|
|
1659
|
+
opacity: 1;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
@keyframes codex-image-breathe {
|
|
1664
|
+
from {
|
|
1665
|
+
opacity: 0.35;
|
|
1666
|
+
}
|
|
1667
|
+
to {
|
|
1668
|
+
opacity: 1;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1673
|
+
.codex-image-generation[aria-busy="true"] .codex-image-generation-texture {
|
|
1674
|
+
animation: none;
|
|
1675
|
+
}
|
|
1676
|
+
.codex-generated-image-download {
|
|
1677
|
+
transition: none;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Gn,ut,N,ge,mt,pt,gt}from"../chunk-nxarfyj2.js";export{Gn as CODEX_UNKNOWN_TURN_HEIGHT,N as calculateCodexThreadVirtualRange,pt as calculateCodexTurnCenterDistanceFromBottom,gt as calculateCodexTurnTargetDistanceFromBottom,ut as createCodexThreadVirtualLayout,mt as preserveCodexThreadDistanceFromBottom,ge as preserveCodexThreadRenderedWindow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{xe,kt}from"../chunk-w3yddw6n.js";import"../chunk-q7e2bdav.js";export{kt as CodexUserMessage,xe as CopyAction};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ct}from"../chunk-jsb0zged.js";import"../chunk-nxarfyj2.js";export{ct as VirtualizedTurnList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{X,In}from"../chunk-xjen1yt6.js";import"../chunk-h6df4xfd.js";export{In as filterFiles,X as filterSlashCommands};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e}from"../chunk-
|
|
1
|
+
import{e}from"../chunk-801v0awm.js";import{B}from"../chunk-h38yw8y3.js";import"../chunk-h6df4xfd.js";import{X}from"../chunk-xjen1yt6.js";import{Re}from"../chunk-6vky4fcv.js";import{_e}from"../chunk-t3vgbc9s.js";import{autoUpdate as st}from"@floating-ui/dom";import{cn as Y}from"cn";import{BookOpenTextIcon as it,FileIcon as lt,StoreIcon as ut}from"lucide-react";import{useCallback as at,useEffect as v,useLayoutEffect as Z,useMemo as _,useRef as R,useState as g}from"react";import{createPortal as ct}from"react-dom";import{jsx as p,jsxs as E,Fragment as mt}from"react/jsx-runtime";function Et({handleRef:a,anchorRef:c,commands:C,searchFiles:u,onMention:F,onSearchError:A,fileSearchDebounceMs:M=0,bashMode:j=!1,forcedOpen:i=!1,onForcedOpenChange:f,emptyLabel:O,fileStatusLabels:h,morePlugins:D}){let z=_e(),l=z.textInput.value,[K,U]=g(0),[y,P]=g(null),[b,L]=g(0),V=R(null);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>U(t.selectionStart??0),o=()=>{if(document.activeElement===t)n()};return t.addEventListener("keyup",n),t.addEventListener("click",n),t.addEventListener("input",n),t.addEventListener("select",n),t.addEventListener("focus",n),document.addEventListener("selectionchange",o),()=>{t.removeEventListener("keyup",n),t.removeEventListener("click",n),t.removeEventListener("input",n),t.removeEventListener("select",n),t.removeEventListener("focus",n),document.removeEventListener("selectionchange",o)}});let W=_(()=>j&&l.startsWith("!")?null:Re(l,K),[l,K,j]),r=W?.kind==="at"&&!u?null:W,q=`${r?.kind??"forced"}:${r?.query??""}:${i}`,[tt,et]=g(q);if(tt!==q)et(q),L(0);let I=R(null);v(()=>{if(!i){I.current=null;return}if(I.current===null)I.current=l;else if(l!==I.current)f?.(!1)},[i,l,f]);let x=r?.kind==="at"?r.query:null;v(()=>{if(x===null||!u){P(null);return}let t=!0,n=()=>{u(x).then((s)=>{if(t)P({query:x,search:u,items:s})},(s)=>{if(t)P({query:x,search:u,items:[]}),A(s)})},o=M>0?window.setTimeout(n,M):null;if(o===null)n();return()=>{if(t=!1,o!==null)window.clearTimeout(o)}},[x,u,M,A]);let d=_(()=>{if(r?.kind==="at")return y?.query===r.query&&y.search===u?y.items:[];if(r)return X(C,r.query);if(i)return X(C,"");return[]},[r,i,C,y,u]),[nt,N]=g(!1);v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=()=>N(!0),o=()=>{if(N(!1),i)f?.(!1)};return N(document.activeElement===t),t.addEventListener("focus",n),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",n),t.removeEventListener("blur",o)}},[a,i,f]),v(()=>{if(i)a.current?.getTextarea()?.focus()},[i,a]);let m=nt&&(r!==null?r.kind==="slash"||d.length>0||!!h:i);v(()=>{if(!m)return;V.current?.querySelector(`[data-idx="${b}"]`)?.scrollIntoView({block:"nearest"})},[b,m]);function Q(t){let n=a.current?.getTextarea();if(!n)return;let o,s;if(r){let H=r.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(o=l.slice(0,r.start)+H+l.slice(r.end),r.kind==="at")F?.(t.payload);s=r.start+H.length}else if(i)o=`${l.length===0||l.endsWith(`
|
|
2
2
|
`)?l:`${l}
|
|
3
|
-
`}/${t.payload} `,s=o.length,f?.(!1);else return;z.textInput.setInput(o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s,s)})}v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=(o)=>{if(!m)return;if(a.current?.isComposing()||o.isComposing||o.keyCode===229)return;if(o.key==="ArrowDown")o.preventDefault(),o.stopPropagation(),L((s)=>d.length===0?0:Math.min(d.length-1,s+1));else if(o.key==="ArrowUp")o.preventDefault(),o.stopPropagation(),L((s)=>Math.max(0,s-1));else if(o.key==="Enter"||o.key==="Tab"){o.preventDefault(),o.stopPropagation();let s=d[b];if(s)
|
|
3
|
+
`}/${t.payload} `,s=o.length,f?.(!1);else return;z.textInput.setInput(o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s,s)})}v(()=>{let t=a.current?.getTextarea();if(!t)return;let n=(o)=>{if(!m)return;if(a.current?.isComposing()||o.isComposing||o.keyCode===229)return;if(o.key==="ArrowDown")o.preventDefault(),o.stopPropagation(),L((s)=>d.length===0?0:Math.min(d.length-1,s+1));else if(o.key==="ArrowUp")o.preventDefault(),o.stopPropagation(),L((s)=>Math.max(0,s-1));else if(o.key==="Enter"||o.key==="Tab"){o.preventDefault(),o.stopPropagation();let s=d[b];if(s)Q(s)}else if(o.key==="Escape")if(o.preventDefault(),o.stopPropagation(),r)U(Math.max(0,r.start-1)),t.setSelectionRange(r.start,r.start);else f?.(!1)};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)});let[k,G]=g(null),[S,ot]=g(null),T=at(()=>{let t=c?.current;if(!t)return;let n=t.getBoundingClientRect();G({left:n.left,width:n.width,bottom:window.innerHeight-n.top+8})},[c]);if(Z(()=>{if(!m){G(null);return}T()},[m,T]),Z(()=>{let t=c?.current;if(!m||!t||!S)return;return st(t,S,T,{animationFrame:!0})},[m,S,c,T]),!m||c&&!k)return null;let w=r?r.kind==="slash":i,rt=w?it:lt,J=p("div",{ref:ot,className:c?"fixed z-50":"absolute inset-x-0 bottom-full z-50 mb-2",style:c&&k?{left:k.left,width:k.width,bottom:k.bottom}:void 0,children:E("div",{ref:V,role:"listbox",onMouseDown:(t)=>t.preventDefault(),className:"bg-popover text-popover-foreground ring-foreground/10 pointer-events-auto w-full overflow-hidden rounded-lg p-1 shadow-md ring-1 outline-hidden",children:[E("div",{className:"max-h-72 overflow-y-auto",children:[d.length===0&&w&&p("div",{className:"text-muted-foreground px-2 py-3 text-xs",children:O}),d.length===0&&!w&&h&&p("div",{role:"status",className:"text-muted-foreground px-2 py-3 text-xs",children:y?.query===x&&y.search===u?h.empty:h.loading}),d.map((t,n)=>E(e,{type:"button",variant:"ghost",role:"option","aria-selected":n===b,"data-idx":n,onMouseDown:(o)=>{o.preventDefault(),Q(t)},onMouseEnter:()=>L(n),className:Y("flex h-auto w-full items-center justify-start gap-2.5 rounded-md px-2.5 py-2 text-start",n===b&&"bg-muted"),children:[p(rt,{className:Y("size-4 shrink-0",w?"text-blue-500":"text-muted-foreground")}),p("span",{className:"text-foreground shrink-0 text-sm font-medium",children:t.label}),t.description&&p("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:t.description})]},t.key))]}),w&&D&&E(mt,{children:[p(B,{}),E(e,{type:"button",variant:"ghost",onMouseDown:(t)=>{t.preventDefault(),f?.(!1),D.open()},className:"h-auto w-full justify-start px-2.5 py-2",children:[p(ut,{"data-icon":"inline-start"}),D.label]})]})]})});return c?ct(J,document.body):J}export{Et as CompletionMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Re}from"../chunk-6vky4fcv.js";export{Re as detectTrigger};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Y}from"../chunk-phe3an96.js";export{Y as EffortSlider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{r}from"../chunk-42zr8zpv.js";import"../chunk-2epnn4sq.js";export{r as MenuRadioSelect};
|