agent-tower 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/git/git-cli.js +2 -2
- package/dist/git/git-cli.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-CB48v8IV.js → AgentDemoPage-B4p6JOaa.js} +1 -1
- package/dist/web/assets/{DemoPage-_dT9rdpV.js → DemoPage-a61F8WUp.js} +1 -1
- package/dist/web/assets/{GeneralSettingsPage-DtD_oirE.js → GeneralSettingsPage-CQmEjFi8.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-DQqz8xJs.js → NotificationSettingsPage-BRw2fFTj.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-BaFNyfse.js → ProfileSettingsPage-D-zyXwz1.js} +1 -1
- package/dist/web/assets/{ProjectKanbanPage-DNCKy0g4.js → ProjectKanbanPage-DSO5OEi0.js} +22 -22
- package/dist/web/assets/{ProjectSettingsPage-Cv6VpL1g.js → ProjectSettingsPage-CKb-5dhB.js} +1 -1
- package/dist/web/assets/{ProviderSettingsPage-BqmSJV2I.js → ProviderSettingsPage-dGoaMV8Q.js} +1 -1
- package/dist/web/assets/{button-Cg3N0RX4.js → button-yc8E-9mL.js} +1 -1
- package/dist/web/assets/{chevron-down-BZ2n6wh3.js → chevron-down-CgN79gJE.js} +1 -1
- package/dist/web/assets/{chevron-right-BrrhT2ph.js → chevron-right-DlWP8lVM.js} +1 -1
- package/dist/web/assets/{circle-alert-a6g1jQyL.js → circle-alert-CgMmay1J.js} +1 -1
- package/dist/web/assets/{circle-check-CQEg-cq1.js → circle-check-CSmMKb6_.js} +1 -1
- package/dist/web/assets/{code-block-OCS4YCEC-C72vBOSD.js → code-block-OCS4YCEC-DiXG3CzW.js} +1 -1
- package/dist/web/assets/{confirm-dialog-DmuQeQ0J.js → confirm-dialog-Q8BsN1Up.js} +1 -1
- package/dist/web/assets/{folder-picker-Dl5GZRtL.js → folder-picker-C45cXliN.js} +1 -1
- package/dist/web/assets/{index-D3_Vq2xm.js → index-DK-vt3Cl.js} +2 -2
- package/dist/web/assets/{loader-circle-DRKF9OZx.js → loader-circle-DYUWI5Dr.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-DyQsSSRd.js → mermaid-NOHMQCX5-C5mvGqWa.js} +3 -3
- package/dist/web/assets/{modal-wSbeXj_V.js → modal-BgEFLccc.js} +1 -1
- package/dist/web/assets/{pencil-CT2HBX6f.js → pencil-CjaX70qm.js} +1 -1
- package/dist/web/assets/{rotate-ccw-DkZPjdAj.js → rotate-ccw-CDDSxb2s.js} +1 -1
- package/dist/web/assets/{select-BRJQTh28.js → select-DKQPvWiV.js} +1 -1
- package/dist/web/assets/{use-profiles-zSSuAJaA.js → use-profiles-Brdh89vT.js} +1 -1
- package/dist/web/assets/{use-providers-BfLpM8PB.js → use-providers-Es21U-kq.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as se,u as B,r as l,g as ne,j as e,i as re,k as le,l as ae,m as ie,t as T}from"./index-D3_Vq2xm.js";import{B as S}from"./button-Cg3N0RX4.js";import{S as oe}from"./select-BRJQTh28.js";import{a as W,F as _,R as ce}from"./rotate-ccw-DkZPjdAj.js";import{X as J,P as Q,T as de,M as G}from"./modal-wSbeXj_V.js";import{FolderPicker as ue}from"./folder-picker-Dl5GZRtL.js";import"./utils-CkSf8FUe.js";import"./chevron-down-BZ2n6wh3.js";import"./chevron-right-BrrhT2ph.js";import"./loader-circle-DRKF9OZx.js";import"./circle-alert-a6g1jQyL.js";const xe=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],me=se("folder-plus",xe);function pe({value:t,onChange:g,repoPath:b,placeholder:v}){const{t:o}=B(),[i,c]=l.useState(""),[x,h]=l.useState([]),[N,r]=l.useState(!1),[u,y]=l.useState(-1),m=l.useRef(null),f=l.useRef(null),P=l.useRef(void 0),F=l.useCallback(async s=>{if(!b||!s){h([]),r(!1);return}try{const a=await ne.get("/filesystem/complete",{params:{basePath:b,prefix:s}});h(a.results),r(a.results.length>0),y(-1)}catch{h([]),r(!1)}},[b]);l.useEffect(()=>{if(clearTimeout(P.current),!i){h([]),r(!1);return}return P.current=setTimeout(()=>F(i),200),()=>clearTimeout(P.current)},[i,F]),l.useEffect(()=>{const s=a=>{f.current&&!f.current.contains(a.target)&&m.current&&!m.current.contains(a.target)&&r(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const k=s=>{const a=s.trim();!a||t.includes(a)||(g([...t,a]),c(""),r(!1),m.current?.focus())},z=s=>{g(t.filter((a,w)=>w!==s))},D=s=>{s.type==="directory"?(c(s.path),m.current?.focus()):k(s.path)},C=(s,a)=>{a.stopPropagation(),k(s.path.replace(/\/$/,""))},A=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||(N&&x.length>0?s.key==="ArrowDown"?(s.preventDefault(),y(a=>Math.min(a+1,x.length-1))):s.key==="ArrowUp"?(s.preventDefault(),y(a=>Math.max(a-1,-1))):s.key==="Enter"?(s.preventDefault(),u>=0?D(x[u]):k(i)):s.key==="Escape"&&r(!1):s.key==="Enter"&&(s.preventDefault(),k(i)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(W,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(_,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>z(a),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(J,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:m,type:"text",value:i,onChange:s=>c(s.target.value),onKeyDown:A,onFocus:()=>{i&&x.length>0&&r(!0)},placeholder:v??o("输入文件路径..."),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:()=>k(i),disabled:!i.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Q,{size:14}),e.jsx("span",{children:o("添加")})]})]}),N&&e.jsx("div",{ref:f,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:x.map((s,a)=>e.jsxs("button",{onClick:()=>D(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${a===u?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(_,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(W,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:w=>C(s,w),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:o("添加此目录"),children:e.jsx(me,{size:14})})]},s.path))})]})]})}function he({value:t,onChange:g}){const{t:b}=B(),[v,o]=l.useState(""),[i,c]=l.useState(""),x=()=>{const r=v.trim(),u=i.trim();!r||!u||(g([...t,{name:r,command:u}]),o(""),c(""))},h=r=>{g(t.filter((u,y)=>y!==r))},N=r=>{r.key==="Enter"&&!r.nativeEvent.isComposing&&r.nativeEvent.keyCode!==229&&(r.preventDefault(),x())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((r,u)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:r.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:r.command}),e.jsx("button",{onClick:()=>h(u),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(J,{size:14})})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:v,onChange:r=>o(r.target.value),onKeyDown:N,placeholder:b("名称"),className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:i,onChange:r=>c(r.target.value),onKeyDown:N,placeholder:b("命令"),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:x,disabled:!v.trim()||!i.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(Q,{size:14}),e.jsx("span",{children:b("添加")})]})]})]})}function fe(t){return t?t.split(",").map(g=>g.trim()).filter(Boolean):[]}function je(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function $(t){return typeof t.color!="string"||t.color.trim()===""?"bg-neutral-400":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-neutral-400"}function De(){const{t}=B(),{data:g,isLoading:b}=re({limit:100,includeArchived:!0}),v=le(),o=ae(),i=ie(),[c,x]=l.useState(""),[h,N]=l.useState(null),[r,u]=l.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[y,m]=l.useState(!1),[f,P]=l.useState(null),[F,k]=l.useState(!1),[z,D]=l.useState(!1),[C,A]=l.useState(!1),[s,a]=l.useState(!1),[w,I]=l.useState(""),R=g?.data??[],j=l.useMemo(()=>R.filter(n=>!n.archivedAt),[R]),E=l.useMemo(()=>R.filter(n=>n.archivedAt),[R]),d=j.find(n=>n.id===c),q=l.useMemo(()=>R.find(n=>n.id===f)??null,[f,R]);if(l.useEffect(()=>{!c&&j.length>0&&x(j[0].id)},[j,c]),l.useEffect(()=>{if(h){j.some(n=>n.id===h)&&(x(h),N(null));return}c&&!j.some(n=>n.id===c)&&(x(j[0]?.id??""),m(!1))},[j,h,c]),l.useEffect(()=>{d&&!y&&u({copyFiles:fe(d.copyFiles),setupScript:d.setupScript??"",quickCommands:je(d.quickCommands)})},[d,y]),b)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:t("加载中...")});if(R.length===0)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:t("暂无项目,请先创建项目")});const H=j.map(n=>({value:n.id,label:n.name})),V=()=>{c&&v.mutate({id:c,copyFiles:r.copyFiles.length>0?r.copyFiles.join(", "):null,setupScript:r.setupScript.trim()||null,quickCommands:r.quickCommands.length>0?JSON.stringify(r.quickCommands):null},{onSuccess:()=>m(!1)})},X=n=>{N(null),x(n),m(!1)},Z=()=>{d&&(P(d.id),A(!1),a(!1),k(!0))},O=()=>{o.isPending||(k(!1),P(null),A(!1),a(!1))},Y=async()=>{if(f)try{await o.mutateAsync({id:f,deleteRepo:C}),T.success(t(C?"项目已删除,并清理了本地文件":"项目已删除")),m(!1),O()}catch{}},ee=n=>{const p=E.find(U=>U.id===n);P(n),I(p?.repoDeletedAt?p.repoPath:""),D(!0)},M=()=>{i.isPending||(D(!1),P(null),I(""))},te=async()=>{if(!(!f||q?.repoDeletedAt&&!w.trim()))try{const p=await i.mutateAsync({id:f,repoPath:w.trim()||void 0});T.success(t("项目已恢复"));for(const U of p.warnings)T.warning(U);m(!1),N(p.project.id),x(p.project.id),M()}catch{}},K=q?.name??t("this project"),L=!!q?.repoDeletedAt;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-10 py-6 mx-auto w-full max-w-4xl space-y-8",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:t("项目配置")}),e.jsx("p",{className:"text-[12px] text-neutral-400",children:t("配置当前项目的 worktree 初始化行为,并在此页统一管理删除与恢复。")})]}),j.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-neutral-700 mb-2",children:t("选择项目")}),e.jsx(oe,{value:c,onChange:X,options:H,placeholder:t("选择项目...")})]}),d?e.jsx("div",{className:"rounded-xl border border-neutral-200 bg-neutral-50 px-4 py-4",children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${$(d)}`}),e.jsx("p",{className:"text-sm font-medium text-neutral-900",children:d.name})]}),e.jsx("p",{className:"text-xs text-neutral-500 break-all",children:d.repoPath}),d.repoRemoteUrl?e.jsxs("p",{className:"text-xs text-neutral-400 break-all",children:[t("Remote"),": ",d.repoRemoteUrl]}):null]}),e.jsxs("div",{className:"flex flex-col items-stretch gap-2 md:items-end",children:[e.jsxs(S,{size:"sm",variant:"destructive",onClick:Z,disabled:o.isPending||i.isPending,children:[e.jsx(de,{size:14}),t("删除项目")]}),e.jsx("p",{className:"text-[11px] text-neutral-500 md:max-w-56 md:text-right",children:t("删除后项目会从默认列表隐藏,但历史任务、workspace 与会话记录仍会保留。")})]})]})}):null]}):e.jsx("div",{className:"rounded-xl border border-dashed border-neutral-200 bg-neutral-50 px-4 py-5 text-sm text-neutral-500",children:t("当前没有可配置的项目。你可以先创建项目,或在下方恢复已删除项目。")})]}),d?e.jsxs(e.Fragment,{children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:t("自动复制文件")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:t("创建 worktree 时自动从主仓库复制的文件或目录。支持 glob 模式。")}),e.jsx(pe,{value:r.copyFiles,onChange:n=>{u(p=>({...p,copyFiles:n})),m(!0)},repoPath:d.repoPath}),e.jsx("p",{className:"text-[11px] text-neutral-400 mt-2",children:t("适用于不在 git 管理中但启动必需的文件,如 .env、node_modules、数据库文件等")})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:t("创建 worktree 后自动执行的命令,每行一条,按顺序执行。")}),e.jsx("textarea",{value:r.setupScript,onChange:n=>{u(p=>({...p,setupScript:n.target.value})),m(!0)},placeholder:`pnpm install
|
|
1
|
+
import{h as se,u as B,r as l,g as ne,j as e,i as re,k as le,l as ae,m as ie,t as T}from"./index-DK-vt3Cl.js";import{B as S}from"./button-yc8E-9mL.js";import{S as oe}from"./select-DKQPvWiV.js";import{a as W,F as _,R as ce}from"./rotate-ccw-CDDSxb2s.js";import{X as J,P as Q,T as de,M as G}from"./modal-BgEFLccc.js";import{FolderPicker as ue}from"./folder-picker-C45cXliN.js";import"./utils-CkSf8FUe.js";import"./chevron-down-CgN79gJE.js";import"./chevron-right-DlWP8lVM.js";import"./loader-circle-DYUWI5Dr.js";import"./circle-alert-CgMmay1J.js";const xe=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],me=se("folder-plus",xe);function pe({value:t,onChange:g,repoPath:b,placeholder:v}){const{t:o}=B(),[i,c]=l.useState(""),[x,h]=l.useState([]),[N,r]=l.useState(!1),[u,y]=l.useState(-1),m=l.useRef(null),f=l.useRef(null),P=l.useRef(void 0),F=l.useCallback(async s=>{if(!b||!s){h([]),r(!1);return}try{const a=await ne.get("/filesystem/complete",{params:{basePath:b,prefix:s}});h(a.results),r(a.results.length>0),y(-1)}catch{h([]),r(!1)}},[b]);l.useEffect(()=>{if(clearTimeout(P.current),!i){h([]),r(!1);return}return P.current=setTimeout(()=>F(i),200),()=>clearTimeout(P.current)},[i,F]),l.useEffect(()=>{const s=a=>{f.current&&!f.current.contains(a.target)&&m.current&&!m.current.contains(a.target)&&r(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const k=s=>{const a=s.trim();!a||t.includes(a)||(g([...t,a]),c(""),r(!1),m.current?.focus())},z=s=>{g(t.filter((a,w)=>w!==s))},D=s=>{s.type==="directory"?(c(s.path),m.current?.focus()):k(s.path)},C=(s,a)=>{a.stopPropagation(),k(s.path.replace(/\/$/,""))},A=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||(N&&x.length>0?s.key==="ArrowDown"?(s.preventDefault(),y(a=>Math.min(a+1,x.length-1))):s.key==="ArrowUp"?(s.preventDefault(),y(a=>Math.max(a-1,-1))):s.key==="Enter"?(s.preventDefault(),u>=0?D(x[u]):k(i)):s.key==="Escape"&&r(!1):s.key==="Enter"&&(s.preventDefault(),k(i)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(W,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(_,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>z(a),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(J,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:m,type:"text",value:i,onChange:s=>c(s.target.value),onKeyDown:A,onFocus:()=>{i&&x.length>0&&r(!0)},placeholder:v??o("输入文件路径..."),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:()=>k(i),disabled:!i.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(Q,{size:14}),e.jsx("span",{children:o("添加")})]})]}),N&&e.jsx("div",{ref:f,className:"absolute z-50 left-0 right-0 mt-1 bg-white border border-neutral-200 rounded-lg shadow-lg max-h-[200px] overflow-y-auto",children:x.map((s,a)=>e.jsxs("button",{onClick:()=>D(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${a===u?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(_,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(W,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:w=>C(s,w),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:o("添加此目录"),children:e.jsx(me,{size:14})})]},s.path))})]})]})}function he({value:t,onChange:g}){const{t:b}=B(),[v,o]=l.useState(""),[i,c]=l.useState(""),x=()=>{const r=v.trim(),u=i.trim();!r||!u||(g([...t,{name:r,command:u}]),o(""),c(""))},h=r=>{g(t.filter((u,y)=>y!==r))},N=r=>{r.key==="Enter"&&!r.nativeEvent.isComposing&&r.nativeEvent.keyCode!==229&&(r.preventDefault(),x())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((r,u)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:r.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:r.command}),e.jsx("button",{onClick:()=>h(u),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(J,{size:14})})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:v,onChange:r=>o(r.target.value),onKeyDown:N,placeholder:b("名称"),className:"w-28 shrink-0 px-3 py-2 border border-neutral-200 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsx("input",{type:"text",value:i,onChange:r=>c(r.target.value),onKeyDown:N,placeholder:b("命令"),className:"flex-1 px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300"}),e.jsxs("button",{onClick:x,disabled:!v.trim()||!i.trim(),className:"flex items-center gap-1 px-3 py-2 text-sm bg-neutral-900 text-white rounded-lg hover:bg-neutral-800 disabled:opacity-30 disabled:cursor-not-allowed transition-colors shrink-0",children:[e.jsx(Q,{size:14}),e.jsx("span",{children:b("添加")})]})]})]})}function fe(t){return t?t.split(",").map(g=>g.trim()).filter(Boolean):[]}function je(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function $(t){return typeof t.color!="string"||t.color.trim()===""?"bg-neutral-400":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-neutral-400"}function De(){const{t}=B(),{data:g,isLoading:b}=re({limit:100,includeArchived:!0}),v=le(),o=ae(),i=ie(),[c,x]=l.useState(""),[h,N]=l.useState(null),[r,u]=l.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[y,m]=l.useState(!1),[f,P]=l.useState(null),[F,k]=l.useState(!1),[z,D]=l.useState(!1),[C,A]=l.useState(!1),[s,a]=l.useState(!1),[w,I]=l.useState(""),R=g?.data??[],j=l.useMemo(()=>R.filter(n=>!n.archivedAt),[R]),E=l.useMemo(()=>R.filter(n=>n.archivedAt),[R]),d=j.find(n=>n.id===c),q=l.useMemo(()=>R.find(n=>n.id===f)??null,[f,R]);if(l.useEffect(()=>{!c&&j.length>0&&x(j[0].id)},[j,c]),l.useEffect(()=>{if(h){j.some(n=>n.id===h)&&(x(h),N(null));return}c&&!j.some(n=>n.id===c)&&(x(j[0]?.id??""),m(!1))},[j,h,c]),l.useEffect(()=>{d&&!y&&u({copyFiles:fe(d.copyFiles),setupScript:d.setupScript??"",quickCommands:je(d.quickCommands)})},[d,y]),b)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:t("加载中...")});if(R.length===0)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:t("暂无项目,请先创建项目")});const H=j.map(n=>({value:n.id,label:n.name})),V=()=>{c&&v.mutate({id:c,copyFiles:r.copyFiles.length>0?r.copyFiles.join(", "):null,setupScript:r.setupScript.trim()||null,quickCommands:r.quickCommands.length>0?JSON.stringify(r.quickCommands):null},{onSuccess:()=>m(!1)})},X=n=>{N(null),x(n),m(!1)},Z=()=>{d&&(P(d.id),A(!1),a(!1),k(!0))},O=()=>{o.isPending||(k(!1),P(null),A(!1),a(!1))},Y=async()=>{if(f)try{await o.mutateAsync({id:f,deleteRepo:C}),T.success(t(C?"项目已删除,并清理了本地文件":"项目已删除")),m(!1),O()}catch{}},ee=n=>{const p=E.find(U=>U.id===n);P(n),I(p?.repoDeletedAt?p.repoPath:""),D(!0)},M=()=>{i.isPending||(D(!1),P(null),I(""))},te=async()=>{if(!(!f||q?.repoDeletedAt&&!w.trim()))try{const p=await i.mutateAsync({id:f,repoPath:w.trim()||void 0});T.success(t("项目已恢复"));for(const U of p.warnings)T.warning(U);m(!1),N(p.project.id),x(p.project.id),M()}catch{}},K=q?.name??t("this project"),L=!!q?.repoDeletedAt;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-10 py-6 mx-auto w-full max-w-4xl space-y-8",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:t("项目配置")}),e.jsx("p",{className:"text-[12px] text-neutral-400",children:t("配置当前项目的 worktree 初始化行为,并在此页统一管理删除与恢复。")})]}),j.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[12px] font-medium text-neutral-700 mb-2",children:t("选择项目")}),e.jsx(oe,{value:c,onChange:X,options:H,placeholder:t("选择项目...")})]}),d?e.jsx("div",{className:"rounded-xl border border-neutral-200 bg-neutral-50 px-4 py-4",children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"space-y-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${$(d)}`}),e.jsx("p",{className:"text-sm font-medium text-neutral-900",children:d.name})]}),e.jsx("p",{className:"text-xs text-neutral-500 break-all",children:d.repoPath}),d.repoRemoteUrl?e.jsxs("p",{className:"text-xs text-neutral-400 break-all",children:[t("Remote"),": ",d.repoRemoteUrl]}):null]}),e.jsxs("div",{className:"flex flex-col items-stretch gap-2 md:items-end",children:[e.jsxs(S,{size:"sm",variant:"destructive",onClick:Z,disabled:o.isPending||i.isPending,children:[e.jsx(de,{size:14}),t("删除项目")]}),e.jsx("p",{className:"text-[11px] text-neutral-500 md:max-w-56 md:text-right",children:t("删除后项目会从默认列表隐藏,但历史任务、workspace 与会话记录仍会保留。")})]})]})}):null]}):e.jsx("div",{className:"rounded-xl border border-dashed border-neutral-200 bg-neutral-50 px-4 py-5 text-sm text-neutral-500",children:t("当前没有可配置的项目。你可以先创建项目,或在下方恢复已删除项目。")})]}),d?e.jsxs(e.Fragment,{children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:t("自动复制文件")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:t("创建 worktree 时自动从主仓库复制的文件或目录。支持 glob 模式。")}),e.jsx(pe,{value:r.copyFiles,onChange:n=>{u(p=>({...p,copyFiles:n})),m(!0)},repoPath:d.repoPath}),e.jsx("p",{className:"text-[11px] text-neutral-400 mt-2",children:t("适用于不在 git 管理中但启动必需的文件,如 .env、node_modules、数据库文件等")})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:t("创建 worktree 后自动执行的命令,每行一条,按顺序执行。")}),e.jsx("textarea",{value:r.setupScript,onChange:n=>{u(p=>({...p,setupScript:n.target.value})),m(!0)},placeholder:`pnpm install
|
|
2
2
|
pnpm run setup`,rows:4,className:"w-full px-3 py-2 border border-neutral-200 rounded-lg text-sm font-mono focus:outline-none focus:ring-1 focus:ring-neutral-300 resize-none"}),e.jsx("p",{className:"text-[11px] text-neutral-400 mt-1",children:t("命令在 worktree 目录下执行,单条命令超时 5 分钟,失败不会阻断后续命令")})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:t("常用命令")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:t("在终端中可快速执行的命令,不会自动运行。")}),e.jsx(he,{value:r.quickCommands,onChange:n=>{u(p=>({...p,quickCommands:n})),m(!0)}})]})]}):null,e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:t("已删除项目")}),e.jsx("p",{className:"text-[12px] text-neutral-400",children:t("这些项目不会出现在主看板里,但历史记录仍保留;如源码已删除,恢复时需要重新绑定 repoPath。")})]}),e.jsx("span",{className:"rounded-full bg-neutral-100 px-2.5 py-1 text-[11px] font-medium text-neutral-500",children:E.length})]}),E.length===0?e.jsx("div",{className:"rounded-xl border border-dashed border-neutral-200 bg-neutral-50 px-4 py-5 text-sm text-neutral-500",children:t("暂无已删除项目")}):e.jsx("div",{className:"space-y-3",children:E.map(n=>e.jsx("div",{className:"rounded-xl border border-neutral-200 bg-white px-4 py-4",children:e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{className:"space-y-2 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:`h-2.5 w-2.5 rounded-full ${$(n)}`}),e.jsx("p",{className:"text-sm font-medium text-neutral-900",children:n.name}),e.jsx("span",{className:"rounded-full bg-neutral-100 px-2 py-0.5 text-[10px] font-medium text-neutral-500",children:t("已删除")}),n.repoDeletedAt?e.jsx("span",{className:"rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-medium text-amber-700",children:t("源码已删除")}):null]}),n.repoDeletedAt?e.jsx("p",{className:"text-xs text-neutral-500",children:t("本地源码目录已删除,相关 Git/代码能力已禁用。恢复时需要重新绑定一个有效仓库路径。")}):e.jsx("p",{className:"text-xs text-neutral-500 break-all",children:n.repoPath}),n.repoRemoteUrl?e.jsxs("p",{className:"text-xs text-neutral-400 break-all",children:[t("Remote"),": ",n.repoRemoteUrl]}):null]}),e.jsxs(S,{size:"sm",variant:"outline",onClick:()=>ee(n.id),disabled:o.isPending||i.isPending,children:[e.jsx(ce,{size:14}),t("恢复")]})]})},n.id))})]}),y&&d?e.jsx("div",{className:"sticky bottom-6 flex justify-end",children:e.jsx(S,{size:"sm",onClick:V,disabled:v.isPending,children:v.isPending?t("保存中..."):t("保存")})}):null]}),e.jsx(G,{isOpen:F,onClose:O,title:t("Delete Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",onClick:O,disabled:o.isPending,children:t("Cancel")}),e.jsx(S,{variant:"destructive",onClick:Y,disabled:o.isPending||C&&!s,children:o.isPending?t("Deleting..."):t("Delete Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-neutral-600 leading-relaxed",children:t("项目「{title}」将从默认项目列表隐藏,但历史任务、workspace 和会话记录仍会保留。",{title:K})}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-neutral-200 bg-neutral-50 px-3 py-3",children:[e.jsx("input",{type:"checkbox",checked:C,onChange:n=>{A(n.target.checked),n.target.checked||a(!1)},className:"mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-neutral-900",children:t("同时删除本地项目文件")}),e.jsx("p",{className:"mt-1 text-xs text-neutral-500",children:t("勾选后会删除 repoPath 指向的本地仓库目录,并禁用代码/Git 相关能力。")})]})]}),C?e.jsxs("div",{className:"rounded-lg border border-red-200 bg-red-50 px-3 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-red-700",children:t("勾选后会连项目文件一起删除,请谨慎选择。")}),e.jsx("p",{className:"mt-1 text-xs text-red-600",children:t("恢复该项目时需要重新绑定一个有效的 Git 仓库路径。")}),e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-xs text-red-700",children:[e.jsx("input",{type:"checkbox",checked:s,onChange:n=>a(n.target.checked),className:"mt-0.5"}),e.jsx("span",{children:t("我已确认这会删除本地项目文件")})]})]}):null,o.isError?e.jsx("p",{className:"text-xs text-red-500",children:o.error instanceof Error?o.error.message:t("Failed to delete project")}):null]})}),e.jsx(G,{isOpen:z,onClose:M,title:t("Restore Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"outline",onClick:M,disabled:i.isPending,children:t("Cancel")}),e.jsx(S,{onClick:te,disabled:i.isPending||L&&!w.trim(),children:i.isPending?t("Restoring..."):t("Restore Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-neutral-600 leading-relaxed",children:L?t("项目「{title}」的本地仓库文件已删除。恢复前需要重新绑定一个有效的 Git 仓库路径。",{title:K}):t("恢复后,项目会重新出现在默认项目列表中。")}),L?e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-neutral-700 mb-1.5",children:t("Repository Path")}),e.jsx(ue,{value:w,onChange:I}),e.jsx("p",{className:"mt-2 text-xs text-neutral-400",children:t("Agent Tower 会尽量校验仓库 identity;如果 remote URL 或目录名不同,会给出警告但允许继续。")})]}):null,i.isError?e.jsx("p",{className:"text-xs text-red-500",children:i.error instanceof Error?i.error.message:t("Failed to restore project")}):null]})})]})}export{De as ProjectSettingsPage};
|
package/dist/web/assets/{ProviderSettingsPage-BqmSJV2I.js → ProviderSettingsPage-dGoaMV8Q.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as X,d as be,q as ve,g as ye,u as T,r as w,j as n,t as P,n as Q}from"./index-
|
|
1
|
+
import{h as X,d as be,q as ve,g as ye,u as T,r as w,j as n,t as P,n as Q}from"./index-DK-vt3Cl.js";import{u as je,a as we,b as Ne,c as Ce,d as Ee,e as ke,f as Pe}from"./use-providers-Es21U-kq.js";import{B as E}from"./button-yc8E-9mL.js";import{C as _e,A as N}from"./confirm-dialog-Q8BsN1Up.js";import{P as re,T as se,M as q}from"./modal-BgEFLccc.js";import{S as le}from"./select-DKQPvWiV.js";import"./log-adapter-50wgehrc.js";import{c as U}from"./utils-CkSf8FUe.js";import{C as ae}from"./chevron-down-CgN79gJE.js";import{P as Oe}from"./pencil-CjaX70qm.js";import{C as Ie}from"./circle-check-CSmMKb6_.js";const Te=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Ae=X("circle-x",Te);const Se=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],De=X("download",Se);const Le=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Re=X("upload",Le);function Me(e,t){let l=e.slice(0,t).split(/\r\n|\n|\r/g);return[l.length,l.pop().length+1]}function Fe(e,t,l){let i=e.split(/\r\n|\n|\r/g),a="",s=(Math.log10(t+1)|0)+1;for(let r=t-1;r<=t+1;r++){let o=i[r-1];o&&(a+=r.toString().padEnd(s," "),a+=": ",a+=o,a+=`
|
|
2
2
|
`,r===t&&(a+=" ".repeat(s+l+2),a+=`^
|
|
3
3
|
`))}return a}class f extends Error{line;column;codeblock;constructor(t,l){const[i,a]=Me(l.toml,l.ptr),s=Fe(l.toml,i,a);super(`Invalid TOML document: ${t}
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as p}from"./index-
|
|
1
|
+
import{r as a,j as p}from"./index-DK-vt3Cl.js";import{a as V,c as k}from"./utils-CkSf8FUe.js";const y=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,b=V,E=(t,n)=>e=>{var i;if(n?.variants==null)return b(t,e?.class,e?.className);const{variants:r,defaultVariants:s}=n,u=Object.keys(r).map(o=>{const c=e?.[o],d=s?.[o];if(c===null)return null;const v=y(c)||y(d);return r[o][v]}),l=e&&Object.entries(e).reduce((o,c)=>{let[d,v]=c;return v===void 0||(o[d]=v),o},{}),f=n==null||(i=n.compoundVariants)===null||i===void 0?void 0:i.reduce((o,c)=>{let{class:d,className:v,...x}=c;return Object.entries(x).every(C=>{let[m,g]=C;return Array.isArray(g)?g.includes({...s,...l}[m]):{...s,...l}[m]===g})?[...o,d,v]:o},[]);return b(t,u,f,e?.class,e?.className)};function h(t,n){if(typeof t=="function")return t(n);t!=null&&(t.current=n)}function S(...t){return n=>{let e=!1;const i=t.map(r=>{const s=h(r,n);return!e&&typeof s=="function"&&(e=!0),s});if(e)return()=>{for(let r=0;r<i.length;r++){const s=i[r];typeof s=="function"?s():h(t[r],null)}}}}function j(t){const n=_(t),e=a.forwardRef((i,r)=>{const{children:s,...u}=i,l=a.Children.toArray(s),f=l.find(R);if(f){const o=f.props.children,c=l.map(d=>d===f?a.Children.count(o)>1?a.Children.only(null):a.isValidElement(o)?o.props.children:null:d);return p.jsx(n,{...u,ref:r,children:a.isValidElement(o)?a.cloneElement(o,void 0,c):null})}return p.jsx(n,{...u,ref:r,children:s})});return e.displayName=`${t}.Slot`,e}var z=j("Slot");function _(t){const n=a.forwardRef((e,i)=>{const{children:r,...s}=e;if(a.isValidElement(r)){const u=w(r),l=O(s,r.props);return r.type!==a.Fragment&&(l.ref=i?S(i,u):u),a.cloneElement(r,l)}return a.Children.count(r)>1?a.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var N=Symbol("radix.slottable");function R(t){return a.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===N}function O(t,n){const e={...n};for(const i in n){const r=t[i],s=n[i];/^on[A-Z]/.test(i)?r&&s?e[i]=(...l)=>{const f=s(...l);return r(...l),f}:r&&(e[i]=r):i==="style"?e[i]={...r,...s}:i==="className"&&(e[i]=[r,s].filter(Boolean).join(" "))}return{...t,...e}}function w(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,e=n&&"isReactWarning"in n&&n.isReactWarning;return e?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,e=n&&"isReactWarning"in n&&n.isReactWarning,e?t.props.ref:t.props.ref||t.ref)}const P=E("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function I({className:t,variant:n="default",size:e="default",asChild:i=!1,...r}){const s=i?z:"button";return p.jsx(s,{"data-slot":"button","data-variant":n,"data-size":e,className:k(P({variant:n,size:e,className:t})),...r})}export{I as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as o}from"./index-
|
|
1
|
+
import{h as o}from"./index-DK-vt3Cl.js";const c=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=o("check",c);const e=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],s=o("chevron-down",e);export{s as C,t as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as o}from"./index-
|
|
1
|
+
import{h as o}from"./index-DK-vt3Cl.js";const t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],h=o("chevron-right",t);export{h as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./index-
|
|
1
|
+
import{h as e}from"./index-DK-vt3Cl.js";const c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],y=e("circle-alert",c);export{y as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as c}from"./index-
|
|
1
|
+
import{h as c}from"./index-DK-vt3Cl.js";const e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],r=c("circle-check",e);export{r as C};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{L as h,Z as x,I as p,g as u}from"./mermaid-NOHMQCX5-
|
|
1
|
+
import{L as h,Z as x,I as p,g as u}from"./mermaid-NOHMQCX5-C5mvGqWa.js";import{r as i,j as a}from"./index-DK-vt3Cl.js";import"./log-adapter-50wgehrc.js";import"./chevron-right-DlWP8lVM.js";import"./chevron-down-CgN79gJE.js";import"./utils-CkSf8FUe.js";var v=u("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-6","before:mr-4","before:text-[13px]","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),k=r=>{let e={};for(let l of r.split(";")){let o=l.indexOf(":");if(o>0){let c=l.slice(0,o).trim(),n=l.slice(o+1).trim();c&&n&&(e[c]=n)}}return e},j=i.memo(({children:r,result:e,language:l,className:o,...c})=>{let n=i.useMemo(()=>{let s={};return e.bg&&(s["--sdm-bg"]=e.bg),e.fg&&(s["--sdm-fg"]=e.fg),e.rootStyle&&Object.assign(s,k(e.rootStyle)),s},[e.bg,e.fg,e.rootStyle]);return a.jsx("pre",{className:u(o,"p-4 text-sm","bg-[var(--sdm-bg,transparent)]","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,transparent))]"),"data-language":l,"data-streamdown":"code-block-body",style:n,...c,children:a.jsx("code",{className:"[counter-increment:line_0] [counter-reset:line]",children:e.tokens.map((s,d)=>a.jsx("span",{className:v,children:s.map((t,b)=>a.jsx("span",{className:u("text-[var(--sdm-c,inherit)]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]",t.bgColor&&"bg-[var(--sdm-tbg)]",t.bgColor&&"dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),style:{...t.color?{"--sdm-c":t.color}:{},...t.bgColor?{"--sdm-tbg":t.bgColor}:{},...t.htmlStyle},...t.htmlAttrs,children:t.content},b))},d))})})},(r,e)=>r.result===e.result&&r.language===e.language&&r.className===e.className),y=({className:r,language:e,style:l,...o})=>a.jsx("div",{className:u("my-4 w-full overflow-hidden rounded-xl border border-border",r),"data-language":e,"data-streamdown":"code-block",style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...l},...o}),N=({language:r,children:e})=>a.jsxs("div",{className:"flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs","data-language":r,"data-streamdown":"code-block-header",children:[a.jsx("span",{className:"ml-1 font-mono lowercase",children:r}),a.jsx("div",{className:"flex items-center gap-2",children:e})]}),w=/\n+$/,O=({code:r,language:e,className:l,children:o,...c})=>{let{shikiTheme:n}=i.useContext(h),s=x(),d=i.useMemo(()=>r.replace(w,""),[r]),t=i.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:d.split(`
|
|
2
2
|
`).map(g=>[{content:g,color:"inherit",bgColor:"transparent",htmlStyle:{},offset:0}])}),[d]),[b,m]=i.useState(t);return i.useEffect(()=>{if(!s){m(t);return}let g=s.highlight({code:d,language:e,themes:n},f=>{m(f)});if(g){m(g);return}m(t)},[d,e,n,s,t]),a.jsx(p.Provider,{value:{code:r},children:a.jsxs(y,{language:e,children:[a.jsx(N,{language:e,children:o}),a.jsx(j,{className:l,language:e,result:b,...c})]})})};export{O as CodeBlock};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as A,u as h,j as t}from"./index-
|
|
1
|
+
import{h as A,u as h,j as t}from"./index-DK-vt3Cl.js";import{M as O}from"./modal-BgEFLccc.js";import{c as u}from"./utils-CkSf8FUe.js";const R=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],f=A("triangle-alert",R);var i;(function(e){e.TODO="TODO",e.IN_PROGRESS="IN_PROGRESS",e.IN_REVIEW="IN_REVIEW",e.DONE="DONE",e.CANCELLED="CANCELLED"})(i||(i={}));var l;(function(e){e.ACTIVE="ACTIVE",e.MERGED="MERGED",e.ABANDONED="ABANDONED"})(l||(l={}));var s;(function(e){e.CLAUDE_CODE="CLAUDE_CODE",e.GEMINI_CLI="GEMINI_CLI",e.CURSOR_AGENT="CURSOR_AGENT",e.CODEX="CODEX"})(s||(s={}));var c;(function(e){e.PENDING="PENDING",e.RUNNING="RUNNING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.CANCELLED="CANCELLED"})(c||(c={}));var o;(function(e){e.CHAT="CHAT",e.COMMIT_MSG="COMMIT_MSG"})(o||(o={}));var d;(function(e){e.REBASE="REBASE",e.MERGE="MERGE"})(d||(d={}));const L=({isOpen:e,onClose:E,onConfirm:N,title:C,description:m,confirmText:D="确认",cancelText:x="取消",variant:I="default",isLoading:a=!1})=>{const{t:r}=h(),n=I==="danger";return t.jsx(O,{isOpen:e,onClose:E,title:C,className:"max-w-sm",action:t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:E,disabled:a,className:"px-4 py-2 text-sm font-medium text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:r(x)}),t.jsx("button",{onClick:N,disabled:a,className:u("px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50",n?"bg-red-500 text-white hover:bg-red-600":"bg-neutral-900 text-white hover:bg-black"),children:r(a?"处理中...":D)})]}),children:t.jsxs("div",{className:"flex gap-4",children:[n&&t.jsx("div",{className:"shrink-0 w-10 h-10 rounded-full bg-red-50 flex items-center justify-center",children:t.jsx(f,{size:20,className:"text-red-500"})}),t.jsx("div",{className:"text-sm text-neutral-600 leading-relaxed pt-1",children:m})]})})};export{s as A,L as C,c as S,f as T,d as a,i as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as q,r as a,g as w,j as e,F as E}from"./index-
|
|
1
|
+
import{u as q,r as a,g as w,j as e,F as E}from"./index-DK-vt3Cl.js";import{c as o}from"./utils-CkSf8FUe.js";import{C as S}from"./chevron-right-DlWP8lVM.js";import{L as z}from"./loader-circle-DYUWI5Dr.js";import{C as D}from"./circle-alert-CgMmay1J.js";import{F as G}from"./rotate-ccw-CDDSxb2s.js";function X({value:n,onChange:m,placeholder:P}){const{t:R}=q(),[c,V]=a.useState(""),[h,F]=a.useState([]),[f,L]=a.useState(""),[I,B]=a.useState("/"),[j,U]=a.useState([]),[A,g]=a.useState(!1),[b,N]=a.useState(null),[p,v]=a.useState(n),[y,i]=a.useState(null),[K,C]=a.useState(!1),k=a.useRef(!1);a.useEffect(()=>{v(n)},[n]);const r=a.useCallback(async t=>{g(!0),N(null);try{const s={};t&&(s.path=t);const l=await w.get("/filesystem/browse",{params:s});V(l.current),L(l.parent),B(l.sep||"/"),F(l.dirs),l.drives&&U(l.drives)}catch(s){N(s instanceof Error?s.message:"Failed to browse directory")}finally{g(!1)}},[]);a.useEffect(()=>{k.current||(k.current=!0,r())},[r]);const x=a.useCallback(async t=>{C(!0),i(null);try{const s=await w.get("/filesystem/validate",{params:{path:t}});s.valid?(m(t),i(null)):i(s.error??"Not a Git repository")}catch(s){i(s instanceof Error?s.message:"Validation failed")}finally{C(!1)}},[m]),W=a.useCallback(t=>{t.isGitRepo?(x(t.path),r(t.path)):(r(t.path),i(null))},[x,r]),d=I==="\\",u=c?c.split(/[\\/]/).filter(Boolean):[],Z=a.useCallback(t=>{const s=u.slice(0,t+1);let l;d?(l=s.join("\\"),s.length===1&&/^[A-Za-z]:$/.test(s[0])&&(l+="\\")):l="/"+s.join("/"),r(l),i(null)},[u,r,d]),$=a.useCallback(t=>{if(t.key==="Enter"&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229){t.preventDefault();const s=p.trim();s&&(r(s),x(s))}},[p,r,x]);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:p,onChange:t=>v(t.target.value),onKeyDown:$,placeholder:P??"e.g., /Users/me/projects/my-repo",className:o("w-full px-3 py-2 border rounded-lg text-sm font-mono focus:outline-none transition-colors pr-8",n?"border-emerald-300 bg-emerald-50/50 focus:border-emerald-400":"border-neutral-200 focus:border-neutral-400")}),n&&e.jsx(E,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 text-emerald-500"})]}),e.jsx("p",{className:"text-xs text-neutral-400",children:R("Browse and select a Git repository, or type a path and press Enter")}),j.length>0&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:j.map(t=>e.jsx("button",{onClick:()=>{r(t),i(null)},className:o("px-2 py-0.5 rounded text-xs font-mono transition-colors border",c.toUpperCase().startsWith(t.toUpperCase())?"bg-neutral-900 text-white border-neutral-900":"border-neutral-200 text-neutral-600 hover:bg-neutral-100"),children:t.replace("\\","")},t))}),e.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-neutral-500 overflow-x-auto pb-1 scrollbar-none",children:[!d&&e.jsx("button",{onClick:()=>r("/"),className:"hover:text-neutral-900 transition-colors flex-shrink-0 px-1 py-0.5 rounded hover:bg-neutral-100",children:"/"}),u.map((t,s)=>e.jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[(d?s>0:!0)&&e.jsx(S,{size:10,className:"text-neutral-300"}),e.jsx("button",{onClick:()=>Z(s),className:o("px-1 py-0.5 rounded transition-colors truncate max-w-[120px]",s===u.length-1?"font-medium text-neutral-900":"hover:text-neutral-900 hover:bg-neutral-100"),children:t})]},s))]}),e.jsx("div",{className:"border border-neutral-200 rounded-lg overflow-hidden",children:e.jsx("div",{className:"max-h-[200px] overflow-y-auto",children:A?e.jsxs("div",{className:"flex items-center justify-center py-8 text-neutral-400",children:[e.jsx(z,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-xs",children:"Loading..."})]}):b?e.jsxs("div",{className:"flex items-center justify-center py-8 text-red-500 gap-2",children:[e.jsx(D,{size:14}),e.jsx("span",{className:"text-xs",children:b})]}):h.length===0?e.jsx("div",{className:"flex items-center justify-center py-8 text-neutral-400",children:e.jsx("span",{className:"text-xs",children:"No subdirectories"})}):e.jsxs("ul",{className:"divide-y divide-neutral-100",children:[c!==f&&e.jsx("li",{children:e.jsxs("button",{onClick:()=>r(f),className:"w-full flex items-center gap-2.5 px-3 py-2 text-left hover:bg-neutral-50 transition-colors group",children:[e.jsx(G,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs text-neutral-500 group-hover:text-neutral-700",children:".."})]})}),h.map(t=>e.jsx("li",{children:e.jsxs("button",{onClick:()=>W(t),className:o("w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors group",t.path===n?"bg-emerald-50":"hover:bg-neutral-50"),children:[t.isGitRepo?e.jsx(E,{size:14,className:"text-emerald-500 flex-shrink-0"}):e.jsx(G,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:o("text-xs truncate",t.path===n?"font-medium text-emerald-700":"text-neutral-700 group-hover:text-neutral-900"),children:t.name}),t.isGitRepo&&e.jsx("span",{className:"ml-auto flex-shrink-0 text-[10px] font-medium bg-emerald-100 text-emerald-600 px-1.5 py-0.5 rounded",children:"Git"}),!t.isGitRepo&&e.jsx(S,{size:12,className:"ml-auto text-neutral-300 group-hover:text-neutral-400 flex-shrink-0"})]})},t.path))]})})}),K&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-400",children:[e.jsx(z,{size:12,className:"animate-spin"}),e.jsx("span",{children:"Validating..."})]}),y&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-500",children:[e.jsx(D,{size:12}),e.jsx("span",{children:y})]})]})}export{X as FolderPicker};
|