@alwith/module-chat 0.5.1 → 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-2epnn4sq.js +1 -0
- package/dist/chunk-2f19pcpn.js +2 -0
- package/dist/chunk-3vt71emt.js +2 -0
- package/dist/{chunk-6ynartgd.js → chunk-42zr8zpv.js} +2 -2
- package/dist/{chunk-7ex6r8ja.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-wnq8g0kp.js → chunk-6p5hgnpq.js} +1 -1
- package/dist/{chunk-2sgxwycp.js → chunk-6qa5dt1k.js} +1 -1
- package/dist/{chunk-6q8b8aww.js → chunk-6qn5srgg.js} +1 -1
- package/dist/{chunk-8md0gr7j.js → chunk-6vky4fcv.js} +2 -2
- package/dist/chunk-7kcdf82d.js +2 -0
- package/dist/{chunk-wmsdg5fb.js → chunk-7q7c0mds.js} +1 -1
- package/dist/{chunk-vk39871j.js → chunk-801v0awm.js} +1 -1
- package/dist/{chunk-fmxt5ysw.js → chunk-8e7xf2tb.js} +1 -1
- package/dist/chunk-8k7wzkna.js +2 -0
- package/dist/chunk-8vvn71rf.js +2 -0
- package/dist/{chunk-3z0y9amd.js → chunk-9ab18v07.js} +2 -2
- package/dist/{chunk-r125b0z5.js → chunk-9dsa5vm7.js} +2 -2
- package/dist/chunk-9pdj44jr.js +2 -0
- package/dist/{chunk-s2n85pks.js → chunk-9s1cgt7s.js} +1 -1
- package/dist/chunk-aqj0v5a9.js +7 -0
- package/dist/chunk-azmqtycn.js +2 -0
- package/dist/{chunk-3t2c4zky.js → chunk-b5mkvr4d.js} +2 -2
- package/dist/chunk-bfe7xk9m.js +3 -0
- package/dist/{chunk-ahcmeqvb.js → chunk-bkbemt8g.js} +2 -2
- package/dist/{chunk-d0ptk8x8.js → chunk-c4621n0b.js} +1 -1
- package/dist/{chunk-9f42d428.js → chunk-cw9tg2sz.js} +1 -1
- package/dist/{chunk-dp4g5y18.js → chunk-d675nr2b.js} +2 -2
- package/dist/{chunk-2v9kbth7.js → chunk-d8gwsw6j.js} +3 -3
- package/dist/{chunk-38skakaz.js → chunk-dgp9q950.js} +1 -1
- package/dist/{chunk-kk9q6wtq.js → chunk-dm31xvh3.js} +2 -2
- package/dist/chunk-dr6z453e.js +2 -0
- package/dist/{chunk-1vxrdkew.js → chunk-ea7zsd2s.js} +2 -2
- package/dist/chunk-fgsd4fsd.js +2 -0
- package/dist/chunk-fvnb8ds4.js +2 -0
- package/dist/{chunk-tcqf45rf.js → chunk-h0dq9ztv.js} +2 -2
- package/dist/{chunk-gnthx1zg.js → chunk-h38yw8y3.js} +1 -1
- package/dist/chunk-h6df4xfd.js +2 -0
- 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-dj8v2w6n.js → chunk-jrrvpnf3.js} +1 -1
- package/dist/chunk-jsb0zged.js +2 -0
- package/dist/chunk-k2y4cpra.js +2 -0
- package/dist/{chunk-nfd274y3.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-fk5nvz2s.js → chunk-phe3an96.js} +2 -2
- package/dist/{chunk-en6qem8e.js → chunk-q7e2bdav.js} +2 -2
- package/dist/chunk-qh5fhcrh.js +3 -0
- package/dist/{chunk-3abwky4a.js → chunk-sky795ex.js} +1 -1
- package/dist/chunk-t3vgbc9s.js +2 -0
- package/dist/{chunk-g13txkf0.js → chunk-t5nstx0k.js} +2 -2
- package/dist/chunk-trgq8rq1.js +2 -0
- package/dist/{chunk-h96s3j1e.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-jaf9msp7.js → chunk-w3yddw6n.js} +2 -2
- package/dist/chunk-x9pramem.js +2 -0
- package/dist/chunk-xjen1yt6.js +2 -0
- package/dist/chunk-ypvjzkfb.js +2 -0
- 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.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-35j3t609.js +0 -2
- package/dist/chunk-6mhdcz0h.js +0 -2
- package/dist/chunk-6pmsbx1j.js +0 -2
- package/dist/chunk-7ar540cc.js +0 -2
- package/dist/chunk-7xdvwjxh.js +0 -2
- package/dist/chunk-98g6kwj5.js +0 -2
- package/dist/chunk-bbw2zg1a.js +0 -2
- package/dist/chunk-c4ps9628.js +0 -2
- package/dist/chunk-c8dr4btd.js +0 -2
- package/dist/chunk-d4e74rv1.js +0 -2
- package/dist/chunk-fk1z4bmr.js +0 -2
- package/dist/chunk-j3my6gn8.js +0 -1
- package/dist/chunk-k0mayxgs.js +0 -2
- package/dist/chunk-k4w61adv.js +0 -2
- package/dist/chunk-p141s624.js +0 -2
- package/dist/chunk-rgy601b7.js +0 -2
- package/dist/chunk-sdv6vdhr.js +0 -7
- package/dist/chunk-sptvg9xh.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createContext as s,useContext as a}from"react";import{jsx as r}from"react/jsx-runtime";var e=s(null);function en({host:t,children:o}){return r(e.Provider,{value:t,children:o})}function n(){let t=a(e);if(t===null)throw Error("Activity host is missing");return t}function i(t){let{Markdown:o}=n();return r(o,{...t})}
|
|
2
|
+
export{en,n,i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-
|
|
2
|
-
export{
|
|
1
|
+
import{e}from"./chunk-801v0awm.js";import{u}from"./chunk-7q7c0mds.js";import{cn as v}from"cn";import{ChevronDownIcon as g,ChevronUpIcon as b,XIcon as z}from"lucide-react";import{useEffect as B,useImperativeHandle as N,useRef as E}from"react";import{jsx as n,jsxs as k}from"react/jsx-runtime";function He({ref:p,value:i,onChange:d,onFind:o,onClose:s,placeholder:m,autoFocusOpen:a=!0,prevTitle:l,nextTitle:c,className:h}){let r=E(null);N(p,()=>{if(r.current===null)throw Error("FindBar input is not mounted");return r.current},[]),B(()=>{if(!a)return;let t=r.current;if(t===null)throw Error("FindBar input is not mounted");t.focus(),t.select()},[a]);let f=!i;return k("div",{className:v("border-border flex h-9 shrink-0 items-center gap-1 border-b px-2",h),children:[n(u,{ref:r,value:i,onChange:(t)=>d(t.target.value),placeholder:m,className:"h-7 text-xs",onKeyDown:(t)=>{if(t.key==="Escape"){t.preventDefault(),s();return}if(t.key==="Enter"){if(t.preventDefault(),i)o(t.shiftKey)}}}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>o(!0),title:l?`${l} (⇧↵)`:"⇧↵",children:n(b,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",disabled:f,onClick:()=>o(!1),title:c?`${c} (↵)`:"↵",children:n(g,{className:"size-3.5"})}),n(e,{size:"icon",variant:"ghost",className:"size-6",onClick:s,title:"Esc",children:n(z,{className:"size-3.5"})})]})}
|
|
2
|
+
export{He};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n,i}from"./chunk-azmqtycn.js";import{m}from"./chunk-d8gwsw6j.js";import{ht}from"./chunk-t5nstx0k.js";import{f}from"./chunk-v0zn87k5.js";import{Pt,O}from"./chunk-aqj0v5a9.js";import{yt}from"./chunk-4svwa5p8.js";import{xe}from"./chunk-w3yddw6n.js";import{cn as P}from"cn";import{jsx as o,jsxs as C}from"react/jsx-runtime";var N=new WeakMap,I=1;function A(t){if(t.type==="tool_use"||t.type==="subagent"||t.type==="collab")return`${t.type}:${t.id}`;let s=N.get(t);if(s!==void 0)return`${t.type}:${s}`;let r=I++;return N.set(t,r),`${t.type}:${r}`}function E({block:t,streaming:s,actions:r}){if(t.isApiError)return o("div",{className:"codex-stream-error",children:t.text});return C("div",{className:"codex-assistant-message",children:[o(i,{text:t.text,streaming:s}),r]})}function _({block:t,streaming:s,actions:r,renderText:a}){switch(t.type){case"text":return a===void 0?o(E,{block:t,streaming:s,actions:r}):a({block:t,streaming:s,actions:r});case"thinking":return t.thinking.length>0?o(i,{text:t.thinking,streaming:!t.isComplete}):null;case"plan":return o(f,{entries:t.entries});case"image":return o("img",{src:`data:${t.source.media_type};base64,${t.source.data}`,className:"max-h-64 rounded",alt:""});case"tool_use":case"subagent":case"collab":return null}}var S=new Set;function Wn({message:t,isMostRecentTurn:s,hiddenTools:r=S,time:a,beforeCopy:c,afterCopy:u,providerIcon:B,renderText:M,renderEditedFiles:h}){if(t.streaming===!0&&t.content.every((e)=>e.type==="text"?e.text.length===0:e.type==="thinking"?e.thinking.length===0:!1))return o(T,{});let k=t.content.filter((e)=>e.type==="text").map((e)=>e.text).join(`
|
|
2
|
+
`),b=!t.streaming&&k.trim().length>0?o(fe,{text:k,isMostRecentTurn:s,beforeCopy:c,afterCopy:u,time:a}):null,l=ht(t.content,"compact"),x=l.reduce((e,d,p)=>d.kind==="codexActivityGroup"?p:e,-1),v=l.findIndex((e,d)=>d>x&&e.kind==="block"&&e.block.type==="text"),w=[...t.content].toReversed().find((e)=>e.type==="text"),g=t.content.filter((e)=>e.type==="tool_use"&&m(e).category==="edit"),R=(e)=>{if(e.kind==="codexActivityGroup"){let d=e.blocks.filter((p)=>p.type!=="tool_use"||!r.has(p.name));return d.length===0?null:o(O,{blocks:d},`activity:${A(d[0])}`)}if(e.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${e.kind}`);return o(_,{block:e.block,streaming:Boolean(t.streaming),actions:e.block===w?b:void 0,renderText:M},A(e.block))},y=x===-1?0:v===-1?l.length:v;return o(he,{stateKey:t.id,active:Boolean(t.streaming),startedAt:t.startedAt,durationMs:t.durationMs,providerId:t.providerId,providerIcon:B,work:l.slice(0,y).map(R),answer:l.length>y?l.slice(y).map(R):null,footer:x!==-1&&g.length>0&&(h===void 0?o(yt,{blocks:g}):h(g))})}function fe({text:t,isMostRecentTurn:s=!1,beforeCopy:r,afterCopy:a,time:c}){let{t:u}=n();return C("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:[r,o(xe,{text:t,label:u("actions.copy")}),a,c&&o("span",{className:"codex-user-time ms-1",title:c.full,children:c.short})]})}function T(){let{t}=n();return o("div",{className:"codex-pending-message py-2",role:"status",children:o("span",{className:"codex-activity-running",children:t("message.thinking")})})}function he({work:t,answer:s,footer:r,loading:a=!1,...c}){if(a)return o(T,{});return C("div",{className:"group/am codex-assistant-turn",children:[t.length>0&&o(Pt,{...c,children:t}),s!==null&&(t.length===0?s:o("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:s})),r]})}
|
|
3
|
+
export{Wn,fe,he};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Marked as p}from"marked";import k from"marked-linkify-it";var h=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,m=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,d=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,x={extensions:[{name:"math",level:"block",tokenizer(n){let t=d.exec(n);if(t===null)return;return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0}}},{name:"math",level:"inline",start(n){return n.search(/\$|\\[([]/)},tokenizer(n){let t=d.exec(n);if(t!==null)return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0};let r=/^\\\(([^\n]+?)\\\)/.exec(n);if(r!==null)return{type:"math",raw:r[0],text:r[1].trim(),display:!1};let i=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(n);if(i===null||/^\s|\s$/.test(i[1]))return;return{type:"math",raw:i[0],text:i[1],display:!1}}}]};function
|
|
2
|
-
export{
|
|
1
|
+
import{Marked as p}from"marked";import k from"marked-linkify-it";var h=/<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>/,m=/^<(task-notification|system-reminder|antml:[\w-]+)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/,d=/^(?:\$\$([\s\S]+?)\$\$|\\\[([\s\S]+?)\\\])/,x={extensions:[{name:"math",level:"block",tokenizer(n){let t=d.exec(n);if(t===null)return;return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0}}},{name:"math",level:"inline",start(n){return n.search(/\$|\\[([]/)},tokenizer(n){let t=d.exec(n);if(t!==null)return{type:"math",raw:t[0],text:(t[1]??t[2]).trim(),display:!0};let r=/^\\\(([^\n]+?)\\\)/.exec(n);if(r!==null)return{type:"math",raw:r[0],text:r[1].trim(),display:!1};let i=/^\$(?!\$)((?:\\[^\n]|[^\\$\n])+?)\$(?![\d$])/.exec(n);if(i===null||/^\s|\s$/.test(i[1]))return;return{type:"math",raw:i[0],text:i[1],display:!1}}}]};function Vt(){let n=new p({gfm:!0}),t=k(),r=t.extensions[0],i=r.tokenizer;r.tokenizer=function(o,a){let e=i.call(this,o,a);if(e===void 0)return;if(e.raw.startsWith("<"))return e;let l=/^(?:[a-z][a-z\d+.-]*:\/\/|www\.)[^/?#]+[/?#]/i.exec(e.raw);if(l===null)return e;let c=l[0].length-1,u=e.raw.slice(c).search(/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u);if(u===-1)return e;let s=e.raw.slice(0,c+u),f=e.href.slice(0,e.href.length-(e.raw.length-s.length));return{...e,raw:s,href:f,text:s,tokens:[{type:"text",raw:s,text:s}]}},n.use(x,t);for(let o of["block","inline"])n.use({extensions:[{name:"internalMessage",level:o,...o==="inline"?{start(a){return h.exec(a)?.index}}:{},tokenizer(a){let e=m.exec(a);if(e===null)return;return{type:"internalMessage",raw:e[0]}},renderer(){return""}}]});return n}function ke(n){let t=n.replaceAll(/[\p{Cc}\s]/gu,"");return!/^(?:data|javascript|vbscript):/i.test(t)}
|
|
2
|
+
export{Vt,ke};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as i}from"cn";import{jsx as a}from"react/jsx-runtime";function
|
|
1
|
+
import{cn as i}from"cn";import{jsx as a}from"react/jsx-runtime";function s({className:r,...e}){return a("textarea",{"data-slot":"textarea",className:i("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm",r),...e})}export{s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Tooltip as i}from"@base-ui/react/tooltip";import{cn as l}from"cn";import{jsx as o,jsxs as p}from"react/jsx-runtime";function
|
|
1
|
+
import{Tooltip as i}from"@base-ui/react/tooltip";import{cn as l}from"cn";import{jsx as o,jsxs as p}from"react/jsx-runtime";function Hn({delay:t=0,...e}){return o(i.Provider,{"data-slot":"tooltip-provider",delay:t,...e})}function oe({...t}){return o(i.Root,{"data-slot":"tooltip",...t})}function ie({...t}){return o(i.Trigger,{"data-slot":"tooltip-trigger",...t})}function ae({className:t,side:e="top",sideOffset:a=4,align:d="center",alignOffset:r=0,children:n,...s}){return o(i.Portal,{children:o(i.Positioner,{align:d,alignOffset:r,side:e,sideOffset:a,className:"isolate z-50",children:p(i.Popup,{"data-slot":"tooltip-content",className:l("bg-foreground text-background 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-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 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 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md px-3 py-1.5 text-xs has-data-[slot=kbd]:pr-1.5 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm",t),...s,children:[n,o(i.Arrow,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}export{Hn,oe,ie,ae};
|
|
@@ -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 Ut(i,e){return n??=new s,n.connect(i,e)}
|
|
2
|
+
export{Ut};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function
|
|
3
|
-
export{Mt,
|
|
1
|
+
var jn=["full","compact","codexUI"];function Mt(t){return t==="compact"||t==="codexUI"}var bn=["read","edit","delete","move","search","execute","think","fetch","switch_mode","other"];function c(t){let o=t.split(/[/\\]/).at(-1)??"";return o===""?t:o}function m(t){let o=bn.includes(t.kind)?t.kind:"other",i=t.rawInput,e=(a)=>{let r=i[a];return typeof r==="string"&&r.length>0?r:void 0},n=t.locations?.[0]?.path??e("file_path")??e("notebook_path"),s=n!==void 0?c(n):e("command")?.split(`
|
|
2
|
+
`)[0]??e("pattern")??e("url")??e("query")??e("description");return{category:o,...s===void 0?{}:{target:s},...n===void 0?{}:{filePath:n}}}function Qn(t,o){if(o)return"dot-permission";switch(t){case"completed":return"dot-success";case"failed":return"dot-error";case"in_progress":return"dot-in-progress";case"pending":return"dot-pending";case"interrupted":return"dot-interrupted";default:return console.warn("[acp] unknown tool call status:",t),"dot-pending"}}
|
|
3
|
+
export{jn,Mt,bn,m,Qn};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PreviewCard as i}from"@base-ui/react/preview-card";import{cn as s}from"cn";import{jsx as r}from"react/jsx-runtime";function
|
|
1
|
+
import{PreviewCard as i}from"@base-ui/react/preview-card";import{cn as s}from"cn";import{jsx as r}from"react/jsx-runtime";function je({...e}){return r(i.Root,{"data-slot":"hover-card",...e})}function Qe({...e}){return r(i.Trigger,{"data-slot":"hover-card-trigger",...e})}function Xe({className:e,side:o="bottom",sideOffset:t=4,align:a="center",alignOffset:d=4,...n}){return r(i.Portal,{"data-slot":"hover-card-portal",children:r(i.Positioner,{align:a,alignOffset:d,side:o,sideOffset:t,className:"isolate z-50",children:r(i.Popup,{"data-slot":"hover-card-content",className:s("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 w-64 origin-(--transform-origin) rounded-lg p-4 text-sm shadow-md ring-1 outline-hidden duration-100",e),...n})})})}export{je,Qe,Xe};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{st}from"./chunk-h0dq9ztv.js";import{L,et,A,_}from"./chunk-6p5hgnpq.js";import{cn as v}from"cn";import{XIcon as E}from"lucide-react";import{useCallback as p,useEffect as D,useMemo as X,useRef as N,useState as b}from"react";import{jsx as i,jsxs as j}from"react/jsx-runtime";function Je({open:l,onOpenChange:y,url:h,filename:M,scale:d,onScaleChange:f,containerRef:z,containerClassName:H,dialogContentClassName:P,imageClassName:T}){let g=p((e)=>Math.min(4,Math.max(0.25,e)),[]),[I,O]=b(1),o=g(d??I),R=N(null),s=z??R,S=N(null),[m,x]=b({width:0,height:0}),[C,W]=b({width:0,height:0}),w=p((e)=>{let n=g(e);if(typeof f==="function"){f(n);return}O(n)},[f,g]);D(()=>{if(!l)return;if(!h)return;if(typeof d==="number")return;O(1)},[l,h,d]),D(()=>{if(!l)return;let e=s.current;if(!e)return;let n=()=>{x({width:e.clientWidth,height:e.clientHeight})};n();let t=new ResizeObserver(n);return t.observe(e),()=>{t.disconnect()}},[s,l]);let Z=p(()=>{w(1)},[w]),r=X(()=>{let{width:e,height:n}=C,{width:t,height:a}=m;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),u=e*c,k=n*c;return{width:u*o,height:k*o}},[o,C,m]);if(!h)return null;return i(L,{open:l,onOpenChange:y,children:j(A,{className:v("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]!",P),showCloseButton:!1,children:[i(_,{className:"sr-only",children:M||"Image preview"}),i(et,{"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(E,{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=S.current,u=a&&c?st({container:a,target:c,clientX:e.clientX,clientY:e.clientY,currentScale:o,nextScale:t}):null;if(w(t),a&&u)requestAnimationFrame(()=>{a.scrollTo(u)})},className:v("h-full w-full scrollbar-thin overflow-auto",H),children:i("div",{className:"grid min-h-full min-w-full place-items-center",style:{width:Math.max(m.width,r.width),height:Math.max(m.height,r.height)},children:i("div",{className:"shrink-0",children:i("img",{alt:M||"image preview",className:v("block object-contain select-none",T),decoding:"async",draggable:!1,ref:S,onDoubleClick:Z,onLoad:(e)=>{let n=e.currentTarget;W({width:n.naturalWidth,height:n.naturalHeight});let t=s.current;if(t&&(t.clientWidth||t.clientHeight))x({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{Je};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function Oe(t){return Object.entries(t.properties??{}).map(([n,e])=>({key:n,property:e}))}function se(t){let{title:n,description:e}=t;return{title:n??void 0,description:e??void 0}}function w(t){return t.type==="array"}function W(t){return(w(t)?t.items?.oneOf??[]:t.oneOf??[]).map((e)=>{let i=e,r=i.const??i.title??"";return{value:r,label:i.title??r,...i.description?{description:i.description}:{},...i._meta?.alwith?.preview?{preview:i._meta.alwith.preview}:{}}})}
|
|
2
|
+
export{Oe,se,w,W};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{dt}from"./chunk-9ab18v07.js";async function m(r){try{let i=await(await fetch(r)).blob();if(typeof createImageBitmap==="function")return(await createImageBitmap(i)).close(),!0;return await new Promise((a)=>{let o=new Image;o.onload=()=>a(!0),o.onerror=()=>a(!1),o.src=r})}catch{return!1}}async function Ze(r){let n=await Promise.all(r.map(async({id:a,lastModified:o,sourcePath:p,...t})=>{let e=t.url;if(t.url.startsWith("blob:")){let s=await dt(t.url,t.mediaType);if(s===null)return null;e=s}let l=t.mediaType.toLowerCase().startsWith("image/"),c=e.startsWith("data:image/");if(l&&c&&!await m(e))return null;let u=e.startsWith("data:")?e.slice(5,e.indexOf(";")):t.mediaType;return{...t,url:e,mediaType:u}})),i=n.filter((a)=>a!==null);return{files:i,rejectedCount:n.length-i.length}}
|
|
2
|
+
export{Ze};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-801v0awm.js";import{t,V}from"./chunk-vw2hv2sq.js";import{isEmbeddedResource as E,isImage as N,isResourceLink as T}from"@alwith/api";import{DownloadIcon as L,FileIcon as y,ImageOffIcon as F,LoaderCircleIcon as U}from"lucide-react";import{useState as I}from"react";import{jsx as i,jsxs as r}from"react/jsx-runtime";function an(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 p({block:a,generated:o=!1}){let n=t(),[d,f]=I(!1),[C,R]=I(null);if(T(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=an(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(y,{}),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(!E(a)&&!N(a))return null;let s=N(a)?{uri:a.uri??`image.${a.mimeType.split("/")[1]??"png"}`,mimeType:a.mimeType,blob:a.data}:a.resource,l=an(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(y,{}),i("span",{className:"truncate",children:l})]})]});let m=`data:${s.mimeType??"application/octet-stream"};base64,${s.blob}`,g=s.mimeType?.toLowerCase().startsWith("image/")&&C!==m,{openImage:w,openImageGallery:x}=n,v=x?()=>x([{src:m,alt:l,uri:s.uri}],0):w&&(()=>w(m)),c=o&&g,B=async()=>{f(!0);try{if(n.saveFile)await n.saveFile(l,s.blob);else b(l,m)}catch(u){V(n,u)}finally{f(!1)}},h=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:()=>R(m)});return r("div",{className:c?"codex-generated-image":"flex max-w-full min-w-0 flex-col items-start gap-1",children:[g&&(v===void 0?h: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:v,children:h})),r(e,{variant:c?"secondary":"link",size:c?"icon":"sm",className:c?"codex-generated-image-download":"max-w-full min-w-0",disabled:d,title:n.t("timeline.download",{name:l}),"aria-label":n.t("timeline.download",{name:l}),onClick:()=>{B()},children:[d?i(U,{className:"motion-safe:animate-spin"}):i(L,{}),!c&&i("span",{className:"truncate",children:l})]})]})}
|
|
2
|
+
export{an,p};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-5grywgpq.js";import{textOf as S,turns as E}from"@alwith/api";import{codexMessageError as _,nativeTurnId as m}from"@nyssance/codex-acp-v2/client";function Cn(t){return t.kind==="tool"&&t.name==="mcp_startup"}function j(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 Kt(t){return t.user===null&&t.items.length>0&&t.items.every((e)=>e.kind==="assistant"&&w(e))}function T(t,e){let n=t.work.at(-1),r=n?.kind==="activity"?n.items.at(-1):void 0;if(n?.kind==="activity"&&r!==void 0&&t.items.indexOf(e)===t.items.indexOf(r)+1){n.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 r=n.get(t.id);if(r===void 0)throw Error(`Grouped tool is missing from the session: ${t.id}`);e.push(r);for(let i of t.children)M(i,e,n)}function K(t,e,n){switch(e.kind){case"user":break;case"assistant":{if(_(e)!==null){let i=m(e),u=t.errors.findIndex((c)=>i!==null&&m(c)===i);if(u===-1)t.errors.push(e);else t.errors[u]=e;break}let r=j(e);if(a(e._meta).length>0||r==="final_answer")t.final.push(e);else if(r==="commentary"||w(e)||r===null&&n)t.work.push({kind:"text",key:`text:${e.id}`,item:e});else t.final.push(e);break}case"thought":T(t,e);break;case"tool":if(T(t,e),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 Gt(t,e=[],n=[]){let r=new Map(e.map((o)=>[o.key,o])),i=new Map(t.items.filter((o)=>o.kind==="tool").map((o)=>[o.id,o])),u={...t,items:t.items.filter((o)=>!Cn(o))},c=new Map(n.map((o,s)=>[o.turnId,s])),d=[],p=[d],y,I=null;for(let o of u.items){let s=m(o),f=c.get(s??"");if(s!==null&&I!==null&&s!==I||f!==void 0&&y!==void 0&&f>y+1)d=[],p.push(d);if(d.push(o),s!==null||o.kind==="user")I=s;if(f!==void 0)y=f}return p.flatMap((o)=>E({...u,items:o})).map((o)=>{let s=o.prompt===null?[]:[o.prompt];for(let l of o.entries)M(l,s,i);let f=s[0];if(f===void 0)throw Error("A turn without items");let g=`turn:${f.kind}:${f.id}`,b=o.endedAt??Math.max(...s.map((l)=>l.at)),k=r.get(g);if(k!==void 0&&P(k.items,s)&&k.endedAt===b)return k;let x={key:g,user:o.prompt,work:[],final:[],errors:[],edits:[],startedAt:o.startedAt??f.at,endedAt:b,replayed:s.every((l)=>l.replayed),items:s},v=s.findLastIndex((l)=>l.kind!=="user"&&l.kind!=="compaction");return s.forEach((l,A)=>K(x,l,A<v)),x})}function P(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function h(t){return S(t.content)}function U(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"historyInterrupted"in n&&n.historyInterrupted===!0})}function Te(t){return t.items.some((e)=>{let n=e._meta?.codex;return typeof n==="object"&&n!==null&&"turnInterrupted"in n&&n.turnInterrupted===!0})}function Wt(t){let e=(i)=>{for(let u of t.items){let c=u._meta?.codex;if(typeof c!=="object"||c===null)continue;let d=c[i];if(typeof d==="number"&&Number.isFinite(d)&&d>=0)return d}return},n=e("workDurationMs"),r=e("turnDurationMs");return{durationMs:n??r,durationKind:n===void 0&&r!==void 0?"total":"work",startedAt:e("workStartedAt")}}function jt(t,e,n){if(n?.user==null)return!1;let r=e.items.map(m).find((u)=>u!==null),i=m(n.user);if(r!==void 0&&i!==null)return r===i;return 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 Qt(t,e){if(t.state==="idle")return;let n=e.length-1;while(n>0){let r=e[n];if(r.items.some((i)=>i.kind!=="user"))break;if(!jt(t,e[n-1],r))break;n--}return e[n]?.key}function Xt(t,e,n){let r=n,i=n;while(r>0&&jt(t,e[r-1],e[r]))r--;while(i+1<e.length&&jt(t,e[i],e[i+1]))i++;let u=e.slice(r,i+1),c=u.findLast((d)=>d.items.some((p)=>p.kind!=="user"))??u[0];return{continued:e[n]!==c,items:u.flatMap((d)=>d.items),edits:u.flatMap((d)=>d.edits),startedAt:u[0].startedAt}}
|
|
2
|
+
export{Cn,Kt,Gt,h,U,Te,Wt,jt,Qt,Xt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
export{
|
|
1
|
+
function st({container:i,target:f,clientX:e,clientY:n,currentScale:r,nextScale:s}){if(r<=0||s<=0)return null;let o=i.getBoundingClientRect(),t=f.getBoundingClientRect();if(t.width===0||t.height===0)return null;let h=e>=t.left&&e<=t.right&&n>=t.top&&n<=t.bottom,l=h?(e-t.left)/t.width:0.5,a=h?(n-t.top)/t.height:0.5,c=t.width/r,g=t.height/r,m=c*s,u=g*s,d=e-o.left,p=n-o.top,P=i.scrollLeft+(t.left-o.left)+t.width/2,b=i.scrollTop+(t.top-o.top)+t.height/2,C=(l-0.5)*m,x=(a-0.5)*u;return{left:Math.max(0,P+C-d),top:Math.max(0,b+x-p)}}
|
|
2
|
+
export{st};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Separator as o}from"@base-ui/react/separator";import{cn as i}from"cn";import{jsx as e}from"react/jsx-runtime";function
|
|
1
|
+
import{Separator as o}from"@base-ui/react/separator";import{cn as i}from"cn";import{jsx as e}from"react/jsx-runtime";function B({className:a,orientation:r="horizontal",...t}){return e(o,{"data-slot":"separator",orientation:r,className:i("bg-border shrink-0 data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...t})}export{B};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var z=/[\\/._\- ]/;function h(r,n){if(n===0)return!0;let s=r[n-1];if(z.test(s))return!0;let c=r[n];if(s===s.toLowerCase()&&c!==c.toLowerCase())return!0;return!1}function pe(r,n){if(!n)return{score:0,indices:[]};let s=r.toLowerCase(),c=n.toLowerCase(),i=[],t=0,e=0,u=-2;for(let l of c.split("")){let o=-1;while(t<s.length){if(s[t]===l){o=t;break}t++}if(o<0)return null;if(e+=1,o===u+1)e+=4;if(h(r,o))e+=5;let f=r.lastIndexOf("/");if(f!==-1&&o>f)e+=2;i.push(o),u=o,t=o+1}if(e-=Math.floor(r.length/50),r.includes(n))e+=3;return{score:e,indices:i}}function lt(r,n,s,c=100){if(!n)return r.slice(0,c).map((t)=>({item:t,score:0,indices:[]}));let i=[];for(let t of r){let e=pe(s(t),n);if(!e)continue;i.push({item:t,score:e.score,indices:e.indices})}return i.sort((t,e)=>e.score-t.score),i.slice(0,c)}
|
|
2
|
+
export{pe,lt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i}from"./chunk-azmqtycn.js";import{t}from"./chunk-vw2hv2sq.js";import{p}from"./chunk-fgsd4fsd.js";import{ContentBlock as s}from"@agentclientprotocol/sdk/experimental/v2/unstable";import{isEmbeddedResource as u,isResourceLink as d}from"@alwith/api";import{jsx as n}from"react/jsx-runtime";function c({block:e,streaming:o}){let r=t();if(s.isText(e)){if(e.text.length===0)return null;return n("div",{className:"codex-assistant-message",children:n(i,{text:e.text,streaming:o})})}if(s.isImage(e))return n(p,{block:e,generated:!0});if(s.isAudio(e))return n("audio",{controls:!0,src:`data:${e.mimeType};base64,${e.data}`});if(d(e)||u(e))return n(p,{block:e,generated:!0});return n("div",{className:"text-muted-foreground",children:r.t("timeline.unsupportedContent",{type:e.type})})}function Q({content:e,messageId:o,streaming:r}){return e.map((a,m)=>n(c,{block:a,streaming:r},`${o}:${m}`))}
|
|
2
|
+
export{Q};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as a}from"cn";import{jsx as
|
|
1
|
+
import{cn as a}from"cn";import{jsx as l}from"react/jsx-runtime";function o({className:e,...t}){return l("label",{"data-slot":"label",className:a("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}export{o};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{Ut}from"./chunk-d675nr2b.js";import{Ce,qt}from"./chunk-ypvjzkfb.js";import{ke}from"./chunk-bkbemt8g.js";import{decodeHTMLAttribute as v,decodeHTMLStrict as I}from"entities";import oe from"katex";import{CheckIcon as z,ChevronLeftIcon as ae,ChevronRightIcon as se,CopyIcon as ie,DownloadIcon as ce,FileIcon as de,LinkIcon as le,MailIcon as ue,XIcon as me}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as ge,createElement as U,memo as B,startTransition as fe,useContext as he,useEffect as p,useLayoutEffect as D,useMemo as X,useRef as k,useState as h}from"react";import{jsx as a,jsxs as g,Fragment as te}from"react/jsx-runtime";var G=ge(null);function C(){let e=he(G);if(e===null)throw Error("Markdown host is missing");return e}var pe=80,A=/\[([^\]\n]+)\]\(([^)\n]+)$/,we=/(^|\n)[^\S\n]*!\[[^\]\n]*(?:\](?:\([^\n]*)?)?\s*$/,be=/\uE200[^\uE201]*$/,xe=4,Te=new Set("7zipx.accdb.asarpack.asciidoc.backup.backupdb.bundle.ccproj.cdrdao.code-workspace.config.debugin.deploy.design.docbook.dockerfile.dockerignore.editorconfig.eslintignore.gitattributes.gitignore.gitignore.gitkeep.gradle.graphqls.ignore.ipynb.keychain.keynote.licensee.lockfile.lockfile.markdown.markup.matlab.mkdocs.models.module.msstyle.notebook.npmignore.output.packageinfo.parquet.pickle.plistx.policy.postcssrc.prettierignore.projectfile.python.readme.review.robots.schema.search.series.settingsjson.shader.sqlite.sqlite3.storyboard.styles.system.target.terraform.update.vertex.webapp.webdoc.webpackrc.widget.workspace.xcodeproj.yarnlock".split("."));function y(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function J(e,n,t){if(t.length!==1)return!1;return e[n-1]===t||e[n+1]===t}function ve(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)&&!J(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function ye(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!y(e,t)&&!J(e,t,n))return t;return-1}function Ne(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!y(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function Me(e){return Ne(e,"```")%2===1}function V(e){let n=0;for(let t=0;t<e.length;){if(e.startsWith("```",t)){for(t+=3;t<e.length&&!e.startsWith("```",t);)t+=1;if(t<e.length)t+=3;continue}if(e[t]==="`"&&!y(e,t))n+=1;t+=1}return n%2===1}function Le(e){return e.endsWith(`
|
|
2
|
+
`)?`${e}\`\`\``:`${e}
|
|
3
|
+
\`\`\``}function H(e,n){if(!e.includes(n)||ve(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>xe&&!Te.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(be,"");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:")?ue:o?de:le;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=Ut(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(ie,{})})})]}),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(ae,{})}),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(ce,{})}),a("button",{type:"button","aria-label":"Next image",disabled:e.index===e.images.length-1,onClick:()=>n({...e,index:e.index+1}),children:a(se,{})}),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(me,{})})]})]})}function Be(e){return C().preview?a(te,{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(te,{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 Xe({value:e,display:n}){let t=k(null);return D(()=>{if(t.current===null)throw Error("Codex math root is not mounted");oe.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 Ge=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,pe)}function Je(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(Je(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),ne(r,`${n}-${o}-${s}`)})}function Ve(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 Ze(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 Ye(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(!ke(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 ne(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 ke(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 Ze(e,n);case"list_item":return Ve(e,n);case"table":return Ye(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(Xe,{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 Qe({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=T;try{return T={cursor:t,runs:r,generation:o},ne(e,n)}finally{T=s}}var en=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),re={token:M,tokenKey:`root-${L}-${S}`,offset:P,visibleText:F};return P+=F.length,re})},[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<Ge):[],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(Qe,{token:l.token,tokenKey:l.tokenKey,offset:l.offset,runs:f.runs,generation:N},l.tokenKey))})}),nn=B(function({text:n,isStreaming:t}){let r=k(null),[o,s]=h(()=>Ce(n,t)),[i,c]=h(null);if(p(()=>{let d=qt((u)=>{fe(()=>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(en,{result:o})});function Ot({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(nn,{text:r?o:e,isStreaming:r})})}
|
|
7
|
+
export{Ot};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{ve}from"./chunk-4svwa5p8.js";import{t}from"./chunk-vw2hv2sq.js";import{isDiffEntry as p}from"@alwith/api";import{jsx as f,jsxs as g,Fragment as h}from"react/jsx-runtime";function fn(o,s){let e=o.split(/^(?=diff --git )/m).filter((i)=>i.length>0);if(e.length<=1)return o;return e.find((i)=>{let a=i.split(`
|
|
2
|
+
`,1)[0]??"";return a.endsWith(` b/${s}`)||a.endsWith(` ${s}`)||a.includes(`/${s} `)})??o}function hn(o){let s=new Map,e=null;for(let n of o.split(`
|
|
3
|
+
`)){if(n.startsWith("diff --git ")){e=null;continue}if(n.startsWith("+++ ")){let i=n.slice(4).trim(),a=i==="/dev/null"?null:i.replace(/^b\//,"");if(a!==null)e={additions:0,deletions:0},s.set(a,e);continue}if(n.startsWith("--- ")){let i=n.slice(4).trim();if(i!=="/dev/null"&&e===null)e={additions:0,deletions:0},s.set(i.replace(/^a\//,""),e);continue}if(e===null)continue;if(n.startsWith("+"))e.additions+=1;else if(n.startsWith("-"))e.deletions+=1}return s}function u(o,s){let e=s.replaceAll("\\","/");for(let[n,i]of o)if(e===n||e.endsWith(`/${n}`))return i;return{additions:0,deletions:0}}function vn(o){let s=new Map;for(let e of o)for(let n of e.content){if(!p(n))continue;let i=n.patch?hn(n.patch.text):new Map;for(let a of n.changes){let r=typeof a.path==="string"?a.path:null;if(r===null)continue;let c=u(i,r),d=n.patch?fn(n.patch.text,r):"",l=s.get(r);if(l)l.additions+=c.additions,l.deletions+=c.deletions,l.patch=l.patch?`${l.patch}
|
|
4
|
+
${d}`:d;else s.set(r,{path:r,patch:d,...c})}}return[...s.values()]}function bt({items:o}){let s=t(),{openDiff:e,FileIcon:n}=s;return f(ve,{files:vn(o),onOpen:e===void 0?void 0:(i)=>e({path:i.path,patch:i.patch}),renderPath:n===void 0?void 0:(i)=>g(h,{children:[f(n,{path:i.path,className:"codex-edited-file-icon"}),f("span",{className:"codex-edited-file-name",children:i.path})]})})}
|
|
5
|
+
export{fn,hn,vn,bt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function*te(n,e){if(e.length===0)return;let r=new RegExp(e.replaceAll(/[.*+?^{}()|[\]\\$]/g,String.raw`\$&`),"giu");for(let t of n.matchAll(r))yield{start:t.index,end:t.index+t[0].length}}function En(n,e){if(e.length===0)return[];let r=[];for(let{turnKey:t,segments:o}of n){let c=0;for(let s of o)for(let a of te(s,e))r.push({turnKey:t,occurrenceInTurn:c}),c+=1}return r}
|
|
2
|
+
export{te,En};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$t}from"./chunk-9dsa5vm7.js";import{useCallback as Te,useEffect as P,useLayoutEffect as xe,useMemo as Q,useRef as I,useState as E}from"react";import"@alwith/module-chat/navigation-rail.css";import{jsx as T,jsxs as Ne,Fragment as Me}from"react/jsx-runtime";var ye=4,me=10;function we(h,x){let v=new Map(x.flatMap((c)=>c.itemIds.map((w)=>[w,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 O=Math.max(-1,...x.map((c)=>c.key))+1,B=new Set,n=[];for(let[c,w]of h.entries()){let S=v.get(w),m=n.at(-1);if(!m||S!==void 0&&S!==m.key||S===void 0&&m.itemIds.length>=64&&p[c]!==m.key){let y=S!==void 0&&!B.has(S)?S:O++;m={key:y,startIndex:c,itemIds:[]},n.push(m),B.add(y)}m.itemIds.push(w)}return n}function ge(h,x){if(h.size!==x.size)return!1;for(let v of h)if(!x.has(v))return!1;return!0}function zt({audio:h,beforeReveal:x,ensureItemMounted:v,items:p,onPreviewItem:C,renderPreview:O,onRevealError:B,scrollRoot:n,targetTopMarginPx:c=16}){let[w,S]=E(()=>{let e=p.at(-1);return new Set(e===void 0?[]:[e.id])}),[m,y]=E(null),[W,A]=E(null),[X,U]=E(!1),[_,fe]=E(()=>new Set),[pe,ve]=E(!0),[be,j]=E(null),{installUnlock:Z,preload:ee,playSequence:te}=h,K=I(null),M=I(null),R=I(!1),H=I(null),L=I(0),N=I(null),G=I(new Set),V=Q(()=>p.map((e)=>e.id).join("\x00"),[p]),F=I(p);F.current=p;let ne=I(_),ie=I(w),re=I({itemIdsKey:V,scrollRoot:n});if(re.current.scrollRoot!==n)L.current+=1,re.current={itemIdsKey:V,scrollRoot:n};let g=Q(()=>v===void 0?p.filter((e)=>_.has(e.id)):p,[v,p,_]),se=Q(()=>g.map((e)=>({inputTokens:e.inputTokens,outputTokens:e.outputTokens})),[g]),z=I({ids:"",groups:[]}),ae=g.map((e)=>e.id).join("\x00");if(z.current.ids!==ae)z.current={ids:ae,groups:we(g.map((e)=>e.id),z.current.groups)};P(()=>Z(),[Z]),P(()=>()=>{if(L.current+=1,N.current!==null)clearTimeout(N.current)},[]),P(()=>{y(null),U(!1),A(null),M.current=null,R.current=!1,H.current=null,j(null),G.current.clear()},[n]),P(()=>{ee()},[ee]),P(()=>{if(n===null)return;let e=new Set,t=new Map,i=new Set(F.current.map((o)=>o.id)),r=()=>{let o=new Set(t.values()),d=F.current.filter((f)=>o.has(f.id)).map((f)=>f.id),u=d.findIndex((f)=>e.has(f));if(u===-1)return;let b=u;for(let f=u+1;f<d.length;f++)if(e.has(d[f]))b=f;let k=new Set(d.slice(u,b+1));if(ge(ie.current,k))return;ie.current=k,S(k)},s=new IntersectionObserver((o)=>{for(let d of o){let u=t.get(d.target);if(d.isIntersecting)e.add(u);else e.delete(u)}r()},{root:n,rootMargin:`-${c}px 0px 0px 0px`}),a=()=>{let o=new Set,d=new Set;for(let u of n.querySelectorAll("[data-content-search-unit-key]")){let b=u.dataset.contentSearchUnitKey;if(b===void 0||!i.has(b)||o.has(b))continue;o.add(b);let k=u.closest("[data-turn-key]"),f=k===null||d.has(k)?u:k;if(d.add(f),t.has(f))continue;t.set(f,b),s.observe(f)}for(let u of t.keys()){if(d.has(u))continue;s.unobserve(u),e.delete(t.get(u)),t.delete(u)}if(r(),ge(ne.current,o))return;ne.current=o,fe(o)};a();let l=new MutationObserver((o)=>{if(o.some((u)=>[...u.addedNodes,...u.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))))a()});return l.observe(n,{childList:!0,subtree:!0}),()=>{l.disconnect(),s.disconnect()}},[V,n,c]);let J=g.find((e)=>w.has(e.id))?.id??g.at(-1)?.id;xe(()=>{let e=K.current;if(e===null||M.current!==null||J===void 0)return;let t=e.querySelector(`[data-timeline-user-message-navigation-item-id="${CSS.escape(J)}"]`);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},[J,V]),P(()=>{let e=n?.querySelector("[data-timeline-user-message-navigation-content]");if(!n||!e)return;let t=()=>{let r=n.getBoundingClientRect(),s=e.getBoundingClientRect();if(r.width===0||s.width===0)return;let a=n.offsetWidth>0?r.width/n.offsetWidth:1;ve((s.left-r.left)/a>=48)},i=new ResizeObserver(t);return i.observe(n),i.observe(e),t(),()=>i.disconnect()},[n]);let Ie=Te(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)}"]`),s=r(),a=s!==null&&n.clientHeight>0&&s.closest("[data-turn-key]")!==null&&Math.abs(s.getBoundingClientRect().top-n.getBoundingClientRect().top)>n.clientHeight*2;if((s===null||a)&&v!==void 0){if(t==="instant"&&e.isLoaded===!1)return;s=await v(e,()=>L.current===i)??r(),t="instant"}if(L.current!==i)return;if(s===null)return;let l=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;s.scrollIntoView({behavior:l?"instant":t,block:"start"}),s.querySelector("[data-user-message-bubble], [data-composer-attachment-pill]")?.animate?.([{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)"},{backgroundColor:"color-mix(in srgb, var(--foreground) 14%, transparent)",offset:0.35},{backgroundColor:"transparent"}],{duration:l?0:1000,easing:"cubic-bezier(0.23, 1, 0.32, 1)"})},[x,v,n]);if(g.length<ye||!pe)return null;let Y=()=>{if(N.current!==null)clearTimeout(N.current);N.current=null},oe=(e,t=!1)=>{if(Y(),C===void 0||e.isLoaded!==!1||G.current.has(e.turnKey))return;let i=()=>{N.current=null,G.current.add(e.turnKey),C(e).catch(()=>G.current.delete(e.turnKey))};if(t)i();else N.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,ue=(e,t="smooth")=>{Ie(e,t).catch((i)=>{if(B)B(i);else throw i})},le=g.findIndex((e)=>e.id===(W??be)),de=K.current,he=m===null||!de?.contains(m.button)?0:Se(de,m.button),ce=(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,s=g.findIndex((a)=>a.id===r);return{button:t,item:g[s],index:s}},D=(e)=>{let t=M.current;if(t?.pointerId!==e.pointerId)return;if(M.current=null,A(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($t,{open:X,onOpenChange:U,side:"inline-end",sideOffset:0,align:"center",alignOffset:he,trigger:T("div",{ref:K,"data-timeline-user-message-navigation-rail-list":!0,"data-scrubbing":W===null?void 0:"",className:"timeline-user-message-navigation-rail-list",onPointerEnter:()=>{H.current=null},onPointerDown:(e)=>{if(e.button!==0)return;Y();let t=ce(e.target instanceof Element?e.target:null);if(t===null)return;R.current=!1,M.current={pointerId:e.pointerId,itemId:t.item.id,itemIndex:t.index,captureTarget:t.button},t.button.setPointerCapture(e.pointerId),A(t.item.id),y(t),U(!0)},onPointerMove:(e)=>{let t=M.current;if(t===null){let l=ce(e.target instanceof Element?e.target:null);if(l!==null){j(l.item.id);let o=H.current;if(o!==null&&o!==l.index)te(o,l.index,se);H.current=l.index,y((d)=>d?.item.id===l.item.id?d:l),oe(l.item)}return}if(t.pointerId!==e.pointerId)return;if((e.buttons&1)===0){D(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)/me))),a={button:e.currentTarget.querySelectorAll("[data-timeline-user-message-navigation-item-id]")[r],item:g[r],index:r};if(a.item.id===t.itemId)return;te(t.itemIndex,a.index,se),H.current=a.index,M.current={...t,itemId:a.item.id,itemIndex:a.index},R.current=!0,A(a.item.id),y(a),ue(a.item,"instant")},onPointerUp:D,onPointerCancel:D,onLostPointerCapture:D,onPointerLeave:()=>{if(Y(),j(null),H.current=null,M.current===null&&!X)y(null)},children:T("div",{className:"flex flex-col",children:z.current.groups.map((e)=>T("div",{className:"flex w-9 shrink-0 flex-col [content-visibility:auto]",style:{height:e.itemIds.length*me},children:g.slice(e.startIndex,e.startIndex+e.itemIds.length).map((t,i)=>{let r=e.startIndex+i,s=Math.abs(r-le),a=le===-1||s>3?void 0:[1,0.7,0.4,0.2][s];return T("button",{type:"button","data-timeline-user-message-navigation-item-id":t.id,"data-scrub-target":W===t.id?"":void 0,"aria-current":w.has(t.id)?"true":void 0,"aria-label":`Jump to user message ${r+1}`,className:"timeline-user-message-navigation-row",onClick:(l)=>{if(R.current){R.current=!1;return}let o={button:l.currentTarget,item:t,index:r};y(o),U(!0),ue(t)},onFocus:(l)=>{oe(t,!0),y({button:l.currentTarget,item:t,index:r}),U(!0)},children:T("span",{className:"flex h-0.5 w-[30px] items-center",children:T("span",{className:"timeline-user-message-navigation-marker",style:a===void 0?void 0:{"--marker-progress":a}})})},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:O?O(q):Ne(Me,{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 Se(h,x){let v=h.getBoundingClientRect(),p=x.getBoundingClientRect();return p.top+p.height/2-(v.top+v.height/2)}
|
|
2
|
+
export{zt};
|
|
@@ -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 P({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{P};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ut,N,ge,mt,pt,gt}from"./chunk-nxarfyj2.js";import{forwardRef as pe,useCallback as K,useEffect as me,useImperativeHandle as Re,useLayoutEffect as w,useMemo as re,useRef as s,useState as F}from"react";import{jsx as R,jsxs as ie}from"react/jsx-runtime";var He=12,j=2,q=800,fe=new Map;function Te({turnKey:W,heightPx:x,placeholder:_=!1,deferUntilReady:n=!1,observe:H,onReady:L,children:z}){let h=s(null),[T,U]=F(!1),G=K((m)=>{h.current=m,H(W,m)},[H,W]);return w(()=>{let m=h.current;if(m===null)throw Error("Codex turn element is missing");let b=()=>{L(m),U(!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]),ie("div",{style:T?void 0:{position:"relative",height:x,overflow:"hidden"},children:[R("div",{ref:G,className:"[&_[data-virtualized-turn-content]]:[content-visibility:visible]","data-turn-key":W,"aria-busy":!T||void 0,style:!T&&!_&&n?{visibility:"hidden"}:void 0,"data-turn-ready":T?"":void 0,children:z}),!T&&!_&&n&&R("div",{"aria-hidden":"true",className:"codex-turn-loading",children:ie("div",{className:"codex-turn-loading-lines",children:[R("span",{}),R("span",{}),R("span",{})]})})]})}var ct=pe(function({entries:x,renderTurn:_,scrollElement:n,sessionKey:H,leadingContent:L,leadingInsetPx:z=0,preserveViewport:h=!1},T){let U=s(null),[G,m]=F(z),b=L!==void 0&&L!==null;w(()=>{let e=U.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=re(()=>fe.get(H),[H]),[J,Q]=F(()=>d?.turnHeightsByKey??{}),i=re(()=>ut({entries:x,gapPx:He,measuredHeightsByKey:J,leadingInsetPx:b?G:z}),[x,J,b,G,z]),xe=re(()=>{let e=N({distanceFromBottomPx:d?.distanceFromBottomPx??0,layout:i,overscanCount:j,viewportHeightPx:q}),t=d?.renderedWindow;if(t===void 0||t===null)return e;return ge({anchorKey:t.anchorKey,layout:i,previousRange:{startIndex:0,endIndex:Math.min(t.count,e.endIndex-e.startIndex)}})??e},[d,i]),[M,oe]=F(xe),[y,ue]=F(q),[c,ae]=F(null),k=s(d?.distanceFromBottomPx??0),S=s(M),se=s(i.turnKeys),l=s(J),E=s(i),ce=s(i),P=s(new Map),v=s(null),C=s(null),D=s(null),O=s(new Map),Y=s(!1),de=s(()=>{}),A=s(null),le=K(()=>{if(!h||n===null||v.current!==null||A.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=E.current.turnIndexByKey.get(r),B=g===void 0?a.height:E.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)A.current={key:o.key,element:o.element,top:o.rect.top-e.top,scrollTop:n.scrollTop}},[h,n]),Z=s(le);Z.current=le;let p=K((e,t)=>{let o=Math.min(e,i.totalHeightPx),r=N({distanceFromBottomPx:o,layout:i,overscanCount:j,viewportHeightPx:t}),u=S.current,a=u.startIndex<=r.startIndex&&u.endIndex>=r.endIndex?u:r;if(k.current=o,S.current=a,se.current=i.turnKeys,ue(t),a!==u)oe(a)},[i]),V=K((e)=>{let t=Math.max(0,e.scrollHeight-i.totalHeightPx);return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop-t)},[i.totalHeightPx]),ye=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;Z.current();let r={...l.current,[t]:o};l.current=r,Q(r)},[]),ee=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);O.current.set(r,u)}if(D.current!==null||O.current.size===0)return;D.current=requestAnimationFrame(()=>{D.current=null;let t=[...O.current].filter(([r,u])=>l.current[r]!==u);if(O.current.clear(),t.length===0)return;Z.current();let o={...l.current,...Object.fromEntries(t)};l.current=o,Q(o)})}),C.current},[]),ve=K((e,t)=>{let o=P.current.get(e);if(o!==void 0)ee().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),ee().observe(t)},[ee]);me(()=>()=>{if(C.current?.disconnect(),D.current!==null)cancelAnimationFrame(D.current);O.current.clear(),C.current=null,P.current.clear()},[]),w(()=>{de.current=()=>{if(n===null)return;let e=V(n);if(v.current!==null){k.current=e,ue(n.clientHeight||q);return}p(e,n.clientHeight||q)}},[V,n,p]),w(()=>{if(n===null)return;if(!Y.current){Y.current=!0;let o=d?.distanceFromBottomPx??0;n.scrollTo({behavior:"instant",top:Math.max(0,o>0?E.current.totalHeightPx-n.clientHeight-o:n.scrollHeight-n.clientHeight)})}let e=()=>de.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,Q(g);return}let o=c.getTargetElement(e)??e,r=e.getBoundingClientRect(),u=o.getBoundingClientRect(),a=gt({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||q),queueMicrotask(()=>{if(v.current!==c)return;c.complete(),v.current=null,ae(null)})},[i,c,n,p]),w(()=>{let e=ce.current;if(ce.current=i,E.current=i,n===null||c!==null){A.current=null;return}let t=A.current;A.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(V(n),n.clientHeight);return}let r=k.current;if(h&&e!==i&&Y.current)r=Math.max(0,e.totalHeightPx-n.clientHeight-n.scrollTop);if((r>24||h)&&e!==i){let u=V(n);if(u<=96&&!h){p(u,y);return}let a=N({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=mt({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,V,n,p,y,h]),w(()=>{S.current=M},[M]),me(()=>()=>{v.current?.complete(),v.current=null;let e=S.current,o=E.current.turnKeys[e.startIndex];fe.set(H,{distanceFromBottomPx:k.current,renderedWindow:o===void 0?null:{anchorKey:o,count:e.endIndex-e.startIndex},turnHeightsByKey:l.current})},[H]),Re(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=pt({layout:i,turnKey:e,viewportHeightPx:y});if(a===null)throw Error(`Codex virtual turn is missing: ${e}`);let g=N({distanceFromBottomPx:a,layout:i,overscanCount:j,viewportHeightPx:y});return S.current=g,oe(g),new Promise((B)=>{let f={align:o.align,complete:B,getTargetElement:t,turnKey:u};v.current=f,ae(f)})}}),[i,y]);let I=M,X=se.current;if(!(X===i.turnKeys||X.length===i.turnKeys.length&&X.every((e,t)=>e===i.turnKeys[t]))){let e=X[M.startIndex];I=(e===void 0?null:ge({anchorKey:e,layout:i,previousRange:M}))??N({distanceFromBottomPx:k.current,layout:i,overscanCount:j,viewportHeightPx:y})}let te=x.length-1,he=x[te],ne=x.slice(I.startIndex,Math.min(I.endIndex,te)).map((e,t)=>({entry:e,index:I.startIndex+t}));if(he!==void 0)ne.push({entry:he,index:te});return ie("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":ne.length,className:"relative shrink-0",style:{height:i.totalHeightPx},children:[b&&R("div",{ref:U,"data-codex-timeline-leading":!0,className:"absolute inset-x-0 top-0",children:L}),ne.map(({entry:e,index:t})=>R("div",{className:"absolute inset-x-0",style:{top:i.topOffsetsPx[t]??0},children:R(Te,{turnKey:e.turnKey,heightPx:i.heightsPx[t],placeholder:e.placeholder,deferUntilReady:e.deferUntilReady,observe:ve,onReady:ye,children:_(e,t)})},e.turnKey))]})});
|
|
2
|
+
export{ct};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{O}from"./chunk-aqj0v5a9.js";import{St}from"./chunk-p6558tbk.js";import{t}from"./chunk-vw2hv2sq.js";import{p}from"./chunk-fgsd4fsd.js";import{isContentEntry as a,isEmbeddedResource as f,isResourceLink as g}from"@alwith/api";import{memo as k,useMemo as y}from"react";import{jsx as s,jsxs as u,Fragment as T}from"react/jsx-runtime";function R({item:n}){if(n.name==="view_image"&&n.status==="completed")return null;let r=n.content.filter(a).filter((e)=>f(e.content)||g(e.content));if(r.length===0)return null;return u("fieldset",{className:"mt-1 min-w-0",children:[s("legend",{className:"text-muted-foreground text-xs",children:n.title??n.name}),r.map((e,l)=>s(p,{block:e.content},`${n.id}:${l}`))]})}var It=k(function({sessionId:r,items:e,terminals:l,streamingThoughtId:m}){let i=t().toolBlock,d=y(()=>e.map((o)=>{let c={...St(o,l,o.kind==="thought"&&o.id===m),id:JSON.stringify([r,o.id])};return c.type==="tool_use"&&o.kind==="tool"&&i!==void 0?i(c,o):c}),[r,e,l,m,i]);return u(T,{children:[s(O,{blocks:d}),e.map((o)=>o.kind==="tool"&&s(R,{item:o},o.id))]})});
|
|
2
|
+
export{It};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function
|
|
1
|
+
import{Radio as e}from"@base-ui/react/radio";import{RadioGroup as d}from"@base-ui/react/radio-group";import{cn as o}from"cn";import{jsx as i}from"react/jsx-runtime";function v({className:r,...a}){return i(d,{"data-slot":"radio-group",className:o("grid w-full gap-3",r),...a})}function c({className:r,...a}){return i(e.Root,{"data-slot":"radio-group-item",className:o("group/radio-group-item peer border-input group-has-[:focus-visible]/field-label:not-data-checked:border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary relative flex aspect-square size-4 shrink-0 rounded-full border outline-none group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3",r),...a,children:i(e.Indicator,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:i("span",{className:"bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full"})})})}export{v,c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function cn(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 Le(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(cn(n,i))}return{imageFiles:e,sawNonImageFile:o}}function Ae(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 un(t){return[...t].filter((e)=>!s(e)).join("")}function rn(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 q(t){let{value:e,selectionStart:o,selectionEnd:i}=t,n=un(e);if(n===e)return n;if(t.value=n,o!==null&&i!==null){let a=Math.max(0,o-rn(e,o)),r=Math.max(0,i-rn(e,i));requestAnimationFrame(()=>{t.setSelectionRange(a,r)})}return n}
|
|
2
|
+
export{cn,Le,Ae,un,rn,q};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n}from"./chunk-azmqtycn.js";import{d}from"./chunk-trgq8rq1.js";import{isContentEntry as b,isImage as N,isResourceLink as w}from"@alwith/api";import{ChevronRightIcon as C,ImageIcon as S,LoaderCircleIcon as A,RefreshCwIcon as R}from"lucide-react";import{useEffect as B,useState as v}from"react";import{jsx as s,jsxs as f}from"react/jsx-runtime";function M(e){return e.type==="tool_use"&&e.name==="view_image"&&e.status==="completed"}function T(e){let r=[];for(let[c,l]of e.content.entries()){if(!b(l))continue;let i=l.content;if(N(i))r.push({key:`${e.id}:${c}`,src:`data:${i.mimeType};base64,${i.data}`,alt:e.title??""});if(w(i))r.push({key:`${e.id}:${c}`,path:i.uri,alt:i.name})}if(r.length)return r;let a=e.rawInput;if(a!==null&&typeof a==="object"&&"path"in a&&typeof a.path==="string")return[{key:e.id,path:a.path,alt:a.path.split(/[\\/]/).at(-1)??a.path}];throw Error(`Image view ${e.id} has no image source`)}function E({images:e}){let{loadImage:r,openImageGallery:a,openImage:c,t:l}=n(),[i,y]=v({}),[x,I]=v(0),h=JSON.stringify(e);B(()=>{let t=!0,u=JSON.parse(h);y({});for(let o of u)(o.src!==void 0?Promise.resolve(o.src):o.path!==void 0&&r?r(o.path):Promise.reject(Error("Image loading is unavailable"))).then((m)=>{if(t)y((g)=>({...g,[o.key]:{src:m}}))},()=>{if(t)y((m)=>({...m,[o.key]:{error:!0}}))});return()=>{t=!1}},[h,r,x]);let k=e.flatMap((t)=>{let u=i[t.key];return u&&"src"in u?[{src:u.src,alt:t.alt}]:[]});return s("div",{className:"codex-image-thumbnails",children:e.map((t,u)=>{let o=i[t.key];if(!o)return s("div",{className:"codex-image-thumbnail",role:"status","aria-label":l("stream.codex.imageLoading"),children:s(A,{className:"motion-safe:animate-spin","aria-hidden":"true"})},t.key);if("error"in o)return s("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,"aria-label":l("stream.codex.imageFailed"),onClick:()=>I((p)=>p+1),children:s(R,{"aria-hidden":"true"})},t.key);return s("button",{type:"button",className:"codex-image-thumbnail",title:t.alt,onClick:()=>{let p=e.slice(0,u).filter((m)=>{let g=i[m.key];return g&&"src"in g}).length;if(a)a(k,p);else c?.(o.src)},children:s("img",{src:o.src,alt:t.alt,draggable:!1})},t.key)})})}function Nt({blocks:e}){let{t:r}=n(),a=e.flatMap(T),[c,l]=d(`image-view:${e[0].id}`,!1);return f("div",{className:"codex-activity-item",children:[f("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":c,onClick:()=>l((i)=>!i),children:[f("span",{className:"codex-activity-label",children:[s(S,{className:"codex-activity-icon","aria-hidden":"true"}),s("span",{className:"codex-activity-leading",children:r("stream.codex.viewedImages",{count:a.length})})]}),s(C,{className:c?"codex-image-chevron codex-image-chevron-open":"codex-image-chevron","aria-hidden":"true"})]}),c&&s(E,{images:a})]})}
|
|
2
|
+
export{M,Nt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var Gn=280;function ut({entries:i,gapPx:t,measuredHeightsByKey:o,leadingInsetPx:e=0}){let n=[],r=[],d=new Map,s=[],u=e;for(let[x,a]of i.entries()){d.set(a.turnKey,x);for(let h of a.aliases??[])d.set(h,x);s.push(a.turnKey),r.push(u);let f=a.aliases?.map((h)=>o[h]).find((h)=>h!==void 0),m=o[a.turnKey]??f??a.estimatedHeightPx??280;if(n.push(m),u+=m,x<i.length-1)u+=t}return{bottomOffsetsPx:r.map((x,a)=>{let f=n[a];if(f===void 0)throw Error(`Codex turn height is missing at index ${a}`);return u-x-f}),heightsPx:n,topOffsetsPx:r,totalHeightPx:u,turnIndexByKey:d,turnKeys:s}}function N({distanceFromBottomPx:i,layout:t,overscanCount:o,viewportHeightPx:e}){if(t.turnKeys.length===0)return{startIndex:0,endIndex:0};let n=Math.min(Math.max(0,i),t.totalHeightPx),r=Math.min(n+Math.max(0,e),t.totalHeightPx),d=g(t.bottomOffsetsPx,r),s=l(t.bottomOffsetsPx,t.heightsPx,n);return{startIndex:Math.max(0,d-o),endIndex:Math.min(t.turnKeys.length,Math.max(s,d+1)+o)}}function ge({anchorKey:i,layout:t,previousRange:o}){let e=t.turnIndexByKey.get(i);if(e===void 0)return null;return{startIndex:e,endIndex:Math.min(t.turnKeys.length,e+o.endIndex-o.startIndex)}}function mt({anchorKey:i,distanceFromBottomPx:t,nextLayout:o,previousLayout:e}){let n=e.turnIndexByKey.get(i),r=o.turnIndexByKey.get(i);if(n===void 0||r===void 0)return null;let d=e.bottomOffsetsPx[n],s=e.heightsPx[n],u=o.bottomOffsetsPx[r],x=o.heightsPx[r];if(d===void 0||s===void 0||u===void 0||x===void 0)throw Error(`Codex turn geometry is missing: ${i}`);return Math.max(0,t+u+x-d-s)}function pt({layout:i,turnKey:t,viewportHeightPx:o}){let e=i.turnIndexByKey.get(t);if(e===void 0)return null;let n=i.bottomOffsetsPx[e],r=i.heightsPx[e];if(n===void 0||r===void 0)throw Error(`Codex turn geometry is missing: ${t}`);return Math.max(0,n-o/2+r/2)}function gt({align:i,layout:t,targetHeightPx:o,targetOffsetPx:e,turnKey:n,viewportHeightPx:r}){let d=t.turnIndexByKey.get(n);if(d===void 0)return null;let s=t.bottomOffsetsPx[d],u=t.heightsPx[d];if(s===void 0||u===void 0)throw Error(`Codex turn geometry is missing: ${n}`);let x=s+u-e;return i==="top"?Math.max(0,x-r+10):Math.max(0,x-o/2-r/2)}function g(i,t){let o=0,e=i.length;while(o<e){let n=Math.floor((o+e)/2),r=i[n];if(r===void 0)throw Error(`Codex bottom offset is missing at index ${n}`);if(r<t)e=n;else o=n+1}return o}function l(i,t,o){let e=0,n=i.length;while(e<n){let r=Math.floor((e+n)/2),d=i[r],s=t[r];if(d===void 0||s===void 0)throw Error(`Codex turn geometry is missing at index ${r}`);if(d+s<=o)n=r;else e=r+1}return e}
|
|
2
|
+
export{Gn,ut,N,ge,mt,pt,gt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var a=(e)=>String(e).padStart(2,"0");function z(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{z};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{terminalOf as u,textOf as g}from"@alwith/api";function St(n,o,r){if(n.kind!=="tool"){let t=g(n.content),c=/^\s*\*\*([^\n]*?)\*\*\s*$/.exec(t);return{type:"thinking",id:n.id,thinking:c?c[1]:t,isComplete:!r}}if(n.name==="subagent"){let t=s(n.rawInput,n.id);return{type:"subagent",id:n.id,name:p(t.agentPath,n.id),threadId:f(t.agentThreadId,"agentThreadId",n.id),activity:y(t.activity,n.id),model:l(t.model,"model",n.id),reasoningEffort:l(t.reasoningEffort,"reasoningEffort",n.id),status:n.status??"pending",blocks:[]}}if(n.name==="collab"){let t=s(s(s(n._meta,n.id).codex,n.id).collaboration,n.id);if(typeof t.tool!=="string"||!Array.isArray(t.agents))throw Error(`Collaboration call ${n.id} lacks codex-acp-v2 agent metadata`);return{type:"collab",id:n.id,tool:t.tool,status:n.status??"pending",prompt:l(s(n.rawInput,n.id).prompt,"prompt",n.id),agents:t.agents}}let i=typeof n.rawInput==="object"&&n.rawInput!==null&&!Array.isArray(n.rawInput)?{...n.rawInput}:{},e=u(n,o);if(Array.isArray(i.command))i.command=i.command.map(String).join(" ");if(n.toolKind==="execute"&&typeof i.command!=="string"){let t=e?.command??n.title;if(t!==null)i.command=t}let a=n.rawOutput;if(typeof a==="object"&&a!==null&&"output"in a&&typeof a.output==="string")a=a.output;if(e!==null&&e.output.length>0)a=e.output;let d=e?.exitStatus?.exitCode;return{type:"tool_use",id:n.id,name:n.name??"",title:n.title??n.name??"",kind:n.toolKind??"other",status:n.status??"pending",content:n.content,locations:n.locations,rawInput:i,rawOutput:a,...typeof d==="number"?{exitCode:d}:{}}}function s(n,o){if(typeof n!=="object"||n===null||Array.isArray(n))throw Error(`Tool call ${o} is missing an object codex-acp-v2 always sends`);return n}function l(n,o,r){if(n===null||typeof n==="string")return n;throw Error(`Tool call ${r} has a non-string ${o}`)}function p(n,o){let r=typeof n==="string"?n.split("/").findLast(Boolean):void 0;if(r===void 0)throw Error(`Subagent ${o} has no agent path`);return r}function f(n,o,r){if(typeof n==="string")return n;throw Error(`Tool call ${r} has no ${o}`)}function y(n,o){if(n==="started"||n==="interacted"||n==="interrupted"||n==="completed")return n;throw Error(`Subagent ${o} has an unknown activity ${String(n)}`)}
|
|
2
|
+
export{St};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function
|
|
2
|
-
export{
|
|
1
|
+
import{cn as S}from"cn";import{useRef as y,useState as k}from"react";import{jsx as m,jsxs as u}from"react/jsx-runtime";function Y({name:p,value:P,levels:h,disabled:c,onChange:v}){if(h.length===0)throw Error("EffortSlider requires at least one level");let o=h,g=Math.max(0,o.findIndex((t)=>t.value===P)),[M,d]=k(null),l=y(null),[I,b]=k(null),x=y(0),s=M??I??g,w=(t)=>{let n=++x.current;b(t);let e=()=>{if(x.current===n)b(null)};try{Promise.resolve(v(o[t].value)).then(e,e)}catch(N){throw e(),N}},f=76,r=14,a=2,i=o.length,C=a+s/Math.max(1,i-1)*(f-r-a*2);return u("div",{className:S("flex items-center justify-between px-2 py-2.5",c&&"opacity-50"),children:[u("span",{className:"grid shrink-0 text-sm whitespace-nowrap",children:[o.map((t)=>u("span",{"aria-hidden":!0,className:"invisible col-start-1 row-start-1",children:[p," ",u("span",{style:{fontSize:12},children:["(",t.name,")"]})]},t.value)),u("span",{className:"col-start-1 row-start-1",children:[p," ",u("span",{"data-effort-value":"",style:{fontSize:12},children:["(",o[s].name,")"]})]})]}),u("button",{type:"button",disabled:c,role:"slider","aria-label":p,"aria-valuemin":0,"aria-valuemax":i-1,"aria-valuenow":s,"aria-valuetext":o[s].name,onKeyDown:(t)=>{let n;if(t.key==="ArrowRight"||t.key==="ArrowUp")n=Math.min(i-1,s+1);else if(t.key==="ArrowLeft"||t.key==="ArrowDown")n=Math.max(0,s-1);else if(t.key==="Home")n=0;else if(t.key==="End")n=i-1;else return;if(t.preventDefault(),t.stopPropagation(),!c&&n!==s)w(n)},className:"relative shrink-0 cursor-pointer touch-none overflow-hidden rounded-full border-none p-0 disabled:cursor-default",style:{width:f,height:18,background:"var(--input)"},onPointerDown:(t)=>{if(c||t.button!==0)return;t.preventDefault(),t.stopPropagation(),t.currentTarget.focus(),t.currentTarget.setPointerCapture(t.pointerId);let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerMove:(t)=>{if(l.current===null)return;let n=t.currentTarget.getBoundingClientRect(),e=Math.round(Math.max(0,Math.min(1,(t.clientX-n.left-a-r/2)/(n.width-r-a*2)))*(i-1));l.current=e,d(e)},onPointerUp:(t)=>{let n=l.current;if(l.current=null,d(null),t.currentTarget.hasPointerCapture(t.pointerId))t.currentTarget.releasePointerCapture(t.pointerId);if(!c&&n!==null&&n!==g)w(n)},onLostPointerCapture:()=>{l.current=null,d(null)},onPointerCancel:()=>{l.current=null,d(null)},onClick:(t)=>{t.preventDefault(),t.stopPropagation()},children:[m("span",{className:"absolute inset-y-0 left-0 w-full rounded-full",style:{background:"var(--input)"}}),o.map((t,n)=>{let e=a+r/2+n/Math.max(1,i-1)*(f-r-a*2)-2;return m("span",{className:"absolute top-1/2 size-1 -translate-y-1/2 rounded-full",style:{left:e,background:"color-mix(in srgb, var(--muted-foreground) 40%, transparent)"}},t.value)}),m("span",{className:"absolute rounded-full transition-all duration-150",style:{width:r,height:r,top:a,left:C,background:"var(--foreground)",boxShadow:"0 1px 2px #0003"}})]})]})}
|
|
2
|
+
export{Y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function
|
|
2
|
-
export{
|
|
1
|
+
import{createPortal as n}from"react-dom";import{jsx as t}from"react/jsx-runtime";function Ct({src:o,alt:e,onClose:i}){return n(t("button",{type:"button",className:"fixed inset-0 z-[1000] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.7)"},onClick:i,children:t("img",{src:o,alt:e,style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4}})}),document.body)}
|
|
2
|
+
export{Ct};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{fe,he}from"./chunk-bfe7xk9m.js";import{a}from"./chunk-5grywgpq.js";import{t}from"./chunk-vw2hv2sq.js";import{It}from"./chunk-k2y4cpra.js";import{Q}from"./chunk-h87xp1gv.js";import{vt}from"./chunk-3vt71emt.js";import{bt}from"./chunk-jeyvacx6.js";import{Et}from"./chunk-4tkxmh52.js";import{ye,we}from"./chunk-8k7wzkna.js";import{z}from"./chunk-p1pd1twf.js";import{Kt,h,U,Wt}from"./chunk-fvnb8ds4.js";import{isContentEntry as ge,isEmbeddedResource as ee,isImage as te,isResourceLink as pe,isText as ue}from"@alwith/api";import{codexMessageError as X,codexTurnError as Y,nativeTurnId as ke}from"@nyssance/codex-acp-v2/client";import{LoaderCircleIcon as xe,SparklesIcon as Te}from"lucide-react";import{memo as Ie}from"react";import{jsx as s,jsxs as l,Fragment as W}from"react/jsx-runtime";function Z(r){if(te(r))return`${r.mimeType.toLowerCase()}:${r.data}`;if(ee(r)&&"blob"in r.resource&&r.resource.mimeType?.toLowerCase().startsWith("image/"))return`${r.resource.mimeType.toLowerCase()}:${r.resource.blob}`;return null}function u({sessionId:r,entry:n,terminals:d,streaming:o,streamingThoughtId:w}){let{t:m}=t();switch(n.kind){case"activity":return s(It,{sessionId:r,items:n.items,terminals:d,streamingThoughtId:w});case"text":return s(Q,{content:n.item.content,messageId:n.item.id,streaming:o});case"plan":return s(Et,{plan:n.item.plan});case"compaction":if(n.item.status==="failed")return l(ye,{children:[s("div",{children:m("timeline.compactionFailed")}),n.item.error!==null&&s("div",{children:n.item.error})]});return l("div",{className:"codex-context-compaction",children:[s(Te,{"aria-hidden":"true"}),s("span",{children:n.item.status==="completed"?m("stream.codex.contextCompacted"):m("timeline.compacting")})]})}}function Ce({sessionId:r,turn:n,terminals:d,active:o,blocked:w=!1,continued:m=!1,edits:F=n.edits,activityItems:C=n.items,workStartedAt:ne=n.startedAt,isLast:O,error:f,interrupted:P,retry:G,retrying:p,answerActions:K,footer:se}){let{t:c}=t(),N=n.errors.map((e)=>{let i=X(e);if(i===null)throw Error("Turn error item is missing its diagnostics");let I=G?.turnId===ke(e)?G:void 0;return s(we,{error:i,retry:I},`${e.id}:${I?.delaySeconds??"manual"}`)});if(O&&f!==null&&!n.errors.some((e)=>{let i=X(e);return i!==null&&i.stopReason===f.stopReason&&Y(i).message===Y(f).message}))N.push(s(we,{error:f},"current-run-error"));let A=N.length>0?s("div",{className:"codex-turn-errors",children:N}):null,b=n.work.filter((e)=>e.kind==="compaction"&&e.item.status==="completed"),v=n.work.filter((e)=>!b.includes(e)),ie=b.length>0&&v.length===0&&n.final.length===0;if(Kt(n)||ie)return l(W,{children:[s("div",{role:"status",className:"text-muted-foreground flex min-w-0 flex-col gap-2 py-2 text-sm",children:n.work.map((e)=>s(u,{sessionId:r,entry:e,terminals:d,streaming:!1,streamingThoughtId:null},e.key))}),A]});let E=U(n),y=C.findLast((e)=>e.kind!=="user"),R=o&&y?.kind==="thought"?y.id:null,B=n.final.filter((e)=>a(e._meta).length===0).map(h).join(`
|
|
2
|
+
`),k=o?null:z(n,"assistant"),H=n.items.filter((e)=>e.kind==="tool"&&e.name==="image_generation"&&(e.status==="pending"||e.status==="in_progress")),V=new Set(n.final.flatMap((e)=>e.content.map(Z).filter((i)=>i!==null))),S=n.items.flatMap((e)=>{if(e.kind!=="tool"||e.status!=="completed")return[];return e.content.filter(ge).flatMap((i,I)=>{let g=i.content,de=e.name==="image_generation"&&te(g),ce=e.toolKind!=="read"&&e.toolKind!=="search"&&(pe(g)||ee(g)&&("blob"in g.resource));if(!de&&!ce)return[];let M=Z(g);if(M!==null){if(V.has(M))return[];V.add(M)}return[{key:`${e.id}:${I}`,block:g}]})}),x=n.final.some((e)=>a(e._meta).length===0&&e.content.some((i)=>!ue(i)||i.text.trim().length>0)),oe=H.length>0||S.length>0||x||n.final.some((e)=>a(e._meta).length>0),T=n.items.findIndex((e)=>n.final.includes(e)),_=(e)=>n.items.indexOf(e.kind==="activity"?e.items[0]:e.item),j=v.filter((e)=>T===-1||_(e)<T),J=v.filter((e)=>T!==-1&&_(e)>T),re=[...n.final.map((e)=>({kind:"answer",item:e,index:n.items.indexOf(e)})),...J.map((e)=>({kind:"work",entry:e,index:_(e)}))].toSorted((e,i)=>e.index-i.index),ae=o&&(!x||J.length>0),me=C.some((e)=>e.kind==="tool"&&(e.status==="pending"||e.status==="in_progress")),L=y?._meta?.codex,le=y?.kind==="assistant"&&!(typeof L==="object"&&L!==null&&("messageCompletedAt"in L)),q=ae&&!w&&!me&&!le&&R===null&&p===void 0,D=Wt({...n,items:C});return l(W,{children:[s(he,{stateKey:JSON.stringify([r,n.key]),active:o&&!x,defaultExpanded:P||E||o&&!x,...D,startedAt:D.startedAt??ne,loading:q&&n.work.length===0,work:m?[]:j.map((e)=>s(u,{sessionId:r,entry:e,terminals:d,streaming:o,streamingThoughtId:R},e.key)),answer:oe||m?l("div",{className:"flex min-w-0 flex-col gap-3",children:[m&&j.map((e)=>s(u,{sessionId:r,entry:e,terminals:d,streaming:!1,streamingThoughtId:null},e.key)),re.map((e)=>{if(e.kind==="work")return s(u,{sessionId:r,entry:e.entry,terminals:d,streaming:o,streamingThoughtId:R},e.entry.key);let i=e.item;return a(i._meta).length>0?s(vt,{sessionId:r,item:i},i.id):s(Q,{content:i.content,messageId:i.id,streaming:o},i.id)}),H.map((e)=>l("div",{className:"codex-image-generation",role:"status","aria-label":c(o?"timeline.imageGenerating":"timeline.imageStopped"),"aria-busy":o,children:[s("div",{className:"codex-image-generation-texture","aria-hidden":"true"}),l("span",{className:"codex-image-generation-status",children:[o&&s(xe,{className:"size-4 motion-safe:animate-spin","aria-hidden":"true"}),c(o?"timeline.imageGenerating":"timeline.imageStopped")]})]},e.id)),S.length>0&&s("div",{className:"codex-reply-artifacts flex min-w-0 flex-col gap-3",children:S.map((e)=>s(Q,{content:[e.block],messageId:e.key,streaming:!1},e.key))}),!o&&!m&&(B.trim().length>0?s(fe,{text:B,isMostRecentTurn:O,time:k,afterCopy:K}):l("div",{className:"flex items-center gap-0.5",children:[K,k&&s("span",{className:"codex-user-time ms-1",title:k.full,children:k.short})]}))]}):null,footer:l(W,{children:[q&&n.work.length>0&&s("div",{className:"codex-pending-message py-2",role:"status",children:s("span",{className:"codex-activity-running",children:c("message.thinking")})}),b.map((e)=>s(u,{sessionId:r,entry:e,terminals:d,streaming:!1,streamingThoughtId:null},e.key)),se,F.length>0&&!o&&!m&&s(bt,{items:F}),(P||E)&&s("div",{className:"codex-interrupted-turn",role:"status",children:c(E?"timeline.historyInterrupted":"timeline.interrupted")}),!o&&A]})}),o&&p!==void 0&&s("div",{className:"text-muted-foreground py-2 text-sm",role:"status",children:p.capacity?(()=>{let e=/Reconnecting(?:\.\.\.)?\s+(\d+\/\d+)/.exec(p.message)?.[1];return e===void 0?c("timeline.capacityReconnecting"):c("timeline.capacityReconnectingProgress",{progress:e})})():p.message}),o&&A]})}var ft=Ie(Ce);
|
|
3
|
+
export{ft};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{o}from"./chunk-hx6wfscz.js";import{B}from"./chunk-h38yw8y3.js";import{cva as p}from"class-variance-authority";import{cn as l}from"cn";import{useMemo as u}from"react";import{jsx as t,jsxs as m}from"react/jsx-runtime";function ne({className:a,...e}){return t("fieldset",{"data-slot":"field-set",className:l("flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",a),...e})}function re({className:a,variant:e="legend",...d}){return t("legend",{"data-slot":"field-legend","data-variant":e,className:l("mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base",a),...d})}function Fe({className:a,...e}){return t("div",{"data-slot":"field-group",className:l("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",a),...e})}var c=p("group/field data-[invalid=true]:text-destructive flex w-full gap-3",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function De({className:a,orientation:e="vertical",...d}){return t("div",{role:"group","data-slot":"field","data-orientation":e,className:l(c({orientation:e}),a),...d})}function Rn({className:a,...e}){return t("div",{"data-slot":"field-content",className:l("group/field-content flex flex-1 flex-col gap-1 leading-snug",a),...e})}function Be({className:a,...e}){return t(o,{"data-slot":"field-label",className:l("group/field-label peer/field-label has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10 flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 *:data-[slot=field]:p-3","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",a),...e})}function Ln({className:a,...e}){return t("div",{"data-slot":"field-label",className:l("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50",a),...e})}function G({className:a,...e}){return t("p",{"data-slot":"field-description",className:l("text-muted-foreground text-left text-sm leading-normal font-normal group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5","last:mt-0 nth-last-2:-mt-1","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",a),...e})}function An({children:a,className:e,...d}){return m("div",{"data-slot":"field-separator","data-content":!!a,className:l("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",e),...d,children:[t(B,{className:"absolute inset-0 top-1/2"}),a&&t("span",{className:"bg-background text-muted-foreground relative mx-auto block w-fit px-2","data-slot":"field-separator-content",children:a})]})}function _n({className:a,children:e,errors:d,...n}){let s=u(()=>{if(e)return e;if(!d?.length)return null;let i=[...new Map(d.map((r)=>[r?.message,r])).values()];if(i?.length==1)return i[0]?.message;return t("ul",{className:"ml-4 flex list-disc flex-col gap-1",children:i.map((r,f)=>r?.message&&t("li",{children:r.message},f))})},[e,d]);if(!s)return null;return t("div",{role:"alert","data-slot":"field-error",className:l("text-destructive text-sm font-normal",a),...n,children:s})}export{ne,re,Fe,De,Rn,Be,Ln,G,An,_n};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createContext as d,useCallback as n,useContext as i,useEffect as tt,useMemo as D,useRef as I,useState as B}from"react";import{jsx as G}from"react/jsx-runtime";var C=d(null),Z=d(null);function Pn(){return i(Z)}var J=d(null);function Nn(){return i(J)}var S=d(null);function _e(){let r=i(C);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use usePromptInputController().");return r}var E=()=>i(C);function Mn(){let r=i(S);if(!r)throw Error("Wrap your component inside <PromptInputProvider> to use useProviderAttachments().");return r}var et=()=>i(S);function Sn({initialInput:r="",revision:l,onSubmittedClear:c,onRemoveAttachment:F,attachmentPolicy:f,value:A,onValueChange:R,attachments:U,onAttachmentsChange:L,children:K}){let T=n((t)=>{if(t.type)return t.type;let e=(t.name||"").toLowerCase();if(e.endsWith(".png"))return"image/png";if(e.endsWith(".jpg")||e.endsWith(".jpeg"))return"image/jpeg";if(e.endsWith(".webp"))return"image/webp";if(e.endsWith(".gif"))return"image/gif";if(e.endsWith(".bmp"))return"image/bmp";if(e.endsWith(".svg"))return"image/svg+xml";return""},[]),W=A!==void 0,[N,Q]=B(r),p=A??N,o=I({value:p,external:l,revision:0});if(o.current.value!==p||o.current.external!==l)o.current={value:p,external:l,revision:o.current.revision+1};let j=n(()=>o.current.revision,[]),P=n((t)=>{if(o.current.value=t,o.current.revision++,W)R?.(t);else Q(t)},[W,R]),g=n(()=>P(""),[P]),x=U!==void 0,[V,X]=B([]),v=U??V,h=I(v);h.current=v;let s=n((t)=>{let e=typeof t==="function"?t(h.current):t;if(x)L?.(e);else X(e)},[x,L]),w=I(null),O=I(()=>{}),M=n((t)=>{let e=[...t];if(e.length===0)return;s((a)=>{let m=f===void 0?e:f.uniqueFiles(e,a);return[...a,...m.map((u)=>{let z=f?.sourcePath(u);return{id:crypto.randomUUID(),type:"file",url:URL.createObjectURL(u),mediaType:T(u),filename:u.name,size:u.size,lastModified:u.lastModified,...z===void 0?{}:{sourcePath:z}}})]})},[f,T,s]),k=n((t)=>{s((e)=>{let a=e.find((m)=>m.id===t);if(a?.url)URL.revokeObjectURL(a.url);return e.filter((m)=>m.id!==t)}),F?.()},[F,s]),H=n(()=>{s((t)=>{for(let e of t)if(e.url)URL.revokeObjectURL(e.url);return[]})},[s]);tt(()=>{if(x)return;return()=>{for(let t of h.current)if(t.url)URL.revokeObjectURL(t.url)}},[x]);let _=n(()=>{O.current?.()},[]),b=D(()=>({files:v,add:M,remove:k,clear:H,openFileDialog:_,fileInputRef:w}),[v,M,k,H,_]),q=n((t,e)=>{w.current=t.current,O.current=e},[]),Y=D(()=>({textInput:{value:p,setInput:P,clear:g,getRevision:j,clearSubmitted:c??g},attachments:b,__registerFileInput:q}),[p,P,g,j,c,b,q]);return G(C.Provider,{value:Y,children:G(S.Provider,{value:b,children:K})})}var ee=d(null);function y(){let r=et(),l=i(ee),c=r??l;if(!c)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return c}
|
|
2
|
+
export{Z,Pn,J,Nn,S,_e,E,Mn,Sn,ee,y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{
|
|
1
|
+
import{Mt}from"./chunk-d8gwsw6j.js";function ht(t,o){if(Mt(o))return y(t);return t.map((e)=>({kind:"block",block:e}))}function i(t){return t.type==="thinking"||t.type==="tool_use"||t.type==="subagent"||t.type==="collab"}function c(t){return t.type==="tool_use"&&t.kind!=="think"}function y(t){let o=[],e=[],r=()=>{if(e.length===0)return;o.push({kind:"codexActivityGroup",blocks:e}),e=[]};for(let n of t){if(i(n)&&c(n)){e.push(n);continue}if(r(),i(n)){o.push({kind:"codexActivityGroup",blocks:[n]});continue}o.push({kind:"block",block:n})}return r(),o}
|
|
2
|
+
export{ht};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useCallback as r,useState as x}from"react";var t=new Map;function d(o,e,k=!1){let[p,S]=x(()=>({key:o,expanded:t.get(o)??e})),n=p.expanded;if(p.key!==o||k&&!t.has(o)&&n!==e)n=t.get(o)??e,S({key:o,expanded:n});let b=r((c)=>{S((s)=>{let f=s.key===o?s.expanded:t.get(o)??e,a=typeof c==="function"?c(f):c;return t.set(o,a),s.key===o?{key:o,expanded:a}:s})},[o,e]);return[n,b]}
|
|
2
|
+
export{d};
|
|
@@ -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};
|