codex-mobile-re 0.1.103 → 0.1.104
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/LICENSE +11 -11
- package/dist/assets/{AutomationsPanel-CnK1Yuru.js → AutomationsPanel-B_WavWrg.js} +1 -1
- package/dist/assets/{AutomationsPanel-BBeoQ-Fx.css → AutomationsPanel-VRBbmMYW.css} +1 -1
- package/dist/assets/{DirectoryHub-BunsdSMs.js → DirectoryHub-DOxPtme6.js} +2 -2
- package/dist/assets/{DirectoryHub-Ce5pFnd0.css → DirectoryHub-DmZLEiwB.css} +1 -1
- package/dist/assets/{ReviewPane-CyX0PWor.css → ReviewPane-ZrWfZEd_.css} +1 -1
- package/dist/assets/{ReviewPane-C02hbV2G.js → ReviewPane-mi7B5jTv.js} +1 -1
- package/dist/assets/{ThreadConversation-BS09bMfR.js → ThreadConversation-Cq7_5T10.js} +22 -22
- package/dist/assets/{ThreadConversation-D0SQKKN2.css → ThreadConversation-lQVNzD-y.css} +1 -1
- package/dist/assets/{ThreadTerminalPanel-juDCK2c0.js → ThreadTerminalPanel-BGadHi4n.js} +2 -2
- package/dist/assets/{ThreadTerminalPanel-BHXovq7A.css → ThreadTerminalPanel-O7IxAyfy.css} +1 -1
- package/dist/assets/index-BEqmyO3q.js +86 -0
- package/dist/assets/{index-DM1MDzKD.css → index-CRsi_dU2.css} +1 -1
- package/dist/assets/{index.esm-Cls06s1L.js → index.esm-Cxn_LBGD.js} +1 -1
- package/dist/icons/codexui-icon.svg +52 -52
- package/dist/icons/pwa-icon.svg +38 -38
- package/dist/icons/pwa-maskable.svg +36 -36
- package/dist/index.html +21 -21
- package/dist/manifest.webmanifest +36 -36
- package/dist/sw.js +92 -92
- package/dist-cli/index.js +9530 -9282
- package/dist-cli/index.js.map +1 -1
- package/package.json +94 -94
- package/scripts/dev-random-home.cjs +21 -21
- package/scripts/dev.cjs +69 -69
- package/scripts/fix-pty-native-build.cjs +70 -70
- package/dist/assets/index-DDchNpQh.js +0 -87
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import{d as J,o as u,c as K,a as f,w as Oe,b as g,t as k,n as U,e as
|
|
1
|
+
import{d as J,o as u,c as K,a as f,w as Oe,b as g,t as k,n as U,e as _,T as gs,_ as G,u as T,F,r as D,f as le,g as N,I as ps,h as Do,i as Fe,j as te,k as L,l as ce,m as Yt,p as Ke,q as H,s as qt,v as vs,x as Wo,y as ke,z as jo,A as ks,B as qo,C as rt,D as Ve,E as No,G as zo,H as Uo,J as Vo,K as Jn,L as Ko,M as Go}from"./index-BEqmyO3q.js";import{s as Ot}from"./sanitizeHtml-Bd3No2dT.js";function Zo(e){if(!e||/[\r\n]/u.test(e)||e.endsWith("/")||e.endsWith("\\")||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;const n=e.startsWith("/"),s=/^[A-Za-z]:[\\/]/u.test(e),i=e.startsWith("./")||e.startsWith("../")||e.startsWith("~/");return n||s||i||/^[A-Za-z0-9._@() -]+\.[A-Za-z0-9]{1,12}$/u.test(e)?!0:/^[A-Za-z0-9._@() -]+(?:[\\/][A-Za-z0-9._@() -]+)+$/u.test(e)}function ut(e){return e.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||e}function He(e){return e.replace(/\\/gu,"/")}function ys(e){if(!e.startsWith("file://"))return e;let n=e.replace(/^file:\/\//u,"");try{n=decodeURIComponent(n)}catch{}return/^\/[A-Za-z]:\//u.test(n)&&(n=n.slice(1)),n}function Jo(e){const n=He(e),s=n.match(/^\/Users\/([^/]+)/u);if(s)return`/Users/${s[1]}`;const i=n.match(/^\/home\/([^/]+)/u);return i?`/home/${i[1]}`:""}function Be(e){const n=He(e);if(!n)return n;let s="",i=n;const a=i.match(/^([A-Za-z]:)(\/.*)?$/u);a?(s=`${a[1]}/`,i=(a[2]??"").replace(/^\/+/u,"")):i.startsWith("/")&&(s="/",i=i.slice(1));const c=i.split("/").filter(Boolean),l=[];for(const h of c)if(h!=="."){if(h===".."){l.length>0&&l.pop();continue}l.push(h)}const r=l.join("/");return s?`${s}${r}`.replace(/\/+$/u,"")||s:r||n}function ws(e,n){const s=He(ys(e.trim()));if(!s)return"";if(s.startsWith("/")||/^[A-Za-z]:\//u.test(s))return Be(s);if(s.startsWith("~/")){const c=Jo(n);if(c)return Be(`${c}/${s.slice(2)}`)}const a=He(n.trim());return Be(a?`${a.replace(/\/+$/u,"")}/${s}`:s)}function dt(e){let n=e,s="",i="";const a={"(":")","[":"]","{":"}","<":">",'"':'"',"'":"'","`":"`","“":"”","‘":"’"};for(;n.length>0;){const c=n[0],l=Object.prototype.hasOwnProperty.call(a,c)?a[c]:"";if(!l||!n.endsWith(l))break;s+=c,i+=l,n=n.slice(1,-1)}return{core:n,leading:s,trailing:i}}function Ge(e){if(!e)return null;let n=e.trim();n=dt(n).core.trim();let i=null;const a=n.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(a)n=a[1],i=Number(a[2]);else{const c=n.match(/^(.*):(\d+)(?::\d+)?$/u);c&&(n=c[1],i=Number(c[2]))}return n=ys(n),Zo(n)?{path:n,line:i}:null}function Xn(e,n,s){let i=0,a=n-1;for(;a>=s&&e[a]==="*";)i+=1,a-=1;return i}function Xo(e,n){let s=0,i=n;for(;i<e.length&&e[i]==="*";)s+=1,i+=1;return s}function bs(e,n,s,i,a){const c=Xn(e,n,i);return c<2?null:Xo(e,s)>=c?{segmentStart:n-c,segmentEnd:s+c,tokenEndTrim:0}:Xn(a,a.length,0)>=c?{segmentStart:n-c,segmentEnd:s,tokenEndTrim:c}:null}function Nt(e){const n=e.trim();if(!n.startsWith("[")||!n.endsWith(")"))return null;const s=n.indexOf("]");if(s<=1||n[s+1]!=="(")return null;const i=n.slice(1,s).trim(),a=n.slice(s+2,-1).trim();if(i.includes(`
|
|
2
2
|
`)||a.includes(`
|
|
3
|
-
`))return null;const c=dt(i).core.trim()||i,
|
|
4
|
-
`){
|
|
5
|
-
`);if(!
|
|
6
|
-
`)}function fe(e){var s;return(((s=e.match(/^\s*/u))==null?void 0:s[0])??"").replace(/\t/gu," ").length}function xs(e,n){if(n<=0)return e.trimStart();let s=0,i=0;for(;s<e.length&&i<n;){const a=e[s];i+=a===" "?4:1,s+=1}return e.slice(s)}function he(e){return e.trim().length===0}function zt(e){const n=e.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return n?{level:n[1].length,value:n[2].trim()}:null}function lt(e){const n=e.match(/^\s{0,3}>\s?(.*)$/u);return n?n[1]??"":null}function Ze(e){var s;const n=e.match(/^\s*[-*+]\s+(.+)$/u);return((s=n==null?void 0:n[1])==null?void 0:s.trim())??null}function ta(e){var s;const n=e.match(/^(\s*)[-*+]\s+(.+)$/u);return n?{indent:fe(n[1]??""),text:((s=n[2])==null?void 0:s.trim())??""}:null}function Je(e){var s;const n=e.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return n?{checked:(n[1]??" ").toLowerCase()==="x",text:((s=n[2])==null?void 0:s.trim())??""}:null}function es(e){var s;const n=e.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return n?{indent:fe(n[1]??""),item:{checked:(n[2]??" ").toLowerCase()==="x",text:((s=n[3])==null?void 0:s.trim())??""}}:null}function
|
|
7
|
-
`).trim();return c?{value:c,nextIndex:a}:null}function
|
|
8
|
-
`)),nextIndex:
|
|
9
|
-
`),i=[];let a=0;for(;a<s.length;){if(he(s[a])){a+=1;continue}const
|
|
10
|
-
`)});continue}if(Kt(s[a])){i.push({kind:"thematicBreak"}),a+=1;continue}const
|
|
11
|
-
`).trim()});continue}const m=ss(s,a);if(m){i.push(m),a+=2+m.rows.length;continue}if(Je(s[a])!==null){const b=[],E=((c=es(s[a]))==null?void 0:c.indent)??0;for(;a<s.length;){const B=es(s[a]);if(B===null||B.indent!==E)break;b.push(B.item),a+=1}if(b.length>0){i.push({kind:"taskList",items:b});continue}}const
|
|
12
|
-
`).trim();
|
|
13
|
-
`),i=[];let a=0,c=0;const r
|
|
14
|
-
`);i.push(...ia(h))};for(;a<s.length;){const
|
|
15
|
-
`)}),c=a}return
|
|
16
|
-
${n}`.trim():n}function la(e,n){const s=e.operation==="add"||n.operation==="add"?"add":e.operation==="delete"||n.operation==="delete"?"delete":"update";return{path:n.path||e.path,operation:s,movedToPath:n.movedToPath??e.movedToPath??null,diff:ra(e.diff,n.diff),addedLineCount:e.addedLineCount+n.addedLineCount,removedLineCount:e.removedLineCount+n.removedLineCount}}function ca(e,n){const s=e.operation==="add"?0:e.operation==="update"?1:2,i=n.operation==="add"?0:n.operation==="update"?1:2;if(s!==i)return s-i;const a=`${e.path}\0${e.movedToPath??""}`,c=`${n.path}\0${n.movedToPath??""}`;return a.localeCompare(c)}function Dt(e){const n=new Map;for(const s of e){const i=`${s.path}\0${s.movedToPath??""}`,a=n.get(i);n.set(i,a?la(a,s):{...s})}return Array.from(n.values()).sort(ca)}function Qt(e,n){return e.operation==="update"&&e.movedToPath?e.addedLineCount>0||e.removedLineCount>0?n("Moved + edited"):n("Moved"):e.operation==="add"?n("Added"):e.operation==="delete"?n("Deleted"):n("Edited")}function ua(e){return e.operation==="update"&&e.movedToPath?"→":e.operation==="add"?"+":e.operation==="delete"?"−":"M"}function Gt(e){return e.operation==="update"&&e.movedToPath?"move":e.operation}function xe(e){const n=[];return e.addedLineCount>0&&n.push(`+${e.addedLineCount}`),e.removedLineCount>0&&n.push(`-${e.removedLineCount}`),n.join(" ")}function
|
|
3
|
+
`))return null;const c=dt(i).core.trim()||i,l=dt(a).core.trim();return l?{label:c,target:l}:null}function ft(e){const n=e.trim().match(/^codex:\/\/threads\/([A-Za-z0-9-]+)$/u);if(!n)return null;if(typeof window>"u")return`/#/thread/${n[1]}`;const s=window.location.pathname.replace(/\/?$/u,"/");return`${window.location.origin}${s}#/thread/${n[1]}`}function Yn(e){const n=Math.min(6,Math.max(1,Math.trunc(e)));return`h${String(n)}`}function Qn(e){switch(Math.min(6,Math.max(1,Math.trunc(e)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function Yo(e){const n=e.trim();if(!n)return"";if(n.startsWith("data:")||n.startsWith("blob:")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("/codex-local-image?"))return n;if(n.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(n)}`;const s=n.startsWith("/"),i=/^[A-Za-z]:[\\/]/u.test(n);return s||i?`/codex-local-image?path=${encodeURIComponent(n)}`:n}function Re(e,n={}){const s=[],i=/codex:\/\/threads\/[A-Za-z0-9-]+|https?:\/\/[^\s<>"'`,。;:!?、()[\]{}「」『』《》]+|file:\/\/[^\n<>"'`,。;:!?、[\]{}「」『』《》]+|["'](?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^\n"']+["']|`(?:[A-Za-z]:[\\/]|~\/|\.{1,2}\/|\/)[^`\n]+`/gu;let a=0;for(const c of e.matchAll(i)){if(typeof c.index!="number")continue;const l=c.index,r=l+c[0].length;let h=c[0],m="";for(;/[.,;:!?,。;:!?、]$/u.test(h);)m=h.slice(-1)+m,h=h.slice(0,-1);const y=bs(e,l,r,a,h),I=(y==null?void 0:y.segmentStart)??l,S=(y==null?void 0:y.segmentEnd)??r;I>a&&s.push({kind:"text",value:e.slice(a,I)}),y!=null&&y.tokenEndTrim&&(h=h.slice(0,-y.tokenEndTrim));const C=dt(h);h=C.core;const A=C.leading,b=C.trailing+m;A&&s.push({kind:"text",value:A});const E=ft(h);if(E)s.push({kind:"url",value:E,href:E}),b&&s.push({kind:"text",value:b});else if(h.startsWith("**")&&h.endsWith("**")&&h.length>4)s.push({kind:"bold",value:h.slice(2,-2)}),b&&s.push({kind:"text",value:b});else if(/^https?:\/\//u.test(h))s.push({kind:"url",value:h,href:h}),b&&s.push({kind:"text",value:b});else{const B=Ge(h);B?(s.push({kind:"file",value:h,path:B.path,displayPath:h,downloadName:ut(B.path)}),b&&s.push({kind:"text",value:b})):s.push({kind:"text",value:c[0]})}a=S}return a<e.length&&s.push({kind:"text",value:e.slice(a)}),n.applyMarkdownMarkers===!1?s:$s(s)}function Ht(e,n){const s=[];let i=!1,a="";const c=l=>{l&&s.push({kind:"text",value:l})};for(const l of e){if(l.kind!=="text"){i&&(c(`${n.marker}${a}`),i=!1,a=""),s.push(l);continue}let r=l.value;for(;r.length>0;){const h=r.indexOf(n.marker);if(h<0){i?a+=r:c(r);break}const m=r.slice(0,h);if(i?a+=m:c(m),r=r.slice(h+n.marker.length),i){const y=a;y.length>0&&(!n.isValidContent||n.isValidContent(y))?s.push({kind:n.kind,value:y}):c(`${n.marker}${y}${n.marker}`),a="",i=!1}else i=!0}}return i&&c(`${n.marker}${a}`),s}function $s(e){const n=i=>i.trim().length>0&&!/^\s/u.test(i)&&!/\s$/u.test(i);let s=Ht(e,{marker:"**",kind:"bold",isValidContent:n});return s=Ht(s,{marker:"~~",kind:"strikethrough",isValidContent:n}),s=Ht(s,{marker:"*",kind:"italic",isValidContent:n}),s}function Qo(e,n={}){const s=[];let i=0,a=0;const c=(l,r)=>{let h=l.indexOf("[",r);for(;h>=0;){const m=l.indexOf("]",h+1);if(m<0)return null;if(l[m+1]!=="("){h=l.indexOf("[",h+1);continue}let y=1,I=m+2,S=!1;for(;I<l.length;){const C=l[I];if(C===`
|
|
4
|
+
`){S=!0;break}if(C==="("&&(y+=1),C===")"&&(y-=1,y===0)){const A=l.slice(h,I+1);if(Nt(A))return{start:h,end:I+1,token:A};break}I+=1}if(S){h=l.indexOf("[",h+1);continue}h=l.indexOf("[",h+1)}return null};for(;a<e.length;){const l=c(e,a);if(!l)break;const{start:r,end:h,token:m}=l,y=bs(e,r,h,i,m),I=(y==null?void 0:y.segmentStart)??r,S=(y==null?void 0:y.segmentEnd)??h;I>i&&s.push(...Re(e.slice(i,I),n));const C=Nt(m);if(!C){s.push(...Re(e.slice(I,S),n)),i=S,a=S;continue}const A=C.label,b=C.target,E=ft(b);if(E)s.push({kind:"url",value:A||E,href:E});else if(/^https?:\/\//u.test(b))s.push({kind:"url",value:A||b,href:b});else{const B=Ge(b);B?s.push({kind:"file",value:b,path:B.path,displayPath:A||b,downloadName:ut(B.path)}):s.push({kind:"text",value:m})}i=S,a=S}return i<e.length&&s.push(...Re(e.slice(i),n)),s}function ea(e){const n=e.includes("`"),s=Qo(e,{applyMarkdownMarkers:!n});if(!n)return s;if(!s.some(a=>a.kind==="text"&&a.value.includes("`")))return $s(s);const i=a=>{if(!a.includes("`"))return Re(a);const c=[];let l=0,r=0;for(;l<a.length;){if(a[l]!=="`"){l+=1;continue}let h=1;for(;l+h<a.length&&a[l+h]==="`";)h+=1;const m="`".repeat(h);let y=l+h,I=-1;for(;y<a.length;){const C=a.indexOf(m,y);if(C<0)break;const A=C>0&&a[C-1]==="`",b=C+h<a.length&&a[C+h]==="`",E=a.slice(l+h,C).includes(`
|
|
5
|
+
`);if(!A&&!b&&!E){I=C;break}y=C+1}if(I<0){l+=h;continue}l>r&&c.push(...Re(a.slice(r,l)));const S=a.slice(l+h,I);if(S.length>0){const C=Nt(S);if(C){const A=ft(C.target);if(A)c.push({kind:"url",value:C.label||A,href:A});else if(/^https?:\/\//u.test(C.target))c.push({kind:"url",value:C.label||C.target,href:C.target});else{const b=Ge(C.target);b?c.push({kind:"file",value:C.target,path:b.path,displayPath:C.label||C.target,downloadName:ut(b.path)}):c.push({kind:"code",value:S})}}else{const A=ft(S);if(A)c.push({kind:"url",value:A,href:A});else if(/^https?:\/\/[^\s]+$/u.test(S))c.push({kind:"url",value:S,href:S});else{const b=Ge(S);if(b){const E=b.line?`${b.path}:${String(b.line)}`:b.path;c.push({kind:"file",value:S,path:b.path,displayPath:E,downloadName:ut(b.path)})}else c.push({kind:"code",value:S})}}}else c.push({kind:"text",value:`${m}${m}`});l=I+h,r=l}return r<a.length&&c.push(...Re(a.slice(r))),c};return s.flatMap(a=>a.kind==="text"?i(a.value):[a])}function Cs(e){return e.replace(/\r\n/gu,`
|
|
6
|
+
`)}function fe(e){var s;return(((s=e.match(/^\s*/u))==null?void 0:s[0])??"").replace(/\t/gu," ").length}function xs(e,n){if(n<=0)return e.trimStart();let s=0,i=0;for(;s<e.length&&i<n;){const a=e[s];i+=a===" "?4:1,s+=1}return e.slice(s)}function he(e){return e.trim().length===0}function zt(e){const n=e.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return n?{level:n[1].length,value:n[2].trim()}:null}function lt(e){const n=e.match(/^\s{0,3}>\s?(.*)$/u);return n?n[1]??"":null}function Ze(e){var s;const n=e.match(/^\s*[-*+]\s+(.+)$/u);return((s=n==null?void 0:n[1])==null?void 0:s.trim())??null}function ta(e){var s;const n=e.match(/^(\s*)[-*+]\s+(.+)$/u);return n?{indent:fe(n[1]??""),text:((s=n[2])==null?void 0:s.trim())??""}:null}function Je(e){var s;const n=e.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return n?{checked:(n[1]??" ").toLowerCase()==="x",text:((s=n[2])==null?void 0:s.trim())??""}:null}function es(e){var s;const n=e.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return n?{indent:fe(n[1]??""),item:{checked:(n[2]??" ").toLowerCase()==="x",text:((s=n[3])==null?void 0:s.trim())??""}}:null}function Ts(e){var s;const n=e.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return n?{indent:fe(n[1]??""),start:Number.parseInt(n[2]??"1",10)||1,text:((s=n[3])==null?void 0:s.trim())??""}:null}function Ut(e){var n;return((n=Ts(e))==null?void 0:n.text)??null}function ts(e){return Ts(e)}function Vt(e){const n=e.trim();if(!n.includes("|"))return null;let s=n;s.startsWith("|")&&(s=s.slice(1)),s.endsWith("|")&&(s=s.slice(0,-1));const i=[];let a="",c=0;for(let l=0;l<s.length;l+=1){const r=s[l];if(r==="\\"&&s[l+1]==="|"){a+="|",l+=1;continue}if(r==="`"){let h=1;for(;s[l+h]==="`";)h+=1;a+=s.slice(l,l+h),c===0?c=h:c===h&&(c=0),l+=h-1;continue}if(r==="|"&&c===0){i.push(a.trim()),a="";continue}a+=r}return i.push(a.trim()),i.some(l=>l.length>0)?i:null}function na(e){const n=Vt(e);if(!n||n.length===0)return null;const s=n.map(i=>{const a=i.replace(/\s+/gu,"");if(!/^:?-{3,}:?$/u.test(a))return null;const c=a.startsWith(":"),l=a.endsWith(":");return c&&l?"center":l?"right":c?"left":null});return s.every((i,a)=>i!==null||/^-+$/u.test(n[a].replace(/\s+/gu,"")))?s:null}function ns(e,n){return e.length===n?e:e.length>n?e.slice(0,n):[...e,...Array.from({length:n-e.length},()=>"")]}function ss(e,n){var y;if(n+1>=e.length)return null;const s=e[n],i=e[n+1],a=Vt(s),c=na(i);if(!a||!c||a.length!==c.length)return null;const l=s.trim();if(!l.startsWith("|")&&(((y=l.match(/\|/gu))==null?void 0:y.length)??0)<2)return null;const r=a.length,h=[];let m=n+2;for(;m<e.length&&!he(e[m]);){const I=Vt(e[m]);if(!I)break;h.push(ns(I,r)),m+=1}return{kind:"table",headers:ns(a,r),rows:h,alignments:c}}function sa(e){return he(e)||ht(e)!==null||Kt(e)||zt(e)!==null||lt(e)!==null||Je(e)!==null||Ze(e)!==null||Ut(e)!==null}function oa(e,n,s=-1){const i=[];let a=n;for(;a<e.length&&!(sa(e[a])||s>=0&&fe(e[a])<=s);)i.push(s>=0?xs(e[a],s+1):e[a]),a+=1;const c=i.join(`
|
|
7
|
+
`).trim();return c?{value:c,nextIndex:a}:null}function _s(e,n){for(let s=n;s<e.length;s+=1)if(!he(e[s]))return s;return-1}function aa(e,n,s,i=null,a=!1){const c=[];let l=n;for(;l<e.length;){const r=e[l];if(he(r)){const I=_s(e,l+1);if(I===-1){c.push(""),l=e.length;break}const S=i==null?void 0:i(e[I]);if(S&&S.indent===s||fe(e[I])<=s)break;c.push(""),l+=1;continue}const h=i==null?void 0:i(r);if(h&&h.indent===s)break;const m=fe(r),y=a&&(Je(r)!==null||Ze(r)!==null);if(m<=s&&!y)break;c.push(m>s?xs(r,s+1):r.trimStart()),l+=1}for(;c.length>0&&he(c[0]);)c.shift();for(;c.length>0&&he(c[c.length-1]);)c.pop();return c.length===0?null:{blocks:ct(c.join(`
|
|
8
|
+
`)),nextIndex:l}}function os(e,n,s,i=!1){const a=[];let c=n;const l=s(e[n]);if(!l)return null;const r=l.indent;for(;c<e.length;){const h=s(e[c]);if(h===null||h.indent!==r)break;const m=[h.text],y=[];for(c+=1;c<e.length;){if(he(e[c])){const b=_s(e,c+1);if(b===-1){c=e.length;break}const E=s(e[b]);if(E&&E.indent===r){c=b;break}if(fe(e[b])<=r){c=b;break}c+=1;continue}const I=s(e[c]);if(I&&I.indent===r)break;const S=fe(e[c])>r,C=i&&(Je(e[c])!==null||Ze(e[c])!==null);if(S||C){const b=aa(e,c,r,s,i);if(b){y.push(...b.blocks),c=b.nextIndex;continue}}if(fe(e[c])<=r)break;const A=oa(e,c,r);if(!A)break;m.push(A.value),c=A.nextIndex}a.push(y.length>0?{paragraphs:m,children:y}:{paragraphs:m})}return a.length>0?{items:a,nextIndex:c}:null}function Kt(e){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(e.trim())}function ht(e){const n=e.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return n?{marker:n[1],language:(n[2]??"").trim()}:null}function ct(e){var c;const s=Cs(e).split(`
|
|
9
|
+
`),i=[];let a=0;for(;a<s.length;){if(he(s[a])){a+=1;continue}const l=ht(s[a]);if(l){a+=1;const b=[];for(;a<s.length;){if(s[a].trim()===l.marker){a+=1;break}b.push(s[a]),a+=1}i.push({kind:"codeBlock",language:l.language,value:b.join(`
|
|
10
|
+
`)});continue}if(Kt(s[a])){i.push({kind:"thematicBreak"}),a+=1;continue}const r=zt(s[a]);if(r){i.push({kind:"heading",level:r.level,value:r.value}),a+=1;continue}if(lt(s[a])!==null){const b=[];for(;a<s.length;){const E=lt(s[a]);if(E===null)break;b.push(E),a+=1}i.push({kind:"blockquote",value:b.join(`
|
|
11
|
+
`).trim()});continue}const m=ss(s,a);if(m){i.push(m),a+=2+m.rows.length;continue}if(Je(s[a])!==null){const b=[],E=((c=es(s[a]))==null?void 0:c.indent)??0;for(;a<s.length;){const B=es(s[a]);if(B===null||B.indent!==E)break;b.push(B.item),a+=1}if(b.length>0){i.push({kind:"taskList",items:b});continue}}const I=Ze(s[a]);if(I!==null){const b=os(s,a,ta);if(b){i.push({kind:"unorderedList",items:b.items}),a=b.nextIndex;continue}if(I.length>0){i.push({kind:"unorderedList",items:[{paragraphs:[I]}]}),a+=1;continue}}const S=Ut(s[a]);if(S!==null){const b=ts(s[a]),E=os(s,a,ts,!0);if(E){i.push({kind:"orderedList",items:E.items,start:(b==null?void 0:b.start)??1}),a=E.nextIndex;continue}if(S.length>0){i.push({kind:"orderedList",items:[{paragraphs:[S]}],start:(b==null?void 0:b.start)??1}),a+=1;continue}}const C=[];for(;a<s.length&&!(he(s[a])||ht(s[a])||Kt(s[a])||zt(s[a])||ss(s,a)||lt(s[a])!==null||Je(s[a])!==null||Ze(s[a])!==null||Ut(s[a])!==null);)C.push(s[a]),a+=1;const A=C.join(`
|
|
12
|
+
`).trim();A&&i.push({kind:"paragraph",value:A})}return i}function ia(e){if(!e.includes(")return ct(e);const n=[],s=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let i=0;for(const a of e.matchAll(s)){const[c,l,r]=a;if(typeof a.index!="number")continue;const h=a.index,m=h+c.length,y=Yo(r.trim());y&&(h>i&&n.push(...ct(e.slice(i,h))),n.push({kind:"image",url:y,alt:l.trim(),markdown:c}),i=m)}return i<e.length&&n.push(...ct(e.slice(i))),n}function as(e){const s=Cs(e).split(`
|
|
13
|
+
`),i=[];let a=0,c=0;const l=r=>{if(r<=c)return;const h=s.slice(c,r).join(`
|
|
14
|
+
`);i.push(...ia(h))};for(;a<s.length;){const r=ht(s[a]);if(!r){a+=1;continue}l(a),a+=1;const h=[];for(;a<s.length;){if(s[a].trim()===r.marker){a+=1;break}h.push(s[a]),a+=1}i.push({kind:"codeBlock",language:r.language,value:h.join(`
|
|
15
|
+
`)}),c=a}return l(s.length),i.length>0?i:[{kind:"paragraph",value:e}]}const Is={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",md:"markdown","c++":"cpp","c#":"csharp",ps1:"powershell"};function Y(e){return`${e.path}\0${e.movedToPath??""}`}function ra(e,n){return e?!n||e===n?e:`${e}
|
|
16
|
+
${n}`.trim():n}function la(e,n){const s=e.operation==="add"||n.operation==="add"?"add":e.operation==="delete"||n.operation==="delete"?"delete":"update";return{path:n.path||e.path,operation:s,movedToPath:n.movedToPath??e.movedToPath??null,diff:ra(e.diff,n.diff),addedLineCount:e.addedLineCount+n.addedLineCount,removedLineCount:e.removedLineCount+n.removedLineCount}}function ca(e,n){const s=e.operation==="add"?0:e.operation==="update"?1:2,i=n.operation==="add"?0:n.operation==="update"?1:2;if(s!==i)return s-i;const a=`${e.path}\0${e.movedToPath??""}`,c=`${n.path}\0${n.movedToPath??""}`;return a.localeCompare(c)}function Dt(e){const n=new Map;for(const s of e){const i=`${s.path}\0${s.movedToPath??""}`,a=n.get(i);n.set(i,a?la(a,s):{...s})}return Array.from(n.values()).sort(ca)}function Qt(e,n){return e.operation==="update"&&e.movedToPath?e.addedLineCount>0||e.removedLineCount>0?n("Moved + edited"):n("Moved"):e.operation==="add"?n("Added"):e.operation==="delete"?n("Deleted"):n("Edited")}function ua(e){return e.operation==="update"&&e.movedToPath?"→":e.operation==="add"?"+":e.operation==="delete"?"−":"M"}function Gt(e){return e.operation==="update"&&e.movedToPath?"move":e.operation}function xe(e){const n=[];return e.addedLineCount>0&&n.push(`+${e.addedLineCount}`),e.removedLineCount>0&&n.push(`-${e.removedLineCount}`),n.join(" ")}function Ls(e,n,s=""){const i=[];return e>0&&i.push({tone:"add",label:`+${e}`}),n>0&&i.push({tone:"remove",label:`-${n}`}),i.length>0?i:s?[{tone:"neutral",label:s}]:[]}function da(e){return Ls(e.addedLineCount,e.removedLineCount)}function Ms(e,n){return e===1?`1 ${n("file changed")}`:`${e} ${n("files changed")}`}function fa(e,n){if(!e||e.changes.length===0)return"";let s=0,i=0,a=0,c=0;for(const r of e.changes){if(r.operation==="add"){s+=1;continue}if(r.operation==="delete"){i+=1;continue}if(r.movedToPath){c+=1;continue}a+=1}const l=[];return a>0&&l.push(`${a} ${n("edited")}`),s>0&&l.push(`${s} ${n("added")}`),i>0&&l.push(`${i} ${n("deleted")}`),c>0&&l.push(`${c} ${n("moved")}`),l.join(", ")}function ha(e,n){if(!e||e.changes.length===0)return n("Modified files");const s=Ms(e.changes.length,n),i=fa(e,n);return i?`${s} · ${i}`:s}function ma(e){if(!e||e.changes.length===0)return[];const n=e.changes.reduce((a,c)=>a+c.addedLineCount,0),s=e.changes.reduce((a,c)=>a+c.removedLineCount,0),i=e.changes.some(a=>a.movedToPath)?"Moved":"Ready";return Ls(n,s,i)}function De(e,n){const s=ws(e,n),i=Be(He(n.trim())),a=Be(He(s));return i&&a.startsWith(`${i}/`)?a.slice(i.length+1):e}function ga(e,n,s){if(!e||e.changes.length===0)return"";const i=e.changes.map(a=>{const c=De(a.path,n),l=a.movedToPath?` -> ${De(a.movedToPath,n)}`:"",r=xe(a);return`- ${Qt(a,s)}: ${c}${l}${r?` (${r})`:""}`});return`${s("Modified files")}:
|
|
17
17
|
${i.join(`
|
|
18
|
-
`)}`.trim()}function pa(e){var i;const s=((i=(e.movedToPath||e.path).split(".").pop())==null?void 0:i.toLowerCase())??"";return
|
|
18
|
+
`)}`.trim()}function pa(e){var i;const s=((i=(e.movedToPath||e.path).split(".").pop())==null?void 0:i.toLowerCase())??"";return Is[s]??s??""}function va(e){return e.operation==="update"&&/^diff --git |^@@ |^--- |^\+\+\+ |^[ +-]|^\*\*\* (Move to:|End of File)/mu.test(e.diff)}function ka(e){const n=e.diff.replace(/\r\n/g,`
|
|
19
19
|
`),s=n.length>0?n.split(`
|
|
20
20
|
`):[];return s.length>0&&s[s.length-1]===""&&s.pop(),s.map((i,a)=>({key:`${Y(e)}:synthetic:${a}`,kind:e.operation==="delete"?"remove":"add",oldLine:e.operation==="delete"?a+1:null,newLine:e.operation==="delete"?null:a+1,text:i}))}function ya(e){const n=e.diff.replace(/\r\n/g,`
|
|
21
21
|
`),s=n.length>0?n.split(`
|
|
22
|
-
`):[];s.length>0&&s[s.length-1]===""&&s.pop();const i=[];let a=0,c=0;for(const[r,l]of s.entries()){const h=l.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/u);if(h){a=Number(h[1]),c=Number(h[2]),i.push({key:`${Y(e)}:hunk:${r}`,kind:"hunk",oldLine:null,newLine:null,text:l});continue}if(l.startsWith("+")&&!l.startsWith("+++")){i.push({key:`${Y(e)}:add:${r}`,kind:"add",oldLine:null,newLine:c,text:l.slice(1)}),c+=1;continue}if(l.startsWith("-")&&!l.startsWith("---")){i.push({key:`${Y(e)}:remove:${r}`,kind:"remove",oldLine:a,newLine:null,text:l.slice(1)}),a+=1;continue}if(l.startsWith(" ")){i.push({key:`${Y(e)}:context:${r}`,kind:"context",oldLine:a,newLine:c,text:l.slice(1)}),a+=1,c+=1;continue}i.push({key:`${Y(e)}:meta:${r}`,kind:"meta",oldLine:null,newLine:null,text:l})}return i}function wa(e){return!e||!e.diff.trim()?[]:va(e)?ya(e):ka(e)}function ba(e){return!!(e!=null&&e.diff.trim())}function $a(e){return e.kind==="add"?"+":e.kind==="remove"?"-":e.kind==="hunk"?"@@":""}const Ca=["aria-label"],xa={class:"confirm-dialog-title"},_a={class:"confirm-dialog-message"},Ta={class:"confirm-dialog-actions"},La=J({__name:"ConfirmDialog",props:{visible:{type:Boolean},title:{},message:{},confirmLabel:{default:""},cancelLabel:{default:""},danger:{type:Boolean,default:!1}},emits:["confirm","cancel"],setup(e){return(n,s)=>(u(),K(gs,{to:"body"},[e.visible?(u(),f("div",{key:0,class:"confirm-dialog-overlay",onClick:s[2]||(s[2]=Oe(i=>n.$emit("cancel"),["self"]))},[g("div",{class:"confirm-dialog-panel",role:"alertdialog","aria-modal":"true","aria-label":e.title},[g("h3",xa,k(e.title),1),g("p",_a,k(e.message),1),g("div",Ta,[g("button",{class:"confirm-dialog-btn confirm-dialog-btn-cancel",type:"button",onClick:s[0]||(s[0]=i=>n.$emit("cancel"))},k(e.cancelLabel||"Cancel"),1),g("button",{class:U(["confirm-dialog-btn confirm-dialog-btn-confirm",{"is-danger":e.danger}]),type:"button",onClick:s[1]||(s[1]=i=>n.$emit("confirm"))},k(e.confirmLabel||"Confirm"),3)])],8,Ca)])):T("",!0)]))}}),Ia=G(La,[["__scopeId","data-v-ccc73a9d"]]),Ma={key:0,class:"diff-viewer-sidebar"},Sa={class:"diff-viewer-sidebar-header"},Aa={class:"diff-viewer-sidebar-title"},Pa={class:"diff-viewer-sidebar-count"},Ea={class:"diff-viewer-sidebar-list"},Fa=["data-active","onClick"],Ba=["data-operation"],Ra={class:"diff-viewer-file-label"},Oa={key:0,class:"diff-viewer-file-delta"},Ha={class:"diff-viewer-main"},Da={class:"diff-viewer-toolbar"},Wa={class:"diff-viewer-title-wrap"},ja={class:"diff-viewer-title"},qa={class:"diff-viewer-subtitle"},Na={key:0},za={class:"diff-viewer-toolbar-actions"},Ua=["aria-label"],Va={key:0,class:"diff-viewer-empty"},Ka={class:"diff-viewer-empty-title"},Ga={class:"diff-viewer-empty-text"},Za={key:1,class:"diff-viewer-panel"},Ja={class:"diff-viewer-meta"},Xa={class:"diff-viewer-language"},Ya={class:"diff-viewer-lines"},Qa=["data-kind"],ei={class:"diff-viewer-line-number"},ti={class:"diff-viewer-line-number"},ni={class:"diff-viewer-line-marker"},si=["innerHTML"],oi={class:"diff-viewer-mobile-sheet-header"},ai={class:"diff-viewer-sidebar-title"},ii={class:"diff-viewer-sidebar-count"},ri={class:"diff-viewer-mobile-sheet-list"},li=["data-active","onClick"],ci=["data-operation"],ui={class:"diff-viewer-file-label"},di={key:0,class:"diff-viewer-file-delta"},fi=J({__name:"DiffViewer",props:{change:{},changes:{},lines:{},isMobile:{type:Boolean},isFileListOpen:{type:Boolean},cwd:{}},emits:["close","select-change","toggle-file-list","close-file-list"],setup(e){const n=e,{t:s}=te();function i(l){return l.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/"/gu,""").replace(/'/gu,"'")}const a=I(()=>l=>Qt(l,s)),c=I(()=>l=>Ms(l,s)),r=I(()=>l=>De(l,n.cwd));return(l,h)=>(u(),K(gs,{to:"body"},[e.change?(u(),f("div",{key:0,class:"diff-viewer-backdrop",onClick:h[5]||(h[5]=m=>l.$emit("close"))},[g("div",{class:"diff-viewer-shell",onClick:h[4]||(h[4]=Oe(()=>{},["stop"]))},[e.isMobile?T("",!0):(u(),f("aside",Ma,[g("div",Sa,[g("p",Aa,k(x(s)("Changed files")),1),g("p",Pa,k(c.value(e.changes.length)),1)]),g("div",Ea,[(u(!0),f(F,null,D(e.changes,m=>(u(),f("button",{key:`diff-viewer:${x(Y)(m)}`,type:"button",class:"diff-viewer-file-button","data-active":x(Y)(m)===x(Y)(e.change),onClick:y=>l.$emit("select-change",m)},[g("span",{class:"file-change-badge","data-operation":x(Gt)(m)},k(a.value(m)),9,Ba),g("span",Ra,[le(k(r.value(m.path))+" ",1),m.movedToPath?(u(),f(F,{key:0},[le(" → "+k(r.value(m.movedToPath)),1)],64)):T("",!0)]),x(xe)(m)?(u(),f("span",Oa,k(x(xe)(m)),1)):T("",!0)],8,Fa))),128))])])),g("section",Ha,[g("div",Da,[g("div",Wa,[g("p",ja,[le(k(r.value(e.change.path))+" ",1),e.change.movedToPath?(u(),f(F,{key:0},[le(" → "+k(r.value(e.change.movedToPath)),1)],64)):T("",!0)]),g("p",qa,[le(k(a.value(e.change))+" ",1),x(xe)(e.change)?(u(),f("span",Na," · "+k(x(xe)(e.change)),1)):T("",!0)])]),g("div",za,[e.isMobile?(u(),f("button",{key:0,type:"button",class:"diff-viewer-mobile-files-button",onClick:h[0]||(h[0]=m=>l.$emit("toggle-file-list"))},k(c.value(e.changes.length)),1)):T("",!0),g("button",{class:"image-modal-close diff-viewer-close",type:"button","aria-label":x(s)("Close diff viewer"),onClick:h[1]||(h[1]=m=>l.$emit("close"))},[N(ps,{class:"icon-svg"})],8,Ua)])]),x(ba)(e.change)?(u(),f("div",Za,[g("div",Ja,[g("span",Xa,k(x(pa)(e.change)||"diff"),1)]),g("div",Ya,[(u(!0),f(F,null,D(e.lines,m=>(u(),f("div",{key:m.key,class:"diff-viewer-line","data-kind":m.kind},[g("span",ei,k(m.oldLine??""),1),g("span",ti,k(m.newLine??""),1),g("span",ni,k(x($a)(m)),1),g("code",{class:"diff-viewer-line-code",innerHTML:i(m.text)||" "},null,8,si)],8,Qa))),128))])])):(u(),f("div",Va,[g("p",Ka,k(x(s)("No diff available")),1),g("p",Ga,k(x(s)("This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.")),1)]))]),N(Do,{name:"diff-viewer-sheet"},{default:Fe(()=>[e.isMobile&&e.isFileListOpen?(u(),f("div",{key:0,class:"diff-viewer-mobile-sheet-backdrop",onClick:h[3]||(h[3]=m=>l.$emit("close-file-list"))},[g("div",{class:"diff-viewer-mobile-sheet",onClick:h[2]||(h[2]=Oe(()=>{},["stop"]))},[h[6]||(h[6]=g("div",{class:"diff-viewer-mobile-sheet-handle","aria-hidden":"true"},null,-1)),g("div",oi,[g("p",ai,k(x(s)("Changed files")),1),g("p",ii,k(c.value(e.changes.length)),1)]),g("div",ri,[(u(!0),f(F,null,D(e.changes,m=>(u(),f("button",{key:`diff-viewer-sheet:${x(Y)(m)}`,type:"button",class:"diff-viewer-file-button","data-active":x(Y)(m)===x(Y)(e.change),onClick:y=>l.$emit("select-change",m)},[g("span",{class:"file-change-badge","data-operation":x(Gt)(m)},k(a.value(m)),9,ci),g("span",ui,[le(k(r.value(m.path))+" ",1),m.movedToPath?(u(),f(F,{key:0},[le(" → "+k(r.value(m.movedToPath)),1)],64)):T("",!0)]),x(xe)(m)?(u(),f("span",di,k(x(xe)(m)),1)):T("",!0)],8,li))),128))])])])):T("",!0)]),_:1})])])):T("",!0)]))}}),hi=G(fi,[["__scopeId","data-v-7ec6502b"]]),mi={},gi={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function pi(e,n){return u(),f("svg",gi,[...n[0]||(n[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 14L4 9l5-5m-5 5h11a4 4 0 0 1 0 8H4"},null,-1)])])}const Zt=G(mi,[["render",pi]]),vi={class:"file-change-summary-label"},ki={class:"file-change-summary-status"},yi=["data-tone"],wi={class:"file-change-panel-inner"},bi={class:"file-change-list"},$i=["data-operation","title"],Ci={class:"file-change-path-group"},xi=["title","onClick"],_i={key:0,class:"file-change-arrow"},Ti=["title","onClick"],Li={key:0,class:"file-change-delta"},Ii=["data-tone"],Mi=["title","aria-label","onClick"],Si={key:0,class:"file-change-actions"},Ai={key:0,class:"file-change-action-error"},Pi=["disabled","title","aria-label"],Ei=J({__name:"FileChangeSummaryBlock",props:{summary:{},expanded:{type:Boolean},inline:{type:Boolean},cwd:{},actionable:{type:Boolean},actionStatus:{},actionErrorText:{},nextAction:{},actionLabel:{}},emits:["toggle","open-diff","request-action","request-file-action"],setup(e){const n=e,{t:s}=te(),i=I(()=>l=>Qt(l,s)),a=I(()=>l=>ha(l,s)),c=I(()=>l=>De(l,n.cwd)),r=I(()=>l=>`${s("Undo")} ${De(l.path,n.cwd)}`);return(l,h)=>e.summary?(u(),f("section",{key:0,class:U(["file-change-summary-block",{"file-change-summary-block-inline":e.inline}])},[g("button",{type:"button",class:U(["file-change-summary-row",{"file-change-summary-row-expanded":e.expanded}]),onClick:h[0]||(h[0]=m=>l.$emit("toggle"))},[g("span",{class:U(["file-change-chevron",{"file-change-chevron-open":e.expanded}])},"▶",2),g("span",vi,k(a.value(e.summary)),1),g("span",ki,[(u(!0),f(F,null,D(x(ma)(e.summary),m=>(u(),f("span",{key:`summary-status:${e.summary.turnId}:${m.tone}:${m.label}`,class:"file-change-signed-count","data-tone":m.tone},k(m.label),9,yi))),128))])],2),g("div",{class:U(["file-change-panel",{"file-change-panel-visible":e.expanded}])},[g("div",wi,[g("ul",bi,[(u(!0),f(F,null,D(e.summary.changes,m=>(u(),f("li",{key:`file-change:${e.summary.turnId}:${m.path}:${m.movedToPath||""}`,class:"file-change-item"},[g("span",{class:"file-change-badge","data-operation":x(Gt)(m),title:i.value(m)},k(x(ua)(m)),9,$i),g("span",Ci,[g("button",{type:"button",class:"file-change-path-button",title:m.path,onClick:y=>l.$emit("open-diff",m)},k(c.value(m.path)),9,xi),m.movedToPath?(u(),f("span",_i,"→")):T("",!0),m.movedToPath?(u(),f("button",{key:1,type:"button",class:"file-change-path-button",title:m.movedToPath,onClick:y=>l.$emit("open-diff",m)},k(c.value(m.movedToPath)),9,Ti)):T("",!0)]),m.addedLineCount>0||m.removedLineCount>0?(u(),f("span",Li,[(u(!0),f(F,null,D(x(da)(m),y=>(u(),f("span",{key:`change-delta:${e.summary.turnId}:${m.path}:${y.tone}:${y.label}`,class:"file-change-signed-count","data-tone":y.tone},k(y.label),9,Ii))),128))])):T("",!0),e.actionable?(u(),f("button",{key:1,type:"button",class:"file-change-file-undo-button",title:r.value(m),"aria-label":r.value(m),onClick:y=>l.$emit("request-file-action",m)},[N(Zt,{class:"icon-svg file-change-action-icon"})],8,Mi)):T("",!0)]))),128))]),e.actionable?(u(),f("div",Si,[e.actionErrorText?(u(),f("p",Ai,k(e.actionErrorText),1)):T("",!0),g("button",{type:"button",class:"file-change-action-button",disabled:e.actionStatus==="undoing"||e.actionStatus==="redoing",title:e.nextAction==="redo"?"Redo file changes from this turn":"Undo file changes from this turn","aria-label":e.nextAction==="redo"?"Redo file changes from this turn":"Undo file changes from this turn",onClick:h[1]||(h[1]=m=>l.$emit("request-action",e.nextAction))},[N(Zt,{class:U(["icon-svg file-change-action-icon",{"file-change-action-icon-redo":e.nextAction==="redo"}])},null,8,["class"]),le(" "+k(e.actionLabel),1)],8,Pi)])):T("",!0)])],2)],2)):T("",!0)}}),is=G(Ei,[["__scopeId","data-v-851281a0"]]),Fi=J({__name:"FileLinkContextMenu",props:{visible:{type:Boolean},x:{},y:{},browseUrl:{},editUrl:{}},emits:["close"],setup(e,{emit:n}){const s=e,i=n,a=H(null),c=I(()=>({left:`${String(s.x)}px`,top:`${String(s.y)}px`}));function r(){i("close")}function l(){const _=s.browseUrl;r(),!(!_||_==="#")&&window.open(_,"_blank","noopener,noreferrer")}function h(){const _=s.editUrl;r(),!(!_||_==="#")&&window.open(_,"_blank","noopener,noreferrer")}async function m(){const _=s.browseUrl;if(r(),!(!_||_==="#"))try{await qt(_)}catch{}}function y(_){if(!s.visible)return;const S=a.value;if(!S){r();return}const b=_.target;b instanceof Node&&S.contains(b)||r()}function L(){r()}function P(_){_.key==="Escape"&&r()}return ce(()=>s.visible,_=>{_?(window.addEventListener("pointerdown",y,!0),window.addEventListener("blur",L),window.addEventListener("keydown",P,!0)):(window.removeEventListener("pointerdown",y,!0),window.removeEventListener("blur",L),window.removeEventListener("keydown",P,!0))}),Yt(()=>{window.removeEventListener("pointerdown",y,!0),window.removeEventListener("blur",L),window.removeEventListener("keydown",P,!0)}),(_,S)=>e.visible?(u(),f("div",{key:0,ref_key:"menuRef",ref:a,class:"file-link-context-menu",style:Ke(c.value),onClick:S[0]||(S[0]=Oe(()=>{},["stop"]))},[g("button",{type:"button",class:"file-link-context-menu-item",onClick:l}," Open link "),g("button",{type:"button",class:"file-link-context-menu-item",onClick:m}," Copy link "),e.editUrl?(u(),f("button",{key:0,type:"button",class:"file-link-context-menu-item",onClick:h}," Edit file ")):T("",!0)],4)):T("",!0)}}),Bi=G(Fi,[["__scopeId","data-v-9cda1d9d"]]),Ri=12e3,Oi=240;function Hi(e,{streaming:n,truncateStreaming:s=!0,maxChars:i=Ri,maxLines:a=Oi}){if(!s)return e;let c=e,r=!1;if(i>0&&c.length>i&&(c=c.slice(-i),r=!0),a>0){const l=c.split(/\r?\n/);l.length>a&&(c=l.slice(-a).join(`
|
|
23
|
-
`),
|
|
24
|
-
${c}`:c}const Di={class:"conversation-item conversation-item-overlay"},Wi={class:"message-row"},ji={class:"message-stack"},qi={class:"live-overlay-inline","aria-live":"polite"},Ni={class:"live-overlay-title-row"},zi={key:0,class:"live-overlay-spinner","aria-hidden":"true"},Ui=["aria-expanded"],Vi={class:"live-overlay-label"},Ki={class:"live-overlay-toggle","aria-hidden":"true"},Gi={key:2,class:"live-overlay-label"},Zi={key:0,class:"live-overlay-reasoning"},Ji={key:1,class:"live-overlay-error"},Xi=["href"],Yi=J({__name:"LiveOverlayItem",props:{overlay:{},feedbackMailto:{}},setup(e){const n=e,{buildFeedbackMailto:s,recordVisibleFailure:i}=vs(),{t:a}=te(),c=H(!0);function
|
|
25
|
-
`).trim()});return(a,c)=>(u(),f("div",{class:"reasoning-block","data-state":e.expanded?"expanded":"collapsed"},[g("button",{type:"button",class:"reasoning-block-header","aria-expanded":e.expanded,onClick:c[0]||(c[0]=r=>a.$emit("toggle"))},[g("span",Or,k(x(s)("Thinking process")),1),g("span",Hr,k(e.expanded?"▾":"▸"),1)],8,Rr),e.expanded?(u(),f("div",Dr,[i.value?(u(),f("p",Wr,k(i.value),1)):T("",!0),g("div",{class:"reasoning-block-content message-card",innerHTML:e.contentHtml},null,8,jr)])):T("",!0)],8,Br))}}),ls=G(qr,[["__scopeId","data-v-2136bf8a"]]),Nr=new Set(["read_file","ls","grep","glob","web_fetch","read_skill","code_index","connect_tool_source"]),zr=new Set(["write_file","edit_file","multi_edit","move_file","delete_range","delete_symbol","notebook_edit"]),Ur=new Set(["task","run_skill","explore","research","review","security_review"]);function Vr(e){var s;const n=((s=e.toolCall)==null?void 0:s.tool)??"";return Nr.has(n)?"readonly":zr.has(n)?"modify":Ur.has(n)?"delegate":null}const Kr=2;function Gr(e){var c;const n=[];let s=[],i=null;const a=()=>{if(i!==null&&s.length>=Kr)n.push({type:"batch",kind:i,messages:s});else for(const r of s)n.push({type:"tool",message:r});s=[],i=null};for(const r of e){if(r.messageType!=="toolCall"||((c=r.toolCall)==null?void 0:c.status)==="inProgress"){a(),n.push({type:"tool",message:r});continue}const l=Vr(r);if(l===null){a(),n.push({type:"tool",message:r});continue}i!==null&&i!==l&&a(),i=l,s.push(r)}return a(),n}function Zr(e,n,s){const{t:i}=s;if(e==="readonly"){const a=n.filter(h=>{var m,y;return((m=h.toolCall)==null?void 0:m.tool)==="read_file"||((y=h.toolCall)==null?void 0:y.tool)==="ls"}).length,c=n.filter(h=>{var y;const m=((y=h.toolCall)==null?void 0:y.tool)??"";return m==="grep"||m==="glob"||m==="web_fetch"||m==="code_index"}).length,r=n.length-a-c,l=[];return a>0&&l.push(i("Read {n} files",{n:a})),c>0&&l.push(i("Search {n} files",{n:c})),r>0&&l.push(i("{n} read calls",{n:r})),l.join(" · ")}return e==="modify"?i("Modified {n} files",{n:n.length}):e==="delegate"?i("Delegated {n} tasks",{n:n.length}):i("Explored {n} items",{n:n.length})}const Jr={class:"message-row","data-role":"system"},Xr={class:"message-stack","data-role":"system"},Yr=["title"],Qr={key:0,class:"tool-call-server"},el={class:"tool-call-name"},tl={class:"tool-call-status"},nl={key:0,class:"work-block-spinner","aria-hidden":"true"},sl={key:1,class:"tool-call-status-icon","aria-hidden":"true"},ol={key:2,class:"tool-call-status-icon","aria-hidden":"true"},al=J({__name:"ToolCallRow",props:{message:{}},setup(e){const n=e,{t:s}=te(),i=I(()=>{const r=n.message.toolCall;if(!r)return"";switch(r.status){case"inProgress":return s("Running");case"failed":return s("Failed");default:return s("Done")}}),a=I(()=>{var r;switch((r=n.message.toolCall)==null?void 0:r.status){case"inProgress":return"tool-call-running";case"failed":return"tool-call-error";default:return"tool-call-ok"}}),c=I(()=>{const r=n.message.toolCall;if(!r)return"";const l=[];return r.server&&l.push(r.server),l.push(r.tool),r.error&&l.push(r.error),typeof r.durationMs=="number"&&r.durationMs>=0&&l.push(`${r.durationMs}ms`),l.join(" · ")});return(r,l)=>{var h,m,y,L;return u(),f("div",Jr,[g("div",Xr,[g("div",{class:U(["tool-call-block",a.value]),title:c.value},[l[0]||(l[0]=g("span",{class:"tool-call-icon","aria-hidden":"true"},"🛠",-1)),(h=e.message.toolCall)!=null&&h.server?(u(),f("span",Qr,k(e.message.toolCall.server),1)):T("",!0),g("code",el,k(((m=e.message.toolCall)==null?void 0:m.tool)||e.message.text||"(tool)"),1),g("span",tl,[((y=e.message.toolCall)==null?void 0:y.status)==="inProgress"?(u(),f("span",nl)):((L=e.message.toolCall)==null?void 0:L.status)==="completed"?(u(),f("span",sl,"✓")):(u(),f("span",ol,"✗")),le(" "+k(i.value),1)])],10,Yr)])])}}}),Jt=G(al,[["__scopeId","data-v-5e89e7f5"]]),il=["aria-expanded","title"],rl={class:"tool-batch-toggle","aria-hidden":"true"},ll={class:"tool-batch-label"},cl={class:"tool-batch-count"},ul={key:0,class:"tool-batch-body"},dl=J({__name:"ToolBatchBlock",props:{kind:{},messages:{}},setup(e){const n=e,{t:s}=te(),i=H(!1),a=I(()=>Zr(n.kind,n.messages,{t:s})),c=I(()=>n.messages.map(r=>{var l;return((l=r.toolCall)==null?void 0:l.tool)??""}).join(" · "));return(r,l)=>(u(),f("div",{class:U(["tool-batch-block",{"tool-batch-block--open":i.value}])},[g("button",{type:"button",class:"tool-batch-head","aria-expanded":i.value,title:c.value,onClick:l[0]||(l[0]=h=>i.value=!i.value)},[g("span",rl,k(i.value?"▾":"▸"),1),l[1]||(l[1]=g("span",{class:"tool-batch-icon","aria-hidden":"true"},"🛠",-1)),g("span",ll,k(a.value),1),g("span",cl,k(e.messages.length),1)],8,il),i.value?(u(),f("div",ul,[(u(!0),f(F,null,D(e.messages,h=>(u(),K(Jt,{key:h.id,message:h},null,8,["message"]))),128))])):T("",!0)],2))}}),fl=G(dl,[["__scopeId","data-v-6b794e6e"]]),hl=["data-turn-key"],ml={key:0,class:"conversation-turn-request","aria-label":"User request"},gl={class:"conversation-turn-items"},pl={key:1,class:"conversation-turn-process","aria-label":"Turn process"},vl=["aria-expanded","aria-label"],kl={class:"conversation-turn-process-count"},yl={key:1,class:"conversation-turn-process-heading"},wl={key:2,class:"conversation-turn-items conversation-turn-process-items"},bl={key:2,class:"conversation-turn-final","aria-label":"Assistant final response"},$l={class:"conversation-turn-items"},Cl=J({__name:"ThreadTurn",props:{turnKey:{},request:{},processItems:{default:()=>[]},finalItem:{},fileChangeAnchorIds:{default:()=>[]},warm:{},warmItems:{default:()=>[]}},setup(e){const n=e,{t:s}=te(),i=H(!0),a=I(()=>n.processItems.length+n.fileChangeAnchorIds.length),c=I(()=>!!n.finalItem);return ce(a,(r,l)=>{r>l&&(i.value=!0)}),(r,l)=>e.warm?(u(),f(F,{key:0},[ke(r.$slots,"warm-card",{warm:e.warm},void 0),(u(!0),f(F,null,D(e.warmItems,h=>ke(r.$slots,"default",{key:h.message.id,item:h,section:"warm"},void 0)),128))],64)):(u(),f("li",{key:1,class:"conversation-turn","data-turn-key":e.turnKey},[e.request?(u(),f("section",ml,[g("ol",gl,[ke(r.$slots,"default",{item:e.request,section:"request"},void 0)])])):T("",!0),a.value>0?(u(),f("section",pl,[c.value?(u(),f("button",{key:0,class:"conversation-turn-process-heading conversation-turn-process-toggle",type:"button","aria-expanded":i.value,"aria-label":i.value?x(s)("Collapse turn process"):x(s)("Expand turn process"),onClick:l[0]||(l[0]=h=>i.value=!i.value)},[i.value?(u(),K(jo,{key:0,class:"conversation-turn-process-toggle-icon"})):(u(),K(ks,{key:1,class:"conversation-turn-process-toggle-icon"})),g("span",null,k(x(s)("Turn process")),1),g("span",kl,k(x(s)("{n} process items",{n:a.value})),1)],8,vl)):(u(),f("div",yl,k(x(s)("Turn process")),1)),i.value?(u(),f("ol",wl,[(u(!0),f(F,null,D(e.processItems,h=>ke(r.$slots,"default",{key:h.message.id,item:h,section:"process"},void 0)),128)),(u(!0),f(F,null,D(e.fileChangeAnchorIds,h=>(u(),f("li",{key:`file-change-${h}`,class:"conversation-turn-row conversation-turn-file-change"},[ke(r.$slots,"file-change",{anchorMessageId:h},void 0)]))),128))])):T("",!0)])):T("",!0),e.finalItem?(u(),f("section",bl,[g("ol",$l,[ke(r.$slots,"default",{item:e.finalItem,section:"final"},void 0)])])):T("",!0)],8,hl))}}),xl=G(Cl,[["__scopeId","data-v-8db8edcd"]]),_l=["aria-expanded"],Tl={class:"warm-turn__preview"},Ll={key:0,class:"warm-turn__meta"},Il={class:"warm-turn__content"},Ml={key:1,class:"warm-turn__assistant"},Sl=J({__name:"WarmTurnCard",props:{userText:{},assistantPreview:{},toolCount:{},expanded:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const s=n,{t:i}=te();function a(){s("toggle")}return(c,r)=>(u(),f("div",{class:U(["warm-turn",{"warm-turn--expanded":e.expanded}])},[g("button",{type:"button",class:"warm-turn__head","aria-expanded":e.expanded,onClick:a},[N(ks,{class:U(["warm-turn__chevron",{"warm-turn__chevron--open":e.expanded}])},null,8,["class"]),g("span",Tl,k(e.userText),1),e.toolCount>0?(u(),f("span",Ll,k(x(i)("{n} tools",{n:e.toolCount})),1)):T("",!0)],8,_l),g("div",Il,[e.expanded?ke(c.$slots,"default",{},void 0,!0,0):e.assistantPreview?(u(),f("div",Ml,k(e.assistantPreview),1)):T("",!0)])],2))}}),Al=G(Sl,[["__scopeId","data-v-6b70725e"]]),Pl=["aria-expanded"],El=["title"],Fl={class:"work-block-command"},Bl={class:"work-block-status"},Rl={key:0,class:"work-block-spinner","aria-hidden":"true"},Ol={key:1,class:"work-block-status-icon","aria-hidden":"true"},Hl={key:2,class:"work-block-status-icon","aria-hidden":"true"},Dl={class:"work-block-output-inner"},Wl=["textContent"],jl=["textContent"],ql={key:0,class:"work-block-permission-hint",role:"note"},Nl=J({__name:"WorkBlockItem",props:{command:{},stepIndex:{},expanded:{type:Boolean},compact:{type:Boolean},outputCondensed:{type:Boolean}},emits:["toggle"],setup(e){const n=e,{t:s}=te(),i=I(()=>{var h,m;const l=(h=n.command.commandExecution)==null?void 0:h.status;return l==="inProgress"?"cmd-status-running":l==="completed"&&((m=n.command.commandExecution)==null?void 0:m.exitCode)===0?"cmd-status-ok":"cmd-status-error"}),a=I(()=>{const l=n.command.commandExecution;if(!l)return"";switch(l.status){case"inProgress":return s("Running");case"completed":return l.exitCode===0?s("Done"):`${s("Exit")} ${l.exitCode??"?"}`;case"failed":return s("Failed");case"declined":return s("Declined");case"interrupted":return s("Stopped");default:return""}}),c=[/access to the path .* is denied/iu,/access is denied/iu,/permission denied/iu,/not permitted/iu,/EACCES|EPERM/iu,/denied access|deny access/iu,/拒绝访问/iu,/没有权限/iu,/权限不足/iu,/要求提权|需要提权|require_escalated/iu],r=I(()=>{const l=n.command.commandExecution;if(!l||!(l.status==="failed"||l.status==="declined"||typeof l.exitCode=="number"&&l.exitCode!==0))return"";const m=l.aggregatedOutput??"";return!m||!c.some(y=>y.test(m))?"":s("Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.")});return(l,h)=>{var m,y,L,P,_,S;return u(),f("div",{class:U(["work-block",[i.value,{"work-block-expanded":e.expanded,"work-block-compact":e.compact}]])},[g("button",{type:"button",class:"work-block-header","aria-expanded":e.expanded,onClick:h[0]||(h[0]=b=>l.$emit("toggle"))},[g("span",{class:"work-step-dot",title:`${x(s)("Step")} ${String(e.stepIndex+1)}`},k(e.stepIndex+1),9,El),g("code",Fl,k(x(s)("Command")),1),g("span",Bl,[((m=e.command.commandExecution)==null?void 0:m.status)==="inProgress"?(u(),f("span",Rl)):((y=e.command.commandExecution)==null?void 0:y.status)==="completed"&&((L=e.command.commandExecution)==null?void 0:L.exitCode)===0?(u(),f("span",Ol,"✓")):((P=e.command.commandExecution)==null?void 0:P.status)==="failed"?(u(),f("span",Hl,"✗")):T("",!0),le(" "+k(a.value),1)])],8,Pl),g("div",{class:U(["work-block-output-wrap",{"work-block-output-visible":e.expanded}])},[g("div",Dl,[g("pre",{class:"work-block-output-command",textContent:k(((_=e.command.commandExecution)==null?void 0:_.command)||"(command)")},null,8,Wl),g("pre",{class:U(["work-block-output",{"cmd-output-condensed":e.outputCondensed}]),textContent:k(((S=e.command.commandExecution)==null?void 0:S.aggregatedOutput)||"(no output)")},null,10,jl)])],2),r.value?(u(),f("p",ql,k(r.value),1)):T("",!0)],2)}}}),cs=G(Nl,[["__scopeId","data-v-25bf4cae"]]),zl=2;function us(e){const n=e.messageType;return n==="commandExecution"||n==="toolCall"}function Ul(e){var s,i;return(((s=e.commandExecution)==null?void 0:s.status)??"")==="inProgress"||(((i=e.toolCall)==null?void 0:i.status)??"")==="inProgress"?!0:(e.messageType??"").endsWith(".live")}function Vl(e){const n=[];let s=[],i="";const a=()=>{s.length>0&&(n.push(s),s=[])};for(const l of e){const h=l.turnId??"",m=us(l)&&h!=="";(!m||h!==i)&&(s.length>0&&a(),i=m?h:""),m&&s.push(l)}a();const c=new Map;for(const l of e)l.messageType==="worked"&&l.turnId&&typeof l.durationMs=="number"&&c.set(l.turnId,l.durationMs);const r=[];for(const l of n){if(l.length<zl)continue;const h=l[0].turnId??"";let m=0,y=0,L=0,P=!1;for(const S of l)S.messageType==="toolCall"?m+=1:S.messageType==="reasoning"?y+=1:S.messageType==="commandExecution"&&(L+=1),Ul(S)&&(P=!0);const _=e.some(S=>S.turnId===h&&!us(S));r.push({turnId:h,messages:l,running:P,toolCount:m,thoughtCount:y,commandCount:L,durationMs:c.get(h)??0,hasOutsideContent:_})}return r}function Kl(e,n){const{t:s,formatDuration:i}=n,a=[];return e.running?a.push(s("Working…")):e.durationMs>0?a.push(i(e.durationMs)):a.push(s("Processed")),e.toolCount>0&&a.push(s("{n} tools",{n:e.toolCount})),e.thoughtCount>0&&a.push(s("{n} thoughts",{n:e.thoughtCount})),e.commandCount>0&&a.push(s("{n} commands",{n:e.commandCount})),a.join(" · ")}function Gl(e){return e.role==="user"?"user":e.messageType==="reasoning"?"reasoning":e.messageType==="plan"||e.messageType==="plan.live"?"plan":e.messageType==="fileChange"?"file-change":e.messageType==="commandExecution"||e.messageType==="toolCall"||e.messageType==="worked"?"process":"assistant"}function Zl(e){var n;return e.role==="assistant"&&e.messageType!=="reasoning"&&e.messageType!=="commandExecution"&&e.messageType!=="toolCall"&&e.messageType!=="worked"&&e.messageType!=="plan"&&e.messageType!=="plan.live"&&e.messageType!=="fileChange"&&!((n=e.messageType)!=null&&n.endsWith(".live"))&&e.text.trim().length>0}function Jl(e,n){const s=[];let i=null;for(const c of e)(c.role==="user"||!i)&&(i={key:`turn-${c.id}`,items:[]},s.push(i)),i.items.push({message:c,kind:Gl(c)});const a=s.length-1;for(let c=0;c<s.length;c+=1){const r=s[c];if((n==null?void 0:n.liveOverlayActive)===!0&&c===a)continue;const h=[...r.items].reverse().find(m=>m.kind!=="file-change");h&&Zl(h.message)&&(r.items.some(y=>typeof y.message.messageType=="string"&&y.message.messageType.endsWith(".live"))||(h.kind="final-assistant"))}return s}function Ss(e){return e.replace(/\s+/g," ").trim()}function Xl(e){const n=Ss(e);return n.length<=80?n:n.slice(0,80)}function As(e){const n=Ss(e);return n.length<=80?n:n.slice(0,77)+"..."}function Xt(e){return{sessionKey:e,expandedWarmTurns:new Set,coldPage:0}}function mt(e,n){return e.sessionKey===n?e:Xt(n)}function Yl(e,n){const s=mt(e,n);return{...s,coldPage:s.coldPage+1}}function Ql(e,n,s){const i=mt(e,n),a=Math.max(0,Math.floor(s));return i.coldPage>=a?i:{...i,coldPage:a}}function ds(e,n,s,i){const a=mt(e,n),c=new Set(a.expandedWarmTurns);return i?c.add(s):c.delete(s),{...a,expandedWarmTurns:c}}function ec(e){return e.role==="user"}function tc(e){var n;return((n=e.messageType)==null?void 0:n.endsWith(".live"))===!0}function nc(e){var c;const n=[];let s=-1,i=0;const a=(r,l)=>{n.push({userItem:r,assistantPreview:"",toolCount:0,startIdx:l,endIdx:e.length})};for(let r=0;r<e.length;r+=1){const l=e[r];if(ec(l)){if(s>=0)n[n.length-1].endIdx=r;else{n.push({userItem:l,assistantPreview:"",toolCount:0,startIdx:i,endIdx:e.length}),s=r,i=r;continue}s=r,a(l,r)}else if(s>=0&&n.length>0){const h=n[n.length-1],m=((c=l.text)==null?void 0:c.trim())||"";l.role==="assistant"&&!tc(l)&&m&&(h.assistantPreview=As(m)),l.messageType==="toolCall"&&(h.toolCount+=1)}}return n}function sc({turnCount:e,hotTurns:n,pageSize:s,coldPage:i}){const a=Math.max(0,e),c=Math.max(0,n),r=Math.max(0,a-Math.min(a,c));if(r===0)return{warmStartTurn:0,warmEndTurn:0,coldTurnCount:0};const l=Math.max(0,s),h=Math.max(0,Math.floor(i)),m=Math.min(r,l*(h+1));return{warmStartTurn:r-m,warmEndTurn:r,coldTurnCount:r-m}}function oc({turn:e,turnCount:n,hotTurns:s,pageSize:i}){const a=Math.max(0,n),c=Math.max(0,s),r=Math.max(0,a-Math.min(a,c));if(r===0||e>=r)return 0;const l=Math.max(1,i),h=Math.max(0,Math.floor(e)),m=r-h;return Math.max(0,Math.ceil(m/l)-1)}function fs(e,n,s){if(n.length===0)return e.slice(0);if(s>=n.length)return[];const i=n[s].startIdx;return e.slice(i)}const ac={key:0,class:"conversation-loading"},ic={key:1,class:"conversation-empty"},rc={key:0,class:"conversation-load-more"},lc=["disabled"],cc={key:1,class:"conversation-load-more conversation-warm-collapse"},uc=["disabled"],dc=["id"],fc={class:"message-row","data-role":"system"},hc={class:"message-stack","data-role":"system"},mc={class:"message-row","data-role":"system","data-message-type":"fileChange"},gc={class:"message-stack","data-role":"system"},pc={key:0,class:"conversation-item conversation-item-fold","data-role":"system","data-message-type":"processFold"},vc={class:"message-row","data-role":"system"},kc={class:"message-stack","data-role":"system"},yc={key:0,class:"work-block-list"},wc=["id","data-role","data-message-type"],bc={key:0,class:"message-row thread-compaction-row","data-role":"system"},$c={class:"thread-compaction-inline thread-compaction-inline--pending",role:"status"},Cc={key:1,class:"message-row thread-compaction-row","data-role":"system"},xc={class:"thread-compaction-inline thread-compaction-inline--done",role:"status"},_c={key:2,class:"message-row","data-role":"system"},Tc={class:"message-stack","data-role":"system"},Lc={class:"work-block-list"},Ic=["data-role","data-message-type"],Mc=["data-role"],Sc=["data-role"],Ac={key:5,class:"message-row","data-role":"system","data-message-type":"plan"},Pc={class:"message-stack","data-role":"system"},Ec={class:"thread-plan-record"},Fc={class:"thread-plan-record-header"},Bc={key:0,class:"thread-plan-record-explanation"},Rc={key:1,class:"thread-plan-record-steps"},Oc=["data-status"],Hc={class:"thread-plan-record-marker","aria-hidden":"true"},Dc=["data-role","data-message-type"],Wc=["data-role"],jc=["data-role"],qc=["data-role"],Nc=["onClick"],zc=["src"],Uc=["src","alt"],Vc={key:1,class:"message-file-attachments"},Kc=["href","title"],Gc={key:2,class:"message-skill-attachments"},Zc=["href","title"],Jc={class:"message-skill-chip-prefix"},Xc={class:"message-skill-chip-name"},Yc=["data-role"],Qc={key:0,class:"automation-message-label"},eu={key:0},tu={key:1,class:"work-summary-wrap","aria-live":"polite"},nu={class:"work-summary-text"},su={key:0,class:"message-text"},ou={key:2,class:"message-blockquote"},au={key:3,class:"message-list message-list-unordered"},iu=["innerHTML"],ru={key:4,class:"message-list message-task-list"},lu=["data-checked"],cu={class:"message-list-item-text"},uu=["start"],du=["innerHTML"],fu={key:6,class:"message-table-wrap"},hu={class:"message-table"},mu={key:0},gu={key:7,class:"message-code-block"},pu={key:0,class:"message-code-language"},vu={class:"message-code-pre"},ku=["innerHTML"],yu={key:8,class:"message-divider"},wu={key:9,class:"message-text"},bu=["onClick"],$u=["src"],Cu=["src","alt","onError"],xu=["href","onClick"],_u=["title","aria-label"],Tu=["aria-label"],Lu=["src"],Iu=["src","alt"],Mu=16,Su=300,Au=1200,Pu=300,Eu=250,hs=30,ms=20,Fu=200,Bu=J({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},liveTurnId:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},hasMorePersistedAbove:{type:Boolean},isLoadingPersistedAbove:{type:Boolean},loadEarlierMessages:{type:Function}},emits:["forkThread","rollback","respondServerRequest","fileChangesChanged"],setup(e,{expose:n,emit:s}){function i(t){return ga(t,C.cwd,R)}function a(t){return De(t,C.cwd)}const c=H(new Set),r=H(new Set),l=H(new Set),h=H(null),m=H(""),y=H(!1),L=H(!1),P=H(0),_=H(0),S=H(""),b=H(""),{isMobile:E}=qo(),{buildFeedbackMailto:B,feedbackMailtoBase:X,recordVisibleFailure:ee}=vs(),{t:R}=te(),ye=X();function _e(t,o){ee(o);const d=t.currentTarget;d instanceof HTMLAnchorElement&&(d.href=B())}function Q(t){return t.messageType==="commandExecution"&&!!t.commandExecution}function Ps(t){return t.messageType==="compaction.pending"}function Es(t){return t.messageType==="compaction.done"}function gt(t){return t.messageType==="plan"||t.messageType==="plan.live"}function pt(t){return t.messageType==="reasoning"&&!!t.reasoning}const vt=H(new Set);function en(t){return vt.value.has(t.id)}function tn(t){const o=new Set(vt.value);o.has(t.id)?o.delete(t.id):o.add(t.id),vt.value=o}function nn(t){return t.messageType==="toolCall"&&!!t.toolCall}function Fs(t){return t.messageType==="turnError"}function Xe(t){return t.messageType==="fileChange"&&t.fileChangeStatus==="completed"&&Array.isArray(t.fileChanges)&&t.fileChanges.length>0}function kt(t){return t.role==="assistant"&&!Q(t)&&t.messageType!=="worked"&&!(t.messageType??"").endsWith(".live")}const yt=I(()=>{var t;for(let o=C.messages.length-1;o>=0;o-=1){const d=C.messages[o];if(d.messageType==="commandExecution"&&((t=d.commandExecution)==null?void 0:t.status)==="inProgress")return d.id}return""}),sn=I(()=>C.messages.some(t=>t.role==="assistant"&&t.messageType==="agentMessage.live"&&t.text.trim().length>0)),on=I(()=>!!C.liveOverlay||yt.value.length>0||sn.value),an=I(()=>{const t={};for(let o=0;o<C.messages.length;){const d=C.messages[o];if(!Q(d)){o+=1;continue}const v=[];for(;o<C.messages.length&&Q(C.messages[o]);)v.push(C.messages[o]),o+=1;if(v.length<=1)continue;const $=v[v.length-1];t[$.id]=v.slice(0,-1)}return t}),wt=I(()=>{const t=new Set;for(const o of Object.values(an.value))for(const d of o)t.add(d.id);return t});function rn(t){return!sn.value&&t.id===yt.value}function ln(t){return Q(t)?c.value.has(t.id)||!r.value.has(t.id)&&rn(t):!1}function cn(t){return Q(t)&&on.value}function un(t){var o;return Q(t)&&(on.value||((o=t.commandExecution)==null?void 0:o.status)==="inProgress")}function dn(t){if(!Q(t))return;const o=new Set(c.value),d=new Set(r.value),v=rn(t);o.has(t.id)?(o.delete(t.id),v&&d.add(t.id)):v&&!d.has(t.id)?d.add(t.id):(o.add(t.id),d.delete(t.id)),c.value=o,r.value=d}function Bs(t){return an.value[t.id]??[]}function fn(t){return Q(t)?[...Bs(t),t]:[]}function hn(t){const o=new Set(l.value);o.has(t.id)?o.delete(t.id):o.add(t.id),l.value=o}function Rs(t){return l.value.has(t.id)}function mn(t,o){t&&(h.value=t,m.value=Y(o),y.value=!1)}function Os(){h.value=null,m.value="",y.value=!1}function Hs(){y.value=!y.value}function Ds(){y.value=!1}function Ws(t){m.value=Y(t),E.value&&(y.value=!1)}function bt(t,o){if(t.size===0)return t;const d=new Set;for(const v of t)o.has(v)&&d.add(v);return d.size===t.size?t:d}const C=e,$t=s,me=H(null),gn=H(null),Te=H(""),Ct=H(!1),we=H(""),Z=H({}),oe=H({}),ae=H({}),ue=H(null),js=I(()=>{const t=ue.value;return t?t.kind==="edit-message"?R("Rollback this turn?"):t.action==="undo"?R("Undo file changes?"):R("Redo file changes?"):""}),qs=I(()=>{const t=ue.value;return t?t.kind==="edit-message"?R("This rolls the thread back to this turn so you can edit the message. Later replies will be removed."):t.filePathLabel?t.action==="undo"?R("Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.",{file:t.filePathLabel}):R("Redo the changes to {file}? This reapplies the edits to the working tree.",{file:t.filePathLabel}):t.action==="undo"?R("Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically."):R("Redo the file changes from this turn? This reapplies the edits to the working tree."):""}),ge=H(!0);let be=0,ie=0,Ye=0,ne=null,We=null;const pn=new WeakSet,Qe=H(null),Le=H(0),vn=H(0);let et=null;const je=new Map,qe=new Map,Ie=new Map,Me=new Map;function tt(t,o,d,v){for(t.has(o)&&t.delete(o),t.set(o,d);t.size>v;){const $=t.keys().next().value;if($===void 0)break;t.delete($)}return d}const pe=H(Xt(C.activeThreadId)),kn=I(()=>mt(pe.value,C.activeThreadId)),ve=H(!1),xt=I(()=>C.messages.filter(t=>!gt(t))),Se=I(()=>nc(xt.value)),_t=I(()=>sc({turnCount:Se.value.length,hotTurns:hs,pageSize:ms,coldPage:kn.value.coldPage})),Tt=I(()=>_t.value.warmStartTurn),Ae=I(()=>_t.value.warmEndTurn),yn=I(()=>_t.value.coldTurnCount),wn=I(()=>yn.value>0),Lt=I(()=>kn.value.expandedWarmTurns),Ns=I(()=>{const t=xt.value,o=Se.value,d=[],v=Lt.value;for(let W=Tt.value;W<Ae.value;W+=1){const z=o[W];if(!z)continue;const w={turn:W,userText:As(z.userItem.text),assistantPreview:z.assistantPreview,toolCount:z.toolCount,expanded:v.has(W)},O=v.has(W)?t.slice(z.startIdx,z.endIdx).map(q=>({message:q})):[];d.push({key:`warm-${W}`,warm:w,warmItems:O,processItems:[],fileChangeAnchorIds:[]})}const $=fs(t,o,Ae.value),p=$[0];if(!p)return d;const M=C.messages.findIndex(W=>W.id===p.id),A=M>=0?C.messages.slice(M):$;for(const W of Jl(A,{liveOverlayActive:C.liveOverlay!==null})){const z=W.items.find(j=>j.kind==="user"),w=W.items.find(j=>j.kind==="final-assistant"),O=W.items.filter(j=>j!==z&&j!==w).map(j=>({message:j.message,presentation:j.kind==="plan"?"plan":"process"})),q=W.items.map(j=>j.message.id).filter(j=>!!se(j));d.push({key:W.key,warmItems:[],request:z?{message:z.message}:void 0,processItems:O,fileChangeAnchorIds:q,finalItem:w?{message:w.message,presentation:"final-assistant"}:void 0})}return d});function bn(){pe.value=Yl(pe.value,C.activeThreadId)}function zs(t){pe.value=ds(pe.value,C.activeThreadId,t,!Lt.value.has(t))}const $n=I(()=>Se.value.map((t,o)=>({turn:o,text:Xl(t.userItem.text)}))),Us=I(()=>Math.max(0,$n.value.length-1)),Vs=I(()=>{const t=new Map;return Se.value.forEach((o,d)=>{t.set(o.userItem.id,d)}),t});function It(t){return`question-anchor-${t}`}function Ks(t){const o=Vs.value.get(t.id);if(o!==void 0&&!(o<Ae.value))return It(o)}function Gs(t){if(t<Ae.value){let o=pe.value;if(t<Tt.value){const d=oc({turn:t,turnCount:Se.value.length,hotTurns:hs,pageSize:ms});o=Ql(o,C.activeThreadId,d)}o=ds(o,C.activeThreadId,t,!0),pe.value=o}ge.value=!1,rt().then(()=>{const o=me.value,d=document.getElementById(It(t));if(!o||!d)return;const v=d.getBoundingClientRect(),$=o.getBoundingClientRect(),p=o.scrollTop+v.top-$.top-12;o.scrollTo({top:Math.max(0,p),behavior:"smooth"})})}const Zs=I(()=>{const t=xt.value,o=Se.value,d=[];for(let M=Tt.value;M<Ae.value;M+=1){if(!Lt.value.has(M))continue;const A=o[M];A&&d.push(...t.slice(A.startIdx,A.endIdx))}const v=fs(t,o,Ae.value),$=v[0];if(!$)return d;const p=C.messages.findIndex(M=>M.id===$.id);return d.push(...p>=0?C.messages.slice(p):v),d}),Mt=I(()=>Vl(Zs.value)),Ne=I(()=>{var o;const t=new Map;for(const d of Mt.value){const v=((o=d.messages[0])==null?void 0:o.id)??"";v&&t.set(v,d)}return t}),Js=I(()=>{const t=new Set;for(const o of Mt.value)for(const d of o.messages)t.add(d.id);return t}),Xs=I(()=>{const t=new Set;for(const o of Mt.value)t.add(o.turnId);return t});function Ys(t){return Ne.value.has(t.id)}function Cn(t){return Js.value.has(t.id)}function Qs(t){var o;return((o=Ne.value.get(t.id))==null?void 0:o.messages)??[]}function eo(t){return Gr(Qs(t))}function to(t){var o;return t.type==="batch"?`tool-batch-${t.kind}-${((o=t.messages[0])==null?void 0:o.id)??""}`:t.message.id}function no(t){const o=Ne.value.get(t.id);return o?Kl(o,{t:R,formatDuration:Go}):""}function so(t){var o;return((o=Ne.value.get(t.id))==null?void 0:o.running)??!1}function oo(t){var o;return((o=Ne.value.get(t.id))==null?void 0:o.hasOutsideContent)??!0}function ao(t){return t.messageType==="worked"}const io=I(()=>C.hasMorePersistedAbove===!0),ro=I(()=>!ge.value&&(C.messages.length>0||C.pendingRequests.length>0||!!C.liveOverlay));function lo(){return Qe.value?Promise.resolve():(et||(et=Vo(()=>import("./common-BeuopZEI.js"),[]).then(t=>{Qe.value=t.default,Me.clear(),Ie.clear(),Le.value+=1}).finally(()=>{et=null})),et)}function xn(t){switch(t){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function co(t){var v;const o=Ve(t);if(!o)return"";const d=[];return(v=o.explanation)!=null&&v.trim()&&d.push(o.explanation.trim()),o.steps.length>0&&d.push(o.steps.map($=>`- ${xn($.status)} ${$.step}`.trim()).join(`
|
|
22
|
+
`):[];s.length>0&&s[s.length-1]===""&&s.pop();const i=[];let a=0,c=0;for(const[l,r]of s.entries()){const h=r.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/u);if(h){a=Number(h[1]),c=Number(h[2]),i.push({key:`${Y(e)}:hunk:${l}`,kind:"hunk",oldLine:null,newLine:null,text:r});continue}if(r.startsWith("+")&&!r.startsWith("+++")){i.push({key:`${Y(e)}:add:${l}`,kind:"add",oldLine:null,newLine:c,text:r.slice(1)}),c+=1;continue}if(r.startsWith("-")&&!r.startsWith("---")){i.push({key:`${Y(e)}:remove:${l}`,kind:"remove",oldLine:a,newLine:null,text:r.slice(1)}),a+=1;continue}if(r.startsWith(" ")){i.push({key:`${Y(e)}:context:${l}`,kind:"context",oldLine:a,newLine:c,text:r.slice(1)}),a+=1,c+=1;continue}i.push({key:`${Y(e)}:meta:${l}`,kind:"meta",oldLine:null,newLine:null,text:r})}return i}function wa(e){return!e||!e.diff.trim()?[]:va(e)?ya(e):ka(e)}function ba(e){return!!(e!=null&&e.diff.trim())}function $a(e){return e.kind==="add"?"+":e.kind==="remove"?"-":e.kind==="hunk"?"@@":""}const Ca=["aria-label"],xa={class:"confirm-dialog-title"},Ta={class:"confirm-dialog-message"},_a={class:"confirm-dialog-actions"},Ia=J({__name:"ConfirmDialog",props:{visible:{type:Boolean},title:{},message:{},confirmLabel:{default:""},cancelLabel:{default:""},danger:{type:Boolean,default:!1}},emits:["confirm","cancel"],setup(e){return(n,s)=>(u(),K(gs,{to:"body"},[e.visible?(u(),f("div",{key:0,class:"confirm-dialog-overlay",onClick:s[2]||(s[2]=Oe(i=>n.$emit("cancel"),["self"]))},[g("div",{class:"confirm-dialog-panel",role:"alertdialog","aria-modal":"true","aria-label":e.title},[g("h3",xa,k(e.title),1),g("p",Ta,k(e.message),1),g("div",_a,[g("button",{class:"confirm-dialog-btn confirm-dialog-btn-cancel",type:"button",onClick:s[0]||(s[0]=i=>n.$emit("cancel"))},k(e.cancelLabel||"Cancel"),1),g("button",{class:U(["confirm-dialog-btn confirm-dialog-btn-confirm",{"is-danger":e.danger}]),type:"button",onClick:s[1]||(s[1]=i=>n.$emit("confirm"))},k(e.confirmLabel||"Confirm"),3)])],8,Ca)])):_("",!0)]))}}),La=G(Ia,[["__scopeId","data-v-de94025d"]]),Ma={key:0,class:"diff-viewer-sidebar"},Sa={class:"diff-viewer-sidebar-header"},Aa={class:"diff-viewer-sidebar-title"},Pa={class:"diff-viewer-sidebar-count"},Ea={class:"diff-viewer-sidebar-list"},Fa=["data-active","onClick"],Ba=["data-operation"],Ra={class:"diff-viewer-file-label"},Oa={key:0,class:"diff-viewer-file-delta"},Ha={class:"diff-viewer-main"},Da={class:"diff-viewer-toolbar"},Wa={class:"diff-viewer-title-wrap"},ja={class:"diff-viewer-title"},qa={class:"diff-viewer-subtitle"},Na={key:0},za={class:"diff-viewer-toolbar-actions"},Ua=["aria-label"],Va={key:0,class:"diff-viewer-empty"},Ka={class:"diff-viewer-empty-title"},Ga={class:"diff-viewer-empty-text"},Za={key:1,class:"diff-viewer-panel"},Ja={class:"diff-viewer-meta"},Xa={class:"diff-viewer-language"},Ya={class:"diff-viewer-lines"},Qa=["data-kind"],ei={class:"diff-viewer-line-number"},ti={class:"diff-viewer-line-number"},ni={class:"diff-viewer-line-marker"},si=["innerHTML"],oi={class:"diff-viewer-mobile-sheet-header"},ai={class:"diff-viewer-sidebar-title"},ii={class:"diff-viewer-sidebar-count"},ri={class:"diff-viewer-mobile-sheet-list"},li=["data-active","onClick"],ci=["data-operation"],ui={class:"diff-viewer-file-label"},di={key:0,class:"diff-viewer-file-delta"},fi=J({__name:"DiffViewer",props:{change:{},changes:{},lines:{},isMobile:{type:Boolean},isFileListOpen:{type:Boolean},cwd:{}},emits:["close","select-change","toggle-file-list","close-file-list"],setup(e){const n=e,{t:s}=te();function i(r){return r.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/"/gu,""").replace(/'/gu,"'")}const a=L(()=>r=>Qt(r,s)),c=L(()=>r=>Ms(r,s)),l=L(()=>r=>De(r,n.cwd));return(r,h)=>(u(),K(gs,{to:"body"},[e.change?(u(),f("div",{key:0,class:"diff-viewer-backdrop",onClick:h[5]||(h[5]=m=>r.$emit("close"))},[g("div",{class:"diff-viewer-shell",onClick:h[4]||(h[4]=Oe(()=>{},["stop"]))},[e.isMobile?_("",!0):(u(),f("aside",Ma,[g("div",Sa,[g("p",Aa,k(T(s)("Changed files")),1),g("p",Pa,k(c.value(e.changes.length)),1)]),g("div",Ea,[(u(!0),f(F,null,D(e.changes,m=>(u(),f("button",{key:`diff-viewer:${T(Y)(m)}`,type:"button",class:"diff-viewer-file-button","data-active":T(Y)(m)===T(Y)(e.change),onClick:y=>r.$emit("select-change",m)},[g("span",{class:"file-change-badge","data-operation":T(Gt)(m)},k(a.value(m)),9,Ba),g("span",Ra,[le(k(l.value(m.path))+" ",1),m.movedToPath?(u(),f(F,{key:0},[le(" → "+k(l.value(m.movedToPath)),1)],64)):_("",!0)]),T(xe)(m)?(u(),f("span",Oa,k(T(xe)(m)),1)):_("",!0)],8,Fa))),128))])])),g("section",Ha,[g("div",Da,[g("div",Wa,[g("p",ja,[le(k(l.value(e.change.path))+" ",1),e.change.movedToPath?(u(),f(F,{key:0},[le(" → "+k(l.value(e.change.movedToPath)),1)],64)):_("",!0)]),g("p",qa,[le(k(a.value(e.change))+" ",1),T(xe)(e.change)?(u(),f("span",Na," · "+k(T(xe)(e.change)),1)):_("",!0)])]),g("div",za,[e.isMobile?(u(),f("button",{key:0,type:"button",class:"diff-viewer-mobile-files-button",onClick:h[0]||(h[0]=m=>r.$emit("toggle-file-list"))},k(c.value(e.changes.length)),1)):_("",!0),g("button",{class:"image-modal-close diff-viewer-close",type:"button","aria-label":T(s)("Close diff viewer"),onClick:h[1]||(h[1]=m=>r.$emit("close"))},[N(ps,{class:"icon-svg"})],8,Ua)])]),T(ba)(e.change)?(u(),f("div",Za,[g("div",Ja,[g("span",Xa,k(T(pa)(e.change)||"diff"),1)]),g("div",Ya,[(u(!0),f(F,null,D(e.lines,m=>(u(),f("div",{key:m.key,class:"diff-viewer-line","data-kind":m.kind},[g("span",ei,k(m.oldLine??""),1),g("span",ti,k(m.newLine??""),1),g("span",ni,k(T($a)(m)),1),g("code",{class:"diff-viewer-line-code",innerHTML:i(m.text)||" "},null,8,si)],8,Qa))),128))])])):(u(),f("div",Va,[g("p",Ka,k(T(s)("No diff available")),1),g("p",Ga,k(T(s)("This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.")),1)]))]),N(Do,{name:"diff-viewer-sheet"},{default:Fe(()=>[e.isMobile&&e.isFileListOpen?(u(),f("div",{key:0,class:"diff-viewer-mobile-sheet-backdrop",onClick:h[3]||(h[3]=m=>r.$emit("close-file-list"))},[g("div",{class:"diff-viewer-mobile-sheet",onClick:h[2]||(h[2]=Oe(()=>{},["stop"]))},[h[6]||(h[6]=g("div",{class:"diff-viewer-mobile-sheet-handle","aria-hidden":"true"},null,-1)),g("div",oi,[g("p",ai,k(T(s)("Changed files")),1),g("p",ii,k(c.value(e.changes.length)),1)]),g("div",ri,[(u(!0),f(F,null,D(e.changes,m=>(u(),f("button",{key:`diff-viewer-sheet:${T(Y)(m)}`,type:"button",class:"diff-viewer-file-button","data-active":T(Y)(m)===T(Y)(e.change),onClick:y=>r.$emit("select-change",m)},[g("span",{class:"file-change-badge","data-operation":T(Gt)(m)},k(a.value(m)),9,ci),g("span",ui,[le(k(l.value(m.path))+" ",1),m.movedToPath?(u(),f(F,{key:0},[le(" → "+k(l.value(m.movedToPath)),1)],64)):_("",!0)]),T(xe)(m)?(u(),f("span",di,k(T(xe)(m)),1)):_("",!0)],8,li))),128))])])])):_("",!0)]),_:1})])])):_("",!0)]))}}),hi=G(fi,[["__scopeId","data-v-7ec6502b"]]),mi={},gi={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function pi(e,n){return u(),f("svg",gi,[...n[0]||(n[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 14L4 9l5-5m-5 5h11a4 4 0 0 1 0 8H4"},null,-1)])])}const Zt=G(mi,[["render",pi]]),vi={class:"file-change-summary-label"},ki={class:"file-change-summary-status"},yi=["data-tone"],wi={class:"file-change-panel-inner"},bi={class:"file-change-list"},$i=["data-operation","title"],Ci={class:"file-change-path-group"},xi=["title","onClick"],Ti={key:0,class:"file-change-arrow"},_i=["title","onClick"],Ii={key:0,class:"file-change-delta"},Li=["data-tone"],Mi=["title","aria-label","onClick"],Si={key:0,class:"file-change-actions"},Ai={key:0,class:"file-change-action-error"},Pi=["disabled","title","aria-label"],Ei=J({__name:"FileChangeSummaryBlock",props:{summary:{},expanded:{type:Boolean},inline:{type:Boolean},cwd:{},actionable:{type:Boolean},actionStatus:{},actionErrorText:{},nextAction:{},actionLabel:{}},emits:["toggle","open-diff","request-action","request-file-action"],setup(e){const n=e,{t:s}=te(),i=L(()=>r=>Qt(r,s)),a=L(()=>r=>ha(r,s)),c=L(()=>r=>De(r,n.cwd)),l=L(()=>r=>`${s("Undo")} ${De(r.path,n.cwd)}`);return(r,h)=>e.summary?(u(),f("section",{key:0,class:U(["file-change-summary-block",{"file-change-summary-block-inline":e.inline}])},[g("button",{type:"button",class:U(["file-change-summary-row",{"file-change-summary-row-expanded":e.expanded}]),onClick:h[0]||(h[0]=m=>r.$emit("toggle"))},[g("span",{class:U(["file-change-chevron",{"file-change-chevron-open":e.expanded}])},"▶",2),g("span",vi,k(a.value(e.summary)),1),g("span",ki,[(u(!0),f(F,null,D(T(ma)(e.summary),m=>(u(),f("span",{key:`summary-status:${e.summary.turnId}:${m.tone}:${m.label}`,class:"file-change-signed-count","data-tone":m.tone},k(m.label),9,yi))),128))])],2),g("div",{class:U(["file-change-panel",{"file-change-panel-visible":e.expanded}])},[g("div",wi,[g("ul",bi,[(u(!0),f(F,null,D(e.summary.changes,m=>(u(),f("li",{key:`file-change:${e.summary.turnId}:${m.path}:${m.movedToPath||""}`,class:"file-change-item"},[g("span",{class:"file-change-badge","data-operation":T(Gt)(m),title:i.value(m)},k(T(ua)(m)),9,$i),g("span",Ci,[g("button",{type:"button",class:"file-change-path-button",title:m.path,onClick:y=>r.$emit("open-diff",m)},k(c.value(m.path)),9,xi),m.movedToPath?(u(),f("span",Ti,"→")):_("",!0),m.movedToPath?(u(),f("button",{key:1,type:"button",class:"file-change-path-button",title:m.movedToPath,onClick:y=>r.$emit("open-diff",m)},k(c.value(m.movedToPath)),9,_i)):_("",!0)]),m.addedLineCount>0||m.removedLineCount>0?(u(),f("span",Ii,[(u(!0),f(F,null,D(T(da)(m),y=>(u(),f("span",{key:`change-delta:${e.summary.turnId}:${m.path}:${y.tone}:${y.label}`,class:"file-change-signed-count","data-tone":y.tone},k(y.label),9,Li))),128))])):_("",!0),e.actionable?(u(),f("button",{key:1,type:"button",class:"file-change-file-undo-button",title:l.value(m),"aria-label":l.value(m),onClick:y=>r.$emit("request-file-action",m)},[N(Zt,{class:"icon-svg file-change-action-icon"})],8,Mi)):_("",!0)]))),128))]),e.actionable?(u(),f("div",Si,[e.actionErrorText?(u(),f("p",Ai,k(e.actionErrorText),1)):_("",!0),g("button",{type:"button",class:"file-change-action-button",disabled:e.actionStatus==="undoing"||e.actionStatus==="redoing",title:e.nextAction==="redo"?"Redo file changes from this turn":"Undo file changes from this turn","aria-label":e.nextAction==="redo"?"Redo file changes from this turn":"Undo file changes from this turn",onClick:h[1]||(h[1]=m=>r.$emit("request-action",e.nextAction))},[N(Zt,{class:U(["icon-svg file-change-action-icon",{"file-change-action-icon-redo":e.nextAction==="redo"}])},null,8,["class"]),le(" "+k(e.actionLabel),1)],8,Pi)])):_("",!0)])],2)],2)):_("",!0)}}),is=G(Ei,[["__scopeId","data-v-851281a0"]]),Fi=J({__name:"FileLinkContextMenu",props:{visible:{type:Boolean},x:{},y:{},browseUrl:{},editUrl:{}},emits:["close"],setup(e,{emit:n}){const s=e,i=n,a=H(null),c=L(()=>({left:`${String(s.x)}px`,top:`${String(s.y)}px`}));function l(){i("close")}function r(){const C=s.browseUrl;l(),!(!C||C==="#")&&window.open(C,"_blank","noopener,noreferrer")}function h(){const C=s.editUrl;l(),!(!C||C==="#")&&window.open(C,"_blank","noopener,noreferrer")}async function m(){const C=s.browseUrl;if(l(),!(!C||C==="#"))try{await qt(C)}catch{}}function y(C){if(!s.visible)return;const A=a.value;if(!A){l();return}const b=C.target;b instanceof Node&&A.contains(b)||l()}function I(){l()}function S(C){C.key==="Escape"&&l()}return ce(()=>s.visible,C=>{C?(window.addEventListener("pointerdown",y,!0),window.addEventListener("blur",I),window.addEventListener("keydown",S,!0)):(window.removeEventListener("pointerdown",y,!0),window.removeEventListener("blur",I),window.removeEventListener("keydown",S,!0))}),Yt(()=>{window.removeEventListener("pointerdown",y,!0),window.removeEventListener("blur",I),window.removeEventListener("keydown",S,!0)}),(C,A)=>e.visible?(u(),f("div",{key:0,ref_key:"menuRef",ref:a,class:"file-link-context-menu",style:Ke(c.value),onClick:A[0]||(A[0]=Oe(()=>{},["stop"]))},[g("button",{type:"button",class:"file-link-context-menu-item",onClick:r}," Open link "),g("button",{type:"button",class:"file-link-context-menu-item",onClick:m}," Copy link "),e.editUrl?(u(),f("button",{key:0,type:"button",class:"file-link-context-menu-item",onClick:h}," Edit file ")):_("",!0)],4)):_("",!0)}}),Bi=G(Fi,[["__scopeId","data-v-9cda1d9d"]]),Ri=12e3,Oi=240;function Hi(e,{streaming:n,truncateStreaming:s=!0,maxChars:i=Ri,maxLines:a=Oi}){if(!s)return e;let c=e,l=!1;if(i>0&&c.length>i&&(c=c.slice(-i),l=!0),a>0){const r=c.split(/\r?\n/);r.length>a&&(c=r.slice(-a).join(`
|
|
23
|
+
`),l=!0)}return l?`...
|
|
24
|
+
${c}`:c}const Di={class:"conversation-item conversation-item-overlay"},Wi={class:"message-row"},ji={class:"message-stack"},qi={class:"live-overlay-inline","aria-live":"polite"},Ni={class:"live-overlay-title-row"},zi={key:0,class:"live-overlay-spinner","aria-hidden":"true"},Ui=["aria-expanded"],Vi={class:"live-overlay-label"},Ki={class:"live-overlay-toggle","aria-hidden":"true"},Gi={key:2,class:"live-overlay-label"},Zi={key:0,class:"live-overlay-reasoning"},Ji={key:1,class:"live-overlay-error"},Xi=["href"],Yi=J({__name:"LiveOverlayItem",props:{overlay:{},feedbackMailto:{}},setup(e){const n=e,{buildFeedbackMailto:s,recordVisibleFailure:i}=vs(),{t:a}=te(),c=H(!0);function l(){c.value=!c.value}const r=L(()=>{var m;return Hi(((m=n.overlay)==null?void 0:m.reasoningText)??"",{streaming:!0})});function h(m,y){i(y);const I=m.currentTarget;I instanceof HTMLAnchorElement&&(I.href=s())}return(m,y)=>{var I,S,C,A,b,E;return u(),f("li",Di,[g("div",Wi,[g("div",ji,[g("article",qi,[g("div",Ni,[(I=e.overlay)!=null&&I.errorText?_("",!0):(u(),f("span",zi)),(S=e.overlay)!=null&&S.reasoningText?(u(),f("button",{key:1,type:"button",class:"live-overlay-heading","aria-expanded":c.value,onClick:l},[g("span",Vi,k((C=e.overlay)==null?void 0:C.activityLabel),1),g("span",Ki,k(c.value?"▾":"▸"),1)],8,Ui)):(u(),f("p",Gi,k((A=e.overlay)==null?void 0:A.activityLabel),1))]),(b=e.overlay)!=null&&b.reasoningText&&c.value?(u(),f("p",Zi,k(r.value),1)):_("",!0),(E=e.overlay)!=null&&E.errorText?(u(),f("div",Ji,[g("span",null,k(e.overlay.errorText),1),g("a",{class:"live-overlay-feedback",href:e.feedbackMailto,onClick:y[0]||(y[0]=B=>h(B,e.overlay.errorText))},k(T(a)("Send feedback")),9,Xi)])):_("",!0)])])])])}}}),Qi=G(Yi,[["__scopeId","data-v-b69a0020"]]),er={key:0},tr={key:1,class:"message-bold-text"},nr={key:2,class:"message-italic-text"},sr={key:3,class:"message-strikethrough-text"},or=["href","title"],ar=["href","title"],ir={key:6,class:"message-inline-code"},rr=J({__name:"MessageInlineContent",props:{segments:{},toBrowseUrl:{type:Function}},setup(e){return(n,s)=>(u(!0),f(F,null,D(e.segments,(i,a)=>(u(),f(F,{key:a},[i.kind==="text"?(u(),f("span",er,k(i.value),1)):i.kind==="bold"?(u(),f("strong",tr,k(i.value),1)):i.kind==="italic"?(u(),f("em",nr,k(i.value),1)):i.kind==="strikethrough"?(u(),f("s",sr,k(i.value),1)):i.kind==="file"?(u(),f("a",{key:4,class:"message-file-link",href:e.toBrowseUrl(i.path),target:"_blank",rel:"noopener noreferrer",title:i.path},k(i.displayPath),9,or)):i.kind==="url"?(u(),f("a",{key:5,class:"message-file-link",href:i.href,target:"_blank",rel:"noopener noreferrer",title:i.href},k(i.value),9,ar)):(u(),f("code",ir,k(i.value),1))],64))),128))}}),Ee=G(rr,[["__scopeId","data-v-e81c51c6"]]),lr={},cr={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ur(e,n){return u(),f("svg",cr,[...n[0]||(n[0]=[g("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zm-4 4a2 2 0 0 1-2-2V8m4 8h10"},null,-1)])])}const dr=G(lr,[["render",ur]]),fr=["data-role"],hr=["aria-label","title"],mr={key:0,class:"message-rollback-label"},gr=["aria-label","title"],pr={class:"message-fork-label"},vr=["data-copied","aria-label","title"],kr={key:0,class:"message-copy-label"},yr=J({__name:"MessageToolbar",props:{role:{},showEdit:{type:Boolean,default:!1},showFork:{type:Boolean,default:!1},showCopy:{type:Boolean,default:!1},copied:{type:Boolean,default:!1}},emits:["edit","fork","copy"],setup(e){const{t:n}=te();return(s,i)=>e.showEdit||e.showFork||e.showCopy?(u(),f("div",{key:0,class:"message-toolbar","data-role":e.role},[e.showEdit?(u(),f("button",{key:0,type:"button",class:"message-rollback-button","aria-label":T(n)("Rollback this message"),title:T(n)("Rollback this message"),onClick:i[0]||(i[0]=a=>s.$emit("edit"))},[N(Zt,{class:"icon-svg message-rollback-icon"}),e.role!=="user"?(u(),f("span",mr,k(T(n)("Rollback")),1)):_("",!0)],8,hr)):_("",!0),e.showFork?(u(),f("button",{key:1,type:"button",class:"message-fork-button","aria-label":T(n)("Fork thread from this response"),title:T(n)("Fork thread from this response"),onClick:i[1]||(i[1]=a=>s.$emit("fork"))},[N(Wo,{class:"icon-svg message-fork-icon"}),g("span",pr,k(T(n)("Fork")),1)],8,gr)):_("",!0),e.showCopy?(u(),f("button",{key:2,type:"button",class:"message-copy-button","data-copied":e.copied,"aria-label":e.copied?T(n)("Response copied"):T(n)("Copy response"),title:e.copied?T(n)("Response copied"):T(n)("Copy response"),onClick:i[2]||(i[2]=a=>s.$emit("copy"))},[N(dr,{class:"icon-svg message-copy-icon"}),e.role!=="user"?(u(),f("span",kr,k(e.copied?"Copied":"Copy"),1)):_("",!0)],8,vr)):_("",!0)],8,fr)):_("",!0)}}),wr=G(yr,[["__scopeId","data-v-59a7a725"]]),br="codex-web-local.process-fold.v1",rs="codex:web-local:process-fold";function Wt(){return typeof localStorage>"u"?"auto":localStorage.getItem(br)==="expanded"?"expanded":"auto"}function $r(e){const n=s=>e(s.detail);return window.addEventListener(rs,n),()=>window.removeEventListener(rs,n)}const Cr=["aria-expanded"],xr={class:"process-fold-label"},Tr={class:"process-fold-toggle","aria-hidden":"true"},_r={key:0,class:"process-fold-body"},Ir=J({__name:"ProcessFold",props:{label:{},running:{type:Boolean},hasOutsideContent:{type:Boolean}},setup(e){const n=e,s=H(Wt()==="expanded"||!n.hasOutsideContent),i=H(!1);let a=!1;const c=$r(()=>{i.value=!1,Wt()==="expanded"?s.value=!0:!n.running&&n.hasOutsideContent&&(s.value=!1)});ce(()=>n.running,r=>{const h=a;a=r,r?(h||(i.value=!1),i.value||(s.value=!0)):h&&!i.value&&n.hasOutsideContent&&Wt()!=="expanded"&&(s.value=!1)},{immediate:!0}),Yt(()=>c());function l(){i.value=!0,s.value=!s.value}return(r,h)=>(u(),f("div",{class:U(["process-fold",{"process-fold--open":s.value,"process-fold--running":e.running}])},[g("button",{type:"button",class:"process-fold-header","aria-expanded":s.value,onClick:l},[g("span",xr,k(e.label),1),g("span",Tr,k(s.value?"▾":"▸"),1)],8,Cr),s.value?(u(),f("div",_r,[ke(r.$slots,"default",{},void 0)])):_("",!0)],2))}}),Lr=G(Ir,[["__scopeId","data-v-de9b3329"]]),Mr=["aria-label"],Sr=["data-turn","aria-label","onClick"],Ar={class:"question-jump-preview-text"},Pr=2,jt="#3b82f6",Er=J({__name:"QuestionJumpBar",props:{anchors:{},activeTurn:{}},emits:["jump"],setup(e,{emit:n}){const s=e,i=n,{t:a}=te(),c=H(null),l=H(-1),r=H("0px"),h=L(()=>{const b=l.value;return b<0?null:s.anchors[b]??null});function m(b){var ee;const E=s.activeTurn===((ee=s.anchors[b])==null?void 0:ee.turn),B={};if(l.value<0)return B.width=E?"18px":"12px",B.background=E?jt:void 0,B;const X=Math.abs(b-l.value);return B.width=X===0?"32px":X===1?"20px":X===2?"14px":E?"18px":"12px",B.background=X===0?jt:X===1?"rgba(59,130,246,0.6)":X===2?"rgba(59,130,246,0.35)":E?jt:void 0,B.transitionDelay=`${X*20}ms`,B}function y(b){const E=c.value;if(!E)return-1;const B=Array.from(E.querySelectorAll(".question-jump-item"));let X=-1,ee=Number.POSITIVE_INFINITY;for(let R=0;R<B.length;R+=1){const ye=B[R].getBoundingClientRect(),Te=ye.top+ye.height/2,Q=Math.abs(b-Te);Q<ee&&(ee=Q,X=R)}return X}function I(b){var Te;const E=y(b.clientY);if(E<0)return;l.value=E;const B=c.value;if(!B)return;const ee=(Te=Array.from(B.querySelectorAll(".question-jump-item"))[E])==null?void 0:Te.getBoundingClientRect(),R=B.getBoundingClientRect();if(!ee)return;const ye=ee.top+ee.height/2;r.value=`${ye-R.top}px`}function S(){l.value=-1}function C(b){const E=y(b.clientY),B=E>=0?s.anchors[E]:null;B&&i("jump",B.turn)}function A(b){i("jump",b.turn)}return(b,E)=>e.anchors.length>=Pr?(u(),f("nav",{key:0,class:"question-jump-bar","aria-label":T(a)("Question navigation")},[g("div",{ref_key:"trackRef",ref:c,class:"question-jump-track",onMousemove:I,onMouseleave:S,onMousedown:C},[(u(!0),f(F,null,D(e.anchors,(B,X)=>(u(),f("button",{key:B.turn,type:"button",class:"question-jump-item","data-turn":B.turn,"aria-label":T(a)("Jump to question {n}",{n:B.turn+1}),onMousedown:E[0]||(E[0]=Oe(()=>{},["prevent"])),onClick:ee=>A(B)},[g("span",{class:"question-jump-dot",style:Ke(m(X))},null,4)],40,Sr))),128))],544),h.value?(u(),f("div",{key:0,class:"question-jump-preview",role:"tooltip",style:Ke({top:r.value})},[g("span",Ar,k(h.value.text),1)],4)):_("",!0)],8,Mr)):_("",!0)}}),Fr=G(Er,[["__scopeId","data-v-96d087d4"]]),Br=["data-state"],Rr=["aria-expanded"],Or={class:"reasoning-block-title"},Hr={class:"reasoning-block-toggle","aria-hidden":"true"},Dr={key:0,class:"reasoning-block-body"},Wr={key:0,class:"reasoning-block-summary"},jr=["innerHTML"],qr=J({__name:"ReasoningBlock",props:{message:{},expanded:{type:Boolean},contentHtml:{}},emits:["toggle"],setup(e){const n=e,{t:s}=te(),i=L(()=>{var c;return(((c=n.message.reasoning)==null?void 0:c.summary)??[]).map(l=>l.trim()).filter(Boolean).join(`
|
|
25
|
+
`).trim()});return(a,c)=>(u(),f("div",{class:"reasoning-block","data-state":e.expanded?"expanded":"collapsed"},[g("button",{type:"button",class:"reasoning-block-header","aria-expanded":e.expanded,onClick:c[0]||(c[0]=l=>a.$emit("toggle"))},[g("span",Or,k(T(s)("Thinking process")),1),g("span",Hr,k(e.expanded?"▾":"▸"),1)],8,Rr),e.expanded?(u(),f("div",Dr,[i.value?(u(),f("p",Wr,k(i.value),1)):_("",!0),g("div",{class:"reasoning-block-content message-card",innerHTML:e.contentHtml},null,8,jr)])):_("",!0)],8,Br))}}),ls=G(qr,[["__scopeId","data-v-5fa90230"]]),Nr=new Set(["read_file","ls","grep","glob","web_fetch","read_skill","code_index","connect_tool_source"]),zr=new Set(["write_file","edit_file","multi_edit","move_file","delete_range","delete_symbol","notebook_edit"]),Ur=new Set(["task","run_skill","explore","research","review","security_review"]);function Vr(e){var s;const n=((s=e.toolCall)==null?void 0:s.tool)??"";return Nr.has(n)?"readonly":zr.has(n)?"modify":Ur.has(n)?"delegate":null}const Kr=2;function Gr(e){var c;const n=[];let s=[],i=null;const a=()=>{if(i!==null&&s.length>=Kr)n.push({type:"batch",kind:i,messages:s});else for(const l of s)n.push({type:"tool",message:l});s=[],i=null};for(const l of e){if(l.messageType!=="toolCall"||((c=l.toolCall)==null?void 0:c.status)==="inProgress"){a(),n.push({type:"tool",message:l});continue}const r=Vr(l);if(r===null){a(),n.push({type:"tool",message:l});continue}i!==null&&i!==r&&a(),i=r,s.push(l)}return a(),n}function Zr(e,n,s){const{t:i}=s;if(e==="readonly"){const a=n.filter(h=>{var m,y;return((m=h.toolCall)==null?void 0:m.tool)==="read_file"||((y=h.toolCall)==null?void 0:y.tool)==="ls"}).length,c=n.filter(h=>{var y;const m=((y=h.toolCall)==null?void 0:y.tool)??"";return m==="grep"||m==="glob"||m==="web_fetch"||m==="code_index"}).length,l=n.length-a-c,r=[];return a>0&&r.push(i("Read {n} files",{n:a})),c>0&&r.push(i("Search {n} files",{n:c})),l>0&&r.push(i("{n} read calls",{n:l})),r.join(" · ")}return e==="modify"?i("Modified {n} files",{n:n.length}):e==="delegate"?i("Delegated {n} tasks",{n:n.length}):i("Explored {n} items",{n:n.length})}const Jr={class:"message-row","data-role":"system"},Xr={class:"message-stack","data-role":"system"},Yr=["title"],Qr={key:0,class:"tool-call-server"},el={class:"tool-call-name"},tl={class:"tool-call-status"},nl={key:0,class:"work-block-spinner","aria-hidden":"true"},sl={key:1,class:"tool-call-status-icon","aria-hidden":"true"},ol={key:2,class:"tool-call-status-icon","aria-hidden":"true"},al=J({__name:"ToolCallRow",props:{message:{}},setup(e){const n=e,{t:s}=te(),i=L(()=>{const l=n.message.toolCall;if(!l)return"";switch(l.status){case"inProgress":return s("Running");case"failed":return s("Failed");default:return s("Done")}}),a=L(()=>{var l;switch((l=n.message.toolCall)==null?void 0:l.status){case"inProgress":return"tool-call-running";case"failed":return"tool-call-error";default:return"tool-call-ok"}}),c=L(()=>{const l=n.message.toolCall;if(!l)return"";const r=[];return l.server&&r.push(l.server),r.push(l.tool),l.error&&r.push(l.error),typeof l.durationMs=="number"&&l.durationMs>=0&&r.push(`${l.durationMs}ms`),r.join(" · ")});return(l,r)=>{var h,m,y,I;return u(),f("div",Jr,[g("div",Xr,[g("div",{class:U(["tool-call-block",a.value]),title:c.value},[r[0]||(r[0]=g("span",{class:"tool-call-icon","aria-hidden":"true"},"🛠",-1)),(h=e.message.toolCall)!=null&&h.server?(u(),f("span",Qr,k(e.message.toolCall.server),1)):_("",!0),g("code",el,k(((m=e.message.toolCall)==null?void 0:m.tool)||e.message.text||"(tool)"),1),g("span",tl,[((y=e.message.toolCall)==null?void 0:y.status)==="inProgress"?(u(),f("span",nl)):((I=e.message.toolCall)==null?void 0:I.status)==="completed"?(u(),f("span",sl,"✓")):(u(),f("span",ol,"✗")),le(" "+k(i.value),1)])],10,Yr)])])}}}),Jt=G(al,[["__scopeId","data-v-e25278a7"]]),il=["aria-expanded","title"],rl={class:"tool-batch-toggle","aria-hidden":"true"},ll={class:"tool-batch-label"},cl={class:"tool-batch-count"},ul={key:0,class:"tool-batch-body"},dl=J({__name:"ToolBatchBlock",props:{kind:{},messages:{}},setup(e){const n=e,{t:s}=te(),i=H(!1),a=L(()=>Zr(n.kind,n.messages,{t:s})),c=L(()=>n.messages.map(l=>{var r;return((r=l.toolCall)==null?void 0:r.tool)??""}).join(" · "));return(l,r)=>(u(),f("div",{class:U(["tool-batch-block",{"tool-batch-block--open":i.value}])},[g("button",{type:"button",class:"tool-batch-head","aria-expanded":i.value,title:c.value,onClick:r[0]||(r[0]=h=>i.value=!i.value)},[g("span",rl,k(i.value?"▾":"▸"),1),r[1]||(r[1]=g("span",{class:"tool-batch-icon","aria-hidden":"true"},"🛠",-1)),g("span",ll,k(a.value),1),g("span",cl,k(e.messages.length),1)],8,il),i.value?(u(),f("div",ul,[(u(!0),f(F,null,D(e.messages,h=>(u(),K(Jt,{key:h.id,message:h},null,8,["message"]))),128))])):_("",!0)],2))}}),fl=G(dl,[["__scopeId","data-v-908995a9"]]),hl=["data-turn-key"],ml={key:0,class:"conversation-turn-request","aria-label":"User request"},gl={class:"conversation-turn-items"},pl={key:1,class:"conversation-turn-process","aria-label":"Turn process"},vl=["aria-expanded","aria-label"],kl={class:"conversation-turn-process-count"},yl={key:1,class:"conversation-turn-process-heading"},wl={key:2,class:"conversation-turn-items conversation-turn-process-items"},bl={key:2,class:"conversation-turn-final","aria-label":"Assistant final response"},$l={class:"conversation-turn-items"},Cl=J({__name:"ThreadTurn",props:{turnKey:{},request:{},processItems:{default:()=>[]},finalItem:{},fileChangeAnchorIds:{default:()=>[]},warm:{},warmItems:{default:()=>[]}},setup(e){const n=e,{t:s}=te(),i=H(!0),a=L(()=>n.processItems.length+n.fileChangeAnchorIds.length),c=L(()=>!!n.finalItem);return ce(a,(l,r)=>{l>r&&(i.value=!0)}),(l,r)=>e.warm?(u(),f(F,{key:0},[ke(l.$slots,"warm-card",{warm:e.warm},void 0),(u(!0),f(F,null,D(e.warmItems,h=>ke(l.$slots,"default",{key:h.message.id,item:h,section:"warm"},void 0)),128))],64)):(u(),f("li",{key:1,class:"conversation-turn","data-turn-key":e.turnKey},[e.request?(u(),f("section",ml,[g("ol",gl,[ke(l.$slots,"default",{item:e.request,section:"request"},void 0)])])):_("",!0),a.value>0?(u(),f("section",pl,[c.value?(u(),f("button",{key:0,class:"conversation-turn-process-heading conversation-turn-process-toggle",type:"button","aria-expanded":i.value,"aria-label":i.value?T(s)("Collapse turn process"):T(s)("Expand turn process"),onClick:r[0]||(r[0]=h=>i.value=!i.value)},[i.value?(u(),K(jo,{key:0,class:"conversation-turn-process-toggle-icon"})):(u(),K(ks,{key:1,class:"conversation-turn-process-toggle-icon"})),g("span",null,k(T(s)("Turn process")),1),g("span",kl,k(T(s)("{n} process items",{n:a.value})),1)],8,vl)):(u(),f("div",yl,k(T(s)("Turn process")),1)),i.value?(u(),f("ol",wl,[(u(!0),f(F,null,D(e.processItems,h=>ke(l.$slots,"default",{key:h.message.id,item:h,section:"process"},void 0)),128)),(u(!0),f(F,null,D(e.fileChangeAnchorIds,h=>(u(),f("li",{key:`file-change-${h}`,class:"conversation-turn-row conversation-turn-file-change"},[ke(l.$slots,"file-change",{anchorMessageId:h},void 0)]))),128))])):_("",!0)])):_("",!0),e.finalItem?(u(),f("section",bl,[g("ol",$l,[ke(l.$slots,"default",{item:e.finalItem,section:"final"},void 0)])])):_("",!0)],8,hl))}}),xl=G(Cl,[["__scopeId","data-v-7ed82fa7"]]),Tl=["aria-expanded"],_l={class:"warm-turn__preview"},Il={key:0,class:"warm-turn__meta"},Ll={class:"warm-turn__content"},Ml={key:1,class:"warm-turn__assistant"},Sl=J({__name:"WarmTurnCard",props:{userText:{},assistantPreview:{},toolCount:{},expanded:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const s=n,{t:i}=te();function a(){s("toggle")}return(c,l)=>(u(),f("div",{class:U(["warm-turn",{"warm-turn--expanded":e.expanded}])},[g("button",{type:"button",class:"warm-turn__head","aria-expanded":e.expanded,onClick:a},[N(ks,{class:U(["warm-turn__chevron",{"warm-turn__chevron--open":e.expanded}])},null,8,["class"]),g("span",_l,k(e.userText),1),e.toolCount>0?(u(),f("span",Il,k(T(i)("{n} tools",{n:e.toolCount})),1)):_("",!0)],8,Tl),g("div",Ll,[e.expanded?ke(c.$slots,"default",{},void 0,!0,0):e.assistantPreview?(u(),f("div",Ml,k(e.assistantPreview),1)):_("",!0)])],2))}}),Al=G(Sl,[["__scopeId","data-v-7e3ebbc7"]]),Pl=["aria-expanded"],El=["title"],Fl={class:"work-block-command"},Bl={class:"work-block-status"},Rl={key:0,class:"work-block-spinner","aria-hidden":"true"},Ol={key:1,class:"work-block-status-icon","aria-hidden":"true"},Hl={key:2,class:"work-block-status-icon","aria-hidden":"true"},Dl={class:"work-block-output-inner"},Wl=["textContent"],jl=["textContent"],ql={key:0,class:"work-block-permission-hint",role:"note"},Nl=J({__name:"WorkBlockItem",props:{command:{},stepIndex:{},expanded:{type:Boolean},compact:{type:Boolean},outputCondensed:{type:Boolean}},emits:["toggle"],setup(e){const n=e,{t:s}=te(),i=L(()=>{var h,m;const r=(h=n.command.commandExecution)==null?void 0:h.status;return r==="inProgress"?"cmd-status-running":r==="completed"&&((m=n.command.commandExecution)==null?void 0:m.exitCode)===0?"cmd-status-ok":"cmd-status-error"}),a=L(()=>{const r=n.command.commandExecution;if(!r)return"";switch(r.status){case"inProgress":return s("Running");case"completed":return r.exitCode===0?s("Done"):`${s("Exit")} ${r.exitCode??"?"}`;case"failed":return s("Failed");case"declined":return s("Declined");case"interrupted":return s("Stopped");default:return""}}),c=[/access to the path .* is denied/iu,/access is denied/iu,/permission denied/iu,/not permitted/iu,/EACCES|EPERM/iu,/denied access|deny access/iu,/拒绝访问/iu,/没有权限/iu,/权限不足/iu,/要求提权|需要提权|require_escalated/iu],l=L(()=>{const r=n.command.commandExecution;if(!r||!(r.status==="failed"||r.status==="declined"||typeof r.exitCode=="number"&&r.exitCode!==0))return"";const m=r.aggregatedOutput??"";return!m||!c.some(y=>y.test(m))?"":s("Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.")});return(r,h)=>{var m,y,I,S,C,A;return u(),f("div",{class:U(["work-block",[i.value,{"work-block-expanded":e.expanded,"work-block-compact":e.compact}]])},[g("button",{type:"button",class:"work-block-header","aria-expanded":e.expanded,onClick:h[0]||(h[0]=b=>r.$emit("toggle"))},[g("span",{class:"work-step-dot",title:`${T(s)("Step")} ${String(e.stepIndex+1)}`},k(e.stepIndex+1),9,El),g("code",Fl,k(T(s)("Command")),1),g("span",Bl,[((m=e.command.commandExecution)==null?void 0:m.status)==="inProgress"?(u(),f("span",Rl)):((y=e.command.commandExecution)==null?void 0:y.status)==="completed"&&((I=e.command.commandExecution)==null?void 0:I.exitCode)===0?(u(),f("span",Ol,"✓")):((S=e.command.commandExecution)==null?void 0:S.status)==="failed"?(u(),f("span",Hl,"✗")):_("",!0),le(" "+k(a.value),1)])],8,Pl),g("div",{class:U(["work-block-output-wrap",{"work-block-output-visible":e.expanded}])},[g("div",Dl,[g("pre",{class:"work-block-output-command",textContent:k(((C=e.command.commandExecution)==null?void 0:C.command)||"(command)")},null,8,Wl),g("pre",{class:U(["work-block-output",{"cmd-output-condensed":e.outputCondensed}]),textContent:k(((A=e.command.commandExecution)==null?void 0:A.aggregatedOutput)||"(no output)")},null,10,jl)])],2),l.value?(u(),f("p",ql,k(l.value),1)):_("",!0)],2)}}}),cs=G(Nl,[["__scopeId","data-v-e9fdf684"]]),zl=2;function us(e){const n=e.messageType;return n==="commandExecution"||n==="toolCall"}function Ul(e){var s,i;return(((s=e.commandExecution)==null?void 0:s.status)??"")==="inProgress"||(((i=e.toolCall)==null?void 0:i.status)??"")==="inProgress"?!0:(e.messageType??"").endsWith(".live")}function Vl(e){const n=[];let s=[],i="";const a=()=>{s.length>0&&(n.push(s),s=[])};for(const r of e){const h=r.turnId??"",m=us(r)&&h!=="";(!m||h!==i)&&(s.length>0&&a(),i=m?h:""),m&&s.push(r)}a();const c=new Map;for(const r of e)r.messageType==="worked"&&r.turnId&&typeof r.durationMs=="number"&&c.set(r.turnId,r.durationMs);const l=[];for(const r of n){if(r.length<zl)continue;const h=r[0].turnId??"";let m=0,y=0,I=0,S=!1;for(const A of r)A.messageType==="toolCall"?m+=1:A.messageType==="reasoning"?y+=1:A.messageType==="commandExecution"&&(I+=1),Ul(A)&&(S=!0);const C=e.some(A=>A.turnId===h&&!us(A));l.push({turnId:h,messages:r,running:S,toolCount:m,thoughtCount:y,commandCount:I,durationMs:c.get(h)??0,hasOutsideContent:C})}return l}function Kl(e,n){const{t:s,formatDuration:i}=n,a=[];return e.running?a.push(s("Working…")):e.durationMs>0?a.push(i(e.durationMs)):a.push(s("Processed")),e.toolCount>0&&a.push(s("{n} tools",{n:e.toolCount})),e.thoughtCount>0&&a.push(s("{n} thoughts",{n:e.thoughtCount})),e.commandCount>0&&a.push(s("{n} commands",{n:e.commandCount})),a.join(" · ")}function Gl(e){return e.role==="user"?"user":e.messageType==="reasoning"?"reasoning":e.messageType==="plan"||e.messageType==="plan.live"?"plan":e.messageType==="fileChange"?"file-change":e.messageType==="commandExecution"||e.messageType==="toolCall"||e.messageType==="worked"?"process":"assistant"}function Zl(e){var n;return e.role==="assistant"&&e.messageType!=="reasoning"&&e.messageType!=="commandExecution"&&e.messageType!=="toolCall"&&e.messageType!=="worked"&&e.messageType!=="plan"&&e.messageType!=="plan.live"&&e.messageType!=="fileChange"&&!((n=e.messageType)!=null&&n.endsWith(".live"))&&e.text.trim().length>0}function Jl(e,n){var c,l;const s=[];let i=null;for(const r of e)(r.role==="user"||!i)&&(i={key:`turn-${r.id}`,items:[]},s.push(i)),i.items.push({message:r,kind:Gl(r)});const a=s.length-1;for(let r=0;r<s.length;r+=1){const h=s[r],m=(l=(c=h.items.find(S=>{var C;return(C=S.message.turnId)==null?void 0:C.trim()}))==null?void 0:c.message.turnId)==null?void 0:l.trim();if((n==null?void 0:n.liveOverlayActive)===!0&&(n.liveTurnId?m===n.liveTurnId:r===a))continue;const I=[...h.items].reverse().find(S=>S.kind!=="file-change");I&&Zl(I.message)&&(h.items.some(C=>typeof C.message.messageType=="string"&&C.message.messageType.endsWith(".live"))||(I.kind="final-assistant"))}return s}function Ss(e){return e.replace(/\s+/g," ").trim()}function Xl(e){const n=Ss(e);return n.length<=80?n:n.slice(0,80)}function As(e){const n=Ss(e);return n.length<=80?n:n.slice(0,77)+"..."}function Xt(e){return{sessionKey:e,expandedWarmTurns:new Set,coldPage:0}}function mt(e,n){return e.sessionKey===n?e:Xt(n)}function Yl(e,n){const s=mt(e,n);return{...s,coldPage:s.coldPage+1}}function Ql(e,n,s){const i=mt(e,n),a=Math.max(0,Math.floor(s));return i.coldPage>=a?i:{...i,coldPage:a}}function ds(e,n,s,i){const a=mt(e,n),c=new Set(a.expandedWarmTurns);return i?c.add(s):c.delete(s),{...a,expandedWarmTurns:c}}function ec(e){return e.role==="user"}function tc(e){var n;return((n=e.messageType)==null?void 0:n.endsWith(".live"))===!0}function nc(e){var c;const n=[];let s=-1,i=0;const a=(l,r)=>{n.push({userItem:l,assistantPreview:"",toolCount:0,startIdx:r,endIdx:e.length})};for(let l=0;l<e.length;l+=1){const r=e[l];if(ec(r)){if(s>=0)n[n.length-1].endIdx=l;else{n.push({userItem:r,assistantPreview:"",toolCount:0,startIdx:i,endIdx:e.length}),s=l,i=l;continue}s=l,a(r,l)}else if(s>=0&&n.length>0){const h=n[n.length-1],m=((c=r.text)==null?void 0:c.trim())||"";r.role==="assistant"&&!tc(r)&&m&&(h.assistantPreview=As(m)),r.messageType==="toolCall"&&(h.toolCount+=1)}}return n}function sc({turnCount:e,hotTurns:n,pageSize:s,coldPage:i}){const a=Math.max(0,e),c=Math.max(0,n),l=Math.max(0,a-Math.min(a,c));if(l===0)return{warmStartTurn:0,warmEndTurn:0,coldTurnCount:0};const r=Math.max(0,s),h=Math.max(0,Math.floor(i)),m=Math.min(l,r*(h+1));return{warmStartTurn:l-m,warmEndTurn:l,coldTurnCount:l-m}}function oc({turn:e,turnCount:n,hotTurns:s,pageSize:i}){const a=Math.max(0,n),c=Math.max(0,s),l=Math.max(0,a-Math.min(a,c));if(l===0||e>=l)return 0;const r=Math.max(1,i),h=Math.max(0,Math.floor(e)),m=l-h;return Math.max(0,Math.ceil(m/r)-1)}function fs(e,n,s){if(n.length===0)return e.slice(0);if(s>=n.length)return[];const i=n[s].startIdx;return e.slice(i)}const ac={key:0,class:"conversation-loading"},ic={key:1,class:"conversation-empty"},rc={key:0,class:"conversation-load-more"},lc=["disabled"],cc={key:1,class:"conversation-load-more conversation-warm-collapse"},uc=["disabled"],dc=["id"],fc={class:"message-row","data-role":"system"},hc={class:"message-stack","data-role":"system"},mc={class:"message-row","data-role":"system","data-message-type":"fileChange"},gc={class:"message-stack","data-role":"system"},pc={key:0,class:"conversation-item conversation-item-fold","data-role":"system","data-message-type":"processFold"},vc={class:"message-row","data-role":"system"},kc={class:"message-stack","data-role":"system"},yc={key:0,class:"work-block-list"},wc=["id","data-role","data-message-type"],bc={key:0,class:"message-row thread-compaction-row","data-role":"system"},$c={class:"thread-compaction-inline thread-compaction-inline--pending",role:"status"},Cc={key:1,class:"message-row thread-compaction-row","data-role":"system"},xc={class:"thread-compaction-inline thread-compaction-inline--done",role:"status"},Tc={key:2,class:"message-row","data-role":"system"},_c={class:"message-stack","data-role":"system"},Ic={class:"work-block-list"},Lc=["data-role","data-message-type"],Mc=["data-role"],Sc=["data-role"],Ac={key:5,class:"message-row","data-role":"system","data-message-type":"plan"},Pc={class:"message-stack","data-role":"system"},Ec={class:"thread-plan-record"},Fc={class:"thread-plan-record-header"},Bc={key:0,class:"thread-plan-record-explanation"},Rc={key:1,class:"thread-plan-record-steps"},Oc=["data-status"],Hc={class:"thread-plan-record-marker","aria-hidden":"true"},Dc=["data-role","data-message-type"],Wc=["data-role"],jc=["data-role"],qc=["data-role"],Nc=["onClick"],zc=["src"],Uc=["src","alt"],Vc={key:1,class:"message-file-attachments"},Kc=["href","title"],Gc={key:2,class:"message-skill-attachments"},Zc=["href","title"],Jc={class:"message-skill-chip-prefix"},Xc={class:"message-skill-chip-name"},Yc=["data-role"],Qc={key:0,class:"automation-message-label"},eu={key:0},tu={key:1,class:"work-summary-wrap","aria-live":"polite"},nu={class:"work-summary-text"},su={key:0,class:"message-text"},ou={key:2,class:"message-blockquote"},au={key:3,class:"message-list message-list-unordered"},iu=["innerHTML"],ru={key:4,class:"message-list message-task-list"},lu=["data-checked"],cu={class:"message-list-item-text"},uu=["start"],du=["innerHTML"],fu={key:6,class:"message-table-wrap"},hu={class:"message-table"},mu={key:0},gu={key:7,class:"message-code-block"},pu={key:0,class:"message-code-language"},vu={class:"message-code-pre"},ku=["innerHTML"],yu={key:8,class:"message-divider"},wu={key:9,class:"message-text"},bu=["onClick"],$u=["src"],Cu=["src","alt","onError"],xu=["href","onClick"],Tu=["title","aria-label"],_u=["aria-label"],Iu=["src"],Lu=["src","alt"],Mu=16,Su=300,Au=1200,Pu=300,Eu=250,hs=30,ms=20,Fu=200,Bu=J({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},liveTurnId:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},hasMorePersistedAbove:{type:Boolean},isLoadingPersistedAbove:{type:Boolean},loadEarlierMessages:{type:Function}},emits:["forkThread","rollback","respondServerRequest","fileChangesChanged"],setup(e,{expose:n,emit:s}){function i(t){return ga(t,x.cwd,R)}function a(t){return De(t,x.cwd)}const c=H(new Set),l=H(new Set),r=H(new Set),h=H(null),m=H(""),y=H(!1),I=H(!1),S=H(0),C=H(0),A=H(""),b=H(""),{isMobile:E}=qo(),{buildFeedbackMailto:B,feedbackMailtoBase:X,recordVisibleFailure:ee}=vs(),{t:R}=te(),ye=X();function Te(t,o){ee(o);const d=t.currentTarget;d instanceof HTMLAnchorElement&&(d.href=B())}function Q(t){return t.messageType==="commandExecution"&&!!t.commandExecution}function Ps(t){return t.messageType==="compaction.pending"}function Es(t){return t.messageType==="compaction.done"}function gt(t){return t.messageType==="plan"||t.messageType==="plan.live"}function pt(t){return t.messageType==="reasoning"&&!!t.reasoning}const vt=H(new Set);function en(t){return vt.value.has(t.id)}function tn(t){const o=new Set(vt.value);o.has(t.id)?o.delete(t.id):o.add(t.id),vt.value=o}function nn(t){return t.messageType==="toolCall"&&!!t.toolCall}function Fs(t){return t.messageType==="turnError"}function Xe(t){return t.messageType==="fileChange"&&t.fileChangeStatus==="completed"&&Array.isArray(t.fileChanges)&&t.fileChanges.length>0}function kt(t){return t.role==="assistant"&&!Q(t)&&t.messageType!=="worked"&&!(t.messageType??"").endsWith(".live")}const yt=L(()=>{var t;for(let o=x.messages.length-1;o>=0;o-=1){const d=x.messages[o];if(d.messageType==="commandExecution"&&((t=d.commandExecution)==null?void 0:t.status)==="inProgress")return d.id}return""}),sn=L(()=>x.messages.some(t=>t.role==="assistant"&&t.messageType==="agentMessage.live"&&t.text.trim().length>0)),on=L(()=>!!x.liveOverlay||yt.value.length>0||sn.value),an=L(()=>{const t={};for(let o=0;o<x.messages.length;){const d=x.messages[o];if(!Q(d)){o+=1;continue}const v=[];for(;o<x.messages.length&&Q(x.messages[o]);)v.push(x.messages[o]),o+=1;if(v.length<=1)continue;const $=v[v.length-1];t[$.id]=v.slice(0,-1)}return t}),wt=L(()=>{const t=new Set;for(const o of Object.values(an.value))for(const d of o)t.add(d.id);return t});function rn(t){return!sn.value&&t.id===yt.value}function ln(t){return Q(t)?c.value.has(t.id)||!l.value.has(t.id)&&rn(t):!1}function cn(t){return Q(t)&&on.value}function un(t){var o;return Q(t)&&(on.value||((o=t.commandExecution)==null?void 0:o.status)==="inProgress")}function dn(t){if(!Q(t))return;const o=new Set(c.value),d=new Set(l.value),v=rn(t);o.has(t.id)?(o.delete(t.id),v&&d.add(t.id)):v&&!d.has(t.id)?d.add(t.id):(o.add(t.id),d.delete(t.id)),c.value=o,l.value=d}function Bs(t){return an.value[t.id]??[]}function fn(t){return Q(t)?[...Bs(t),t]:[]}function hn(t){const o=new Set(r.value);o.has(t.id)?o.delete(t.id):o.add(t.id),r.value=o}function Rs(t){return r.value.has(t.id)}function mn(t,o){t&&(h.value=t,m.value=Y(o),y.value=!1)}function Os(){h.value=null,m.value="",y.value=!1}function Hs(){y.value=!y.value}function Ds(){y.value=!1}function Ws(t){m.value=Y(t),E.value&&(y.value=!1)}function bt(t,o){if(t.size===0)return t;const d=new Set;for(const v of t)o.has(v)&&d.add(v);return d.size===t.size?t:d}const x=e,$t=s,me=H(null),gn=H(null),_e=H(""),Ct=H(!1),we=H(""),Z=H({}),oe=H({}),ae=H({}),ue=H(null),js=L(()=>{const t=ue.value;return t?t.kind==="edit-message"?R("Rollback this turn?"):t.action==="undo"?R("Undo file changes?"):R("Redo file changes?"):""}),qs=L(()=>{const t=ue.value;return t?t.kind==="edit-message"?R("This rolls the thread back to this turn so you can edit the message. Later replies will be removed."):t.filePathLabel?t.action==="undo"?R("Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.",{file:t.filePathLabel}):R("Redo the changes to {file}? This reapplies the edits to the working tree.",{file:t.filePathLabel}):t.action==="undo"?R("Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically."):R("Redo the file changes from this turn? This reapplies the edits to the working tree."):""}),ge=H(!0);let be=0,ie=0,Ye=0,ne=null,We=null;const pn=new WeakSet,Qe=H(null),Ie=H(0),vn=H(0);let et=null;const je=new Map,qe=new Map,Le=new Map,Me=new Map;function tt(t,o,d,v){for(t.has(o)&&t.delete(o),t.set(o,d);t.size>v;){const $=t.keys().next().value;if($===void 0)break;t.delete($)}return d}const pe=H(Xt(x.activeThreadId)),kn=L(()=>mt(pe.value,x.activeThreadId)),ve=H(!1),xt=L(()=>x.messages.filter(t=>!gt(t))),Se=L(()=>nc(xt.value)),Tt=L(()=>sc({turnCount:Se.value.length,hotTurns:hs,pageSize:ms,coldPage:kn.value.coldPage})),_t=L(()=>Tt.value.warmStartTurn),Ae=L(()=>Tt.value.warmEndTurn),yn=L(()=>Tt.value.coldTurnCount),wn=L(()=>yn.value>0),It=L(()=>kn.value.expandedWarmTurns),Ns=L(()=>{const t=xt.value,o=Se.value,d=[],v=It.value;for(let W=_t.value;W<Ae.value;W+=1){const z=o[W];if(!z)continue;const w={turn:W,userText:As(z.userItem.text),assistantPreview:z.assistantPreview,toolCount:z.toolCount,expanded:v.has(W)},O=v.has(W)?t.slice(z.startIdx,z.endIdx).map(q=>({message:q})):[];d.push({key:`warm-${W}`,warm:w,warmItems:O,processItems:[],fileChangeAnchorIds:[]})}const $=fs(t,o,Ae.value),p=$[0];if(!p)return d;const M=x.messages.findIndex(W=>W.id===p.id),P=M>=0?x.messages.slice(M):$;for(const W of Jl(P,{liveOverlayActive:x.liveOverlay!==null,liveTurnId:x.liveTurnId})){const z=W.items.find(j=>j.kind==="user"),w=W.items.find(j=>j.kind==="final-assistant"),O=W.items.filter(j=>j!==z&&j!==w).map(j=>({message:j.message,presentation:j.kind==="plan"?"plan":"process"})),q=W.items.map(j=>j.message.id).filter(j=>!!se(j));d.push({key:W.key,warmItems:[],request:z?{message:z.message}:void 0,processItems:O,fileChangeAnchorIds:q,finalItem:w?{message:w.message,presentation:"final-assistant"}:void 0})}return d});function bn(){pe.value=Yl(pe.value,x.activeThreadId)}function zs(t){pe.value=ds(pe.value,x.activeThreadId,t,!It.value.has(t))}const $n=L(()=>Se.value.map((t,o)=>({turn:o,text:Xl(t.userItem.text)}))),Us=L(()=>Math.max(0,$n.value.length-1)),Vs=L(()=>{const t=new Map;return Se.value.forEach((o,d)=>{t.set(o.userItem.id,d)}),t});function Lt(t){return`question-anchor-${t}`}function Ks(t){const o=Vs.value.get(t.id);if(o!==void 0&&!(o<Ae.value))return Lt(o)}function Gs(t){if(t<Ae.value){let o=pe.value;if(t<_t.value){const d=oc({turn:t,turnCount:Se.value.length,hotTurns:hs,pageSize:ms});o=Ql(o,x.activeThreadId,d)}o=ds(o,x.activeThreadId,t,!0),pe.value=o}ge.value=!1,rt().then(()=>{const o=me.value,d=document.getElementById(Lt(t));if(!o||!d)return;const v=d.getBoundingClientRect(),$=o.getBoundingClientRect(),p=o.scrollTop+v.top-$.top-12;o.scrollTo({top:Math.max(0,p),behavior:"smooth"})})}const Zs=L(()=>{const t=xt.value,o=Se.value,d=[];for(let M=_t.value;M<Ae.value;M+=1){if(!It.value.has(M))continue;const P=o[M];P&&d.push(...t.slice(P.startIdx,P.endIdx))}const v=fs(t,o,Ae.value),$=v[0];if(!$)return d;const p=x.messages.findIndex(M=>M.id===$.id);return d.push(...p>=0?x.messages.slice(p):v),d}),Mt=L(()=>Vl(Zs.value)),Ne=L(()=>{var o;const t=new Map;for(const d of Mt.value){const v=((o=d.messages[0])==null?void 0:o.id)??"";v&&t.set(v,d)}return t}),Js=L(()=>{const t=new Set;for(const o of Mt.value)for(const d of o.messages)t.add(d.id);return t}),Xs=L(()=>{const t=new Set;for(const o of Mt.value)t.add(o.turnId);return t});function Ys(t){return Ne.value.has(t.id)}function Cn(t){return Js.value.has(t.id)}function Qs(t){var o;return((o=Ne.value.get(t.id))==null?void 0:o.messages)??[]}function eo(t){return Gr(Qs(t))}function to(t){var o;return t.type==="batch"?`tool-batch-${t.kind}-${((o=t.messages[0])==null?void 0:o.id)??""}`:t.message.id}function no(t){const o=Ne.value.get(t.id);return o?Kl(o,{t:R,formatDuration:Go}):""}function so(t){var o;return((o=Ne.value.get(t.id))==null?void 0:o.running)??!1}function oo(t){var o;return((o=Ne.value.get(t.id))==null?void 0:o.hasOutsideContent)??!0}function ao(t){return t.messageType==="worked"}const io=L(()=>x.hasMorePersistedAbove===!0),ro=L(()=>!ge.value&&(x.messages.length>0||x.pendingRequests.length>0||!!x.liveOverlay));function lo(){return Qe.value?Promise.resolve():(et||(et=Vo(()=>import("./common-BeuopZEI.js"),[]).then(t=>{Qe.value=t.default,Me.clear(),Le.clear(),Ie.value+=1}).finally(()=>{et=null})),et)}function xn(t){switch(t){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function co(t){var v;const o=Ve(t);if(!o)return"";const d=[];return(v=o.explanation)!=null&&v.trim()&&d.push(o.explanation.trim()),o.steps.length>0&&d.push(o.steps.map($=>`- ${xn($.status)} ${$.step}`.trim()).join(`
|
|
26
26
|
`)),d.join(`
|
|
27
27
|
|
|
28
28
|
`).trim()}function St(t){const o=[],d=t.text.trim()||co(t),v=gt(t)&&d?`Plan
|
|
@@ -32,8 +32,8 @@ ${$.join(`
|
|
|
32
32
|
${p.join(`
|
|
33
33
|
`)}`),o.join(`
|
|
34
34
|
|
|
35
|
-
`).trim()}const
|
|
35
|
+
`).trim()}const Tn=L(()=>{var d;const t=new Map;for(const v of x.messages){if(!kt(v))continue;const $=St(v);if(!$)continue;const p=typeof v.turnIndex=="number"?`turn:${v.turnIndex}`:`message:${v.id}`,M=t.get(p);if(M){M.anchorMessageId=v.id,M.parts.push($);continue}t.set(p,{anchorMessageId:v.id,parts:[$]})}const o={};for(const v of t.values()){const $=v.parts.join(`
|
|
36
36
|
|
|
37
37
|
`).trim();$&&(o[v.anchorMessageId]=$)}for(const[v,$]of Object.entries(ze.value)){if($.source!=="metadata")continue;const p=i($);if(!p)continue;const M=(d=o[v])==null?void 0:d.trim();o[v]=M?`${M}
|
|
38
38
|
|
|
39
|
-
${p}`:p}return o}),Tn=I(()=>{const t=new Map;for(const d of C.messages){if(!kt(d)||typeof d.turnIndex!="number")continue;const v=`turn:${d.turnIndex}`,$=t.get(v);if($){$.anchorMessageId=d.id,$.turnIndex=d.turnIndex;continue}t.set(v,{anchorMessageId:d.id,turnIndex:d.turnIndex})}const o={};for(const d of t.values())o[d.anchorMessageId]=d.turnIndex;return o});function uo(t){return typeof _n.value[t.id]=="string"}function fo(t){return t.role==="user"&&St(t).length>0}async function ho(t){const o=C.messages.find($=>$.id===t);if(!o)return;const d=St(o);if(!d)return;let v=!1;try{await qt(d),v=!0}catch{v=!1}v||(v=Jn(d)),v&&(we.value=t,ne&&clearTimeout(ne),ne=setTimeout(()=>{we.value===t&&(we.value=""),ne=null},1800))}function mo(t){return typeof Tn.value[t.id]=="number"}const ze=I(()=>{var p,M;const t=new Map,o=new Map,d=new Map,v=A=>!Xe(A)&&!pt(A)&&!gt(A)&&!wt.value.has(A.id)&&!Cn(A);for(const A of C.messages){const W=typeof A.turnIndex=="number"?`turn:${A.turnIndex}`:`message:${A.id}`;if(v(A)&&t.set(W,A.id),kt(A)&&typeof A.turnIndex=="number"&&Array.isArray(A.fileChanges)&&A.fileChanges.length>0&&o.set(A.id,{changes:Dt(A.fileChanges),sourceMessageIds:[],source:"assistant",turnId:A.turnId??""}),!Xe(A))continue;const z=d.get(W);z?z.push(A):d.set(W,[A])}const $={};for(const[A,W]of d.entries()){const z=t.get(A);if(!z)continue;const w=((p=o.get(z))==null?void 0:p.turnId)??"";$[z]={changes:Dt(W.flatMap(O=>O.fileChanges??[])),sourceMessageIds:W.map(O=>O.id),source:"metadata",turnId:((M=W.find(O=>typeof O.turnId=="string"&&O.turnId.length>0))==null?void 0:M.turnId)??w}}for(const[A,W]of o.entries())$[A]||($[A]=W);return $}),At=I(()=>{var v;const t=new Map,o=new Set;for(const $ of Object.values(ze.value))for(const p of $.sourceMessageIds)o.add(p);for(const $ of C.messages){if(!Xe($))continue;const p=typeof $.turnIndex=="number"?`turn:${$.turnIndex}`:`message:${$.id}`,M=t.get(p);M?M.push($):t.set(p,[$])}const d={};for(const[$,p]of t.entries()){if(p.some(A=>o.has(A.id)))continue;const M=p[p.length-1];M&&(d[M.id]={changes:Dt(p.flatMap(A=>A.fileChanges??[])),sourceMessageIds:p.map(A=>A.id),source:"metadata",turnId:M.turnId??((v=p.find(A=>typeof A.turnId=="string"&&A.turnId.length>0))==null?void 0:v.turnId)??""})}return d}),Ln=I(()=>{const t=new Set;for(const o of Object.values(ze.value))for(const d of o.sourceMessageIds)t.add(d);for(const[o,d]of Object.entries(At.value))for(const v of d.sourceMessageIds)v!==o&&t.add(v);return t});function se(t){return ze.value[t]??null}function go(t){return l.value.has(t)}function po(t){const o=C.messages.find(d=>d.id===t);o&&hn(o)}function re(t){return At.value[t.id]??null}function In(t){if(!t)return!1;const o=C.liveTurnId??"";return o?(t.turnId??"")!==o:!0}function Pe(t){return t!=null&&t.turnId&&C.activeThreadId?`thread:${C.activeThreadId}:turn:${t.turnId}`:""}function Mn(t){return Pe(t).length>0}function Ue(t){const o=Pe(t);return o?Z.value[o]??"idle":"idle"}function Sn(t){const o=Pe(t);return o?oe.value[o]??"":""}function Pt(t){const o=Ue(t);return o==="undone"||o==="redoing"?"redo":"undo"}function An(t){const o=Ue(t);return o==="undoing"?R("Undoing"):o==="redoing"?R("Redoing"):Pt(t)==="redo"?R("Redo"):R("Undo")}async function vo(t,o,d){const v=Pe(t);if(!t||!v||!C.activeThreadId||!C.cwd)return;const $=Ue(t),p=o==="undo"?"undoing":"redoing";Z.value={...Z.value,[v]:p},oe.value={...oe.value,[v]:""};let M;try{const A=ae.value[v]??[];M=await Ko(C.activeThreadId,t.turnId,C.cwd,o,A.length>0?A:void 0,"single_turn",d)}catch(A){Z.value={...Z.value,[v]:$},oe.value={...oe.value,[v]:A instanceof Error?A.message:R("Failed to update file changes.")};return}if(M.errors.length>0){o==="undo"?(ae.value={...ae.value,[v]:M.revertedPatchIds??[]},Z.value={...Z.value,[v]:"undone"}):((M.appliedPatchIds??[]).length>0&&(ae.value={...ae.value,[v]:M.appliedPatchIds??[]}),Z.value={...Z.value,[v]:"undone"}),oe.value={...oe.value,[v]:M.errors.join("; ")};return}if((M.changed??0)<=0){Z.value={...Z.value,[v]:$},oe.value={...oe.value,[v]:M.message||R(o==="undo"?"No file changes to undo.":"No file changes to redo.")};return}o==="undo"?(ae.value={...ae.value,[v]:M.revertedPatchIds??[]},Z.value={...Z.value,[v]:"undone"}):(ae.value={...ae.value,[v]:M.appliedPatchIds??[]},Z.value={...Z.value,[v]:"redone"}),$t("fileChangesChanged",C.activeThreadId)}const Pn=I(()=>{var t;return((t=h.value)==null?void 0:t.changes)??[]}),En=I(()=>{const t=Pn.value;return t.length===0?null:t.find(o=>Y(o)===m.value)??t[0]}),ko=I(()=>wa(En.value));async function yo(t){const o=_n.value[t]??"";if(!o)return;let d=!1;try{await qt(o),d=!0}catch{d=!1}d||(d=Jn(o)),d&&(we.value=t,ne&&clearTimeout(ne),ne=setTimeout(()=>{we.value===t&&(we.value=""),ne=null},1800))}function wo(t){const o=Tn.value[t];typeof o=="number"&&C.activeThreadId&&$t("forkThread",{threadId:C.activeThreadId,turnIndex:o})}const Et=I(()=>{const t={};for(const o of C.messages){if(o.role!=="user"||typeof o.turnIndex!="number")continue;const d=typeof o.turnId=="string"&&o.turnId.length>0?o.turnId:"";!d||o.text.trim().length===0||(t[o.id]=d)}return t});function bo(t){return typeof Et.value[t.id]=="string"}function $o(t){Et.value[t]&&(ue.value={kind:"edit-message",messageId:t})}function Fn(t,o){Pe(t)&&(ue.value={kind:"file-change",summary:t,action:o})}function Bn(t,o){!t||!Pe(t)||!o.path||(ue.value={kind:"file-change",summary:t,action:"undo",filePaths:[o.path],filePathLabel:a(o.path)})}function Co(){const t=ue.value;if(ue.value=null,!!t){if(t.kind==="edit-message"){const o=Et.value[t.messageId];o&&$t("rollback",{turnId:o});return}vo(t.summary,t.action,t.filePaths)}}function $e(t){const o=qe.get(t);return o?(qe.delete(t),qe.set(t,o),o):tt(qe,t,ea(t),Au)}function de(t){const o=t.trim();if(!o)return"#";const d=M=>M.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(M),v=Ge(o),$=(v==null?void 0:v.path)??o,p=ws($,C.cwd);if(d(p)){const M=p.startsWith("/")?p:`/${p}`;return`/codex-local-browse${encodeURI(M)}`}return"#"}function xo(t){const o=t.trim();if(!o)return"";try{const d=new URL(o,window.location.href);return d.pathname.startsWith("/codex-local-browse")?`${`/codex-local-edit${d.pathname.slice(19)}`}${d.search}${d.hash}`:""}catch{return""}}function _o(t){const o=t.target;if(!(o instanceof Element))return;const d=o.closest("a.message-file-link");if(!(d instanceof HTMLAnchorElement))return;const v=(d.getAttribute("href")??"").trim();!v||v==="#"||(t.preventDefault(),t.stopPropagation(),S.value=v,b.value=xo(v),P.value=t.clientX,_.value=t.clientY,L.value=!0)}function To(){L.value&&(L.value=!1)}function Lo(t){const o=je.get(t.id);if(o&&o.text===t.text&&o.cwd===C.cwd)return je.delete(t.id),je.set(t.id,o),o.blocks;const d=as(t.text);return tt(je,t.id,{text:t.text,cwd:C.cwd,blocks:d},Su).blocks}function V(t){return t.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/"/gu,""").replace(/'/gu,"'")}function Rn(t){var d;const o=((d=t.trim().split(/\s+/u)[0])==null?void 0:d.toLowerCase())??"";return o?Ls[o]??o:""}function Io(t,o){const d=Rn(t);if(!d)return V(o);const v=Qe.value;if(!v)return V(o);try{if(v.getLanguage(d))return v.highlight(o,{language:d,ignoreIllegals:!0}).value}catch{}return V(o)}function On(t,o){return Ot(Mo(t,o))}function Mo(t,o){const d=`${Le.value}\0${Rn(t)}\0${t}\0${o}`,v=Me.get(d);return v!==void 0?(Me.delete(d),Me.set(d,v),v):tt(Me,d,Io(t,o),Eu)}function Ce(t){return $e(t).map(o=>o.kind==="text"?V(o.value):o.kind==="bold"?`<strong class="message-bold-text">${V(o.value)}</strong>`:o.kind==="italic"?`<em class="message-italic-text">${V(o.value)}</em>`:o.kind==="strikethrough"?`<s class="message-strikethrough-text">${V(o.value)}</s>`:o.kind==="file"?`<a class="message-file-link" href="${V(de(o.path))}" target="_blank" rel="noopener noreferrer" title="${V(o.path)}">${V(o.displayPath)}</a>`:o.kind==="url"?`<a class="message-file-link" href="${V(o.href)}" target="_blank" rel="noopener noreferrer" title="${V(o.href)}">${V(o.value)}</a>`:`<code class="message-inline-code">${V(o.value)}</code>`).join("")}function So(t){return t.paragraphs.map(o=>`<div class="message-list-item-text message-list-item-paragraph">${Ce(o)}</div>`).join("")}function nt(t){var v;const o=So(t),d=((v=t.children)==null?void 0:v.map($=>Dn($)).join(""))??"";return Ot(o+d)}function Hn(t){return t?` style="text-align:${t}"`:""}function Dn(t){if(t.kind==="paragraph")return`<p class="message-text">${Ce(t.value)}</p>`;if(t.kind==="heading"){const o=Math.min(6,Math.max(1,Math.trunc(t.level))),d=Yn(o),v=`message-heading ${Qn(o)}`;return`<${d} class="${v}">${Ce(t.value)}</${d}>`}if(t.kind==="blockquote")return`<blockquote class="message-blockquote">${Ce(t.value)}</blockquote>`;if(t.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${t.items.map(d=>`<li class="message-list-item"><div class="message-list-item-content">${nt(d)}</div></li>`).join("")}</ul>`;if(t.kind==="taskList")return`<ul class="message-list message-task-list">${t.items.map(d=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${d.checked?"true":"false"}">${d.checked?"☑":"☐"}</span><div class="message-list-item-text">${Ce(d.text)}</div></li>`).join("")}</ul>`;if(t.kind==="orderedList"){const o=t.items.map(d=>`<li class="message-list-item"><div class="message-list-item-content">${nt(d)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${t.start}">${o}</ol>`}if(t.kind==="table"){const o=t.headers.map(($,p)=>`<th class="message-table-head-cell"${Hn(t.alignments[p]??null)}>${Ce($)}</th>`).join(""),d=t.rows.map($=>'<tr class="message-table-body-row">'+$.map((p,M)=>`<td class="message-table-cell"${Hn(t.alignments[M]??null)}>${Ce(p)}</td>`).join("")+"</tr>").join(""),v=d?`<tbody>${d}</tbody>`:"";return`<div class="message-table-wrap"><table class="message-table"><thead><tr>${o}</tr></thead>${v}</table></div>`}return t.kind==="codeBlock"?`<div class="message-code-block">${t.language?`<div class="message-code-language">${V(t.language)}</div>`:""}<pre class="message-code-pre"><code class="hljs">${On(t.language,t.value)}</code></pre></div>`:t.kind==="thematicBreak"?'<hr class="message-divider">':it(t.url)?`<video class="message-image-preview message-video-preview message-markdown-image" src="${V(t.url)}" controls preload="metadata"></video>`:`<img class="message-image-preview message-markdown-image" src="${V(t.url)}" alt="${V(t.alt||"Embedded message image")}" loading="lazy">`}function Wn(t){const o=`${C.cwd}\0${Le.value}\0${t}`,d=Ie.get(o);if(d&&d.text===t&&d.cwd===C.cwd&&d.highlightVersion===Le.value)return Ie.delete(o),Ie.set(o,d),d.html;const v=as(t).map(p=>Dn(p)).join(""),$=Ot(v);return tt(Ie,o,{text:t,cwd:C.cwd,highlightVersion:Le.value,html:$},Pu).html}function Ao(){const t=me.value,o=gn.value;!t||!o||(t.scrollTop=t.scrollHeight,o.scrollIntoView({block:"end"}))}function Po(t){return t.scrollHeight-(t.scrollTop+t.clientHeight)<=Mu}function Eo(){if(me.value&&ge.value){st();return}}function st(){me.value&&Ao()}function Ft(){return ge.value}function jn(){if(!Ft()){Ye=0,ie=0;return}if(st(),Ye-=1,Ye<=0){ie=0;return}ie=requestAnimationFrame(jn)}function ot(t=6){Ft()&&(ie&&(cancelAnimationFrame(ie),ie=0),Ye=Math.max(t,1),ie=requestAnimationFrame(jn))}function qn(){ot(3)}function Nn(){ge.value=!0,st(),ot(4)}async function zn(){var $;const t=me.value;if(!t||!C.hasMorePersistedAbove||ve.value||C.isLoadingPersistedAbove===!0)return;ve.value=!0;const o=C.activeThreadId,d=t.scrollHeight,v=t.scrollTop;try{await(($=C.loadEarlierMessages)==null?void 0:$.call(C,o)),await rt(),C.activeThreadId===o&&(t.scrollTop=v+(t.scrollHeight-d))}finally{ve.value=!1}}n({jumpToLatest:Nn});function Fo(){if(!Ft())return;const t=me.value;if(!t)return;const o=t.querySelectorAll("img.message-image-preview");for(const d of o)d.complete||pn.has(d)||(pn.add(d),d.addEventListener("load",qn,{once:!0}),d.addEventListener("error",qn,{once:!0}))}async function at(){return We||(We=rt().then(()=>new Promise(t=>{be&&cancelAnimationFrame(be),be=requestAnimationFrame(()=>{be=0,We=null,Eo(),Fo(),ot(),t()})})),We)}function Bo(){je.clear(),qe.clear(),Ie.clear(),Me.clear()}ce(()=>C.messages,async t=>{if(C.isLoading)return;const o=new Set(t.filter(d=>d.messageType==="commandExecution"&&d.commandExecution).map(d=>d.id));c.value=bt(c.value,o),r.value=bt(r.value,o),l.value=bt(l.value,new Set([...Object.keys(ze.value),...Object.keys(At.value)])),await at()}),ce(()=>C.messages.some(t=>t.text.includes("```")),t=>{!t||Qe.value||lo()},{immediate:!0}),ce(yt,(t,o)=>{if(!o||o===t||!r.value.has(o))return;const d=new Set(r.value);d.delete(o),r.value=d}),ce(()=>C.pendingRequests,async()=>{C.isLoading||await at()},{deep:!0}),ce(()=>C.liveOverlay,async t=>{t&&ge.value&&(await rt(),st(),ot(8))},{deep:!0}),ce(()=>C.isLoading,async t=>{t||await at()}),ce(()=>C.activeThreadId,async()=>{ge.value=!0,Te.value="",ve.value=!1,Z.value={},oe.value={},ae.value={},pe.value=Xt(C.activeThreadId),await at()},{flush:"post"});function Ro(){const t=me.value;!t||C.isLoading||(ge.value=Po(t),t.scrollTop<Fu&&!ve.value&&(wn.value?bn():C.hasMorePersistedAbove===!0&&zn()))}const Bt=H(new Set);function Un(t,o){return`${t}:${o}`}function Oo(t,o){return Bt.value.has(Un(t,o))}function Ho(t,o){const d=new Set(Bt.value);d.add(Un(t,o)),Bt.value=d,vn.value+=1}function Vn(t){Te.value=t,Ct.value=it(t)}function Kn(){Te.value="",Ct.value=!1}const Rt=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function it(t){const o=t.trim();if(!o)return!1;if(o.startsWith("data:video/"))return!0;try{const d=new URL(o,window.location.href);return Rt.test(d.pathname)?!0:d.pathname==="/codex-local-image"?Rt.test(d.searchParams.get("path")??""):!1}catch{return Rt.test(o)}}return Yt(()=>{Bo(),be&&(cancelAnimationFrame(be),be=0),ie&&(cancelAnimationFrame(ie),ie=0),ne&&(clearTimeout(ne),ne=null)}),(t,o)=>(u(),f(F,null,[g("section",{class:"conversation-root",onContextmenuCapture:_o},[e.isLoading?(u(),f("p",ac,k(x(R)("Loading messages...")),1)):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(u(),f("p",ic,k(x(R)("No messages in this thread yet.")),1)):(u(),f("ul",{key:2,ref_key:"conversationListRef",ref:me,class:"conversation-list",onScroll:Ro},[io.value?(u(),f("li",rc,[g("button",{type:"button",class:"load-more-button",disabled:ve.value||e.isLoadingPersistedAbove,onClick:zn},k(ve.value||e.isLoadingPersistedAbove?x(R)("Loading…"):x(R)("Load earlier messages")),9,lc)])):T("",!0),wn.value?(u(),f("li",cc,[g("button",{type:"button",class:"load-more-button",disabled:ve.value,onClick:bn},k(x(R)("Load earlier ({n} turns)",{n:yn.value})),9,uc)])):T("",!0),(u(!0),f(F,null,D(Ns.value,d=>(u(),K(xl,{key:d.key,"turn-key":d.key,warm:d.warm,"warm-items":d.warmItems,request:d.request,"process-items":d.processItems,"final-item":d.finalItem,"file-change-anchor-ids":d.fileChangeAnchorIds},{"warm-card":Fe(({warm:v})=>[g("li",{id:It(v.turn),class:"conversation-item conversation-item-warm-card","data-role":"system","data-message-type":"warmTurn"},[g("div",fc,[g("div",hc,[N(Al,{"user-text":v.userText,"assistant-preview":v.assistantPreview,"tool-count":v.toolCount,expanded:v.expanded,onToggle:$=>zs(v.turn)},null,8,["user-text","assistant-preview","tool-count","expanded","onToggle"])])])],8,dc)]),"file-change":Fe(({anchorMessageId:v})=>[g("div",mc,[g("div",gc,[In(se(v))?(u(),K(is,{key:0,summary:se(v),expanded:go(v),cwd:C.cwd,actionable:Mn(se(v)),"action-status":Ue(se(v)),"action-error-text":Sn(se(v)),"next-action":Pt(se(v)),"action-label":An(se(v)),onToggle:$=>po(v),onOpenDiff:$=>mn(se(v),$),onRequestAction:$=>Fn(se(v),$),onRequestFileAction:$=>Bn(se(v),$)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):T("",!0)])])]),default:Fe(({item:v,section:$})=>[(u(!0),f(F,null,D([v.message],p=>{var M,A,W,z;return u(),f(F,{key:p.id},[Ys(p)?(u(),f("li",pc,[g("div",vc,[g("div",kc,[N(Ir,{label:no(p),running:so(p),"has-outside-content":oo(p)},{default:Fe(()=>[(u(!0),f(F,null,D(eo(p),w=>(u(),f(F,{key:to(w)},[w.type==="batch"?(u(),K(fl,{key:0,kind:w.kind,messages:w.messages},null,8,["kind","messages"])):(u(!0),f(F,{key:1},D([w.message],O=>(u(),f(F,{key:O.id},[!wt.value.has(O.id)&&!Ln.value.has(O.id)?(u(),f(F,{key:0},[Q(O)?(u(),f("div",yc,[(u(!0),f(F,null,D(fn(O),(q,j)=>(u(),K(cs,{key:`work-cmd-${q.id}`,command:q,"step-index":j,expanded:ln(q),compact:cn(q),"output-condensed":un(q),onToggle:Gn=>dn(q)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])):nn(O)?(u(),K(Jt,{key:1,message:O},null,8,["message"])):pt(O)?(u(),K(ls,{key:2,message:O,expanded:en(O),"content-html":Wn(O.text),onToggle:q=>tn(O)},null,8,["message","expanded","content-html","onToggle"])):T("",!0)],64)):T("",!0)],64))),128))],64))),128))]),_:2},1032,["label","running","has-outside-content"])])])])):!Cn(p)&&!wt.value.has(p.id)&&!Ln.value.has(p.id)&&!(ao(p)&&Xs.value.has(p.turnId??""))?(u(),f("li",{key:1,id:Ks(p),class:U(["conversation-item",{"conversation-item-request":$==="request","conversation-item-process":$==="process"||v.presentation==="process","conversation-item-final":$==="final"||v.presentation==="final-assistant","conversation-item-plan":v.presentation==="plan"}]),"data-role":p.role,"data-message-type":p.messageType||""},[Ps(p)?(u(),f("div",bc,[g("div",$c,[o[3]||(o[3]=g("span",{class:"thread-compaction-spinner","aria-hidden":"true"},null,-1)),g("span",null,k(x(R)("Compacting thread context…")),1)])])):Es(p)?(u(),f("div",Cc,[g("div",xc,k(x(R)("Context compacted")),1)])):Q(p)?(u(),f("div",_c,[g("div",Tc,[g("div",Lc,[(u(!0),f(F,null,D(fn(p),(w,O)=>(u(),K(cs,{key:`work-cmd-${w.id}`,command:w,"step-index":O,expanded:ln(w),compact:cn(w),"output-condensed":un(w),onToggle:q=>dn(w)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])])])):nn(p)?(u(),K(Jt,{key:3,message:p},null,8,["message"])):Xe(p)?(u(),f("div",{key:4,class:"message-row","data-role":p.role,"data-message-type":p.messageType||""},[g("div",{class:"message-stack","data-role":p.role},[g("article",{class:"message-body","data-role":p.role},[In(re(p))?(u(),K(is,{key:0,summary:re(p),expanded:Rs(p),cwd:C.cwd,actionable:Mn(re(p)),"action-status":Ue(re(p)),"action-error-text":Sn(re(p)),"next-action":Pt(re(p)),"action-label":An(re(p)),onToggle:w=>hn(p),onOpenDiff:w=>mn(re(p),w),onRequestAction:w=>Fn(re(p),w),onRequestFileAction:w=>Bn(re(p),w)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):T("",!0)],8,Sc)],8,Mc)],8,Ic)):v.presentation==="plan"?(u(),f("div",Ac,[g("div",Pc,[g("article",Ec,[g("div",Fc,k(x(R)("Plan")),1),(M=x(Ve)(p))!=null&&M.explanation?(u(),f("p",Bc,k((A=x(Ve)(p))==null?void 0:A.explanation),1)):T("",!0),(W=x(Ve)(p))!=null&&W.steps.length?(u(),f("ol",Rc,[(u(!0),f(F,null,D((z=x(Ve)(p))==null?void 0:z.steps,(w,O)=>(u(),f("li",{key:`${p.id}-plan-${O}`,"data-status":w.status},[g("span",Hc,k(xn(w.status)),1),g("span",null,k(w.step),1)],8,Oc))),128))])):T("",!0)])])])):(u(),f("div",{key:6,class:U(["message-row",{"message-row-final":v.presentation==="final-assistant"}]),"data-role":p.role,"data-message-type":p.messageType||""},[g("div",{class:"message-stack","data-role":p.role},[g("article",{class:"message-body","data-role":p.role},[p.images&&p.images.length>0?(u(),f("ul",{key:0,class:U(["message-image-list",{"message-generated-image-list":p.messageType==="imageView"}]),"data-role":p.role},[(u(!0),f(F,null,D(p.images,w=>(u(),f("li",{key:w,class:"message-image-item"},[g("button",{class:"message-image-button",type:"button",onClick:O=>Vn(w)},[it(w)?(u(),f("video",{key:0,class:U(["message-image-preview message-video-preview",{"message-generated-image-preview":p.messageType==="imageView"}]),src:w,controls:"",preload:"metadata"},null,10,zc)):(u(),f("img",{key:1,class:U(["message-image-preview",{"message-generated-image-preview":p.messageType==="imageView"}]),src:w,alt:p.messageType==="imageView"?"Generated image":"Message image preview",loading:"lazy"},null,10,Uc))],8,Nc)]))),128))],10,qc)):T("",!0),p.fileAttachments&&p.fileAttachments.length>0?(u(),f("div",Vc,[(u(!0),f(F,null,D(p.fileAttachments,w=>(u(),f("span",{key:`${p.id}:${w.path}`,class:"message-file-chip"},[o[4]||(o[4]=g("span",{class:"message-file-chip-icon"},"📄",-1)),g("a",{class:"message-file-link message-file-chip-name",href:de(w.path),target:"_blank",rel:"noopener noreferrer",title:w.path},k(w.label),9,Kc)]))),128))])):T("",!0),p.skills&&p.skills.length>0?(u(),f("div",Gc,[(u(!0),f(F,null,D(p.skills,w=>(u(),f("a",{key:`${p.id}:${w.path}`,class:"message-skill-chip",href:de(w.path),title:w.path},[g("span",Jc,k(x(R)("Skill")),1),g("span",Xc,k(w.name),1)],8,Zc))),128))])):T("",!0),p.text.length>0?(u(),f("article",{key:3,class:"message-card","data-role":p.role},[p.isAutomationRun?(u(),f("div",Qc,[o[5]||(o[5]=g("span",null,"Sent via automation",-1)),p.automationDisplayName?(u(),f("code",eu,k(p.automationDisplayName),1)):T("",!0)])):T("",!0),p.messageType==="worked"?(u(),f("div",tu,[g("p",nu,k(p.text),1)])):pt(p)?(u(),K(ls,{key:2,message:p,expanded:en(p),"content-html":Wn(p.text),onToggle:w=>tn(p)},null,8,["message","expanded","content-html","onToggle"])):No([p.id,p.text,C.cwd,Le.value,vn.value],()=>(u(),f("div",{key:3,class:"message-text-flow"},[(u(!0),f(F,null,D(Lo(p),(w,O)=>(u(),f(F,{key:`block-${O}`},[w.kind==="paragraph"?(u(),f("p",su,[N(Ee,{segments:$e(w.value),"to-browse-url":de},null,8,["segments"])])):w.kind==="heading"?(u(),K(zo(x(Yn)(w.level)),{key:1,class:U(["message-heading",x(Qn)(w.level)])},{default:Fe(()=>[N(Ee,{segments:$e(w.value),"to-browse-url":de},null,8,["segments"])]),_:2},1032,["class"])):w.kind==="blockquote"?(u(),f("blockquote",ou,[N(Ee,{segments:$e(w.value),"to-browse-url":de},null,8,["segments"])])):w.kind==="unorderedList"?(u(),f("ul",au,[(u(!0),f(F,null,D(w.items,(q,j)=>(u(),f("li",{key:`ul-${O}-${j}`,class:"message-list-item"},[g("div",{class:"message-list-item-content",innerHTML:nt(q)},null,8,iu)]))),128))])):w.kind==="taskList"?(u(),f("ul",ru,[(u(!0),f(F,null,D(w.items,(q,j)=>(u(),f("li",{key:`task-${O}-${j}`,class:"message-task-item"},[g("span",{class:"message-task-checkbox","data-checked":q.checked},k(q.checked?"☑":"☐"),9,lu),g("div",cu,[N(Ee,{segments:$e(q.text),"to-browse-url":de},null,8,["segments"])])]))),128))])):w.kind==="orderedList"?(u(),f("ol",{key:5,class:"message-list message-list-ordered",start:w.start},[(u(!0),f(F,null,D(w.items,(q,j)=>(u(),f("li",{key:`ol-${O}-${j}`,class:"message-list-item"},[g("div",{class:"message-list-item-content",innerHTML:nt(q)},null,8,du)]))),128))],8,uu)):w.kind==="table"?(u(),f("div",fu,[g("table",hu,[g("thead",null,[g("tr",null,[(u(!0),f(F,null,D(w.headers,(q,j)=>(u(),f("th",{key:`th-${O}-${j}`,class:"message-table-head-cell",style:Ke({textAlign:w.alignments[j]??"left"})},[N(Ee,{segments:$e(q),"to-browse-url":de},null,8,["segments"])],4))),128))])]),w.rows.length>0?(u(),f("tbody",mu,[(u(!0),f(F,null,D(w.rows,(q,j)=>(u(),f("tr",{key:`tr-${O}-${j}`,class:"message-table-body-row"},[(u(!0),f(F,null,D(q,(Gn,Zn)=>(u(),f("td",{key:`td-${O}-${j}-${Zn}`,class:"message-table-cell",style:Ke({textAlign:w.alignments[Zn]??"left"})},[N(Ee,{segments:$e(Gn),"to-browse-url":de},null,8,["segments"])],4))),128))]))),128))])):T("",!0)])])):w.kind==="codeBlock"?(u(),f("div",gu,[w.language?(u(),f("div",pu,k(w.language),1)):T("",!0),g("pre",vu,[g("code",{class:"hljs",innerHTML:On(w.language,w.value)},null,8,ku)])])):w.kind==="thematicBreak"?(u(),f("hr",yu)):Oo(p.id,O)?(u(),f("p",wu,k(w.markdown),1)):(u(),f("button",{key:10,class:"message-image-button",type:"button",onClick:q=>Vn(w.url)},[it(w.url)?(u(),f("video",{key:0,class:"message-image-preview message-video-preview message-markdown-image",src:w.url,controls:"",preload:"metadata"},null,8,$u)):(u(),f("img",{key:1,class:"message-image-preview message-markdown-image",src:w.url,alt:w.alt||"Embedded message image",loading:"lazy",onError:q=>Ho(p.id,O)},null,40,Cu))],8,bu))],64))),128))])),o,0),Fs(p)?(u(),f("a",{key:4,class:"turn-error-feedback",href:x(ye),onClick:w=>_e(w,p.text)},k(x(R)("Send feedback")),9,xu)):T("",!0)],8,Yc)):T("",!0),$!=="process"?(u(),K(wr,{key:4,role:p.role,"show-edit":bo(p),"show-fork":mo(p),"show-copy":uo(p)||fo(p),copied:we.value===p.id,onEdit:w=>$o(p.id),onFork:w=>wo(p.id),onCopy:w=>p.role==="user"?ho(p.id):yo(p.id)},null,8,["role","show-edit","show-fork","show-copy","copied","onEdit","onFork","onCopy"])):T("",!0)],8,jc)],8,Wc)],10,Dc))],10,wc)):T("",!0)],64)}),128))]),_:2},1032,["turn-key","warm","warm-items","request","process-items","final-item","file-change-anchor-ids"]))),128)),e.liveOverlay?(u(),K(Qi,{key:2,overlay:e.liveOverlay,"feedback-mailto":x(ye)},null,8,["overlay","feedback-mailto"])):T("",!0),g("li",{ref_key:"bottomAnchorRef",ref:gn,class:"conversation-bottom-anchor"},null,512)],544)),N(Fr,{anchors:$n.value,"active-turn":Us.value,onJump:Gs},null,8,["anchors","active-turn"]),ro.value?(u(),f("button",{key:3,type:"button",class:"jump-to-latest-button",title:x(R)("Jump to latest"),"aria-label":x(R)("Jump to latest output"),onClick:Nn},[N(Uo,{class:"icon-svg jump-to-latest-icon"})],8,_u)):T("",!0),Te.value.length>0?(u(),f("div",{key:4,class:"image-modal-backdrop",onClick:Kn},[g("div",{class:"image-modal-content",onClick:o[1]||(o[1]=Oe(()=>{},["stop"]))},[g("button",{class:"image-modal-close",type:"button","aria-label":x(R)("Close image preview"),onClick:Kn},[N(ps,{class:"icon-svg"})],8,Tu),Ct.value?(u(),f("video",{key:0,class:"image-modal-image",src:Te.value,controls:"",autoplay:""},null,8,Lu)):(u(),f("img",{key:1,class:"image-modal-image",src:Te.value,alt:x(R)("Expanded message image")},null,8,Iu))])])):T("",!0),N(Bi,{visible:L.value,x:P.value,y:_.value,"browse-url":S.value,"edit-url":b.value,onClose:To},null,8,["visible","x","y","browse-url","edit-url"]),N(hi,{change:En.value,changes:Pn.value,lines:ko.value,"is-mobile":x(E),"is-file-list-open":y.value,cwd:C.cwd,onClose:Os,onSelectChange:Ws,onToggleFileList:Hs,onCloseFileList:Ds},null,8,["change","changes","lines","is-mobile","is-file-list-open","cwd"])],32),N(Ia,{visible:ue.value!==null,title:js.value,message:qs.value,"confirm-label":"Confirm",danger:"",onConfirm:Co,onCancel:o[2]||(o[2]=d=>ue.value=null)},null,8,["visible","title","message"])],64))}}),Hu=G(Bu,[["__scopeId","data-v-f02bcb72"]]);export{Hu as default};
|
|
39
|
+
${p}`:p}return o}),_n=L(()=>{const t=new Map;for(const d of x.messages){if(!kt(d)||typeof d.turnIndex!="number")continue;const v=`turn:${d.turnIndex}`,$=t.get(v);if($){$.anchorMessageId=d.id,$.turnIndex=d.turnIndex;continue}t.set(v,{anchorMessageId:d.id,turnIndex:d.turnIndex})}const o={};for(const d of t.values())o[d.anchorMessageId]=d.turnIndex;return o});function uo(t){return typeof Tn.value[t.id]=="string"}function fo(t){return t.role==="user"&&St(t).length>0}async function ho(t){const o=x.messages.find($=>$.id===t);if(!o)return;const d=St(o);if(!d)return;let v=!1;try{await qt(d),v=!0}catch{v=!1}v||(v=Jn(d)),v&&(we.value=t,ne&&clearTimeout(ne),ne=setTimeout(()=>{we.value===t&&(we.value=""),ne=null},1800))}function mo(t){return typeof _n.value[t.id]=="number"}const ze=L(()=>{var p,M;const t=new Map,o=new Map,d=new Map,v=P=>!Xe(P)&&!pt(P)&&!gt(P)&&!wt.value.has(P.id)&&!Cn(P);for(const P of x.messages){const W=typeof P.turnIndex=="number"?`turn:${P.turnIndex}`:`message:${P.id}`;if(v(P)&&t.set(W,P.id),kt(P)&&typeof P.turnIndex=="number"&&Array.isArray(P.fileChanges)&&P.fileChanges.length>0&&o.set(P.id,{changes:Dt(P.fileChanges),sourceMessageIds:[],source:"assistant",turnId:P.turnId??""}),!Xe(P))continue;const z=d.get(W);z?z.push(P):d.set(W,[P])}const $={};for(const[P,W]of d.entries()){const z=t.get(P);if(!z)continue;const w=((p=o.get(z))==null?void 0:p.turnId)??"";$[z]={changes:Dt(W.flatMap(O=>O.fileChanges??[])),sourceMessageIds:W.map(O=>O.id),source:"metadata",turnId:((M=W.find(O=>typeof O.turnId=="string"&&O.turnId.length>0))==null?void 0:M.turnId)??w}}for(const[P,W]of o.entries())$[P]||($[P]=W);return $}),At=L(()=>{var v;const t=new Map,o=new Set;for(const $ of Object.values(ze.value))for(const p of $.sourceMessageIds)o.add(p);for(const $ of x.messages){if(!Xe($))continue;const p=typeof $.turnIndex=="number"?`turn:${$.turnIndex}`:`message:${$.id}`,M=t.get(p);M?M.push($):t.set(p,[$])}const d={};for(const[$,p]of t.entries()){if(p.some(P=>o.has(P.id)))continue;const M=p[p.length-1];M&&(d[M.id]={changes:Dt(p.flatMap(P=>P.fileChanges??[])),sourceMessageIds:p.map(P=>P.id),source:"metadata",turnId:M.turnId??((v=p.find(P=>typeof P.turnId=="string"&&P.turnId.length>0))==null?void 0:v.turnId)??""})}return d}),In=L(()=>{const t=new Set;for(const o of Object.values(ze.value))for(const d of o.sourceMessageIds)t.add(d);for(const[o,d]of Object.entries(At.value))for(const v of d.sourceMessageIds)v!==o&&t.add(v);return t});function se(t){return ze.value[t]??null}function go(t){return r.value.has(t)}function po(t){const o=x.messages.find(d=>d.id===t);o&&hn(o)}function re(t){return At.value[t.id]??null}function Ln(t){if(!t)return!1;const o=x.liveTurnId??"";return o?(t.turnId??"")!==o:!0}function Pe(t){return t!=null&&t.turnId&&x.activeThreadId?`thread:${x.activeThreadId}:turn:${t.turnId}`:""}function Mn(t){return Pe(t).length>0}function Ue(t){const o=Pe(t);return o?Z.value[o]??"idle":"idle"}function Sn(t){const o=Pe(t);return o?oe.value[o]??"":""}function Pt(t){const o=Ue(t);return o==="undone"||o==="redoing"?"redo":"undo"}function An(t){const o=Ue(t);return o==="undoing"?R("Undoing"):o==="redoing"?R("Redoing"):Pt(t)==="redo"?R("Redo"):R("Undo")}async function vo(t,o,d){const v=Pe(t);if(!t||!v||!x.activeThreadId||!x.cwd)return;const $=Ue(t),p=o==="undo"?"undoing":"redoing";Z.value={...Z.value,[v]:p},oe.value={...oe.value,[v]:""};let M;try{const P=ae.value[v]??[];M=await Ko(x.activeThreadId,t.turnId,x.cwd,o,P.length>0?P:void 0,"single_turn",d)}catch(P){Z.value={...Z.value,[v]:$},oe.value={...oe.value,[v]:P instanceof Error?P.message:R("Failed to update file changes.")};return}if(M.errors.length>0){o==="undo"?(ae.value={...ae.value,[v]:M.revertedPatchIds??[]},Z.value={...Z.value,[v]:"undone"}):((M.appliedPatchIds??[]).length>0&&(ae.value={...ae.value,[v]:M.appliedPatchIds??[]}),Z.value={...Z.value,[v]:"undone"}),oe.value={...oe.value,[v]:M.errors.join("; ")};return}if((M.changed??0)<=0){Z.value={...Z.value,[v]:$},oe.value={...oe.value,[v]:M.message||R(o==="undo"?"No file changes to undo.":"No file changes to redo.")};return}o==="undo"?(ae.value={...ae.value,[v]:M.revertedPatchIds??[]},Z.value={...Z.value,[v]:"undone"}):(ae.value={...ae.value,[v]:M.appliedPatchIds??[]},Z.value={...Z.value,[v]:"redone"}),$t("fileChangesChanged",x.activeThreadId)}const Pn=L(()=>{var t;return((t=h.value)==null?void 0:t.changes)??[]}),En=L(()=>{const t=Pn.value;return t.length===0?null:t.find(o=>Y(o)===m.value)??t[0]}),ko=L(()=>wa(En.value));async function yo(t){const o=Tn.value[t]??"";if(!o)return;let d=!1;try{await qt(o),d=!0}catch{d=!1}d||(d=Jn(o)),d&&(we.value=t,ne&&clearTimeout(ne),ne=setTimeout(()=>{we.value===t&&(we.value=""),ne=null},1800))}function wo(t){const o=_n.value[t];typeof o=="number"&&x.activeThreadId&&$t("forkThread",{threadId:x.activeThreadId,turnIndex:o})}const Et=L(()=>{const t={};for(const o of x.messages){if(o.role!=="user"||typeof o.turnIndex!="number")continue;const d=typeof o.turnId=="string"&&o.turnId.length>0?o.turnId:"";!d||o.text.trim().length===0||(t[o.id]=d)}return t});function bo(t){return typeof Et.value[t.id]=="string"}function $o(t){Et.value[t]&&(ue.value={kind:"edit-message",messageId:t})}function Fn(t,o){Pe(t)&&(ue.value={kind:"file-change",summary:t,action:o})}function Bn(t,o){!t||!Pe(t)||!o.path||(ue.value={kind:"file-change",summary:t,action:"undo",filePaths:[o.path],filePathLabel:a(o.path)})}function Co(){const t=ue.value;if(ue.value=null,!!t){if(t.kind==="edit-message"){const o=Et.value[t.messageId];o&&$t("rollback",{turnId:o});return}vo(t.summary,t.action,t.filePaths)}}function $e(t){const o=qe.get(t);return o?(qe.delete(t),qe.set(t,o),o):tt(qe,t,ea(t),Au)}function de(t){const o=t.trim();if(!o)return"#";const d=M=>M.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(M),v=Ge(o),$=(v==null?void 0:v.path)??o,p=ws($,x.cwd);if(d(p)){const M=p.startsWith("/")?p:`/${p}`;return`/codex-local-browse${encodeURI(M)}`}return"#"}function xo(t){const o=t.trim();if(!o)return"";try{const d=new URL(o,window.location.href);return d.pathname.startsWith("/codex-local-browse")?`${`/codex-local-edit${d.pathname.slice(19)}`}${d.search}${d.hash}`:""}catch{return""}}function To(t){const o=t.target;if(!(o instanceof Element))return;const d=o.closest("a.message-file-link");if(!(d instanceof HTMLAnchorElement))return;const v=(d.getAttribute("href")??"").trim();!v||v==="#"||(t.preventDefault(),t.stopPropagation(),A.value=v,b.value=xo(v),S.value=t.clientX,C.value=t.clientY,I.value=!0)}function _o(){I.value&&(I.value=!1)}function Io(t){const o=je.get(t.id);if(o&&o.text===t.text&&o.cwd===x.cwd)return je.delete(t.id),je.set(t.id,o),o.blocks;const d=as(t.text);return tt(je,t.id,{text:t.text,cwd:x.cwd,blocks:d},Su).blocks}function V(t){return t.replace(/&/gu,"&").replace(/</gu,"<").replace(/>/gu,">").replace(/"/gu,""").replace(/'/gu,"'")}function Rn(t){var d;const o=((d=t.trim().split(/\s+/u)[0])==null?void 0:d.toLowerCase())??"";return o?Is[o]??o:""}function Lo(t,o){const d=Rn(t);if(!d)return V(o);const v=Qe.value;if(!v)return V(o);try{if(v.getLanguage(d))return v.highlight(o,{language:d,ignoreIllegals:!0}).value}catch{}return V(o)}function On(t,o){return Ot(Mo(t,o))}function Mo(t,o){const d=`${Ie.value}\0${Rn(t)}\0${t}\0${o}`,v=Me.get(d);return v!==void 0?(Me.delete(d),Me.set(d,v),v):tt(Me,d,Lo(t,o),Eu)}function Ce(t){return $e(t).map(o=>o.kind==="text"?V(o.value):o.kind==="bold"?`<strong class="message-bold-text">${V(o.value)}</strong>`:o.kind==="italic"?`<em class="message-italic-text">${V(o.value)}</em>`:o.kind==="strikethrough"?`<s class="message-strikethrough-text">${V(o.value)}</s>`:o.kind==="file"?`<a class="message-file-link" href="${V(de(o.path))}" target="_blank" rel="noopener noreferrer" title="${V(o.path)}">${V(o.displayPath)}</a>`:o.kind==="url"?`<a class="message-file-link" href="${V(o.href)}" target="_blank" rel="noopener noreferrer" title="${V(o.href)}">${V(o.value)}</a>`:`<code class="message-inline-code">${V(o.value)}</code>`).join("")}function So(t){return t.paragraphs.map(o=>`<div class="message-list-item-text message-list-item-paragraph">${Ce(o)}</div>`).join("")}function nt(t){var v;const o=So(t),d=((v=t.children)==null?void 0:v.map($=>Dn($)).join(""))??"";return Ot(o+d)}function Hn(t){return t?` style="text-align:${t}"`:""}function Dn(t){if(t.kind==="paragraph")return`<p class="message-text">${Ce(t.value)}</p>`;if(t.kind==="heading"){const o=Math.min(6,Math.max(1,Math.trunc(t.level))),d=Yn(o),v=`message-heading ${Qn(o)}`;return`<${d} class="${v}">${Ce(t.value)}</${d}>`}if(t.kind==="blockquote")return`<blockquote class="message-blockquote">${Ce(t.value)}</blockquote>`;if(t.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${t.items.map(d=>`<li class="message-list-item"><div class="message-list-item-content">${nt(d)}</div></li>`).join("")}</ul>`;if(t.kind==="taskList")return`<ul class="message-list message-task-list">${t.items.map(d=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${d.checked?"true":"false"}">${d.checked?"☑":"☐"}</span><div class="message-list-item-text">${Ce(d.text)}</div></li>`).join("")}</ul>`;if(t.kind==="orderedList"){const o=t.items.map(d=>`<li class="message-list-item"><div class="message-list-item-content">${nt(d)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${t.start}">${o}</ol>`}if(t.kind==="table"){const o=t.headers.map(($,p)=>`<th class="message-table-head-cell"${Hn(t.alignments[p]??null)}>${Ce($)}</th>`).join(""),d=t.rows.map($=>'<tr class="message-table-body-row">'+$.map((p,M)=>`<td class="message-table-cell"${Hn(t.alignments[M]??null)}>${Ce(p)}</td>`).join("")+"</tr>").join(""),v=d?`<tbody>${d}</tbody>`:"";return`<div class="message-table-wrap"><table class="message-table"><thead><tr>${o}</tr></thead>${v}</table></div>`}return t.kind==="codeBlock"?`<div class="message-code-block">${t.language?`<div class="message-code-language">${V(t.language)}</div>`:""}<pre class="message-code-pre"><code class="hljs">${On(t.language,t.value)}</code></pre></div>`:t.kind==="thematicBreak"?'<hr class="message-divider">':it(t.url)?`<video class="message-image-preview message-video-preview message-markdown-image" src="${V(t.url)}" controls preload="metadata"></video>`:`<img class="message-image-preview message-markdown-image" src="${V(t.url)}" alt="${V(t.alt||"Embedded message image")}" loading="lazy">`}function Wn(t){const o=`${x.cwd}\0${Ie.value}\0${t}`,d=Le.get(o);if(d&&d.text===t&&d.cwd===x.cwd&&d.highlightVersion===Ie.value)return Le.delete(o),Le.set(o,d),d.html;const v=as(t).map(p=>Dn(p)).join(""),$=Ot(v);return tt(Le,o,{text:t,cwd:x.cwd,highlightVersion:Ie.value,html:$},Pu).html}function Ao(){const t=me.value,o=gn.value;!t||!o||(t.scrollTop=t.scrollHeight,o.scrollIntoView({block:"end"}))}function Po(t){return t.scrollHeight-(t.scrollTop+t.clientHeight)<=Mu}function Eo(){if(me.value&&ge.value){st();return}}function st(){me.value&&Ao()}function Ft(){return ge.value}function jn(){if(!Ft()){Ye=0,ie=0;return}if(st(),Ye-=1,Ye<=0){ie=0;return}ie=requestAnimationFrame(jn)}function ot(t=6){Ft()&&(ie&&(cancelAnimationFrame(ie),ie=0),Ye=Math.max(t,1),ie=requestAnimationFrame(jn))}function qn(){ot(3)}function Nn(){ge.value=!0,st(),ot(4)}async function zn(){var $;const t=me.value;if(!t||!x.hasMorePersistedAbove||ve.value||x.isLoadingPersistedAbove===!0)return;ve.value=!0;const o=x.activeThreadId,d=t.scrollHeight,v=t.scrollTop;try{await(($=x.loadEarlierMessages)==null?void 0:$.call(x,o)),await rt(),x.activeThreadId===o&&(t.scrollTop=v+(t.scrollHeight-d))}finally{ve.value=!1}}n({jumpToLatest:Nn});function Fo(){if(!Ft())return;const t=me.value;if(!t)return;const o=t.querySelectorAll("img.message-image-preview");for(const d of o)d.complete||pn.has(d)||(pn.add(d),d.addEventListener("load",qn,{once:!0}),d.addEventListener("error",qn,{once:!0}))}async function at(){return We||(We=rt().then(()=>new Promise(t=>{be&&cancelAnimationFrame(be),be=requestAnimationFrame(()=>{be=0,We=null,Eo(),Fo(),ot(),t()})})),We)}function Bo(){je.clear(),qe.clear(),Le.clear(),Me.clear()}ce(()=>x.messages,async t=>{if(x.isLoading)return;const o=new Set(t.filter(d=>d.messageType==="commandExecution"&&d.commandExecution).map(d=>d.id));c.value=bt(c.value,o),l.value=bt(l.value,o),r.value=bt(r.value,new Set([...Object.keys(ze.value),...Object.keys(At.value)])),await at()}),ce(()=>x.messages.some(t=>t.text.includes("```")),t=>{!t||Qe.value||lo()},{immediate:!0}),ce(yt,(t,o)=>{if(!o||o===t||!l.value.has(o))return;const d=new Set(l.value);d.delete(o),l.value=d}),ce(()=>x.pendingRequests,async()=>{x.isLoading||await at()},{deep:!0}),ce(()=>x.liveOverlay,async t=>{t&&ge.value&&(await rt(),st(),ot(8))},{deep:!0}),ce(()=>x.isLoading,async t=>{t||await at()}),ce(()=>x.activeThreadId,async()=>{ge.value=!0,_e.value="",ve.value=!1,Z.value={},oe.value={},ae.value={},pe.value=Xt(x.activeThreadId),await at()},{flush:"post"});function Ro(){const t=me.value;!t||x.isLoading||(ge.value=Po(t),t.scrollTop<Fu&&!ve.value&&(wn.value?bn():x.hasMorePersistedAbove===!0&&zn()))}const Bt=H(new Set);function Un(t,o){return`${t}:${o}`}function Oo(t,o){return Bt.value.has(Un(t,o))}function Ho(t,o){const d=new Set(Bt.value);d.add(Un(t,o)),Bt.value=d,vn.value+=1}function Vn(t){_e.value=t,Ct.value=it(t)}function Kn(){_e.value="",Ct.value=!1}const Rt=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function it(t){const o=t.trim();if(!o)return!1;if(o.startsWith("data:video/"))return!0;try{const d=new URL(o,window.location.href);return Rt.test(d.pathname)?!0:d.pathname==="/codex-local-image"?Rt.test(d.searchParams.get("path")??""):!1}catch{return Rt.test(o)}}return Yt(()=>{Bo(),be&&(cancelAnimationFrame(be),be=0),ie&&(cancelAnimationFrame(ie),ie=0),ne&&(clearTimeout(ne),ne=null)}),(t,o)=>(u(),f(F,null,[g("section",{class:"conversation-root",onContextmenuCapture:To},[e.isLoading?(u(),f("p",ac,k(T(R)("Loading messages...")),1)):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(u(),f("p",ic,k(T(R)("No messages in this thread yet.")),1)):(u(),f("ul",{key:2,ref_key:"conversationListRef",ref:me,class:"conversation-list",onScroll:Ro},[io.value?(u(),f("li",rc,[g("button",{type:"button",class:"load-more-button",disabled:ve.value||e.isLoadingPersistedAbove,onClick:zn},k(ve.value||e.isLoadingPersistedAbove?T(R)("Loading…"):T(R)("Load earlier messages")),9,lc)])):_("",!0),wn.value?(u(),f("li",cc,[g("button",{type:"button",class:"load-more-button",disabled:ve.value,onClick:bn},k(T(R)("Load earlier ({n} turns)",{n:yn.value})),9,uc)])):_("",!0),(u(!0),f(F,null,D(Ns.value,d=>(u(),K(xl,{key:d.key,"turn-key":d.key,warm:d.warm,"warm-items":d.warmItems,request:d.request,"process-items":d.processItems,"final-item":d.finalItem,"file-change-anchor-ids":d.fileChangeAnchorIds},{"warm-card":Fe(({warm:v})=>[g("li",{id:Lt(v.turn),class:"conversation-item conversation-item-warm-card","data-role":"system","data-message-type":"warmTurn"},[g("div",fc,[g("div",hc,[N(Al,{"user-text":v.userText,"assistant-preview":v.assistantPreview,"tool-count":v.toolCount,expanded:v.expanded,onToggle:$=>zs(v.turn)},null,8,["user-text","assistant-preview","tool-count","expanded","onToggle"])])])],8,dc)]),"file-change":Fe(({anchorMessageId:v})=>[g("div",mc,[g("div",gc,[Ln(se(v))?(u(),K(is,{key:0,summary:se(v),expanded:go(v),cwd:x.cwd,actionable:Mn(se(v)),"action-status":Ue(se(v)),"action-error-text":Sn(se(v)),"next-action":Pt(se(v)),"action-label":An(se(v)),onToggle:$=>po(v),onOpenDiff:$=>mn(se(v),$),onRequestAction:$=>Fn(se(v),$),onRequestFileAction:$=>Bn(se(v),$)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):_("",!0)])])]),default:Fe(({item:v,section:$})=>[(u(!0),f(F,null,D([v.message],p=>{var M,P,W,z;return u(),f(F,{key:p.id},[Ys(p)?(u(),f("li",pc,[g("div",vc,[g("div",kc,[N(Lr,{label:no(p),running:so(p),"has-outside-content":oo(p)},{default:Fe(()=>[(u(!0),f(F,null,D(eo(p),w=>(u(),f(F,{key:to(w)},[w.type==="batch"?(u(),K(fl,{key:0,kind:w.kind,messages:w.messages},null,8,["kind","messages"])):(u(!0),f(F,{key:1},D([w.message],O=>(u(),f(F,{key:O.id},[!wt.value.has(O.id)&&!In.value.has(O.id)?(u(),f(F,{key:0},[Q(O)?(u(),f("div",yc,[(u(!0),f(F,null,D(fn(O),(q,j)=>(u(),K(cs,{key:`work-cmd-${q.id}`,command:q,"step-index":j,expanded:ln(q),compact:cn(q),"output-condensed":un(q),onToggle:Gn=>dn(q)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])):nn(O)?(u(),K(Jt,{key:1,message:O},null,8,["message"])):pt(O)?(u(),K(ls,{key:2,message:O,expanded:en(O),"content-html":Wn(O.text),onToggle:q=>tn(O)},null,8,["message","expanded","content-html","onToggle"])):_("",!0)],64)):_("",!0)],64))),128))],64))),128))]),_:2},1032,["label","running","has-outside-content"])])])])):!Cn(p)&&!wt.value.has(p.id)&&!In.value.has(p.id)&&!(ao(p)&&Xs.value.has(p.turnId??""))?(u(),f("li",{key:1,id:Ks(p),class:U(["conversation-item",{"conversation-item-request":$==="request","conversation-item-process":$==="process"||v.presentation==="process","conversation-item-final":$==="final"||v.presentation==="final-assistant","conversation-item-plan":v.presentation==="plan"}]),"data-role":p.role,"data-message-type":p.messageType||""},[Ps(p)?(u(),f("div",bc,[g("div",$c,[o[3]||(o[3]=g("span",{class:"thread-compaction-spinner","aria-hidden":"true"},null,-1)),g("span",null,k(T(R)("Compacting thread context…")),1)])])):Es(p)?(u(),f("div",Cc,[g("div",xc,k(T(R)("Context compacted")),1)])):Q(p)?(u(),f("div",Tc,[g("div",_c,[g("div",Ic,[(u(!0),f(F,null,D(fn(p),(w,O)=>(u(),K(cs,{key:`work-cmd-${w.id}`,command:w,"step-index":O,expanded:ln(w),compact:cn(w),"output-condensed":un(w),onToggle:q=>dn(w)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])])])):nn(p)?(u(),K(Jt,{key:3,message:p},null,8,["message"])):Xe(p)?(u(),f("div",{key:4,class:"message-row","data-role":p.role,"data-message-type":p.messageType||""},[g("div",{class:"message-stack","data-role":p.role},[g("article",{class:"message-body","data-role":p.role},[Ln(re(p))?(u(),K(is,{key:0,summary:re(p),expanded:Rs(p),cwd:x.cwd,actionable:Mn(re(p)),"action-status":Ue(re(p)),"action-error-text":Sn(re(p)),"next-action":Pt(re(p)),"action-label":An(re(p)),onToggle:w=>hn(p),onOpenDiff:w=>mn(re(p),w),onRequestAction:w=>Fn(re(p),w),onRequestFileAction:w=>Bn(re(p),w)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):_("",!0)],8,Sc)],8,Mc)],8,Lc)):v.presentation==="plan"?(u(),f("div",Ac,[g("div",Pc,[g("article",Ec,[g("div",Fc,k(T(R)("Plan")),1),(M=T(Ve)(p))!=null&&M.explanation?(u(),f("p",Bc,k((P=T(Ve)(p))==null?void 0:P.explanation),1)):_("",!0),(W=T(Ve)(p))!=null&&W.steps.length?(u(),f("ol",Rc,[(u(!0),f(F,null,D((z=T(Ve)(p))==null?void 0:z.steps,(w,O)=>(u(),f("li",{key:`${p.id}-plan-${O}`,"data-status":w.status},[g("span",Hc,k(xn(w.status)),1),g("span",null,k(w.step),1)],8,Oc))),128))])):_("",!0)])])])):(u(),f("div",{key:6,class:U(["message-row",{"message-row-final":v.presentation==="final-assistant"}]),"data-role":p.role,"data-message-type":p.messageType||""},[g("div",{class:"message-stack","data-role":p.role},[g("article",{class:"message-body","data-role":p.role},[p.images&&p.images.length>0?(u(),f("ul",{key:0,class:U(["message-image-list",{"message-generated-image-list":p.messageType==="imageView"}]),"data-role":p.role},[(u(!0),f(F,null,D(p.images,w=>(u(),f("li",{key:w,class:"message-image-item"},[g("button",{class:"message-image-button",type:"button",onClick:O=>Vn(w)},[it(w)?(u(),f("video",{key:0,class:U(["message-image-preview message-video-preview",{"message-generated-image-preview":p.messageType==="imageView"}]),src:w,controls:"",preload:"metadata"},null,10,zc)):(u(),f("img",{key:1,class:U(["message-image-preview",{"message-generated-image-preview":p.messageType==="imageView"}]),src:w,alt:p.messageType==="imageView"?"Generated image":"Message image preview",loading:"lazy"},null,10,Uc))],8,Nc)]))),128))],10,qc)):_("",!0),p.fileAttachments&&p.fileAttachments.length>0?(u(),f("div",Vc,[(u(!0),f(F,null,D(p.fileAttachments,w=>(u(),f("span",{key:`${p.id}:${w.path}`,class:"message-file-chip"},[o[4]||(o[4]=g("span",{class:"message-file-chip-icon"},"📄",-1)),g("a",{class:"message-file-link message-file-chip-name",href:de(w.path),target:"_blank",rel:"noopener noreferrer",title:w.path},k(w.label),9,Kc)]))),128))])):_("",!0),p.skills&&p.skills.length>0?(u(),f("div",Gc,[(u(!0),f(F,null,D(p.skills,w=>(u(),f("a",{key:`${p.id}:${w.path}`,class:"message-skill-chip",href:de(w.path),title:w.path},[g("span",Jc,k(T(R)("Skill")),1),g("span",Xc,k(w.name),1)],8,Zc))),128))])):_("",!0),p.text.length>0?(u(),f("article",{key:3,class:"message-card","data-role":p.role},[p.isAutomationRun?(u(),f("div",Qc,[o[5]||(o[5]=g("span",null,"Sent via automation",-1)),p.automationDisplayName?(u(),f("code",eu,k(p.automationDisplayName),1)):_("",!0)])):_("",!0),p.messageType==="worked"?(u(),f("div",tu,[g("p",nu,k(p.text),1)])):pt(p)?(u(),K(ls,{key:2,message:p,expanded:en(p),"content-html":Wn(p.text),onToggle:w=>tn(p)},null,8,["message","expanded","content-html","onToggle"])):No([p.id,p.text,x.cwd,Ie.value,vn.value],()=>(u(),f("div",{key:3,class:"message-text-flow"},[(u(!0),f(F,null,D(Io(p),(w,O)=>(u(),f(F,{key:`block-${O}`},[w.kind==="paragraph"?(u(),f("p",su,[N(Ee,{segments:$e(w.value),"to-browse-url":de},null,8,["segments"])])):w.kind==="heading"?(u(),K(zo(T(Yn)(w.level)),{key:1,class:U(["message-heading",T(Qn)(w.level)])},{default:Fe(()=>[N(Ee,{segments:$e(w.value),"to-browse-url":de},null,8,["segments"])]),_:2},1032,["class"])):w.kind==="blockquote"?(u(),f("blockquote",ou,[N(Ee,{segments:$e(w.value),"to-browse-url":de},null,8,["segments"])])):w.kind==="unorderedList"?(u(),f("ul",au,[(u(!0),f(F,null,D(w.items,(q,j)=>(u(),f("li",{key:`ul-${O}-${j}`,class:"message-list-item"},[g("div",{class:"message-list-item-content",innerHTML:nt(q)},null,8,iu)]))),128))])):w.kind==="taskList"?(u(),f("ul",ru,[(u(!0),f(F,null,D(w.items,(q,j)=>(u(),f("li",{key:`task-${O}-${j}`,class:"message-task-item"},[g("span",{class:"message-task-checkbox","data-checked":q.checked},k(q.checked?"☑":"☐"),9,lu),g("div",cu,[N(Ee,{segments:$e(q.text),"to-browse-url":de},null,8,["segments"])])]))),128))])):w.kind==="orderedList"?(u(),f("ol",{key:5,class:"message-list message-list-ordered",start:w.start},[(u(!0),f(F,null,D(w.items,(q,j)=>(u(),f("li",{key:`ol-${O}-${j}`,class:"message-list-item"},[g("div",{class:"message-list-item-content",innerHTML:nt(q)},null,8,du)]))),128))],8,uu)):w.kind==="table"?(u(),f("div",fu,[g("table",hu,[g("thead",null,[g("tr",null,[(u(!0),f(F,null,D(w.headers,(q,j)=>(u(),f("th",{key:`th-${O}-${j}`,class:"message-table-head-cell",style:Ke({textAlign:w.alignments[j]??"left"})},[N(Ee,{segments:$e(q),"to-browse-url":de},null,8,["segments"])],4))),128))])]),w.rows.length>0?(u(),f("tbody",mu,[(u(!0),f(F,null,D(w.rows,(q,j)=>(u(),f("tr",{key:`tr-${O}-${j}`,class:"message-table-body-row"},[(u(!0),f(F,null,D(q,(Gn,Zn)=>(u(),f("td",{key:`td-${O}-${j}-${Zn}`,class:"message-table-cell",style:Ke({textAlign:w.alignments[Zn]??"left"})},[N(Ee,{segments:$e(Gn),"to-browse-url":de},null,8,["segments"])],4))),128))]))),128))])):_("",!0)])])):w.kind==="codeBlock"?(u(),f("div",gu,[w.language?(u(),f("div",pu,k(w.language),1)):_("",!0),g("pre",vu,[g("code",{class:"hljs",innerHTML:On(w.language,w.value)},null,8,ku)])])):w.kind==="thematicBreak"?(u(),f("hr",yu)):Oo(p.id,O)?(u(),f("p",wu,k(w.markdown),1)):(u(),f("button",{key:10,class:"message-image-button",type:"button",onClick:q=>Vn(w.url)},[it(w.url)?(u(),f("video",{key:0,class:"message-image-preview message-video-preview message-markdown-image",src:w.url,controls:"",preload:"metadata"},null,8,$u)):(u(),f("img",{key:1,class:"message-image-preview message-markdown-image",src:w.url,alt:w.alt||"Embedded message image",loading:"lazy",onError:q=>Ho(p.id,O)},null,40,Cu))],8,bu))],64))),128))])),o,0),Fs(p)?(u(),f("a",{key:4,class:"turn-error-feedback",href:T(ye),onClick:w=>Te(w,p.text)},k(T(R)("Send feedback")),9,xu)):_("",!0)],8,Yc)):_("",!0),$!=="process"?(u(),K(wr,{key:4,role:p.role,"show-edit":bo(p),"show-fork":mo(p),"show-copy":uo(p)||fo(p),copied:we.value===p.id,onEdit:w=>$o(p.id),onFork:w=>wo(p.id),onCopy:w=>p.role==="user"?ho(p.id):yo(p.id)},null,8,["role","show-edit","show-fork","show-copy","copied","onEdit","onFork","onCopy"])):_("",!0)],8,jc)],8,Wc)],10,Dc))],10,wc)):_("",!0)],64)}),128))]),_:2},1032,["turn-key","warm","warm-items","request","process-items","final-item","file-change-anchor-ids"]))),128)),e.liveOverlay?(u(),K(Qi,{key:2,overlay:e.liveOverlay,"feedback-mailto":T(ye)},null,8,["overlay","feedback-mailto"])):_("",!0),g("li",{ref_key:"bottomAnchorRef",ref:gn,class:"conversation-bottom-anchor"},null,512)],544)),N(Fr,{anchors:$n.value,"active-turn":Us.value,onJump:Gs},null,8,["anchors","active-turn"]),ro.value?(u(),f("button",{key:3,type:"button",class:"jump-to-latest-button",title:T(R)("Jump to latest"),"aria-label":T(R)("Jump to latest output"),onClick:Nn},[N(Uo,{class:"icon-svg jump-to-latest-icon"})],8,Tu)):_("",!0),_e.value.length>0?(u(),f("div",{key:4,class:"image-modal-backdrop",onClick:Kn},[g("div",{class:"image-modal-content",onClick:o[1]||(o[1]=Oe(()=>{},["stop"]))},[g("button",{class:"image-modal-close",type:"button","aria-label":T(R)("Close image preview"),onClick:Kn},[N(ps,{class:"icon-svg"})],8,_u),Ct.value?(u(),f("video",{key:0,class:"image-modal-image",src:_e.value,controls:"",autoplay:""},null,8,Iu)):(u(),f("img",{key:1,class:"image-modal-image",src:_e.value,alt:T(R)("Expanded message image")},null,8,Lu))])])):_("",!0),N(Bi,{visible:I.value,x:S.value,y:C.value,"browse-url":A.value,"edit-url":b.value,onClose:_o},null,8,["visible","x","y","browse-url","edit-url"]),N(hi,{change:En.value,changes:Pn.value,lines:ko.value,"is-mobile":T(E),"is-file-list-open":y.value,cwd:x.cwd,onClose:Os,onSelectChange:Ws,onToggleFileList:Hs,onCloseFileList:Ds},null,8,["change","changes","lines","is-mobile","is-file-list-open","cwd"])],32),N(La,{visible:ue.value!==null,title:js.value,message:qs.value,"confirm-label":"Confirm",danger:"",onConfirm:Co,onCancel:o[2]||(o[2]=d=>ue.value=null)},null,8,["visible","title","message"])],64))}}),Hu=G(Bu,[["__scopeId","data-v-01698720"]]);export{Hu as default};
|