@alwith/module-chat 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-host.js +1 -1
- package/dist/approval/choice-elicitation-form.js +1 -1
- package/dist/approval/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-25na55ve.js +2 -0
- package/dist/{chunk-bgmsrs7h.js → chunk-2845n9v4.js} +1 -1
- package/dist/{chunk-ymka3s33.js → chunk-341yykkp.js} +1 -1
- package/dist/{chunk-9npx3fhh.js → chunk-74phx7h8.js} +1 -1
- package/dist/{chunk-xgy0heva.js → chunk-7pr2j1zb.js} +1 -1
- package/dist/{chunk-e05fnqjq.js → chunk-7tj0a2na.js} +2 -2
- package/dist/{chunk-0wtckvss.js → chunk-8zs8vy0q.js} +1 -1
- package/dist/{chunk-vghme4ag.js → chunk-9me7jmzd.js} +2 -2
- package/dist/{chunk-ekhe60qa.js → chunk-arge74eh.js} +2 -2
- package/dist/{chunk-h7vdhe9r.js → chunk-awbgf3hp.js} +2 -2
- package/dist/{chunk-gsn2bext.js → chunk-ax9ganqr.js} +2 -2
- package/dist/{chunk-1cy1j8gj.js → chunk-bhvtt6tv.js} +2 -2
- package/dist/chunk-darkfx1b.js +2 -0
- package/dist/{chunk-3rttyj3m.js → chunk-etvhn65g.js} +2 -2
- package/dist/{chunk-f5syjtnd.js → chunk-f20xh0z9.js} +1 -1
- package/dist/chunk-g20b01rn.js +2 -0
- package/dist/{chunk-6c610cwg.js → chunk-g3r8m488.js} +1 -1
- package/dist/{chunk-fr3n6fk5.js → chunk-g77gammg.js} +2 -2
- package/dist/{chunk-c54yh2t2.js → chunk-ghfbzhnb.js} +1 -1
- package/dist/{chunk-mfphmgy1.js → chunk-gycty1x1.js} +2 -2
- package/dist/{chunk-f773g8wv.js → chunk-hnt4tt1n.js} +2 -2
- package/dist/{chunk-6yc96p86.js → chunk-hy1x2td2.js} +1 -1
- package/dist/{chunk-10yvvt3h.js → chunk-jkr153v1.js} +1 -1
- package/dist/{chunk-8d3t4bmf.js → chunk-k1c0jrk1.js} +1 -1
- package/dist/{chunk-gj85c3gx.js → chunk-p9wpghey.js} +2 -2
- package/dist/{chunk-etj5bb5a.js → chunk-q17wr01c.js} +3 -3
- package/dist/{chunk-n9mnvxs4.js → chunk-qj8r5xvx.js} +2 -2
- package/dist/{chunk-2kb5qj2v.js → chunk-qyhgwc51.js} +2 -2
- package/dist/{chunk-55zxk0m8.js → chunk-rakd7vzb.js} +1 -1
- package/dist/chunk-reqrpvyy.js +2 -0
- package/dist/{chunk-1nr8t8ar.js → chunk-s0nhgptn.js} +1 -1
- package/dist/{chunk-095yr4wk.js → chunk-s28x10qd.js} +1 -1
- package/dist/{chunk-6zj9rdvw.js → chunk-s3z33k7f.js} +1 -1
- package/dist/{chunk-8n7st0js.js → chunk-wc3patey.js} +2 -2
- package/dist/{chunk-7fn3yt0k.js → chunk-wtkv29ba.js} +1 -1
- package/dist/{chunk-6rrnp8ha.js → chunk-y2xbq7rb.js} +3 -3
- package/dist/codex/activity-group.js +1 -1
- package/dist/codex/assistant-message.js +2 -2
- package/dist/codex/async-question-card.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 +4 -4
- package/dist/codex/thread-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 +1 -1
- package/dist/composer/prompt-input.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/limits.js +1 -1
- package/dist/lib/markdown-parser.js +1 -1
- package/dist/lib/markdown-parser.worker.js +66 -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/stream-style.js +1 -1
- package/dist/lib/streaming-markdown.js +2 -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/ui/badge.js +1 -1
- package/dist/ui/button.js +1 -1
- package/dist/ui/card.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/input-group.js +1 -1
- package/dist/ui/separator.js +1 -1
- package/dist/ui/switch.js +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/package.json +8 -2
- package/dist/chunk-1s523gek.js +0 -2
- package/dist/chunk-am0ge8nt.js +0 -2
- package/dist/chunk-gp69a45h.js +0 -2
- package/dist/chunk-j9hhbm77.js +0 -3
- package/dist/chunk-zb5h5p7y.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Switch as a}from"@base-ui/react/switch";import{cn as d}from"cn";import{jsxDEV as e}from"react/jsx-dev-runtime";function
|
|
1
|
+
import{Switch as a}from"@base-ui/react/switch";import{cn as d}from"cn";import{jsxDEV as e}from"react/jsx-dev-runtime";function S({className:i,size:t="default",...r}){return e(a.Root,{"data-slot":"switch","data-size":t,className:d("peer group/switch focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-3 aria-invalid:ring-3 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px]",i),...r,children:e(a.Thumb,{"data-slot":"switch-thumb",className:"bg-background dark:data-checked:bg-primary-foreground dark:data-unchecked:bg-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}export{S};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{et}from"./chunk-y2xbq7rb.js";function Ue(t,o){if(et(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
2
|
export{Ue};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{t,u}from"./chunk-mfphmgy1.js";import{re}from"./chunk-gj85c3gx.js";import{d}from"./chunk-6rrnp8ha.js";import{i}from"./chunk-pve9b7z3.js";import{f,we}from"./chunk-6yc96p86.js";import{T}from"./chunk-7gh078gc.js";import{cn as w}from"cn";import{BotIcon as le,CheckIcon as ue,CopyIcon as me}from"lucide-react";import{Fragment as pe,useEffect as V,useRef as O,useState as R}from"react";import{jsxDEV as a,Fragment as P}from"react/jsx-dev-runtime";function H(e,n){let[o,r]=R(()=>({key:e,mounted:n})),s=n||o.key===e&&o.mounted;if(o.key!==e||o.mounted!==s)r({key:e,mounted:s});return s}var q=new WeakMap,z=1;function b(e){if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return`${e.type}:${e.id}`;if(e.type==="thinking"&&e.id!==void 0)return`thinking:${e.id}`;let n=q.get(e);if(n!==void 0)return`${e.type}:${n}`;let o=z;return z+=1,q.set(e,o),`${e.type}:${o}`}function B(e){switch(e){case"pending":case"in_progress":return!0;case"completed":case"failed":case"cancelled":case"interrupted":return!1;default:throw Error(`Unknown ACP tool status: ${e}`)}}function U(e,n){let o=Math.max(0,Math.round(e/1000)),r=Math.floor(o/3600),s=Math.floor(o%3600/60),c=o%60;if(c>=60)s+=Math.floor(c/60),c%=60;if(s>=60)r+=Math.floor(s/60),s%=60;let m=Intl.DurationFormat;if(m)try{return new m(n,{style:"narrow"}).format({hours:r,minutes:s,seconds:r>0?0:c})}catch{}if(r>0)return s>0?`${r}h ${s}m`:`${r}h`;if(s>0)return c>0?`${s}m ${c}s`:`${s}m`;return`${c}s`}var ge="M7.52925 3.7793C7.75652 3.55203 8.10803 3.52383 8.36616 3.69434L8.47065 3.7793L14.2207 9.5293C14.4804 9.789 14.4804 10.211 14.2207 10.4707L8.47065 16.2207C8.21095 16.4804 7.78895 16.4804 7.52925 16.2207C7.26955 15.961 7.26955 15.539 7.52925 15.2793L12.8085 10L7.52925 4.7207L7.44429 4.61621C7.27378 4.35808 7.30198 4.00657 7.52925 3.7793Z";function S({expanded:e,className:n}){return a("svg",{className:w("codex-activity-disclosure",e&&"codex-activity-disclosure-expanded",n),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:ge},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function fe(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M16.3965 5.01128C16.3963 4.93399 16.3489 4.87691 16.293 4.85406L16.2354 4.84332C13.9306 4.91764 12.5622 5.32101 10.665 6.34722V16.3716C11.3851 15.9994 12.0688 15.7115 12.7861 15.5015C13.8286 15.1965 14.9113 15.0633 16.2402 15.0435L16.2979 15.0308C16.353 15.0063 16.3965 14.9483 16.3965 14.8755V5.01128ZM3.54492 14.8765C3.54492 14.9725 3.62159 15.0422 3.70117 15.0435L4.19629 15.0562C5.94062 15.1247 7.26036 15.4201 8.65918 16.0484C8.05544 15.1706 7.14706 14.436 6.17871 14.1109V14.1099C5.56757 13.9045 5.16816 13.3314 5.16797 12.6988V4.98882C4.86679 4.93786 4.60268 4.8999 4.28223 4.87457L3.72754 4.84429C3.62093 4.84079 3.54505 4.92417 3.54492 5.01226V14.8765ZM17.7266 14.8755C17.7266 15.6314 17.1607 16.2751 16.4121 16.3628L16.2598 16.3736C15.0122 16.3922 14.0555 16.5159 13.1602 16.7779C12.2629 17.0404 11.3966 17.4508 10.3369 18.0738C10.129 18.1959 9.87099 18.1958 9.66309 18.0738C7.71455 16.9283 6.31974 16.4689 4.12988 16.3853L3.68164 16.3736C2.85966 16.3614 2.21484 15.6838 2.21484 14.8765V5.01226C2.21497 4.15391 2.93263 3.4871 3.77246 3.51519L4.39844 3.54937C4.67996 3.57191 4.92258 3.60421 5.16797 3.64214V2.51031C5.16797 1.44939 6.29018 0.645615 7.31055 1.15679L7.31152 1.15582C8.78675 1.89511 10.0656 3.33006 10.5352 4.91461C12.3595 3.98907 13.8688 3.58817 16.1924 3.51324L16.3506 3.51714C17.1285 3.5741 17.7264 4.23496 17.7266 5.01128V14.8755ZM6.49805 12.6988C6.49824 12.7723 6.5442 12.8296 6.60254 12.8492L6.96289 12.9859C7.85245 13.3586 8.68125 13.9846 9.33496 14.7496V5.5816C9.08794 4.37762 8.13648 3.1566 6.95801 2.47613L6.71582 2.34527C6.67779 2.32617 6.6337 2.32502 6.58301 2.35796C6.52946 2.39279 6.49805 2.44863 6.49805 2.51031V12.6988Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Ce(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M7.33057 1.98535C10.2484 1.98535 12.6136 4.3508 12.6138 7.26855C12.6138 8.58031 12.1346 9.77942 11.3433 10.7031L13.9897 13.3496C14.1655 13.5253 14.1655 13.8106 13.9897 13.9863C13.814 14.1621 13.5288 14.1621 13.353 13.9863L10.7017 11.335C9.78678 12.0942 8.61243 12.5518 7.33057 12.5518C4.41281 12.5516 2.04736 10.1864 2.04736 7.26855C2.04754 4.35091 4.41292 1.98553 7.33057 1.98535ZM7.33057 2.88574C4.90998 2.88592 2.94793 4.84796 2.94775 7.26855C2.94775 9.68929 4.90987 11.6522 7.33057 11.6523C9.75141 11.6523 11.7144 9.6894 11.7144 7.26855C11.7142 4.84786 9.75131 2.88574 7.33057 2.88574Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function xe(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[a("path",{d:"M6.19629 7.86231C6.42357 7.63534 6.7752 7.60692 7.0332 7.77734L7.1377 7.86231L8.80371 9.5293C9.06329 9.78889 9.06307 10.21 8.80371 10.4697L7.1377 12.1367C6.878 12.3964 6.45599 12.3964 6.19629 12.1367C5.93686 11.8771 5.93697 11.456 6.19629 11.1963L7.39258 9.99902L6.19629 8.80371L6.11133 8.69922C5.94087 8.4411 5.96904 8.08955 6.19629 7.86231Z"},void 0,!1,void 0,this),a("path",{d:"M13.4668 11.0156C13.7699 11.0776 13.998 11.3456 13.998 11.667C13.9979 11.9883 13.7698 12.2564 13.4668 12.3184L13.333 12.332H10.833C10.466 12.3319 10.1682 12.034 10.168 11.667C10.168 11.2998 10.4659 11.0021 10.833 11.002H13.333L13.4668 11.0156Z"},void 0,!1,void 0,this),a("path",{d:"M12.6602 2.66504C13.3492 2.66504 13.9062 2.66439 14.3564 2.70117C14.8142 2.73859 15.2201 2.81796 15.5967 3.00977C16.1922 3.31321 16.677 3.79805 16.9805 4.39356C17.1722 4.77014 17.2517 5.17604 17.2891 5.63379C17.3258 6.08402 17.3252 6.64102 17.3252 7.33008V12.6602C17.3252 13.3492 17.3258 13.9062 17.2891 14.3564C17.2516 14.8142 17.1723 15.2201 16.9805 15.5967C16.677 16.1922 16.1922 16.677 15.5967 16.9805C15.2201 17.1723 14.8142 17.2516 14.3564 17.2891C13.9062 17.3258 13.3492 17.3252 12.6602 17.3252H7.33008C6.64102 17.3252 6.08402 17.3258 5.63379 17.2891C5.17604 17.2517 4.77014 17.1722 4.39356 16.9805C3.79805 16.677 3.31321 16.1922 3.00977 15.5967C2.81796 15.2201 2.73859 14.8142 2.70117 14.3564C2.66439 13.9062 2.66504 13.3492 2.66504 12.6602V7.33008C2.66504 6.64101 2.66439 6.08402 2.70117 5.63379C2.73858 5.17601 2.81797 4.77016 3.00977 4.39356C3.31321 3.79802 3.79802 3.31321 4.39356 3.00977C4.77016 2.81797 5.17601 2.73858 5.63379 2.70117C6.08402 2.66439 6.64101 2.66504 7.33008 2.66504H12.6602ZM7.33008 3.99512C6.61907 3.99512 6.1257 3.99601 5.74219 4.02734C5.3665 4.05804 5.15508 4.11481 4.99707 4.19531C4.65183 4.37124 4.37124 4.65183 4.19531 4.99707C4.11481 5.15508 4.05805 5.3665 4.02734 5.74219C3.99601 6.1257 3.99512 6.61908 3.99512 7.33008V12.6602C3.99512 13.3711 3.99601 13.8646 4.02734 14.248C4.05805 14.6237 4.11481 14.8352 4.19531 14.9932C4.37124 15.3384 4.65186 15.619 4.99707 15.7949C5.15507 15.8754 5.36654 15.9322 5.74219 15.9629C6.1257 15.9942 6.61908 15.9951 7.33008 15.9951H12.6602C13.3711 15.9951 13.8646 15.9942 14.248 15.9629C14.6237 15.9322 14.8352 15.8754 14.9932 15.7949C15.3384 15.619 15.619 15.3384 15.7949 14.9932C15.8754 14.8352 15.9322 14.6237 15.9629 14.248C15.9942 13.8646 15.9951 13.3711 15.9951 12.6602V7.33008C15.9951 6.61908 15.9942 6.1257 15.9629 5.74219C15.9322 5.36654 15.8754 5.15507 15.7949 4.99707C15.619 4.65186 15.3384 4.37124 14.9932 4.19531C14.8352 4.11481 14.6237 4.05805 14.248 4.02734C13.8646 3.99601 13.3711 3.99512 12.6602 3.99512H7.33008Z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ve(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M11.3312 4.20472C12.7488 2.92391 14.9377 2.96644 16.3039 4.33265L16.4318 4.46742C17.6713 5.8393 17.6713 7.93343 16.4318 9.30531L16.3039 9.44007L10.0119 15.7311C9.68839 16.0546 9.45384 16.2917 9.22185 16.4821L8.98748 16.6588C8.78233 16.799 8.56429 16.9196 8.33709 17.0192L8.10759 17.1119C7.92582 17.1785 7.73843 17.2266 7.52166 17.2711L6.75701 17.4069L4.36345 17.8053C4.22059 17.8291 4.06914 17.8552 3.9406 17.8649C3.84183 17.8723 3.70833 17.875 3.56267 17.8395L3.41423 17.7907C3.19121 17.695 3.00747 17.5271 2.89177 17.316L2.84588 17.2223C2.75958 17.0209 2.76174 16.8276 2.77166 16.6959C2.78136 16.5674 2.80742 16.4159 2.83123 16.2731L3.22966 13.8795L3.36443 13.1149C3.40899 12.898 3.45795 12.7108 3.52459 12.5289L3.61736 12.2985C3.71691 12.0715 3.83772 11.854 3.97771 11.6491L4.15349 11.4147C4.34392 11.1825 4.58171 10.9484 4.90545 10.6246L11.1965 4.33265L11.3312 4.20472ZM5.84588 11.5651C5.49671 11.9142 5.31258 12.0998 5.1867 12.2526L5.07537 12.3991C4.98194 12.5358 4.90157 12.6812 4.83513 12.8327L4.77361 12.9869C4.73328 13.0971 4.70248 13.2125 4.66814 13.3815L4.54119 14.0983L4.14275 16.4918L4.14177 16.4938H4.1447L6.53826 16.0944L7.25505 15.9684C7.42406 15.9341 7.53946 15.9033 7.64959 15.8629L7.80291 15.8014C7.95461 15.7349 8.09953 15.6538 8.2365 15.5602L8.38396 15.4498C8.53674 15.3239 8.72231 15.1398 9.07146 14.7907L14.0588 9.80238L10.8332 6.57679L5.84588 11.5651ZM15.3635 5.27308C14.5281 4.43776 13.2058 4.38573 12.3097 5.11683L12.1369 5.27308L11.7736 5.63636L15.0002 8.86195L15.3635 8.49964L15.5197 8.32581C16.2015 7.48961 16.2015 6.28311 15.5197 5.44691L15.3635 5.27308Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function he(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M16.8347 7.91699C16.8347 7.76279 16.8266 7.61021 16.8123 7.45996L15.4705 8.80371C14.2903 9.98388 12.3762 9.98388 11.1961 8.80371C10.016 7.62352 10.0159 5.70942 11.1961 4.5293L12.5378 3.18652C12.3885 3.17238 12.237 3.16505 12.0837 3.16504C9.45947 3.16504 7.33179 5.29272 7.33179 7.91699C7.33184 8.56608 7.46162 9.18329 7.69605 9.74512C7.79981 9.9939 7.74311 10.2811 7.5525 10.4717L3.59547 14.4287C3.0498 14.9744 3.04991 15.8586 3.59547 16.4043L3.70191 16.501C4.25076 16.9483 5.05957 16.9158 5.57105 16.4043L9.52906 12.4473L9.60426 12.3828C9.79018 12.2455 10.0369 12.2131 10.2546 12.3037C10.8166 12.5382 11.4345 12.668 12.0837 12.668C14.7078 12.6678 16.8345 10.541 16.8347 7.91699ZM18.1648 7.91699C18.1646 11.2755 15.4423 13.9979 12.0837 13.998C11.4151 13.998 10.7708 13.8886 10.1677 13.6885L6.51246 17.3457C5.51389 18.3443 3.93332 18.406 2.86207 17.5322L2.65504 17.3457C1.58992 16.2806 1.58992 14.5534 2.65504 13.4883L6.31031 9.83203C6.1104 9.22921 6.00175 8.58526 6.00172 7.91699C6.00172 4.55818 8.72494 1.83496 12.0837 1.83496C12.7838 1.835 13.458 1.95316 14.0857 2.17188L14.1638 2.20508C14.3404 2.29325 14.4697 2.45713 14.5144 2.65234C14.5653 2.87533 14.4984 3.10876 14.3367 3.27051L12.1375 5.4707C11.4767 6.13148 11.4767 7.20251 12.1375 7.86328C12.7983 8.52373 13.8694 8.52395 14.53 7.86328L16.7293 5.66309L16.7937 5.60742C16.9499 5.48687 17.1532 5.44067 17.3484 5.48535C17.5714 5.53648 17.7526 5.69898 17.8279 5.91504C18.0466 6.54272 18.1648 7.21689 18.1648 7.91699Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function X({block:e}){if(e.type!=="tool_use")return null;let n=d(e).category;if(n==="read")return a(fe,{},void 0,!1,void 0,this);if(n==="search"||n==="fetch")return a(Ce,{},void 0,!1,void 0,this);if(n==="execute")return a(xe,{},void 0,!1,void 0,this);if(n==="edit")return a(ve,{},void 0,!1,void 0,this);return a(he,{},void 0,!1,void 0,this)}function E(e,n){let o=e.rawInput[n];return typeof o==="string"&&o.length>0?o:void 0}function Le(e){return d(e).target}function W(e){return e.name.startsWith("mcp__")||e.name.startsWith("mcp_")}function Y(e,n){let{category:o}=d(e),r=Le(e),s=B(e.status);if(W(e))return{leading:e.title};if(o==="execute"){let c=E(e,"command")?.split(`
|
|
1
|
+
import{t,u}from"./chunk-gycty1x1.js";import{oe}from"./chunk-p9wpghey.js";import{d}from"./chunk-y2xbq7rb.js";import{i}from"./chunk-pve9b7z3.js";import{f,we}from"./chunk-hy1x2td2.js";import{T}from"./chunk-7gh078gc.js";import{cn as w}from"cn";import{BotIcon as le,CheckIcon as ue,CopyIcon as me}from"lucide-react";import{Fragment as pe,useEffect as V,useRef as O,useState as R}from"react";import{jsxDEV as a,Fragment as P}from"react/jsx-dev-runtime";function H(e,n){let[o,r]=R(()=>({key:e,mounted:n})),s=n||o.key===e&&o.mounted;if(o.key!==e||o.mounted!==s)r({key:e,mounted:s});return s}var q=new WeakMap,z=1;function b(e){if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return`${e.type}:${e.id}`;if(e.type==="thinking"&&e.id!==void 0)return`thinking:${e.id}`;let n=q.get(e);if(n!==void 0)return`${e.type}:${n}`;let o=z;return z+=1,q.set(e,o),`${e.type}:${o}`}function B(e){switch(e){case"pending":case"in_progress":return!0;case"completed":case"failed":case"cancelled":case"interrupted":return!1;default:throw Error(`Unknown ACP tool status: ${e}`)}}function U(e,n){let o=Math.max(0,Math.round(e/1000)),r=Math.floor(o/3600),s=Math.floor(o%3600/60),c=o%60;if(c>=60)s+=Math.floor(c/60),c%=60;if(s>=60)r+=Math.floor(s/60),s%=60;let m=Intl.DurationFormat;if(m)try{return new m(n,{style:"narrow"}).format({hours:r,minutes:s,seconds:r>0?0:c})}catch{}if(r>0)return s>0?`${r}h ${s}m`:`${r}h`;if(s>0)return c>0?`${s}m ${c}s`:`${s}m`;return`${c}s`}var ge="M7.52925 3.7793C7.75652 3.55203 8.10803 3.52383 8.36616 3.69434L8.47065 3.7793L14.2207 9.5293C14.4804 9.789 14.4804 10.211 14.2207 10.4707L8.47065 16.2207C8.21095 16.4804 7.78895 16.4804 7.52925 16.2207C7.26955 15.961 7.26955 15.539 7.52925 15.2793L12.8085 10L7.52925 4.7207L7.44429 4.61621C7.27378 4.35808 7.30198 4.00657 7.52925 3.7793Z";function S({expanded:e,className:n}){return a("svg",{className:w("codex-activity-disclosure",e&&"codex-activity-disclosure-expanded",n),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:ge},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function fe(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M16.3965 5.01128C16.3963 4.93399 16.3489 4.87691 16.293 4.85406L16.2354 4.84332C13.9306 4.91764 12.5622 5.32101 10.665 6.34722V16.3716C11.3851 15.9994 12.0688 15.7115 12.7861 15.5015C13.8286 15.1965 14.9113 15.0633 16.2402 15.0435L16.2979 15.0308C16.353 15.0063 16.3965 14.9483 16.3965 14.8755V5.01128ZM3.54492 14.8765C3.54492 14.9725 3.62159 15.0422 3.70117 15.0435L4.19629 15.0562C5.94062 15.1247 7.26036 15.4201 8.65918 16.0484C8.05544 15.1706 7.14706 14.436 6.17871 14.1109V14.1099C5.56757 13.9045 5.16816 13.3314 5.16797 12.6988V4.98882C4.86679 4.93786 4.60268 4.8999 4.28223 4.87457L3.72754 4.84429C3.62093 4.84079 3.54505 4.92417 3.54492 5.01226V14.8765ZM17.7266 14.8755C17.7266 15.6314 17.1607 16.2751 16.4121 16.3628L16.2598 16.3736C15.0122 16.3922 14.0555 16.5159 13.1602 16.7779C12.2629 17.0404 11.3966 17.4508 10.3369 18.0738C10.129 18.1959 9.87099 18.1958 9.66309 18.0738C7.71455 16.9283 6.31974 16.4689 4.12988 16.3853L3.68164 16.3736C2.85966 16.3614 2.21484 15.6838 2.21484 14.8765V5.01226C2.21497 4.15391 2.93263 3.4871 3.77246 3.51519L4.39844 3.54937C4.67996 3.57191 4.92258 3.60421 5.16797 3.64214V2.51031C5.16797 1.44939 6.29018 0.645615 7.31055 1.15679L7.31152 1.15582C8.78675 1.89511 10.0656 3.33006 10.5352 4.91461C12.3595 3.98907 13.8688 3.58817 16.1924 3.51324L16.3506 3.51714C17.1285 3.5741 17.7264 4.23496 17.7266 5.01128V14.8755ZM6.49805 12.6988C6.49824 12.7723 6.5442 12.8296 6.60254 12.8492L6.96289 12.9859C7.85245 13.3586 8.68125 13.9846 9.33496 14.7496V5.5816C9.08794 4.37762 8.13648 3.1566 6.95801 2.47613L6.71582 2.34527C6.67779 2.32617 6.6337 2.32502 6.58301 2.35796C6.52946 2.39279 6.49805 2.44863 6.49805 2.51031V12.6988Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Ce(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M7.33057 1.98535C10.2484 1.98535 12.6136 4.3508 12.6138 7.26855C12.6138 8.58031 12.1346 9.77942 11.3433 10.7031L13.9897 13.3496C14.1655 13.5253 14.1655 13.8106 13.9897 13.9863C13.814 14.1621 13.5288 14.1621 13.353 13.9863L10.7017 11.335C9.78678 12.0942 8.61243 12.5518 7.33057 12.5518C4.41281 12.5516 2.04736 10.1864 2.04736 7.26855C2.04754 4.35091 4.41292 1.98553 7.33057 1.98535ZM7.33057 2.88574C4.90998 2.88592 2.94793 4.84796 2.94775 7.26855C2.94775 9.68929 4.90987 11.6522 7.33057 11.6523C9.75141 11.6523 11.7144 9.6894 11.7144 7.26855C11.7142 4.84786 9.75131 2.88574 7.33057 2.88574Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function xe(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:[a("path",{d:"M6.19629 7.86231C6.42357 7.63534 6.7752 7.60692 7.0332 7.77734L7.1377 7.86231L8.80371 9.5293C9.06329 9.78889 9.06307 10.21 8.80371 10.4697L7.1377 12.1367C6.878 12.3964 6.45599 12.3964 6.19629 12.1367C5.93686 11.8771 5.93697 11.456 6.19629 11.1963L7.39258 9.99902L6.19629 8.80371L6.11133 8.69922C5.94087 8.4411 5.96904 8.08955 6.19629 7.86231Z"},void 0,!1,void 0,this),a("path",{d:"M13.4668 11.0156C13.7699 11.0776 13.998 11.3456 13.998 11.667C13.9979 11.9883 13.7698 12.2564 13.4668 12.3184L13.333 12.332H10.833C10.466 12.3319 10.1682 12.034 10.168 11.667C10.168 11.2998 10.4659 11.0021 10.833 11.002H13.333L13.4668 11.0156Z"},void 0,!1,void 0,this),a("path",{d:"M12.6602 2.66504C13.3492 2.66504 13.9062 2.66439 14.3564 2.70117C14.8142 2.73859 15.2201 2.81796 15.5967 3.00977C16.1922 3.31321 16.677 3.79805 16.9805 4.39356C17.1722 4.77014 17.2517 5.17604 17.2891 5.63379C17.3258 6.08402 17.3252 6.64102 17.3252 7.33008V12.6602C17.3252 13.3492 17.3258 13.9062 17.2891 14.3564C17.2516 14.8142 17.1723 15.2201 16.9805 15.5967C16.677 16.1922 16.1922 16.677 15.5967 16.9805C15.2201 17.1723 14.8142 17.2516 14.3564 17.2891C13.9062 17.3258 13.3492 17.3252 12.6602 17.3252H7.33008C6.64102 17.3252 6.08402 17.3258 5.63379 17.2891C5.17604 17.2517 4.77014 17.1722 4.39356 16.9805C3.79805 16.677 3.31321 16.1922 3.00977 15.5967C2.81796 15.2201 2.73859 14.8142 2.70117 14.3564C2.66439 13.9062 2.66504 13.3492 2.66504 12.6602V7.33008C2.66504 6.64101 2.66439 6.08402 2.70117 5.63379C2.73858 5.17601 2.81797 4.77016 3.00977 4.39356C3.31321 3.79802 3.79802 3.31321 4.39356 3.00977C4.77016 2.81797 5.17601 2.73858 5.63379 2.70117C6.08402 2.66439 6.64101 2.66504 7.33008 2.66504H12.6602ZM7.33008 3.99512C6.61907 3.99512 6.1257 3.99601 5.74219 4.02734C5.3665 4.05804 5.15508 4.11481 4.99707 4.19531C4.65183 4.37124 4.37124 4.65183 4.19531 4.99707C4.11481 5.15508 4.05805 5.3665 4.02734 5.74219C3.99601 6.1257 3.99512 6.61908 3.99512 7.33008V12.6602C3.99512 13.3711 3.99601 13.8646 4.02734 14.248C4.05805 14.6237 4.11481 14.8352 4.19531 14.9932C4.37124 15.3384 4.65186 15.619 4.99707 15.7949C5.15507 15.8754 5.36654 15.9322 5.74219 15.9629C6.1257 15.9942 6.61908 15.9951 7.33008 15.9951H12.6602C13.3711 15.9951 13.8646 15.9942 14.248 15.9629C14.6237 15.9322 14.8352 15.8754 14.9932 15.7949C15.3384 15.619 15.619 15.3384 15.7949 14.9932C15.8754 14.8352 15.9322 14.6237 15.9629 14.248C15.9942 13.8646 15.9951 13.3711 15.9951 12.6602V7.33008C15.9951 6.61908 15.9942 6.1257 15.9629 5.74219C15.9322 5.36654 15.8754 5.15507 15.7949 4.99707C15.619 4.65186 15.3384 4.37124 14.9932 4.19531C14.8352 4.11481 14.6237 4.05805 14.248 4.02734C13.8646 3.99601 13.3711 3.99512 12.6602 3.99512H7.33008Z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ve(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M11.3312 4.20472C12.7488 2.92391 14.9377 2.96644 16.3039 4.33265L16.4318 4.46742C17.6713 5.8393 17.6713 7.93343 16.4318 9.30531L16.3039 9.44007L10.0119 15.7311C9.68839 16.0546 9.45384 16.2917 9.22185 16.4821L8.98748 16.6588C8.78233 16.799 8.56429 16.9196 8.33709 17.0192L8.10759 17.1119C7.92582 17.1785 7.73843 17.2266 7.52166 17.2711L6.75701 17.4069L4.36345 17.8053C4.22059 17.8291 4.06914 17.8552 3.9406 17.8649C3.84183 17.8723 3.70833 17.875 3.56267 17.8395L3.41423 17.7907C3.19121 17.695 3.00747 17.5271 2.89177 17.316L2.84588 17.2223C2.75958 17.0209 2.76174 16.8276 2.77166 16.6959C2.78136 16.5674 2.80742 16.4159 2.83123 16.2731L3.22966 13.8795L3.36443 13.1149C3.40899 12.898 3.45795 12.7108 3.52459 12.5289L3.61736 12.2985C3.71691 12.0715 3.83772 11.854 3.97771 11.6491L4.15349 11.4147C4.34392 11.1825 4.58171 10.9484 4.90545 10.6246L11.1965 4.33265L11.3312 4.20472ZM5.84588 11.5651C5.49671 11.9142 5.31258 12.0998 5.1867 12.2526L5.07537 12.3991C4.98194 12.5358 4.90157 12.6812 4.83513 12.8327L4.77361 12.9869C4.73328 13.0971 4.70248 13.2125 4.66814 13.3815L4.54119 14.0983L4.14275 16.4918L4.14177 16.4938H4.1447L6.53826 16.0944L7.25505 15.9684C7.42406 15.9341 7.53946 15.9033 7.64959 15.8629L7.80291 15.8014C7.95461 15.7349 8.09953 15.6538 8.2365 15.5602L8.38396 15.4498C8.53674 15.3239 8.72231 15.1398 9.07146 14.7907L14.0588 9.80238L10.8332 6.57679L5.84588 11.5651ZM15.3635 5.27308C14.5281 4.43776 13.2058 4.38573 12.3097 5.11683L12.1369 5.27308L11.7736 5.63636L15.0002 8.86195L15.3635 8.49964L15.5197 8.32581C16.2015 7.48961 16.2015 6.28311 15.5197 5.44691L15.3635 5.27308Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function he(){return a("svg",{className:"codex-activity-icon",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:a("path",{d:"M16.8347 7.91699C16.8347 7.76279 16.8266 7.61021 16.8123 7.45996L15.4705 8.80371C14.2903 9.98388 12.3762 9.98388 11.1961 8.80371C10.016 7.62352 10.0159 5.70942 11.1961 4.5293L12.5378 3.18652C12.3885 3.17238 12.237 3.16505 12.0837 3.16504C9.45947 3.16504 7.33179 5.29272 7.33179 7.91699C7.33184 8.56608 7.46162 9.18329 7.69605 9.74512C7.79981 9.9939 7.74311 10.2811 7.5525 10.4717L3.59547 14.4287C3.0498 14.9744 3.04991 15.8586 3.59547 16.4043L3.70191 16.501C4.25076 16.9483 5.05957 16.9158 5.57105 16.4043L9.52906 12.4473L9.60426 12.3828C9.79018 12.2455 10.0369 12.2131 10.2546 12.3037C10.8166 12.5382 11.4345 12.668 12.0837 12.668C14.7078 12.6678 16.8345 10.541 16.8347 7.91699ZM18.1648 7.91699C18.1646 11.2755 15.4423 13.9979 12.0837 13.998C11.4151 13.998 10.7708 13.8886 10.1677 13.6885L6.51246 17.3457C5.51389 18.3443 3.93332 18.406 2.86207 17.5322L2.65504 17.3457C1.58992 16.2806 1.58992 14.5534 2.65504 13.4883L6.31031 9.83203C6.1104 9.22921 6.00175 8.58526 6.00172 7.91699C6.00172 4.55818 8.72494 1.83496 12.0837 1.83496C12.7838 1.835 13.458 1.95316 14.0857 2.17188L14.1638 2.20508C14.3404 2.29325 14.4697 2.45713 14.5144 2.65234C14.5653 2.87533 14.4984 3.10876 14.3367 3.27051L12.1375 5.4707C11.4767 6.13148 11.4767 7.20251 12.1375 7.86328C12.7983 8.52373 13.8694 8.52395 14.53 7.86328L16.7293 5.66309L16.7937 5.60742C16.9499 5.48687 17.1532 5.44067 17.3484 5.48535C17.5714 5.53648 17.7526 5.69898 17.8279 5.91504C18.0466 6.54272 18.1648 7.21689 18.1648 7.91699Z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function X({block:e}){if(e.type!=="tool_use")return null;let n=d(e).category;if(n==="read")return a(fe,{},void 0,!1,void 0,this);if(n==="search"||n==="fetch")return a(Ce,{},void 0,!1,void 0,this);if(n==="execute")return a(xe,{},void 0,!1,void 0,this);if(n==="edit")return a(ve,{},void 0,!1,void 0,this);return a(he,{},void 0,!1,void 0,this)}function E(e,n){let o=e.rawInput[n];return typeof o==="string"&&o.length>0?o:void 0}function Le(e){return d(e).target}function W(e){return e.name.startsWith("mcp__")||e.name.startsWith("mcp_")}function Y(e,n){let{category:o}=d(e),r=Le(e),s=B(e.status);if(W(e))return{leading:e.title};if(o==="execute"){let c=E(e,"command")?.split(`
|
|
2
2
|
`)[0]??r;return c?{leading:n(s?"stream.codex.running":"stream.codex.ran"),trailing:c}:{leading:n(s?"stream.codex.runningCommand":"stream.codex.ranCommandGeneric")}}if(o==="search"){let c=E(e,"pattern")??E(e,"query")??r;return c?{leading:n(s?"stream.codex.searching":"stream.codex.searched"),trailing:n("stream.codex.forDetail",{detail:c})}:{leading:n(s?"stream.codex.searchingFiles":"stream.codex.searchedFiles")}}if(o==="fetch"){let c=E(e,"query")??E(e,"url")??r;return c?{leading:n(s?"stream.codex.searchingWeb":"stream.codex.searchedWeb"),trailing:n("stream.codex.forDetail",{detail:c})}:{leading:n(s?"stream.codex.searchingWeb":"stream.codex.searchedWeb")}}if(o==="read")return r?{leading:n("stream.codex.readLabel"),trailing:r}:{leading:n("stream.codex.readFiles")};if(o==="edit")return r?{leading:n(s?"stream.codex.editingLabel":"stream.codex.editedLabel"),trailing:r}:{leading:n(s?"stream.codex.editingFiles":"stream.codex.editedFiles")};if(o==="delete")return r?{leading:n(s?"stream.codex.deletingLabel":"stream.codex.deletedLabel"),trailing:r}:{leading:n(s?"stream.codex.deletingFiles":"stream.codex.deletedFiles")};if(o==="move")return r?{leading:n(s?"stream.codex.movingLabel":"stream.codex.movedLabel"),trailing:r}:{leading:n(s?"stream.codex.movingFiles":"stream.codex.movedFiles")};return{leading:e.title}}function Ne(e,n){let o=Y(e,n);return o.trailing===void 0?o.leading:`${o.leading} ${o.trailing}`}function Te(e){return e.map((n)=>{if(n.type!=="content")return"";let o=n.content;return o.type==="text"?o.text:""}).filter(Boolean).join(`
|
|
3
3
|
`).trim()}function $e(e){return e.flatMap((n)=>{if(n.type!=="content")return[];let o=n.content;return o.type==="image"?[{data:o.data,mimeType:o.mimeType}]:[]})}function ke(e){return e.flatMap((n)=>{if(n.type!=="content")return[];let o=n.content;return o.type==="audio"?[{data:o.data,mimeType:o.mimeType}]:[]})}function Ae(e){if(typeof e==="string"&&e.length>0)return e;return}function Be(e){return e.type==="diff"}function Me(e){let n=e.content.find(Be);if(n===void 0)return;return n.changes.map((o)=>`${o.operation} ${o.path}`).join(`
|
|
4
4
|
`)}function ee(e){let n=Ae(e.rawOutput);if(n!==void 0)return n;let o=Te(e.content);if(o.length>0)return o;return Me(e)}function Ie({block:e,command:n}){let{t:o,Output:r,commandStatus:s}=t(),[c,m]=R(!1),[p,g]=R(!1),C=ee(e),l=s===void 0?e.exitCode===void 0?void 0:o("stream.codex.exitCode",{code:e.exitCode}):s(e),x=()=>{navigator.clipboard.writeText([`$ ${n}`,C].filter((h)=>h!==void 0).join(`
|
|
5
5
|
`)),m(!0),setTimeout(()=>m(!1),1500)};return a("div",{className:"codex-command-details",children:a("div",{className:"codex-command-card",children:[a("div",{className:"codex-command-line-row",children:[a("span",{className:"codex-command-prompt","aria-hidden":"true",children:"$"},void 0,!1,void 0,this),a("button",{type:"button",className:w("codex-command-line",!p&&"codex-command-line-clamped"),"data-codex-disclosure":"","aria-expanded":p,onClick:()=>g((h)=>!h),children:n},void 0,!1,void 0,this),a("button",{type:"button",className:"codex-command-copy","aria-label":o("actions.copy"),onClick:x,children:c?a(ue,{},void 0,!1,void 0,this):a(me,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C!==void 0&&(r===void 0?a("pre",{className:"codex-command-output",children:C},void 0,!1,void 0,this):a(r,{text:C},void 0,!1,void 0,this)),l!==void 0&&a("div",{className:"codex-command-footer",children:a("span",{className:"codex-command-status",children:l},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function te({block:e}){let{t:n,openLink:o,Patch:r,openImage:s,commandStatus:c,expandToolOutput:m=!1}=t(),p=ee(e),g=r===void 0?void 0:e.content.flatMap((y)=>{if(y.type!=="diff")return[];let I=y;return I.patch?.text?[I.patch.text]:[]}).join(`
|
|
6
|
-
`),C=$e(e.content),l=ke(e.content),[x,h]=i(`tool:${e.id}`,!1),L=H(`tool:${e.id}`,x),N=d(e),k=N.category,v=Y(e,n),A=k==="execute"?E(e,"command"):void 0,_=A!==void 0||W(e)||C.length>0||l.length>0||Boolean(g)||m&&p!==void 0,M=!_&&!B(e.status)?N.filePath:void 0;if(k==="execute"&&!B(e.status)&&e.status!=="completed"){let y=c?.(e);if(y)v={...v,leading:y}}if(k==="read"&&B(e.status))return null;let j=a("span",{className:"codex-activity-label",children:[a(X,{block:e},void 0,!1,void 0,this),a("span",{className:"min-w-0 flex-1 truncate",children:B(e.status)?a("span",{className:"codex-activity-running",children:v.trailing===void 0?v.leading:`${v.leading} ${v.trailing}`},void 0,!1,void 0,this):a(P,{children:[a("span",{className:"codex-activity-leading",children:v.leading},void 0,!1,void 0,this),v.trailing!==void 0&&(M!==void 0?a(P,{children:[" ",a("button",{type:"button",className:"codex-activity-trailing codex-activity-file-link",title:M,onClick:()=>o(M),children:v.trailing},void 0,!1,void 0,this)]},void 0,!0,void 0,this):a("span",{className:"codex-activity-trailing",children:[" ",v.trailing]},void 0,!0,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return a("div",{className:"codex-activity-item",children:[_?a("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-label":v.trailing===void 0?v.leading:`${v.leading} ${v.trailing}`,"aria-expanded":x,onClick:()=>h((y)=>!y),children:[j,a(S,{expanded:x},void 0,!1,void 0,this)]},void 0,!0,void 0,this):a("div",{className:"codex-activity-header codex-activity-header-static",children:j},void 0,!1,void 0,this),a("div",{className:w("codex-activity-details-grid",x&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:L&&a(P,{children:[A!==void 0?a(Ie,{block:e,command:A},void 0,!1,void 0,this):r!==void 0&&g?a(r,{patch:g},void 0,!1,void 0,this):p!==void 0&&a("pre",{className:"codex-activity-details",children:p},void 0,!1,void 0,this),C.length>0&&a("div",{className:"codex-activity-media",children:C.map((y)=>{let I=`data:${y.mimeType};base64,${y.data}`,G=a("img",{src:I,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},`${y.mimeType}:${y.data.slice(0,32)}`,!1,void 0,this);return s===void 0?G:a("button",{type:"button",className:"cursor-pointer",onClick:()=>s(I),children:G},I,!1,void 0,this)})},void 0,!1,void 0,this),l.map((y)=>a("audio",{className:"mt-1 w-full","aria-label":n("stream.codex.audioOutput"),controls:!0,src:`data:${y.mimeType};base64,${y.data}`},`${y.mimeType}:${y.data.slice(0,32)}`,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ne({block:e}){if(e.type==="tool_use")return a(te,{block:e},void 0,!1,void 0,this);if(e.type==="thinking")return a(ce,{block:e},void 0,!1,void 0,this);if(e.type==="collab")return a(de,{block:e},void 0,!1,void 0,this);return a(ae,{block:e},void 0,!1,void 0,this)}function ae({block:e}){let{t:n,openSession:o}=t(),r=B(e.status),[s,c]=i(`subagent:${e.id}`,r),m=O(r);V(()=>{if(r)c(!0);if(m.current&&!r)c(!1);m.current=r},[r,c]);let p=`${_e(e.activity,r,e.name,n)}${oe(e.model,e.reasoningEffort,n)}`,g=e.threadId??"",C=e.blocks.length>0;return a("div",{className:"codex-activity-item",children:[a("button",{type:"button",className:w("codex-activity-header",!C&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":C?s:void 0,disabled:!C,onClick:()=>c((l)=>!l),children:[a("span",{className:"codex-activity-label",children:[a(Re,{seed:e.threadId??e.id},void 0,!1,void 0,this),a("span",{className:"min-w-0 flex-1 truncate",children:o===void 0||e.threadId===null?r?a("span",{className:"codex-activity-running",children:p},void 0,!1,void 0,this):p:a("span",{role:"link",tabIndex:0,className:w("codex-agent-link",r&&"codex-activity-running"),"aria-label":n("stream.codex.subagentOpen",{name:e.name}),onClick:(l)=>{l.stopPropagation(),o(g,e.name)},onKeyDown:(l)=>{if(l.key!=="Enter"&&l.key!==" ")return;l.preventDefault(),l.stopPropagation(),o(g,e.name)},children:p},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&a(S,{expanded:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:w("codex-activity-details-grid",s&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-subagent-details",children:e.blocks.map((l)=>{if(l.type==="tool_use")return a(te,{block:l},l.id,!1,void 0,this);if(l.type==="thinking")return a(ce,{block:l},b(l),!1,void 0,this);if(l.type==="subagent")return a(ae,{block:l},l.id,!1,void 0,this);if(l.type==="collab")return a(de,{block:l},l.id,!1,void 0,this);if(l.type==="text")return a("div",{className:"codex-reasoning-details",children:a(u,{text:l.text,streaming:!1},void 0,!1,void 0,this)},b(l),!1,void 0,this);if(l.type==="plan")return a(T,{entries:l.entries},b(l),!1,void 0,this);if(l.type==="image")return a("img",{src:`data:${l.source.media_type};base64,${l.source.data}`,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},b(l),!1,void 0,this);return null})},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ee=8;function Se(e){let n=0;for(let o=0;o<e.length;o+=1)n=(n*31+e.charCodeAt(o))%2147483647;return n%Ee}function Re({seed:e}){return a("span",{className:"codex-agent-avatar","data-hue":Se(e),"aria-hidden":"true"},void 0,!1,void 0,this)}function _e(e,n,o,r){switch(e){case"started":return r(n?"stream.codex.subagentWorking":"stream.codex.subagentFinished",{name:o});case"interacted":return r("stream.codex.subagentMessaged",{name:o});case"interrupted":return r("stream.codex.subagentInterrupted",{name:o});case"completed":return r("stream.codex.subagentFinished",{name:o})}}var Fe=new Set(["none","minimal","low","medium","high","xhigh","max","ultra","persistent"]);function oe(e,n,o){if(e===null)return"";if(n===null)return` · ${re(e)}`;let r=Fe.has(n)?o(`stream.codex.reasoningEffort.${n}`):n;return` · ${re(e)} · ${r}`}var De={spawnAgent:"spawn",sendInput:"message",sendMessage:"message",followupTask:"message",interruptAgent:"interrupt",listAgents:"list",resumeAgent:"resume",closeAgent:"close"};function ie(e){switch(e){case"pending":case"in_progress":return"inProgress";case"completed":return"completed";case"failed":return"failed";case"cancelled":case"interrupted":return"interrupted";default:throw Error(`Unknown ACP tool status: ${e}`)}}function Z(e,n,o){if(e.tool==="wait")throw Error("Codex does not present wait calls");let r=ie(e.status);if(r==="interrupted")return o("stream.codex.collab.interrupted");return o(`stream.codex.collab.${n}.${De[e.tool]}.${r}`)}function Pe(e){return e.agents.filter((n)=>n.nickname!==null)}function se(e,n){let o=e.agents.length>0?e.agents.length:1;return`${Z(e,"header",n)}${n("stream.codex.collab.agentCount",{count:o})}`}var F="\x01";function D(e,n,o,r){let s=Object.fromEntries(Object.keys(r).map((c)=>[c,`${F}${c}${F}`]));return e(n,{...o,...s}).split(new RegExp(`${F}(\\w+)${F}`,"u")).map((c,m)=>a(pe,{children:m%2===1?r[c]:c},`${m}:${c}`,!1,void 0,this))}function Ve({agent:e,showModel:n}){let{t:o,openSession:r}=t(),s=e.nickname??"",c=r===void 0?a("span",{className:"font-medium",children:s},void 0,!1,void 0,this):a("button",{type:"button",className:"codex-agent-link font-medium","aria-label":o("stream.codex.subagentOpen",{name:s}),onClick:()=>r(e.threadId,s),children:s},void 0,!1,void 0,this);return a("span",{children:[c,e.role!==null&&` (${e.role})`,n&&oe(e.model,e.reasoningEffort,o)]},void 0,!0,void 0,this)}function K({prompt:e}){return a("span",{className:"codex-collab-prompt",title:e,children:e},void 0,!1,void 0,this)}function Oe(e,n){let o=e.prompt?.trim()?e.prompt:null,r=ie(e.status),s=e.tool==="spawnAgent"&&r==="completed"&&o!==null,c=(e.tool==="sendInput"||e.tool==="sendMessage"||e.tool==="followupTask")&&o!==null,m=Pe(e),p=[];if(m.length===0)p.push({key:"generic",node:Z(e,"row",n)});for(let g of m){let C=a(Ve,{agent:g,showModel:e.tool==="spawnAgent"},void 0,!1,void 0,this);if(s)p.push({key:g.threadId,node:a("span",{className:"codex-collab-line",children:D(n,"stream.codex.collab.createdWithInstructions",{},{agent:C,instructions:a(K,{prompt:o},void 0,!1,void 0,this)})},void 0,!1,void 0,this)});else if(c)p.push({key:g.threadId,node:a("span",{className:"codex-collab-line",children:D(n,"stream.codex.collab.messagedWithPrompt",{action:r==="interrupted"?n("stream.codex.collab.interrupted"):n(`stream.codex.collab.messaged.${r}`)},{agent:C,prompt:a(K,{prompt:o},void 0,!1,void 0,this)})},void 0,!1,void 0,this)});else{let x=e.tool!=="closeAgent"&&e.tool!=="resumeAgent"&&g.state!==null&&g.state!==null?g.state.message?.trim()?n("stream.codex.collab.stateWithMessage",{state:n(`stream.codex.collab.state.${g.state.status}`),message:g.state.message}):n("stream.codex.collab.stateOnly",{state:n(`stream.codex.collab.state.${g.state.status}`)}):"";p.push({key:g.threadId,node:D(n,"stream.codex.collab.agentRow",{action:Z(e,"row",n),state:x},{agent:C})})}}if(!s&&!c&&o!==null)p.push({key:"input",node:D(n,"stream.codex.collab.input",{},{prompt:a("span",{className:"codex-collab-input",children:o},void 0,!1,void 0,this)})});return p}function de({block:e}){let{t:n}=t(),[o,r]=i(`collab:${e.id}`,!1);if(e.tool==="wait")return null;let s=B(e.status),c=se(e,n);return a("div",{className:"codex-activity-item",children:[a("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":o,onClick:()=>r((m)=>!m),children:[a("span",{className:"codex-activity-label",children:[a(le,{className:"size-4 shrink-0","aria-hidden":"true"},void 0,!1,void 0,this),a("span",{className:"min-w-0 flex-1 truncate",children:s?a("span",{className:"codex-activity-running",children:c},void 0,!1,void 0,this):c},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(S,{expanded:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:w("codex-activity-details-grid",o&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-subagent-details",children:Oe(e,n).map((m)=>a("div",{className:"codex-collab-row",children:m.node},m.key,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ce({block:e}){let{t:n,i18n:o}=t(),r=Boolean(e.isComplete),[s,c]=i(`thinking:${b(e)}`,!1),m=O(null),p=e.thinking.trim().length>0;V(()=>{if(r||!p)return;let l=m.current;if(l===null)throw Error("Thinking details are not mounted");let x=new ResizeObserver(()=>{l.scrollTop=l.scrollHeight}),h=null,L=()=>{let k=l.firstElementChild;if(k===h)return;if(h!==null)x.unobserve(h);if(h=k,h!==null)x.observe(h)},N=new MutationObserver(L);return N.observe(l,{childList:!0}),L(),()=>{N.disconnect(),x.disconnect()}},[p,r]);let g=r?e.durationMs!==void 0?n("stream.codex.thoughtFor",{duration:U(e.durationMs,o.language)}):n("stream.codex.thought"):n("message.thinking"),C=e.thinking.trimStart().replace(/^\*\*[^\n]*?\*\*\s*/,"");return a("div",{className:"codex-activity-item",children:[a("button",{type:"button",className:w("codex-activity-header",!p&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":p?s:void 0,disabled:!p,onClick:()=>c((l)=>!l),children:[a("span",{className:"codex-activity-label",children:a("span",{className:"codex-reasoning-label min-w-0 flex-1 truncate",children:r?g:a("span",{className:"codex-activity-running",children:g},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),p&&a(S,{expanded:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:w("codex-activity-details-grid",s&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:p&&a("div",{ref:m,className:"codex-reasoning-details",role:"region","aria-label":g,"aria-hidden":!s,tabIndex:0,inert:!s,children:a(u,{text:C,streaming:!r},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ue(e){if(W(e))return"mcp";let n=d(e).category;return n==="think"||n==="switch_mode"?"other":n}function Ze(e,n,o,r){return r(`stream.codex.summary.${e}.${o?"leading":"following"}`,{count:n})}function He(e,n,o){let r=new Map;for(let c of e){let m=Ue(c);r.set(m,(r.get(m)??0)+1)}let s=Array.from(r,([c,m],p)=>Ze(c,m,p===0,n));if(o.startsWith("zh"))return s.join("");return new Intl.ListFormat(o,{style:"long",type:"conjunction"}).format(s)}function be({stateKey:e,durationMs:n,durationKind:o="work",active:r,startedAt:s,providerId:c,providerIcon:m,children:p}){let{t:g,i18n:C}=t(),[l,x]=i(`work:${e}:${r?"active":"complete"}`,r),h=H(`work:${e}`,l||r),L=O(null),[N,k]=R(0);V(()=>{if(!r||n!==void 0){L.current=null;return}L.current=s??Date.now();let A=()=>{let M=L.current;if(M===null)throw Error("Codex work section is ticking without a start time");k(Date.now()-M)};A();let _=window.setInterval(A,1000);return()=>window.clearInterval(_)},[r,s,n]);let v=n!==void 0?g(o==="total"?"stream.codex.totalDuration":"stream.codex.workedFor",{duration:U(n,C.language)}):r&&N>=1000?g("stream.codex.workedFor",{duration:U(N,C.language)}):g("stream.codex.worked");return a("section",{className:"codex-work-section",children:[a("button",{type:"button",className:"codex-work-trigger","data-codex-disclosure":"","aria-expanded":l,onClick:()=>x((A)=>!A),children:[c!==void 0&&a("span",{className:"codex-work-provider-icon","data-testid":"codex-work-provider-icon","data-provider-id":c,"aria-hidden":"true",children:m},void 0,!1,void 0,this),a("span",{children:v},void 0,!1,void 0,this),a(S,{expanded:l,className:"codex-work-chevron"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:"codex-work-separator","aria-hidden":"true"},void 0,!1,void 0,this),a("div",{className:w("codex-work-grid",l&&"codex-work-grid-open"),"aria-hidden":!l,inert:!l,children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-work-body",children:h&&p},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function We(e,n){if(e.type==="tool_use")return Ne(e,n);if(e.type==="thinking")return n("message.thinking");if(e.type==="collab")return se(e,n);return n("stream.codex.subagentWorking",{name:e.name})}function J(e){if(e.type==="thinking")return!e.isComplete;if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return B(e.status);return!1}function je(e,n,o=1000){let[r,s]=R({text:e,live:n}),c=O(Date.now());return V(()=>{if(e===r.text&&n===r.live)return;let m=Date.now(),p=Math.max(0,c.current+o-m);if(p===0||n!==r.live){c.current=m,s({text:e,live:n});return}let g=window.setTimeout(()=>{c.current=Date.now(),s({text:e,live:n})},p);return()=>window.clearTimeout(g)},[r,n,o,e]),n===r.live?r.text:e}function Ge({blocks:e}){let{t:n,i18n:o}=t(),r=e.some(J),s=b(e[0]),[c,m]=i(`group:${s}`,!0),p=H(`group:${s}`,c||r),g=e.findLast(J)??e.at(-1);if(g===void 0)throw Error("CodexActivityGroup requires at least one activity block");let C=e.filter((x)=>x.type==="tool_use"),l=je(r?We(g,n):He(C,n,o.language),r);return a("div",{className:"codex-activity-group",children:[a("button",{type:"button",className:"codex-activity-group-trigger","aria-expanded":c,onClick:()=>m((x)=>!x),children:[a("span",{className:"codex-activity-label",children:[a(X,{block:e[0]},void 0,!1,void 0,this),a("span",{className:"truncate",children:r?a("span",{className:"codex-activity-running",children:l},void 0,!1,void 0,this):l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(S,{expanded:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:w("codex-activity-group-grid",c&&"codex-activity-group-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-activity-group-body",children:p&&e.map((x)=>a(ne,{block:x},b(x),!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Q({blocks:e}){if(e.length===0)throw Error("CodexActivityGroup requires at least one activity block");if(e.length===1)return a(ne,{block:e[0]},void 0,!1,void 0,this);return a(Ge,{blocks:e},void 0,!1,void 0,this)}function ye({blocks:e}){if(!e.some(f))return a(Q,{blocks:e},void 0,!1,void 0,this);let n=[];for(let o of e){let r=n.at(-1);if(r&&f(r[0])===f(o))r.push(o);else n.push([o])}return a(P,{children:n.map((o)=>f(o[0])?a(we,{blocks:o.filter(f)},b(o[0]),!1,void 0,this):a(Q,{blocks:o},b(o[0]),!1,void 0,this))},void 0,!1,void 0,this)}
|
|
6
|
+
`),C=$e(e.content),l=ke(e.content),[x,h]=i(`tool:${e.id}`,!1),L=H(`tool:${e.id}`,x),N=d(e),k=N.category,v=Y(e,n),A=k==="execute"?E(e,"command"):void 0,_=A!==void 0||W(e)||C.length>0||l.length>0||Boolean(g)||m&&p!==void 0,M=!_&&!B(e.status)?N.filePath:void 0;if(k==="execute"&&!B(e.status)&&e.status!=="completed"){let y=c?.(e);if(y)v={...v,leading:y}}if(k==="read"&&B(e.status))return null;let j=a("span",{className:"codex-activity-label",children:[a(X,{block:e},void 0,!1,void 0,this),a("span",{className:"min-w-0 flex-1 truncate",children:B(e.status)?a("span",{className:"codex-activity-running",children:v.trailing===void 0?v.leading:`${v.leading} ${v.trailing}`},void 0,!1,void 0,this):a(P,{children:[a("span",{className:"codex-activity-leading",children:v.leading},void 0,!1,void 0,this),v.trailing!==void 0&&(M!==void 0?a(P,{children:[" ",a("button",{type:"button",className:"codex-activity-trailing codex-activity-file-link",title:M,onClick:()=>o(M),children:v.trailing},void 0,!1,void 0,this)]},void 0,!0,void 0,this):a("span",{className:"codex-activity-trailing",children:[" ",v.trailing]},void 0,!0,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return a("div",{className:"codex-activity-item",children:[_?a("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-label":v.trailing===void 0?v.leading:`${v.leading} ${v.trailing}`,"aria-expanded":x,onClick:()=>h((y)=>!y),children:[j,a(S,{expanded:x},void 0,!1,void 0,this)]},void 0,!0,void 0,this):a("div",{className:"codex-activity-header codex-activity-header-static",children:j},void 0,!1,void 0,this),a("div",{className:w("codex-activity-details-grid",x&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:L&&a(P,{children:[A!==void 0?a(Ie,{block:e,command:A},void 0,!1,void 0,this):r!==void 0&&g?a(r,{patch:g},void 0,!1,void 0,this):p!==void 0&&a("pre",{className:"codex-activity-details",children:p},void 0,!1,void 0,this),C.length>0&&a("div",{className:"codex-activity-media",children:C.map((y)=>{let I=`data:${y.mimeType};base64,${y.data}`,G=a("img",{src:I,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},`${y.mimeType}:${y.data.slice(0,32)}`,!1,void 0,this);return s===void 0?G:a("button",{type:"button",className:"cursor-pointer",onClick:()=>s(I),children:G},I,!1,void 0,this)})},void 0,!1,void 0,this),l.map((y)=>a("audio",{className:"mt-1 w-full","aria-label":n("stream.codex.audioOutput"),controls:!0,src:`data:${y.mimeType};base64,${y.data}`},`${y.mimeType}:${y.data.slice(0,32)}`,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ne({block:e}){if(e.type==="tool_use")return a(te,{block:e},void 0,!1,void 0,this);if(e.type==="thinking")return a(ce,{block:e},void 0,!1,void 0,this);if(e.type==="collab")return a(de,{block:e},void 0,!1,void 0,this);return a(ae,{block:e},void 0,!1,void 0,this)}function ae({block:e}){let{t:n,openSession:o}=t(),r=B(e.status),[s,c]=i(`subagent:${e.id}`,r),m=O(r);V(()=>{if(r)c(!0);if(m.current&&!r)c(!1);m.current=r},[r,c]);let p=`${_e(e.activity,r,e.name,n)}${ie(e.model,e.reasoningEffort,n)}`,g=e.threadId??"",C=e.blocks.length>0;return a("div",{className:"codex-activity-item",children:[a("button",{type:"button",className:w("codex-activity-header",!C&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":C?s:void 0,disabled:!C,onClick:()=>c((l)=>!l),children:[a("span",{className:"codex-activity-label",children:[a(Re,{seed:e.threadId??e.id},void 0,!1,void 0,this),a("span",{className:"min-w-0 flex-1 truncate",children:o===void 0||e.threadId===null?r?a("span",{className:"codex-activity-running",children:p},void 0,!1,void 0,this):p:a("span",{role:"link",tabIndex:0,className:w("codex-agent-link",r&&"codex-activity-running"),"aria-label":n("stream.codex.subagentOpen",{name:e.name}),onClick:(l)=>{l.stopPropagation(),o(g,e.name)},onKeyDown:(l)=>{if(l.key!=="Enter"&&l.key!==" ")return;l.preventDefault(),l.stopPropagation(),o(g,e.name)},children:p},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&a(S,{expanded:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:w("codex-activity-details-grid",s&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-subagent-details",children:e.blocks.map((l)=>{if(l.type==="tool_use")return a(te,{block:l},l.id,!1,void 0,this);if(l.type==="thinking")return a(ce,{block:l},b(l),!1,void 0,this);if(l.type==="subagent")return a(ae,{block:l},l.id,!1,void 0,this);if(l.type==="collab")return a(de,{block:l},l.id,!1,void 0,this);if(l.type==="text")return a("div",{className:"codex-reasoning-details",children:a(u,{text:l.text,streaming:!1},void 0,!1,void 0,this)},b(l),!1,void 0,this);if(l.type==="plan")return a(T,{entries:l.entries},b(l),!1,void 0,this);if(l.type==="image")return a("img",{src:`data:${l.source.media_type};base64,${l.source.data}`,className:"max-h-48 max-w-full rounded-lg object-contain",alt:""},b(l),!1,void 0,this);return null})},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Ee=8;function Se(e){let n=0;for(let o=0;o<e.length;o+=1)n=(n*31+e.charCodeAt(o))%2147483647;return n%Ee}function Re({seed:e}){return a("span",{className:"codex-agent-avatar","data-hue":Se(e),"aria-hidden":"true"},void 0,!1,void 0,this)}function _e(e,n,o,r){switch(e){case"started":return r(n?"stream.codex.subagentWorking":"stream.codex.subagentFinished",{name:o});case"interacted":return r("stream.codex.subagentMessaged",{name:o});case"interrupted":return r("stream.codex.subagentInterrupted",{name:o});case"completed":return r("stream.codex.subagentFinished",{name:o})}}var Fe=new Set(["none","minimal","low","medium","high","xhigh","max","ultra","persistent"]);function ie(e,n,o){if(e===null)return"";if(n===null)return` · ${oe(e)}`;let r=Fe.has(n)?o(`stream.codex.reasoningEffort.${n}`):n;return` · ${oe(e)} · ${r}`}var De={spawnAgent:"spawn",sendInput:"message",sendMessage:"message",followupTask:"message",interruptAgent:"interrupt",listAgents:"list",resumeAgent:"resume",closeAgent:"close"};function re(e){switch(e){case"pending":case"in_progress":return"inProgress";case"completed":return"completed";case"failed":return"failed";case"cancelled":case"interrupted":return"interrupted";default:throw Error(`Unknown ACP tool status: ${e}`)}}function Z(e,n,o){if(e.tool==="wait")throw Error("Codex does not present wait calls");let r=re(e.status);if(r==="interrupted")return o("stream.codex.collab.interrupted");return o(`stream.codex.collab.${n}.${De[e.tool]}.${r}`)}function Pe(e){return e.agents.filter((n)=>n.nickname!==null)}function se(e,n){let o=e.agents.length>0?e.agents.length:1;return`${Z(e,"header",n)}${n("stream.codex.collab.agentCount",{count:o})}`}var F="\x01";function D(e,n,o,r){let s=Object.fromEntries(Object.keys(r).map((c)=>[c,`${F}${c}${F}`]));return e(n,{...o,...s}).split(new RegExp(`${F}(\\w+)${F}`,"u")).map((c,m)=>a(pe,{children:m%2===1?r[c]:c},`${m}:${c}`,!1,void 0,this))}function Ve({agent:e,showModel:n}){let{t:o,openSession:r}=t(),s=e.nickname??"",c=r===void 0?a("span",{className:"font-medium",children:s},void 0,!1,void 0,this):a("button",{type:"button",className:"codex-agent-link font-medium","aria-label":o("stream.codex.subagentOpen",{name:s}),onClick:()=>r(e.threadId,s),children:s},void 0,!1,void 0,this);return a("span",{children:[c,e.role!==null&&` (${e.role})`,n&&ie(e.model,e.reasoningEffort,o)]},void 0,!0,void 0,this)}function K({prompt:e}){return a("span",{className:"codex-collab-prompt",title:e,children:e},void 0,!1,void 0,this)}function Oe(e,n){let o=e.prompt?.trim()?e.prompt:null,r=re(e.status),s=e.tool==="spawnAgent"&&r==="completed"&&o!==null,c=(e.tool==="sendInput"||e.tool==="sendMessage"||e.tool==="followupTask")&&o!==null,m=Pe(e),p=[];if(m.length===0)p.push({key:"generic",node:Z(e,"row",n)});for(let g of m){let C=a(Ve,{agent:g,showModel:e.tool==="spawnAgent"},void 0,!1,void 0,this);if(s)p.push({key:g.threadId,node:a("span",{className:"codex-collab-line",children:D(n,"stream.codex.collab.createdWithInstructions",{},{agent:C,instructions:a(K,{prompt:o},void 0,!1,void 0,this)})},void 0,!1,void 0,this)});else if(c)p.push({key:g.threadId,node:a("span",{className:"codex-collab-line",children:D(n,"stream.codex.collab.messagedWithPrompt",{action:r==="interrupted"?n("stream.codex.collab.interrupted"):n(`stream.codex.collab.messaged.${r}`)},{agent:C,prompt:a(K,{prompt:o},void 0,!1,void 0,this)})},void 0,!1,void 0,this)});else{let x=e.tool!=="closeAgent"&&e.tool!=="resumeAgent"&&g.state!==null&&g.state!==null?g.state.message?.trim()?n("stream.codex.collab.stateWithMessage",{state:n(`stream.codex.collab.state.${g.state.status}`),message:g.state.message}):n("stream.codex.collab.stateOnly",{state:n(`stream.codex.collab.state.${g.state.status}`)}):"";p.push({key:g.threadId,node:D(n,"stream.codex.collab.agentRow",{action:Z(e,"row",n),state:x},{agent:C})})}}if(!s&&!c&&o!==null)p.push({key:"input",node:D(n,"stream.codex.collab.input",{},{prompt:a("span",{className:"codex-collab-input",children:o},void 0,!1,void 0,this)})});return p}function de({block:e}){let{t:n}=t(),[o,r]=i(`collab:${e.id}`,!1);if(e.tool==="wait")return null;let s=B(e.status),c=se(e,n);return a("div",{className:"codex-activity-item",children:[a("button",{type:"button",className:"codex-activity-header","data-codex-disclosure":"","aria-expanded":o,onClick:()=>r((m)=>!m),children:[a("span",{className:"codex-activity-label",children:[a(le,{className:"size-4 shrink-0","aria-hidden":"true"},void 0,!1,void 0,this),a("span",{className:"min-w-0 flex-1 truncate",children:s?a("span",{className:"codex-activity-running",children:c},void 0,!1,void 0,this):c},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(S,{expanded:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:w("codex-activity-details-grid",o&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-subagent-details",children:Oe(e,n).map((m)=>a("div",{className:"codex-collab-row",children:m.node},m.key,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function ce({block:e}){let{t:n,i18n:o}=t(),r=Boolean(e.isComplete),[s,c]=i(`thinking:${b(e)}`,!1),m=O(null),p=e.thinking.trim().length>0;V(()=>{if(r||!p)return;let l=m.current;if(l===null)throw Error("Thinking details are not mounted");let x=new ResizeObserver(()=>{l.scrollTop=l.scrollHeight}),h=null,L=()=>{let k=l.firstElementChild;if(k===h)return;if(h!==null)x.unobserve(h);if(h=k,h!==null)x.observe(h)},N=new MutationObserver(L);return N.observe(l,{childList:!0}),L(),()=>{N.disconnect(),x.disconnect()}},[p,r]);let g=r?e.durationMs!==void 0?n("stream.codex.thoughtFor",{duration:U(e.durationMs,o.language)}):n("stream.codex.thought"):n("message.thinking"),C=e.thinking.trimStart().replace(/^\*\*[^\n]*?\*\*\s*/,"");return a("div",{className:"codex-activity-item",children:[a("button",{type:"button",className:w("codex-activity-header",!p&&"codex-activity-header-static"),"data-codex-disclosure":"","aria-expanded":p?s:void 0,disabled:!p,onClick:()=>c((l)=>!l),children:[a("span",{className:"codex-activity-label",children:a("span",{className:"codex-reasoning-label min-w-0 flex-1 truncate",children:r?g:a("span",{className:"codex-activity-running",children:g},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),p&&a(S,{expanded:s},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:w("codex-activity-details-grid",s&&"codex-activity-details-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:p&&a("div",{ref:m,className:"codex-reasoning-details",role:"region","aria-label":g,"aria-hidden":!s,tabIndex:0,inert:!s,children:a(u,{text:C,streaming:!r},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ue(e){if(W(e))return"mcp";let n=d(e).category;return n==="think"||n==="switch_mode"?"other":n}function Ze(e,n,o,r){return r(`stream.codex.summary.${e}.${o?"leading":"following"}`,{count:n})}function He(e,n,o){let r=new Map;for(let c of e){let m=Ue(c);r.set(m,(r.get(m)??0)+1)}let s=Array.from(r,([c,m],p)=>Ze(c,m,p===0,n));if(o.startsWith("zh"))return s.join("");return new Intl.ListFormat(o,{style:"long",type:"conjunction"}).format(s)}function be({stateKey:e,durationMs:n,durationKind:o="work",active:r,startedAt:s,providerId:c,providerIcon:m,children:p}){let{t:g,i18n:C}=t(),[l,x]=i(`work:${e}:${r?"active":"complete"}`,r),h=H(`work:${e}`,l||r),L=O(null),[N,k]=R(0);V(()=>{if(!r||n!==void 0){L.current=null;return}L.current=s??Date.now();let A=()=>{let M=L.current;if(M===null)throw Error("Codex work section is ticking without a start time");k(Date.now()-M)};A();let _=window.setInterval(A,1000);return()=>window.clearInterval(_)},[r,s,n]);let v=n!==void 0?g(o==="total"?"stream.codex.totalDuration":"stream.codex.workedFor",{duration:U(n,C.language)}):r&&N>=1000?g("stream.codex.workedFor",{duration:U(N,C.language)}):g("stream.codex.worked");return a("section",{className:"codex-work-section",children:[a("button",{type:"button",className:"codex-work-trigger","data-codex-disclosure":"","aria-expanded":l,onClick:()=>x((A)=>!A),children:[c!==void 0&&a("span",{className:"codex-work-provider-icon","data-testid":"codex-work-provider-icon","data-provider-id":c,"aria-hidden":"true",children:m},void 0,!1,void 0,this),a("span",{children:v},void 0,!1,void 0,this),a(S,{expanded:l,className:"codex-work-chevron"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:"codex-work-separator","aria-hidden":"true"},void 0,!1,void 0,this),a("div",{className:w("codex-work-grid",l&&"codex-work-grid-open"),"aria-hidden":!l,inert:!l,children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-work-body",children:h&&p},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function We(e,n){if(e.type==="tool_use")return Ne(e,n);if(e.type==="thinking")return n("message.thinking");if(e.type==="collab")return se(e,n);return n("stream.codex.subagentWorking",{name:e.name})}function J(e){if(e.type==="thinking")return!e.isComplete;if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return B(e.status);return!1}function je(e,n,o=1000){let[r,s]=R({text:e,live:n}),c=O(Date.now());return V(()=>{if(e===r.text&&n===r.live)return;let m=Date.now(),p=Math.max(0,c.current+o-m);if(p===0||n!==r.live){c.current=m,s({text:e,live:n});return}let g=window.setTimeout(()=>{c.current=Date.now(),s({text:e,live:n})},p);return()=>window.clearTimeout(g)},[r,n,o,e]),n===r.live?r.text:e}function Ge({blocks:e}){let{t:n,i18n:o}=t(),r=e.some(J),s=b(e[0]),[c,m]=i(`group:${s}`,!0),p=H(`group:${s}`,c||r),g=e.findLast(J)??e.at(-1);if(g===void 0)throw Error("CodexActivityGroup requires at least one activity block");let C=e.filter((x)=>x.type==="tool_use"),l=je(r?We(g,n):He(C,n,o.language),r);return a("div",{className:"codex-activity-group",children:[a("button",{type:"button",className:"codex-activity-group-trigger","aria-expanded":c,onClick:()=>m((x)=>!x),children:[a("span",{className:"codex-activity-label",children:[a(X,{block:e[0]},void 0,!1,void 0,this),a("span",{className:"truncate",children:r?a("span",{className:"codex-activity-running",children:l},void 0,!1,void 0,this):l},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a(S,{expanded:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:w("codex-activity-group-grid",c&&"codex-activity-group-grid-open"),children:a("div",{className:"min-h-0 overflow-hidden",children:a("div",{className:"codex-activity-group-body",children:p&&e.map((x)=>a(ne,{block:x},b(x),!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Q({blocks:e}){if(e.length===0)throw Error("CodexActivityGroup requires at least one activity block");if(e.length===1)return a(ne,{block:e[0]},void 0,!1,void 0,this);return a(Ge,{blocks:e},void 0,!1,void 0,this)}function ye({blocks:e}){if(!e.some(f))return a(Q,{blocks:e},void 0,!1,void 0,this);let n=[];for(let o of e){let r=n.at(-1);if(r&&f(r[0])===f(o))r.push(o);else n.push([o])}return a(P,{children:n.map((o)=>f(o[0])?a(we,{blocks:o.filter(f)},b(o[0]),!1,void 0,this):a(Q,{blocks:o},b(o[0]),!1,void 0,this))},void 0,!1,void 0,this)}
|
|
7
7
|
export{be,ye};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Tooltip as i}from"@base-ui/react/tooltip";import{cn as l}from"cn";import{jsxDEV as o}from"react/jsx-dev-runtime";function
|
|
1
|
+
import{Tooltip as i}from"@base-ui/react/tooltip";import{cn as l}from"cn";import{jsxDEV as o}from"react/jsx-dev-runtime";function kt({delay:t=0,...e}){return o(i.Provider,{"data-slot":"tooltip-provider",delay:t,...e},void 0,!1,void 0,this)}function G({...t}){return o(i.Root,{"data-slot":"tooltip",...t},void 0,!1,void 0,this)}function j({...t}){return o(i.Trigger,{"data-slot":"tooltip-trigger",...t},void 0,!1,void 0,this)}function Q({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:o(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"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}export{kt,G,j,Q};
|
|
@@ -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{
|
|
1
|
+
var Ht=["full","compact","codexUI"];function et(t){return t==="compact"||t==="codexUI"}var mt=["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 d(t){let o=mt.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 Ot(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{Ht,et,mt,d,Ot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{be,ye}from"../chunk-
|
|
1
|
+
import{be,ye}from"../chunk-wc3patey.js";import"../chunk-hy1x2td2.js";import"../chunk-pve9b7z3.js";import"../chunk-gycty1x1.js";import"../chunk-7gh078gc.js";import"../chunk-p9wpghey.js";import"../chunk-y2xbq7rb.js";export{ye as CodexActivityGroup,be as CodexWorkSection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t,u}from"../chunk-
|
|
2
|
-
`),M=!e.streaming&&C.trim().length>0?n(S,{text:C,isMostRecentTurn:s,beforeCopy:a,afterCopy:x,time:r},void 0,!1,void 0,this):null,l=Ue(e.content,"compact"),f=l.reduce((o,c,p)=>c.kind==="codexActivityGroup"?p:o,-1),h=l.findIndex((o,c)=>c>f&&o.kind==="block"&&o.block.type==="text"),b=[...e.content].toReversed().find((o)=>o.type==="text"),m=e.content.filter((o)=>o.type==="tool_use"&&d(o).category==="edit"),k=(o)=>{if(o.kind==="codexActivityGroup"){let c=o.blocks.filter((p)=>p.type!=="tool_use"||!i.has(p.name));return c.length===0?null:n(ye,{blocks:c},`activity:${R(c[0])}`,!1,void 0,this)}if(o.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${o.kind}`);return n(E,{block:o.block,streaming:Boolean(e.streaming),actions:o.block===b?M:void 0,renderText:B},R(o.block),!1,void 0,this)},g=f===-1?0:h===-1?l.length:h;return n(O,{stateKey:e.id,active:Boolean(e.streaming),startedAt:e.startedAt,durationMs:e.durationMs,providerId:e.providerId,providerIcon:A,work:l.slice(0,g).map(k),answer:l.length>g?l.slice(g).map(k):null,footer:f!==-1&&m.length>0&&(y===void 0?n(
|
|
1
|
+
import{t,u}from"../chunk-gycty1x1.js";import{d}from"../chunk-y2xbq7rb.js";import{Ue}from"../chunk-s3z33k7f.js";import"../chunk-p9wpghey.js";import"../chunk-pve9b7z3.js";import"../chunk-hy1x2td2.js";import{T}from"../chunk-7gh078gc.js";import{be,ye}from"../chunk-wc3patey.js";import{ve}from"../chunk-q17wr01c.js";import"../chunk-8bdd6q4w.js";import{W}from"../chunk-ax9ganqr.js";import{cn as w}from"cn";import{jsxDEV as n}from"react/jsx-dev-runtime";var v=new WeakMap,P=1;function R(e){if(e.type==="tool_use"||e.type==="subagent"||e.type==="collab")return`${e.type}:${e.id}`;let s=v.get(e);if(s!==void 0)return`${e.type}:${s}`;let i=P++;return v.set(e,i),`${e.type}:${i}`}function I({block:e,streaming:s,actions:i}){if(e.isApiError)return n("div",{className:"codex-stream-error",children:e.text},void 0,!1,void 0,this);return n("div",{className:"codex-assistant-message",children:[n(u,{text:e.text,streaming:s},void 0,!1,void 0,this),i]},void 0,!0,void 0,this)}function E({block:e,streaming:s,actions:i,renderText:r}){switch(e.type){case"text":return r===void 0?n(I,{block:e,streaming:s,actions:i},void 0,!1,void 0,this):r({block:e,streaming:s,actions:i});case"thinking":return e.thinking.length>0?n(u,{text:e.thinking,streaming:!e.isComplete},void 0,!1,void 0,this):null;case"plan":return n(T,{entries:e.entries},void 0,!1,void 0,this);case"image":return n("img",{src:`data:${e.source.media_type};base64,${e.source.data}`,className:"max-h-64 rounded",alt:""},void 0,!1,void 0,this);case"tool_use":case"subagent":case"collab":return null}}var _=new Set;function q({message:e,isMostRecentTurn:s,hiddenTools:i=_,time:r,beforeCopy:a,afterCopy:x,providerIcon:A,renderText:B,renderEditedFiles:y}){if(e.streaming===!0&&e.content.every((o)=>o.type==="text"?o.text.length===0:o.type==="thinking"?o.thinking.length===0:!1))return n(N,{},void 0,!1,void 0,this);let C=e.content.filter((o)=>o.type==="text").map((o)=>o.text).join(`
|
|
2
|
+
`),M=!e.streaming&&C.trim().length>0?n(S,{text:C,isMostRecentTurn:s,beforeCopy:a,afterCopy:x,time:r},void 0,!1,void 0,this):null,l=Ue(e.content,"compact"),f=l.reduce((o,c,p)=>c.kind==="codexActivityGroup"?p:o,-1),h=l.findIndex((o,c)=>c>f&&o.kind==="block"&&o.block.type==="text"),b=[...e.content].toReversed().find((o)=>o.type==="text"),m=e.content.filter((o)=>o.type==="tool_use"&&d(o).category==="edit"),k=(o)=>{if(o.kind==="codexActivityGroup"){let c=o.blocks.filter((p)=>p.type!=="tool_use"||!i.has(p.name));return c.length===0?null:n(ye,{blocks:c},`activity:${R(c[0])}`,!1,void 0,this)}if(o.kind!=="block")throw Error(`Codex received an incompatible grouped entry: ${o.kind}`);return n(E,{block:o.block,streaming:Boolean(e.streaming),actions:o.block===b?M:void 0,renderText:B},R(o.block),!1,void 0,this)},g=f===-1?0:h===-1?l.length:h;return n(O,{stateKey:e.id,active:Boolean(e.streaming),startedAt:e.startedAt,durationMs:e.durationMs,providerId:e.providerId,providerIcon:A,work:l.slice(0,g).map(k),answer:l.length>g?l.slice(g).map(k):null,footer:f!==-1&&m.length>0&&(y===void 0?n(ve,{blocks:m},void 0,!1,void 0,this):y(m))},void 0,!1,void 0,this)}function S({text:e,isMostRecentTurn:s=!1,beforeCopy:i,afterCopy:r,time:a}){let{t:x}=t();return n("div",{className:w("mt-1.5 flex h-5 w-fit -translate-x-1 items-center justify-start gap-0.5 [&_*]:transition-none",s?"opacity-100":"opacity-0 group-focus-within/am:opacity-100 group-hover/am:opacity-100"),children:[i,n(W,{text:e,label:x("actions.copy")},void 0,!1,void 0,this),r,a&&n("span",{className:"codex-user-time ms-1",title:a.full,children:a.short},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function N(){let{t:e}=t();return n("div",{className:"codex-pending-message py-2",role:"status",children:n("span",{className:"codex-activity-running",children:e("message.thinking")},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function O({work:e,answer:s,footer:i,loading:r=!1,...a}){if(r)return n(N,{},void 0,!1,void 0,this);return n("div",{className:"group/am codex-assistant-turn",children:[e.length>0&&n(be,{...a,children:e},void 0,!1,void 0,this),s!==null&&(e.length===0?s:n("div",{"data-local-conversation-final-assistant":!0,"data-testid":"codex-final-answer",className:"codex-final-answer",children:s},void 0,!1,void 0,this)),i]},void 0,!0,void 0,this)}export{q as CodexAssistantMessage,O as CodexAssistantTurn,S as CodexMessageActions};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e}from"../chunk-
|
|
1
|
+
import{e}from"../chunk-7pr2j1zb.js";import{r}from"../chunk-pnncsvbz.js";import{c,a}from"../chunk-rka1mc9r.js";import{o}from"../chunk-r9k7kszp.js";import{useId as k}from"react";import{jsxDEV as i,Fragment as A}from"react/jsx-dev-runtime";function p(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function I(n){if(!p(n)||!p(n.codex))return[];let s=n.codex,l=s.questions;if(s.delivery!=="async"||!Array.isArray(l))return[];if(!l.every((t)=>p(t)&&typeof t.title==="string"&&t.title.trim().length>0&&(t.options===null||Array.isArray(t.options)&&t.options.every((d)=>typeof d==="string"))))return[];return l}function D(n,s){return JSON.stringify(["request_user_input_async",n,s])}function S(n){return{selected:n.options?.length?0:null,text:""}}function h(n,s){return s.selected===null?s.text:n.options?.[s.selected]??""}function C(n){return`<send_user_message_question_reply>
|
|
2
2
|
${JSON.stringify([n])}
|
|
3
3
|
</send_user_message_question_reply>`}function B(n){if(!p(n)||!p(n.codex))return[];let s=n.codex;return(Array.isArray(s.questionReplyParts)?s.questionReplyParts.map((t)=>p(t)?{...t,answer:t.text}:t):[s.questionReply]).filter((t)=>p(t)&&typeof t.questionItemId==="string"&&typeof t.question==="string"&&typeof t.answer==="string").map(({questionItemId:t,question:d,answer:g})=>({questionItemId:t,question:d,answer:g}))}function G({question:n,draft:s,status:l,answer:t,error:d,onChange:g,onSubmit:b,onSkip:w,t:u}){let x=k(),m=l==="pending",Q=l==="answered"||l==="skipped";return i("section",{"aria-labelledby":`${x}-title`,className:"border-border bg-card text-card-foreground flex min-w-0 flex-col gap-3 rounded-xl border p-4",children:[i("h3",{id:`${x}-title`,className:"text-sm font-medium whitespace-pre-wrap",children:n.title},void 0,!1,void 0,this),Q?i("p",{className:"text-sm whitespace-pre-wrap",children:l==="answered"?t:u("asyncQuestion.skipped")},void 0,!1,void 0,this):i(A,{children:[(n.options?.length??0)>0&&i(c,{"aria-labelledby":`${x}-title`,disabled:!m,value:s.selected===null?"other":String(s.selected),onValueChange:(y)=>g({...s,selected:y==="other"?null:Number(y)}),children:[n.options?.map((y,f)=>i(r,{className:"flex items-start gap-2 text-sm",children:[i(a,{value:String(f)},void 0,!1,void 0,this),i("span",{className:"whitespace-pre-wrap",children:y},void 0,!1,void 0,this)]},f,!0,void 0,this)),i(r,{className:"flex items-center gap-2 text-sm",children:[i(a,{value:"other"},void 0,!1,void 0,this),u("asyncQuestion.other")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),i(o,{"aria-label":u("asyncQuestion.answer"),placeholder:u("asyncQuestion.answer"),value:s.text,readOnly:!m,onChange:(y)=>g({selected:null,text:y.target.value})},void 0,!1,void 0,this),d&&i("p",{role:"alert",className:"text-destructive text-sm",children:d},void 0,!1,void 0,this),i("div",{className:"flex flex-wrap items-center gap-2",children:[i(e,{size:"sm",disabled:!m||h(n,s).trim().length===0,onClick:b,children:u(l==="submitting"?"asyncQuestion.submitting":"asyncQuestion.submit")},void 0,!1,void 0,this),i(e,{size:"sm",variant:"ghost",disabled:!m,onClick:w,children:u("asyncQuestion.skip")},void 0,!1,void 0,this),(l==="closed"||l==="unavailable")&&i("span",{role:"status",className:"text-muted-foreground text-xs",children:u(`asyncQuestion.${l}`)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}export{G as AsyncQuestionCard,D as asyncQuestionId,I as asyncQuestions,S as initialQuestionDraft,h as questionAnswer,B as questionReplies,C as questionReplyEnvelope};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{at,ve,st}from"../chunk-q17wr01c.js";import"../chunk-gycty1x1.js";export{ve as CodexEditedFilesCard,st as EditedFilesCard,at as fileChanges};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f,we}from"../chunk-
|
|
1
|
+
import{f,we}from"../chunk-hy1x2td2.js";import"../chunk-pve9b7z3.js";import"../chunk-gycty1x1.js";export{we as ImageViewActivity,f as isImageView};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{tt}from"../chunk-25na55ve.js";import{ie,Xe}from"../chunk-g20b01rn.js";import{re}from"../chunk-9me7jmzd.js";import{decodeHTMLAttribute as T,decodeHTMLStrict as E}from"entities";import oe from"katex";import{CheckIcon as K,ChevronLeftIcon as ae,ChevronRightIcon as se,CopyIcon as ce,DownloadIcon as de,FileIcon as le,LinkIcon as ue,MailIcon as me,XIcon as ge}from"lucide-react";import"katex/dist/katex.min.css";import{createContext as fe,createElement as z,memo as U,startTransition as he,useContext as pe,useEffect as h,useLayoutEffect as B,useMemo as D,useRef as p,useState as f}from"react";import{jsxDEV as a,Fragment as ne}from"react/jsx-dev-runtime";var X=fe(null);function v(){let e=pe(X);if(e===null)throw Error("Markdown host is missing");return e}var ke=80,F=/\[([^\]\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 C(e,n){let t=0;for(let r=n-1;r>=0&&e[r]==="\\";r-=1)t+=1;return t%2===1}function G(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)&&!C(e,r)&&!G(e,r,n)){t+=1,r+=n.length;continue}r+=1}return t}function Ce(e,n){for(let t=e.length-n.length;t>=0;t-=1)if(e.startsWith(n,t)&&!C(e,t)&&!G(e,t,n))return t;return-1}function ye(e,n){let t=0;for(let r=0;r<=e.length-n.length;){if(e.startsWith(n,r)&&!C(e,r)){t+=1,r+=n.length;continue}r+=1}return t}function Ne(e){return ye(e,"```")%2===1}function J(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]==="`"&&!C(e,t))n+=1;t+=1}return n%2===1}function Me(e){return e.endsWith(`
|
|
2
2
|
`)?`${e}\`\`\``:`${e}
|
|
3
3
|
\`\`\``}function A(e,n){if(!e.includes(n)||ve(e,n)%2===0)return e;let t=Ce(e,n);if(t<0)return e;let r=e.slice(t+n.length);if(r.length===0||/^\s/.test(r)||r.includes(`
|
|
4
|
-
`)||J(r))return e;return`${e}${n}`}function Le(e){return e.startsWith("/")&&!e.startsWith("//")||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)||/^\/\/[^/]+\/[^/]+/.test(e)}function V(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 Ee(e){let{path:n,line:t,column:r,endLine:o,endColumn:s}=V(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 Ie(e){let{path:n}=V(e);if(Le(n))return!0;try{return new URL(n).protocol==="file:"}catch{return!1}}function
|
|
5
|
-
`),t.raw=e.slice(n,s).map((i)=>i.raw).join(""),e.splice(n+1,s-n-1)}}function _(e){return{type:"text",raw:e,text:e}}function
|
|
6
|
-
`,1)[0];if(t===void 0)throw Error("Codex Markdown token has no first line");return(t.match(/\S+/)?.[0]??t).slice(0,ke)}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}:${j(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return j(e.text);default:return""}}function Q(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Y(Je(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=Q(r),s=t.get(o)??0;return t.set(o,s+1),ee(r,`${n}-${o}-${s}`)})}function Ve(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return a("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?a("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},void 0,!1,void 0,this),e.checked?a(K,{},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,m(t,n)]},n,!0,void 0,this)}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,!1,void 0,this):a("ul",{className:r,children:o},n,!1,void 0,this)}function W(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return z(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
|
|
4
|
+
`)||J(r))return e;return`${e}${n}`}function Le(e){return e.startsWith("/")&&!e.startsWith("//")||/^[A-Za-z]:[\\/]/.test(e)||/^\\\\[^\\]+\\[^\\]+/.test(e)||/^\/\/[^/]+\/[^/]+/.test(e)}function V(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 Ee(e){let{path:n,line:t,column:r,endLine:o,endColumn:s}=V(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 Ie(e){let{path:n}=V(e);if(Le(n))return!0;try{return new URL(n).protocol==="file:"}catch{return!1}}function $e(e){let n=e.match(F);if(n===null)return e;let t=n[2];if(t===void 0)throw Error("Codex streaming link target is missing");return Ee(t)||Ie(t)?e.replace(F,"$1"):`${e})`}function Re(e){let n=e.replace(be,"");if(n.length===0||n.includes("`")&&J(n))return{isCodeFenceOpen:!1,markdown:n};if(n.includes("```")&&Ne(n))return{isCodeFenceOpen:!0,markdown:Me(n)};if(n.includes(")n=$e(n);return n=A(n,"**"),n=A(n,"*"),{isCodeFenceOpen:!1,markdown:n}}function Pe(e){return e?.type==="paragraph"&&"tokens"in e&&Array.isArray(e.tokens)}function H(e){return Pe(e)&&e.tokens.length===1&&e.tokens[0]?.type==="image"}function Z(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))Z(t.tokens);if(!H(t))continue;let r=[...t.tokens],o=n+1,s=o;for(;;){while(e[o]?.type==="space")o+=1;let i=e[o];if(!H(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 _(e){return{type:"text",raw:e,text:e}}function Se(e){return{type:"paragraph",raw:e.raw,text:e.text,tokens:e.tokens??[e]}}function L(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?[_(s)]:[_(i),...o.tokens]}}if(t.loose)t.tokens=t.tokens.map((o)=>o.type==="text"?Se(o):o);L(t.tokens)}if("tokens"in n&&Array.isArray(n.tokens))L(n.tokens)}}function Fe(e,n,t){e.preventDefault(),e.stopPropagation(),t.openLink(n)}function Ae(e){try{let n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?null:`${n.origin}/favicon.ico`}catch{return null}}function He(e){let n=Ae(e);return n===null?[]:[n,`https://www.google.com/s2/favicons?domain=${new URL(e).origin}&sz=32`]}function _e({href:e}){let n=D(()=>He(e),[e]),[t,r]=f(),o=n.length===0&&!/^[a-z][a-z0-9+.-]*:/i.test(e),s=e.toLowerCase().startsWith("mailto:")?me:o?le:ue;return a("span",{className:"codex-markdown-favicon",children:[t===void 0?a("span",{className:"codex-markdown-favicon-fallback",children:a(s,{"aria-hidden":!0},void 0,!1,void 0,this)},void 0,!1,void 0,this):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,!1,void 0,this))]},void 0,!0,void 0,this)}function Oe({children:e,href:n,title:t}){let r=v();if(r.preview)return a("span",{children:e},void 0,!1,void 0,this);return a("a",{className:"codex-markdown-link","data-inline-mention-interactive":"",href:n,title:t,onClick:(o)=>Fe(o,n,r),children:a("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(_e,{href:n},void 0,!1,void 0,this)},void 0,!1,void 0,this),a("span",{className:"codex-markdown-link-label",children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}function je({code:e,language:n}){let{theme:t,copyLabel:r}=v(),o=p(null),[s,i]=f(null),[c,d]=f(null),[u,k]=f(!1);if(h(()=>{let g=tt(i,d);return o.current=g,()=>{g.dispose(),o.current=null}},[]),h(()=>{let g=o.current;if(g===null)throw Error("Code highlighter is not mounted");g.update(e,n)},[e,n]),c!==null)throw c;let b=s!==null&&s.code===e&&s.language===n?s.html:null;return a("div",{className:"codex-markdown-code-block","data-markdown-copy":"code-block","data-markdown-copy-text":e,"data-theme":t==="dark"?"dark":"light",children:[a("div",{className:"codex-markdown-code-header","data-markdown-copy":"exclude",children:[a("div",{className:"codex-markdown-code-title",children:n},void 0,!1,void 0,this),a("div",{className:"codex-markdown-code-actions",children:a("button",{type:"button",className:"codex-markdown-code-copy",title:r,onClick:()=>{navigator.clipboard.writeText(e),k(!0),window.setTimeout(()=>k(!1),2000)},children:u?a(K,{},void 0,!1,void 0,this):a(ce,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a("div",{className:"codex-markdown-code-container",dir:"ltr",children:a("code",{className:"codex-markdown-code-content hljs",...b===null?{children:e}:{dangerouslySetInnerHTML:{__html:b}}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function We({code:e,language:n}){return v().preview?a("span",{children:e},void 0,!1,void 0,this):a(qe,{code:e,language:n},void 0,!1,void 0,this)}function qe({code:e,language:n}){let t=p(null),[r,o]=f(!1);if(h(()=>{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(je,{code:e,language:n},void 0,!1,void 0,this);return a("div",{ref:t,className:"codex-markdown-code-block",children:a("pre",{className:"codex-markdown-code-placeholder",children:a("code",{children:e},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Ke(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 ze({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 a("div",{className:"codex-markdown-image-preview",children:[a("img",{src:t.src,alt:t.alt},void 0,!1,void 0,this),a("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,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),a("a",{href:t.src,download:!0,"aria-label":"Download image",children:a(de,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),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,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),a("button",{type:"button","aria-label":"Close image preview",onClick:()=>n(void 0),children:a(ge,{},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function Ue(e){return v().preview?a(ne,{children:e.alt},void 0,!1,void 0,this):a(Be,{...e},void 0,!1,void 0,this)}function Be({src:e,alt:n,title:t,allowWide:r}){let o=p(null),[s,i]=f();h(()=>{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 a(ne,{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(Ke(d.currentTarget)),children:a("img",{className:`codex-markdown-image${r?"codex-markdown-image-wide":""}`,src:e,alt:n,title:t,loading:"lazy"},void 0,!1,void 0,this)},void 0,!1,void 0,this),a("dialog",{ref:o,className:"codex-markdown-image-dialog","aria-label":c,onClose:()=>i(void 0),children:s===void 0?null:a(ze,{preview:s,setPreview:i},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function De({value:e,display:n}){let t=p(null);return B(()=>{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"},void 0,!1,void 0,this)}var Ge=150,x=null;function O(e,n){let t=x;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}`,!1,void 0,this)),i=u}if(i<o)s.push(e.slice(i-r));return s}function Y(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 j(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,ke)}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}:${j(n.text)}`}case"html":case"space":case"br":case"hr":case"def":return e.raw;case"math":return j(e.text);default:return""}}function Q(e){return`${e.type==="math"?`math-${e.display?"block":"inline"}`:e.type}-${Y(Je(e))}`}function m(e,n){let t=new Map;return e.map((r)=>{let o=Q(r),s=t.get(o)??0;return t.set(o,s+1),ee(r,`${n}-${o}-${s}`)})}function Ve(e,n){let t=e.task?e.tokens.filter((r)=>r.type!=="checkbox"):e.tokens;return a("li",{className:`codex-markdown-list-item${e.task?"codex-markdown-task-list-item":""}`,children:[e.task?a("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},void 0,!1,void 0,this),e.checked?a(K,{},void 0,!1,void 0,this):null]},void 0,!0,void 0,this):null,m(t,n)]},n,!0,void 0,this)}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,!1,void 0,this):a("ul",{className:r,children:o},n,!1,void 0,this)}function W(e,n,t){let r=t?"th":"td",o=/^\d+$/.test(e.text);return z(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:a("table",{className:"codex-markdown-table",children:[a("thead",{children:a("tr",{className:"codex-markdown-table-row",children:e.header.map((r,o)=>W(r,`${n}-header-${o}`,!0))},void 0,!1,void 0,this)},void 0,!1,void 0,this),a("tbody",{className:"codex-markdown-table-body",children:e.rows.map((r)=>{let o=Y(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)=>W(c,`${i}-cell-${d}`,!1))},i,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},n,!1,void 0,this)}function q(e,n,t){let r=T(e.href);if(!re(r))return null;return a(Ue,{src:r,alt:E(e.text),title:e.title==null?void 0:T(e.title),allowWide:t},n,!1,void 0,this)}function ee(e,n){switch(e.type){case"space":case"def":case"internalMessage":return null;case"hr":return a("hr",{className:"codex-markdown-horizontal-rule"},n,!1,void 0,this);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 z(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)=>q(i,`${n}-image-${c}`,!0)):m(t.tokens,n)},n,!1,void 0,this)}case"text":{let t=e;return t.tokens===void 0?O(E(t.text),n):m(t.tokens,n)}case"escape":return O(e.text,n);case"strong":return a("strong",{className:"codex-markdown-strong",children:m(e.tokens,n)},n,!1,void 0,this);case"em":return a("em",{children:m(e.tokens,n)},n,!1,void 0,this);case"del":return a("del",{children:m(e.tokens,n)},n,!1,void 0,this);case"codespan":return a("span",{className:"codex-markdown-inline-code",dir:"ltr","data-markdown-copy":"inline-code",children:e.text},n,!1,void 0,this);case"br":return a("br",{},n,!1,void 0,this);case"link":{let t=e,r=m(t.tokens,n),o=T(t.href);return re(o)?a(Oe,{href:o,title:t.title==null?void 0:T(t.title),children:r},n,!1,void 0,this):a("span",{children:r},n,!1,void 0,this)}case"image":return q(e,n,!1);case"code":{let t=e;return a(We,{code:t.text,language:t.lang},n,!1,void 0,this)}case"blockquote":return a("blockquote",{className:"codex-markdown-blockquote",children:m(e.tokens,n)},n,!1,void 0,this);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,!1,void 0,this):t.raw}case"math":{let t=e;return a(De,{value:t.text,display:t.display},n,!1,void 0,this)}default:throw Error(`Unsupported Codex Markdown token: ${JSON.stringify(e)}`)}}function w(e){switch(e.type){case"text":{let n=e;return n.tokens===void 0?E(n.text):n.tokens.map(w).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(w).join("");case"list":return e.items.map(w).join("");case"table":{let n=e;return[n.header,...n.rows].map((t)=>t.map((r)=>r.tokens.map(w).join("")).join("")).join("")}default:return""}}function Qe({token:e,tokenKey:n,offset:t,runs:r,generation:o}){let s=x;try{return x={cursor:t,runs:r,generation:o},ee(e,n)}finally{x=s}}var en=U(function({result:n}){let{text:t,isStreaming:r}=n,o=D(()=>{let l=n.tokens;if(n.source.includes("!["))Z(l);L(l);let I=new Map,R=0;return l.map((N)=>{let M=Q(N),P=I.get(M)??0;I.set(M,P+1);let S=w(N),te={token:N,tokenKey:`root-${M}-${P}`,offset:R,visibleText:S};return R+=S.length,te})},[n]),s=o.map((l)=>l.visibleText).join(""),i=p({text:"",visibleText:"",runs:[],generation:0}),c=i.current,d=t.startsWith(c.text)||s.startsWith(c.visibleText),u=d?c.visibleText.length:0,k=performance.now(),b=r&&d?c.runs.filter((l)=>k-l.firstSeenAtMs<Ge):[],y=c.generation+(d?0:1),g={text:t,visibleText:s,runs:b.filter((l)=>l.start<s.length).map((l)=>({...l,end:Math.min(l.end,s.length)})),generation:y};if(r&&s.length>u)g.runs.push({start:u,end:s.length,firstSeenAtMs:k});return B(()=>{i.current=g}),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:g.runs,generation:y},l.tokenKey,!1,void 0,this))},void 0,!1,void 0,this)}),nn=U(function({text:n,isStreaming:t}){let r=p(null),[o,s]=f(()=>ie(n,t)),[i,c]=f(null);if(h(()=>{let d=Xe((u)=>{he(()=>s(u))},c);return r.current=d,()=>{d.dispose(),r.current=null}},[]),h(()=>{let d=r.current;if(d===null)throw Error("Markdown parser is not mounted");let u=t?Re(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},void 0,!1,void 0,this):a(en,{result:o},void 0,!1,void 0,this)});function un({text:e,streaming:n,host:t}){let r=n===!0,[o,s]=f(e);return h(()=>{if(o===e)return;if(!r){s(e);return}let i=requestAnimationFrame(()=>s(e));return()=>cancelAnimationFrame(i)},[o,r,e]),a(X.Provider,{value:t,children:a(nn,{text:r?o:e,isStreaming:r},void 0,!1,void 0,this)},void 0,!1,void 0,this)}export{un as CodexMarkdownRenderer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{xt,pe,g,K,ge,fe,he}from"../chunk-g77gammg.js";export{xt as CODEX_UNKNOWN_TURN_HEIGHT,g as calculateCodexThreadVirtualRange,fe as calculateCodexTurnCenterDistanceFromBottom,he as calculateCodexTurnTargetDistanceFromBottom,pe as createCodexThreadVirtualLayout,ge as preserveCodexThreadDistanceFromBottom,K as preserveCodexThreadRenderedWindow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{W,bt}from"../chunk-ax9ganqr.js";import"../chunk-8bdd6q4w.js";export{bt as CodexUserMessage,W as CopyAction};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{pe,g,K,ge,fe,he}from"../chunk-g77gammg.js";import{forwardRef as Te,useCallback as L,useEffect as xe,useImperativeHandle as be,useLayoutEffect as M,useMemo as ie,useRef as s,useState as N}from"react";import{jsxDEV as m}from"react/jsx-dev-runtime";var Pe=12,J=2,W=800,ye=new Map;function Be({turnKey:_,heightPx:v,placeholder:U=!1,deferUntilReady:n=!1,observe:T,onReady:C,children:k}){let f=s(null),[b,G]=N(!1),X=L((x)=>{f.current=x,T(_,x)},[T,_]);return M(()=>{let x=f.current;if(x===null)throw Error("Codex turn element is missing");let P=()=>{C(x),G(!0)};if(x.querySelector("[data-markdown-pending]")===null){P();return}let d=new MutationObserver(()=>{if(x.querySelector("[data-markdown-pending]")!==null)return;d.disconnect(),P()});return d.observe(x,{childList:!0,subtree:!0}),()=>d.disconnect()},[C]),m("div",{style:b?void 0:{position:"relative",height:v,overflow:"hidden"},children:[m("div",{ref:X,className:"[&_[data-virtualized-turn-content]]:[content-visibility:visible]","data-turn-key":_,"aria-busy":!b||void 0,style:!b&&!U&&n?{visibility:"hidden"}:void 0,"data-turn-ready":b?"":void 0,children:k},void 0,!1,void 0,this),!b&&!U&&n&&m("div",{"aria-hidden":"true",className:"codex-turn-loading",children:m("div",{className:"codex-turn-loading-lines",children:[m("span",{},void 0,!1,void 0,this),m("span",{},void 0,!1,void 0,this),m("span",{},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var Me=Te(function({entries:v,renderTurn:U,scrollElement:n,sessionKey:T,leadingContent:C,leadingInsetPx:k=0,preserveViewport:f=!1},b){let G=s(null),[X,x]=N(k),P=C!==void 0&&C!==null;M(()=>{let e=G.current;if(e===null)return;let t=()=>x(e.getBoundingClientRect().height);t();let o=new ResizeObserver(t);return o.observe(e),()=>o.disconnect()},[P]);let d=ie(()=>ye.get(T),[T]),[Q,Y]=N(()=>d?.turnHeightsByKey??{}),i=ie(()=>pe({entries:v,gapPx:Pe,measuredHeightsByKey:Q,leadingInsetPx:P?X:k}),[v,Q,P,X,k]),ve=ie(()=>{let e=g({distanceFromBottomPx:d?.distanceFromBottomPx??0,layout:i,overscanCount:J,viewportHeightPx:W}),t=d?.renderedWindow;if(t===void 0||t===null)return e;return K({anchorKey:t.anchorKey,layout:i,previousRange:{startIndex:0,endIndex:Math.min(t.count,e.endIndex-e.startIndex)}})??e},[d,i]),[I,oe]=N(ve),[p,ue]=N(W),[c,ae]=N(null),S=s(d?.distanceFromBottomPx??0),E=s(I),se=s(i.turnKeys),l=s(Q),D=s(i),ce=s(i),B=s(new Map),R=s(null),F=s(null),O=s(null),A=s(new Map),Z=s(!1),de=s(()=>{}),V=s(null),le=L(()=>{if(!f||n===null||R.current!==null||V.current!==null)return;let e=n.getBoundingClientRect();if(e.height<=0)return;let t=[...B.current].filter(([,r])=>r.hasAttribute("data-turn-ready")).map(([r,u])=>{let a=u.getBoundingClientRect(),h=D.current.turnIndexByKey.get(r),w=h===void 0?a.height:D.current.heightsPx[h];return{key:r,element:u,rect:a,bottom:a.top+w}}).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)V.current={key:o.key,element:o.element,top:o.rect.top-e.top,scrollTop:n.scrollTop}},[f,n]),ee=s(le);ee.current=le;let H=L((e,t)=>{let o=Math.min(e,i.totalHeightPx),r=g({distanceFromBottomPx:o,layout:i,overscanCount:J,viewportHeightPx:t}),u=E.current,a=u.startIndex<=r.startIndex&&u.endIndex>=r.endIndex?u:r;if(S.current=o,E.current=a,se.current=i.turnKeys,ue(t),a!==u)oe(a)},[i]),q=L((e)=>{let t=Math.max(0,e.scrollHeight-i.totalHeightPx);return Math.max(0,e.scrollHeight-e.clientHeight-e.scrollTop-t)},[i.totalHeightPx]),Re=L((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;ee.current();let r={...l.current,[t]:o};l.current=r,Y(r)},[]),te=L(()=>{if(F.current!==null)return F.current;return F.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);A.current.set(r,u)}if(O.current!==null||A.current.size===0)return;O.current=requestAnimationFrame(()=>{O.current=null;let t=[...A.current].filter(([r,u])=>l.current[r]!==u);if(A.current.clear(),t.length===0)return;ee.current();let o={...l.current,...Object.fromEntries(t)};l.current=o,Y(o)})}),F.current},[]),He=L((e,t)=>{let o=B.current.get(e);if(o!==void 0)te().unobserve(o),B.current.delete(e);if(t===null)return;if(t.dataset.turnKey!==e)throw Error(`Codex turn key does not match its element: ${e}`);B.current.set(e,t),te().observe(t)},[te]);xe(()=>()=>{if(F.current?.disconnect(),O.current!==null)cancelAnimationFrame(O.current);A.current.clear(),F.current=null,B.current.clear()},[]),M(()=>{de.current=()=>{if(n===null)return;let e=q(n);if(R.current!==null){S.current=e,ue(n.clientHeight||W);return}H(e,n.clientHeight||W)}},[q,n,H]),M(()=>{if(n===null)return;if(!Z.current){Z.current=!0;let o=d?.distanceFromBottomPx??0;n.scrollTo({behavior:"instant",top:Math.max(0,o>0?D.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]),M(()=>{if(n===null||c===null)return;let e=B.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 h={...l.current,[c.turnKey]:t};l.current=h,Y(h);return}let o=c.getTargetElement(e)??e,r=e.getBoundingClientRect(),u=o.getBoundingClientRect(),a=he({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)}),H(a,n.clientHeight||W),queueMicrotask(()=>{if(R.current!==c)return;c.complete(),R.current=null,ae(null)})},[i,c,n,H]),M(()=>{let e=ce.current;if(ce.current=i,D.current=i,n===null||c!==null){V.current=null;return}let t=V.current;V.current=null;let o=t===null?void 0:n.contains(t.element)?t.element:B.current.get(t.key);if(f&&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,H(q(n),n.clientHeight);return}let r=S.current;if(f&&e!==i&&Z.current)r=Math.max(0,e.totalHeightPx-n.clientHeight-n.scrollTop);if((r>24||f)&&e!==i){let u=q(n);if(u<=96&&!f){H(u,p);return}let a=g({distanceFromBottomPx:r,layout:e,overscanCount:0,viewportHeightPx:p}),h=e.turnKeys.slice(a.startIndex,a.endIndex).filter((y)=>i.turnIndexByKey.has(y)),w=h.find((y)=>l.current[y]!==void 0)??h[0];if(w!==void 0){let y=ge({anchorKey:w,distanceFromBottomPx:r,nextLayout:i,previousLayout:e});if(y===null)throw Error(`Codex viewport anchor is missing: ${w}`);r=y,n.scrollTo({behavior:"instant",top:Math.max(0,i.totalHeightPx-n.clientHeight-r)})}}H(r,p)},[i,c,q,n,H,p,f]),M(()=>{E.current=I},[I]),xe(()=>()=>{R.current?.complete(),R.current=null;let e=E.current,o=D.current.turnKeys[e.startIndex];ye.set(T,{distanceFromBottomPx:S.current,renderedWindow:o===void 0?null:{anchorKey:o,count:e.endIndex-e.startIndex},turnHeightsByKey:l.current})},[T]),be(b,()=>({scrollToKey(e,t=(r)=>r,o={align:"center"}){R.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=fe({layout:i,turnKey:e,viewportHeightPx:p});if(a===null)throw Error(`Codex virtual turn is missing: ${e}`);let h=g({distanceFromBottomPx:a,layout:i,overscanCount:J,viewportHeightPx:p});return E.current=h,oe(h),new Promise((w)=>{let y={align:o.align,complete:w,getTargetElement:t,turnKey:u};R.current=y,ae(y)})}}),[i,p]);let z=I,j=se.current;if(!(j===i.turnKeys||j.length===i.turnKeys.length&&j.every((e,t)=>e===i.turnKeys[t]))){let e=j[I.startIndex];z=(e===void 0?null:K({anchorKey:e,layout:i,previousRange:I}))??g({distanceFromBottomPx:S.current,layout:i,overscanCount:J,viewportHeightPx:p})}let ne=v.length-1,me=v[ne],re=v.slice(z.startIndex,Math.min(z.endIndex,ne)).map((e,t)=>({entry:e,index:z.startIndex+t}));if(me!==void 0)re.push({entry:me,index:ne});return m("div",{"data-codex-thread":!0,"data-codex-virtualized-pending-key":c?.turnKey,"data-codex-virtualized-range":`${z.startIndex}:${z.endIndex}`,"data-codex-virtualized-total-count":v.length,"data-codex-virtualized-turn-count":re.length,className:"relative shrink-0",style:{height:i.totalHeightPx},children:[P&&m("div",{ref:G,"data-codex-thread-leading":!0,className:"absolute inset-x-0 top-0",children:C},void 0,!1,void 0,this),re.map(({entry:e,index:t})=>m("div",{className:"absolute inset-x-0",style:{top:i.topOffsetsPx[t]??0},children:m(Be,{turnKey:e.turnKey,heightPx:i.heightsPx[t],placeholder:e.placeholder,deferUntilReady:e.deferUntilReady,observe:He,onReady:Re,children:U(e,t)},void 0,!1,void 0,this)},e.turnKey,!1,void 0,this))]},void 0,!0,void 0,this)});export{Me as VirtualizedTurnList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{V,vt}from"../chunk-arge74eh.js";import"../chunk-hnt4tt1n.js";export{vt as filterFiles,V as filterSlashCommands};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e}from"../chunk-
|
|
1
|
+
import{e}from"../chunk-7pr2j1zb.js";import{N}from"../chunk-8zs8vy0q.js";import"../chunk-hnt4tt1n.js";import{V}from"../chunk-arge74eh.js";import{ue}from"../chunk-bhvtt6tv.js";import{ce}from"../chunk-awbgf3hp.js";import{autoUpdate as rt}from"@floating-ui/dom";import{cn as X}from"cn";import{BookOpenTextIcon as st,FileIcon as it,StoreIcon as lt}from"lucide-react";import{useCallback as ut,useEffect as v,useLayoutEffect as Y,useMemo as Z,useRef as _,useState as g}from"react";import{createPortal as at}from"react-dom";import{jsxDEV as i,Fragment as ct}from"react/jsx-dev-runtime";function wt({handleRef:c,anchorRef:m,commands:T,searchFiles:a,onMention:R,onSearchError:H,fileSearchDebounceMs:C=0,bashMode:A=!1,forcedOpen:l=!1,onForcedOpenChange:f,emptyLabel:F,fileStatusLabels:E,morePlugins:M}){let j=ce(),u=j.textInput.value,[z,K]=g(0),[y,D]=g(null),[b,h]=g(0),U=_(null);v(()=>{let t=c.current?.getTextarea();if(!t)return;let n=()=>K(t.selectionStart??0),o=()=>{if(document.activeElement===t)n()};return t.addEventListener("keyup",n),t.addEventListener("click",n),t.addEventListener("input",n),t.addEventListener("select",n),t.addEventListener("focus",n),document.addEventListener("selectionchange",o),()=>{t.removeEventListener("keyup",n),t.removeEventListener("click",n),t.removeEventListener("input",n),t.removeEventListener("select",n),t.removeEventListener("focus",n),document.removeEventListener("selectionchange",o)}});let W=Z(()=>A&&u.startsWith("!")?null:ue(u,z),[u,z,A]),r=W?.kind==="at"&&!a?null:W,P=`${r?.kind??"forced"}:${r?.query??""}:${l}`,[O,tt]=g(P);if(O!==P)tt(P),h(0);let L=_(null);v(()=>{if(!l){L.current=null;return}if(L.current===null)L.current=u;else if(u!==L.current)f?.(!1)},[l,u,f]);let x=r?.kind==="at"?r.query:null;v(()=>{if(x===null||!a){D(null);return}let t=!0,n=()=>{a(x).then((s)=>{if(t)D({query:x,search:a,items:s})},(s)=>{if(t)D({query:x,search:a,items:[]}),H(s)})},o=C>0?window.setTimeout(n,C):null;if(o===null)n();return()=>{if(t=!1,o!==null)window.clearTimeout(o)}},[x,a,C,H]);let d=Z(()=>{if(r?.kind==="at")return y?.query===r.query&&y.search===a?y.items:[];if(r)return V(T,r.query);if(l)return V(T,"");return[]},[r,l,T,y,a]),[et,q]=g(!1);v(()=>{let t=c.current?.getTextarea();if(!t)return;let n=()=>q(!0),o=()=>{if(q(!1),l)f?.(!1)};return q(document.activeElement===t),t.addEventListener("focus",n),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",n),t.removeEventListener("blur",o)}},[c,l,f]),v(()=>{if(l)c.current?.getTextarea()?.focus()},[l,c]);let p=et&&(r!==null?r.kind==="slash"||d.length>0||!!E:l);v(()=>{if(!p)return;U.current?.querySelector(`[data-idx="${b}"]`)?.scrollIntoView({block:"nearest"})},[b,p]);function Q(t){let n=c.current?.getTextarea();if(!n)return;let o,s;if(r){let B=r.kind==="slash"?`/${t.payload} `:`@${t.label} `;if(o=u.slice(0,r.start)+B+u.slice(r.end),r.kind==="at")R?.(t.payload);s=r.start+B.length}else if(l)o=`${u.length===0||u.endsWith(`
|
|
2
2
|
`)?u:`${u}
|
|
3
|
-
`}/${t.payload} `,s=o.length,f?.(!1);else return;j.textInput.setInput(o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s,s)})}v(()=>{let t=c.current?.getTextarea();if(!t)return;let n=(o)=>{if(!p)return;if(c.current?.isComposing()||o.isComposing||o.keyCode===229)return;if(o.key==="ArrowDown")o.preventDefault(),o.stopPropagation(),h((s)=>d.length===0?0:Math.min(d.length-1,s+1));else if(o.key==="ArrowUp")o.preventDefault(),o.stopPropagation(),h((s)=>Math.max(0,s-1));else if(o.key==="Enter"||o.key==="Tab"){o.preventDefault(),o.stopPropagation();let s=d[b];if(s)
|
|
3
|
+
`}/${t.payload} `,s=o.length,f?.(!1);else return;j.textInput.setInput(o),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s,s)})}v(()=>{let t=c.current?.getTextarea();if(!t)return;let n=(o)=>{if(!p)return;if(c.current?.isComposing()||o.isComposing||o.keyCode===229)return;if(o.key==="ArrowDown")o.preventDefault(),o.stopPropagation(),h((s)=>d.length===0?0:Math.min(d.length-1,s+1));else if(o.key==="ArrowUp")o.preventDefault(),o.stopPropagation(),h((s)=>Math.max(0,s-1));else if(o.key==="Enter"||o.key==="Tab"){o.preventDefault(),o.stopPropagation();let s=d[b];if(s)Q(s)}else if(o.key==="Escape")if(o.preventDefault(),o.stopPropagation(),r)K(Math.max(0,r.start-1)),t.setSelectionRange(r.start,r.start);else f?.(!1)};return t.addEventListener("keydown",n,!0),()=>t.removeEventListener("keydown",n,!0)});let[k,G]=g(null),[S,nt]=g(null),I=ut(()=>{let t=m?.current;if(!t)return;let n=t.getBoundingClientRect();G({left:n.left,width:n.width,bottom:window.innerHeight-n.top+8})},[m]);if(Y(()=>{if(!p){G(null);return}I()},[p,I]),Y(()=>{let t=m?.current;if(!p||!t||!S)return;return rt(t,S,I,{animationFrame:!0})},[p,S,m,I]),!p||m&&!k)return null;let w=r?r.kind==="slash":l,ot=w?st:it,J=i("div",{ref:nt,className:m?"fixed z-50":"absolute inset-x-0 bottom-full z-50 mb-2",style:m&&k?{left:k.left,width:k.width,bottom:k.bottom}:void 0,children:i("div",{ref:U,role:"listbox",onMouseDown:(t)=>t.preventDefault(),className:"bg-popover text-popover-foreground ring-foreground/10 pointer-events-auto w-full overflow-hidden rounded-lg p-1 shadow-md ring-1 outline-hidden",children:[i("div",{className:"max-h-72 overflow-y-auto",children:[d.length===0&&w&&i("div",{className:"text-muted-foreground px-2 py-3 text-xs",children:F},void 0,!1,void 0,this),d.length===0&&!w&&E&&i("div",{role:"status",className:"text-muted-foreground px-2 py-3 text-xs",children:y?.query===x&&y.search===a?E.empty:E.loading},void 0,!1,void 0,this),d.map((t,n)=>i(e,{type:"button",variant:"ghost",role:"option","aria-selected":n===b,"data-idx":n,onMouseDown:(o)=>{o.preventDefault(),Q(t)},onMouseEnter:()=>h(n),className:X("flex h-auto w-full items-center justify-start gap-2.5 rounded-md px-2.5 py-2 text-start",n===b&&"bg-muted"),children:[i(ot,{className:X("size-4 shrink-0",w?"text-blue-500":"text-muted-foreground")},void 0,!1,void 0,this),i("span",{className:"text-foreground shrink-0 text-sm font-medium",children:t.label},void 0,!1,void 0,this),t.description&&i("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:t.description},void 0,!1,void 0,this)]},t.key,!0,void 0,this))]},void 0,!0,void 0,this),w&&M&&i(ct,{children:[i(N,{},void 0,!1,void 0,this),i(e,{type:"button",variant:"ghost",onMouseDown:(t)=>{t.preventDefault(),f?.(!1),M.open()},className:"h-auto w-full justify-start px-2.5 py-2",children:[i(lt,{"data-icon":"inline-start"},void 0,!1,void 0,this),M.label]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return m?at(J,document.body):J}export{wt as CompletionMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ue}from"../chunk-bhvtt6tv.js";export{ue as detectTrigger};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{U}from"../chunk-etvhn65g.js";export{U as EffortSlider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n}from"../chunk-
|
|
1
|
+
import{n}from"../chunk-g3r8m488.js";import"../chunk-2845n9v4.js";export{n as MenuRadioSelect};
|