agent-tower 0.3.10 → 0.3.11

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.
Files changed (54) hide show
  1. package/dist/app.d.ts.map +1 -1
  2. package/dist/app.js +2 -0
  3. package/dist/app.js.map +1 -1
  4. package/dist/middleware/__tests__/tunnel-auth.test.d.ts +2 -0
  5. package/dist/middleware/__tests__/tunnel-auth.test.d.ts.map +1 -0
  6. package/dist/middleware/__tests__/tunnel-auth.test.js +87 -0
  7. package/dist/middleware/__tests__/tunnel-auth.test.js.map +1 -0
  8. package/dist/middleware/tunnel-auth.d.ts.map +1 -1
  9. package/dist/middleware/tunnel-auth.js +32 -9
  10. package/dist/middleware/tunnel-auth.js.map +1 -1
  11. package/dist/routes/tunnel.d.ts.map +1 -1
  12. package/dist/routes/tunnel.js +2 -0
  13. package/dist/routes/tunnel.js.map +1 -1
  14. package/dist/socket/middleware/__tests__/auth.test.d.ts +2 -0
  15. package/dist/socket/middleware/__tests__/auth.test.d.ts.map +1 -0
  16. package/dist/socket/middleware/__tests__/auth.test.js +50 -0
  17. package/dist/socket/middleware/__tests__/auth.test.js.map +1 -0
  18. package/dist/socket/middleware/auth.d.ts.map +1 -1
  19. package/dist/socket/middleware/auth.js +7 -8
  20. package/dist/socket/middleware/auth.js.map +1 -1
  21. package/dist/utils/__tests__/tunnel-cookie.test.d.ts +2 -0
  22. package/dist/utils/__tests__/tunnel-cookie.test.d.ts.map +1 -0
  23. package/dist/utils/__tests__/tunnel-cookie.test.js +11 -0
  24. package/dist/utils/__tests__/tunnel-cookie.test.js.map +1 -0
  25. package/dist/utils/tunnel-cookie.d.ts +9 -0
  26. package/dist/utils/tunnel-cookie.d.ts.map +1 -0
  27. package/dist/utils/tunnel-cookie.js +19 -0
  28. package/dist/utils/tunnel-cookie.js.map +1 -0
  29. package/dist/web/assets/{AgentDemoPage-BpV7uQ3g.js → AgentDemoPage-CTlnJyU5.js} +1 -1
  30. package/dist/web/assets/{DemoPage-BGjHCKHx.js → DemoPage-CJ38nIO8.js} +1 -1
  31. package/dist/web/assets/{GeneralSettingsPage-D8GaBU89.js → GeneralSettingsPage-B7VYEpgr.js} +1 -1
  32. package/dist/web/assets/{NotificationSettingsPage-R1vzDEfU.js → NotificationSettingsPage-CHD4DBUP.js} +1 -1
  33. package/dist/web/assets/{ProfileSettingsPage-DrNxHv3c.js → ProfileSettingsPage-qmtWRC95.js} +1 -1
  34. package/dist/web/assets/{ProjectKanbanPage-B3aK9esV.js → ProjectKanbanPage-BlLvUJHU.js} +23 -23
  35. package/dist/web/assets/{ProjectSettingsPage-Cmopz-Gr.js → ProjectSettingsPage-jenb_WWg.js} +1 -1
  36. package/dist/web/assets/{ProviderSettingsPage-Pf3xga4g.js → ProviderSettingsPage-BHH0jqW4.js} +1 -1
  37. package/dist/web/assets/{button-mT6fR5Wv.js → button-CljdSOa6.js} +1 -1
  38. package/dist/web/assets/{chevron-down-KO5Wcpg9.js → chevron-down-BYofhuN2.js} +1 -1
  39. package/dist/web/assets/{circle-alert-CZMIHvRs.js → circle-alert-mZUTomft.js} +1 -1
  40. package/dist/web/assets/{circle-check-CdWs_twI.js → circle-check-CE93UcTb.js} +1 -1
  41. package/dist/web/assets/{code-block-OCS4YCEC-CVVuqs_P.js → code-block-OCS4YCEC-BFgaKpDI.js} +1 -1
  42. package/dist/web/assets/{confirm-dialog-COaPglPO.js → confirm-dialog-nNRI_61i.js} +1 -1
  43. package/dist/web/assets/{folder-picker-CPaFyHlQ.js → folder-picker-DBgAK0Ax.js} +1 -1
  44. package/dist/web/assets/{index-CTITGUzC.js → index-8kxJ66vL.js} +9 -9
  45. package/dist/web/assets/{loader-circle-B49bBnM9.js → loader-circle-C9xqhRQy.js} +1 -1
  46. package/dist/web/assets/{mermaid-NOHMQCX5-drOfvylS.js → mermaid-NOHMQCX5-DCP6uuN7.js} +42 -42
  47. package/dist/web/assets/{modal-D6YfM74t.js → modal-BoAiDPtT.js} +1 -1
  48. package/dist/web/assets/{pencil-CvEjUv9A.js → pencil-Ch8xuc6u.js} +1 -1
  49. package/dist/web/assets/{select-B3kLwiMg.js → select-BzwBaSER.js} +1 -1
  50. package/dist/web/assets/{use-profiles-nR91n9X5.js → use-profiles-B5A7JdZj.js} +1 -1
  51. package/dist/web/assets/{use-projects-CP8WXqHv.js → use-projects-CEI8i-dO.js} +1 -1
  52. package/dist/web/assets/{x-BP0L8Jra.js → x-nkgvEsnZ.js} +1 -1
  53. package/dist/web/index.html +1 -1
  54. package/package.json +2 -1
