@muyichengshayu/promptx 0.1.8 → 0.1.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.9
4
+
5
+ - 新增 `PromptX Glass Light` 毛玻璃主题,统一覆盖工作台主容器、任务列表、设置面板、弹窗、下拉、状态标签与图片预览层。
6
+ - 优化执行区视觉层次,补齐提示词 / 执行过程 / 回复三类消息卡片,以及 Markdown 中引用、代码块、表格等内容样式。
7
+ - 单独收敛手机端观感:压低玻璃强度与阴影,收紧任务卡、详情头部、设置页导航与表单布局。
8
+ - 修复 Markdown 表格在新主题下布局错乱的问题,改为使用外层滚动容器承载表格边框与横向滚动。
9
+ - 编辑区右上角主按钮在任务执行中保持“发送”文案并禁用,不再切换成“停止”,减少误触和语义跳变。
10
+
3
11
  ## 0.1.8
4
12
 
5
13
  - 新增 OpenCode 执行引擎接入,补齐 runner、契约测试、Doctor 检查与文档说明,并支持在项目配置里直接选择 OpenCode。
@@ -0,0 +1 @@
1
+ import{w as ce,o as Ne,a as u,c as me,b as m,d as e,e as S,u as $,t as g,G as Ve,I as We,n as T,F as ve,m as $e,f as L,l as Ge,g as Te,T as Ae,p as C,q as P,s as Re,A as ze,v as Ke}from"./index-C1w_TyJ6.js";import{A as Xe,n as Le,j as ke,r as Qe,f as ue,X as Oe,S as Me,L as Pe,k as Je,d as Ye,s as Ze,m as De,_ as et,P as tt,b as nt,o as st,B as at,p as lt,e as Ie,T as it,q as ot}from"./WorkbenchView-Dvfcqpk_.js";import{I as rt}from"./info-sxVO7QMl.js";function dt(a=[]){return(Array.isArray(a)&&a.length?a:Xe).filter(o=>o&&typeof o=="object").map(o=>{const b=Le(o.value);return{...o,value:b,label:String(o.label||ke(b)).trim()||ke(b),enabled:o.enabled!==!1,available:o.available!==!1}})}function Ee(a=[]){return dt(a).filter(B=>B.enabled&&B.available)}async function ut(){const a=await Qe("/api/meta",{cache:"no-store"});return Ee(a==null?void 0:a.agentEngineOptions)}const ct={class:"panel flex h-full w-full max-w-4xl flex-col overflow-hidden sm:h-auto sm:max-h-[86vh]"},mt={class:"theme-divider flex items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},vt={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},ft=["disabled"],pt={class:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5"},ht={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},gt={class:"flex items-start gap-2 text-xs leading-5"},xt={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},yt={class:"theme-muted-text mt-4 block text-xs"},bt={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)"}},wt={class:"mt-4 flex items-center gap-1.5"},St={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"},$t={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},kt={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Ct={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},_t={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},Pt={key:4,class:"theme-empty-state px-3 py-8 text-sm"},Tt={key:5,class:"theme-empty-state px-3 py-8 text-sm"},Lt={key:6,class:"theme-empty-state px-3 py-8 text-sm"},Et={key:7,class:"space-y-1"},Rt=["onClick"],Mt={class:"min-w-0 flex-1"},Dt=["innerHTML"],It=["innerHTML"],Ft={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},Bt={key:8,class:"space-y-1"},Nt={class:"flex items-start gap-1.5"},At=["onClick"],zt=["onClick"],Ot={class:"min-w-0 flex-1"},jt={key:0,class:"theme-muted-text truncate font-mono text-[10px]"},Ut={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"},Ht={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},qt=["disabled"],Vt=["disabled"],Wt={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""}},emits:["close","select"],setup(a,{emit:B}){const o=a,b=B,f=C(""),w=C(null),r=C(!1),d=C(""),x=C(!1),p=C(""),R=C([]),D=C(!1),E=C(""),k=C("tree"),M=C(""),N=C("");let I=null,j=0;const _=P(()=>q(w.value?[w.value]:[])),le=P(()=>k.value==="search"&&!E.value.trim()),Ce=P(()=>k.value==="search"&&!!E.value.trim()&&!x.value&&!p.value&&!R.value.length),J=P(()=>k.value==="tree"&&!r.value&&!d.value&&!_.value.length);function Y(n=""){const l=String(n||"").trim();return/^[a-z]:[\\/]/i.test(l)||l.includes("\\")}function y(n=""){const l=String(n||"").trim();if(!l)return"";const s=Y(l);let c=l.replace(/\\/g,"/");return c.length>1&&!/^[a-z]:\/?$/i.test(c)&&c!=="/"&&(c=c.replace(/\/+$/,"")),s?c.toLowerCase():c}function X(n="",l=""){const s=y(n),c=y(l);return!s||!c?!1:s===c||s.startsWith(`${c}/`)}function fe(n="",l=""){const s=String(n||"").trim(),c=String(l||"").trim();return s?c?Y(s)?/^[a-z]:\\?$/i.test(s)?`${s.replace(/[\\/]+$/,"")}\\${c}`:`${s.replace(/[\\/]+$/,"")}\\${c}`:s==="/"?`/${c}`:`${s.replace(/\/+$/,"")}/${c}`:s:c}function ie(n="",l=""){const s=y(n),c=y(l);if(!s||!c||!X(c,s))return[];const F=c===s?"":c.slice(s.length).replace(/^\//,"");return F?F.split("/").filter(Boolean):[]}function Z(n){return(n==null?void 0:n.name)||(n==null?void 0:n.path)||"未命名目录"}function pe(n=""){const l=String(n||"").trim();return l?l.split(/[\\/]/).filter(Boolean).at(-1)||l:"Home"}function Q(n=""){return String(n||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function he(n="",l=""){const s=String(n||""),c=String(l||"").trim().toLowerCase();if(!s||!c)return null;const F=s.toLowerCase(),O=F.indexOf(c);if(O>=0)return{start:O,end:O+c.length};const _e=c.split(/[\\/\s_.-]+/).filter(Boolean).sort((W,G)=>G.length-W.length);for(const W of _e){if(W.length<2)continue;const G=F.indexOf(W);if(G>=0)return{start:G,end:G+W.length}}return null}function ge(n="",l=""){const s=String(n||""),c=he(s,l);return c?`${Q(s.slice(0,c.start))}<mark class="rounded bg-[var(--theme-warningSoft)] px-0.5 text-inherit">${Q(s.slice(c.start,c.end))}</mark>${Q(s.slice(c.end))}`:Q(s)}function xe(n){return ge(Z(n),E.value)}function ye(n){return ge((n==null?void 0:n.path)||"",E.value)}function A(n,l=0){return{...n,depth:l,expanded:!1,loaded:!1,loading:!1,children:[]}}function q(n=[],l=[]){return n.forEach(s=>{l.push(s),s.expanded&&s.children.length&&q(s.children,l)}),l}function V(){w.value&&(w.value={...w.value})}function ee(n,l=w.value?[w.value]:[]){const s=y(n);if(!s)return null;for(const c of l){if(y(c.path)===s)return c;if(c.children.length){const F=ee(n,c.children);if(F)return F}}return null}function U(n){M.value=String((n==null?void 0:n.path)||"").trim(),N.value=Z(n)}async function te(n,l={}){if(!(!n||n.loading)&&!(n.loaded&&!l.force)){n.loading=!0,d.value="",V();try{const s=await De({path:n.path,limit:240});n.children=(s.items||[]).map(c=>A(c,n.depth+1)),n.loaded=!0}catch(s){d.value=s.message||"目录加载失败。"}finally{n.loading=!1,V()}}}async function oe(){r.value=!0,d.value="";try{const n=await De({limit:240});f.value=String(n.path||""),w.value=A({name:pe(n.path||""),path:String(n.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),w.value.children=(n.items||[]).map(l=>A(l,1)),w.value.loaded=!0,w.value.expanded=!0,U(w.value)}catch(n){d.value=n.message||"目录树加载失败。",w.value=null,f.value=""}finally{r.value=!1}}async function ne(n=""){const l=String(n||"").trim();if(!l||!f.value||!X(l,f.value))return;let s=w.value;if(!s)return;U(s);const c=ie(f.value,l);for(const F of c){await te(s),s.expanded=!0,V();const O=ee(fe(s.path,F),s.children);if(!O)break;s=O,U(s)}}async function be(){E.value="",k.value="tree",R.value=[],p.value="",D.value=!1,M.value="",N.value="",await oe();const n=String(o.initialPath||"").trim();n&&X(n,f.value)&&await ne(n)}async function se(n){if(n!=null&&n.path&&(U(n),!!n.hasChildren)){if(!n.loaded){n.expanded=!0,V(),await te(n);return}n.expanded=!n.expanded,V()}}function H(n){n!=null&&n.path&&(U(n),k.value="tree")}async function re(){const n=String(E.value||"").trim();j+=1;const l=j;if(!o.open||!n||!f.value){x.value=!1,p.value="",R.value=[],D.value=!1;return}x.value=!0,p.value="";try{const s=await Ze(n,{path:f.value,limit:80});if(l!==j)return;R.value=Array.isArray(s.items)?s.items:[],D.value=!!s.truncated}catch(s){if(l!==j)return;p.value=s.message||"搜索失败。",R.value=[],D.value=!1}finally{l===j&&(x.value=!1)}}function we(){if(I&&(window.clearTimeout(I),I=null),!String(E.value||"").trim()){x.value=!1,p.value="",R.value=[],D.value=!1;return}x.value=!0,p.value="",I=window.setTimeout(()=>{re()},120)}async function de(n){n!=null&&n.path&&(k.value="tree",await ne(n.path))}function Se(){M.value&&(b("select",M.value),b("close"))}function ae(n){o.open&&n.key==="Escape"&&b("close")}return ce(E,()=>{k.value=E.value.trim()?"search":"tree",we()}),ce(()=>o.open,n=>{if(document.body.classList.toggle("overflow-hidden",n),n){window.addEventListener("keydown",ae),be().catch(()=>{});return}window.removeEventListener("keydown",ae),I&&(window.clearTimeout(I),I=null)}),Ne(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",ae),I&&window.clearTimeout(I)}),(n,l)=>(u(),me(Ae,{to:"body"},[a.open?(u(),m("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-[60] flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:l[5]||(l[5]=Te(s=>!(r.value||x.value)&&b("close"),["self"]))},[e("section",ct,[e("div",mt,[e("div",null,[e("div",vt,[S($(ue),{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:r.value||x.value,onClick:l[0]||(l[0]=s=>b("close"))},[S($(Oe),{class:"h-4 w-4"})],8,ft)]),e("div",pt,[e("div",ht,[e("div",gt,[l[8]||(l[8]=e("span",{class:"theme-muted-text shrink-0"},"当前选中",-1)),e("span",xt,g(M.value||"请在目录树或搜索结果里选择目录"),1)])]),e("label",yt,[l[9]||(l[9]=e("span",null,"搜索目录",-1)),e("div",bt,[S($(Me),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),Ve(e("input",{"onUpdate:modelValue":l[1]||(l[1]=s=>E.value=s),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),[[We,E.value]])])]),e("div",wt,[e("button",{type:"button",class:T(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",k.value==="search"?"tool-button-primary":"theme-filter-idle border-dashed"]),onClick:l[2]||(l[2]=s=>k.value="search")},[S($(Me),{class:"h-3.5 w-3.5"}),l[10]||(l[10]=e("span",null,"搜索",-1))],2),e("button",{type:"button",class:T(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",k.value==="tree"?"tool-button-primary":"theme-filter-idle border-dashed"]),onClick:l[3]||(l[3]=s=>k.value="tree")},[S($(ue),{class:"h-3.5 w-3.5"}),l[11]||(l[11]=e("span",null,"目录树",-1))],2)]),e("div",St,[k.value==="search"&&p.value?(u(),m("div",$t,g(p.value),1)):k.value==="tree"&&d.value?(u(),m("div",kt,g(d.value),1)):k.value==="search"&&x.value?(u(),m("div",Ct,[S($(Pe),{class:"h-4 w-4 animate-spin"}),l[12]||(l[12]=e("span",null,"搜索中...",-1))])):k.value==="tree"&&r.value?(u(),m("div",_t,[S($(Pe),{class:"h-4 w-4 animate-spin"}),l[13]||(l[13]=e("span",null,"目录树加载中...",-1))])):le.value?(u(),m("div",Pt," 输入关键词后,只会在当前用户目录下搜索。 ")):Ce.value?(u(),m("div",Tt," 没搜到匹配目录,试试更短的关键词,或者直接用目录树浏览。 ")):J.value?(u(),m("div",Lt," 当前没有可显示的目录。 ")):k.value==="search"?(u(),m("div",Et,[(u(!0),m(ve,null,$e(R.value,s=>(u(),m("button",{key:s.path,type:"button",class:T(["flex w-full items-start gap-2 rounded-sm border border-transparent px-2.5 py-1.5 text-left transition",y(M.value)===y(s.path)?"bg-[var(--theme-appPanelInset)]":"hover:bg-[var(--theme-appPanelMuted)]"]),onClick:c=>de(s)},[S($(ue),{class:"theme-muted-text mt-0.5 h-4 w-4 shrink-0"}),e("div",Mt,[e("div",null,[e("span",{class:"truncate text-[13px] text-[var(--theme-textPrimary)]",innerHTML:xe(s)},null,8,Dt)]),e("div",{class:"theme-muted-text truncate font-mono text-[10px]",innerHTML:ye(s)},null,8,It)])],10,Rt))),128)),D.value?(u(),m("p",Ft," 搜索结果已截断,只展示最相关的一部分目录。 ")):L("",!0)])):(u(),m("div",Bt,[(u(!0),m(ve,null,$e(_.value,s=>(u(),m("div",{key:s.path,class:T(["rounded-sm border border-transparent px-1.5 py-1 transition",y(M.value)===y(s.path)?"bg-[var(--theme-appPanelInset)]":s.expanded?"bg-[var(--theme-appPanelMuted)]":"hover:bg-[var(--theme-appPanelMuted)]"]),style:Ge({paddingLeft:`${s.depth*16+6}px`})},[e("div",Nt,[e("button",{type:"button",class:T(["theme-icon-button h-5 w-5 shrink-0",s.hasChildren?"":"invisible pointer-events-none"]),onClick:Te(c=>se(s),["stop"])},[s.loading?(u(),me($(Pe),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(u(),me($(Je),{key:1,class:T(["h-3.5 w-3.5 transition",s.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,At),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:c=>H(s)},[S($(ue),{class:T(["h-4 w-4 shrink-0",y(M.value)===y(s.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),e("div",Ot,[e("div",{class:T(["truncate text-[13px]",s.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},g(Z(s)),3),s.isHomeRoot?(u(),m("div",jt,g(s.path),1)):L("",!0)])],8,zt)])],6))),128))]))])]),e("div",Ut,[e("div",Ht,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:r.value||x.value,onClick:l[4]||(l[4]=s=>b("close"))}," 取消 ",8,qt),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:r.value||x.value||!M.value,onClick:Se},[S($(Ye),{class:"h-4 w-4"}),l[14]||(l[14]=e("span",null,"使用当前目录",-1))],8,Vt)])])])])):L("",!0)]))}},Gt={class:"grid gap-4"},Kt={class:"theme-muted-text block text-xs"},Xt=["value","disabled"],Qt={class:"theme-muted-text block text-xs"},Jt={class:"mt-1 flex gap-2"},Yt=["value","disabled"],Zt=["disabled"],en={id:"codex-manager-workspace-suggestions"},tn=["value"],nn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},sn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},an={class:"theme-muted-text block text-xs"},ln={class:"mt-1"},on={class:"flex items-center gap-2 text-sm"},rn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},dn=["disabled","onClick"],un={class:"flex items-center justify-between gap-3"},cn={class:"min-w-0 flex-1 truncate"},mn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},vn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Fe={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},canEditEngine:{type:Boolean,default:!0},canEditCwd:{type:Boolean,default:!0},cwd:{type:String,default:""},cwdReadonlyMessage:{type:String,default:""},duplicateCwdMessage:{type:String,default:""},engine:{type:String,default:"codex"},engineOptions:{type:Array,default:()=>[]},engineReadonlyMessage:{type:String,default:""},mobile:{type:Boolean,default:!1},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["open-directory-picker","update:cwd","update:engine","update:title"],setup(a,{emit:B}){const o=a,b=B,f=P(()=>{const w=String(o.engine||"").trim();return o.engineOptions.find(r=>String((r==null?void 0:r.value)||"").trim()===w)||null});return(w,r)=>(u(),m("div",Gt,[e("label",Kt,[r[4]||(r[4]=e("span",null,"项目标题(可选)",-1)),e("input",{value:a.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:a.busy,onInput:r[0]||(r[0]=d=>b("update:title",d.target.value))},null,40,Xt)]),e("label",Qt,[r[5]||(r[5]=e("span",null,"工作目录",-1)),e("div",Jt,[e("input",{value:a.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:T(["tool-input min-w-0 flex-1 disabled:cursor-not-allowed disabled:opacity-80",a.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:a.busy||!a.canEditCwd,onInput:r[1]||(r[1]=d=>b("update:cwd",d.target.value))},null,42,Yt),e("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:a.busy||!a.canEditCwd,onClick:r[2]||(r[2]=d=>b("open-directory-picker"))},[S($(ue),{class:"h-4 w-4"}),e("span",null,g(a.mobile?"选择":"选择目录"),1)],8,Zt)]),e("datalist",en,[(u(!0),m(ve,null,$e(a.workspaceSuggestions,d=>(u(),m("option",{key:d,value:d},null,8,tn))),128))]),a.duplicateCwdMessage?(u(),m("p",nn,g(a.duplicateCwdMessage),1)):a.cwdReadonlyMessage?(u(),m("p",sn,g(a.cwdReadonlyMessage),1)):L("",!0)]),e("label",an,[r[6]||(r[6]=e("span",null,"执行引擎",-1)),e("div",ln,[S(et,{"model-value":a.engine,options:a.engineOptions,disabled:a.busy||!a.canEditEngine,placeholder:"请选择执行引擎","empty-text":"暂无可用执行引擎","get-option-value":d=>(d==null?void 0:d.value)||"","onUpdate:modelValue":r[3]||(r[3]=d=>b("update:engine",d))},{trigger:Re(({disabled:d})=>{var x;return[e("div",on,[e("span",{class:T(["min-w-0 flex-1 truncate",d?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},g(((x=f.value)==null?void 0:x.label)||"请选择执行引擎"),3),f.value&&f.value.enabled===!1?(u(),m("span",rn," 即将支持 ")):L("",!0)])]}),option:Re(({option:d,selected:x,select:p})=>[e("button",{type:"button",class:T(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",x?"theme-filter-active":"theme-filter-idle"]),disabled:(d==null?void 0:d.enabled)===!1,onClick:p},[e("div",un,[e("span",cn,g(d.label),1),(d==null?void 0:d.enabled)===!1?(u(),m("span",mn," 即将支持 ")):L("",!0)])],10,dn)]),_:1},8,["model-value","options","disabled","get-option-value"])]),a.engineReadonlyMessage?(u(),m("p",vn,g(a.engineReadonlyMessage),1)):L("",!0)])]))}},fn={class:"flex items-center justify-between gap-3"},pn={key:0,class:"theme-muted-text mt-1 text-xs"},hn=["disabled"],gn=["onClick"],xn={key:0,class:"absolute inset-y-3 left-0 w-1 rounded-full bg-[var(--theme-accent)]"},yn={class:"w-full text-left"},bn={class:"theme-heading flex flex-wrap items-center gap-2 text-sm font-medium"},wn={class:"truncate"},Sn={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},$n={class:"theme-muted-text mt-2 text-[11px]"},kn={class:"theme-muted-text mt-2 break-all font-mono text-[11px] leading-5"},Cn={key:0,class:"theme-muted-text mt-2 text-[11px]"},Be={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:a=>a},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(a,{emit:B}){const o=a,b=B;function f(d){return o.mode==="edit"&&o.editingSessionId===d.id?"border-[var(--theme-accent)] bg-[var(--theme-accentSoft)] text-[var(--theme-textPrimary)] shadow-md shadow-[color-mix(in_srgb,var(--theme-accent)_18%,transparent)]":o.isSessionRunning(d.id)?"border-[var(--theme-warning)] bg-[var(--theme-appPanelMuted)] text-[var(--theme-textPrimary)] hover:bg-[var(--theme-appPanelHover)]":"border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelStrong)] hover:border-[var(--theme-borderStrong)] hover:bg-[var(--theme-appPanel)]"}function w(d){return o.isCurrentSession(d.id)?"当前":"普通"}function r(d){return o.isCurrentSession(d.id)?"theme-status-info":"theme-status-neutral"}return(d,x)=>(u(),m(ve,null,[e("div",fn,[e("div",null,[x[1]||(x[1]=e("div",{class:"theme-heading text-sm font-medium"},"项目列表",-1)),a.hasSessions?L("",!0):(u(),m("p",pn," 还没有项目,先新建一个固定工作目录。 "))]),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:a.busy,onClick:x[0]||(x[0]=p=>b("create"))},[S($(tt),{class:"h-4 w-4"}),x[2]||(x[2]=e("span",null,"新建",-1))],8,hn)]),e("div",{class:T(["mt-4 space-y-2",a.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)]"])},[(u(!0),m(ve,null,$e(a.sessions,p=>(u(),m("article",{key:p.id,class:T(["relative cursor-pointer rounded-sm border p-3 transition",f(p)]),onClick:R=>b("select",p.id)},[a.mode==="edit"&&a.editingSessionId===p.id?(u(),m("span",xn)):L("",!0),e("div",yn,[e("div",bn,[e("span",wn,g(p.title||"未命名项目"),1),e("span",{class:T(["rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",r(p)])},g(w(p)),3),e("span",{class:T(["inline-flex items-center gap-1 rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",a.getRuntimeStatusClass(p.id)])},[a.isSessionRunning(p.id)?(u(),m("span",Sn)):L("",!0),ze(" "+g(a.getRuntimeStatusLabel(p.id)),1)],2),e("span",{class:T(["rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",a.getThreadStatusClass(p)])},g(a.getThreadStatusLabel(p)),3)]),e("div",$n," 引擎:"+g($(ke)(p.engine)),1),e("div",kn,g(p.cwd),1),a.mobile?L("",!0):(u(),m("div",Cn," 最近更新:"+g(a.formatUpdatedAt(p.updatedAt)),1))])],10,gn))),128))],2)],64))}},_n={class:"space-y-3"},Pn={class:"dashed-panel px-3 py-3"},Tn={class:"mt-2 flex flex-wrap gap-2"},Ln={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},En={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},Rn={class:"dashed-panel px-3 py-3"},Mn={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},Dn={class:"dashed-panel px-3 py-3"},In={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},Fn={class:"dashed-panel px-3 py-3"},Bn={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},Nn={class:"dashed-panel px-3 py-3"},An={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},zn={__name:"CodexSessionManagerStatus",props:{activeSession:{type:Object,default:null},formatUpdatedAt:{type:Function,default:a=>a},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(a){return(B,o)=>{var b,f,w,r,d,x,p;return u(),m("div",_n,[e("div",Pn,[o[0]||(o[0]=e("div",{class:"theme-muted-text text-[11px]"},"运行状态",-1)),e("div",Tn,[e("span",{class:T(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",a.getRuntimeStatusClass((b=a.activeSession)==null?void 0:b.id)])},[a.isSessionRunning((f=a.activeSession)==null?void 0:f.id)?(u(),m("span",Ln)):L("",!0),ze(" "+g(a.getRuntimeStatusLabel((w=a.activeSession)==null?void 0:w.id)),1)],2),e("span",{class:T(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",a.getThreadStatusClass(a.activeSession)])},g(a.getThreadStatusLabel(a.activeSession)),3),(r=a.activeSession)!=null&&r.id&&a.isCurrentSession(a.activeSession.id)?(u(),m("span",En," 当前项目 ")):L("",!0)])]),e("div",Rn,[o[1]||(o[1]=e("div",{class:"theme-muted-text text-[11px]"},"执行引擎",-1)),e("div",Mn,g($(ke)((d=a.activeSession)==null?void 0:d.engine)),1)]),e("div",Dn,[o[2]||(o[2]=e("div",{class:"theme-muted-text text-[11px]"},"工作目录",-1)),e("div",In,g(((x=a.activeSession)==null?void 0:x.cwd)||"未设置"),1)]),e("div",Fn,[o[3]||(o[3]=e("div",{class:"theme-muted-text text-[11px]"},"最近更新",-1)),e("div",Bn,g(a.formatUpdatedAt((p=a.activeSession)==null?void 0:p.updatedAt)),1)]),e("div",Nn,[e("div",An,[S($(rt),{class:"h-3.5 w-3.5"}),o[4]||(o[4]=e("span",null,"说明",-1))]),o[5]||(o[5]=e("p",{class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"}," 项目绑定目录与执行引擎,目录不变时会继续复用同一条引擎会话。 ",-1))])])}}},On={class:"panel flex h-full w-full max-w-5xl flex-col overflow-hidden sm:h-auto sm:max-h-[88vh]"},jn={class:"theme-divider flex flex-wrap items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},Un={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Hn={class:"flex items-center gap-2"},qn=["disabled"],Vn={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},Wn={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"},Gn={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},Kn={class:"flex flex-wrap items-start justify-between gap-3"},Xn={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Qn={class:"mt-5"},Jn={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Yn={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"},Zn={class:"flex flex-wrap items-center gap-2"},es=["disabled"],ts={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},ns=["disabled"],ss=["disabled"],as=["disabled"],ls={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},is={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},os={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},rs={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},ds={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},us=["disabled"],cs={class:"min-w-0 flex-1"},ms={class:"theme-heading truncate text-sm font-medium"},vs={key:0,class:"theme-muted-text mt-1 truncate text-xs"},fs={class:"theme-divider border-b px-4 py-3"},ps={class:"grid grid-cols-2 gap-2"},hs=["disabled"],gs={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},xs={key:0},ys={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},bs={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},ws=["disabled"],Ss=["disabled"],_s={__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(a,{emit:B}){const o=a,b=B,f=C("edit"),w=C(""),r=Ke({title:"",engine:"codex",cwd:""}),d=C(""),x=C(!1),p=C(!1),R=C(!1),D=C(!1),E=C(!1),{matches:k}=nt("(max-width: 767px)"),M=C("list"),N=C("basic"),I=C(Ee()),j=P(()=>V(o.sessions)),_=P(()=>o.sessions.find(t=>t.id===w.value)||null),le=P(()=>o.sessions.length>0),Ce=P(()=>o.sessions.find(t=>t.id===o.selectedSessionId)||null),J=P(()=>{var t;return!((t=_.value)!=null&&t.started)}),Y=P(()=>{var t;return!((t=_.value)!=null&&t.started)}),y=P(()=>o.loading||x.value||p.value||R.value),X=P(()=>{var h,v;const t=new Set,i=[];return[r.cwd,(h=_.value)==null?void 0:h.cwd,(v=Ce.value)==null?void 0:v.cwd,...o.workspaces,...o.sessions.map(K=>K.cwd)].forEach(K=>{const z=String(K||"").trim();!z||t.has(z)||(t.add(z),i.push(z))}),i.slice(0,12)}),fe=P(()=>I.value),ie=P(()=>{const t=ye(r.cwd);return t?o.sessions.filter(i=>{var h;return i.id===((h=_.value)==null?void 0:h.id)?!1:ye(i.cwd)===t}):[]}),Z=P(()=>{if(!ie.value.length)return"";const t=ie.value.slice(0,3).map(h=>`「${h.title||"未命名项目"}」`).join("、"),i=ie.value.length>3?"等项目":"项目";return`该目录已被${t}${i}使用,建议优先复用,避免把同一目录拆成多个项目。`}),pe=P(()=>f.value!=="edit"||J.value?"":"当前项目已绑定执行引擎会话,工作目录不能再修改;如需使用新目录,请新建项目。"),Q=P(()=>f.value!=="edit"||!_.value||Y.value?"":"当前项目已绑定执行引擎会话,执行引擎不能再修改;如需更换,请新建项目。"),he=P(()=>f.value==="create"?x.value?"创建中...":"创建项目":p.value?"保存中...":"保存修改"),ge=P(()=>{var t;return f.value==="create"?"新建项目":((t=_.value)==null?void 0:t.title)||"未命名项目"});function xe(t=""){const i=Date.parse(String(t||""));return Number.isFinite(i)?i:0}function ye(t=""){const i=String(t||"").trim();if(!i)return"";const h=/^[a-z]:[\\/]/i.test(i)||i.includes("\\");let v=i.replace(/\\/g,"/");return v.length>1&&!/^[a-z]:\/$/i.test(v)&&(v=v.replace(/\/+$/,"")),h?v.toLowerCase():v}function A(t){var i;return!!((i=o.sessions.find(h=>h.id===t))!=null&&i.running)}function q(t){return!!t&&t===o.selectedSessionId}function V(t=[]){return[...t].sort((i,h)=>{const v=Number(A(h.id))-Number(A(i.id));if(v)return v;const K=Number(q(h.id))-Number(q(i.id));if(K)return K;const z=xe(h.updatedAt)-xe(i.updatedAt);return z||String(i.title||i.cwd||i.id).localeCompare(String(h.title||h.cwd||h.id),"zh-CN")})}function ee(t){return A(t)?"运行中":"空闲"}function U(t){return A(t)?"theme-status-warning":"theme-status-success"}function te(t){return t!=null&&t.started?"已绑定线程":"未启动"}function oe(t){return t!=null&&t.started?"theme-status-success":"theme-status-neutral"}function ne(t=""){if(!t)return"未知";const i=new Date(t);return Number.isNaN(i.getTime())?t:i.toLocaleString("zh-CN")}function be(t){r.title=String((t==null?void 0:t.title)||""),r.engine=Le(t==null?void 0:t.engine),r.cwd=String((t==null?void 0:t.cwd)||"")}function se(){f.value="create",w.value="",d.value="",r.title="",r.engine="codex",r.cwd=""}function H(t){const i=o.sessions.find(h=>h.id===t);i&&(f.value="edit",w.value=i.id,d.value="",be(i))}function re(){var t;return o.selectedSessionId&&o.sessions.some(i=>i.id===o.selectedSessionId)?o.selectedSessionId:((t=j.value[0])==null?void 0:t.id)||""}function we(t="basic"){M.value="detail",N.value=t}function de(){M.value="list",N.value="basic"}function Se(){se(),k.value&&we("basic")}function ae(t){y.value||(H(t),k.value&&we("basic"))}function n(t){r.cwd=String(t||"").trim()}function l(t){r.title=String(t||"")}function s(t){r.engine=Le(t)}function c(t){r.cwd=String(t||"")}function F(){d.value="",D.value=!1,N.value="basic",M.value=k.value?"list":"detail";const t=re();if(t){H(t);return}se()}function O(t){!o.open||y.value||t.key==="Escape"&&b("close")}async function _e(){if(!(y.value||typeof o.onRefresh!="function")){d.value="";try{await Promise.all([o.onRefresh(),W()])}catch(t){d.value=t.message}}}async function W(){try{I.value=await ut()}catch{I.value=Ee()}}async function G(){if(!y.value){d.value="";try{const t=je();if(!t)return;await Ue(t)}catch(t){d.value=t.message}}}function je(){if(f.value==="create"){const i=String(r.cwd||"").trim();return i?{type:"create",cwd:i,payload:{title:r.title,engine:r.engine,cwd:i}}:(d.value="请先填写工作目录。",null)}if(!_.value)return d.value="当前项目不存在,请重新选择。",null;const t={title:r.title,engine:r.engine};return J.value&&(t.cwd=r.cwd),{type:"update",sessionId:_.value.id,payload:t}}async function Ue(t){var i,h;if(t.type==="create"){x.value=!0;try{const v=await((i=o.onCreate)==null?void 0:i.call(o,t.payload));v!=null&&v.id&&(H(v.id),b("select-session",v.id));return}finally{x.value=!1}}p.value=!0;try{const v=await((h=o.onUpdate)==null?void 0:h.call(o,t.sessionId,t.payload));v!=null&&v.id&&H(v.id)}finally{p.value=!1}}async function He(){var i,h;if(!_.value||R.value)return;const t=_.value.id;d.value="",R.value=!0;try{const v=await((i=o.onDelete)==null?void 0:i.call(o,t));D.value=!1;const K=o.sessions.filter(qe=>qe.id!==t),z=(v==null?void 0:v.selectedSessionId)||((h=V(K)[0])==null?void 0:h.id)||"";b("select-session",z),z?(H(z),k.value&&de()):(se(),k.value&&de())}catch(v){d.value=v.message}finally{R.value=!1}}return ce(()=>o.open,t=>{if(document.body.classList.toggle("overflow-hidden",t),t){window.addEventListener("keydown",O),F(),typeof o.onRefresh=="function"?_e().catch(()=>{}):W().catch(()=>{});return}window.removeEventListener("keydown",O),E.value=!1,D.value=!1,d.value=""},{immediate:!0}),ce(k,t=>{t||(M.value="detail")},{immediate:!0}),ce(()=>o.sessions,()=>{if(!o.open)return;if(f.value==="create"){if(!!(String(r.title||"").trim()||String(r.cwd||"").trim()))return;const h=re();h&&H(h);return}if(_.value){be(_.value);return}const t=re();if(t){H(t);return}se()}),Ne(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",O)}),(t,i)=>{var h;return u(),me(Ae,{to:"body"},[a.open?(u(),m("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-50 flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:i[10]||(i[10]=Te(v=>!y.value&&b("close"),["self"]))},[e("section",On,[S(st,{open:D.value,title:"确认删除 PromptX 项目?",description:_.value?`将删除「${_.value.title||"未命名项目"}」这条本地记录,不会删除工作目录,也不会删除对应执行引擎的历史数据。`:"","confirm-text":"确认删除","cancel-text":"先保留",loading:R.value,danger:"",onCancel:i[0]||(i[0]=v=>D.value=!1),onConfirm:He},null,8,["open","description","loading"]),S(Wt,{open:E.value,"initial-path":r.cwd,suggestions:X.value,onClose:i[1]||(i[1]=v=>E.value=!1),onSelect:n},null,8,["open","initial-path","suggestions"]),e("div",jn,[e("div",null,[e("div",Un,[S($(at),{class:"h-4 w-4"}),i[11]||(i[11]=e("span",null,"PromptX 项目管理",-1))])]),e("div",Hn,[e("button",{type:"button",class:"theme-icon-button h-9 w-9",disabled:y.value,onClick:i[2]||(i[2]=v=>b("close"))},[S($(Oe),{class:"h-4 w-4"})],8,qn)])]),$(k)?(u(),m("div",ls,[M.value==="list"?(u(),m("div",is,[e("div",os,[S(Be,{mobile:"",busy:y.value,"editing-session-id":w.value,"format-updated-at":ne,"get-runtime-status-class":U,"get-runtime-status-label":ee,"get-thread-status-class":oe,"get-thread-status-label":te,"has-sessions":le.value,"is-current-session":q,"is-session-running":A,mode:f.value,sessions:j.value,onCreate:Se,onSelect:ae},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(u(),m("div",rs,[e("div",ds,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-1.5 px-3 py-2 text-xs",disabled:y.value,onClick:de},[S($(ot),{class:"h-4 w-4"}),i[12]||(i[12]=e("span",null,"列表",-1))],8,us),e("div",cs,[e("div",ms,g(ge.value),1),f.value==="edit"&&((h=_.value)!=null&&h.cwd)?(u(),m("p",vs,g(_.value.cwd),1)):L("",!0)])]),e("div",fs,[e("div",ps,[e("button",{type:"button",class:T(["tool-button px-3 py-2 text-sm",N.value==="basic"?"tool-button-primary":""]),onClick:i[6]||(i[6]=v=>N.value="basic")}," 基本信息 ",2),e("button",{type:"button",class:T(["tool-button px-3 py-2 text-sm",N.value==="status"?"tool-button-primary":""]),disabled:f.value==="create",onClick:i[7]||(i[7]=v=>N.value="status")}," 状态 ",10,hs)])]),e("div",gs,[N.value==="basic"?(u(),m("div",xs,[S(Fe,{mobile:"",busy:y.value,"can-edit-engine":f.value!=="edit"||Y.value,"can-edit-cwd":f.value!=="edit"||J.value,cwd:r.cwd,"cwd-readonly-message":pe.value,"duplicate-cwd-message":Z.value,engine:r.engine,"engine-options":fe.value,"engine-readonly-message":Q.value,title:r.title,"workspace-suggestions":X.value,onOpenDirectoryPicker:i[8]||(i[8]=v=>E.value=!0),"onUpdate:cwd":c,"onUpdate:engine":s,"onUpdate:title":l},null,8,["busy","can-edit-engine","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","title","workspace-suggestions"]),d.value?(u(),m("p",ys,[S($(Ie),{class:"h-4 w-4"}),e("span",null,g(d.value),1)])):L("",!0),e("div",bs,[e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-sm",disabled:y.value,onClick:G},g(he.value),9,ws),f.value==="edit"&&_.value?(u(),m("button",{key:0,type:"button",class:"tool-button theme-danger-text theme-danger-hover w-full px-3 py-2 text-sm",disabled:y.value||a.sending,onClick:i[9]||(i[9]=v=>D.value=!0)},g(R.value?"删除中...":"删除项目"),9,Ss)):L("",!0)])])):(u(),me(zn,{key:1,"active-session":_.value,"format-updated-at":ne,"get-runtime-status-class":U,"get-runtime-status-label":ee,"get-thread-status-class":oe,"get-thread-status-label":te,"is-current-session":q,"is-session-running":A},null,8,["active-session"]))])]))])):(u(),m("div",Vn,[e("aside",Wn,[S(Be,{busy:y.value,"editing-session-id":w.value,"format-updated-at":ne,"get-runtime-status-class":U,"get-runtime-status-label":ee,"get-thread-status-class":oe,"get-thread-status-label":te,"has-sessions":le.value,"is-current-session":q,"is-session-running":A,mode:f.value,sessions:j.value,onCreate:Se,onSelect:ae},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),e("div",Gn,[e("div",Kn,[e("div",null,[e("div",Xn,[S($(lt),{class:"h-4 w-4"}),e("span",null,g(f.value==="create"?"新建项目":"编辑项目"),1)])])]),e("div",Qn,[S(Fe,{busy:y.value,"can-edit-engine":f.value!=="edit"||Y.value,"can-edit-cwd":f.value!=="edit"||J.value,cwd:r.cwd,"cwd-readonly-message":pe.value,"duplicate-cwd-message":Z.value,engine:r.engine,"engine-options":fe.value,"engine-readonly-message":Q.value,title:r.title,"workspace-suggestions":X.value,onOpenDirectoryPicker:i[3]||(i[3]=v=>E.value=!0),"onUpdate:cwd":c,"onUpdate:engine":s,"onUpdate:title":l},null,8,["busy","can-edit-engine","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","title","workspace-suggestions"])]),d.value?(u(),m("p",Jn,[S($(Ie),{class:"h-4 w-4"}),e("span",null,g(d.value),1)])):L("",!0),e("div",Yn,[e("div",Zn,[f.value==="edit"&&_.value?(u(),m("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:y.value||a.sending,onClick:i[4]||(i[4]=v=>D.value=!0)},[S($(it),{class:"h-4 w-4"}),e("span",null,g(R.value?"删除中...":"删除项目"),1)],8,es)):L("",!0)]),e("div",ts,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:y.value,onClick:i[5]||(i[5]=v=>b("close"))}," 关闭 ",8,ns),f.value==="create"&&le.value?(u(),m("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:y.value,onClick:F}," 返回列表 ",8,ss)):L("",!0),e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-xs sm:w-auto",disabled:y.value,onClick:G},g(he.value),9,as)])])])]))])])):L("",!0)])}}};export{_s as default};
@@ -1,4 +1,4 @@
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-B3UXxmEa.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-COApDo0z.js";/**
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-C1w_TyJ6.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-Dvfcqpk_.js";/**
2
2
  * @license lucide-vue-next v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -9,4 +9,4 @@ 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
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
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 o=r==="run"?"run":r==="task"?"task":"workspace";return[String(e||"").trim(),o,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,o=0){for(e.delete(r),e.set(r,ze(i));o>0&&e.size>o;){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
- `),o=[];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]),o.push({id:`hunk-${l}`,kind:"hunk",oldNumber:"",newNumber:"",content:p});return}if(p.startsWith("+")&&!p.startsWith("+++")){o.push({id:`line-${l}`,kind:"add",oldNumber:"",newNumber:y,content:p}),y+=1;return}if(p.startsWith("-")&&!p.startsWith("---")){o.push({id:`line-${l}`,kind:"delete",oldNumber:d,newNumber:"",content:p}),d+=1;return}if(p.startsWith(" ")){o.push({id:`line-${l}`,kind:"context",oldNumber:d,newNumber:y,content:p}),d+=1,y+=1;return}o.push({id:`line-${l}`,kind:"meta",oldNumber:"",newNumber:"",content:p})}),o}function lt(e){const r=C("workspace"),i=C(""),o=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)),oe=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===o.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")),ue=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 u(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){o.value="";return}t.some(n=>n.path===o.value)||(o.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,events:"none"});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(o.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(o.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&&(o.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(()=>[o.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(()=>o.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:o,selectedPatchHunks:D,selectedPatchLines:le,selectedRunId:i,setPatchLineRef:ye,showSummarySkeleton:ue,statsLoading:g,statusCounts:oe,statusFilter:d,terminalRuns:ee,formatRunOptionLabel:u}}const it={class:"mb-3 flex flex-wrap gap-2"},ot=["onClick"],ut={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,o=r,d=j({get:()=>i.fileSearch,set:l=>o("update:fileSearch",l)}),y=j({get:()=>i.statusFilter,set:l=>o("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,ot)),64))]),a("label",ut,[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=>o("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]=o=>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]=o=>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]=o=>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]=o=>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,o=>{var d;return c(),v("div",{key:o.id,ref_for:!0,ref:y=>e.setPatchLineRef(o.id,y),class:w(["grid grid-cols-[56px_56px_minmax(0,1fr)]",[e.getPatchLineClass(o.kind),o.kind==="hunk"&&((d=e.selectedPatchHunks[e.activeHunkIndex])==null?void 0:d.id)===o.id?"ring-1 ring-inset ring-[var(--theme-warning)]":""]])},[a("span",Vt,h(o.oldNumber),1),a("span",Bt,h(o.newNumber),1),a("pre",zt,h(o.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"},os={key:2,class:"flex flex-1 items-center justify-center px-5"},us={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:o,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:oe,showSummarySkeleton:O,statsLoading:ne,statusCounts:le,statusFilter:D,terminalRuns:ue}=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")}),(_,u)=>{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:u[0]||(u[0]=m=>y.value="workspace")},[...u[12]||(u[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:u[1]||(u[1]=m=>y.value="task")},[...u[13]||(u[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:u[2]||(u[2]=m=>y.value="run")},[...u[14]||(u[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:u[3]||(u[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"]),u[15]||(u[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":u[4]||(u[4]=m=>Oe(ee)?ee.value=m:null),class:"min-w-0 sm:max-w-[360px]",options:s(ue),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(ue).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",os,[a("div",us,[a("div",rs,[k(s(Be),{class:"h-4 w-4"}),u[16]||(u[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),u[21]||(u[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},[u[17]||(u[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},[u[18]||(u[18]=a("span",{class:"opacity-50"},"•",-1)),u[19]||(u[19]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-successSoft)]"},null,-1)),u[20]||(u[20]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-dangerSoft)]"},null,-1))],64)):(c(),v("span",$s,"等待统计"))])]),s(o)?(c(),v("p",Fs,h(s(o)),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:u[5]||(u[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:u[6]||(u[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":u[7]||(u[7]=m=>l.value=m),"onUpdate:statusFilter":u[8]||(u[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(oe),"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":u[9]||(u[9]=m=>l.value=m),"onUpdate:statusFilter":u[10]||(u[10]=m=>D.value=m),onSelectFile:u[11]||(u[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(oe),"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,o=r,d=j(()=>{const p=String(i.taskTitle||"").trim();return p?`代码变更 · ${p}`:"代码变更"});function y(p){i.open&&p.key==="Escape"&&o("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=>o("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=>o("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};
12
+ `),o=[];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]),o.push({id:`hunk-${l}`,kind:"hunk",oldNumber:"",newNumber:"",content:p});return}if(p.startsWith("+")&&!p.startsWith("+++")){o.push({id:`line-${l}`,kind:"add",oldNumber:"",newNumber:y,content:p}),y+=1;return}if(p.startsWith("-")&&!p.startsWith("---")){o.push({id:`line-${l}`,kind:"delete",oldNumber:d,newNumber:"",content:p}),d+=1;return}if(p.startsWith(" ")){o.push({id:`line-${l}`,kind:"context",oldNumber:d,newNumber:y,content:p}),d+=1,y+=1;return}o.push({id:`line-${l}`,kind:"meta",oldNumber:"",newNumber:"",content:p})}),o}function lt(e){const r=C("workspace"),i=C(""),o=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)),oe=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===o.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")),ue=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 u(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){o.value="";return}t.some(n=>n.path===o.value)||(o.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,events:"none"});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(o.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(o.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&&(o.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(()=>[o.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(()=>o.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:o,selectedPatchHunks:D,selectedPatchLines:le,selectedRunId:i,setPatchLineRef:ye,showSummarySkeleton:ue,statsLoading:g,statusCounts:oe,statusFilter:d,terminalRuns:ee,formatRunOptionLabel:u}}const it={class:"mb-3 flex flex-wrap gap-2"},ot=["onClick"],ut={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,o=r,d=j({get:()=>i.fileSearch,set:l=>o("update:fileSearch",l)}),y=j({get:()=>i.statusFilter,set:l=>o("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,ot)),64))]),a("label",ut,[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=>o("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]=o=>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]=o=>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]=o=>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]=o=>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,o=>{var d;return c(),v("div",{key:o.id,ref_for:!0,ref:y=>e.setPatchLineRef(o.id,y),class:w(["grid grid-cols-[56px_56px_minmax(0,1fr)]",[e.getPatchLineClass(o.kind),o.kind==="hunk"&&((d=e.selectedPatchHunks[e.activeHunkIndex])==null?void 0:d.id)===o.id?"ring-1 ring-inset ring-[var(--theme-warning)]":""]])},[a("span",Vt,h(o.oldNumber),1),a("span",Bt,h(o.newNumber),1),a("pre",zt,h(o.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"},os={key:2,class:"flex flex-1 items-center justify-center px-5"},us={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:o,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:oe,showSummarySkeleton:O,statsLoading:ne,statusCounts:le,statusFilter:D,terminalRuns:ue}=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")}),(_,u)=>{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:u[0]||(u[0]=m=>y.value="workspace")},[...u[12]||(u[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:u[1]||(u[1]=m=>y.value="task")},[...u[13]||(u[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:u[2]||(u[2]=m=>y.value="run")},[...u[14]||(u[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:u[3]||(u[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"]),u[15]||(u[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":u[4]||(u[4]=m=>Oe(ee)?ee.value=m:null),class:"min-w-0 sm:max-w-[360px]",options:s(ue),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(ue).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",os,[a("div",us,[a("div",rs,[k(s(Be),{class:"h-4 w-4"}),u[16]||(u[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),u[21]||(u[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},[u[17]||(u[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},[u[18]||(u[18]=a("span",{class:"opacity-50"},"•",-1)),u[19]||(u[19]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-successSoft)]"},null,-1)),u[20]||(u[20]=a("span",{class:"h-3 w-10 animate-pulse rounded bg-[var(--theme-dangerSoft)]"},null,-1))],64)):(c(),v("span",$s,"等待统计"))])]),s(o)?(c(),v("p",Fs,h(s(o)),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:u[5]||(u[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:u[6]||(u[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":u[7]||(u[7]=m=>l.value=m),"onUpdate:statusFilter":u[8]||(u[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(oe),"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":u[9]||(u[9]=m=>l.value=m),"onUpdate:statusFilter":u[10]||(u[10]=m=>D.value=m),onSelectFile:u[11]||(u[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(oe),"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,o=r,d=j(()=>{const p=String(i.taskTitle||"").trim();return p?`代码变更 · ${p}`:"代码变更"});function y(p){i.open&&p.key==="Escape"&&o("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:"theme-modal-backdrop fixed inset-0 z-50 flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:l[1]||(l[1]=Ke(S=>o("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=>o("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,21 @@
1
+ import{a as l,b as o,d as e,t as c,u as p,F as P,m as R,n as L,l as D,c as y,f as C,J as Z,q as j,w as ee,o as te,e as B,G as M,K as se,I as F,L as ne,A as ae,g as le,T as oe,p as u,v as re,z as ie}from"./index-C1w_TyJ6.js";import{c as E,r as A,d as de,h as ce,X as ue,L as me,i as ve}from"./WorkbenchView-Dvfcqpk_.js";import{I as he}from"./info-sxVO7QMl.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 pe=E("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
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 xe=E("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
12
+ * @license lucide-vue-next v0.577.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const fe=E("palette",[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]);/**
17
+ * @license lucide-vue-next v0.577.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const X=E("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);function be(){return A("/api/relay/config",{cache:"no-store"})}function q(g){return A("/api/relay/config",{method:"PUT",body:JSON.stringify(g)})}const ye={class:"space-y-4"},ge={class:"flex items-center justify-between gap-3"},_e={class:"theme-toggle-current theme-muted-text rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelStrong)] px-2 py-1 text-[11px]"},ke={class:"space-y-4"},we={class:"theme-muted-text px-1 text-[10px] font-medium uppercase tracking-[0.16em]"},Ce=["onClick"],Se={class:"flex items-start gap-3"},Te={class:"mt-0.5 flex items-center gap-1.5"},$e={class:"min-w-0 flex-1"},Be={class:"flex items-center justify-between gap-2"},Me={class:"truncate text-sm font-medium"},Pe={class:"theme-muted-text mt-1 text-[11px] leading-5"},Re={class:"theme-toggle-card__preview mt-2 flex items-center gap-2"},Ee={__name:"ThemeToggle",setup(g){const{currentTheme:_,setTheme:S,themes:f}=Z(),b=j(()=>{const x=f.filter(d=>d.mode==="light"),m=f.filter(d=>d.mode==="dark");return[{id:"light",label:"浅色主题",items:x},{id:"dark",label:"深色主题",items:m}].filter(d=>d.items.length)});function k(x){S(x)}return(x,m)=>(l(),o("div",ye,[e("div",null,[e("div",ge,[m[0]||(m[0]=e("div",{class:"theme-heading text-sm font-medium"},"界面主题",-1)),e("div",_e," 当前:"+c(p(_).shortName),1)]),m[1]||(m[1]=e("div",{class:"theme-muted-text mt-1 text-xs leading-5"},"像编辑器一样切换整套配色,而不只是深浅模式。",-1))]),e("div",ke,[(l(!0),o(P,null,R(b.value,d=>(l(),o("section",{key:d.id,class:"space-y-1.5"},[e("div",we,c(d.label),1),(l(!0),o(P,null,R(d.items,a=>(l(),o("button",{key:a.id,type:"button",class:L(["theme-option theme-toggle-card w-full rounded-sm border px-3 py-2 text-left transition",a.id===p(_).id?"theme-option-active":"theme-option-idle"]),onClick:h=>k(a.id)},[e("div",Se,[e("div",Te,[(l(!0),o(P,null,R(a.swatches,(h,r)=>(l(),o("span",{key:`${a.id}-${r}`,class:"h-3 w-3 rounded-full border border-black/10",style:D({backgroundColor:h})},null,4))),128))]),e("div",$e,[e("div",Be,[e("span",Me,c(a.name),1),a.id===p(_).id?(l(),y(p(de),{key:0,class:"h-4 w-4 shrink-0"})):C("",!0)]),e("div",Pe,c(a.description),1),e("div",Re,[e("span",{class:"h-7 flex-1 rounded-[10px] border",style:D({background:`linear-gradient(180deg, ${a.swatches[1]} 0%, ${a.swatches[0]} 100%)`,borderColor:a.swatches[2]||a.swatches[0]})},null,4),e("span",{class:"h-7 w-10 rounded-[10px] border",style:D({backgroundColor:a.swatches[3]||a.swatches[0],borderColor:a.swatches[2]||a.swatches[0]})},null,4)])])])],10,Ce))),128))]))),128))])]))}},Ie={class:"panel settings-dialog-panel flex h-full w-full max-w-5xl flex-col overflow-hidden sm:h-[42rem] sm:max-h-[88vh]"},Ue={class:"theme-divider settings-dialog-header flex items-start justify-between gap-4 border-b px-5 py-4"},De={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Le={class:"settings-dialog-body min-h-0 flex flex-1 flex-col sm:flex-row"},je={class:"theme-divider settings-dialog-nav border-b px-3 py-3 sm:w-60 sm:shrink-0 sm:border-b-0 sm:border-r sm:px-4 sm:py-4"},Ve={class:"settings-nav flex gap-2 overflow-x-auto sm:flex-col sm:overflow-visible"},ze=["onClick"],Ne={class:"min-w-0"},Fe={class:"text-sm font-medium"},Xe={class:"theme-muted-text mt-1 hidden text-xs leading-5 sm:block"},qe={class:"settings-dialog-content min-h-0 flex-1 overflow-y-auto px-5 py-5"},Ae={key:0,class:"space-y-4"},Ge={class:"settings-section-card rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelMuted)] px-4 py-4"},Je={key:1,class:"space-y-4"},Ke={class:"flex items-start justify-between gap-3"},Oe={class:"theme-heading inline-flex items-center gap-2 text-base font-medium"},We={class:"settings-section-card space-y-4 rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelMuted)] px-4 py-4"},He={class:"settings-form-card flex items-center justify-between gap-3 rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelStrong)] px-3 py-2"},Qe=["disabled"],Ye={class:"grid gap-4 sm:grid-cols-2"},Ze={class:"space-y-1.5 sm:col-span-2"},et=["disabled"],tt={class:"space-y-1.5"},st=["disabled"],nt={class:"space-y-1.5"},at={class:"relative"},lt=["type","disabled"],ot=["disabled"],rt={class:"settings-form-footer flex flex-wrap items-center justify-between gap-3"},it={class:"min-w-0 space-y-1"},dt={key:0,class:"theme-status-warning text-xs leading-5"},ct={key:1,class:"theme-danger-text text-xs leading-5"},ut={key:2,class:"theme-status-success text-xs leading-5"},mt={key:3,class:"theme-danger-text text-xs leading-5"},vt={key:4,class:"theme-muted-text text-xs leading-5"},ht={key:0},pt={key:5,class:"theme-muted-text text-xs leading-5"},xt={key:6,class:"theme-muted-text text-xs leading-5"},ft=["disabled"],bt={key:2,class:"space-y-4"},yt={class:"settings-section-card rounded-sm border border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelMuted)] px-4 py-4"},gt={class:"flex items-center justify-between gap-3"},_t={class:"theme-muted-text mt-1 text-xs leading-5"},kt={class:"rounded-sm border border-dashed border-[var(--theme-borderStrong)] bg-[var(--theme-appPanelStrong)] px-2.5 py-1 text-xs font-medium text-[var(--theme-textSecondary)]"},$t={__name:"WorkbenchSettingsDialog",props:{open:{type:Boolean,default:!1}},emits:["close"],setup(g,{emit:_}){const S=g,f=_,b=u(""),k=u(!1),x=u(""),m=u(!1),d=u(!1),a=u(""),h=u(""),r=u(null),v=u(!1),T=u(!1),$=u(!1),n=re({enabled:!1,relayUrl:"",deviceId:"",deviceToken:""}),w=u("theme"),G=[{id:"theme",label:"主题",description:"界面风格与配色",icon:fe},{id:"relay",label:"远程",description:"Relay 与手机访问",icon:X},{id:"about",label:"关于",description:"版本与说明",icon:he}],J=j(()=>{var t;return d.value||T.value?"保存中...":m.value?"读取中...":(t=r.value)!=null&&t.connected?"已连接":n.enabled?"未连接":"未启用"}),K=j(()=>{var t;return(t=r.value)!=null&&t.connected?"theme-status-success":n.enabled?"theme-status-warning":"theme-status-neutral"});async function O(){k.value=!0,x.value="";try{const t=await ve(),s=String((t==null?void 0:t.version)||"").trim();b.value=s,s||(x.value="当前服务暂未返回版本号,请确认已重启到最新版本。")}catch(t){b.value="",x.value=(t==null?void 0:t.message)||"版本信息读取失败。"}finally{k.value=!1}}function I(t={}){n.enabled=!!(t!=null&&t.enabled),n.relayUrl=String((t==null?void 0:t.relayUrl)||""),n.deviceId=String((t==null?void 0:t.deviceId)||""),n.deviceToken=String((t==null?void 0:t.deviceToken)||"")}async function W(){m.value=!0,a.value="",h.value="";try{const t=await be();I((t==null?void 0:t.config)||{}),v.value=!!(t!=null&&t.managedByEnv),r.value=(t==null?void 0:t.relay)||null}catch(t){a.value=(t==null?void 0:t.message)||"远程访问配置读取失败。",r.value=null}finally{m.value=!1}}async function H(){d.value=!0,a.value="",h.value="";try{const t=await q({enabled:n.enabled,relayUrl:n.relayUrl,deviceId:n.deviceId,deviceToken:n.deviceToken});I((t==null?void 0:t.config)||{}),v.value=!!(t!=null&&t.managedByEnv),r.value=(t==null?void 0:t.relay)||null,h.value=n.enabled?"远程访问配置已保存,PromptX 正在尝试连接 Relay。":"远程访问已关闭。"}catch(t){a.value=(t==null?void 0:t.message)||"远程访问配置保存失败。"}finally{d.value=!1}}function Q(){return!!(String(n.relayUrl||"").trim()&&String(n.deviceId||"").trim()&&String(n.deviceToken||"").trim())}async function Y(){var t;if(!v.value){if(a.value="",h.value="",n.enabled&&!Q()){n.enabled=!1,a.value="请先填写完整的 Relay 地址、设备 ID 和设备 Token,再启用远程访问。";return}T.value=!0;try{const s=await q({enabled:n.enabled,relayUrl:n.relayUrl,deviceId:n.deviceId,deviceToken:n.deviceToken});I((s==null?void 0:s.config)||{}),v.value=!!(s!=null&&s.managedByEnv),r.value=(s==null?void 0:s.relay)||null,h.value=n.enabled?"远程访问已启用,PromptX 正在尝试连接 Relay。":"远程访问已关闭。"}catch(s){n.enabled=!!((t=r.value)!=null&&t.enabled),a.value=(s==null?void 0:s.message)||"远程访问开关保存失败。"}finally{T.value=!1}}}function U(t){S.open&&t.key==="Escape"&&f("close")}return ee(()=>S.open,t=>{if(document.body.classList.toggle("overflow-hidden",t),t){window.addEventListener("keydown",U),w.value="theme",O(),W();return}window.removeEventListener("keydown",U)},{immediate:!0}),te(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",U)}),(t,s)=>{var V,z,N;return l(),y(oe,{to:"body"},[g.open?(l(),o("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-[70] flex items-center justify-center px-4 py-6",onClick:s[6]||(s[6]=le(i=>f("close"),["self"]))},[e("section",Ie,[e("div",Ue,[e("div",null,[e("div",De,[B(p(ce),{class:"h-4 w-4"}),s[7]||(s[7]=e("span",null,"设置",-1))])]),e("button",{type:"button",class:"theme-icon-button h-8 w-8 shrink-0",onClick:s[0]||(s[0]=i=>f("close"))},[B(p(ue),{class:"h-4 w-4"})])]),e("div",Le,[e("aside",je,[e("nav",Ve,[(l(),o(P,null,R(G,i=>e("button",{key:i.id,type:"button",class:L(["settings-nav__item flex min-w-0 items-start gap-3 rounded-sm border px-3 py-3 text-left transition sm:w-full",w.value===i.id?"border-[var(--theme-accent)] bg-[var(--theme-accentSoft)] text-[var(--theme-textPrimary)]":"border-dashed border-[var(--theme-borderDefault)] bg-[var(--theme-appPanelMuted)] hover:border-[var(--theme-borderStrong)] hover:bg-[var(--theme-appPanelStrong)]"]),onClick:wt=>w.value=i.id},[(l(),y(ie(i.icon),{class:"mt-0.5 h-4 w-4 shrink-0"})),e("div",Ne,[e("div",Fe,c(i.label),1),e("p",Xe,c(i.description),1)])],10,ze)),64))])]),e("div",qe,[w.value==="theme"?(l(),o("section",Ae,[s[8]||(s[8]=e("div",null,[e("div",{class:"theme-heading text-base font-medium"},"主题"),e("p",{class:"theme-muted-text mt-1 text-xs leading-5"},"这里先放界面主题,后面如果有排版、字号等偏好,也继续归到这一类。")],-1)),e("section",Ge,[B(Ee)])])):w.value==="relay"?(l(),o("section",Je,[e("div",Ke,[e("div",null,[e("div",Oe,[B(p(X),{class:"h-4 w-4"}),s[9]||(s[9]=e("span",null,"远程访问 Relay",-1))])]),e("span",{class:L(["rounded-sm border border-dashed px-2.5 py-1 text-xs font-medium",K.value])},c(J.value),3)]),e("section",We,[e("label",He,[s[10]||(s[10]=e("div",null,[e("div",{class:"text-sm font-medium text-[var(--theme-textPrimary)]"},"启用远程访问"),e("p",{class:"theme-muted-text mt-1 text-xs"},"关闭后,本机会主动断开当前 Relay 连接。")],-1)),M(e("input",{"onUpdate:modelValue":s[1]||(s[1]=i=>n.enabled=i),type:"checkbox",class:"h-4 w-4",disabled:v.value,onChange:Y},null,40,Qe),[[se,n.enabled]])]),e("div",Ye,[e("label",Ze,[s[11]||(s[11]=e("span",{class:"theme-muted-text text-xs"},"Relay 地址",-1)),M(e("input",{"onUpdate:modelValue":s[2]||(s[2]=i=>n.relayUrl=i),type:"text",placeholder:"https://user1.promptx.example.com",class:"w-full rounded-sm border border-[var(--theme-inputBorder)] bg-[var(--theme-inputBg)] px-3 py-2 text-sm text-[var(--theme-textPrimary)] outline-none transition focus:border-[var(--theme-borderStrong)]",disabled:v.value},null,8,et),[[F,n.relayUrl]])]),e("label",tt,[s[12]||(s[12]=e("span",{class:"theme-muted-text text-xs"},"设备 ID",-1)),M(e("input",{"onUpdate:modelValue":s[3]||(s[3]=i=>n.deviceId=i),type:"text",placeholder:"my-macbook",class:"w-full rounded-sm border border-[var(--theme-inputBorder)] bg-[var(--theme-inputBg)] px-3 py-2 text-sm text-[var(--theme-textPrimary)] outline-none transition focus:border-[var(--theme-borderStrong)]",disabled:v.value},null,8,st),[[F,n.deviceId]])]),e("label",nt,[s[13]||(s[13]=e("span",{class:"theme-muted-text text-xs"},"设备 Token",-1)),e("div",at,[M(e("input",{"onUpdate:modelValue":s[4]||(s[4]=i=>n.deviceToken=i),type:$.value?"text":"password",placeholder:"请输入云端 Relay 的设备 token",class:"w-full rounded-sm border border-[var(--theme-inputBorder)] bg-[var(--theme-inputBg)] px-3 py-2 pr-10 text-sm text-[var(--theme-textPrimary)] outline-none transition focus:border-[var(--theme-borderStrong)]",disabled:v.value},null,8,lt),[[ne,n.deviceToken]]),e("button",{type:"button",class:"theme-icon-button absolute inset-y-1 right-1 flex h-auto w-8 items-center justify-center",disabled:v.value,onClick:s[5]||(s[5]=i=>$.value=!$.value)},[$.value?(l(),y(p(pe),{key:1,class:"h-4 w-4"})):(l(),y(p(xe),{key:0,class:"h-4 w-4"}))],8,ot)])])]),e("div",rt,[e("div",it,[v.value?(l(),o("p",dt," 当前 Relay 配置由环境变量接管,设置页仅展示实际值,修改环境变量后需重启服务。 ")):C("",!0),a.value?(l(),o("p",ct,c(a.value),1)):h.value?(l(),o("p",ut,c(h.value),1)):(V=r.value)!=null&&V.lastError?(l(),o("p",mt," 最近错误:"+c(r.value.lastError),1)):(z=r.value)!=null&&z.lastCloseReason?(l(),o("p",vt,[ae(" 最近断开:"+c(r.value.lastCloseReason),1),r.value.lastCloseCode?(l(),o("span",ht,"(code "+c(r.value.lastCloseCode)+")",1)):C("",!0)])):(N=r.value)!=null&&N.lastConnectedAt?(l(),o("p",pt," 最近连接:"+c(new Date(r.value.lastConnectedAt).toLocaleString("zh-CN")),1)):(l(),o("p",xt," 建议公网 Relay 使用 HTTPS,并确保云端与本机使用同一个设备 Token;多租户时每个人填写自己的子域名地址。 "))]),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:m.value||d.value||T.value||v.value,onClick:H},[d.value?(l(),y(p(me),{key:0,class:"h-4 w-4 animate-spin"})):C("",!0),e("span",null,c(d.value?"保存中...":"保存远程访问配置"),1)],8,ft)])])])):(l(),o("section",bt,[s[15]||(s[15]=e("div",null,[e("div",{class:"theme-heading text-base font-medium"},"关于"),e("p",{class:"theme-muted-text mt-1 text-xs leading-5"},"这里先放版本信息,后面像更新日志、环境说明也可以继续往这里放。")],-1)),e("section",yt,[e("div",gt,[e("div",null,[s[14]||(s[14]=e("div",{class:"theme-heading text-sm font-medium"},"版本信息",-1)),e("p",_t,c(x.value||"当前已安装的 PromptX 版本。"),1)]),e("span",kt,c(k.value?"读取中...":b.value?`v${b.value}`:"不可用"),1)])])]))])])])])):C("",!0)])}}};export{$t as default};