agent-tower 0.7.2-beta.4 → 0.7.2-beta.6
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/runtime/__tests__/cli-driver-lifecycle.test.js +12 -8
- package/dist/runtime/__tests__/cli-driver-lifecycle.test.js.map +1 -1
- package/dist/runtime/cli-driver.js +15 -9
- package/dist/runtime/cli-driver.js.map +1 -1
- package/dist/services/__tests__/session-manager.lifecycle.test.js +69 -0
- package/dist/services/__tests__/session-manager.lifecycle.test.js.map +1 -1
- package/dist/services/__tests__/session-manager.team-run.test.js +3 -1
- package/dist/services/__tests__/session-manager.team-run.test.js.map +1 -1
- package/dist/services/__tests__/terminal-manager.test.js +70 -0
- package/dist/services/__tests__/terminal-manager.test.js.map +1 -1
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +2 -2
- package/dist/services/session-manager.js.map +1 -1
- package/dist/services/terminal-manager.d.ts.map +1 -1
- package/dist/services/terminal-manager.js +9 -4
- package/dist/services/terminal-manager.js.map +1 -1
- package/dist/web/assets/AgentDemoPage-D0LQRcXm.js +1 -0
- package/dist/web/assets/{AgentEnvironmentSettingsPage-DQjnDr-h.js → AgentEnvironmentSettingsPage-BnWVgvNe.js} +1 -1
- package/dist/web/assets/{AgentLogo-I2etsqym.js → AgentLogo-BDyW3ihb.js} +1 -1
- package/dist/web/assets/BranchSelect-Dmp5hq0i.js +1 -0
- package/dist/web/assets/BrandLogo-YGT4Vlw5.js +1 -0
- package/dist/web/assets/{ConversationPage-jEYUuSPT.js → ConversationPage-BhapUYGe.js} +2 -2
- package/dist/web/assets/CreateTaskInput-GLF3Oyc1.js +1 -0
- package/dist/web/assets/{DemoPage-BkkueMuL.js → DemoPage-BwX2SvcN.js} +1 -1
- package/dist/web/assets/{DesignSystemPage-oM16R2Ta.js → DesignSystemPage-j-1-1JtQ.js} +4 -4
- package/dist/web/assets/EditableTaskTitle-mHT39coo.js +70 -0
- package/dist/web/assets/{ExecutionPermissionSelector-BX5Xx8ta.js → ExecutionPermissionSelector-DeeNd4Kh.js} +1 -1
- package/dist/web/assets/{GeneralSettingsPage-B0jFlgDl.js → GeneralSettingsPage-BBe3EXcj.js} +1 -1
- package/dist/web/assets/{LoadingPreviewPage-BxjpxLLP.js → LoadingPreviewPage-BxEFnEQh.js} +1 -1
- package/dist/web/assets/{McpSettingsPage-BErvd619.js → McpSettingsPage-DDA8yUxu.js} +1 -1
- package/dist/web/assets/{MemberAvatar-TVtoxQe8.js → MemberAvatar-CCRbS97s.js} +1 -1
- package/dist/web/assets/MobileTaskDetail-BOIFPybn.js +5 -0
- package/dist/web/assets/{NotificationSettingsPage-BETMBdj1.js → NotificationSettingsPage-B2kUnE8w.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-C03ZAft-.js → ProfileSettingsPage-DPZpUoFd.js} +1 -1
- package/dist/web/assets/ProjectKanbanPage-DQnwUBFg.js +12 -0
- package/dist/web/assets/ProjectSettingsPage-CcXAOYb7.js +2 -0
- package/dist/web/assets/{ProviderSettingsPage-CeNQPd74.js → ProviderSettingsPage-BAIRvcAS.js} +2 -2
- package/dist/web/assets/{SettingsMasterDetail-B_SI2h_k.js → SettingsMasterDetail-BuxwsR9R.js} +1 -1
- package/dist/web/assets/TaskDetail-B3pOSx3f.js +3 -0
- package/dist/web/assets/TeamSettingsPage-DoWmzvKu.js +1 -0
- package/dist/web/assets/{agent-meta-DOylIs2N.js → agent-meta-MzuGtqxl.js} +1 -1
- package/dist/web/assets/arc-Bm_QIbJA.js +1 -0
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-DWO_DRgk.js → architectureDiagram-3BPJPVTR-B5EIiXuX.js} +1 -1
- package/dist/web/assets/arrow-down-BVePf1ZM.js +1 -0
- package/dist/web/assets/{at-sign-BFf8Sz8T.js → at-sign-BE17rU5b.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-CJPYhE52.js → blockDiagram-GPEHLZMM-GFwnvSLM.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-Cx5IvcjB.js → c4Diagram-AAUBKEIU-iJfLTxEa.js} +1 -1
- package/dist/web/assets/channel-CYYV7_Oi.js +1 -0
- package/dist/web/assets/check-qs0S_9rB.js +1 -0
- package/dist/web/assets/{chevron-down-C6Ta4vyM.js → chevron-down-BaQEBzp3.js} +1 -1
- package/dist/web/assets/{chevron-up-BwJT7iif.js → chevron-up-D0y6skqr.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-D9cBNYgd.js → chunk-2J33WTMH-CDxRPp-8.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-BY8TNt6E.js → chunk-4BX2VUAB-mzPbgyiz.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-pT-HP-28.js → chunk-55IACEB6-KNAJbQyw.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-hy95xDLb.js → chunk-727SXJPM-BqGfqkDK.js} +2 -2
- package/dist/web/assets/{chunk-AQP2D5EJ-DlUN-icr.js → chunk-AQP2D5EJ-D27ue-H0.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-Dg2iMKZR.js → chunk-FMBD7UC4-DRza-3q8.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-DMzFIsJ-.js → chunk-ND2GUHAM-CUgkviLu.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-C6CgmKuM.js → chunk-QZHKN3VN-BAlOJwZb.js} +1 -1
- package/dist/web/assets/{circle-alert-Dm2Pl-rU.js → circle-alert-Cbvy2cMo.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-Cl-3ikxt.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-Cl-3ikxt.js +1 -0
- package/dist/web/assets/code-block-OCS4YCEC-CO23R1Os.js +2 -0
- package/dist/web/assets/{confirm-dialog-DRpyE_qU.js → confirm-dialog-BrgNTypL.js} +1 -1
- package/dist/web/assets/{copy-r0aUdsl8.js → copy-DejkmIHZ.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-D-fvmvw-.js → cose-bilkent-S5V4N54A-8TBY7BP_.js} +1 -1
- package/dist/web/assets/cssMode-hzDRnxMx.js +1 -0
- package/dist/web/assets/{dagre-BM42HDAG-H0bYI1f3.js → dagre-BM42HDAG-CkMzDiim.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-DI568fLp.js → diagram-2AECGRRQ-CAOQJ2N1.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-BLcaBzw2.js → diagram-5GNKFQAL-DKhE0hiI.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-aL1cvl23.js → diagram-KO2AKTUF-DBdkXSpa.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-DbOutAfH.js → diagram-LMA3HP47-DRi2t32c.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-D_cWftAX.js → diagram-OG6HWLK6-DtP92tI1.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-DRe5V8Dx.js → erDiagram-TEJ5UH35-DWFKXtst.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-B5-vg_Nh.js → flowDiagram-I6XJVG4X-LDE0h4ri.js} +1 -1
- package/dist/web/assets/{freemarker2-CXlYb2yX.js → freemarker2-CLksOOZX.js} +2 -2
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-B3iBFICN.js → ganttDiagram-6RSMTGT7-DD2RfdyV.js} +1 -1
- package/dist/web/assets/gauge-CPlvCZUV.js +1 -0
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-CZ9zsKVw.js → gitGraphDiagram-PVQCEYII-DkKrR8ex.js} +1 -1
- package/dist/web/assets/{globe-JXfw4MCF.js → globe-CD4g63c9.js} +1 -1
- package/dist/web/assets/handlebars-C1M9t0Lo.js +1 -0
- package/dist/web/assets/html-DKVKQovh.js +1 -0
- package/dist/web/assets/htmlMode-BSWjg5ir.js +1 -0
- package/dist/web/assets/index-BnqdwOEH.css +1 -0
- package/dist/web/assets/{index-CWbMMO6g.js → index-CMJV-mgF.js} +3 -3
- package/dist/web/assets/{index-CWEbo6pZ.js → index-D_QVcsLn.js} +5 -5
- package/dist/web/assets/{infoDiagram-5YYISTIA-DQU_sN8x.js → infoDiagram-5YYISTIA-BdPA9Xfi.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-BVGrNzJa.js → ishikawaDiagram-YF4QCWOH-220u4uiv.js} +1 -1
- package/dist/web/assets/javascript-WwrMY2Bg.js +1 -0
- package/dist/web/assets/{journeyDiagram-JHISSGLW-DU4Md1Tq.js → journeyDiagram-JHISSGLW-BvE0Y3tZ.js} +1 -1
- package/dist/web/assets/{jsonMode-BMSvHUHa.js → jsonMode-Dz0hnnvg.js} +2 -2
- package/dist/web/assets/{kanban-definition-UN3LZRKU-DDPgCucq.js → kanban-definition-UN3LZRKU-Q0JH1P6D.js} +1 -1
- package/dist/web/assets/{key-round-BHVp7u3Z.js → key-round-DZm1FLLr.js} +1 -1
- package/dist/web/assets/{layers-2tjjhM75.js → layers-Dda7MM7a.js} +1 -1
- package/dist/web/assets/{linear-D8yLBTVY.js → linear-Dr6SfnSn.js} +1 -1
- package/dist/web/assets/{link-CnunXc7X.js → link-BUeSP3T7.js} +1 -1
- package/dist/web/assets/liquid-CzGEh0ls.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-BiYvrSP0.js → lspLanguageFeatures-Bbp4PWlJ.js} +1 -1
- package/dist/web/assets/mdx-y6S3OMMk.js +1 -0
- package/dist/web/assets/{mermaid-NOHMQCX5-9-DTTfp6.js → mermaid-NOHMQCX5-C72362la.js} +60 -61
- package/dist/web/assets/{message-square-QM0c6Dcv.js → message-square-CFriSt4D.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-CCAuuWFZ.js → mindmap-definition-RKZ34NQL-bvDaNfKs.js} +1 -1
- package/dist/web/assets/{modal-BRoNvfhw.js → modal-DeigO7aN.js} +1 -1
- package/dist/web/assets/{monaco-CrBn9oMJ.js → monaco-BuDK9Fat.js} +3 -3
- package/dist/web/assets/{paperclip-CC7nHUQ7.js → paperclip-BOSklTt7.js} +1 -1
- package/dist/web/assets/{pencil-DIY0Hu5t.js → pencil-BRQ9W_a-.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-CXy_N5QX.js → pieDiagram-4H26LBE5-BQCca9Cq.js} +2 -2
- package/dist/web/assets/{play-CIZVXiwM.js → play-Mxkwq69n.js} +1 -1
- package/dist/web/assets/python-CMnGKsU9.js +1 -0
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-Dt44QsS8.js → quadrantDiagram-W4KKPZXB-BEM2U7Cd.js} +1 -1
- package/dist/web/assets/razor-mLurbGgY.js +1 -0
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-BL8D7Np0.js → requirementDiagram-4Y6WPE33-CcmFIALZ.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-I5nefO3A.js → sankeyDiagram-5OEKKPKP-D9Nrfbqk.js} +1 -1
- package/dist/web/assets/{select-BmjoUfrV.js → select-DKS02St6.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-lbPrhX8g.js → sequenceDiagram-3UESZ5HK-5udQDi0x.js} +1 -1
- package/dist/web/assets/{server-BNBdQGor.js → server-DJaSJ9m1.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-Bw3qtv2M.js → stateDiagram-AJRCARHV-D-cF1NGV.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-a4ugQnZs.js +1 -0
- package/dist/web/assets/status-styles-sQm4KLdp.js +1 -0
- package/dist/web/assets/{switch-CEUHI4gI.js → switch-7LWQ_sEx.js} +1 -1
- package/dist/web/assets/task-CDYaC_No.js +42 -0
- package/dist/web/assets/task-priority-acVgTiil.js +1 -0
- package/dist/web/assets/{textarea-CD82lB0Z.js → textarea-Ft9KMoEI.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-Cfg_kgoa.js → timeline-definition-PNZ67QCA-DXS236a-.js} +1 -1
- package/dist/web/assets/{trash-2-BF_3L-qk.js → trash-2-Bc-URu8c.js} +1 -1
- package/dist/web/assets/{tsMode-DAHSkTAr.js → tsMode-Vr3bndW1.js} +4 -4
- package/dist/web/assets/typescript-BfjoaUSn.js +1 -0
- package/dist/web/assets/{upload-B2AMXrU-.js → upload-C9Z4jLtv.js} +1 -1
- package/dist/web/assets/use-attachments-EypT-7PI.js +2 -0
- package/dist/web/assets/{use-profiles-CQ-jIuiI.js → use-profiles-nMPGwy3v.js} +1 -1
- package/dist/web/assets/{use-projects-BYUZwQ-q.js → use-projects-DI27nNwl.js} +1 -1
- package/dist/web/assets/{use-providers-DdV9gbj1.js → use-providers-DB9ghBPq.js} +1 -1
- package/dist/web/assets/use-workspaces-d4n9m9cX.js +1 -0
- package/dist/web/assets/{useNormalizedLogs-DdFsf-Z1.js → useNormalizedLogs-DRoPbP0w.js} +1 -1
- package/dist/web/assets/useTokenUsage-4qTDa8SY.js +1 -0
- package/dist/web/assets/{vennDiagram-CIIHVFJN-CdEP03CK.js → vennDiagram-CIIHVFJN-BzyNrP06.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-q_Enplrs.js → wardley-L42UT6IY-BQ4SyU9_.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-DlL6fsid.js → wardleyDiagram-YWT4CUSO-CcCqmB58.js} +1 -1
- package/dist/web/assets/xml-BGVoPR0b.js +1 -0
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-B2OGqVKA.js → xychartDiagram-2RQKCTM6-RWm1MtQk.js} +1 -1
- package/dist/web/assets/yaml-eFhNavrs.js +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/AgentDemoPage-Svq9Baa7.js +0 -1
- package/dist/web/assets/BranchSelect-Eb5UGWWX.js +0 -1
- package/dist/web/assets/BrandLogo-BjC1hcgv.js +0 -1
- package/dist/web/assets/CreateTaskInput-B_cRDkVq.js +0 -1
- package/dist/web/assets/ProjectKanbanPage-DsPxwoVf.js +0 -86
- package/dist/web/assets/ProjectSettingsPage-BwNM6VWs.js +0 -2
- package/dist/web/assets/TeamSettingsPage-BfgtMl_n.js +0 -1
- package/dist/web/assets/arc-BlZww3MO.js +0 -1
- package/dist/web/assets/channel-D9sA6Wxp.js +0 -1
- package/dist/web/assets/check-Cm7Vstpm.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-2e2YVo9r.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-2e2YVo9r.js +0 -1
- package/dist/web/assets/code-block-OCS4YCEC-DizntuP_.js +0 -2
- package/dist/web/assets/cssMode-DVorIr82.js +0 -1
- package/dist/web/assets/handlebars-BL0prPVZ.js +0 -1
- package/dist/web/assets/html-DJWeRkWe.js +0 -1
- package/dist/web/assets/htmlMode-D_fekqg9.js +0 -1
- package/dist/web/assets/index-uXglTJ2_.css +0 -1
- package/dist/web/assets/javascript-CDfuzdfe.js +0 -1
- package/dist/web/assets/liquid-DHrNpv6c.js +0 -1
- package/dist/web/assets/mdx-CIEpgUOV.js +0 -1
- package/dist/web/assets/python-BIs0pClJ.js +0 -1
- package/dist/web/assets/razor-JCx8NEwU.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-Xbc4HxDQ.js +0 -1
- package/dist/web/assets/task-kalEmHDc.js +0 -42
- package/dist/web/assets/task-priority-wLXAgVZZ.js +0 -1
- package/dist/web/assets/typescript-CptiLWGr.js +0 -1
- package/dist/web/assets/xml-DbPqkgZW.js +0 -1
- package/dist/web/assets/yaml-Deyq6Z5-.js +0 -1
- /package/dist/web/assets/{ProjectKanbanPage-DcpNTP1B.css → EditableTaskTitle-DcpNTP1B.css} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e as B,A as M,i as k}from"./agent-meta-MzuGtqxl.js";import{u as z,r as S,j as p,l as T}from"./index-CMJV-mgF.js";import{C as Z}from"./chevron-down-BaQEBzp3.js";import{C as Y}from"./check-qs0S_9rB.js";function G(e,n){let i=e.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function J(e,n,i){let t=e.split(/\r\n|\n|\r/g),r="",o=(Math.log10(n+1)|0)+1;for(let s=n-1;s<=n+1;s++){let l=t[s-1];l&&(r+=s.toString().padEnd(o," "),r+=": ",r+=l,r+=`
|
|
2
2
|
`,s===n&&(r+=" ".repeat(o+i+2),r+=`^
|
|
3
3
|
`))}return r}class m extends Error{line;column;codeblock;constructor(n,i){const[t,r]=G(i.toml,i.ptr),o=J(i.toml,t,r);super(`Invalid TOML document: ${n}
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as te,a as ne,b as le,d as ie,e as re,f as oe,g as ce,r as t,t as m,j as s,S as de,h as ue,i as A,k as G,B as g,I as z}from"./index-
|
|
1
|
+
import{u as te,a as ne,b as le,d as ie,e as re,f as oe,g as ce,r as t,t as m,j as s,S as de,h as ue,i as A,k as G,B as g,I as z}from"./index-CMJV-mgF.js";import{S as U}from"./select-DKS02St6.js";import{T as me}from"./textarea-Ft9KMoEI.js";import{S as ge}from"./switch-7LWQ_sEx.js";import{u as pe}from"./use-providers-DB9ghBPq.js";import"./chevron-down-BaQEBzp3.js";import"./check-qs0S_9rB.js";const fe=[{value:"zh-CN",label:"简体中文"},{value:"en",label:"English"}],N="__follow_task__",R=8;function W(P,y){return P instanceof Error?P.message:y}function je(){const{locale:P,setLocale:y,t:e}=te(),{data:p}=ne(),{data:H}=pe(),{data:w}=le(),{data:r}=ie(),u=re(),i=oe(),S=ce(),[K,D]=t.useState(N),[E,k]=t.useState(""),[V,j]=t.useState(!1),[d,_]=t.useState(""),[o,L]=t.useState(""),[C,I]=t.useState(""),[M,f]=t.useState(!1),[q,h]=t.useState(!1),[b,l]=t.useState(null);t.useEffect(()=>{!p||!w||(D(p.commitMessageProviderId||N),k(p.commitMessagePrompt||w.prompt),j(!1))},[p,w]),t.useEffect(()=>{r&&(f(r.enabled),h(!1),l(null),_(""),L(""),I(""))},[r?.enabled]);const J=[{value:N,label:e("跟随任务")},...(H??[]).filter(a=>a.availability.type!=="NOT_FOUND").map(a=>({value:a.provider.id,label:a.provider.name}))],x=r?.enabled??!1,n=!x&&M?"enable":x&&!M?"disable":x&&q?"change":"idle",O=n!=="idle",Q=e(O?n==="disable"?"将关闭":n==="enable"?"将启用":"已启用":x?"已启用":"未启用"),X=t.useCallback(a=>{D(a);const v=a===N?null:a;u.mutate({commitMessageProviderId:v},{onError:()=>m.error(e("保存失败"))})},[u,e]),Y=t.useCallback(()=>{const a=E.trim()||null;u.mutate({commitMessagePrompt:a},{onSuccess:()=>{j(!1),m.success(e("已保存"))},onError:()=>m.error(e("保存失败"))})},[E,u,e]),c=t.useCallback(()=>{_(""),L(""),I("")},[]),Z=t.useCallback(()=>{f(r?.enabled??!1),h(!1),l(null),c()},[r?.enabled,c]),F=t.useCallback(a=>{if((a==="change"||a==="disable")&&!d)return l(e("请输入当前密码")),!1;if(a==="enable"||a==="change"){if(o.length<R)return l(e("密码至少需要 8 个字符")),!1;if(o!==C)return l(e("两次输入不一致")),!1}return l(null),!0},[C,d,o,e]),B=t.useCallback(()=>{if(n==="idle"||!F(n))return;const a=n==="disable"?{enabled:!1,currentPassword:d}:n==="enable"?{enabled:!0,newPassword:o}:{currentPassword:d,newPassword:o};i.mutate(a,{onSuccess:v=>{f(v.enabled),h(!1),l(null),c(),m.success(e(n==="disable"?"已关闭":"已保存"))},onError:v=>{const T=W(v,e("保存失败"));T.toLowerCase().includes("current password")?l(e("当前密码不正确")):T.toLowerCase().includes("at least 8")?l(e("密码至少需要 8 个字符")):l(T)}})},[n,c,d,o,e,i,F]),$=t.useCallback(a=>{!r||i.isPending||(f(a),h(!1),l(null),c())},[r,c,i.isPending]),ee=t.useCallback(()=>{S.mutate(void 0,{onSuccess:()=>m.success(e("已退出登录")),onError:a=>m.error(W(a,e("退出登录失败")))})},[S,e]),se=t.useCallback(a=>{a.preventDefault(),B()},[B]),ae=t.useCallback(()=>{!r||i.isPending||(f(!0),h(!0),l(null),c())},[r,c,i.isPending]);return s.jsxs(de,{children:[s.jsx(ue,{title:e("通用设置"),className:"mb-1"}),s.jsx("div",{className:"divide-y divide-border/60",children:s.jsx(A,{label:e("显示语言"),description:e("界面语言会保存到本地数据库,重启后继续生效。"),align:"center",children:s.jsx(U,{value:P,onChange:a=>y(a),options:fe})})}),s.jsx(G,{className:"mt-8 mb-1",children:e("访问安全")}),s.jsx("div",{className:"divide-y divide-border/60",children:s.jsx(A,{label:e("访问密码"),description:e("开启后,进入 Agent Tower 需要输入密码。"),controlWidth:"fixed",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"text-sm font-medium text-foreground",children:Q}),s.jsx(ge,{checked:M,onCheckedChange:$,disabled:!r||i.isPending,"aria-label":e("访问密码")})]}),x&&n==="idle"&&s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[s.jsx(g,{type:"button",size:"sm",variant:"outline",className:"w-full sm:w-auto",onClick:ae,disabled:i.isPending,children:e("修改密码")}),s.jsx(g,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:ee,disabled:S.isPending,children:S.isPending?e("退出中..."):e("退出登录")})]}),O&&s.jsxs("form",{className:"space-y-2",onSubmit:se,children:[(n==="change"||n==="disable")&&s.jsx(z,{type:"password",autoComplete:"current-password",placeholder:e("当前密码"),value:d,onChange:a=>{_(a.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&!d)}),(n==="enable"||n==="change")&&s.jsxs(s.Fragment,{children:[s.jsx(z,{type:"password",autoComplete:"new-password",placeholder:e(n==="enable"?"访问密码":"新密码"),value:o,onChange:a=>{L(a.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o.length<R)}),s.jsx(z,{type:"password",autoComplete:"new-password",placeholder:e("确认密码"),value:C,onChange:a=>{I(a.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o!==C)})]}),(n==="change"||n==="disable")&&s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e(n==="disable"?"关闭后不再要求访问密码。":"保存后其他已登录页面需要重新输入。")}),b&&s.jsx("p",{className:"text-xs text-destructive",children:b}),s.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-1 sm:flex-row sm:justify-end",children:[s.jsx(g,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:Z,disabled:i.isPending,children:e("取消")}),s.jsx(g,{type:"submit",size:"sm",className:"w-full sm:w-auto",disabled:i.isPending,children:i.isPending?e("保存中..."):e(n==="disable"?"关闭访问密码":"保存")})]})]})]})})}),s.jsx(G,{className:"mt-8 mb-1",children:e("Git Commit Message")}),s.jsxs("div",{className:"divide-y divide-border/60",children:[s.jsx(A,{label:e("Agent 渠道"),description:e('"跟随任务"表示使用当前任务所用的 Agent 渠道。选择具体渠道可使用更经济的模型。'),children:s.jsx(U,{value:K,onChange:X,options:J})}),s.jsx(A,{label:e("提示词模板"),description:e("自定义生成 commit message 的提示词。留空则使用内置默认模板。"),children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(me,{value:E,onChange:a=>{k(a.target.value),j(!0)},rows:5,className:"font-mono resize-y"}),V&&s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.jsx(g,{size:"sm",variant:"ghost",onClick:()=>{k(p?.commitMessagePrompt||w?.prompt||""),j(!1)},children:e("取消")}),s.jsx(g,{size:"sm",onClick:Y,disabled:u.isPending,children:u.isPending?e("保存中..."):e("保存")})]})]})})]})]})}export{je as GeneralSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as f,r as o,L as u,j as e,R as h,X as b}from"./index-
|
|
1
|
+
import{u as f,r as o,L as u,j as e,R as h,X as b}from"./index-CMJV-mgF.js";function p(){const{t:s}=f(),[a,c]=o.useState(null),x=o.useRef(null),d=o.useRef(null),i=o.useRef(null),t=a?u.find(r=>r.id===a):null,l=o.useCallback(()=>{c(null)},[]);return o.useEffect(()=>{if(!t){i.current?.focus(),i.current=null;return}d.current?.focus();const r=n=>{if(n.key==="Escape"){n.preventDefault(),l();return}n.key==="Tab"&&(n.preventDefault(),d.current?.focus())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,l]),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("style",{children:h}),e.jsx("header",{className:"border-b border-border px-6 py-4",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Loading Animation Preview"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("10 个首屏加载动画候选 · 颜色遵循 Agent Tower 设计规范 · 点击卡片查看全屏效果")})]})}),e.jsxs("main",{className:"max-w-6xl mx-auto px-6 py-8",inert:t?!0:void 0,"aria-hidden":t?!0:void 0,children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:u.map((r,n)=>{const m=r.component;return e.jsxs("button",{onClick:g=>{i.current=g.currentTarget,c(r.id)},className:"group relative flex flex-col bg-card border border-border rounded-lg p-5 text-left transition-shadow hover:shadow-md focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",children:[e.jsxs("span",{className:"absolute top-3 right-3 text-[11px] font-semibold text-muted-foreground/60 tabular-nums",children:["#",n+1]}),e.jsx("div",{className:"flex items-center justify-center h-28 mb-4",children:e.jsx(m,{})}),e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:r.name}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:s(r.description)})]},r.id)})}),e.jsxs("div",{className:"mt-10 p-5 border border-border rounded-lg bg-muted/30",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground mb-2",children:s("设计推荐")}),e.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1.5 leading-relaxed",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("首选:Charcoal Breathe (#10)")})," — ",s("品牌感最强,Charcoal 色块+Tower 图标呼吸,用户对产品的第一印象即品牌本身。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选A:Tower Pulse (#1)")})," — ",s("品牌图标直接出现,脉冲节奏稳定,不浮夸,适合工作台场景。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选B:Terminal Cursor (#4)")})," — ",s("终端光标闪烁,贴合 Agent/终端协作的核心场景,开发者亲切感强。")]})]})]})]}),t&&e.jsxs("div",{ref:x,className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:r=>{r.target===r.currentTarget&&l()},role:"dialog","aria-modal":"true","aria-label":s("全屏预览:{name}",{name:t.name}),children:[e.jsx("button",{ref:d,onClick:l,className:"absolute top-4 right-4 p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none","aria-label":s("关闭预览"),children:e.jsx(b,{size:20})}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx("div",{className:"scale-[2] origin-center",children:e.jsx(t.component,{})}),e.jsxs("div",{className:"text-center mt-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:t.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-sm",children:s(t.description)})]}),e.jsx("span",{className:"text-xs text-muted-foreground/60 mt-2",children:s("按 Esc 或点击关闭按钮退出")})]})]})]})}export{p as LoadingPreviewPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as c,q as m,p as o,u,r as p,t as n,j as e,S as a,
|
|
1
|
+
import{m as c,q as m,p as o,u,r as p,t as n,j as e,S as a,E as g,B as l,Z as f}from"./index-CMJV-mgF.js";import{C as j}from"./copy-DejkmIHZ.js";import{S as b}from"./server-DJaSJ9m1.js";import{C as h}from"./check-qs0S_9rB.js";function N(){return c({queryKey:m.system.mcpConfig,queryFn:()=>o.get("/system/mcp-config")})}function C({mode:s,label:t}){const r=s==="desktop-packaged";return e.jsx("span",{className:`inline-flex items-center rounded-md px-2 py-1 text-[11px] font-medium ${r?"bg-emerald-50 text-emerald-700":"bg-amber-50 text-amber-700"}`,children:t})}function w(){const{t:s}=u(),{data:t,isLoading:r,isError:i,refetch:d}=N(),x=p.useCallback(async()=>{if(t?.configJson)try{await navigator.clipboard.writeText(t.configJson),n.success(s("MCP 配置已复制"))}catch{n.error(s("复制 MCP 配置失败"))}},[t?.configJson,s]);return r?e.jsx(a,{children:e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(g,{className:"h-5 w-5 animate-spin text-neutral-500"})})}):i||!t?e.jsxs(a,{children:[e.jsx("h2",{className:"mb-1 text-base font-semibold text-neutral-900",children:s("MCP 配置")}),e.jsx("div",{className:"mt-5 rounded-lg border border-red-100 bg-red-50 px-4 py-3 text-sm text-red-700",children:s("MCP 配置加载失败")}),e.jsx(l,{className:"mt-4",size:"sm",variant:"outline",onClick:()=>{d()},children:s("重试")})]}):e.jsxs(a,{children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-neutral-900",children:s("MCP 配置")}),e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-neutral-500",children:s("复制下面的 JSON 到支持 MCP 的客户端配置中。桌面打包版使用 App 内置 runtime,不需要全局安装 agent-tower。")})]}),e.jsxs(l,{size:"sm",onClick:x,children:[e.jsx(j,{size:14}),s("复制配置")]})]}),e.jsxs("div",{className:"space-y-3 border-b border-neutral-100 pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(C,{mode:t.runtimeMode,label:t.runtimeMode==="desktop-packaged"?s("桌面打包 runtime"):s("工作区 runtime")}),e.jsx("span",{className:"text-[12px] text-neutral-400",children:t.serverName})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-neutral-100 bg-neutral-50/70 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-[11px] font-medium uppercase text-neutral-400",children:[e.jsx(f,{size:12}),"Command"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-neutral-800",children:t.command})]}),e.jsxs("div",{className:"rounded-lg border border-neutral-100 bg-neutral-50/70 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-[11px] font-medium uppercase text-neutral-400",children:[e.jsx(b,{size:12}),"Entry"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-neutral-800",children:t.args.at(-1)??""})]})]})]}),e.jsxs("div",{className:"pt-5",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("label",{className:"text-[12px] font-medium text-neutral-600",children:"mcpServers JSON"}),t.runtimeMode==="desktop-packaged"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-emerald-600",children:[e.jsx(h,{size:12}),s("无需全局 CLI")]})]}),e.jsx("textarea",{readOnly:!0,value:t.configJson,rows:14,className:"w-full resize-y rounded-lg border border-neutral-200 bg-neutral-950 px-3 py-3 font-mono text-[12px] leading-relaxed text-neutral-100 outline-none"}),e.jsx("p",{className:"mt-2 text-[11px] leading-relaxed text-neutral-400",children:s("当前版本只生成通用 MCP 配置,不会自动修改 Claude、Codex 或其他第三方客户端配置文件。")})]})]})}export{w as McpSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as n,l as o}from"./index-
|
|
1
|
+
import{r as i,j as n,l as o}from"./index-CMJV-mgF.js";function d(r){const t=r.trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);return e.length>=2?`${e[0][0]??""}${e[1][0]??""}`.toUpperCase():Array.from(t).slice(0,2).join("").toUpperCase()}function a(r){const t=r.trim();return/^#([0-9a-f]{3,8})$/i.test(t)||/^rgba?\(/i.test(t)||/^hsla?\(/i.test(t)}function l(r){const t=r.trim();return t.startsWith("/")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:image/")||t.startsWith("blob:")}function h(r,t){const e=r?.trim()??"";return!e||a(e)||l(e)?d(t):e.length<=2?e.toUpperCase():e.slice(0,2).toUpperCase()}function p(r){const t=r?.trim()??"";if(!(!t||!a(t)))return{backgroundColor:t,color:"#ffffff"}}function g({name:r,avatar:t,className:e}){const[u,c]=i.useState(null),s=t?.trim()??"",f=!!s&&l(s)&&u!==s,m=i.useMemo(()=>h(s,r),[r,s]);return f?n.jsx("img",{src:s,alt:r,loading:"lazy",onError:()=>c(s),className:o("h-7 w-7 shrink-0 rounded-full border border-neutral-200 bg-white object-cover",e)}):n.jsx("div",{className:o("flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-neutral-200 bg-neutral-100 text-[10px] font-semibold text-neutral-600",e),style:p(s),"aria-label":r,children:m})}export{g as M};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{u as U,j as e,E as K,r as n,l as D,p as Dt,q as Qe,ac as Ne,a7 as bs,o as vs,a3 as js,a4 as ys,a5 as Ns,ad as ks,a6 as ws,s as At,B as He,ab as Cs,Q as Is}from"./index-CMJV-mgF.js";import{C as we,W as Ss,S as W}from"./agent-meta-MzuGtqxl.js";import{a as Rt,Q as As,s as Rs}from"./mermaid-NOHMQCX5-C72362la.js";import{u as Ts,a as Es,R as Ms,P as Ps,T as Os}from"./useTokenUsage-4qTDa8SY.js";import{u as Ls,a as Ws,L as Tt,T as Et}from"./useNormalizedLogs-DRoPbP0w.js";import{g as Ds}from"./ExecutionPermissionSelector-DeeNd4Kh.js";import{u as zs,A as Bs}from"./use-attachments-EypT-7PI.js";import{u as Fs,a as Gs,b as Us,d as qs,e as Vs,S as Mt}from"./CreateTaskInput-GLF3Oyc1.js";import{b as zt,G as Xe,m as Hs,n as $s,o as _s,p as Ks,u as Qs,r as Xs,g as ke,c as Ys,e as Zs,a as Js,f as en,W as tn,E as sn,h as nn,S as an,R as rn,T as ln,j as on,q as cn,s as dn,i as un,k as mn,l as xn}from"./EditableTaskTitle-mHT39coo.js";import{C as Ce}from"./chevron-down-BaQEBzp3.js";import{H as Bt,F as Ft,C as pn,P as $e}from"./play-Mxkwq69n.js";import{a as hn,b as fn,c as gn}from"./use-workspaces-d4n9m9cX.js";import{u as bn}from"./use-providers-DB9ghBPq.js";import{D as vn}from"./ProjectKanbanPage-DQnwUBFg.js";import{U as ie}from"./status-styles-sQm4KLdp.js";import{M as Gt}from"./message-square-CFriSt4D.js";import{T as jn}from"./trash-2-Bc-URu8c.js";import{A as Pt}from"./arrow-down-BVePf1ZM.js";import{P as yn}from"./paperclip-BOSklTt7.js";import{A as Nn}from"./task-priority-acVgTiil.js";import"./gauge-CPlvCZUV.js";import"./AgentLogo-BDyW3ihb.js";import"./check-qs0S_9rB.js";import"./use-projects-DI27nNwl.js";import"./MemberAvatar-CCRbS97s.js";import"./BrandLogo-YGT4Vlw5.js";import"./chevron-up-D0y6skqr.js";import"./at-sign-BE17rU5b.js";import"./confirm-dialog-BrgNTypL.js";import"./modal-DeigO7aN.js";import"./select-DKS02St6.js";import"./layers-Dda7MM7a.js";import"./textarea-Ft9KMoEI.js";import"./server-DJaSJ9m1.js";import"./task-CDYaC_No.js";import"./copy-DejkmIHZ.js";import"./upload-C9Z4jLtv.js";import"./globe-CD4g63c9.js";import"./BranchSelect-Dmp5hq0i.js";import"./pencil-BRQ9W_a-.js";import"./circle-alert-Cbvy2cMo.js";const Ot={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function kn(t){const r=t.split("/");return r[r.length-1]||t}function wn(t){const r=t.lastIndexOf("/");return r>0?t.slice(0,r):""}function Cn({workingDir:t,filePath:r,type:c}){const{t:d}=U(),{data:v,isLoading:x,isError:f}=Hs(t,r,c);if(x)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[e.jsx(K,{size:14,className:"animate-spin"}),e.jsx("span",{className:"text-xs",children:d("Loading diff...")})]});if(f)return e.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:d("Failed to load diff.")});const i=v?.diff||"";if(!i.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:d("No diff content available.")});const g=i.split(`
|
|
2
|
+
`);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:g.map((l,C)=>{let b="",N="text-neutral-400";return l.startsWith("+")&&!l.startsWith("+++")?(b="bg-emerald-950/40",N="text-emerald-400"):l.startsWith("-")&&!l.startsWith("---")?(b="bg-red-950/40",N="text-red-400"):l.startsWith("@@")&&(b="bg-blue-950/30",N="text-blue-400"),e.jsx("div",{className:D("px-3 whitespace-pre",b,N),children:l},C)})})}function In({entry:t,type:r,workingDir:c}){const[d,v]=n.useState(!1),x=Ot[t.status]||Ot.M,f=wn(t.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>v(i=>!i),className:D("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-neutral-50",d&&"bg-neutral-50"),children:[e.jsx("span",{className:D("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",x),children:t.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:kn(t.path)}),f&&e.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:f})]}),e.jsx("span",{className:"text-neutral-400 shrink-0",children:d?e.jsx(Ce,{size:14}):e.jsx(we,{size:14})})]}),d&&e.jsx(Cn,{workingDir:c,filePath:t.path,type:r})]})}function Lt({title:t,entries:r,type:c,workingDir:d,defaultOpen:v}){const{t:x}=U(),[f,i]=n.useState(v);return r.length===0?null:e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>i(g=>!g),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-neutral-50",children:[e.jsx("span",{className:"text-neutral-400",children:f?e.jsx(Ce,{size:14}):e.jsx(we,{size:14})}),e.jsx("span",{className:"text-xs font-semibold text-neutral-500 uppercase tracking-wider",children:x(t)}),e.jsx("span",{className:"text-[10px] bg-neutral-100 px-1.5 py-0.5 rounded text-neutral-500",children:r.length})]}),f&&e.jsx("div",{className:"divide-y divide-neutral-100",children:r.map(g=>e.jsx(In,{entry:g,type:c,workingDir:d},`${c}:${g.path}`))})]})}function Sn({workingDir:t}){const{t:r}=U(),{data:c,isLoading:d,isError:v}=zt(t);if(!t)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:r("No workspace selected.")});if(d)return e.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[e.jsx(K,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-sm",children:r("Loading changes...")})]});if(v)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:r("Failed to load changes.")});const x=c?.uncommitted||[],f=c?.committed||[];return x.length+f.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[e.jsx(Xe,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:r("No pending changes")})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin overscroll-y-contain",children:[e.jsx(Lt,{title:"Uncommitted",entries:x,type:"uncommitted",workingDir:t,defaultOpen:!0}),e.jsx(Lt,{title:"Committed",entries:f,type:"committed",workingDir:t,defaultOpen:!1})]})}const _e=50,Wt={M:"text-amber-600 border-amber-200 bg-amber-50",A:"text-emerald-600 border-emerald-200 bg-emerald-50",D:"text-red-600 border-red-200 bg-red-50",R:"text-blue-600 border-blue-200 bg-blue-50"};function An(t){const c=Math.floor(Date.now()/1e3)-t;return c<60?Ne("{count}s ago",{count:c}):c<3600?Ne("{count}m ago",{count:Math.floor(c/60)}):c<86400?Ne("{count}h ago",{count:Math.floor(c/3600)}):c<604800?Ne("{count}d ago",{count:Math.floor(c/86400)}):new Date(t*1e3).toLocaleDateString()}function Rn(t){const r=t.split("/");return r[r.length-1]||t}function Tn(t){const r=t.lastIndexOf("/");return r>0?t.slice(0,r):""}function En({workingDir:t,hash:r,filePath:c}){const{t:d}=U(),{data:v,isLoading:x,isError:f}=Ks(t,r,c);if(x)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-neutral-400",children:[e.jsx(K,{size:14,className:"animate-spin"}),e.jsx("span",{className:"text-xs",children:d("Loading diff...")})]});if(f)return e.jsx("div",{className:"px-3 py-3 text-xs text-red-500",children:d("Failed to load diff.")});const i=v?.diff||"";if(!i.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:d("No diff content available.")});const g=i.split(`
|
|
3
|
+
`);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin bg-neutral-950 rounded-lg mx-3 mb-3 font-mono text-[11px] leading-5",children:g.map((l,C)=>{let b="",N="text-neutral-400";return l.startsWith("+")&&!l.startsWith("+++")?(b="bg-emerald-950/40",N="text-emerald-400"):l.startsWith("-")&&!l.startsWith("---")?(b="bg-red-950/40",N="text-red-400"):l.startsWith("@@")&&(b="bg-blue-950/30",N="text-blue-400"),e.jsx("div",{className:D("px-3 whitespace-pre",b,N),children:l},C)})})}function Mn({entry:t,workingDir:r,hash:c}){const[d,v]=n.useState(!1),x=Wt[t.status]||Wt.M,f=Tn(t.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>v(i=>!i),className:D("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-neutral-50",d&&"bg-neutral-50"),children:[e.jsx("span",{className:D("w-5 h-5 flex items-center justify-center text-[10px] font-bold border rounded shrink-0",x),children:t.status}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-neutral-900 truncate block",children:Rn(t.path)}),f&&e.jsx("span",{className:"text-[11px] text-neutral-400 truncate block",children:f})]}),e.jsx("span",{className:"text-neutral-400 shrink-0",children:d?e.jsx(Ce,{size:14}):e.jsx(we,{size:14})})]}),d&&e.jsx(En,{workingDir:r,hash:c,filePath:t.path})]})}function Pn({commit:t,workingDir:r}){const{t:c}=U(),[d,v]=n.useState(!1),{data:x,isLoading:f}=_s(r,d?t.hash:null),i=x?.files||[];return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>v(g=>!g),className:D("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-neutral-50",d&&"bg-neutral-50"),children:[e.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:e.jsx("div",{className:D("w-2.5 h-2.5 rounded-full shrink-0",d?"bg-blue-500":"bg-neutral-300")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-mono text-blue-600 shrink-0",children:t.shortHash}),e.jsx("span",{className:"text-sm text-neutral-900 truncate flex-1",children:t.message})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"text-[11px] text-neutral-500 truncate",children:t.author}),e.jsx("span",{className:"text-[11px] text-neutral-400",children:An(t.timestamp)})]})]}),e.jsx("span",{className:"text-neutral-400 shrink-0 pt-0.5",children:d?e.jsx(Ce,{size:14}):e.jsx(we,{size:14})})]}),d&&e.jsxs("div",{className:"pl-4 border-l-2 border-blue-100 ml-[22px]",children:[t.body&&e.jsx("div",{className:"px-3 py-2 text-xs text-neutral-600 whitespace-pre-wrap leading-4",children:t.body}),f?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-neutral-400",children:[e.jsx(K,{size:14,className:"animate-spin"}),e.jsx("span",{className:"text-xs",children:c("Loading files...")})]}):i.length===0?e.jsx("div",{className:"px-3 py-3 text-xs text-neutral-400",children:c("No files changed")}):e.jsx("div",{className:"divide-y divide-neutral-100",children:i.map(g=>e.jsx(Mn,{entry:g,workingDir:r,hash:t.hash},g.path))})]})]})}function On({workingDir:t}){const{t:r}=U(),{data:c,isLoading:d,isError:v,fetchNextPage:x,hasNextPage:f,isFetchingNextPage:i}=$s({queryKey:Qe.git.log(t||""),queryFn:({pageParam:l=0})=>Dt.get("/git/log",{params:{workingDir:t||"",limit:String(_e),skip:String(l)}}),initialPageParam:0,getNextPageParam:(l,C)=>l.commits.length<_e?void 0:C.length*_e,enabled:!!t}),g=c?.pages.flatMap(l=>l.commits)||[];return t?d?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-neutral-400",children:[e.jsx(K,{size:16,className:"animate-spin mr-2"}),e.jsx("span",{className:"text-sm",children:r("Loading history...")})]}):v?e.jsx("div",{className:"flex-1 flex items-center justify-center text-red-500 text-sm",children:r("Failed to load history.")}):g.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-neutral-400 py-16",children:[e.jsx(Bt,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:r("No commit history")})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin overscroll-y-contain",children:[e.jsx("div",{className:"divide-y divide-neutral-100",children:g.map(l=>e.jsx(Pn,{commit:l,workingDir:t},l.hash))}),f&&e.jsx("button",{type:"button",onClick:()=>x(),disabled:i,className:"w-full py-4 text-sm text-neutral-500 active:text-neutral-700 active:bg-neutral-50 flex items-center justify-center gap-2",children:i?e.jsxs(e.Fragment,{children:[e.jsx(K,{size:14,className:"animate-spin"})," ",r("Loading...")]}):r("Load more")})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-neutral-400 text-sm",children:r("No workspace selected.")})}const Ln=Is(),Wn=t=>t.includes("://")||t.startsWith("/api/")?t:t.startsWith("/")?`${Ln}/attachments/by-path?path=${encodeURIComponent(t)}`:t;function Dn({status:t}){const r={[ie.Running]:"bg-blue-500",[ie.Review]:"bg-amber-500",[ie.Pending]:"bg-neutral-400",[ie.Done]:"bg-emerald-500",[ie.Cancelled]:"bg-neutral-400"};return e.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${r[t]}`})}const zn=[{key:"chat",label:"Chat",icon:Gt},{key:"changes",label:"Changes",icon:Xe},{key:"history",label:"History",icon:Bt},{key:"workspace",label:"Workspace",icon:Ft}],Bn=[{key:"chat",label:"Team room",icon:Gt},{key:"team-status",label:"Team Status",icon:ks},{key:"changes",label:"Changes",icon:Xe},{key:"workspace",label:"Workspace",icon:Ft}];function Sa({task:t,onBack:r,onDeleteTask:c,onTaskPriorityChange:d,isDeleting:v,autoStartState:x,onAutoStartRecovered:f}){const{t:i}=U(),g=bs(s=>s.setVisibleContext),[l,C]=n.useState("chat"),[b,N]=n.useState(""),[Ut,le]=n.useState(!1),[qt,Ie]=n.useState(!1),[Se,Ae]=n.useState(!1),[T,Re]=n.useState(null),[Q,X]=n.useState(void 0),Ye=n.useRef(0),[Vt,Te]=n.useState(),Ee=n.useRef(null),Me=n.useRef(null),Y=n.useRef(null),Ze=n.useRef(null),{scrollRef:z,contentRef:Je,isAtBottom:et,scrollToBottom:oe,stopScroll:tt}=Ts({resize:"smooth",initial:"instant"}),q=vs();n.useEffect(()=>{if(!Se)return;const s=a=>{Me.current&&!Me.current.contains(a.target)&&Ae(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[Se]);const{data:o,isLoading:Ht}=hn(t.id),Z=Qs(t.id),st=Z?.status==="completed"&&x?.status!=="failed"?null:x,Pe=!!(st||Z&&Z.status!=="completed"),{data:ce}=js(t.id),{data:$t}=ys(ce?.id??""),nt=Ns(ce?.id??""),h=ce??null,M=t.isGitRepo!==!1&&t.worktreeReady!==!1,Oe=n.useMemo(()=>(h?Bn:zn).filter(s=>M||s.key!=="changes"&&s.key!=="history"),[M,h]),_t=ce===null,{data:J,isLoading:Kt}=ws(t.id,_t),k=!!t.projectArchivedAt,at=!!t.projectRepoDeletedAt,Le=i(at?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。");n.useEffect(()=>{X(void 0),Re(null),Te(void 0)},[t.id]),n.useEffect(()=>{h&&l==="history"&&C("chat"),!h&&l==="team-status"&&C("chat"),Oe.some(s=>s.key===l)||C("chat")},[l,Oe,h]);const B=n.useMemo(()=>Xs(o,h,Q),[Q,h,o]);n.useEffect(()=>{Q&&!o?.some(s=>s.id===Q)&&X(void 0)},[Q,o]);const w=n.useMemo(()=>o?.find(s=>s.id===B),[B,o]),A=n.useMemo(()=>{if(o){if(w)return ke(w);for(const s of o)if(s.status==="ACTIVE"&&ke(s))return ke(s);return ke(o[0])}},[w,o]),E=w?.status===Ss.ACTIVE?w.id:void 0,We=M&&Ys(w,h),De=w?.branchName??"",rt=w?.commitMessage,ze=n.useMemo(()=>Zs(w,o,t?.mainBranch??""),[w,t?.mainBranch,o]),ee=!!(We&&E&&A&&!k),{data:P,isLoading:Qt}=fn(E??"",{enabled:ee}),{data:it}=zt(A,{enabled:ee}),Xt=it?.committed?.length,[lt,ot]=n.useState(!1),[ct,dt]=n.useState(null);n.useEffect(()=>{const s=M&&(l==="changes"||l==="chat"&&ee)?"changes":M&&l==="history"?"history":null;if(!E||!A||!s){g(null);return}return g({workspaceId:E,workingDir:A,tab:s}),()=>{g(null)}},[l,M,E,g,ee,A]);const I=n.useMemo(()=>P?.conflictOp&&P.conflictedFiles.length>0?{conflictOp:P.conflictOp,conflictedFiles:P.conflictedFiles}:ct,[P?.conflictOp,P?.conflictedFiles,ct]),ut=I?.targetWorkspaceId??E,Yt=I?.targetWorktreePath??w?.worktreePath,Zt=I?.sourceBranch??De,Jt=I?.targetBranch??ze,es=w?.sessions??[],Be=n.useCallback(s=>{dt(s??null),ot(!0)},[]),mt=n.useCallback(()=>t?.id?q.invalidateQueries({queryKey:Qe.workspaces.list(t.id)}):Promise.resolve(),[t?.id,q]),Fe=n.useCallback(async()=>q.fetchQuery({queryKey:Qe.tasks.body(t.id),queryFn:()=>Dt.get(`/tasks/${t.id}/body`)}),[q,t.id]),S=n.useMemo(()=>{if(!o)return null;const s=o.filter(p=>p.status==="ACTIVE"&&Array.isArray(p.sessions)).flatMap(p=>p.sessions??[]),a=p=>{const $=p.createdAt,_=p.endedAt??p.startedAt??$;if(!_)return 0;const ye=Date.parse(_);return Number.isNaN(ye)?0:ye},u=p=>{const $=s.filter(_=>p.includes(_.status));return $.length===0?null:$.sort((_,ye)=>a(ye)-a(_))[0]??null},m=u([W.RUNNING])??u([W.PENDING])??u([W.COMPLETED,W.FAILED,W.CANCELLED]);if(m)return m;const L=o.filter(p=>(p.status==="ABANDONED"||p.status==="MERGED"||p.status==="HIBERNATED")&&Array.isArray(p.sessions)).flatMap(p=>p.sessions??[]).filter(p=>[W.COMPLETED,W.FAILED,W.CANCELLED].includes(p.status));return L.length===0?null:L.sort((p,$)=>a($)-a(p))[0]??null},[o]),j=S?.id??"",de=h?T??"":j,ts=n.useMemo(()=>{if(!T||!o)return null;for(const s of o){const a=s.sessions?.find(u=>u.id===T);if(a)return a}return null},[T,o]),Ge=n.useMemo(()=>{if(!T||!h?.invocations)return null;const s=h.invocations.filter(a=>a.sessionId===T);return s.length===0?null:s.sort((a,u)=>{const m=Date.parse(a.updatedAt??a.createdAt??""),R=Date.parse(u.updatedAt??u.createdAt??"");return(Number.isNaN(R)?0:R)-(Number.isNaN(m)?0:m)})[0]??null},[T,h?.invocations]),ss=n.useMemo(()=>!Ge?.memberId||!h?.members?null:h.members.find(s=>s.id===Ge.memberId)??null,[Ge?.memberId,h?.members]),y=T?ts:S??null,V=y?.id,H=n.useMemo(()=>{if(y?.workspaceId)return y.workspaceId;if(!(!y||!o))return o.find(s=>s.sessions?.some(a=>a.id===y.id))?.id},[y,o]),ue=n.useCallback((s,a)=>{const m=(a&&o?.some(R=>R.id===a)?a:void 0)??H??B??void 0;m&&X(m),Ye.current+=1,Te({id:Ye.current,source:s,workspaceId:m}),C("workspace")},[H,B,o]),Ue=n.useCallback((s,a)=>{ue({kind:"web",url:s},a)},[ue]),qe=n.useCallback((s,a,u)=>{ue({kind:"visualization",sessionId:s,file:a},u)},[ue]),xt=n.useCallback(s=>{Ue(s,H)},[H,Ue]),pt=n.useCallback(s=>{V&&qe(V,s,H)},[V,H,qe]),{isActive:te,isCancelling:se}=Fs(V??"",y?.status),ns=n.useMemo(()=>!S||!o?!1:!o.some(a=>a.status==="ACTIVE"&&a.sessions?.some(u=>u.id===S.id)),[S,o]),{data:me}=bn(),[ht,as]=n.useState(null),xe=ht?.sessionId===j?ht.providerId:S?.providerId??null,pe=S?Ds(me,xe):void 0,rs=n.useCallback(s=>{as({sessionId:j,providerId:s})},[j]),F=Gs({agentType:S?.agentType,workingDir:A,input:b,setInput:N,textareaRef:Y,minHeight:40,maxHeight:140}),G=Js({agentType:S?.agentType,workingDir:A,input:b,setInput:N,textareaRef:Y,minHeight:40,maxHeight:140}),he=A&&w?w.id:void 0,fe=Us(),ft=gn(),O=qs(),{isConnected:gt,isLoadingSnapshot:bt,isOutputActive:vt,lastExitAt:jt,logs:ne,entries:is,attach:ge}=Ls({sessionId:de,sessionStatus:y?.status,sessionStartedAt:y?.startedAt??y?.createdAt,sessionEndedAt:y?.endedAt??(te?null:y?.updatedAt),onExit:n.useCallback(()=>{q.invalidateQueries({queryKey:["workspaces"]})},[q])}),{todos:be}=Ws(is),{files:ls,addFiles:ve,removeFile:os,clear:yt,buildMarkdownLinks:Nt,hasFiles:ae,isUploading:je}=zs(),cs=n.useMemo(()=>en(y),[y?.tokenUsage]),kt=Es(ne,cs);n.useEffect(()=>{de&>&&ge()},[de,gt,ge]);const wt=n.useRef(null);n.useEffect(()=>{if(wt.current!==t.id&&z.current){const s=z.current;requestAnimationFrame(()=>{s.scrollTop=s.scrollHeight})}wt.current=t.id},[t.id,z]);const Ve=n.useRef(!1),Ct=n.useCallback(async()=>{if(!b.trim()&&!ae||!j||Ve.current||O.isPending||se||je||pe)return;Ve.current=!0;const s=Nt(),a=[b.trim(),s].filter(Boolean).join(`
|
|
4
|
+
|
|
5
|
+
`);N(""),yt(),Y.current&&(Y.current.style.height="40px"),fe.mutate({id:j,message:a,providerId:xe??void 0},{onSuccess:()=>ge(),onError:()=>N(u=>u||a),onSettled:()=>{Ve.current=!1}})},[b,j,fe,ge,ae,je,Nt,yt,xe,pe,O.isPending,se]),ds=n.useCallback(()=>{!j||O.isPending||O.mutate(j)},[j,O]),us=n.useCallback(s=>nt.mutateAsync(s),[nt]),It=n.useCallback(s=>{Re(s),C("chat"),requestAnimationFrame(()=>{oe()})},[oe]),ms=n.useCallback(()=>{Re(null)},[]),xs=n.useCallback(()=>{C("changes")},[]),St=ee&&E?e.jsx(tn,{projectId:t?.projectId??"",workspaceId:E,branchName:De,targetBranch:ze,commitMessage:rt,changes:it,gitStatus:P,isGitStatusLoading:Qt,canRunGitOperations:We,onOpenChanges:xs,onRefreshCommitMessage:mt,onConflict:Be,className:"mb-2"}):null,ps=n.useCallback(s=>{const a=s.target.files;a&&a.length>0&&ve(Array.from(a)),s.target.value=""},[ve]),hs=n.useCallback(s=>{const a=s.clipboardData.items,u=[];for(const m of a)if(m.kind==="file"){const R=m.getAsFile();R&&u.push(R)}u.length>0&&(s.preventDefault(),ve(u))},[ve]),fs=n.useCallback(s=>{N(s.target.value);const a=s.target;a.style.height="auto",a.style.height=`${Math.max(40,Math.min(a.scrollHeight,140))}px`},[]),gs=n.useCallback(()=>{he&&ft.mutate({workspaceId:he})},[ft,he]),re=n.useRef(null);return n.useEffect(()=>{const s=window.visualViewport;if(!s)return;let a=!1;const u=()=>{re.current&&(re.current.style.height=`${s.height}px`,re.current.style.top=`${s.offsetTop}px`)},m=()=>u(),R=()=>{a||u()},L=()=>{a=!0},p=()=>{a=!1,requestAnimationFrame(u)};return s.addEventListener("resize",m),s.addEventListener("scroll",R),document.addEventListener("touchstart",L,{passive:!0}),document.addEventListener("touchend",p,{passive:!0}),document.addEventListener("touchcancel",p,{passive:!0}),()=>{s.removeEventListener("resize",m),s.removeEventListener("scroll",R),document.removeEventListener("touchstart",L),document.removeEventListener("touchend",p),document.removeEventListener("touchcancel",p)}},[]),n.useEffect(()=>{const s=re.current;if(!s)return;const a=u=>{let m=u.target;for(;m&&m!==s;){if(m.tagName==="TEXTAREA"){if(m.scrollHeight>m.clientHeight)return;m=m.parentElement;continue}const L=window.getComputedStyle(m).overflowY;if((L==="auto"||L==="scroll")&&m.scrollHeight>m.clientHeight)return;m=m.parentElement}u.preventDefault()};return s.addEventListener("touchmove",a,{passive:!1}),()=>s.removeEventListener("touchmove",a)},[]),e.jsxs("div",{ref:re,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-white overflow-hidden overscroll-none",children:[e.jsxs("header",{className:"shrink-0 bg-white border-b border-neutral-200 z-20",children:[e.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[e.jsx("button",{onClick:r,className:"p-1.5 -ml-0.5 text-neutral-600 active:text-neutral-900",children:e.jsx(At,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(sn,{taskId:t.id,title:t.title,readOnly:k,titleClassName:"text-[13px] font-bold text-neutral-900 truncate leading-tight",compact:!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-[11px] text-neutral-500 leading-tight",children:[e.jsx("span",{className:`truncate font-medium ${t.projectColor}`,children:t.projectName}),t.projectArchivedAt&&e.jsx("span",{className:"rounded-full bg-neutral-100 px-1.5 py-0.5 text-[10px] font-medium text-neutral-500",children:t.projectRepoDeletedAt?i("源码已删除"):i("已删除")}),e.jsx("span",{className:"text-neutral-300",children:"/"}),e.jsx("span",{className:"font-mono truncate",children:t.branch})]})]}),e.jsx(Dn,{status:t.status}),e.jsx(Vs,{value:t.priority,compact:!0,onChange:!k&&d?s=>d(t.id,s):void 0}),e.jsx("button",{onClick:gs,disabled:!he||k,className:"p-1.5 text-neutral-400 active:text-neutral-900 disabled:opacity-30",children:e.jsx(pn,{size:16})}),c&&!k&&e.jsxs("div",{className:"relative",ref:Me,children:[e.jsx("button",{onClick:()=>Ae(s=>!s),className:"p-1.5 text-neutral-400 active:text-neutral-900","aria-label":"More actions",children:e.jsx(nn,{size:16})}),Se&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-40 bg-white rounded-lg border border-neutral-200 shadow-lg z-50 py-1",children:e.jsxs("button",{onClick:()=>{Ie(!0),Ae(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-600 active:bg-red-50",children:[e.jsx(jn,{size:15}),e.jsx("span",{children:i("删除任务")})]})})]})]}),e.jsx("div",{className:"flex border-t border-neutral-100",children:Oe.map(({key:s,label:a,icon:u})=>e.jsxs("button",{onClick:()=>C(s),className:`flex min-w-0 flex-1 items-center justify-center gap-1 px-1 py-2 text-[11px] font-medium transition-colors ${l===s?"text-neutral-900 border-b-2 border-neutral-900":"text-neutral-400 border-b-2 border-transparent"}`,children:[e.jsx(u,{size:13,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:i(a)})]},s))})]}),l==="chat"&&(h?e.jsx("main",{className:"flex-1 min-h-0 overflow-hidden",children:T?e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-white",children:[e.jsxs("div",{className:"relative z-20 flex shrink-0 items-center justify-between gap-3 overflow-visible border-b border-neutral-200 px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-neutral-900",children:i("Invocation details")}),e.jsx("div",{className:"truncate text-[11px] text-neutral-500",children:T})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(an,{session:y,providers:me,usage:kt,compact:!0,providerIdFallback:ss?.providerId,agentTypeFallback:y?.agentType,tokenTooltipSide:"bottom"}),e.jsxs(He,{type:"button",size:"xs",variant:"ghost",className:"h-7 gap-1 rounded-lg border border-neutral-200/70 bg-white/60 px-1.5 text-[11px] font-medium text-neutral-500 hover:border-neutral-300 hover:bg-neutral-100 hover:text-neutral-900 active:bg-neutral-100",onClick:ms,children:[e.jsx(At,{size:12}),e.jsx("span",{children:i("Team room")})]})]})]}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:z,className:"h-full overflow-y-auto overflow-x-hidden scrollbar-app-thin overscroll-y-contain px-3 pt-3 pb-2",children:e.jsx("div",{ref:Je,children:bt?e.jsx(Ke,{label:i("Loading logs...")}):ne.length===0?e.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:i(te?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(Tt,{children:e.jsx(Rt,{logs:ne,downloadSessionId:V,isOutputActive:vt,lastExitAt:jt,onUserToggleDetails:tt,scrollElementRef:z,onOpenPreviewUrl:xt,onOpenVisualization:pt})})})}),!et&&e.jsxs("button",{onClick:()=>oe(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":i("Scroll to bottom"),children:[e.jsx(Pt,{size:12}),e.jsx("span",{children:i("回到底部")})]})]}),be.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:e.jsx(Et,{todos:be,compact:!0})})]}):e.jsx(rn,{teamRun:h,messages:$t??h.messages??[],readOnly:k,readOnlyMessage:Le,onSendMessage:us,onViewInvocationSession:It,changeSummaryBar:St,compactComposer:!0,workingDir:A,onOpenPreviewUrl:Ue,onOpenVisualization:qe})}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:z,className:"h-full overflow-y-auto overflow-x-hidden scrollbar-app-thin overscroll-y-contain px-3 pt-3 pb-2",children:e.jsxs("div",{ref:Je,children:[e.jsx("div",{className:"mb-3 pb-2 border-b border-neutral-100",children:Kt?e.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:i("Loading...")}):J?.body?e.jsx("div",{className:"text-[13px] text-neutral-500 leading-relaxed prose prose-sm max-w-none",children:e.jsx(As,{urlTransform:Wn,components:Rs,children:J.body})}):e.jsx("p",{className:"text-[13px] text-neutral-400 italic",children:"No description"})}),!k&&e.jsx(ln,{state:st,setupProgress:Z,sessionStarted:!!S?.startedAt,onRetry:j&&x?.status==="failed"?async()=>{await Fe(),le(!0)}:void 0,compact:!0},t.id),Ht?(!Pe||k)&&e.jsx(Ke,{label:"Loading..."}):j?bt?e.jsx(Ke,{label:"Loading logs..."}):ne.length===0?e.jsx("div",{className:"text-neutral-400 text-center py-8 text-sm",children:te?"Waiting for agent output...":"No logs recorded."}):e.jsx(Tt,{children:e.jsx(Rt,{logs:ne,downloadSessionId:V,isOutputActive:vt,lastExitAt:jt,onUserToggleDetails:tt,scrollElementRef:z,onOpenPreviewUrl:xt,onOpenVisualization:pt})}):!Pe||x?.status==="failed"||Z?.status==="failed"||k?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(!Pe||k)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-12 h-12 bg-neutral-50 rounded-xl border border-neutral-100 flex items-center justify-center mb-4",children:e.jsx($e,{size:20,className:"text-neutral-400 ml-0.5"})}),e.jsx("h3",{className:"text-sm font-medium text-neutral-900 mb-1",children:i("尚未启动 Agent")}),e.jsx("p",{className:"text-xs text-neutral-500 mb-5 max-w-[240px]",children:k?Le:i("选择一个 Agent 来执行此任务")})]}),!k&&(!x||x.status==="failed")&&e.jsxs(He,{onClick:async()=>{await Fe(),le(!0)},disabled:!!(x&&x.status!=="failed"),children:[e.jsx($e,{size:16,className:"mr-1.5"}),x?.status==="failed"?i("重试启动 Agent"):i("启动 Agent")]})]}):null]})}),!et&&e.jsxs("button",{onClick:()=>oe(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-white/90 backdrop-blur-sm border border-neutral-200 rounded-full shadow-md text-[11px] text-neutral-600 active:bg-white transition-all","aria-label":"Scroll to bottom",children:[e.jsx(Pt,{size:12}),e.jsx("span",{children:i("回到底部")})]})]}),be.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-white shrink-0 border-t border-neutral-100",children:e.jsx(Et,{todos:be,compact:!0})}),k?e.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:e.jsx("div",{className:"rounded-xl border border-neutral-200 bg-neutral-50 px-3 py-2 text-xs text-neutral-500",children:Le})}):ns?e.jsx("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-neutral-200 bg-neutral-50 px-3 py-2",children:[e.jsx("span",{className:"text-xs text-neutral-500",children:i("代码已合并,以上为历史沟通记录")}),e.jsxs(He,{size:"sm",onClick:async()=>{await Fe(),le(!0)},children:[e.jsx($e,{size:14,className:"mr-1.5"}),i("启动新 Agent")]})]})}):j&&e.jsxs("div",{className:"px-3 py-2 bg-white shrink-0 border-t border-neutral-100",children:[St,e.jsx(Ms,{sessionId:de||j,compact:!0}),e.jsxs("div",{ref:Ee,className:"relative bg-white rounded-xl border border-neutral-200 shadow-sm focus-within:border-neutral-300",children:[e.jsx(Bs,{files:ls,onRemove:os}),e.jsx("textarea",{ref:Y,value:b,onChange:fs,onPaste:hs,onKeyDown:s=>{G.handleKeyDown(s)||F.handleKeyDown(s)||s.key==="Enter"&&!s.shiftKey&&!s.repeat&&!s.nativeEvent.isComposing&&s.nativeEvent.keyCode!==229&&(s.preventDefault(),Ct())},rows:1,placeholder:te?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-neutral-900 placeholder-neutral-400",style:{minHeight:40,maxHeight:140}}),e.jsx("input",{ref:Ze,type:"file",multiple:!0,className:"hidden",onChange:ps}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[e.jsx("div",{className:"flex items-center gap-0.5",children:e.jsx("button",{onClick:()=>Ze.current?.click(),className:"p-1 text-neutral-400 active:text-neutral-600 rounded-lg",children:e.jsx(yn,{size:15})})}),e.jsxs("div",{className:"flex items-center gap-1",children:[S&&me&&e.jsx(Ps,{providers:me,currentProviderId:xe,agentType:S.agentType,runtimeType:S.runtimeType,onSelect:rs}),e.jsx(Os,{usage:kt}),te&&!b.trim()&&!ae?e.jsx("button",{onClick:ds,disabled:O.isPending||se,className:"p-1.5 rounded-lg bg-red-500 text-white active:bg-red-600 disabled:opacity-50",children:e.jsx(Cs,{size:12})}):e.jsx("button",{onClick:Ct,disabled:!b.trim()&&!ae||je||fe.isPending||O.isPending||se||!!pe,className:`p-1.5 rounded-lg transition-colors ${(b.trim()||ae)&&!je&&!fe.isPending&&!O.isPending&&!se&&!pe?"bg-neutral-900 text-white active:bg-black":"bg-transparent text-neutral-300"}`,children:e.jsx(Nn,{size:15})})]})]})]}),e.jsx(Mt,{open:F.query!==null,anchorRef:Ee,commands:F.filteredCommands,selectedIndex:F.selectedIndex,query:F.query??"",hasCatalog:F.allCommands.length>0,compact:!0,onSelect:F.applyCommand}),e.jsx(Mt,{open:G.query!==null,anchorRef:Ee,commands:G.filteredSkills,selectedIndex:G.selectedIndex,query:G.query??"",hasCatalog:G.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",compact:!0,onSelect:G.applySkill})]})]})),l==="team-status"&&h&&e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(on,{teamRun:h,workspaces:o,selectedWorkspaceId:B,onSelectWorkspace:X,onViewInvocationSession:It})}),l==="changes"&&M&&e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[o&&o.length>1&&e.jsx("div",{className:"shrink-0 border-b border-neutral-100 bg-white px-3 py-2",children:e.jsx(cn,{workspaces:o,teamRun:h,selectedWorkspaceId:B,onSelectWorkspace:X,className:"w-full",buttonClassName:"w-full max-w-none min-w-0 justify-start"})}),We&&E&&e.jsx("div",{className:"shrink-0",children:e.jsx(dn,{projectId:t.projectId,workspaceId:E,branchName:De,targetBranch:ze,commitMessage:rt,committedFileCount:Xt,onRefreshCommitMessage:mt,onConflict:Be,onResolveConflicts:()=>Be()})}),e.jsx(Sn,{workingDir:A})]}),l==="history"&&e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsx(On,{workingDir:A})}),l==="workspace"&&e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(un,{sessionId:j||void 0,workspaceId:B,workingDir:A,projectId:t.projectId,className:"h-full",hideChanges:!0,gitAvailable:M,readOnly:k,repoDeleted:at,previewRequest:Vt,onPreviewRequestHandled:s=>{Te(a=>a?.id===s?void 0:a)}})}),!k&&e.jsx(mn,{isOpen:Ut,onClose:()=>le(!1),taskId:t.id,projectId:t.projectId,taskTitle:J?.title??t.title,taskDescription:J?.body??"",taskPrompt:J?.prompt,projectIsGitRepo:t.isGitRepo,projectWorktreeReady:t.worktreeReady,projectGitReason:t.reason,onStarted:()=>f?.(t.id)}),e.jsx(vn,{isOpen:qt,onClose:()=>Ie(!1),onConfirm:()=>{c?.(t.id),Ie(!1)},taskId:t.id,taskTitle:t.title,workspaces:o,isLoading:v}),lt&&I&&ut&&e.jsx(xn,{open:lt,onOpenChange:s=>{ot(s),s||dt(null)},workspaceId:ut,conflictOp:I.conflictOp,conflictedFiles:I.conflictedFiles,sourceBranch:Zt,targetBranch:Jt,operation:P?.operation,worktreePath:Yt,mergeAborted:I.mergeAborted,mergeStrategy:I.mergeStrategy,sourceWorkspaceId:I.sourceWorkspaceId,targetWorkspaceId:I.targetWorkspaceId,sourceWorktreePath:I.sourceWorktreePath,targetWorktreePath:I.targetWorktreePath,sessions:es,currentSessionId:h?void 0:j,teamRunId:h?.id})]})}function Ke({label:t}){return e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-neutral-400",children:[e.jsxs("svg",{className:"animate-spin h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:t})]})}export{Sa as MobileTaskDetail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as
|
|
1
|
+
import{m as F,o as P,n as k,q as v,p as h,u as R,r as o,j as e,S as g,U as B,h as q,i as j,V as W,I as d,B as z,E as L,W as A,k as K,Y as M}from"./index-CMJV-mgF.js";import{S as Q}from"./select-DKS02St6.js";import{S as O}from"./switch-7LWQ_sEx.js";import{M as D}from"./message-square-CFriSt4D.js";import{C as H}from"./circle-alert-Cbvy2cMo.js";import{L as V}from"./link-BUeSP3T7.js";import"./chevron-down-BaQEBzp3.js";import"./check-qs0S_9rB.js";function Y(){return F({queryKey:v.notifications.settings,queryFn:()=>h.get("/notifications/settings")})}function G(){const t=P();return k({mutationFn:a=>h.put("/notifications/settings",a),onSuccess:()=>{t.invalidateQueries({queryKey:v.notifications.settings})}})}function J(){return k({mutationFn:t=>h.post("/notifications/test",t)})}function ae(){const{t}=R(),{data:a,isLoading:T}=Y(),l=G(),n=J(),N=[{value:"none",label:t("关闭")},{value:"feishu",label:t("飞书 Webhook")}],[i,x]=o.useState({webhookUrl:"",baseUrl:"",titleTemplate:"",bodyTemplate:""}),[m,p]=o.useState(!1),[f,r]=o.useState("idle"),u=o.useRef(void 0);if(o.useEffect(()=>{a&&!m&&x({webhookUrl:a.feishuWebhookUrl??"",baseUrl:a.thirdPartyBaseUrl??"",titleTemplate:a.taskInReviewTitleTemplate??"",bodyTemplate:a.taskInReviewBodyTemplate??""})},[a,m]),o.useEffect(()=>(n.isSuccess?(r("success"),u.current=setTimeout(()=>r("idle"),3e3)):n.isError&&(r("error"),u.current=setTimeout(()=>r("idle"),5e3)),()=>clearTimeout(u.current)),[n.isSuccess,n.isError]),T)return e.jsx(g,{children:e.jsx(B,{rows:3})});const y=a?.osNotificationEnabled??!0,b=a?.thirdPartyChannel??"none",c=(s,I)=>{x(E=>({...E,[s]:I})),p(!0)},S=s=>{l.mutate({osNotificationEnabled:s})},C=s=>{l.mutate({thirdPartyChannel:s})},U=()=>{l.mutate({feishuWebhookUrl:i.webhookUrl.trim()||null,thirdPartyBaseUrl:i.baseUrl.trim()||null,taskInReviewTitleTemplate:i.titleTemplate.trim()||"Agent Tower",taskInReviewBodyTemplate:i.bodyTemplate.trim()||t('✅ "{taskTitle}" 已完成,等待审查')},{onSuccess:()=>p(!1)})},w=()=>{i.webhookUrl.trim()&&n.mutate({channel:"feishu",webhookUrl:i.webhookUrl.trim(),baseUrl:i.baseUrl.trim()||void 0})};return e.jsxs(g,{children:[e.jsx(q,{title:t("通知设置"),className:"mb-1"}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsx(j,{icon:W,label:t("桌面通知"),description:t("任务完成时弹出系统通知"),align:"center",controlWidth:"auto",children:e.jsx(O,{checked:y,onCheckedChange:S,"aria-label":t("桌面通知")})}),e.jsxs("div",{className:"py-5",children:[e.jsx(j,{icon:D,label:t("第三方通知"),description:t("推送到外部渠道(飞书群机器人等)"),align:"center",className:"py-0",children:e.jsx(Q,{value:b,onChange:s=>C(s),options:N})}),b==="feishu"&&e.jsxs("div",{className:"mt-4 space-y-4 sm:pl-11",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-webhook-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Webhook URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"feishu-webhook-url",value:i.webhookUrl,onChange:s=>c("webhookUrl",s.target.value),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"min-w-0 flex-1 font-mono"}),e.jsxs(z,{size:"sm",variant:"outline",onClick:w,disabled:!i.webhookUrl.trim()||n.isPending,className:"h-auto shrink-0",children:[n.isPending&&e.jsx(L,{size:12,className:"mr-1 animate-spin motion-reduce:animate-none"}),t("测试")]})]}),f==="success"&&e.jsxs("div",{role:"status",className:"mt-2 flex items-center gap-1.5 text-xs text-success",children:[e.jsx(A,{size:12,"aria-hidden":"true"}),t("测试消息发送成功")]}),f==="error"&&e.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-xs text-destructive",children:[e.jsx(H,{size:12,"aria-hidden":"true"}),t("发送失败,请检查 Webhook 地址")]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-base-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(V,{size:11,"aria-hidden":"true"}),t("跳转地址")]})}),e.jsx(d,{id:"feishu-base-url",value:i.baseUrl,onChange:s=>c("baseUrl",s.target.value),placeholder:"http://localhost:5173",className:"font-mono"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t('通知卡片中的"查看任务"按钮跳转地址前缀')})]})]})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(K,{children:t("通知模板")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("支持变量: {taskTitle}, {taskId}, {projectId}, {projectName}, {status}",{taskTitle:"{taskTitle}",taskId:"{taskId}",projectId:"{projectId}",projectName:"{projectName}",status:"{status}"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-title-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("标题")}),e.jsx(d,{id:"notification-title-template",value:i.titleTemplate,onChange:s=>c("titleTemplate",s.target.value),placeholder:"Agent Tower"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-body-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("内容")}),e.jsx(d,{id:"notification-body-template",value:i.bodyTemplate,onChange:s=>c("bodyTemplate",s.target.value),placeholder:t('✅ "{taskTitle}" 已完成,等待审查')})]})]})]})]}),m&&e.jsx(M,{saving:l.isPending,onSave:U})]})}export{ae as NotificationSettingsPage};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{u as T,r as g,j as e,S,h as J,v as M,w,I as U,B as E,x as p,l as P}from"./index-
|
|
1
|
+
import{u as T,r as g,j as e,S,h as J,v as M,w,I as U,B as E,x as p,l as P}from"./index-CMJV-mgF.js";import{u as _,a as z,b as B,c as F}from"./use-profiles-nMPGwy3v.js";import{M as G}from"./modal-DeigO7aN.js";import{C as $}from"./confirm-dialog-BrgNTypL.js";import{T as R}from"./textarea-Ft9KMoEI.js";import{L as H}from"./layers-Dda7MM7a.js";import{C as q}from"./chevron-down-BaQEBzp3.js";import{P as K,T as Q}from"./trash-2-Bc-URu8c.js";import{P as W}from"./pencil-BRQ9W_a-.js";function X(t){const a=Object.entries(t);return a.length===0?"(empty)":a.map(([m,c])=>`${m}: ${JSON.stringify(c)}`).join(", ")}const y={CLAUDE_CODE:"Claude Code",GEMINI_CLI:"Gemini CLI",CURSOR_AGENT:"Cursor Agent"};function Y({agentType:t,variants:a,isBuiltIn:m,onEdit:c,onNew:h,onDelete:j}){const{t:n}=T(),[r,b]=g.useState(!0),u=Object.entries(a);return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 bg-muted/40 px-4 py-3",children:[e.jsxs("button",{type:"button",onClick:()=>b(i=>!i),"aria-expanded":r,className:"flex items-center gap-3 rounded-md transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-foreground",children:y[t]??t}),e.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[u.length," ",n("个变体")]}),e.jsx(q,{size:14,"aria-hidden":"true",className:P("text-muted-foreground transition-transform motion-reduce:transition-none",r&&"rotate-180")})]}),e.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsx(K,{size:12,"aria-hidden":"true"}),n("新增")]})]}),r&&e.jsxs("div",{className:"divide-y divide-border/60",children:[u.map(([i,x])=>{const f=m(i);return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-muted/40",children:[e.jsx("span",{className:P("inline-flex shrink-0 items-center rounded px-2 py-0.5 text-[11px] font-semibold tracking-wide",i==="DEFAULT"?"bg-primary/[0.06] text-primary":"bg-muted text-muted-foreground"),children:i}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground",children:X(x)}),f&&e.jsx("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground/70",children:n("内置")}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx("button",{onClick:()=>c(i,x),className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",title:n("编辑"),"aria-label":n("编辑"),children:e.jsx(W,{size:12})}),!f&&e.jsx("button",{onClick:()=>j(i),className:"flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",title:n("删除"),"aria-label":n("删除"),children:e.jsx(Q,{size:12})})]})]},i)}),u.length===0&&e.jsx("div",{className:"px-4 py-4 text-center text-xs text-muted-foreground",children:n("暂无变体")})]})]})}function Z(){return e.jsxs("div",{role:"status","aria-label":"Loading",children:[e.jsx(p,{className:"h-7 w-36"}),e.jsx(p,{className:"mt-2 h-3.5 w-72 max-w-full"}),e.jsx("div",{className:"mt-5 space-y-3",children:Array.from({length:2}).map((t,a)=>e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center gap-3 bg-muted/40 px-4 py-3",children:[e.jsx(p,{className:"h-4 w-28"}),e.jsx(p,{className:"h-3 w-14"})]}),e.jsx("div",{className:"divide-y divide-border/60",children:Array.from({length:2}).map((m,c)=>e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[e.jsx(p,{className:"h-5 w-16 rounded"}),e.jsx(p,{className:"h-3.5 flex-1"})]},c))})]},a))})]})}function de(){const{t}=T(),{data:a,isLoading:m}=_(),{data:c}=z(),h=B(),j=F(),[n,r]=g.useState(null),[b,u]=g.useState(""),[i,x]=g.useState(""),[f,v]=g.useState(""),[o,N]=g.useState(null),k=(s,l,d)=>{r({agentType:s,variant:l,config:d,isNew:!1}),x(l),u(JSON.stringify(d,null,2)),v("")},O=s=>{r({agentType:s,variant:"",config:{},isNew:!0}),x(""),u(`{
|
|
2
2
|
|
|
3
3
|
}`),v("")},D=()=>{if(!(!n||!i.trim()))try{const s=JSON.parse(b);v(""),h.mutate({agentType:n.agentType,variant:i.trim().toUpperCase(),config:s},{onSuccess:()=>r(null)})}catch{v(t("JSON 格式错误"))}},L=(s,l)=>{N({agentType:s,variant:l})},A=()=>{o&&j.mutate({agentType:o.agentType,variant:o.variant},{onSettled:()=>N(null)})},I=(s,l)=>!!c?.executors[s]?.[l];if(m)return e.jsx(S,{children:e.jsx(Z,{})});const C=a?.executors??{};return e.jsxs(S,{children:[e.jsx(J,{title:t("Profile 配置"),description:t("管理 Agent 执行器的配置变体。每个变体定义一组运行参数。"),className:"mb-4"}),e.jsx("div",{className:"space-y-3",children:Object.entries(C).map(([s,l])=>e.jsx(Y,{agentType:s,variants:l,isBuiltIn:d=>I(s,d),onEdit:(d,V)=>k(s,d,V),onNew:()=>O(s),onDelete:d=>L(s,d)},s))}),Object.keys(C).length===0&&e.jsx(M,{icon:H,message:t("暂无 Profile 配置")}),e.jsx(G,{isOpen:!!n,onClose:()=>r(null),title:n?.isNew?t("新增 Variant — {agentType}",{agentType:y[n.agentType]??n.agentType}):t("编辑 {variant}",{variant:n?.variant??""}),action:e.jsxs(e.Fragment,{children:[e.jsx(E,{variant:"outline",onClick:()=>r(null),children:t("取消")}),e.jsx(E,{onClick:D,disabled:h.isPending,children:h.isPending?t("保存中..."):t("保存")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{label:t("Variant 名称"),htmlFor:"profile-variant-name",children:e.jsx(U,{id:"profile-variant-name",value:i,onChange:s=>x(s.target.value),disabled:!n?.isNew,placeholder:t("例如: CUSTOM"),className:"font-mono"})}),e.jsxs(w,{label:t("配置 (JSON)"),htmlFor:"profile-variant-json",children:[e.jsx(R,{id:"profile-variant-json",value:b,onChange:s=>{u(s.target.value),v("")},rows:6,className:"resize-none font-mono","aria-invalid":!!f}),f&&e.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:f})]})]})}),e.jsx($,{isOpen:o!==null,onClose:()=>{j.isPending||N(null)},onConfirm:A,title:t("删除 Profile Variant"),description:o?t('确定删除 "{name}"?此操作不可撤销。',{name:`${y[o.agentType]??o.agentType} / ${o.variant}`}):"",confirmText:t("删除"),cancelText:t("取消"),variant:"danger",isLoading:j.isPending})]})}export{de as ProfileSettingsPage};
|