@@ -1,2 +1,2 @@
1
- import{e as q,u as k,r as o,d as I,j as e}from"./index-CTITGUzC.js";import{a as C,F as S,u as R,b as L}from"./use-projects-CP8WXqHv.js";import{B as A}from"./button-mT6fR5Wv.js";import{S as K}from"./select-B3kLwiMg.js";import{X as E,P as D}from"./x-BP0L8Jra.js";import"./utils-CkSf8FUe.js";import"./chevron-down-KO5Wcpg9.js";const M=[["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"}]],_=q("folder-plus",M);function B({value:n,onChange:x,repoPath:h,placeholder:f}){const{t:u}=k(),[l,c]=o.useState(""),[d,p]=o.useState([]),[m,s]=o.useState(!1),[a,j]=o.useState(-1),y=o.useRef(null),b=o.useRef(null),i=o.useRef(void 0),g=o.useCallback(async t=>{if(!h||!t){p([]),s(!1);return}try{const r=await I.get("/filesystem/complete",{params:{basePath:h,prefix:t}});p(r.results),s(r.results.length>0),j(-1)}catch{p([]),s(!1)}},[h]);o.useEffect(()=>{if(clearTimeout(i.current),!l){p([]),s(!1);return}return i.current=setTimeout(()=>g(l),200),()=>clearTimeout(i.current)},[l,g]),o.useEffect(()=>{const t=r=>{b.current&&!b.current.contains(r.target)&&y.current&&!y.current.contains(r.target)&&s(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const v=t=>{const r=t.trim();!r||n.includes(r)||(x([...n,r]),c(""),s(!1),y.current?.focus())},F=t=>{x(n.filter((r,N)=>N!==t))},w=t=>{t.type==="directory"?(c(t.path),y.current?.focus()):v(t.path)},P=(t,r)=>{r.stopPropagation(),v(t.path.replace(/\/$/,""))},z=t=>{t.nativeEvent.isComposing||t.nativeEvent.keyCode===229||(m&&d.length>0?t.key==="ArrowDown"?(t.preventDefault(),j(r=>Math.min(r+1,d.length-1))):t.key==="ArrowUp"?(t.preventDefault(),j(r=>Math.max(r-1,-1))):t.key==="Enter"?(t.preventDefault(),a>=0?w(d[a]):v(l)):t.key==="Escape"&&s(!1):t.key==="Enter"&&(t.preventDefault(),v(l)))};return e.jsxs("div",{children:[n.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:n.map((t,r)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[t.includes(".")&&!t.endsWith("/")?e.jsx(C,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(S,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:t}),e.jsx("button",{onClick:()=>F(r),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(E,{size:14})})]},t))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:y,type:"text",value:l,onChange:t=>c(t.target.value),onKeyDown:z,onFocus:()=>{l&&d.length>0&&s(!0)},placeholder:f??u("输入文件路径..."),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:()=>v(l),disabled:!l.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(D,{size:14}),e.jsx("span",{children:u("添加")})]})]}),m&&e.jsx("div",{ref:b,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:d.map((t,r)=>e.jsxs("button",{onClick:()=>w(t),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${r===a?"bg-neutral-100":""}`,children:[t.type==="directory"?e.jsx(S,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(C,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:t.path}),t.type==="directory"&&e.jsx("span",{onClick:N=>P(t,N),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:u("添加此目录"),children:e.jsx(_,{size:14})})]},t.path))})]})]})}function O({value:n,onChange:x}){const{t:h}=k(),[f,u]=o.useState(""),[l,c]=o.useState(""),d=()=>{const s=f.trim(),a=l.trim();!s||!a||(x([...n,{name:s,command:a}]),u(""),c(""))},p=s=>{x(n.filter((a,j)=>j!==s))},m=s=>{s.key==="Enter"&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229&&(s.preventDefault(),d())};return e.jsxs("div",{children:[n.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:n.map((s,a)=>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:s.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:s.command}),e.jsx("button",{onClick:()=>p(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(E,{size:14})})]},a))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:f,onChange:s=>u(s.target.value),onKeyDown:m,placeholder:h("名称"),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:l,onChange:s=>c(s.target.value),onKeyDown:m,placeholder:h("命令"),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:d,disabled:!f.trim()||!l.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(D,{size:14}),e.jsx("span",{children:h("添加")})]})]})]})}function T(n){return n?n.split(",").map(x=>x.trim()).filter(Boolean):[]}function J(n){if(!n)return[];try{return JSON.parse(n)}catch{return[]}}function Z(){const{t:n}=k(),{data:x,isLoading:h}=R({limit:100}),f=L(),[u,l]=o.useState(""),[c,d]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[p,m]=o.useState(!1),s=x?.data??[],a=s.find(i=>i.id===u);if(o.useEffect(()=>{!u&&s.length>0&&l(s[0].id)},[s,u]),o.useEffect(()=>{a&&!p&&d({copyFiles:T(a.copyFiles),setupScript:a.setupScript??"",quickCommands:J(a.quickCommands)})},[a,p]),h)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:n("加载中...")});if(s.length===0)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:n("暂无项目,请先创建项目")});const j=s.map(i=>({value:i.id,label:i.name})),y=()=>{u&&f.mutate({id:u,copyFiles:c.copyFiles.length>0?c.copyFiles.join(", "):null,setupScript:c.setupScript.trim()||null,quickCommands:c.quickCommands.length>0?JSON.stringify(c.quickCommands):null},{onSuccess:()=>m(!1)})},b=i=>{l(i),m(!1)};return e.jsxs("div",{className:"px-10 py-6 mx-auto w-full max-w-3xl space-y-8",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:n("选择项目")}),e.jsx(K,{value:u,onChange:b,options:j,placeholder:n("选择项目...")})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:n("自动复制文件")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:n("创建 worktree 时自动从主仓库复制的文件或目录。支持 glob 模式。")}),e.jsx(B,{value:c.copyFiles,onChange:i=>{d(g=>({...g,copyFiles:i})),m(!0)},repoPath:a?.repoPath??""}),e.jsx("p",{className:"text-[11px] text-neutral-400 mt-2",children:n("适用于不在 git 管理中但启动必需的文件,如 .env、node_modules、数据库文件等")})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:n("Setup 脚本")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:n("创建 worktree 后自动执行的命令,每行一条,按顺序执行。")}),e.jsx("textarea",{value:c.setupScript,onChange:i=>{d(g=>({...g,setupScript:i.target.value})),m(!0)},placeholder:`pnpm install
1
+ import{e as q,u as k,r as o,d as I,j as e}from"./index-8kxJ66vL.js";import{a as C,F as S,u as R,b as L}from"./use-projects-CEI8i-dO.js";import{B as A}from"./button-CljdSOa6.js";import{S as K}from"./select-BzwBaSER.js";import{X as E,P as D}from"./x-nkgvEsnZ.js";import"./utils-CkSf8FUe.js";import"./chevron-down-BYofhuN2.js";const M=[["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"}]],_=q("folder-plus",M);function B({value:n,onChange:x,repoPath:h,placeholder:f}){const{t:u}=k(),[l,c]=o.useState(""),[d,p]=o.useState([]),[m,s]=o.useState(!1),[a,j]=o.useState(-1),y=o.useRef(null),b=o.useRef(null),i=o.useRef(void 0),g=o.useCallback(async t=>{if(!h||!t){p([]),s(!1);return}try{const r=await I.get("/filesystem/complete",{params:{basePath:h,prefix:t}});p(r.results),s(r.results.length>0),j(-1)}catch{p([]),s(!1)}},[h]);o.useEffect(()=>{if(clearTimeout(i.current),!l){p([]),s(!1);return}return i.current=setTimeout(()=>g(l),200),()=>clearTimeout(i.current)},[l,g]),o.useEffect(()=>{const t=r=>{b.current&&!b.current.contains(r.target)&&y.current&&!y.current.contains(r.target)&&s(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const v=t=>{const r=t.trim();!r||n.includes(r)||(x([...n,r]),c(""),s(!1),y.current?.focus())},F=t=>{x(n.filter((r,N)=>N!==t))},w=t=>{t.type==="directory"?(c(t.path),y.current?.focus()):v(t.path)},P=(t,r)=>{r.stopPropagation(),v(t.path.replace(/\/$/,""))},z=t=>{t.nativeEvent.isComposing||t.nativeEvent.keyCode===229||(m&&d.length>0?t.key==="ArrowDown"?(t.preventDefault(),j(r=>Math.min(r+1,d.length-1))):t.key==="ArrowUp"?(t.preventDefault(),j(r=>Math.max(r-1,-1))):t.key==="Enter"?(t.preventDefault(),a>=0?w(d[a]):v(l)):t.key==="Escape"&&s(!1):t.key==="Enter"&&(t.preventDefault(),v(l)))};return e.jsxs("div",{children:[n.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:n.map((t,r)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[t.includes(".")&&!t.endsWith("/")?e.jsx(C,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(S,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:t}),e.jsx("button",{onClick:()=>F(r),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(E,{size:14})})]},t))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:y,type:"text",value:l,onChange:t=>c(t.target.value),onKeyDown:z,onFocus:()=>{l&&d.length>0&&s(!0)},placeholder:f??u("输入文件路径..."),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:()=>v(l),disabled:!l.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(D,{size:14}),e.jsx("span",{children:u("添加")})]})]}),m&&e.jsx("div",{ref:b,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:d.map((t,r)=>e.jsxs("button",{onClick:()=>w(t),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${r===a?"bg-neutral-100":""}`,children:[t.type==="directory"?e.jsx(S,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(C,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:t.path}),t.type==="directory"&&e.jsx("span",{onClick:N=>P(t,N),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:u("添加此目录"),children:e.jsx(_,{size:14})})]},t.path))})]})]})}function O({value:n,onChange:x}){const{t:h}=k(),[f,u]=o.useState(""),[l,c]=o.useState(""),d=()=>{const s=f.trim(),a=l.trim();!s||!a||(x([...n,{name:s,command:a}]),u(""),c(""))},p=s=>{x(n.filter((a,j)=>j!==s))},m=s=>{s.key==="Enter"&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229&&(s.preventDefault(),d())};return e.jsxs("div",{children:[n.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:n.map((s,a)=>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:s.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:s.command}),e.jsx("button",{onClick:()=>p(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(E,{size:14})})]},a))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:f,onChange:s=>u(s.target.value),onKeyDown:m,placeholder:h("名称"),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:l,onChange:s=>c(s.target.value),onKeyDown:m,placeholder:h("命令"),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:d,disabled:!f.trim()||!l.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(D,{size:14}),e.jsx("span",{children:h("添加")})]})]})]})}function T(n){return n?n.split(",").map(x=>x.trim()).filter(Boolean):[]}function J(n){if(!n)return[];try{return JSON.parse(n)}catch{return[]}}function Z(){const{t:n}=k(),{data:x,isLoading:h}=R({limit:100}),f=L(),[u,l]=o.useState(""),[c,d]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[p,m]=o.useState(!1),s=x?.data??[],a=s.find(i=>i.id===u);if(o.useEffect(()=>{!u&&s.length>0&&l(s[0].id)},[s,u]),o.useEffect(()=>{a&&!p&&d({copyFiles:T(a.copyFiles),setupScript:a.setupScript??"",quickCommands:J(a.quickCommands)})},[a,p]),h)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:n("加载中...")});if(s.length===0)return e.jsx("div",{className:"p-6 text-sm text-neutral-400",children:n("暂无项目,请先创建项目")});const j=s.map(i=>({value:i.id,label:i.name})),y=()=>{u&&f.mutate({id:u,copyFiles:c.copyFiles.length>0?c.copyFiles.join(", "):null,setupScript:c.setupScript.trim()||null,quickCommands:c.quickCommands.length>0?JSON.stringify(c.quickCommands):null},{onSuccess:()=>m(!1)})},b=i=>{l(i),m(!1)};return e.jsxs("div",{className:"px-10 py-6 mx-auto w-full max-w-3xl space-y-8",children:[e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:n("选择项目")}),e.jsx(K,{value:u,onChange:b,options:j,placeholder:n("选择项目...")})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:n("自动复制文件")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:n("创建 worktree 时自动从主仓库复制的文件或目录。支持 glob 模式。")}),e.jsx(B,{value:c.copyFiles,onChange:i=>{d(g=>({...g,copyFiles:i})),m(!0)},repoPath:a?.repoPath??""}),e.jsx("p",{className:"text-[11px] text-neutral-400 mt-2",children:n("适用于不在 git 管理中但启动必需的文件,如 .env、node_modules、数据库文件等")})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:n("Setup 脚本")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:n("创建 worktree 后自动执行的命令,每行一条,按顺序执行。")}),e.jsx("textarea",{value:c.setupScript,onChange:i=>{d(g=>({...g,setupScript:i.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:n("命令在 worktree 目录下执行,单条命令超时 5 分钟,失败不会阻断后续命令")})]}),e.jsxs("section",{children:[e.jsx("h3",{className:"text-[13px] font-semibold text-neutral-900 mb-1",children:n("常用命令")}),e.jsx("p",{className:"text-[12px] text-neutral-400 mb-3",children:n("在终端中可快速执行的命令,不会自动运行。")}),e.jsx(O,{value:c.quickCommands,onChange:i=>{d(g=>({...g,quickCommands:i})),m(!0)}})]}),p&&e.jsx("div",{className:"sticky bottom-6 flex justify-end",children:e.jsx(A,{size:"sm",onClick:y,disabled:f.isPending,children:f.isPending?n("保存中..."):n("保存")})})]})}export{Z as ProjectSettingsPage};
@@ -1,4 +1,4 @@
1
- import{e as X,a as be,q as ve,d as ye,u as T,r as w,j as n,t as P,f as Q}from"./index-CTITGUzC.js";import{u as je,a as we,b as Ne,c as Ce,d as Ee,e as ke,f as Pe,C as _e,A as N}from"./confirm-dialog-COaPglPO.js";import{B as E}from"./button-mT6fR5Wv.js";import{T as re,M as q}from"./modal-D6YfM74t.js";import{S as se}from"./select-B3kLwiMg.js";import"./log-adapter-50wgehrc.js";import{c as U}from"./utils-CkSf8FUe.js";import{C as le}from"./chevron-down-KO5Wcpg9.js";import{P as ae}from"./x-BP0L8Jra.js";import{P as Oe}from"./pencil-CvEjUv9A.js";import{C as Ie}from"./circle-check-CdWs_twI.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 Fe(e,t){let l=e.slice(0,t).split(/\r\n|\n|\r/g);return[l.length,l.pop().length+1]}function Me(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+=`
1
+ import{e as X,a as be,q as ve,d as ye,u as T,r as w,j as n,t as P,f as Q}from"./index-8kxJ66vL.js";import{u as je,a as we,b as Ne,c as Ce,d as Ee,e as ke,f as Pe,C as _e,A as N}from"./confirm-dialog-nNRI_61i.js";import{B as E}from"./button-CljdSOa6.js";import{T as re,M as q}from"./modal-BoAiDPtT.js";import{S as se}from"./select-BzwBaSER.js";import"./log-adapter-50wgehrc.js";import{c as U}from"./utils-CkSf8FUe.js";import{C as le}from"./chevron-down-BYofhuN2.js";import{P as ae}from"./x-nkgvEsnZ.js";import{P as Oe}from"./pencil-Ch8xuc6u.js";import{C as Ie}from"./circle-check-CE93UcTb.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 Fe(e,t){let l=e.slice(0,t).split(/\r\n|\n|\r/g);return[l.length,l.pop().length+1]}function Me(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]=Fe(l.toml,l.ptr),s=Me(l.toml,i,a);super(`Invalid TOML document: ${t}
4
4
 
@@ -1 +1 @@
1
- import{r as a,j as p}from"./index-CTITGUzC.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
+ import{r as a,j as p}from"./index-8kxJ66vL.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{e as o}from"./index-CTITGUzC.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
+ import{e as o}from"./index-8kxJ66vL.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{e}from"./index-CTITGUzC.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
+ import{e}from"./index-8kxJ66vL.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{e as c}from"./index-CTITGUzC.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
+ import{e as c}from"./index-8kxJ66vL.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-drOfvylS.js";import{r as i,j as a}from"./index-CTITGUzC.js";import"./log-adapter-50wgehrc.js";import"./chevron-down-KO5Wcpg9.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 n=l.indexOf(":");if(n>0){let c=l.slice(0,n).trim(),o=l.slice(n+1).trim();c&&o&&(e[c]=o)}}return e},j=i.memo(({children:r,result:e,language:l,className:n,...c})=>{let o=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(n,"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:o,...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,...n})=>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},...n}),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+$/,B=({code:r,language:e,className:l,children:n,...c})=>{let{shikiTheme:o}=i.useContext(h),s=x(),d=i.useMemo(()=>r.replace(w,""),[r]),t=i.useMemo(()=>({bg:"transparent",fg:"inherit",tokens:d.split(`
1
+ import{L as h,Z as x,I as p,g as u}from"./mermaid-NOHMQCX5-DCP6uuN7.js";import{r as i,j as a}from"./index-8kxJ66vL.js";import"./log-adapter-50wgehrc.js";import"./chevron-down-BYofhuN2.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 n=l.indexOf(":");if(n>0){let c=l.slice(0,n).trim(),o=l.slice(n+1).trim();c&&o&&(e[c]=o)}}return e},j=i.memo(({children:r,result:e,language:l,className:n,...c})=>{let o=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(n,"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:o,...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,...n})=>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},...n}),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+$/,B=({code:r,language:e,className:l,children:n,...c})=>{let{shikiTheme:o}=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:o},f=>{m(f)});if(g){m(g);return}m(t)},[d,e,o,s,t]),a.jsx(p.Provider,{value:{code:r},children:a.jsxs(y,{language:e,children:[a.jsx(N,{language:e,children:n}),a.jsx(j,{className:l,language:e,result:b,...c})]})})};export{B as CodeBlock};
@@ -1 +1 @@
1
- import{e as y,a as A,b as a,c as s,q as i,d as n,u as h,j as t}from"./index-CTITGUzC.js";import{M as O}from"./modal-D6YfM74t.js";import{c as M}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"}]],G=y("triangle-alert",R);var l;(function(e){e.TODO="TODO",e.IN_PROGRESS="IN_PROGRESS",e.IN_REVIEW="IN_REVIEW",e.DONE="DONE",e.CANCELLED="CANCELLED"})(l||(l={}));var E;(function(e){e.ACTIVE="ACTIVE",e.MERGED="MERGED",e.ABANDONED="ABANDONED"})(E||(E={}));var p;(function(e){e.CLAUDE_CODE="CLAUDE_CODE",e.GEMINI_CLI="GEMINI_CLI",e.CURSOR_AGENT="CURSOR_AGENT",e.CODEX="CODEX"})(p||(p={}));var m;(function(e){e.PENDING="PENDING",e.RUNNING="RUNNING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.CANCELLED="CANCELLED"})(m||(m={}));var v;(function(e){e.CHAT="CHAT",e.COMMIT_MSG="COMMIT_MSG"})(v||(v={}));var N;(function(e){e.REBASE="REBASE",e.MERGE="MERGE"})(N||(N={}));function _(){return A({queryKey:i.providers.all,queryFn:()=>n.get("/providers")})}function g(){const e=a();return s({mutationFn:r=>n.post("/providers",r),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function q(){const e=a();return s({mutationFn:({id:r,data:o})=>n.put(`/providers/${r}`,o),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function j(){const e=a();return s({mutationFn:r=>n.delete(`/providers/${r}`),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function F(){return s({mutationFn:()=>n.get("/providers/backup")})}function T(){return s({mutationFn:e=>n.post("/providers/import/preview",e)})}function w(){const e=a();return s({mutationFn:r=>n.post("/providers/import",r),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}const U=({isOpen:e,onClose:r,onConfirm:o,title:C,description:D,confirmText:x="确认",cancelText:f="取消",variant:I="default",isLoading:u=!1})=>{const{t:c}=h(),d=I==="danger";return t.jsx(O,{isOpen:e,onClose:r,title:C,className:"max-w-sm",action:t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:r,disabled:u,className:"px-4 py-2 text-sm font-medium text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:c(f)}),t.jsx("button",{onClick:o,disabled:u,className:M("px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50",d?"bg-red-500 text-white hover:bg-red-600":"bg-neutral-900 text-white hover:bg-black"),children:c(u?"处理中...":x)})]}),children:t.jsxs("div",{className:"flex gap-4",children:[d&&t.jsx("div",{className:"shrink-0 w-10 h-10 rounded-full bg-red-50 flex items-center justify-center",children:t.jsx(G,{size:20,className:"text-red-500"})}),t.jsx("div",{className:"text-sm text-neutral-600 leading-relaxed pt-1",children:D})]})})};export{p as A,U as C,m as S,G as T,g as a,q as b,j as c,F as d,T as e,w as f,N as g,l as h,_ as u};
1
+ import{e as y,a as A,b as a,c as s,q as i,d as n,u as h,j as t}from"./index-8kxJ66vL.js";import{M as O}from"./modal-BoAiDPtT.js";import{c as M}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"}]],G=y("triangle-alert",R);var l;(function(e){e.TODO="TODO",e.IN_PROGRESS="IN_PROGRESS",e.IN_REVIEW="IN_REVIEW",e.DONE="DONE",e.CANCELLED="CANCELLED"})(l||(l={}));var E;(function(e){e.ACTIVE="ACTIVE",e.MERGED="MERGED",e.ABANDONED="ABANDONED"})(E||(E={}));var p;(function(e){e.CLAUDE_CODE="CLAUDE_CODE",e.GEMINI_CLI="GEMINI_CLI",e.CURSOR_AGENT="CURSOR_AGENT",e.CODEX="CODEX"})(p||(p={}));var m;(function(e){e.PENDING="PENDING",e.RUNNING="RUNNING",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.CANCELLED="CANCELLED"})(m||(m={}));var v;(function(e){e.CHAT="CHAT",e.COMMIT_MSG="COMMIT_MSG"})(v||(v={}));var N;(function(e){e.REBASE="REBASE",e.MERGE="MERGE"})(N||(N={}));function _(){return A({queryKey:i.providers.all,queryFn:()=>n.get("/providers")})}function g(){const e=a();return s({mutationFn:r=>n.post("/providers",r),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function q(){const e=a();return s({mutationFn:({id:r,data:o})=>n.put(`/providers/${r}`,o),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function j(){const e=a();return s({mutationFn:r=>n.delete(`/providers/${r}`),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}function F(){return s({mutationFn:()=>n.get("/providers/backup")})}function T(){return s({mutationFn:e=>n.post("/providers/import/preview",e)})}function w(){const e=a();return s({mutationFn:r=>n.post("/providers/import",r),onSuccess:()=>{e.invalidateQueries({queryKey:i.providers.all})}})}const U=({isOpen:e,onClose:r,onConfirm:o,title:C,description:D,confirmText:x="确认",cancelText:f="取消",variant:I="default",isLoading:u=!1})=>{const{t:c}=h(),d=I==="danger";return t.jsx(O,{isOpen:e,onClose:r,title:C,className:"max-w-sm",action:t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:r,disabled:u,className:"px-4 py-2 text-sm font-medium text-neutral-600 hover:text-neutral-900 transition-colors disabled:opacity-50",children:c(f)}),t.jsx("button",{onClick:o,disabled:u,className:M("px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50",d?"bg-red-500 text-white hover:bg-red-600":"bg-neutral-900 text-white hover:bg-black"),children:c(u?"处理中...":x)})]}),children:t.jsxs("div",{className:"flex gap-4",children:[d&&t.jsx("div",{className:"shrink-0 w-10 h-10 rounded-full bg-red-50 flex items-center justify-center",children:t.jsx(G,{size:20,className:"text-red-500"})}),t.jsx("div",{className:"text-sm text-neutral-600 leading-relaxed pt-1",children:D})]})})};export{p as A,U as C,m as S,G as T,g as a,q as b,j as c,F as d,T as e,w as f,N as g,l as h,_ as u};
@@ -1 +1 @@
1
- import{u as A,r as a,d as k,j as e,F as C}from"./index-CTITGUzC.js";import{c}from"./utils-CkSf8FUe.js";import{C as w}from"./mermaid-NOHMQCX5-drOfvylS.js";import{L as E}from"./loader-circle-B49bBnM9.js";import{C as z}from"./circle-alert-CZMIHvRs.js";import{F as S}from"./use-projects-CP8WXqHv.js";import"./log-adapter-50wgehrc.js";import"./chevron-down-KO5Wcpg9.js";function W({value:l,onChange:m,placeholder:G}){const{t:D}=A(),[x,R]=a.useState(""),[p,V]=a.useState([]),[h,F]=a.useState(""),[L,f]=a.useState(!1),[j,g]=a.useState(null),[d,N]=a.useState(l),[b,n]=a.useState(null),[P,v]=a.useState(!1),y=a.useRef(!1);a.useEffect(()=>{N(l)},[l]);const r=a.useCallback(async t=>{f(!0),g(null);try{const s={};t&&(s.path=t);const u=await k.get("/filesystem/browse",{params:s});R(u.current),F(u.parent),V(u.dirs)}catch(s){g(s instanceof Error?s.message:"Failed to browse directory")}finally{f(!1)}},[]);a.useEffect(()=>{y.current||(y.current=!0,r())},[r]);const i=a.useCallback(async t=>{v(!0),n(null);try{const s=await k.get("/filesystem/validate",{params:{path:t}});s.valid?(m(t),n(null)):n(s.error??"Not a Git repository")}catch(s){n(s instanceof Error?s.message:"Validation failed")}finally{v(!1)}},[m]),I=a.useCallback(t=>{t.isGitRepo?(i(t.path),r(t.path)):(r(t.path),n(null))},[i,r]),o=x?x.split("/").filter(Boolean):[],B=a.useCallback(t=>{const s="/"+o.slice(0,t+1).join("/");r(s),n(null)},[o,r]),K=a.useCallback(t=>{if(t.key==="Enter"&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229){t.preventDefault();const s=d.trim();s&&(r(s),i(s))}},[d,r,i]);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:d,onChange:t=>N(t.target.value),onKeyDown:K,placeholder:G??"e.g., /Users/me/projects/my-repo",className:c("w-full px-3 py-2 border rounded-lg text-sm font-mono focus:outline-none transition-colors pr-8",l?"border-emerald-300 bg-emerald-50/50 focus:border-emerald-400":"border-neutral-200 focus:border-neutral-400")}),l&&e.jsx(C,{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:D("Browse and select a Git repository, or type a path and press Enter")}),e.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-neutral-500 overflow-x-auto pb-1 scrollbar-none",children:[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:"/"}),o.map((t,s)=>e.jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(w,{size:10,className:"text-neutral-300"}),e.jsx("button",{onClick:()=>B(s),className:c("px-1 py-0.5 rounded transition-colors truncate max-w-[120px]",s===o.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:L?e.jsxs("div",{className:"flex items-center justify-center py-8 text-neutral-400",children:[e.jsx(E,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-xs",children:"Loading..."})]}):j?e.jsxs("div",{className:"flex items-center justify-center py-8 text-red-500 gap-2",children:[e.jsx(z,{size:14}),e.jsx("span",{className:"text-xs",children:j})]}):p.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:[x!==h&&e.jsx("li",{children:e.jsxs("button",{onClick:()=>r(h),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(S,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs text-neutral-500 group-hover:text-neutral-700",children:".."})]})}),p.map(t=>e.jsx("li",{children:e.jsxs("button",{onClick:()=>I(t),className:c("w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors group",t.path===l?"bg-emerald-50":"hover:bg-neutral-50"),children:[t.isGitRepo?e.jsx(C,{size:14,className:"text-emerald-500 flex-shrink-0"}):e.jsx(S,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:c("text-xs truncate",t.path===l?"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(w,{size:12,className:"ml-auto text-neutral-300 group-hover:text-neutral-400 flex-shrink-0"})]})},t.path))]})})}),P&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-400",children:[e.jsx(E,{size:12,className:"animate-spin"}),e.jsx("span",{children:"Validating..."})]}),b&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-500",children:[e.jsx(z,{size:12}),e.jsx("span",{children:b})]})]})}export{W as FolderPicker};
1
+ import{u as A,r as a,d as k,j as e,F as C}from"./index-8kxJ66vL.js";import{c}from"./utils-CkSf8FUe.js";import{C as w}from"./mermaid-NOHMQCX5-DCP6uuN7.js";import{L as E}from"./loader-circle-C9xqhRQy.js";import{C as z}from"./circle-alert-mZUTomft.js";import{F as S}from"./use-projects-CEI8i-dO.js";import"./log-adapter-50wgehrc.js";import"./chevron-down-BYofhuN2.js";function W({value:l,onChange:m,placeholder:G}){const{t:D}=A(),[x,R]=a.useState(""),[p,V]=a.useState([]),[h,F]=a.useState(""),[L,f]=a.useState(!1),[j,g]=a.useState(null),[d,N]=a.useState(l),[b,n]=a.useState(null),[P,v]=a.useState(!1),y=a.useRef(!1);a.useEffect(()=>{N(l)},[l]);const r=a.useCallback(async t=>{f(!0),g(null);try{const s={};t&&(s.path=t);const u=await k.get("/filesystem/browse",{params:s});R(u.current),F(u.parent),V(u.dirs)}catch(s){g(s instanceof Error?s.message:"Failed to browse directory")}finally{f(!1)}},[]);a.useEffect(()=>{y.current||(y.current=!0,r())},[r]);const i=a.useCallback(async t=>{v(!0),n(null);try{const s=await k.get("/filesystem/validate",{params:{path:t}});s.valid?(m(t),n(null)):n(s.error??"Not a Git repository")}catch(s){n(s instanceof Error?s.message:"Validation failed")}finally{v(!1)}},[m]),I=a.useCallback(t=>{t.isGitRepo?(i(t.path),r(t.path)):(r(t.path),n(null))},[i,r]),o=x?x.split("/").filter(Boolean):[],B=a.useCallback(t=>{const s="/"+o.slice(0,t+1).join("/");r(s),n(null)},[o,r]),K=a.useCallback(t=>{if(t.key==="Enter"&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229){t.preventDefault();const s=d.trim();s&&(r(s),i(s))}},[d,r,i]);return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:d,onChange:t=>N(t.target.value),onKeyDown:K,placeholder:G??"e.g., /Users/me/projects/my-repo",className:c("w-full px-3 py-2 border rounded-lg text-sm font-mono focus:outline-none transition-colors pr-8",l?"border-emerald-300 bg-emerald-50/50 focus:border-emerald-400":"border-neutral-200 focus:border-neutral-400")}),l&&e.jsx(C,{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:D("Browse and select a Git repository, or type a path and press Enter")}),e.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-neutral-500 overflow-x-auto pb-1 scrollbar-none",children:[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:"/"}),o.map((t,s)=>e.jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(w,{size:10,className:"text-neutral-300"}),e.jsx("button",{onClick:()=>B(s),className:c("px-1 py-0.5 rounded transition-colors truncate max-w-[120px]",s===o.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:L?e.jsxs("div",{className:"flex items-center justify-center py-8 text-neutral-400",children:[e.jsx(E,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-xs",children:"Loading..."})]}):j?e.jsxs("div",{className:"flex items-center justify-center py-8 text-red-500 gap-2",children:[e.jsx(z,{size:14}),e.jsx("span",{className:"text-xs",children:j})]}):p.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:[x!==h&&e.jsx("li",{children:e.jsxs("button",{onClick:()=>r(h),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(S,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:"text-xs text-neutral-500 group-hover:text-neutral-700",children:".."})]})}),p.map(t=>e.jsx("li",{children:e.jsxs("button",{onClick:()=>I(t),className:c("w-full flex items-center gap-2.5 px-3 py-2 text-left transition-colors group",t.path===l?"bg-emerald-50":"hover:bg-neutral-50"),children:[t.isGitRepo?e.jsx(C,{size:14,className:"text-emerald-500 flex-shrink-0"}):e.jsx(S,{size:14,className:"text-neutral-400 flex-shrink-0"}),e.jsx("span",{className:c("text-xs truncate",t.path===l?"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(w,{size:12,className:"ml-auto text-neutral-300 group-hover:text-neutral-400 flex-shrink-0"})]})},t.path))]})})}),P&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-neutral-400",children:[e.jsx(E,{size:12,className:"animate-spin"}),e.jsx("span",{children:"Validating..."})]}),b&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-red-500",children:[e.jsx(z,{size:12}),e.jsx("span",{children:b})]})]})}export{W as FolderPicker};