@muyichengshayu/promptx 0.1.0

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.
@@ -0,0 +1,6 @@
1
+ import{w as oe,o as Pe,a as r,c as re,b as c,d as e,e as x,u as w,t as g,G as Fe,I as Be,n as _,F as de,m as ye,f as L,l as Ne,g as ke,T as Re,p as S,q as M,A as Me,v as ze}from"./index-D9ui_gwj.js";import{c as Ee,f as ie,X as De,S as $e,L as Se,i as Ae,d as je,s as He,j as Ce,P as Ue,b as Oe,k as Ve,B as qe,m as We,e as _e,T as Ke,A as Xe}from"./WorkbenchView-Cp_qHNdX.js";/**
2
+ * @license lucide-vue-next v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Ge=Ee("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),Qe={class:"panel flex h-full w-full max-w-4xl flex-col overflow-hidden sm:h-auto sm:max-h-[86vh]"},Je={class:"theme-divider flex items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},Ye={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Ze=["disabled"],et={class:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5"},tt={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},st={class:"flex items-start gap-2 text-xs leading-5"},nt={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},at={class:"theme-muted-text mt-4 block text-xs"},lt={class:"mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2",style:{borderColor:"var(--theme-inputBorder)",background:"var(--theme-inputBg)",color:"var(--theme-textPrimary)","--tw-ring-color":"var(--theme-focusRing)"}},it={class:"mt-4 flex items-center gap-1.5"},ot={class:"mt-3 min-h-0 flex-1 overflow-y-auto rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelStrong)] p-2"},rt={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},dt={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},ut={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},ct={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},mt={key:4,class:"theme-empty-state px-3 py-8 text-sm"},vt={key:5,class:"theme-empty-state px-3 py-8 text-sm"},ft={key:6,class:"theme-empty-state px-3 py-8 text-sm"},pt={key:7,class:"space-y-1"},ht=["onClick"],xt={class:"min-w-0 flex-1"},gt=["innerHTML"],yt=["innerHTML"],bt={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},wt={key:8,class:"space-y-1"},St={class:"flex items-start gap-1.5"},kt=["onClick"],$t=["onClick"],Ct={class:"min-w-0 flex-1"},_t={key:0,class:"theme-muted-text truncate font-mono text-[10px]"},Lt={class:"theme-divider flex flex-col-reverse gap-2 border-t border-dashed px-4 py-4 sm:flex-row sm:items-center sm:justify-end sm:px-5"},Tt={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},Pt=["disabled"],Rt=["disabled"],Mt={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""}},emits:["close","select"],setup(i,{emit:U}){const o=i,k=U,m=S(""),p=S(null),f=S(!1),v=S(""),$=S(!1),F=S(""),D=S([]),B=S(!1),T=S(""),y=S("tree"),I=S(""),z=S("");let P=null,b=0;const Q=M(()=>ee(p.value?[p.value]:[])),be=M(()=>y.value==="search"&&!T.value.trim()),J=M(()=>y.value==="search"&&!!T.value.trim()&&!$.value&&!F.value&&!D.value.length),C=M(()=>y.value==="tree"&&!f.value&&!v.value&&!Q.value.length);function Y(s=""){const l=String(s||"").trim();return/^[a-z]:[\\/]/i.test(l)||l.includes("\\")}function R(s=""){const l=String(s||"").trim();if(!l)return"";const n=Y(l);let d=l.replace(/\\/g,"/");return d.length>1&&!/^[a-z]:\/?$/i.test(d)&&d!=="/"&&(d=d.replace(/\/+$/,"")),n?d.toLowerCase():d}function Z(s="",l=""){const n=R(s),d=R(l);return!n||!d?!1:n===d||n.startsWith(`${d}/`)}function ue(s="",l=""){const n=String(s||"").trim(),d=String(l||"").trim();return n?d?Y(n)?/^[a-z]:\\?$/i.test(n)?`${n.replace(/[\\/]+$/,"")}\\${d}`:`${n.replace(/[\\/]+$/,"")}\\${d}`:n==="/"?`/${d}`:`${n.replace(/\/+$/,"")}/${d}`:n:d}function ce(s="",l=""){const n=R(s),d=R(l);if(!n||!d||!Z(d,n))return[];const N=d===n?"":d.slice(n.length).replace(/^\//,"");return N?N.split("/").filter(Boolean):[]}function se(s){return(s==null?void 0:s.name)||(s==null?void 0:s.path)||"未命名目录"}function me(s=""){const l=String(s||"").trim();return l?l.split(/[\\/]/).filter(Boolean).at(-1)||l:"Home"}function W(s=""){return String(s||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function j(s="",l=""){const n=String(s||""),d=String(l||"").trim().toLowerCase();if(!n||!d)return null;const N=n.toLowerCase(),t=N.indexOf(d);if(t>=0)return{start:t,end:t+d.length};const a=d.split(/[\\/\s_.-]+/).filter(Boolean).sort((h,u)=>u.length-h.length);for(const h of a){if(h.length<2)continue;const u=N.indexOf(h);if(u>=0)return{start:u,end:u+h.length}}return null}function O(s="",l=""){const n=String(s||""),d=j(n,l);return d?`${W(n.slice(0,d.start))}<mark class="rounded bg-[var(--theme-warningSoft)] px-0.5 text-inherit">${W(n.slice(d.start,d.end))}</mark>${W(n.slice(d.end))}`:W(n)}function ve(s){return O(se(s),T.value)}function ne(s){return O((s==null?void 0:s.path)||"",T.value)}function K(s,l=0){return{...s,depth:l,expanded:!1,loaded:!1,loading:!1,children:[]}}function ee(s=[],l=[]){return s.forEach(n=>{l.push(n),n.expanded&&n.children.length&&ee(n.children,l)}),l}function H(){p.value&&(p.value={...p.value})}function te(s,l=p.value?[p.value]:[]){const n=R(s);if(!n)return null;for(const d of l){if(R(d.path)===n)return d;if(d.children.length){const N=te(s,d.children);if(N)return N}}return null}function V(s){I.value=String((s==null?void 0:s.path)||"").trim(),z.value=se(s)}async function X(s,l={}){if(!(!s||s.loading)&&!(s.loaded&&!l.force)){s.loading=!0,v.value="",H();try{const n=await Ce({path:s.path,limit:240});s.children=(n.items||[]).map(d=>K(d,s.depth+1)),s.loaded=!0}catch(n){v.value=n.message||"目录加载失败。"}finally{s.loading=!1,H()}}}async function A(){f.value=!0,v.value="";try{const s=await Ce({limit:240});m.value=String(s.path||""),p.value=K({name:me(s.path||""),path:String(s.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),p.value.children=(s.items||[]).map(l=>K(l,1)),p.value.loaded=!0,p.value.expanded=!0,V(p.value)}catch(s){v.value=s.message||"目录树加载失败。",p.value=null,m.value=""}finally{f.value=!1}}async function ae(s=""){const l=String(s||"").trim();if(!l||!m.value||!Z(l,m.value))return;let n=p.value;if(!n)return;V(n);const d=ce(m.value,l);for(const N of d){await X(n),n.expanded=!0,H();const t=te(ue(n.path,N),n.children);if(!t)break;n=t,V(n)}}async function le(){T.value="",y.value="tree",D.value=[],F.value="",B.value=!1,I.value="",z.value="",await A();const s=String(o.initialPath||"").trim();s&&Z(s,m.value)&&await ae(s)}async function fe(s){if(s!=null&&s.path&&(V(s),!!s.hasChildren)){if(!s.loaded){s.expanded=!0,H(),await X(s);return}s.expanded=!s.expanded,H()}}function pe(s){s!=null&&s.path&&(V(s),y.value="tree")}async function we(){const s=String(T.value||"").trim();b+=1;const l=b;if(!o.open||!s||!m.value){$.value=!1,F.value="",D.value=[],B.value=!1;return}$.value=!0,F.value="";try{const n=await He(s,{path:m.value,limit:80});if(l!==b)return;D.value=Array.isArray(n.items)?n.items:[],B.value=!!n.truncated}catch(n){if(l!==b)return;F.value=n.message||"搜索失败。",D.value=[],B.value=!1}finally{l===b&&($.value=!1)}}function he(){if(P&&(window.clearTimeout(P),P=null),!String(T.value||"").trim()){$.value=!1,F.value="",D.value=[],B.value=!1;return}$.value=!0,F.value="",P=window.setTimeout(()=>{we()},120)}async function xe(s){s!=null&&s.path&&(y.value="tree",await ae(s.path))}function ge(){I.value&&(k("select",I.value),k("close"))}function G(s){o.open&&s.key==="Escape"&&k("close")}return oe(T,()=>{y.value=T.value.trim()?"search":"tree",he()}),oe(()=>o.open,s=>{if(document.body.classList.toggle("overflow-hidden",s),s){window.addEventListener("keydown",G),le().catch(()=>{});return}window.removeEventListener("keydown",G),P&&(window.clearTimeout(P),P=null)}),Pe(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",G),P&&window.clearTimeout(P)}),(s,l)=>(r(),re(Re,{to:"body"},[i.open?(r(),c("div",{key:0,class:"fixed inset-0 z-[60] flex items-end justify-center bg-black/45 px-0 py-0 backdrop-blur-sm sm:items-center sm:px-4 sm:py-6",onClick:l[5]||(l[5]=ke(n=>!(f.value||$.value)&&k("close"),["self"]))},[e("section",Qe,[e("div",Je,[e("div",null,[e("div",Ye,[x(w(ie),{class:"h-4 w-4"}),l[6]||(l[6]=e("span",null,"选择工作目录",-1))]),l[7]||(l[7]=e("p",{class:"theme-muted-text mt-1 text-xs leading-5"}," 默认只在当前用户目录下浏览和搜索;特殊路径继续用手动输入。 ",-1))]),e("button",{type:"button",class:"theme-icon-button h-9 w-9",disabled:f.value||$.value,onClick:l[0]||(l[0]=n=>k("close"))},[x(w(De),{class:"h-4 w-4"})],8,Ze)]),e("div",et,[e("div",tt,[e("div",st,[l[8]||(l[8]=e("span",{class:"theme-muted-text shrink-0"},"当前选中",-1)),e("span",nt,g(I.value||"请在目录树或搜索结果里选择目录"),1)])]),e("label",at,[l[9]||(l[9]=e("span",null,"搜索目录",-1)),e("div",lt,[x(w($e),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),Fe(e("input",{"onUpdate:modelValue":l[1]||(l[1]=n=>T.value=n),type:"text",placeholder:"输入目录名或路径片段,例如 promptx / code",class:"min-w-0 flex-1 border-0 bg-transparent px-0 text-sm text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]"},null,512),[[Be,T.value]])])]),e("div",it,[e("button",{type:"button",class:_(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",y.value==="search"?"tool-button-primary":"theme-filter-idle border-dashed"]),onClick:l[2]||(l[2]=n=>y.value="search")},[x(w($e),{class:"h-3.5 w-3.5"}),l[10]||(l[10]=e("span",null,"搜索",-1))],2),e("button",{type:"button",class:_(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",y.value==="tree"?"tool-button-primary":"theme-filter-idle border-dashed"]),onClick:l[3]||(l[3]=n=>y.value="tree")},[x(w(ie),{class:"h-3.5 w-3.5"}),l[11]||(l[11]=e("span",null,"目录树",-1))],2)]),e("div",ot,[y.value==="search"&&F.value?(r(),c("div",rt,g(F.value),1)):y.value==="tree"&&v.value?(r(),c("div",dt,g(v.value),1)):y.value==="search"&&$.value?(r(),c("div",ut,[x(w(Se),{class:"h-4 w-4 animate-spin"}),l[12]||(l[12]=e("span",null,"搜索中...",-1))])):y.value==="tree"&&f.value?(r(),c("div",ct,[x(w(Se),{class:"h-4 w-4 animate-spin"}),l[13]||(l[13]=e("span",null,"目录树加载中...",-1))])):be.value?(r(),c("div",mt," 输入关键词后,只会在当前用户目录下搜索。 ")):J.value?(r(),c("div",vt," 没搜到匹配目录,试试更短的关键词,或者直接用目录树浏览。 ")):C.value?(r(),c("div",ft," 当前没有可显示的目录。 ")):y.value==="search"?(r(),c("div",pt,[(r(!0),c(de,null,ye(D.value,n=>(r(),c("button",{key:n.path,type:"button",class:_(["flex w-full items-start gap-2 rounded-sm border border-transparent px-2.5 py-1.5 text-left transition",R(I.value)===R(n.path)?"bg-[var(--theme-appPanelInset)]":"hover:bg-[var(--theme-appPanelMuted)]"]),onClick:d=>xe(n)},[x(w(ie),{class:"theme-muted-text mt-0.5 h-4 w-4 shrink-0"}),e("div",xt,[e("div",null,[e("span",{class:"truncate text-[13px] text-[var(--theme-textPrimary)]",innerHTML:ve(n)},null,8,gt)]),e("div",{class:"theme-muted-text truncate font-mono text-[10px]",innerHTML:ne(n)},null,8,yt)])],10,ht))),128)),B.value?(r(),c("p",bt," 搜索结果已截断,只展示最相关的一部分目录。 ")):L("",!0)])):(r(),c("div",wt,[(r(!0),c(de,null,ye(Q.value,n=>(r(),c("div",{key:n.path,class:_(["rounded-sm border border-transparent px-1.5 py-1 transition",R(I.value)===R(n.path)?"bg-[var(--theme-appPanelInset)]":n.expanded?"bg-[var(--theme-appPanelMuted)]":"hover:bg-[var(--theme-appPanelMuted)]"]),style:Ne({paddingLeft:`${n.depth*16+6}px`})},[e("div",St,[e("button",{type:"button",class:_(["theme-icon-button h-5 w-5 shrink-0",n.hasChildren?"":"invisible pointer-events-none"]),onClick:ke(d=>fe(n),["stop"])},[n.loading?(r(),re(w(Se),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(r(),re(w(Ae),{key:1,class:_(["h-3.5 w-3.5 transition",n.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,kt),e("button",{type:"button",class:"flex min-w-0 flex-1 items-start gap-1.5 rounded-sm px-0.5 py-0.5 text-left",onClick:d=>pe(n)},[x(w(ie),{class:_(["h-4 w-4 shrink-0",R(I.value)===R(n.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),e("div",Ct,[e("div",{class:_(["truncate text-[13px]",n.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},g(se(n)),3),n.isHomeRoot?(r(),c("div",_t,g(n.path),1)):L("",!0)])],8,$t)])],6))),128))]))])]),e("div",Lt,[e("div",Tt,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:f.value||$.value,onClick:l[4]||(l[4]=n=>k("close"))}," 取消 ",8,Pt),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex w-full items-center justify-center gap-2 px-3 py-2 text-xs sm:w-auto",disabled:f.value||$.value||!I.value,onClick:ge},[x(w(je),{class:"h-4 w-4"}),l[14]||(l[14]=e("span",null,"使用当前目录",-1))],8,Rt)])])])])):L("",!0)]))}},Dt={class:"theme-muted-text block text-xs"},It=["value","disabled"],Ft={class:"theme-muted-text block text-xs"},Bt={class:"mt-1 flex gap-2"},Nt=["value","disabled"],zt=["disabled"],Et={id:"codex-manager-workspace-suggestions"},At=["value"],jt={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},Ht={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},Le={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},canEditCwd:{type:Boolean,default:!0},cwd:{type:String,default:""},cwdReadonlyMessage:{type:String,default:""},duplicateCwdMessage:{type:String,default:""},mobile:{type:Boolean,default:!1},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["open-directory-picker","update:cwd","update:title"],setup(i,{emit:U}){const o=U;return(k,m)=>(r(),c("div",{class:_(["grid gap-4",i.mobile?"":"sm:grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]"])},[e("label",Dt,[m[3]||(m[3]=e("span",null,"项目标题(可选)",-1)),e("input",{value:i.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:i.busy,onInput:m[0]||(m[0]=p=>o("update:title",p.target.value))},null,40,It)]),e("label",Ft,[m[4]||(m[4]=e("span",null,"工作目录",-1)),e("div",Bt,[e("input",{value:i.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:_(["tool-input min-w-0 flex-1 disabled:cursor-not-allowed disabled:opacity-80",i.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:i.busy||!i.canEditCwd,onInput:m[1]||(m[1]=p=>o("update:cwd",p.target.value))},null,42,Nt),e("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:i.busy||!i.canEditCwd,onClick:m[2]||(m[2]=p=>o("open-directory-picker"))},[x(w(ie),{class:"h-4 w-4"}),e("span",null,g(i.mobile?"选择":"选择目录"),1)],8,zt)]),e("datalist",Et,[(r(!0),c(de,null,ye(i.workspaceSuggestions,p=>(r(),c("option",{key:p,value:p},null,8,At))),128))]),i.duplicateCwdMessage?(r(),c("p",jt,g(i.duplicateCwdMessage),1)):i.cwdReadonlyMessage?(r(),c("p",Ht,g(i.cwdReadonlyMessage),1)):L("",!0)])],2))}},Ut={class:"flex items-center justify-between gap-3"},Ot={key:0,class:"theme-muted-text mt-1 text-xs"},Vt=["disabled"],qt=["onClick"],Wt={key:0,class:"absolute inset-y-3 left-0 w-1 rounded-full bg-[var(--theme-accent)]"},Kt={class:"w-full text-left"},Xt={class:"theme-heading flex flex-wrap items-center gap-2 text-sm font-medium"},Gt={class:"truncate"},Qt={key:0,class:"theme-status-info rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Jt={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},Yt={class:"theme-muted-text mt-2 break-all font-mono text-[11px] leading-5"},Zt={key:0,class:"theme-muted-text mt-2 text-[11px]"},Te={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:i=>i},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},hasSessions:{type:Boolean,default:!1},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1},mode:{type:String,default:"edit"},mobile:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]}},emits:["create","select"],setup(i,{emit:U}){const o=i,k=U;function m(p){return o.mode==="edit"&&o.editingSessionId===p.id?"border-[var(--theme-accent)] bg-[var(--theme-appPanelStrong)] shadow-sm":o.isSessionRunning(p.id)?"theme-status-warning":o.isCurrentSession(p.id)?"theme-status-info":"border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelStrong)] hover:border-[var(--theme-borderStrong)] hover:bg-[var(--theme-appPanel)]"}return(p,f)=>(r(),c(de,null,[e("div",Ut,[e("div",null,[f[1]||(f[1]=e("div",{class:"theme-heading text-sm font-medium"},"项目列表",-1)),i.hasSessions?L("",!0):(r(),c("p",Ot," 还没有项目,先新建一个固定工作目录。 "))]),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:i.busy,onClick:f[0]||(f[0]=v=>k("create"))},[x(w(Ue),{class:"h-4 w-4"}),f[2]||(f[2]=e("span",null,"新建",-1))],8,Vt)]),e("div",{class:_(["mt-4 space-y-2",i.mobile?"min-h-0 flex-1 overflow-y-auto":"max-h-52 overflow-y-auto pr-1 sm:max-h-64 lg:max-h-[calc(88vh-11rem)]"])},[(r(!0),c(de,null,ye(i.sessions,v=>(r(),c("article",{key:v.id,class:_(["relative cursor-pointer rounded-sm border p-3 transition",m(v)]),onClick:$=>k("select",v.id)},[i.mode==="edit"&&i.editingSessionId===v.id?(r(),c("span",Wt)):L("",!0),e("div",Kt,[e("div",Xt,[e("span",Gt,g(v.title||"未命名项目"),1),!i.mobile&&i.isCurrentSession(v.id)?(r(),c("span",Qt," 当前 ")):L("",!0),e("span",{class:_(["inline-flex items-center gap-1 rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getRuntimeStatusClass(v.id)])},[i.isSessionRunning(v.id)?(r(),c("span",Jt)):L("",!0),Me(" "+g(i.getRuntimeStatusLabel(v.id)),1)],2),e("span",{class:_(["rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getThreadStatusClass(v)])},g(i.getThreadStatusLabel(v)),3)]),e("div",Yt,g(v.cwd),1),i.mobile?L("",!0):(r(),c("div",Zt," 最近更新:"+g(i.formatUpdatedAt(v.updatedAt)),1))])],10,qt))),128))],2)],64))}},es={class:"space-y-3"},ts={class:"dashed-panel px-3 py-3"},ss={class:"mt-2 flex flex-wrap gap-2"},ns={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},as={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},ls={class:"dashed-panel px-3 py-3"},is={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},os={class:"dashed-panel px-3 py-3"},rs={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},ds={class:"dashed-panel px-3 py-3"},us={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},cs={__name:"CodexSessionManagerStatus",props:{activeSession:{type:Object,default:null},formatUpdatedAt:{type:Function,default:i=>i},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1}},setup(i){return(U,o)=>{var k,m,p,f,v,$;return r(),c("div",es,[e("div",ts,[o[0]||(o[0]=e("div",{class:"theme-muted-text text-[11px]"},"运行状态",-1)),e("div",ss,[e("span",{class:_(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getRuntimeStatusClass((k=i.activeSession)==null?void 0:k.id)])},[i.isSessionRunning((m=i.activeSession)==null?void 0:m.id)?(r(),c("span",ns)):L("",!0),Me(" "+g(i.getRuntimeStatusLabel((p=i.activeSession)==null?void 0:p.id)),1)],2),e("span",{class:_(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getThreadStatusClass(i.activeSession)])},g(i.getThreadStatusLabel(i.activeSession)),3),(f=i.activeSession)!=null&&f.id&&i.isCurrentSession(i.activeSession.id)?(r(),c("span",as," 当前项目 ")):L("",!0)])]),e("div",ls,[o[1]||(o[1]=e("div",{class:"theme-muted-text text-[11px]"},"工作目录",-1)),e("div",is,g(((v=i.activeSession)==null?void 0:v.cwd)||"未设置"),1)]),e("div",os,[o[2]||(o[2]=e("div",{class:"theme-muted-text text-[11px]"},"最近更新",-1)),e("div",rs,g(i.formatUpdatedAt(($=i.activeSession)==null?void 0:$.updatedAt)),1)]),e("div",ds,[e("div",us,[x(w(Ge),{class:"h-3.5 w-3.5"}),o[3]||(o[3]=e("span",null,"说明",-1))]),o[4]||(o[4]=e("p",{class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"}," 项目绑定目录,目录不变时会继续复用同一个 Codex 线程。 ",-1))])])}}},ms={class:"panel flex h-full w-full max-w-5xl flex-col overflow-hidden sm:h-auto sm:max-h-[88vh]"},vs={class:"theme-divider flex flex-wrap items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},fs={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},ps={class:"flex items-center gap-2"},hs=["disabled"],xs={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},gs={class:"theme-divider border-b bg-[var(--theme-appPanelMuted)] px-3 py-3 sm:px-4 sm:py-4 lg:border-b-0 lg:border-r"},ys={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},bs={class:"flex flex-wrap items-start justify-between gap-3"},ws={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Ss={class:"mt-5"},ks={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},$s={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4 sm:flex-row sm:items-center sm:justify-between"},Cs={class:"flex flex-wrap items-center gap-2"},_s=["disabled"],Ls={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},Ts=["disabled"],Ps=["disabled"],Rs=["disabled"],Ms={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ds={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Is={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},Fs={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Bs={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},Ns=["disabled"],zs={class:"min-w-0 flex-1"},Es={class:"theme-heading truncate text-sm font-medium"},As={key:0,class:"theme-muted-text mt-1 truncate text-xs"},js={class:"theme-divider border-b px-4 py-3"},Hs={class:"grid grid-cols-2 gap-2"},Us=["disabled"],Os={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},Vs={key:0},qs={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Ws={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Ks=["disabled"],Xs=["disabled"],Js={__name:"CodexSessionManagerDialog",props:{open:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]},workspaces:{type:Array,default:()=>[]},selectedSessionId:{type:String,default:""},selectionLocked:{type:Boolean,default:!1},selectionLockReason:{type:String,default:""},loading:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},onRefresh:{type:Function,default:null},onCreate:{type:Function,default:null},onUpdate:{type:Function,default:null},onDelete:{type:Function,default:null}},emits:["close","select-session"],setup(i,{emit:U}){const o=i,k=U,m=S("edit"),p=S(""),f=ze({title:"",cwd:""}),v=S(""),$=S(!1),F=S(!1),D=S(!1),B=S(!1),T=S(!1),{matches:y}=Oe("(max-width: 767px)"),I=S("list"),z=S("basic"),P=M(()=>ve(o.sessions)),b=M(()=>o.sessions.find(t=>t.id===p.value)||null),Q=M(()=>o.sessions.length>0),be=M(()=>o.sessions.find(t=>t.id===o.selectedSessionId)||null),J=M(()=>{var t;return!((t=b.value)!=null&&t.started)}),C=M(()=>o.loading||$.value||F.value||D.value),Y=M(()=>{var h,u;const t=new Set,a=[];return[f.cwd,(h=b.value)==null?void 0:h.cwd,(u=be.value)==null?void 0:u.cwd,...o.workspaces,...o.sessions.map(q=>q.cwd)].forEach(q=>{const E=String(q||"").trim();!E||t.has(E)||(t.add(E),a.push(E))}),a.slice(0,12)}),R=M(()=>{const t=W(f.cwd);return t?o.sessions.filter(a=>{var h;return a.id===((h=b.value)==null?void 0:h.id)?!1:W(a.cwd)===t}):[]}),Z=M(()=>{if(!R.value.length)return"";const t=R.value.slice(0,3).map(h=>`「${h.title||"未命名项目"}」`).join("、"),a=R.value.length>3?"等项目":"项目";return`该目录已被${t}${a}使用,建议优先复用,避免把同一目录拆成多个项目。`}),ue=M(()=>m.value!=="edit"||J.value?"":"当前项目已绑定 Codex 线程,工作目录不能再修改;如需使用新目录,请新建项目。"),ce=M(()=>m.value==="create"?$.value?"创建中...":"创建项目":F.value?"保存中...":"保存修改"),se=M(()=>{var t;return m.value==="create"?"新建项目":((t=b.value)==null?void 0:t.title)||"未命名项目"});function me(t=""){const a=Date.parse(String(t||""));return Number.isFinite(a)?a:0}function W(t=""){const a=String(t||"").trim();if(!a)return"";const h=/^[a-z]:[\\/]/i.test(a)||a.includes("\\");let u=a.replace(/\\/g,"/");return u.length>1&&!/^[a-z]:\/$/i.test(u)&&(u=u.replace(/\/+$/,"")),h?u.toLowerCase():u}function j(t){var a;return!!((a=o.sessions.find(h=>h.id===t))!=null&&a.running)}function O(t){return!!t&&t===o.selectedSessionId}function ve(t=[]){return[...t].sort((a,h)=>{const u=Number(j(h.id))-Number(j(a.id));if(u)return u;const q=Number(O(h.id))-Number(O(a.id));if(q)return q;const E=me(h.updatedAt)-me(a.updatedAt);return E||String(a.title||a.cwd||a.id).localeCompare(String(h.title||h.cwd||h.id),"zh-CN")})}function ne(t){return j(t)?"运行中":"空闲"}function K(t){return j(t)?"theme-status-warning":"theme-status-success"}function ee(t){return t!=null&&t.started?"已绑定线程":"未启动"}function H(t){return t!=null&&t.started?"theme-status-success":"theme-status-neutral"}function te(t=""){if(!t)return"未知";const a=new Date(t);return Number.isNaN(a.getTime())?t:a.toLocaleString("zh-CN")}function V(t){f.title=String((t==null?void 0:t.title)||""),f.cwd=String((t==null?void 0:t.cwd)||"")}function X(){m.value="create",p.value="",v.value="",f.title="",f.cwd=""}function A(t){const a=o.sessions.find(h=>h.id===t);a&&(m.value="edit",p.value=a.id,v.value="",V(a))}function ae(t="basic"){I.value="detail",z.value=t}function le(){I.value="list",z.value="basic"}function fe(){X(),y.value&&ae("basic")}function pe(t){C.value||(A(t),y.value&&ae("basic"))}function we(t){f.cwd=String(t||"").trim()}function he(t){f.title=String(t||"")}function xe(t){f.cwd=String(t||"")}function ge(){var t;if(v.value="",B.value=!1,z.value="basic",I.value=y.value?"list":"detail",o.selectedSessionId&&o.sessions.some(a=>a.id===o.selectedSessionId)){A(o.selectedSessionId);return}if((t=P.value[0])!=null&&t.id){A(P.value[0].id);return}X()}function G(t){!o.open||C.value||t.key==="Escape"&&k("close")}async function s(){if(!(C.value||typeof o.onRefresh!="function")){v.value="";try{await o.onRefresh()}catch(t){v.value=t.message}}}async function l(){if(!C.value){v.value="";try{const t=n();if(!t)return;await d(t)}catch(t){v.value=t.message}}}function n(){if(m.value==="create"){const a=String(f.cwd||"").trim();return a?{type:"create",cwd:a,payload:{title:f.title,cwd:a}}:(v.value="请先填写工作目录。",null)}if(!b.value)return v.value="当前项目不存在,请重新选择。",null;const t={title:f.title};return J.value&&(t.cwd=f.cwd),{type:"update",sessionId:b.value.id,payload:t}}async function d(t){var a,h;if(t.type==="create"){$.value=!0;try{const u=await((a=o.onCreate)==null?void 0:a.call(o,t.payload));u!=null&&u.id&&(A(u.id),k("select-session",u.id));return}finally{$.value=!1}}F.value=!0;try{const u=await((h=o.onUpdate)==null?void 0:h.call(o,t.sessionId,t.payload));u!=null&&u.id&&A(u.id)}finally{F.value=!1}}async function N(){var a,h;if(!b.value||D.value)return;const t=b.value.id;v.value="",D.value=!0;try{const u=await((a=o.onDelete)==null?void 0:a.call(o,t));B.value=!1;const q=o.sessions.filter(Ie=>Ie.id!==t),E=(u==null?void 0:u.selectedSessionId)||((h=ve(q)[0])==null?void 0:h.id)||"";k("select-session",E),E?(A(E),y.value&&le()):(X(),y.value&&le())}catch(u){v.value=u.message}finally{D.value=!1}}return oe(()=>o.open,t=>{if(document.body.classList.toggle("overflow-hidden",t),t){window.addEventListener("keydown",G),ge(),s().catch(()=>{});return}window.removeEventListener("keydown",G),T.value=!1,B.value=!1,v.value=""}),oe(y,t=>{t||(I.value="detail")},{immediate:!0}),oe(()=>o.sessions,()=>{var t;if(o.open&&m.value!=="create"){if(b.value){V(b.value);return}if(o.selectedSessionId&&o.sessions.some(a=>a.id===o.selectedSessionId)){A(o.selectedSessionId);return}if((t=P.value[0])!=null&&t.id){A(P.value[0].id);return}X()}}),Pe(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",G)}),(t,a)=>{var h;return r(),re(Re,{to:"body"},[i.open?(r(),c("div",{key:0,class:"fixed inset-0 z-50 flex items-end justify-center bg-black/45 px-0 py-0 backdrop-blur-sm sm:items-center sm:px-4 sm:py-6",onClick:a[10]||(a[10]=ke(u=>!C.value&&k("close"),["self"]))},[e("section",ms,[x(Ve,{open:B.value,title:"确认删除 PromptX 项目?",description:b.value?`将删除「${b.value.title||"未命名项目"}」这条本地记录,不会删除工作目录,也不会删除 Codex 的历史数据。`:"","confirm-text":"确认删除","cancel-text":"先保留",loading:D.value,danger:"",onCancel:a[0]||(a[0]=u=>B.value=!1),onConfirm:N},null,8,["open","description","loading"]),x(Mt,{open:T.value,"initial-path":f.cwd,suggestions:Y.value,onClose:a[1]||(a[1]=u=>T.value=!1),onSelect:we},null,8,["open","initial-path","suggestions"]),e("div",vs,[e("div",null,[e("div",fs,[x(w(qe),{class:"h-4 w-4"}),a[11]||(a[11]=e("span",null,"PromptX 项目管理",-1))])]),e("div",ps,[e("button",{type:"button",class:"theme-icon-button h-9 w-9",disabled:C.value,onClick:a[2]||(a[2]=u=>k("close"))},[x(w(De),{class:"h-4 w-4"})],8,hs)])]),w(y)?(r(),c("div",Ms,[I.value==="list"?(r(),c("div",Ds,[e("div",Is,[x(Te,{mobile:"",busy:C.value,"editing-session-id":p.value,"format-updated-at":te,"get-runtime-status-class":K,"get-runtime-status-label":ne,"get-thread-status-class":H,"get-thread-status-label":ee,"has-sessions":Q.value,"is-current-session":O,"is-session-running":j,mode:m.value,sessions:P.value,onCreate:fe,onSelect:pe},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(r(),c("div",Fs,[e("div",Bs,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-1.5 px-3 py-2 text-xs",disabled:C.value,onClick:le},[x(w(Xe),{class:"h-4 w-4"}),a[12]||(a[12]=e("span",null,"列表",-1))],8,Ns),e("div",zs,[e("div",Es,g(se.value),1),m.value==="edit"&&((h=b.value)!=null&&h.cwd)?(r(),c("p",As,g(b.value.cwd),1)):L("",!0)])]),e("div",js,[e("div",Hs,[e("button",{type:"button",class:_(["tool-button px-3 py-2 text-sm",z.value==="basic"?"tool-button-primary":""]),onClick:a[6]||(a[6]=u=>z.value="basic")}," 基本信息 ",2),e("button",{type:"button",class:_(["tool-button px-3 py-2 text-sm",z.value==="status"?"tool-button-primary":""]),disabled:m.value==="create",onClick:a[7]||(a[7]=u=>z.value="status")}," 状态 ",10,Us)])]),e("div",Os,[z.value==="basic"?(r(),c("div",Vs,[x(Le,{mobile:"",busy:C.value,"can-edit-cwd":m.value!=="edit"||J.value,cwd:f.cwd,"cwd-readonly-message":ue.value,"duplicate-cwd-message":Z.value,title:f.title,"workspace-suggestions":Y.value,onOpenDirectoryPicker:a[8]||(a[8]=u=>T.value=!0),"onUpdate:cwd":xe,"onUpdate:title":he},null,8,["busy","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","title","workspace-suggestions"]),v.value?(r(),c("p",qs,[x(w(_e),{class:"h-4 w-4"}),e("span",null,g(v.value),1)])):L("",!0),e("div",Ws,[e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-sm",disabled:C.value,onClick:l},g(ce.value),9,Ks),m.value==="edit"&&b.value?(r(),c("button",{key:0,type:"button",class:"tool-button theme-danger-text theme-danger-hover w-full px-3 py-2 text-sm",disabled:C.value||i.sending,onClick:a[9]||(a[9]=u=>B.value=!0)},g(D.value?"删除中...":"删除项目"),9,Xs)):L("",!0)])])):(r(),re(cs,{key:1,"active-session":b.value,"format-updated-at":te,"get-runtime-status-class":K,"get-runtime-status-label":ne,"get-thread-status-class":H,"get-thread-status-label":ee,"is-current-session":O,"is-session-running":j},null,8,["active-session"]))])]))])):(r(),c("div",xs,[e("aside",gs,[x(Te,{busy:C.value,"editing-session-id":p.value,"format-updated-at":te,"get-runtime-status-class":K,"get-runtime-status-label":ne,"get-thread-status-class":H,"get-thread-status-label":ee,"has-sessions":Q.value,"is-current-session":O,"is-session-running":j,mode:m.value,sessions:P.value,onCreate:fe,onSelect:pe},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),e("div",ys,[e("div",bs,[e("div",null,[e("div",ws,[x(w(We),{class:"h-4 w-4"}),e("span",null,g(m.value==="create"?"新建项目":"编辑项目"),1)])])]),e("div",Ss,[x(Le,{busy:C.value,"can-edit-cwd":m.value!=="edit"||J.value,cwd:f.cwd,"cwd-readonly-message":ue.value,"duplicate-cwd-message":Z.value,title:f.title,"workspace-suggestions":Y.value,onOpenDirectoryPicker:a[3]||(a[3]=u=>T.value=!0),"onUpdate:cwd":xe,"onUpdate:title":he},null,8,["busy","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","title","workspace-suggestions"])]),v.value?(r(),c("p",ks,[x(w(_e),{class:"h-4 w-4"}),e("span",null,g(v.value),1)])):L("",!0),e("div",$s,[e("div",Cs,[m.value==="edit"&&b.value?(r(),c("button",{key:0,type:"button",class:"tool-button theme-danger-text theme-danger-hover inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:C.value||i.sending,onClick:a[4]||(a[4]=u=>B.value=!0)},[x(w(Ke),{class:"h-4 w-4"}),e("span",null,g(D.value?"删除中...":"删除项目"),1)],8,_s)):L("",!0)]),e("div",Ls,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:C.value,onClick:a[5]||(a[5]=u=>k("close"))}," 关闭 ",8,Ts),m.value==="create"&&Q.value?(r(),c("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:C.value,onClick:ge}," 返回列表 ",8,Ps)):L("",!0),e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-xs sm:w-auto",disabled:C.value,onClick:l},g(ce.value),9,Rs)])])])]))])])):L("",!0)])}}};export{Js as default};
@@ -0,0 +1,12 @@
1
+ import{w as H,q as j,p as C,i as Ue,a as c,b as v,d as a,F as Q,m as ge,n as w,t as h,e as k,u as s,G as Fe,I as qe,f as T,c as Ce,s as we,x as Oe,H as Te,o as We,g as Ke,T as Ge}from"./index-D9ui_gwj.js";import{c as Ve,u as Je,g as Se,l as Qe,S as Xe,C as He,a as Me,b as Ye,d as Ze,_ as et,e as tt,F as Be,f as De,X as st}from"./WorkbenchView-Cp_qHNdX.js";/**
2
+ * @license lucide-vue-next v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const _e=Ve("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);/**
7
+ * @license lucide-vue-next v0.577.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Ae=Ve("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function G(e,r,i=""){const u=r==="run"?"run":r==="task"?"task":"workspace";return[String(e||"").trim(),u,String(i||"").trim()].join("::")}function at(e="",r=""){return`${String(e||"").trim()}::${String(r||"").trim()}`}function ze(e){if(!e||typeof e!="object")return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function xe(e,r){const i=e.get(r);return i?(e.delete(r),e.set(r,i),ze(i)):null}function $e(e,r,i,u=0){for(e.delete(r),e.set(r,ze(i));u>0&&e.size>u;){const d=e.keys().next().value;if(typeof d>"u")break;e.delete(d)}}function J(e=""){const r=String(e||"").trim().toUpperCase();return r==="A"||r==="D"?r:"M"}function nt(e=""){const r=String(e||"");if(!r)return[];const i=r.split(`
12
+ `),u=[];let d=0,y=0;return i.forEach((p,l)=>{const S=p.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(S){d=Number(S[1]),y=Number(S[2]),u.push({id:`hunk-${l}`,kind:"hunk",oldNumber:"",newNumber:"",content:p});return}if(p.startsWith("+")&&!p.startsWith("+++")){u.push({id:`line-${l}`,kind:"add",oldNumber:"",newNumber:y,content:p}),y+=1;return}if(p.startsWith("-")&&!p.startsWith("---")){u.push({id:`line-${l}`,kind:"delete",oldNumber:d,newNumber:"",content:p}),d+=1;return}if(p.startsWith(" ")){u.push({id:`line-${l}`,kind:"context",oldNumber:d,newNumber:y,content:p}),d+=1,y+=1;return}u.push({id:`line-${l}`,kind:"meta",oldNumber:"",newNumber:"",content:p})}),u}function lt(e){const r=C("workspace"),i=C(""),u=C(""),d=C("all"),y=C(""),p=C([]),l=C(null),S=C(!1),g=C(!1),I=C(""),U=C(!1),se=C(null),X=C(0),V=new Map,B=Je();let q=0,Y=0,F="",R="",z="",M=-1;const E=new Map,Z=new Map,ae=new Map,ee=j(()=>p.value.filter(t=>t.completed)),ue=j(()=>{var n;const t={all:0,A:0,M:0,D:0};return(((n=l.value)==null?void 0:n.files)||[]).forEach(f=>{const x=J(f==null?void 0:f.status);t.all+=1,t[x]+=1}),t}),O=j(()=>{var f;const t=((f=l.value)==null?void 0:f.files)||[],n=String(y.value||"").trim().toLowerCase();return t.filter(x=>d.value!=="all"&&J(x==null?void 0:x.status)!==d.value?!1:n?String((x==null?void 0:x.path)||"").toLowerCase().includes(n):!0)}),ne=j(()=>{const t=O.value;return t.find(n=>n.path===u.value)||t[0]||null}),le=j(()=>{var t;return nt(((t=ne.value)==null?void 0:t.patch)||"")}),D=j(()=>le.value.map((t,n)=>({...t,index:n})).filter(t=>t.kind==="hunk")),oe=j(()=>{var t,n;return g.value&&!((n=(t=l.value)==null?void 0:t.summary)!=null&&n.statsComplete)}),W=j(()=>{var f;const t=((f=l.value)==null?void 0:f.baseline)||null;if(!(t!=null&&t.createdAt)&&!(t!=null&&t.headShort))return"";const n=[];return t.createdAt&&n.push(`基线时间:${new Date(t.createdAt).toLocaleString("zh-CN")}`),t.branch&&n.push(`基线分支:${t.branch}`),t.headShort&&n.push(`基线 commit:${t.headShort}`),t.currentHeadShort&&n.push(`当前 HEAD:${t.currentHeadShort}`),n.join(" · ")});function L(t){return(t==null?void 0:t.status)==="completed"?"已完成":(t==null?void 0:t.status)==="error"?"失败":(t==null?void 0:t.status)==="interrupted"?"已中断":"已停止"}function ye(t,n){if(t){if(n){V.set(t,n);return}V.delete(t)}}function ie(t,n={}){const f=D.value;if(!f.length)return;const x=Math.min(Math.max(0,Number(t)||0),f.length-1),$=f[x],b=V.get($.id);b&&(X.value=x,b.scrollIntoView({block:n.block||"center",behavior:n.behavior||"smooth"}))}function _(t=1){D.value.length&&ie(X.value+t)}function o(t){return`${new Date((t==null?void 0:t.startedAt)||(t==null?void 0:t.createdAt)).toLocaleString("zh-CN")} · ${L(t)}`}function re(){const t=ee.value;if(!t.length){i.value="";return}t.some(n=>n.id===i.value)||(i.value=t[0].id)}function K(){const t=O.value;if(!t.length){u.value="";return}t.some(n=>n.path===u.value)||(u.value=t[0].path)}function de(t=""){return J(t)==="A"?"新增":J(t)==="D"?"删除":"修改"}function ce(t=""){return J(t)==="A"?"theme-status-success":J(t)==="D"?"theme-status-danger":"theme-status-warning"}function fe(t="all"){return t==="A"?"新增":t==="D"?"删除":t==="M"?"修改":"全部"}function m(t="all"){return d.value===t?"theme-filter-active":"theme-filter-idle"}function he(t="context"){return t==="add"?"theme-patch-add":t==="delete"?"theme-patch-delete":t==="hunk"?"theme-patch-hunk":t==="meta"?"theme-patch-meta":"theme-patch-context"}async function be(){if(!e.taskSlug){p.value=[],i.value="",z="",M=-1;return}const t=B.getTaskRunSyncVersion(e.taskSlug);if(z===e.taskSlug&&M===t)return;const n=await Qe(e.taskSlug,{limit:20,includeEvents:!1});p.value=n.items||[],z=e.taskSlug,M=t,re()}async function Le(){if(!e.taskSlug||!e.active)return;const t=++q;S.value=!0,g.value=!1,I.value="";try{const n=r.value==="run"?"run":r.value==="task"?"task":"workspace";n==="run"&&await be();const f=G(e.taskSlug,n,n==="run"?i.value:"");if(n==="run"&&!i.value){l.value={supported:!1,reason:"当前还没有可用于审查的历史执行记录。",repoRoot:"",summary:{fileCount:0,additions:0,deletions:0,statsComplete:!0},files:[]},K();return}const x=xe(E,f);if(x){l.value=x,F=f;const b=xe(Z,f);b?(l.value={...x,baseline:b.baseline||x.baseline||null,warnings:b.warnings||x.warnings||[],summary:b.summary||x.summary},R=f):R="",K(),me().catch(()=>{}),b||Pe().catch(()=>{});return}const $=await Se(e.taskSlug,{scope:n,runId:n==="run"?i.value:"",includeStats:!1});if(t!==q)return;l.value=$,$e(E,f,$,36),F=f,R="",K(),me().catch(()=>{}),Pe().catch(()=>{})}catch(n){if(t!==q)return;I.value=n.message,l.value=null}finally{t===q&&(S.value=!1)}}async function Pe(){var $,b,A;if(!e.taskSlug||!e.active||!(($=l.value)!=null&&$.supported))return;const t=r.value==="run"?"run":r.value==="task"?"task":"workspace",n=t==="run"?i.value:"",f=G(e.taskSlug,t,n);if(R===f&&((A=(b=l.value)==null?void 0:b.summary)!=null&&A.statsComplete))return;const x=xe(Z,f);if(x){l.value={...l.value,baseline:x.baseline||l.value.baseline||null,warnings:x.warnings||l.value.warnings||[],summary:x.summary||l.value.summary},R=f,g.value=!1;return}g.value=!0;try{const P=await Se(e.taskSlug,{scope:t,runId:n,includeFiles:!1,includeStats:!0}),te=G(e.taskSlug,r.value,r.value==="run"?i.value:"");if(f!==te||!l.value)return;l.value={...l.value,baseline:P.baseline||l.value.baseline||null,warnings:P.warnings||l.value.warnings||[],summary:P.summary||l.value.summary},$e(Z,f,{baseline:P.baseline||null,warnings:P.warnings||[],summary:P.summary||null},36),R=f}catch{}finally{const P=G(e.taskSlug,r.value,r.value==="run"?i.value:"");f===P&&(g.value=!1)}}async function me(){var te,Re,je;const t=String(u.value||"").trim();if(!e.taskSlug||!e.active||!t||U.value)return;const n=r.value==="run"?"run":r.value==="task"?"task":"workspace",f=n==="run"?i.value:"",x=G(e.taskSlug,n,f),$=(((te=l.value)==null?void 0:te.files)||[]).find(N=>N.path===t);if(!$||$.patchLoaded||$.binary||$.tooLarge||$.message)return;const b=at(x,t),A=xe(ae,b);if(A&&((Re=l.value)!=null&&Re.files)){l.value={...l.value,files:l.value.files.map(N=>N.path===t?A:N)};return}const P=++Y;U.value=!0;try{const N=await Se(e.taskSlug,{scope:n,runId:f,filePath:t});if(P!==Y)return;const Ee=G(e.taskSlug,r.value,r.value==="run"?i.value:"");if(x!==Ee)return;const ke=(N.files||[]).find(pe=>pe.path===t);if(!ke||!((je=l.value)!=null&&je.files))return;$e(ae,b,ke,120),l.value={...l.value,baseline:N.baseline||l.value.baseline||null,warnings:N.warnings||l.value.warnings||[],files:l.value.files.map(pe=>pe.path===t?ke:pe)}}catch(N){I.value=N.message}finally{P===Y&&(U.value=!1,String(u.value||"").trim()!==t&&me().catch(()=>{}))}}function ve({force:t=!1}={}){if(!e.taskSlug||!e.active)return;const n=G(e.taskSlug,r.value,r.value==="run"?i.value:"");!t&&n===F||Le().catch(()=>{})}return H(()=>[e.taskSlug,e.active,r.value,i.value],([t,n],f=[])=>{const x=f[0]||"";t!==x&&(u.value="",F="",p.value=[],i.value="",z="",M=-1,R=""),!(!t||!n)&&ve()},{immediate:!0}),H(()=>{var t,n;return[d.value,((n=(t=l.value)==null?void 0:t.files)==null?void 0:n.length)||0]},()=>{K()}),H(()=>[u.value,D.value.length],()=>{X.value=0,V.clear(),Ue(()=>{var t,n;D.value.length?ie(0,{behavior:"auto",block:"start"}):(n=(t=se.value)==null?void 0:t.scrollTo)==null||n.call(t,{top:0,behavior:"auto"})})}),H(()=>u.value,()=>{me().catch(()=>{})},{immediate:!0}),H(()=>[e.preferredScope,e.preferredRunId,e.focusToken],([t,n,f],x=[])=>{const $=Number(x[2]||0),b=t==="run"?"run":t==="task"?"task":"workspace",A=b==="run"&&n?String(n||""):"",P=r.value!==b,te=b==="run"&&A&&i.value!==A;r.value=b,A&&(i.value=A),b!=="run"&&(i.value=""),!P&&!te&&e.active&&e.taskSlug&&f!==$&&(F="",ve())},{immediate:!0}),H(()=>B.readyVersion.value,()=>{!e.active||!e.taskSlug||(z="",M=-1,F="",R="",ve({force:!0}))}),H(()=>B.getTaskDiffSyncVersion(e.taskSlug),()=>{!e.active||!e.taskSlug||(z="",M=-1,R="",F="",ve({force:!0}))}),{activeHunkIndex:X,baselineMetaText:W,diffPayload:l,diffScope:r,error:I,fileSearch:y,filteredFiles:O,getFilterButtonClass:m,getFilterLabel:fe,getPatchLineClass:he,getRunStatusLabel:L,getStatusClass:ce,getStatusLabel:de,jumpToAdjacentHunk:_,loadDiff:Le,loading:S,normalizeFileStatus:J,patchLoading:U,patchViewportRef:se,runs:p,selectedFile:ne,selectedFilePath:u,selectedPatchHunks:D,selectedPatchLines:le,selectedRunId:i,setPatchLineRef:ye,showSummarySkeleton:oe,statsLoading:g,statusCounts:ue,statusFilter:d,terminalRuns:ee,formatRunOptionLabel:o}}const it={class:"mb-3 flex flex-wrap gap-2"},ut=["onClick"],ot={class:"mb-3 flex items-center gap-2 rounded-sm border border-[var(--theme-inputBorder)] bg-[var(--theme-inputBg)] px-3 py-2 text-xs text-[var(--theme-textMuted)]"},rt={key:0,class:"theme-empty-state mb-3 bg-[var(--theme-appPanelStrong)] px-3 py-2 text-[11px]"},dt={key:1,class:"theme-empty-state px-3 py-4 text-xs"},ct={key:2,class:"theme-empty-state px-3 py-4 text-xs"},ft={key:3,class:"space-y-2"},ht=["onClick"],mt={class:"flex items-start gap-2"},vt={class:"min-w-0 flex-1"},pt={class:"break-all text-xs font-medium"},xt={class:"mt-1 text-[11px] opacity-75"},Ne={__name:"TaskDiffFileList",props:{diffPayload:{type:Object,default:null},fileSearch:{type:String,default:""},filteredFiles:{type:Array,default:()=>[]},getFilterButtonClass:{type:Function,default:()=>""},getFilterLabel:{type:Function,default:e=>e},getStatusClass:{type:Function,default:()=>""},getStatusLabel:{type:Function,default:e=>e},selectedFilePath:{type:String,default:""},showSummarySkeleton:{type:Boolean,default:!1},statusCounts:{type:Object,default:()=>({})},statusFilter:{type:String,default:"all"}},emits:["select-file","update:fileSearch","update:statusFilter"],setup(e,{emit:r}){const i=e,u=r,d=j({get:()=>i.fileSearch,set:l=>u("update:fileSearch",l)}),y=j({get:()=>i.statusFilter,set:l=>u("update:statusFilter",l)}),p=j(()=>{var l;return Array.isArray((l=i.diffPayload)==null?void 0:l.files)&&i.diffPayload.files.length>0});return(l,S)=>(c(),v(Q,null,[a("div",it,[(c(),v(Q,null,ge(["all","A","M","D"],g=>a("button",{key:g,type:"button",class:w(["rounded-sm border px-2 py-1 text-[11px] transition",e.getFilterButtonClass(g)]),onClick:I=>y.value=g},h(e.getFilterLabel(g))+" "+h(e.statusCounts[g]||0),11,ut)),64))]),a("label",ot,[k(s(Xe),{class:"h-3.5 w-3.5 shrink-0"}),Fe(a("input",{"onUpdate:modelValue":S[0]||(S[0]=g=>d.value=g),type:"text",placeholder:"搜索文件路径",class:"min-w-0 flex-1 bg-transparent text-xs text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]"},null,512),[[qe,d.value]])]),e.showSummarySkeleton?(c(),v("div",rt," 已先展示文件列表,整体增删行数正在后台统计... ")):T("",!0),p.value?e.filteredFiles.length?(c(),v("div",ft,[(c(!0),v(Q,null,ge(e.filteredFiles,g=>(c(),v("button",{key:g.path,type:"button",class:w(["w-full rounded-sm border px-3 py-2 text-left transition",g.path===e.selectedFilePath?"theme-filter-active":"theme-filter-idle"]),onClick:I=>u("select-file",g.path)},[a("div",mt,[a("span",{class:w(["inline-flex shrink-0 rounded-sm border px-1.5 py-0.5 text-[10px]",e.getStatusClass(g.status)])},h(e.getStatusLabel(g.status)),3),a("div",vt,[a("div",pt,h(g.path),1),a("div",xt,h(g.statsLoaded?`+${g.additions} / -${g.deletions}`:"行数按需统计"),1)])])],10,ht))),128))])):(c(),v("div",ct," 当前筛选或搜索条件下没有匹配文件。 ")):(c(),v("div",dt," 当前范围内还没有检测到代码变更。 "))],64))}},gt={key:0,class:"flex h-full min-h-0 flex-col overflow-hidden"},yt={class:"theme-divider theme-secondary-text border-b px-4 py-3 text-xs"},bt={class:"space-y-3 sm:hidden"},kt={class:"flex items-start gap-2"},wt={class:"min-w-0 break-all font-medium text-[var(--theme-textPrimary)]"},St={class:"flex items-center justify-between gap-3"},$t={class:"opacity-75"},Ft=["disabled"],Ct={class:"min-w-[64px] text-center text-[11px] text-[var(--theme-textSecondary)]"},Lt=["disabled"],Pt={class:"hidden items-center gap-3 sm:flex"},Rt={class:"flex min-w-0 flex-1 flex-wrap items-center gap-2"},jt={class:"break-all font-medium text-[var(--theme-textPrimary)]"},Tt={class:"opacity-75"},Ht=["disabled"],Mt={class:"min-w-[64px] text-center text-[11px] text-[var(--theme-textSecondary)]"},Dt=["disabled"],_t={key:0,class:"theme-secondary-text flex-1 overflow-y-auto px-4 py-4 text-sm"},At={class:"theme-empty-state px-4 py-4"},Nt={key:1,class:"theme-muted-text flex-1 overflow-y-auto px-4 py-4 text-sm"},It={class:"min-w-max px-4 py-4 font-mono text-[11px] leading-5"},Vt={class:"select-none border-r border-[var(--theme-borderMuted)] px-2 py-0.5 text-right opacity-60"},Bt={class:"select-none border-r border-[var(--theme-borderMuted)] px-2 py-0.5 text-right opacity-60"},zt={class:"overflow-visible whitespace-pre px-3 py-0.5"},Et={key:3,class:"theme-secondary-text flex-1 overflow-y-auto px-4 py-4 text-sm"},Ut={key:1,class:"theme-muted-text flex h-full items-center justify-center px-5 text-sm"},Ie={__name:"TaskDiffPatchView",props:{activeHunkIndex:{type:Number,default:0},getPatchLineClass:{type:Function,default:()=>""},getStatusClass:{type:Function,default:()=>""},getStatusLabel:{type:Function,default:e=>e},jumpToAdjacentHunk:{type:Function,default:()=>{}},patchLoading:{type:Boolean,default:!1},selectedFile:{type:Object,default:null},selectedPatchHunks:{type:Array,default:()=>[]},selectedPatchLines:{type:Array,default:()=>[]},setPatchLineRef:{type:Function,default:()=>{}},setPatchViewportRef:{type:Function,default:()=>{}}},setup(e){return(r,i)=>e.selectedFile?(c(),v("div",gt,[a("div",yt,[a("div",bt,[a("div",kt,[a("span",{class:w(["inline-flex shrink-0 rounded-sm border px-1.5 py-0.5 text-[10px]",e.getStatusClass(e.selectedFile.status)])},h(e.getStatusLabel(e.selectedFile.status)),3),a("span",wt,h(e.selectedFile.path),1)]),a("div",St,[a("span",$t,h(e.selectedFile.statsLoaded?`+${e.selectedFile.additions} / -${e.selectedFile.deletions}`:"行数按需统计"),1),a("div",{class:w(["inline-flex h-8 shrink-0 items-center gap-1 rounded-sm border px-1.5 py-1",e.selectedPatchHunks.length?"border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelMuted)]":"pointer-events-none invisible border-transparent"])},[a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex<=0,onClick:i[0]||(i[0]=u=>e.jumpToAdjacentHunk(-1))},[k(s(He),{class:"h-4 w-4"})],8,Ft),a("span",Ct," 改动 "+h(Math.min(e.activeHunkIndex+1,e.selectedPatchHunks.length))+"/"+h(e.selectedPatchHunks.length),1),a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex>=e.selectedPatchHunks.length-1,onClick:i[1]||(i[1]=u=>e.jumpToAdjacentHunk(1))},[k(s(Me),{class:"h-4 w-4"})],8,Lt)],2)])]),a("div",Pt,[a("div",Rt,[a("span",{class:w(["inline-flex rounded-sm border px-1.5 py-0.5 text-[10px]",e.getStatusClass(e.selectedFile.status)])},h(e.getStatusLabel(e.selectedFile.status)),3),a("span",jt,h(e.selectedFile.path),1),a("span",Tt,h(e.selectedFile.statsLoaded?`+${e.selectedFile.additions} / -${e.selectedFile.deletions}`:"行数按需统计"),1)]),a("div",{class:w(["inline-flex h-8 w-[132px] shrink-0 items-center gap-1 rounded-sm border px-1.5 py-1",e.selectedPatchHunks.length?"border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelMuted)]":"pointer-events-none invisible border-transparent"])},[a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex<=0,onClick:i[2]||(i[2]=u=>e.jumpToAdjacentHunk(-1))},[k(s(He),{class:"h-4 w-4"})],8,Ht),a("span",Mt," 改动 "+h(Math.min(e.activeHunkIndex+1,e.selectedPatchHunks.length))+"/"+h(e.selectedPatchHunks.length),1),a("button",{type:"button",class:"theme-icon-button h-6 w-6 disabled:opacity-50",disabled:e.activeHunkIndex>=e.selectedPatchHunks.length-1,onClick:i[3]||(i[3]=u=>e.jumpToAdjacentHunk(1))},[k(s(Me),{class:"h-4 w-4"})],8,Dt)],2)])]),e.selectedFile.message?(c(),v("div",_t,[a("div",At,h(e.selectedFile.message),1)])):e.patchLoading&&!e.selectedFile.patchLoaded?(c(),v("div",Nt," 正在加载该文件的 diff... ")):e.selectedPatchLines.length?(c(),v("div",{key:2,ref:e.setPatchViewportRef,class:"flex-1 overflow-auto"},[a("div",It,[(c(!0),v(Q,null,ge(e.selectedPatchLines,u=>{var d;return c(),v("div",{key:u.id,ref_for:!0,ref:y=>e.setPatchLineRef(u.id,y),class:w(["grid grid-cols-[56px_56px_minmax(0,1fr)]",[e.getPatchLineClass(u.kind),u.kind==="hunk"&&((d=e.selectedPatchHunks[e.activeHunkIndex])==null?void 0:d.id)===u.id?"ring-1 ring-inset ring-[var(--theme-warning)]":""]])},[a("span",Vt,h(u.oldNumber),1),a("span",Bt,h(u.newNumber),1),a("pre",zt,h(u.content),1)],2)}),128))])],512)):(c(),v("div",Et,[...i[4]||(i[4]=[a("div",{class:"theme-empty-state px-4 py-4"}," 当前文件没有可展示的 diff 内容。 ",-1)])]))])):(c(),v("div",Ut," 请选择一个文件查看 diff。 "))}},qt={class:"panel flex h-full min-h-0 flex-col overflow-hidden"},Ot={class:"theme-divider border-b px-4 py-3"},Wt={class:"flex flex-col gap-2"},Kt={class:"grid grid-cols-4 gap-2 sm:flex sm:flex-wrap sm:items-center"},Gt=["disabled"],Jt={class:"hidden sm:inline"},Qt={class:"truncate text-xs text-[var(--theme-textPrimary)]"},Xt={class:"theme-divider theme-muted-text border-b border-dashed px-3 py-2 text-[11px]"},Yt=["onClick"],Zt={class:"flex items-start gap-3"},es={class:"min-w-0 flex-1"},ts={class:"truncate text-xs font-medium text-[var(--theme-textPrimary)]"},ss={class:"theme-muted-text mt-1 text-[11px]"},as={key:0,class:"theme-divider theme-danger-text border-b px-4 py-3 text-sm"},ns={class:"inline-flex items-start gap-2"},ls={class:"break-all"},is={key:1,class:"theme-muted-text flex flex-1 items-center justify-center px-5 text-sm"},us={key:2,class:"flex flex-1 items-center justify-center px-5"},os={class:"theme-empty-state w-full max-w-xl px-4 py-5 text-sm text-[var(--theme-textSecondary)]"},rs={class:"theme-heading inline-flex items-center gap-2 font-medium"},ds={class:"mt-2 break-all leading-7"},cs={key:0,class:"mt-3 flex flex-wrap gap-2 text-xs"},fs={class:"theme-status-neutral inline-flex items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},hs={class:"break-all"},ms={key:0,class:"theme-status-success inline-flex items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},vs={key:3,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},ps={class:"theme-divider theme-secondary-text border-b px-4 py-3 text-xs"},xs={class:"flex flex-wrap items-center gap-2"},gs={key:0,class:"theme-status-info inline-flex min-w-0 items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},ys={class:"min-w-0 break-all"},bs={class:"theme-status-success inline-flex items-center gap-2 rounded-sm border border-dashed px-2.5 py-1.5"},ks={class:"text-[var(--theme-textPrimary)]"},ws={class:"font-medium text-[var(--theme-success)]"},Ss={class:"font-medium text-[var(--theme-danger)]"},$s={key:2,class:"opacity-75"},Fs={key:0,class:"mt-2 break-all text-[11px] opacity-75"},Cs={key:1,class:"mt-2 flex flex-col gap-1"},Ls={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ps={class:"theme-divider border-b px-3 py-3"},Rs={class:"grid grid-cols-2 gap-2"},js=["disabled"],Ts={class:"theme-divider min-h-0 flex-1 overflow-y-auto bg-[var(--theme-appPanelMuted)] p-3"},Hs={class:"min-h-0 flex-1 overflow-hidden bg-[var(--theme-appPanelStrong)]"},Ms={key:1,class:"grid min-h-0 flex-1 grid-cols-[320px_minmax(0,1fr)] overflow-hidden"},Ds={class:"theme-divider min-h-0 overflow-y-auto border-r bg-[var(--theme-appPanelMuted)] p-3"},_s={class:"min-h-0 overflow-hidden bg-[var(--theme-appPanelStrong)]"},As={__name:"TaskDiffReviewPanel",props:{taskSlug:{type:String,default:""},preferredScope:{type:String,default:"workspace"},preferredRunId:{type:String,default:""},focusToken:{type:Number,default:0},active:{type:Boolean,default:!1}},setup(e){const r=e,{activeHunkIndex:i,baselineMetaText:u,diffPayload:d,diffScope:y,error:p,fileSearch:l,filteredFiles:S,formatRunOptionLabel:g,getFilterButtonClass:I,getFilterLabel:U,getPatchLineClass:se,getRunStatusLabel:X,getStatusClass:V,getStatusLabel:B,jumpToAdjacentHunk:q,loadDiff:Y,loading:F,patchLoading:R,patchViewportRef:z,selectedFile:M,selectedFilePath:E,selectedPatchHunks:Z,selectedPatchLines:ae,selectedRunId:ee,setPatchLineRef:ue,showSummarySkeleton:O,statsLoading:ne,statusCounts:le,statusFilter:D,terminalRuns:oe}=lt(r),{matches:W}=Ye("(max-width: 767px)"),L=C("files");function ye(_){E.value=_,W.value&&(L.value="patch")}function ie(_){z.value=_||null}return H(W,_=>{_||(L.value="files")},{immediate:!0}),H(E,_=>{!_&&W.value&&(L.value="files")}),H(y,()=>{W.value&&(L.value="files")}),(_,o)=>{var re,K,de,ce,fe;return c(),v("section",qt,[a("div",Ot,[a("div",Wt,[a("div",Kt,[a("button",{type:"button",class:w(["tool-button inline-flex items-center justify-center gap-2 px-3 py-2 text-xs",s(y)==="workspace"?"theme-filter-active":""]),onClick:o[0]||(o[0]=m=>y.value="workspace")},[...o[12]||(o[12]=[a("span",{class:"sm:hidden"},"当前",-1),a("span",{class:"hidden sm:inline"},"当前变更",-1)])],2),a("button",{type:"button",class:w(["tool-button inline-flex items-center justify-center gap-2 px-3 py-2 text-xs",s(y)==="task"?"theme-filter-active":""]),onClick:o[1]||(o[1]=m=>y.value="task")},[...o[13]||(o[13]=[a("span",{class:"sm:hidden"},"累计",-1),a("span",{class:"hidden sm:inline"},"任务累计",-1)])],2),a("button",{type:"button",class:w(["tool-button inline-flex items-center justify-center gap-2 px-3 py-2 text-xs",s(y)==="run"?"theme-filter-active":""]),onClick:o[2]||(o[2]=m=>y.value="run")},[...o[14]||(o[14]=[a("span",null,"本轮",-1)])],2),a("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center justify-center gap-2 px-3 py-2 text-xs",disabled:s(F)||s(ne),onClick:o[3]||(o[3]=(...m)=>s(Y)&&s(Y)(...m))},[k(s(Ae),{class:w(["h-3.5 w-3.5 sm:hidden",s(F)?"animate-spin":""])},null,8,["class"]),o[15]||(o[15]=a("span",{class:"sm:hidden"},"刷新",-1)),k(s(Ae),{class:w(["hidden h-3.5 w-3.5 sm:inline-block",s(F)?"animate-spin":""])},null,8,["class"]),a("span",Jt,h(s(F)?"刷新中...":s(ne)?"统计中...":"刷新"),1)],8,Gt)]),s(y)==="run"?(c(),Ce(et,{key:0,modelValue:s(ee),"onUpdate:modelValue":o[4]||(o[4]=m=>Oe(ee)?ee.value=m:null),class:"min-w-0 sm:max-w-[360px]",options:s(oe),loading:s(F),"get-option-value":m=>(m==null?void 0:m.id)||"",placeholder:"请选择历史执行","empty-text":"暂无可查看的历史执行"},{trigger:we(({selectedOption:m})=>[a("div",Qt,h(m?s(g)(m):"请选择历史执行"),1)]),header:we(()=>[a("div",Xt," 共 "+h(s(oe).length)+" 条可审查执行 ",1)]),option:we(({option:m,selected:he,select:be})=>[a("button",{type:"button",class:w(["w-full rounded-sm border border-dashed px-3 py-2 text-left transition",he?"theme-filter-active":"theme-filter-idle"]),onClick:be},[a("div",Zt,[a("div",es,[a("div",ts,h(new Date(m.startedAt||m.createdAt).toLocaleString("zh-CN")),1),a("div",ss,h(s(X)(m)),1)]),he?(c(),Ce(s(Ze),{key:0,class:"mt-0.5 h-4 w-4 shrink-0 text-[var(--theme-textSecondary)]"})):T("",!0)])],10,Yt)]),_:1},8,["modelValue","options","loading","get-option-value"])):T("",!0)])]),s(p)?(c(),v("div",as,[a("div",ns,[k(s(tt),{class:"mt-0.5 h-4 w-4 shrink-0"}),a("span",ls,h(s(p)),1)])])):T("",!0),s(F)&&!s(d)?(c(),v("div",is," 正在读取代码变更... ")):s(d)&&!s(d).supported?(c(),v("div",us,[a("div",os,[a("div",rs,[k(s(Be),{class:"h-4 w-4"}),o[16]||(o[16]=a("span",null,"暂时无法查看代码变更",-1))]),a("p",ds,h(s(d).reason||"当前没有可展示的代码变更。"),1),s(d).repoRoot?(c(),v("div",cs,[a("div",fs,[k(s(De),{class:"h-3.5 w-3.5 shrink-0"}),a("span",hs,h(s(d).repoRoot),1)]),s(d).branch?(c(),v("div",ms,[k(s(_e),{class:"h-3.5 w-3.5 shrink-0"}),a("span",null,h(s(d).branch),1)])):T("",!0)])):T("",!0)])])):s(d)?(c(),v("div",vs,[a("div",ps,[a("div",xs,[s(d).repoRoot?(c(),v("div",gs,[k(s(De),{class:"h-3.5 w-3.5 shrink-0"}),a("span",ys,h(s(d).repoRoot),1)])):T("",!0),a("div",bs,[k(s(_e),{class:"h-3.5 w-3.5 shrink-0"}),a("span",null,h(s(d).branch||"未识别分支"),1),o[21]||(o[21]=a("span",{class:"opacity-50"},"•",-1)),a("span",ks,h(((re=s(d).summary)==null?void 0:re.fileCount)||0)+" 个文件",1),(K=s(d).summary)!=null&&K.statsComplete?(c(),v(Q,{key:0},[o[17]||(o[17]=a("span",{class:"opacity-50"},"•",-1)),a("span",ws,"+"+h(((de=s(d).summary)==null?void 0:de.additions)||0),1),a("span",Ss,"-"+h(((ce=s(d).summary)==null?void 0:ce.deletions)||0),1)],64)):s(O)?(c(),v(Q,{key:1},[o[18]||(o[18]=a("span",{class:"opacity-50"},"•",-1)),o[19]||(o[19]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-successSoft)]"},null,-1)),o[20]||(o[20]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-dangerSoft)]"},null,-1))],64)):(c(),v("span",$s,"等待统计"))])]),s(u)?(c(),v("p",Fs,h(s(u)),1)):T("",!0),(fe=s(d).warnings)!=null&&fe.length?(c(),v("div",Cs,[(c(!0),v(Q,null,ge(s(d).warnings,m=>(c(),v("p",{key:m,class:"text-[11px] text-[var(--theme-warningText)]"},h(m),1))),128))])):T("",!0)]),s(W)?(c(),v("div",Ls,[a("div",Ps,[a("div",Rs,[a("button",{type:"button",class:w(["tool-button px-3 py-2 text-sm",L.value==="files"?"tool-button-primary":""]),onClick:o[5]||(o[5]=m=>L.value="files")}," 文件 ",2),a("button",{type:"button",class:w(["tool-button px-3 py-2 text-sm",L.value==="patch"?"tool-button-primary":""]),disabled:!s(M),onClick:o[6]||(o[6]=m=>L.value="patch")}," Diff ",10,js)])]),Fe(a("div",Ts,[k(Ne,{"diff-payload":s(d),"file-search":s(l),"filtered-files":s(S),"get-filter-button-class":s(I),"get-filter-label":s(U),"get-status-class":s(V),"get-status-label":s(B),"selected-file-path":s(E),"show-summary-skeleton":s(O),"status-counts":s(le),"status-filter":s(D),"onUpdate:fileSearch":o[7]||(o[7]=m=>l.value=m),"onUpdate:statusFilter":o[8]||(o[8]=m=>D.value=m),onSelectFile:ye},null,8,["diff-payload","file-search","filtered-files","get-filter-button-class","get-filter-label","get-status-class","get-status-label","selected-file-path","show-summary-skeleton","status-counts","status-filter"])],512),[[Te,L.value==="files"]]),Fe(a("div",Hs,[k(Ie,{"active-hunk-index":s(i),"get-patch-line-class":s(se),"get-status-class":s(V),"get-status-label":s(B),"jump-to-adjacent-hunk":s(q),"patch-loading":s(R),"selected-file":s(M),"selected-patch-hunks":s(Z),"selected-patch-lines":s(ae),"set-patch-line-ref":s(ue),"set-patch-viewport-ref":ie},null,8,["active-hunk-index","get-patch-line-class","get-status-class","get-status-label","jump-to-adjacent-hunk","patch-loading","selected-file","selected-patch-hunks","selected-patch-lines","set-patch-line-ref"])],512),[[Te,L.value==="patch"]])])):(c(),v("div",Ms,[a("div",Ds,[k(Ne,{"diff-payload":s(d),"file-search":s(l),"filtered-files":s(S),"get-filter-button-class":s(I),"get-filter-label":s(U),"get-status-class":s(V),"get-status-label":s(B),"selected-file-path":s(E),"show-summary-skeleton":s(O),"status-counts":s(le),"status-filter":s(D),"onUpdate:fileSearch":o[9]||(o[9]=m=>l.value=m),"onUpdate:statusFilter":o[10]||(o[10]=m=>D.value=m),onSelectFile:o[11]||(o[11]=m=>E.value=m)},null,8,["diff-payload","file-search","filtered-files","get-filter-button-class","get-filter-label","get-status-class","get-status-label","selected-file-path","show-summary-skeleton","status-counts","status-filter"])]),a("div",_s,[k(Ie,{"active-hunk-index":s(i),"get-patch-line-class":s(se),"get-status-class":s(V),"get-status-label":s(B),"jump-to-adjacent-hunk":s(q),"patch-loading":s(R),"selected-file":s(M),"selected-patch-hunks":s(Z),"selected-patch-lines":s(ae),"set-patch-line-ref":s(ue),"set-patch-viewport-ref":ie},null,8,["active-hunk-index","get-patch-line-class","get-status-class","get-status-label","jump-to-adjacent-hunk","patch-loading","selected-file","selected-patch-hunks","selected-patch-lines","set-patch-line-ref"])])]))])):T("",!0)])}}},Ns={class:"panel flex h-full w-full min-h-0 flex-col overflow-hidden sm:h-[min(90vh,960px)] sm:max-w-[min(96vw,1560px)]"},Is={class:"theme-divider flex items-start justify-between gap-4 border-b px-4 py-4 sm:px-5"},Vs={class:"min-w-0"},Bs={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},zs={class:"min-h-0 flex-1 overflow-hidden p-3 sm:p-4"},qs={__name:"TaskDiffReviewDialog",props:{open:{type:Boolean,default:!1},taskSlug:{type:String,default:""},taskTitle:{type:String,default:""},preferredScope:{type:String,default:"task"},preferredRunId:{type:String,default:""},focusToken:{type:Number,default:0}},emits:["close"],setup(e,{emit:r}){const i=e,u=r,d=j(()=>{const p=String(i.taskTitle||"").trim();return p?`代码变更 · ${p}`:"代码变更"});function y(p){i.open&&p.key==="Escape"&&u("close")}return H(()=>i.open,p=>{if(document.body.classList.toggle("overflow-hidden",p),p){window.addEventListener("keydown",y);return}window.removeEventListener("keydown",y)}),We(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",y)}),(p,l)=>(c(),Ce(Ge,{to:"body"},[e.open?(c(),v("div",{key:0,class:"fixed inset-0 z-50 flex items-end justify-center bg-black/45 px-0 py-0 backdrop-blur-sm sm:items-center sm:px-4 sm:py-6",onClick:l[1]||(l[1]=Ke(S=>u("close"),["self"]))},[a("section",Ns,[a("div",Is,[a("div",Vs,[a("div",Bs,[k(s(Be),{class:"h-4 w-4"}),a("span",null,h(d.value),1)])]),a("button",{type:"button",class:"theme-icon-button h-8 w-8 shrink-0",onClick:l[0]||(l[0]=S=>u("close"))},[k(s(st),{class:"h-4 w-4"})])]),a("div",zs,[k(As,{"task-slug":e.taskSlug,active:e.open,"preferred-scope":e.preferredScope,"preferred-run-id":e.preferredRunId,"focus-token":e.focusToken},null,8,["task-slug","active","preferred-scope","preferred-run-id","focus-token"])])])])):T("",!0)]))}};export{qs as default};
@@ -0,0 +1 @@
1
+ import{a as s,b as d,d as e,t as p,u as r,F as f,m as x,J as w,q as k,n as $,l as C,c as _,f as y,w as T,o as B,e as b,g as L,T as S}from"./index-D9ui_gwj.js";import{d as E,h as j,X as D}from"./WorkbenchView-Cp_qHNdX.js";const N={class:"space-y-4"},z={class:"flex items-center justify-between gap-3"},V={class:"theme-muted-text rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelStrong)] px-2 py-1 text-[11px]"},F={class:"space-y-4"},M={class:"theme-muted-text px-1 text-[10px] font-medium uppercase tracking-[0.16em]"},P=["onClick"],q={class:"flex items-start gap-3"},G={class:"mt-0.5 flex items-center gap-1.5"},J={class:"min-w-0 flex-1"},K={class:"flex items-center justify-between gap-2"},U={class:"truncate text-sm font-medium"},W={class:"theme-muted-text mt-1 text-[11px] leading-5"},X={__name:"ThemeToggle",setup(h){const{currentTheme:c,setTheme:u,themes:a}=w(),m=k(()=>{const t=a.filter(n=>n.mode==="light"),o=a.filter(n=>n.mode==="dark");return[{id:"light",label:"浅色主题",items:t},{id:"dark",label:"深色主题",items:o}].filter(n=>n.items.length)});function l(t){u(t)}return(t,o)=>(s(),d("div",N,[e("div",null,[e("div",z,[o[0]||(o[0]=e("div",{class:"theme-heading text-sm font-medium"},"界面主题",-1)),e("div",V," 当前:"+p(r(c).shortName),1)]),o[1]||(o[1]=e("div",{class:"theme-muted-text mt-1 text-xs leading-5"},"像编辑器一样切换整套配色,而不只是深浅模式。",-1))]),e("div",F,[(s(!0),d(f,null,x(m.value,n=>(s(),d("section",{key:n.id,class:"space-y-1.5"},[e("div",M,p(n.label),1),(s(!0),d(f,null,x(n.items,i=>(s(),d("button",{key:i.id,type:"button",class:$(["theme-option w-full rounded-sm border px-3 py-2 text-left transition",i.id===r(c).id?"theme-option-active":"theme-option-idle"]),onClick:v=>l(i.id)},[e("div",q,[e("div",G,[(s(!0),d(f,null,x(i.swatches,(v,g)=>(s(),d("span",{key:`${i.id}-${g}`,class:"h-3 w-3 rounded-full border border-black/10",style:C({backgroundColor:v})},null,4))),128))]),e("div",J,[e("div",K,[e("span",U,p(i.name),1),i.id===r(c).id?(s(),_(r(E),{key:0,class:"h-4 w-4 shrink-0"})):y("",!0)]),e("div",W,p(i.description),1)])])],10,P))),128))]))),128))])]))}},A={class:"panel flex w-full max-w-xl flex-col overflow-hidden"},H={class:"theme-divider flex items-start justify-between gap-4 border-b px-5 py-4"},I={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},O={class:"space-y-6 px-5 py-5"},Q={class:"rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelMuted)] px-4 py-4"},Z={__name:"WorkbenchSettingsDialog",props:{open:{type:Boolean,default:!1}},emits:["close"],setup(h,{emit:c}){const u=h,a=c;function m(l){u.open&&l.key==="Escape"&&a("close")}return T(()=>u.open,l=>{if(document.body.classList.toggle("overflow-hidden",l),l){window.addEventListener("keydown",m);return}window.removeEventListener("keydown",m)}),B(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",m)}),(l,t)=>(s(),_(S,{to:"body"},[h.open?(s(),d("div",{key:0,class:"fixed inset-0 z-[70] flex items-center justify-center bg-black/45 px-4 py-6 backdrop-blur-sm",onClick:t[1]||(t[1]=L(o=>a("close"),["self"]))},[e("section",A,[e("div",H,[e("div",null,[e("div",I,[b(r(j),{class:"h-4 w-4"}),t[2]||(t[2]=e("span",null,"设置",-1))]),t[3]||(t[3]=e("p",{class:"theme-muted-text mt-1 text-xs leading-5"},"先把界面主题收到这里,后面其他偏好也可以继续往里放。",-1))]),e("button",{type:"button",class:"theme-icon-button h-8 w-8 shrink-0",onClick:t[0]||(t[0]=o=>a("close"))},[b(r(D),{class:"h-4 w-4"})])]),e("div",O,[e("section",Q,[b(X)])])])])):y("",!0)]))}};export{Z as default};