agent-tower 0.7.0-beta.1 → 0.7.0-beta.3
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__/acp-driver-lifecycle.test.js +295 -1
- package/dist/runtime/__tests__/acp-driver-lifecycle.test.js.map +1 -1
- package/dist/runtime/acp/acp-driver.d.ts.map +1 -1
- package/dist/runtime/acp/acp-driver.js +152 -3
- package/dist/runtime/acp/acp-driver.js.map +1 -1
- package/dist/services/__tests__/conversation.service.test.js +126 -0
- package/dist/services/__tests__/conversation.service.test.js.map +1 -1
- package/dist/services/session-manager.d.ts.map +1 -1
- package/dist/services/session-manager.js +48 -1
- package/dist/services/session-manager.js.map +1 -1
- package/dist/web/assets/AgentDemoPage-Bz3RnDCN.js +1 -0
- package/dist/web/assets/{AgentEnvironmentSettingsPage-CgKLuSVi.js → AgentEnvironmentSettingsPage-CDWsry49.js} +1 -1
- package/dist/web/assets/{AgentLogo-BoU-DtS1.js → AgentLogo-CRz3CfP5.js} +1 -1
- package/dist/web/assets/ConversationPage-U5VIw8hs.js +3 -0
- package/dist/web/assets/CreateTaskInput-CX7_o02E.js +1 -0
- package/dist/web/assets/{DemoPage-C_pqLAig.js → DemoPage-DwoVTSFm.js} +3 -3
- package/dist/web/assets/{GeneralSettingsPage-DgGDkCei.js → GeneralSettingsPage-CH7NW0Q1.js} +1 -1
- package/dist/web/assets/{Icons-DxojzzgC.js → Icons-BsJUZk4z.js} +1 -1
- package/dist/web/assets/{LoadingPreviewPage-DB31Bua7.js → LoadingPreviewPage-sN12whUD.js} +1 -1
- package/dist/web/assets/{McpSettingsPage-CbD2WS6_.js → McpSettingsPage-D6dQVSij.js} +1 -1
- package/dist/web/assets/{MemberAvatar-C3SWnA21.js → MemberAvatar-0z2Vg7fM.js} +1 -1
- package/dist/web/assets/{NotificationSettingsPage-B8phwndw.js → NotificationSettingsPage-Zzsus8n0.js} +1 -1
- package/dist/web/assets/ProfileSettingsPage-Ck5bJV8U.js +3 -0
- package/dist/web/assets/{ProjectKanbanPage-Do_CnL-A.js → ProjectKanbanPage-Dy1q4F4o.js} +31 -31
- package/dist/web/assets/ProjectSettingsPage-CG599xXR.js +2 -0
- package/dist/web/assets/{ProviderSettingsPage-Df0hDNzv.js → ProviderSettingsPage-DI8pXhJO.js} +2 -2
- package/dist/web/assets/SettingsMasterDetail-BgUcVoVU.js +1 -0
- package/dist/web/assets/TeamSettingsPage-CQYgBktd.js +1 -0
- package/dist/web/assets/{arc-OZ-vceMZ.js → arc-C0TZ2Mr-.js} +1 -1
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-BsdLkW1k.js → architectureDiagram-3BPJPVTR-BfAyZiaB.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-BkhEbwDp.js → blockDiagram-GPEHLZMM-Bw4bLBtW.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-COVRvZYn.js → c4Diagram-AAUBKEIU-DJxag49S.js} +1 -1
- package/dist/web/assets/channel-Rd2UMQwz.js +1 -0
- package/dist/web/assets/check-BVfJOKK5.js +1 -0
- package/dist/web/assets/{chevron-down-DO8ocuLa.js → chevron-down-gt857XmZ.js} +1 -1
- package/dist/web/assets/{chevron-right-ffReG4fO.js → chevron-right-Dn5EL2Lm.js} +1 -1
- package/dist/web/assets/{chevron-up-1qS5XjTW.js → chevron-up-Dv5ThQH5.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-Dtd7OE6g.js → chunk-2J33WTMH-71tuZDDX.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-BYB7bgup.js → chunk-4BX2VUAB-CJ5SCvua.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-D8eXYUvV.js → chunk-55IACEB6-D3qUQw2o.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-CsspkJZ6.js → chunk-727SXJPM-e-4CtmqG.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-C4wKQyQJ.js → chunk-AQP2D5EJ-bktXIBYA.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-BgPjdYy6.js → chunk-FMBD7UC4--QBxBR_l.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-DQZQZp-p.js → chunk-ND2GUHAM-D6p_CtQB.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-CzuoyrRN.js → chunk-QZHKN3VN-DxmZnnse.js} +1 -1
- package/dist/web/assets/{circle-alert-BhLONgEk.js → circle-alert-BeGGmA-3.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-Dv78yDSv.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-Dv78yDSv.js +1 -0
- package/dist/web/assets/{code-block-OCS4YCEC-BuMUnxsm.js → code-block-OCS4YCEC-1KMwkqn9.js} +1 -1
- package/dist/web/assets/{confirm-dialog-CDinB23R.js → confirm-dialog-CMtca90c.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-BLfinhMU.js → cose-bilkent-S5V4N54A-CKIKijp7.js} +1 -1
- package/dist/web/assets/cssMode-D8Dg9C1q.js +1 -0
- package/dist/web/assets/{dagre-BM42HDAG-Bu5izb1v.js → dagre-BM42HDAG-jag-rU-a.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-CsRWxFV2.js → diagram-2AECGRRQ-DlSUMPBb.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-DrNRWf6l.js → diagram-5GNKFQAL-gJzBEa1h.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-Dp7EY_gD.js → diagram-KO2AKTUF-CK-dl0Mm.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-BDIdwePd.js → diagram-LMA3HP47-nd0QxqLP.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-CmfR47dA.js → diagram-OG6HWLK6-0UCe4OEH.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-Cy8PFuSb.js → erDiagram-TEJ5UH35-DwJFF8MD.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-oE2ffGw2.js → flowDiagram-I6XJVG4X-DJGfuTg-.js} +1 -1
- package/dist/web/assets/{folder-picker-0bwm5YE1.js → folder-picker-AfAde06M.js} +1 -1
- package/dist/web/assets/{freemarker2-B7H4PRb5.js → freemarker2-ByNQbhxB.js} +2 -2
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-CUBDtOgX.js → ganttDiagram-6RSMTGT7-C6zNqsn4.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-CZe4VCfm.js → gitGraphDiagram-PVQCEYII-CAkDPCOB.js} +1 -1
- package/dist/web/assets/handlebars-9LtiNcLO.js +1 -0
- package/dist/web/assets/html-BwSL2qe7.js +1 -0
- package/dist/web/assets/htmlMode-0mfuF13e.js +1 -0
- package/dist/web/assets/{index-BRYW86tJ.js → index-B5PmQdbq.js} +4 -4
- package/dist/web/assets/index-CBhC80Wq.js +122 -0
- package/dist/web/assets/index-CxCjROy9.css +1 -0
- package/dist/web/assets/{infoDiagram-5YYISTIA-DrabPhph.js → infoDiagram-5YYISTIA-DJylJYHq.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-DIfxSpBY.js → ishikawaDiagram-YF4QCWOH-Da6zdjFO.js} +1 -1
- package/dist/web/assets/javascript-CJNcoLqd.js +1 -0
- package/dist/web/assets/{journeyDiagram-JHISSGLW-B7LiYPZk.js → journeyDiagram-JHISSGLW-DrjNy1ij.js} +1 -1
- package/dist/web/assets/{jsonMode-Cu2lWLKX.js → jsonMode-BEBKjViV.js} +4 -4
- package/dist/web/assets/{kanban-definition-UN3LZRKU-DJ0tk4QS.js → kanban-definition-UN3LZRKU-DNc4IquB.js} +1 -1
- package/dist/web/assets/{layers-DRg_mgyk.js → layers-CPYZanud.js} +1 -1
- package/dist/web/assets/{linear-BHW5IboQ.js → linear-BsMeiiUP.js} +1 -1
- package/dist/web/assets/liquid-BZSJkIo-.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-DBps116H.js → lspLanguageFeatures-u5EzjXi-.js} +1 -1
- package/dist/web/assets/mdx-Bjp1I9VZ.js +1 -0
- package/dist/web/assets/mermaid-NOHMQCX5-juygW0p8.js +124 -0
- package/dist/web/assets/{message-square-CTVVQxz6.js → message-square-DMhmeoQR.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-BcqEpIG8.js → mindmap-definition-RKZ34NQL-BZTf4eUu.js} +1 -1
- package/dist/web/assets/{modal-D1r-F18d.js → modal-DdlXdmPL.js} +1 -1
- package/dist/web/assets/{monaco-BDVujhQR.js → monaco-B4gWh5LA.js} +3 -3
- package/dist/web/assets/{pencil-CniYlzH3.js → pencil-BQnPUnRD.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-CI7jsHUn.js → pieDiagram-4H26LBE5-DmYvE5xK.js} +1 -1
- package/dist/web/assets/python-B32s9JOZ.js +1 -0
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-lZRO7dcp.js → quadrantDiagram-W4KKPZXB-Clc4Is7S.js} +1 -1
- package/dist/web/assets/razor-81IfaByI.js +1 -0
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-DkzFG3Tz.js → requirementDiagram-4Y6WPE33-DYAvCl67.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-D6DX95w9.js → sankeyDiagram-5OEKKPKP-BE8zoPb1.js} +1 -1
- package/dist/web/assets/{select-npOSUcpP.js → select-CifNrwRy.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-CqimAwem.js → sequenceDiagram-3UESZ5HK-CZ-1XEig.js} +1 -1
- package/dist/web/assets/{server-CP7SS59j.js → server-DIU8iWhx.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV--zm2gvoI.js → stateDiagram-AJRCARHV-BwL5WvW1.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-By_Z6bpf.js +1 -0
- package/dist/web/assets/{switch-BYTZYAl5.js → switch-C2P_p2lg.js} +1 -1
- package/dist/web/assets/{textarea-C3iQ4ONP.js → textarea-7PW0aHOr.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-DyTMvhUY.js → timeline-definition-PNZ67QCA-CJFGlrxn.js} +1 -1
- package/dist/web/assets/{trash-2-0zy3IqlI.js → trash-2-BoBBdVYu.js} +1 -1
- package/dist/web/assets/{tsMode-HgxC48Yq.js → tsMode-5BiN2VdS.js} +2 -2
- package/dist/web/assets/typescript-B3ZemQIx.js +1 -0
- package/dist/web/assets/{upload-BLZ_nRBw.js → upload-BGixJJOY.js} +1 -1
- package/dist/web/assets/{use-profiles-DFVi0aT0.js → use-profiles-DcSLdHYE.js} +1 -1
- package/dist/web/assets/{use-projects-CIn-ZTOZ.js → use-projects-CnaCjQj2.js} +1 -1
- package/dist/web/assets/{use-providers-DQxnGN3a.js → use-providers-BOBu75PJ.js} +1 -1
- package/dist/web/assets/useNormalizedLogs-DU1I1PCJ.js +1 -0
- package/dist/web/assets/{vennDiagram-CIIHVFJN-C9ZqZYMv.js → vennDiagram-CIIHVFJN-BC6dMCwh.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-DIkjJ-fY.js → wardley-L42UT6IY--kwEwWxY.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-DRu59DgE.js → wardleyDiagram-YWT4CUSO-B75j5BO3.js} +1 -1
- package/dist/web/assets/xml-CyF6O2wF.js +1 -0
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-obhyu3yJ.js → xychartDiagram-2RQKCTM6-DumRqRWt.js} +1 -1
- package/dist/web/assets/yaml-i8UwSbhD.js +1 -0
- package/dist/web/index.html +2 -2
- package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts +4 -1
- package/node_modules/@agent-tower/shared/dist/log-adapter.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/log-adapter.js +38 -5
- package/node_modules/@agent-tower/shared/dist/log-adapter.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/assets/AgentDemoPage-DVH2r8Bq.js +0 -1
- package/dist/web/assets/ConversationPage-BzxfS0Rj.js +0 -3
- package/dist/web/assets/CreateTaskInput-CbSZrOjZ.js +0 -1
- package/dist/web/assets/ProfileSettingsPage-DrGgBoYT.js +0 -3
- package/dist/web/assets/ProjectSettingsPage-CWucCMvS.js +0 -2
- package/dist/web/assets/SettingsMasterDetail-BDYP0IlS.js +0 -1
- package/dist/web/assets/TeamSettingsPage-DnUoFZy8.js +0 -1
- package/dist/web/assets/arrow-left-DLv7xHB-.js +0 -1
- package/dist/web/assets/channel-Dnx8iy_z.js +0 -1
- package/dist/web/assets/check-06phvoBb.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-B4GBKzvA.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-B4GBKzvA.js +0 -1
- package/dist/web/assets/cssMode-CX7TV5AQ.js +0 -1
- package/dist/web/assets/handlebars-Cb8DyPaL.js +0 -1
- package/dist/web/assets/html-D542B6gH.js +0 -1
- package/dist/web/assets/htmlMode-Ct2mDq0T.js +0 -1
- package/dist/web/assets/index-CUDYX2CO.js +0 -122
- package/dist/web/assets/index-CVgeXPf_.css +0 -1
- package/dist/web/assets/javascript-CN2JLuRw.js +0 -1
- package/dist/web/assets/liquid-DTQCmN-t.js +0 -1
- package/dist/web/assets/mdx-BguPTdam.js +0 -1
- package/dist/web/assets/mermaid-NOHMQCX5-aLv2J0q_.js +0 -122
- package/dist/web/assets/python-B59lpYG0.js +0 -1
- package/dist/web/assets/razor-Dp7HzFIW.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-BgFhspSa.js +0 -1
- package/dist/web/assets/typescript-CnJTMLZh.js +0 -1
- package/dist/web/assets/useNormalizedLogs-Dc-ZYUbk.js +0 -1
- package/dist/web/assets/xml-8KGRJE7b.js +0 -1
- package/dist/web/assets/yaml-xUyCljQf.js +0 -1
package/dist/web/assets/{xychartDiagram-2RQKCTM6-obhyu3yJ.js → xychartDiagram-2RQKCTM6-DumRqRWt.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as gi,g as xi,q as Xt,p as di,a as fi,b as pi,_ as a,l as Yt,I as mi,e as yi,z as bi,D as _t,i as Ai,F as Nt,G as wi,K as Ci,am as Si,R as Wt}from"./index-
|
|
1
|
+
import{s as gi,g as xi,q as Xt,p as di,a as fi,b as pi,_ as a,l as Yt,I as mi,e as yi,z as bi,D as _t,i as Ai,F as Nt,G as wi,K as Ci,am as Si,R as Wt}from"./index-B5PmQdbq.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-Cboi1Yqb.js";import{l as zt}from"./linear-BsMeiiUP.js";import"./index-CBhC80Wq.js";import"./defaultLocale-DX6XiGOO.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function bt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,u,p=!1,f=0,T=0,P=.5;delete e.unknown;function _(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-f+T*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-f))*P,u=o*(1-f),p&&(v=Math.round(v),u=Math.round(u));var I=Ri(y).map(function(m){return v+o*m});return i(E?I.reverse():I)}return e.domain=function(y){return arguments.length?(t(y),_()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,_()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,_()},e.bandwidth=function(){return u},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,_()):p},e.padding=function(y){return arguments.length?(f=Math.min(1,T=+y),_()):f},e.paddingInner=function(y){return arguments.length?(f=Math.min(1,y),_()):f},e.paddingOuter=function(y){return arguments.length?(T=+y,_()):T},e.align=function(y){return arguments.length?(P=Math.max(0,Math.min(1,y)),_()):P},e.copy=function(){return bt(t(),[s,n]).round(p).paddingInner(f).paddingOuter(T).align(P)},_i.apply(_(),arguments)}var At=(function(){var e=a(function(F,h,c,g){for(c=c||{},g=F.length;g--;c[F[g]]=h);return c},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],u=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],f=[1,25],T=[1,26],P=[1,28],_=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],I=[1,34],m=[1,35],R=[1,36],l=[1,37],W=[1,43],O=[1,42],X=[1,47],Y=[1,50],S=[1,10,12,14,16,18,19,21,23,34,35,36],U=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],b=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],w=[1,64],V={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,c,g,x,C,r,rt){var d=r.length-1;switch(C){case 5:x.setOrientation(r[d]);break;case 9:x.setDiagramTitle(r[d].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[d]);break;case 13:x.setLineData(r[d-1],r[d]);break;case 14:x.setBarData({text:"",type:"text"},r[d]);break;case 15:x.setBarData(r[d-1],r[d]);break;case 16:this.$=r[d].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[d].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[d-1];break;case 20:this.$=[Number(r[d-2]),...r[d]];break;case 21:this.$=[Number(r[d])];break;case 22:x.setXAxisTitle(r[d]);break;case 23:x.setXAxisTitle(r[d-1]);break;case 24:x.setXAxisTitle({type:"text",text:""});break;case 25:x.setXAxisBand(r[d]);break;case 26:x.setXAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 27:this.$=r[d-1];break;case 28:this.$=[r[d-2],...r[d]];break;case 29:this.$=[r[d]];break;case 30:x.setYAxisTitle(r[d]);break;case 31:x.setYAxisTitle(r[d-1]);break;case 32:x.setYAxisTitle({type:"text",text:""});break;case 33:x.setYAxisRangeData(Number(r[d-2]),Number(r[d]));break;case 37:this.$={text:r[d],type:"text"};break;case 38:this.$={text:r[d],type:"text"};break;case 39:this.$={text:r[d],type:"markdown"};break;case 40:this.$=r[d];break;case 41:this.$=r[d-1]+""+r[d];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:u}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:u}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:u}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:u}),{11:23,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:39,13:38,24:W,27:O,29:40,30:41,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:45,15:44,27:X,33:46,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:49,17:48,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{11:52,17:51,24:Y,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},{20:[1,53]},{22:[1,54]},e(S,[2,18]),{1:[2,2]},e(S,[2,8]),e(S,[2,9]),e(U,[2,37],{40:55,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l}),e(U,[2,38]),e(U,[2,39]),e(b,[2,40]),e(b,[2,42]),e(b,[2,43]),e(b,[2,44]),e(b,[2,45]),e(b,[2,46]),e(b,[2,47]),e(b,[2,48]),e(b,[2,49]),e(b,[2,50]),e(b,[2,51]),e(S,[2,10]),e(S,[2,22],{30:41,29:56,24:W,27:O}),e(S,[2,24]),e(S,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,11]),e(S,[2,30],{33:60,27:X}),e(S,[2,32]),{31:[1,61]},e(S,[2,12]),{17:62,24:Y},{25:63,27:w},e(S,[2,14]),{17:65,24:Y},e(S,[2,16]),e(S,[2,17]),e(b,[2,41]),e(S,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(S,[2,31]),{27:[1,69]},e(S,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(S,[2,15]),e(S,[2,26]),e(S,[2,27]),{11:59,32:72,37:24,38:f,39:T,40:27,41:P,42:_,43:y,44:E,45:v,46:L,47:I,48:m,49:R,50:l},e(S,[2,33]),e(S,[2,19]),{25:73,27:w},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,c){if(c.recoverable)this.trace(h);else{var g=new Error(h);throw g.hash=c,g}},"parseError"),parse:a(function(h){var c=this,g=[0],x=[],C=[null],r=[],rt=this.table,d="",ct=0,It=0,hi=2,Mt=1,li=r.slice.call(arguments,1),D=Object.create(this.lexer),$={yy:{}};for(var ft in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ft)&&($.yy[ft]=this.yy[ft]);D.setInput(h,$.yy),$.yy.lexer=D,$.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var pt=D.yylloc;r.push(pt);var ci=D.options&&D.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(B){g.length=g.length-2*B,C.length=C.length-B,r.length=r.length-B}a(ui,"popStack");function Vt(){var B;return B=x.pop()||D.lex()||Mt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=c.symbols_[B]||B),B}a(Vt,"lex");for(var M,q,z,mt,G={},ut,N,Bt,gt;;){if(q=g[g.length-1],this.defaultActions[q]?z=this.defaultActions[q]:((M===null||typeof M>"u")&&(M=Vt()),z=rt[q]&&rt[q][M]),typeof z>"u"||!z.length||!z[0]){var yt="";gt=[];for(ut in rt[q])this.terminals_[ut]&&ut>hi&>.push("'"+this.terminals_[ut]+"'");D.showPosition?yt="Parse error on line "+(ct+1)+`:
|
|
2
2
|
`+D.showPosition()+`
|
|
3
3
|
Expecting `+gt.join(", ")+", got '"+(this.terminals_[M]||M)+"'":yt="Parse error on line "+(ct+1)+": Unexpected "+(M==Mt?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(yt,{text:D.match,token:this.terminals_[M]||M,line:D.yylineno,loc:pt,expected:gt})}if(z[0]instanceof Array&&z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+M);switch(z[0]){case 1:g.push(M),C.push(D.yytext),r.push(D.yylloc),g.push(z[1]),M=null,It=D.yyleng,d=D.yytext,ct=D.yylineno,pt=D.yylloc;break;case 2:if(N=this.productions_[z[1]][1],G.$=C[C.length-N],G._$={first_line:r[r.length-(N||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(N||1)].first_column,last_column:r[r.length-1].last_column},ci&&(G._$.range=[r[r.length-(N||1)].range[0],r[r.length-1].range[1]]),mt=this.performAction.apply(G,[d,It,ct,$.yy,z[1],C,r].concat(li)),typeof mt<"u")return mt;N&&(g=g.slice(0,-1*N*2),C=C.slice(0,-1*N),r=r.slice(0,-1*N)),g.push(this.productions_[z[1]][0]),C.push(G.$),r.push(G._$),Bt=rt[g[g.length-2]][g[g.length-1]],g.push(Bt);break;case 3:return!0}}return!0},"parse")},k=(function(){var F={EOF:1,parseError:a(function(c,g){if(this.yy.parser)this.yy.parser.parseError(c,g);else throw new Error(c)},"parseError"),setInput:a(function(h,c){return this.yy=c||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var c=h.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var c=h.length,g=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),c=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./monaco-B4gWh5LA.js";import"./ProjectKanbanPage-Dy1q4F4o.js";import"./index-CBhC80Wq.js";import"./mermaid-NOHMQCX5-juygW0p8.js";import"./chevron-right-Dn5EL2Lm.js";import"./chevron-down-gt857XmZ.js";import"./confirm-dialog-CMtca90c.js";import"./modal-DdlXdmPL.js";import"./Icons-BsJUZk4z.js";import"./CreateTaskInput-CX7_o02E.js";import"./AgentLogo-CRz3CfP5.js";import"./check-BVfJOKK5.js";import"./use-projects-CnaCjQj2.js";import"./MemberAvatar-0z2Vg7fM.js";import"./use-providers-BOBu75PJ.js";import"./trash-2-BoBBdVYu.js";import"./useNormalizedLogs-DU1I1PCJ.js";import"./folder-picker-AfAde06M.js";import"./circle-alert-BeGGmA-3.js";import"./message-square-DMhmeoQR.js";import"./layers-CPYZanud.js";import"./chevron-up-Dv5ThQH5.js";import"./select-CifNrwRy.js";import"./textarea-7PW0aHOr.js";import"./server-DIU8iWhx.js";import"./upload-BGixJJOY.js";import"./pencil-BQnPUnRD.js";const H={comments:{lineComment:"#"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{offSide:!0},onEnterRules:[{beforeText:/:\s*$/,action:{indentAction:e.IndentAction.Indent}}]},v={tokenPostfix:".yaml",brackets:[{token:"delimiter.bracket",open:"{",close:"}"},{token:"delimiter.square",open:"[",close:"]"}],keywords:["true","True","TRUE","false","False","FALSE","null","Null","Null","~"],numberInteger:/(?:0|[+-]?[0-9]+)/,numberFloat:/(?:0|[+-]?[0-9]+)(?:\.[0-9]+)?(?:e[-+][1-9][0-9]*)?/,numberOctal:/0o[0-7]+/,numberHex:/0x[0-9a-fA-F]+/,numberInfinity:/[+-]?\.(?:inf|Inf|INF)/,numberNaN:/\.(?:nan|Nan|NAN)/,numberDate:/\d{4}-\d\d-\d\d([Tt ]\d\d:\d\d:\d\d(\.\d+)?(( ?[+-]\d\d?(:\d\d)?)|Z)?)?/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,tokenizer:{root:[{include:"@whitespace"},{include:"@comment"},[/%[^ ]+.*$/,"meta.directive"],[/---/,"operators.directivesEnd"],[/\.{3}/,"operators.documentEnd"],[/[-?:](?= )/,"operators"],{include:"@anchor"},{include:"@tagHandle"},{include:"@flowCollections"},{include:"@blockStyle"},[/@numberInteger(?![ \t]*\S+)/,"number"],[/@numberFloat(?![ \t]*\S+)/,"number.float"],[/@numberOctal(?![ \t]*\S+)/,"number.octal"],[/@numberHex(?![ \t]*\S+)/,"number.hex"],[/@numberInfinity(?![ \t]*\S+)/,"number.infinity"],[/@numberNaN(?![ \t]*\S+)/,"number.nan"],[/@numberDate(?![ \t]*\S+)/,"number.date"],[/(".*?"|'.*?'|[^#'"]*?)([ \t]*)(:)( |$)/,["type","white","operators","white"]],{include:"@flowScalars"},[/.+?(?=(\s+#|$))/,{cases:{"@keywords":"keyword","@default":"string"}}]],object:[{include:"@whitespace"},{include:"@comment"},[/\}/,"@brackets","@pop"],[/,/,"delimiter.comma"],[/:(?= )/,"operators"],[/(?:".*?"|'.*?'|[^,\{\[]+?)(?=: )/,"type"],{include:"@flowCollections"},{include:"@flowScalars"},{include:"@tagHandle"},{include:"@anchor"},{include:"@flowNumber"},[/[^\},]+/,{cases:{"@keywords":"keyword","@default":"string"}}]],array:[{include:"@whitespace"},{include:"@comment"},[/\]/,"@brackets","@pop"],[/,/,"delimiter.comma"],{include:"@flowCollections"},{include:"@flowScalars"},{include:"@tagHandle"},{include:"@anchor"},{include:"@flowNumber"},[/[^\],]+/,{cases:{"@keywords":"keyword","@default":"string"}}]],multiString:[[/^( +).+$/,"string","@multiStringContinued.$1"]],multiStringContinued:[[/^( *).+$/,{cases:{"$1==$S2":"string","@default":{token:"@rematch",next:"@popall"}}}]],whitespace:[[/[ \t\r\n]+/,"white"]],comment:[[/#.*$/,"comment"]],flowCollections:[[/\[/,"@brackets","@array"],[/\{/,"@brackets","@object"]],flowScalars:[[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/'[^']*'/,"string"],[/"/,"string","@doubleQuotedString"]],doubleQuotedString:[[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],blockStyle:[[/[>|][0-9]*[+-]?$/,"operators","@multiString"]],flowNumber:[[/@numberInteger(?=[ \t]*[,\]\}])/,"number"],[/@numberFloat(?=[ \t]*[,\]\}])/,"number.float"],[/@numberOctal(?=[ \t]*[,\]\}])/,"number.octal"],[/@numberHex(?=[ \t]*[,\]\}])/,"number.hex"],[/@numberInfinity(?=[ \t]*[,\]\}])/,"number.infinity"],[/@numberNaN(?=[ \t]*[,\]\}])/,"number.nan"],[/@numberDate(?=[ \t]*[,\]\}])/,"number.date"]],tagHandle:[[/\![^ ]*/,"tag"]],anchor:[[/[&*][^ ]+/,"namespace"]]}};export{H as conf,v as language};
|
package/dist/web/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<link rel="icon" type="image/x-icon" href="/favicon.ico?v=20260720" sizes="any" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
|
7
7
|
<title>Agent Tower</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-CBhC80Wq.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CxCjROy9.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="root"></div>
|
|
@@ -105,11 +105,14 @@ export interface NormalizedEntry {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* 将单个 NormalizedEntry 转换为 LogEntry
|
|
108
|
+
* 将单个 NormalizedEntry 转换为 LogEntry(结果按引用缓存,见上)
|
|
109
109
|
*/
|
|
110
110
|
export declare function normalizedEntryToLogEntry(entry: NormalizedEntry): LogEntry | null;
|
|
111
111
|
/**
|
|
112
112
|
* 批量转换 NormalizedEntry 数组为 LogEntry 数组
|
|
113
|
+
*
|
|
114
|
+
* 注意:**每次调用都返回新数组**(调用方 `useNormalizedLogs` 会往结果里 push
|
|
115
|
+
* 一个 cursor 条目),但数组元素在条目引用不变时保持同一对象。
|
|
113
116
|
*/
|
|
114
117
|
export declare function normalizedEntriesToLogEntries(entries: NormalizedEntry[]): LogEntry[];
|
|
115
118
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-adapter.d.ts","sourceRoot":"","sources":["../src/log-adapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,oBAAY,OAAO;IACjB,MAAM,WAAW,CAAM,iBAAiB;IACxC,SAAS,cAAc,CAAE,iCAAiC;IAC1D,IAAI,SAAS,CAAU,+BAA+B;IACtD,IAAI,SAAS,CAAU,cAAc;IACrC,IAAI,SAAS,CAAU,eAAe;IACtC,MAAM,WAAW,CAAM,kBAAkB;IACzC,KAAK,UAAU,CAAQ,kBAAkB;IACzC,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,E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AE,MAAM,CAAA;QAChB,mDAAmD;QACnD,KAAK,CAAC,EAAE,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;SAAE,CAAC,CAAA;QAC5E,aAAa,CAAC,EAAE,MAAM,CAAA;KACvB,CAAA;CACF;AAkLD;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,eAAe,GAAG,QAAQ,GAAG,IAAI,CAOjF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,QAAQ,EAAE,CAOpF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAQvF"}
|
|
@@ -55,9 +55,9 @@ function getToolTitle(entry) {
|
|
|
55
55
|
return label;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* 将单个 NormalizedEntry 转换为 LogEntry
|
|
58
|
+
* 将单个 NormalizedEntry 转换为 LogEntry(纯函数,供引用缓存调用)
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
function convertNormalizedEntry(entry) {
|
|
61
61
|
switch (entry.entryType) {
|
|
62
62
|
case 'user_message':
|
|
63
63
|
case 'user_feedback':
|
|
@@ -161,13 +161,46 @@ export function normalizedEntryToLogEntry(entry) {
|
|
|
161
161
|
return null;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* NormalizedEntry → LogEntry 的引用缓存(P0-2 契约 §6②)。
|
|
166
|
+
*
|
|
167
|
+
* 结构化共享(`applyConversationPatch`)保证"未受影响的条目在文档版本之间保持
|
|
168
|
+
* 同一引用",但如果每次渲染都把整份 entries 重新映射成新的 LogEntry,
|
|
169
|
+
* `LogStream` 里的每个 `memo()` 边界仍会整体失效。按条目对象缓存转换结果,
|
|
170
|
+
* 让同一个 NormalizedEntry 始终产出同一个 LogEntry 对象。
|
|
171
|
+
*
|
|
172
|
+
* - key 是条目对象本身,因此快照整体替换后旧条目可被 GC;
|
|
173
|
+
* - 前提是条目对象不被原地修改(P0-2 §3 的不可变约束;dev/test 由冻结兜底);
|
|
174
|
+
* - 畸形 patch 可能塞入非对象值,这类值不做缓存(WeakMap 只接受对象 key)。
|
|
175
|
+
*/
|
|
176
|
+
const logEntryByNormalizedEntry = new WeakMap();
|
|
177
|
+
/**
|
|
178
|
+
* 将单个 NormalizedEntry 转换为 LogEntry(结果按引用缓存,见上)
|
|
179
|
+
*/
|
|
180
|
+
export function normalizedEntryToLogEntry(entry) {
|
|
181
|
+
if (typeof entry !== 'object' || entry === null)
|
|
182
|
+
return convertNormalizedEntry(entry);
|
|
183
|
+
const cached = logEntryByNormalizedEntry.get(entry);
|
|
184
|
+
if (cached !== undefined)
|
|
185
|
+
return cached;
|
|
186
|
+
const converted = convertNormalizedEntry(entry);
|
|
187
|
+
logEntryByNormalizedEntry.set(entry, converted);
|
|
188
|
+
return converted;
|
|
189
|
+
}
|
|
164
190
|
/**
|
|
165
191
|
* 批量转换 NormalizedEntry 数组为 LogEntry 数组
|
|
192
|
+
*
|
|
193
|
+
* 注意:**每次调用都返回新数组**(调用方 `useNormalizedLogs` 会往结果里 push
|
|
194
|
+
* 一个 cursor 条目),但数组元素在条目引用不变时保持同一对象。
|
|
166
195
|
*/
|
|
167
196
|
export function normalizedEntriesToLogEntries(entries) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
197
|
+
const result = [];
|
|
198
|
+
for (const entry of entries) {
|
|
199
|
+
const converted = normalizedEntryToLogEntry(entry);
|
|
200
|
+
if (converted !== null)
|
|
201
|
+
result.push(converted);
|
|
202
|
+
}
|
|
203
|
+
return result;
|
|
171
204
|
}
|
|
172
205
|
/**
|
|
173
206
|
* 创建一个 loading cursor entry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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CAAC,CAAA;IACrF,MAAM,MAAM,GAAG,yBAAyB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACnD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAA;IACvC,MAAM,SAAS,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAA;IAC/C,yBAAyB,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IAC/C,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAA0B;IACtE,MAAM,MAAM,GAAe,EAAE,CAAA;IAC7B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAA;QAClD,IAAI,SAAS,KAAK,IAAI;YAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAChD,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,cAA2C;IAC3E,OAAO;QACL,EAAE,EAAE,UAAU,IAAI,CAAC,GAAG,EAAE,EAAE;QAC1B,SAAS,EAAE,cAAc,EAAE,mBAAmB,IAAI,IAAI,CAAC,GAAG,EAAE;QAC5D,IAAI,EAAE,OAAO,CAAC,MAAM;QACpB,OAAO,EAAE,EAAE;QACX,cAAc;KACf,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k as U,u as te,Y as se,r as n,p as b,j as e,B as y,Z as ne,_ as re,$ as ae}from"./index-CUDYX2CO.js";import{u as le,a as ie,T as oe,P as ce}from"./useNormalizedLogs-Dc-ZYUbk.js";import{b as de}from"./mermaid-NOHMQCX5-aLv2J0q_.js";import{I as H,a as xe,b as me,A as ue,G as pe}from"./Icons-DxojzzgC.js";import{d as he}from"./use-profiles-DFVi0aT0.js";import{C as ge}from"./chevron-up-1qS5XjTW.js";import{C as fe}from"./chevron-down-DO8ocuLa.js";import"./check-06phvoBb.js";import"./chevron-right-ffReG4fO.js";const be=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],je=U("hash",be);const ve=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Ne=U("send",ve),ye=!0;function ze(){const{t:s}=te(),{preserveDesktopSearch:_}=se(),[w,F]=n.useState([]),[i,S]=n.useState(""),[x,A]=n.useState("DEFAULT"),[o,k]=n.useState(""),[a,D]=n.useState(null),[V,E]=n.useState(null),[l,c]=n.useState("idle"),[g,C]=n.useState(!1),[m,j]=n.useState(""),$=n.useRef(null),I=n.useRef(null),u=n.useRef(null),{data:p}=he(i),B=p?Object.keys(p):["DEFAULT"],G=t=>{S(t),A("DEFAULT")},M=n.useCallback(t=>{c(t===0?"stopped":"error")},[]),O=n.useCallback(t=>{console.error("Agent error:",t),c("error")},[]),{isConnected:h,isAttached:f,isOutputActive:K,lastExitAt:q,logs:v,entries:J,agentSessionId:z,attach:P,clearLogs:R}=le({sessionId:a||"",sessionStartedAt:V,onExit:M,onError:O}),{todos:T}=ie(J);n.useEffect(()=>{b.get("/demo/agents").then(t=>{F(t.agents);const r=t.agents.find(N=>N.available);r&&S(r.type)})},[]),n.useEffect(()=>{$.current?.scrollToBottom("smooth")},[v]),n.useEffect(()=>{console.log(`[AgentDemoPage:useEffect] t=${Date.now()} sessionId=${a} isConnected=${h} isAttached=${f}`),a&&h&&!f&&(console.log(`[AgentDemoPage:useEffect] t=${Date.now()} calling attach()`),P())},[a,h,f,P]);const W=t=>{if(j(t.target.value),u.current){u.current.style.height="auto";const N=Math.min(u.current.scrollHeight,210);u.current.style.height=`${N}px`}},Y=async()=>{if(!i||!o.trim())return;const t=Date.now();console.log(`[AgentDemoPage:handleStart] t=${t} starting...`),c("starting"),R();try{const r=await b.post("/demo/start",{agentType:i,prompt:o.trim(),variant:x});ye&&console.log(`[AgentDemoPage:handleStart] t=${Date.now()} apiTime=${Date.now()-t}ms sessionId=${r.sessionId}`),D(r.sessionId),E(t),c("running")}catch(r){console.error("Start failed:",r),c("error")}},L=async()=>{if(!a||!m.trim())return;const t=m.trim();j("");try{await b.post(`/demo/${a}/message`,{message:t})}catch(r){console.error("Send failed:",r)}},Z=async()=>{if(a)try{await b.post(`/demo/${a}/stop`),c("stopped")}catch(t){console.error("Stop failed:",t)}},Q=()=>{D(null),E(null),c("idle"),k(""),j(""),R()},X=l==="running",d=a!==null,ee=w.find(t=>t.type===i);return e.jsxs("div",{className:"flex flex-col h-full bg-white",children:[e.jsxs("div",{className:"px-8 py-5 border-b border-neutral-100 bg-white transition-all duration-300",children:[e.jsxs("div",{className:"flex items-center flex-wrap gap-3",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-base font-medium text-blue-600",children:"Agent Demo"}),e.jsx("span",{className:"text-neutral-300 text-sm",children:"/"}),e.jsx("span",{className:"text-xl font-bold text-neutral-900 tracking-tight",children:d?o.slice(0,50)+(o.length>50?"...":""):s("新会话")})]}),e.jsxs("div",{className:"flex items-center",children:[l==="running"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-blue-50 text-blue-700 rounded-full text-xs font-medium border border-blue-100",children:[e.jsx(H,{className:"w-3.5 h-3.5 animate-pulse"}),e.jsx("span",{children:"Running"})]}),l==="stopped"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-emerald-50 text-emerald-700 rounded-full text-xs font-medium border border-emerald-100",children:[e.jsx(xe,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Done"})]}),l==="idle"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-neutral-100 text-neutral-600 rounded-full text-xs font-medium border border-neutral-200",children:[e.jsx(me,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Idle"})]}),l==="starting"&&e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-amber-50 text-amber-700 rounded-full text-xs font-medium border border-amber-100",children:[e.jsx(H,{className:"w-3.5 h-3.5 animate-spin"}),e.jsx("span",{children:"Starting..."})]}),l==="error"&&e.jsx("div",{className:"flex items-center gap-1.5 px-2.5 py-0.5 bg-red-50 text-red-700 rounded-full text-xs font-medium border border-red-100",children:e.jsx("span",{children:"Error"})})]})]}),d&&e.jsxs("div",{className:"mt-1.5 flex items-start gap-2 group max-w-4xl",children:[e.jsx("div",{className:`text-sm text-neutral-600 leading-relaxed cursor-pointer transition-all ${g?"":"truncate"}`,onClick:()=>C(!g),children:o}),e.jsx("button",{onClick:()=>C(!g),className:"mt-0.5 text-neutral-400 opacity-0 group-hover:opacity-100 hover:text-neutral-600 transition-opacity",children:g?e.jsx(ge,{size:14}):e.jsx(fe,{size:14})})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Agent"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-900 font-medium bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:ee?.name||i||s("未选择")})]}),x!=="DEFAULT"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Variant"}),e.jsx("div",{className:"flex items-center gap-1.5 text-neutral-700 font-medium bg-blue-50 px-2 py-1 rounded border border-blue-100",children:x})]}),z&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:"Session"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-neutral-700 font-mono bg-neutral-50 px-2 py-1 rounded border border-neutral-100",children:[z.slice(0,8),"..."]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-neutral-400 font-medium",children:s("连接")}),e.jsx("div",{className:`flex items-center gap-1.5 font-medium px-2 py-1 rounded border ${h?"text-emerald-700 bg-emerald-50 border-emerald-100":"text-neutral-500 bg-neutral-50 border-neutral-100"}`,children:s(h?f?"已连接":"连接中...":"未连接")})]}),d&&e.jsx(y,{variant:"outline",size:"sm",onClick:Q,className:"ml-auto",children:s("新会话")}),e.jsxs(ne,{to:_("/settings/profiles"),className:`flex items-center gap-1.5 text-xs text-neutral-500 hover:text-neutral-900 transition-colors ${d?"":"ml-auto"}`,children:[e.jsx(re,{size:14}),e.jsx("span",{children:s("Profiles 设置")})]})]})]}),e.jsx("div",{ref:I,className:"flex-1 overflow-y-auto px-8 py-6",children:d?e.jsx("div",{className:"min-h-[200px]",children:v.length===0?e.jsx("div",{className:"text-neutral-400 text-center py-8",children:s("等待 Agent 响应...")}):e.jsx(de,{ref:$,logs:v,isOutputActive:K,lastExitAt:q,scrollElementRef:I})}):e.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:s("选择 Agent")}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:w.map(t=>e.jsxs(y,{variant:i===t.type?"default":"outline",disabled:!t.available,onClick:()=>G(t.type),children:[t.name,t.available&&t.version&&` (${t.version})`,!t.available&&s(" (不可用)")]},t.type))})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:s("配置变体 (Profile Variant)")}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:B.map(t=>e.jsx("button",{onClick:()=>A(t),className:`px-3 py-1.5 rounded-full text-sm font-medium border transition-colors ${x===t?"bg-neutral-900 text-white border-neutral-900":"bg-white text-neutral-600 border-neutral-200 hover:border-neutral-400"}`,children:t},t))}),p&&p[x]&&e.jsx("p",{className:"mt-2 text-xs text-neutral-500 font-mono",children:Object.entries(p[x]).map(([t,r])=>`${t}: ${JSON.stringify(r)}`).join(", ")})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold mb-3 text-neutral-900",children:s("输入任务")}),e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{value:o,onChange:t=>k(t.target.value),rows:4,placeholder:s("描述你想让 Agent 完成的任务..."),className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm"}),e.jsx("div",{className:"flex items-center justify-end px-3 pb-3 pt-1",children:e.jsx(y,{onClick:Y,disabled:l==="starting"||!i||!o.trim(),children:s(l==="starting"?"启动中...":"开始")})})]})]})]})}),d&&T.length>0&&e.jsx("div",{className:"px-8 py-2 bg-white border-t border-neutral-100",children:e.jsx(oe,{todos:T})}),d&&e.jsx("div",{className:"px-8 py-6 border-t border-neutral-100 bg-white",children:e.jsxs("div",{className:"relative border border-neutral-200 rounded-xl shadow-sm bg-white focus-within:ring-1 focus-within:ring-neutral-300 focus-within:border-neutral-300 transition-all duration-200",children:[e.jsx("textarea",{ref:u,value:m,onChange:W,rows:3,placeholder:s("发送消息给 Agent..."),className:"w-full px-4 py-3 bg-transparent border-none focus:outline-none focus:ring-0 resize-none text-neutral-900 placeholder-neutral-400 leading-relaxed text-sm scrollbar-thin scrollbar-thumb-neutral-200 scrollbar-track-transparent",style:{minHeight:"80px",maxHeight:"210px"},onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229&&(t.preventDefault(),L())}}),e.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1 border-t border-transparent",children:[e.jsxs("div",{className:"flex items-center gap-1 text-neutral-400",children:[e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Attach File",children:e.jsx(ce,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Mention",children:e.jsx(ue,{size:18})}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Reference Issue",children:e.jsx(je,{size:18})}),e.jsx("div",{className:"w-px h-4 bg-neutral-200 mx-1"}),e.jsx("button",{className:"p-2 hover:bg-neutral-100 hover:text-neutral-600 rounded-lg transition-colors",title:"Search Web",children:e.jsx(pe,{size:18})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[X&&e.jsxs("button",{onClick:Z,className:"flex items-center gap-2 px-3 py-2 text-xs font-semibold text-red-600 bg-red-50 hover:bg-red-100 rounded-lg transition-colors",children:[e.jsx(ae,{size:12,fill:"currentColor"}),e.jsx("span",{children:s("停止")})]}),e.jsxs("button",{onClick:L,disabled:!m.trim(),className:`flex items-center gap-2 px-3 py-2 text-xs font-semibold rounded-lg transition-all ${m.trim()?"bg-neutral-900 text-white hover:bg-black shadow-sm":"bg-neutral-100 text-neutral-400 cursor-not-allowed"}`,children:[e.jsx("span",{children:s("发送")}),e.jsx(Ne,{size:14})]})]})]})]})})]})}export{ze as AgentDemoPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{k as qe,u as ce,r,j as e,$ as Oe,l as v,m as Ce,o as W,n as de,q as p,p as $,a6 as ze,Y as Fe,a7 as Ke,U as Ue,V as ye,_ as Qe,a8 as Be,a9 as ie}from"./index-CUDYX2CO.js";import{u as _e,b as $e,A as Ve,S as D}from"./mermaid-NOHMQCX5-aLv2J0q_.js";import{u as Ge,a as He,T as We,P as Je}from"./useNormalizedLogs-Dc-ZYUbk.js";import{u as Ye,a as Xe,b as Ze,A as et,R as tt,P as st,T as nt,c as rt,B as at,S as ot,d as ke,C as it}from"./CreateTaskInput-CbSZrOjZ.js";import{u as lt}from"./use-providers-DQxnGN3a.js";import{M as pe}from"./message-square-CTVVQxz6.js";import{A as ct}from"./arrow-left-DLv7xHB-.js";import{T as dt}from"./trash-2-0zy3IqlI.js";import"./chevron-right-ffReG4fO.js";import"./chevron-down-DO8ocuLa.js";import"./check-06phvoBb.js";import"./AgentLogo-BoU-DtS1.js";import"./use-projects-CIn-ZTOZ.js";import"./MemberAvatar-C3SWnA21.js";const ut=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],mt=qe("layout-list",ut);function ft({sessionId:t,sessionStatus:n,sessionStartedAt:o,sessionEndedAt:g,agentType:S,runtimeType:j,providerId:u,providers:y,initialTokenUsage:h,onProviderChange:N,onSend:w,onStop:E,onExit:O,isSending:A=!1,isStopping:a=!1,canStop:m,className:ue}){const{t:f}=ce(),[I,z]=r.useState(""),[F,K]=r.useState(u??""),[C,V]=r.useState(!1),[J,Y]=r.useState(null),P=r.useRef(null),X=r.useRef(null),me=r.useRef(null),M=r.useRef(!1),{scrollRef:G,contentRef:Z,isAtBottom:i,scrollToBottom:T,stopScroll:fe}=Ye({initial:"instant",resize:"smooth"}),{isConnected:U,isLoadingSnapshot:ee,isOutputActive:Q,lastExitAt:xe,logs:k,entries:te,attach:B}=Ge({sessionId:t,sessionStatus:n,sessionStartedAt:o,sessionEndedAt:g,onExit:O}),{todos:H}=He(te),he=Xe(k,h),{files:se,addFiles:L,removeFile:ne,clear:re,buildMarkdownLinks:ae,getDoneAttachments:oe,hasFiles:R,isUploading:s}=_e(),{isActive:l,isCancelling:c}=Ze(t,n),x=m??l;r.useEffect(()=>{K(u??"")},[u]),r.useEffect(()=>{t&&U&&B()},[t,U,B]);const Ie=r.useCallback(d=>{K(d),N?.(d)},[N]),ge=r.useCallback(()=>{P.current&&(P.current.style.height="60px")},[]),De=r.useCallback(d=>{z(d.target.value);const b=d.target;b.style.height="auto",b.style.height=`${Math.max(60,Math.min(b.scrollHeight,300))}px`},[]),be=r.useCallback(async()=>{if(!I.trim()&&!R||M.current||A||a||c||s)return;M.current=!0;const d=ae(),b=oe().map(q=>q.id),_=[I.trim(),d].filter(Boolean).join(`
|
|
2
|
-
|
|
3
|
-
`);z(""),re(),ge(),Y(null);try{await w({message:_,providerId:F||void 0,attachmentIds:b}),await B(),requestAnimationFrame(()=>T("smooth"))}catch(q){Y(q instanceof Error?q.message:f("Send failed. Please try again.")),z(_)}finally{M.current=!1}},[I,R,A,a,c,s,ae,oe,re,ge,w,F,B,T,f]),Ee=r.useCallback(async()=>{!x||a||c||await E()},[x,a,c,E]),Te=r.useCallback(d=>{const b=d.target.files;b&&b.length>0&&L(Array.from(b)),d.target.value=""},[L]),Le=r.useCallback(d=>{const b=d.clipboardData.items,_=[];for(const q of b)if(q.kind==="file"){const ve=q.getAsFile();ve&&_.push(ve)}_.length>0&&(d.preventDefault(),L(_))},[L]),Pe=r.useCallback(d=>{d.preventDefault(),V(!0)},[]),Me=r.useCallback(d=>{d.preventDefault(),V(!1)},[]),Re=r.useCallback(d=>{d.preventDefault(),V(!1);const b=d.dataTransfer.files;b.length>0&&L(Array.from(b))},[L]);return e.jsxs("div",{className:v("relative flex min-h-0 flex-1 flex-col bg-background",ue),children:[e.jsxs("div",{className:"relative min-h-0 flex-1",children:[e.jsx("div",{ref:G,className:"h-full overflow-y-auto scrollbar-app-thin px-6 pb-4 pt-6",children:e.jsx("div",{ref:Z,className:"mx-auto w-full min-w-0 max-w-4xl",children:ee?e.jsxs("div",{className:"flex items-center justify-center gap-3 py-12 text-muted-foreground/70",children:[e.jsxs("svg",{className:"h-5 w-5 animate-spin",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:f("Loading logs...")})]}):k.length===0?e.jsx("div",{className:"py-8 text-center text-muted-foreground/70",children:f(l?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx($e,{logs:k,downloadSessionId:t,isOutputActive:Q,lastExitAt:xe,onUserToggleDetails:fe})})}),!i&&e.jsxs("button",{type:"button",onClick:()=>T(),className:"absolute bottom-3 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-border bg-background/90 px-3 py-1.5 text-xs text-muted-foreground shadow-md backdrop-blur-sm transition-all hover:bg-background hover:text-foreground","aria-label":f("Scroll to bottom"),children:[e.jsx(et,{size:14}),e.jsx("span",{children:f("Back to bottom")})]})]}),H.length>0&&e.jsx("div",{className:"shrink-0 border-t border-border/60 bg-background px-6 pb-1 pt-2",children:e.jsx("div",{className:"mx-auto max-w-4xl",children:e.jsx(We,{todos:H})})}),e.jsx("div",{className:"z-10 w-full shrink-0 border-t border-transparent bg-background p-6 pb-6 pt-2",onDragOver:Pe,onDragLeave:Me,onDrop:Re,children:e.jsxs("div",{className:"mx-auto max-w-4xl",children:[e.jsx(tt,{sessionId:t}),J?e.jsx("div",{className:"mb-2 text-sm text-destructive",children:J}):null,e.jsxs("div",{ref:me,className:v("relative rounded-xl border bg-background transition-colors duration-200 hover:border-ring/40 focus-within:border-ring/60",C?"border-info bg-info/5":"border-border"),children:[e.jsx(Ve,{files:se,onRemove:ne}),e.jsx("textarea",{ref:P,value:I,onChange:De,onPaste:Le,onKeyDown:d=>{d.key==="Enter"&&!d.shiftKey&&!d.repeat&&!d.nativeEvent.isComposing&&d.nativeEvent.keyCode!==229&&(d.preventDefault(),be())},rows:1,placeholder:f(C?"Drop files here...":t&&!l?"Continue conversation...":"Message Agent..."),className:"w-full resize-none border-none bg-transparent px-4 pb-2 pt-4 text-sm leading-relaxed text-foreground placeholder-muted-foreground/70 focus:outline-none",style:{minHeight:"60px",maxHeight:"300px"}}),e.jsx("input",{ref:X,type:"file",multiple:!0,className:"hidden",onChange:Te}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsx("button",{type:"button",onClick:()=>X.current?.click(),disabled:s,className:"rounded-lg p-2 text-muted-foreground/70 transition-colors hover:bg-muted hover:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",title:f("Upload file"),children:e.jsx(Je,{size:18})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(st,{providers:y,currentProviderId:F,agentType:S,runtimeType:j,onSelect:Ie}),e.jsx(nt,{usage:he}),x&&l&&!I.trim()&&!R?e.jsx("button",{type:"button",onClick:Ee,disabled:a||c,className:"rounded-lg bg-destructive p-2 text-white transition-all duration-200 hover:bg-destructive/90 disabled:opacity-50",title:f("Stop"),children:e.jsx(Oe,{size:14})}):e.jsx("button",{type:"button",onClick:be,disabled:!I.trim()&&!R||s||A||a||c,className:v("rounded-lg p-2 transition-all duration-200",(I.trim()||R)&&!s&&!A&&!a&&!c?"bg-primary text-primary-foreground hover:bg-primary/90":"cursor-not-allowed bg-transparent text-muted-foreground/50"),title:f("Send"),children:e.jsx(rt,{size:18})})]})]})]})]})})]})}function xt(t=50){return Ce({queryKey:p.conversations.list({limit:t}),queryFn:()=>$.get("/conversations",{params:{limit:String(t)}})})}function ht(t){return Ce({queryKey:p.conversations.detail(t??""),queryFn:()=>$.get(`/conversations/${t}`),enabled:!!t})}function pt(){const t=W();return de({mutationFn:n=>$.post("/conversations",n),onSuccess:n=>{t.setQueryData(p.conversations.detail(n.id),n),t.invalidateQueries({queryKey:p.conversations.all}),t.invalidateQueries({queryKey:p.sessions.detail(n.sessionId)})}})}function gt(){const t=W();return de({mutationFn:({id:n,...o})=>$.post(`/conversations/${n}/message`,o),onSuccess:n=>{t.setQueryData(p.conversations.detail(n.id),n),t.invalidateQueries({queryKey:p.conversations.all}),t.invalidateQueries({queryKey:p.sessions.detail(n.sessionId)})}})}function bt(){const t=W();return de({mutationFn:n=>$.post(`/conversations/${n}/stop`),onSuccess:n=>{t.setQueryData(p.conversations.detail(n.id),n),t.invalidateQueries({queryKey:p.conversations.all}),t.invalidateQueries({queryKey:p.sessions.detail(n.sessionId)})}})}function vt(){const t=W();return de({mutationFn:n=>$.delete(`/conversations/${n}`),onSuccess:(n,o)=>{t.removeQueries({queryKey:p.conversations.detail(o)}),t.invalidateQueries({queryKey:p.conversations.all})}})}const yt=3e4,Se="agent-tower:conversation-read-times";function jt(){try{const t=window.localStorage.getItem(Se);if(!t)return{};const n=JSON.parse(t);return!n||typeof n!="object"||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).map(([o,g])=>[o,typeof g=="number"?g:Number(g)]).filter(o=>Number.isFinite(o[1])))}catch{return{}}}function je(t){try{window.localStorage.setItem(Se,JSON.stringify(t))}catch{}}function Ne(t){const n=t.lastActiveAt??t.updatedAt??t.createdAt;if(!n)return 0;const o=new Date(n).getTime();return Number.isFinite(o)?o:0}function Nt(t=yt){const[,n]=r.useState(0);r.useEffect(()=>{const o=setInterval(()=>n(g=>g+1),t);return()=>clearInterval(o)},[t])}function le(t){return t===D.RUNNING||t===D.PENDING}function Ae(t){if(!t)return"";const n=new Date(t);if(Number.isNaN(n.getTime()))return"";const o=Math.max(0,Math.floor((Date.now()-n.getTime())/1e3));return o<60?ie("{count}s ago",{count:o}):o<3600?ie("{count}m ago",{count:Math.floor(o/60)}):o<86400?ie("{count}h ago",{count:Math.floor(o/3600)}):ie("{count}d ago",{count:Math.floor(o/86400)})}function wt(t,n){switch(t){case D.RUNNING:return n("Running");case D.PENDING:return n("Starting");case D.COMPLETED:return n("Completed");case D.FAILED:return n("Failed");case D.CANCELLED:return n("Stopped");default:return t}}function we({className:t,pulseClassName:n}){return e.jsxs("span",{className:"relative inline-flex h-2 w-2",children:[e.jsx("span",{className:v("absolute inline-flex h-full w-full animate-ping rounded-full",n)}),e.jsx("span",{className:v("relative inline-flex h-2 w-2 rounded-full",t)})]})}function Ct({status:t,unread:n}){return le(t)?e.jsx(we,{className:"bg-success",pulseClassName:"bg-success/70"}):n?e.jsx(we,{className:"bg-warning",pulseClassName:"bg-warning/70"}):null}function kt({conversation:t,selected:n,onSelect:o,onDelete:g,disabled:S,unread:j}){const{t:u}=ce(),y=Ae(t.lastActiveAt??t.createdAt),h=le(t.status)||j;return e.jsxs("div",{className:v("group ml-4 mr-2 flex items-center rounded-md transition-colors",n?"bg-accent":"hover:bg-accent/50"),children:[e.jsxs("button",{type:"button",onClick:o,title:t.title,className:"flex min-w-0 flex-1 animate-task-enter items-center gap-2.5 rounded-md px-2 py-2 text-left text-sm",children:[e.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:e.jsx(pe,{size:14,className:"text-muted-foreground"})}),e.jsx("span",{className:v("min-w-0 flex-1 truncate",n?"font-medium text-foreground":"text-foreground/90"),children:t.title}),h?e.jsx("span",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center",children:e.jsx(Ct,{status:t.status,unread:j})}):e.jsx("span",{className:"flex w-14 shrink-0 items-center justify-end text-[11px] tabular-nums text-muted-foreground/50",children:e.jsx("span",{className:"truncate group-hover:hidden",children:y})})]}),e.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),g()},disabled:S,className:"mr-1 hidden shrink-0 rounded-md p-1.5 text-muted-foreground hover:bg-background hover:text-destructive disabled:opacity-50 group-hover:flex",title:u("Delete"),children:e.jsx(dt,{size:14})})]})}function St({isOpen:t,conversations:n,onClose:o,onSelectConversation:g}){const{t:S}=ce(),[j,u]=r.useState(""),[y,h]=r.useState(0),N=r.useRef(null);r.useEffect(()=>{t&&(u(""),h(0))},[t]);const w=r.useMemo(()=>{const a=j.trim().toLowerCase();return a?n.filter(m=>m.title.toLowerCase().includes(a)).slice(0,50):n.slice(0,12)},[n,j]);r.useEffect(()=>{h(0)},[j]),r.useEffect(()=>{N.current?.children[y]?.scrollIntoView({block:"nearest"})},[y]);const E=r.useCallback(a=>{g(a),o()},[o,g]),O=r.useCallback(a=>{if(a.key==="Escape"){a.preventDefault(),o();return}if(a.key==="ArrowDown"){a.preventDefault(),h(m=>Math.min(m+1,w.length-1));return}if(a.key==="ArrowUp"){a.preventDefault(),h(m=>Math.max(m-1,0));return}if(a.key==="Enter"&&!a.nativeEvent.isComposing){a.preventDefault();const m=w[y];m&&E(m)}},[y,E,o,w]);if(!t)return null;const A=j.trim().length>0;return e.jsxs("div",{className:"fixed inset-0 z-90",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"absolute inset-0 bg-black/20",onClick:o}),e.jsxs("div",{className:"absolute left-1/2 top-[18vh] w-[min(560px,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-border bg-popover shadow-lg animate-in fade-in zoom-in-95 duration-100",children:[e.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx(ke,{size:15,className:"shrink-0 text-muted-foreground/70"}),e.jsx("input",{value:j,onChange:a=>u(a.target.value),onKeyDown:O,placeholder:S("Search conversations..."),"aria-label":S("Search conversations..."),autoFocus:!0,className:"flex-1 border-none bg-transparent py-3 text-sm text-foreground placeholder-muted-foreground/60 focus:outline-none"})]}),w.length>0?e.jsxs(e.Fragment,{children:[A?null:e.jsx("div",{className:"px-4 pb-1 pt-2.5 text-[11px] font-medium text-muted-foreground/70",children:S("Recent conversations")}),e.jsx("div",{ref:N,className:"max-h-[46vh] overflow-y-auto pb-1.5 pt-0.5 scrollbar-app-thin",children:w.map((a,m)=>e.jsxs("button",{type:"button",onClick:()=>E(a),onMouseEnter:()=>h(m),className:v("flex w-full items-center gap-2.5 px-4 py-2 text-left transition-colors",m===y&&"bg-accent"),children:[e.jsx(pe,{size:14,className:"shrink-0 text-muted-foreground"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground/90",title:a.title,children:a.title}),e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground/60",children:Ae(a.lastActiveAt??a.createdAt)})]},a.id))})]}):e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground/70",children:S("No matching conversations")})]})]})}function Ut(){const{t}=ce();Nt();const n=ze(),{usesIntegratedTitlebar:o,desktopPlatform:g,hasMacTrafficLights:S}=Fe(),j=o&&g==="win32",{conversationId:u}=Ke(),y=W(),[h,N]=r.useState(""),[w,E]=r.useState("idle"),[O,A]=r.useState(null),[a,m]=r.useState(!1),[ue,f]=r.useState(!1),[I,z]=r.useState(jt),[F,K]=r.useState(()=>new Set),{data:C=[],isLoading:V}=xt(),{data:J,isLoading:Y}=ht(u),{data:P=[],isLoading:X}=lt(),me=pt(),M=gt(),G=bt(),Z=vt(),i=J??C.find(s=>s.id===u)??null,T=r.useMemo(()=>P.filter(({availability:s})=>s.type!=="NOT_FOUND"),[P]),fe=T.map(({provider:s})=>({id:s.id,name:s.name,agentType:s.agentType,available:!0})),U=!!u,ee=U||a,Q=r.useCallback(s=>{y.invalidateQueries({queryKey:p.conversations.all}),s&&y.invalidateQueries({queryKey:p.conversations.detail(s)})},[y]),xe=r.useCallback(()=>{Q(u)},[u,Q]),k=r.useCallback(s=>{if(K(c=>{if(!c.has(s.id))return c;const x=new Set(c);return x.delete(s.id),x}),s.status!==D.COMPLETED)return;const l=Math.max(Date.now(),Ne(s));z(c=>{if(c[s.id]&&c[s.id]>=l)return c;const x={...c,[s.id]:l};return je(x),x})},[]),te=r.useCallback(s=>{K(l=>{if(l.has(s))return l;const c=new Set(l);return c.add(s),c})},[]),B=r.useCallback(s=>{K(l=>{if(!l.has(s))return l;const c=new Set(l);return c.delete(s),c}),z(l=>{if(!(s in l))return l;const c={...l};return delete c[s],je(c),c})},[]),H=r.useMemo(()=>{const s=new Map;for(const l of C)s.set(l.sessionId,l);return i&&s.set(i.sessionId,i),s},[i,C]),he=r.useCallback(s=>s.status!==D.COMPLETED?!1:F.has(s.id)?!0:Ne(s)>(I[s.id]??0),[I,F]);r.useEffect(()=>{!h&&T.length>0&&N(T[0].provider.id)},[T,h]),r.useEffect(()=>{i?.providerId&&N(i.providerId)},[i?.providerId]),r.useEffect(()=>{u&&m(!1)},[u]),r.useEffect(()=>{i&&k(i)},[i,k]),r.useEffect(()=>{const s=Ue.connect(),l=c=>{const x=H.get(c.sessionId);if(x){if(Q(x.id),c.status!==D.COMPLETED){k(x);return}if(x.id===u){k(x);return}te(x.id)}};return s.on(ye.SESSION_COMPLETED,l),()=>{s.off(ye.SESSION_COMPLETED,l)}},[u,H,Q,k,te]);const se=()=>{A(null),m(!0),n("/conversations")},L=()=>{m(!1),n("/conversations")},ne=r.useCallback(s=>{k(s),m(!1),n(`/conversations/${s.id}`)},[k,n]),re=async s=>{if(!(!s.providerId||!s.title.trim()||w!=="idle")){E("starting-session"),A(null);try{const l=await me.mutateAsync({prompt:s.title.trim(),providerId:s.providerId,attachmentIds:s.attachmentIds});N(s.providerId),m(!1),n(`/conversations/${l.id}`)}catch(l){A(l instanceof Error?l.message:t("Failed to start. Please try again."))}finally{E("idle")}}},ae=async s=>{!i||!s.message.trim()||M.isPending||await M.mutateAsync({id:i.id,message:s.message,providerId:s.providerId||h||void 0,attachmentIds:s.attachmentIds})},oe=async()=>{!i||!le(i.status)||G.isPending||await G.mutateAsync(i.id)},R=async s=>{window.confirm(t("Delete this conversation?"))&&(await Z.mutateAsync(s),B(s),u===s&&(m(!1),n("/conversations")))};return e.jsxs("div",{className:"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground",children:[e.jsxs("header",{className:v("flex h-12 shrink-0 items-center justify-between bg-sidebar px-4",o&&"app-region-drag",j&&"pr-[150px]"),children:[e.jsxs("div",{className:v("flex min-w-0 items-center gap-2",S&&"pl-[72px]"),children:[e.jsx(at,{}),e.jsx("span",{className:"mx-1.5 select-none text-muted-foreground/40",children:"/"}),e.jsx("span",{className:"truncate text-sm font-medium text-foreground/90",children:t("Conversation")})]}),e.jsx("button",{type:"button",onClick:()=>Be.getState().openSettings(),className:v("rounded-md p-1.5 text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground",o&&"app-region-no-drag"),title:t("Settings"),children:e.jsx(Qe,{size:16})})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsxs("aside",{className:v("h-full w-full shrink-0 flex-col bg-sidebar md:flex md:w-[320px]",ee?"hidden md:flex":"flex"),children:[e.jsxs("div",{className:"shrink-0 px-2 pb-1 pt-2",children:[e.jsxs("button",{type:"button",onClick:se,className:v("flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-sm transition-colors",a?"bg-accent text-foreground":"text-foreground/80 hover:bg-accent/50"),title:t("New Conversation"),children:[e.jsx(ot,{size:16,className:"text-muted-foreground"}),e.jsx("span",{children:t("New Conversation")})]}),e.jsxs("button",{type:"button",onClick:()=>n("/"),className:"flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-sm text-foreground/80 transition-colors hover:bg-accent/50",title:t("Tasks"),children:[e.jsx(mt,{size:16,className:"text-muted-foreground"}),e.jsx("span",{children:t("Tasks")})]}),e.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full items-center gap-2.5 rounded-md px-2 py-2 text-sm text-foreground/80 transition-colors hover:bg-accent/50",title:t("Search"),children:[e.jsx(ke,{size:16,className:"text-muted-foreground"}),e.jsx("span",{children:t("Search")})]})]}),e.jsx("div",{className:"relative min-h-0 flex-1 overflow-y-auto scrollbar-app-thin pb-4 pt-3",children:V?e.jsx("div",{className:"px-4 py-4 text-sm text-muted-foreground",children:t("Loading...")}):C.length===0?e.jsxs("div",{className:"flex h-full select-none flex-col items-center justify-center px-6 text-center",children:[e.jsx(pe,{size:36,className:"mb-3 text-muted-foreground/40",strokeWidth:1.5}),e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:t("No conversations")}),e.jsx("button",{type:"button",onClick:se,className:"rounded-md bg-brand px-3.5 py-1.5 text-xs font-medium text-brand-foreground transition-colors hover:bg-brand/90",children:t("New Conversation")})]}):e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"flex w-full items-center gap-1.5 px-4 py-1.5 text-xs font-medium text-muted-foreground",children:[e.jsx("span",{className:"flex-1 text-left",children:t("History")}),e.jsx("span",{className:"text-[11px] font-normal tabular-nums text-muted-foreground/50",children:C.length})]}),e.jsx("div",{className:"mt-0.5 flex min-h-[40px] flex-col rounded-md",children:C.map(s=>e.jsx(kt,{conversation:s,selected:s.id===u,disabled:Z.isPending,unread:s.id!==u&&he(s),onSelect:()=>ne(s),onDelete:()=>R(s.id)},s.id))})]})}),e.jsx("div",{className:"flex items-center justify-between border-t border-border/60 px-4 py-3 text-xs text-muted-foreground/70",children:e.jsxs("span",{children:[t("Conversations")," · ",C.length]})})]}),e.jsxs("main",{className:v("min-w-0 flex-1 flex-col bg-background md:mb-2 md:mr-2 md:overflow-hidden md:rounded-xl md:border md:border-border/50",ee?"flex":"hidden md:flex"),children:[e.jsx("header",{className:"flex h-12 shrink-0 items-center justify-between border-b border-border/60 px-4 md:px-5",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[U||a?e.jsx("button",{type:"button",className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground md:hidden",onClick:L,title:t("Back"),children:e.jsx(ct,{size:17})}):null,e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold",children:i?.title??t("New Conversation")}),i?e.jsxs("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[wt(i.status,t),i.directoryName?` · ${i.directoryName}`:""]}):null]})]})}),!i&&U?e.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center px-4 text-sm text-muted-foreground",children:t(Y?"Loading...":"Conversation not found")}):i?e.jsx(ft,{sessionId:i.sessionId,sessionStatus:i.status,sessionStartedAt:i.createdAt,sessionEndedAt:le(i.status)?null:i.lastActiveAt??i.updatedAt,agentType:i.agentType,runtimeType:i.runtimeType,providerId:h||i.providerId,providers:P,initialTokenUsage:i.tokenUsage,onProviderChange:N,onSend:ae,onStop:oe,onExit:xe,isSending:M.isPending,isStopping:G.isPending}):e.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-4 pb-[10vh] md:px-8",children:e.jsxs("div",{className:"w-full max-w-2xl animate-[fadeInUp_0.5s_cubic-bezier(0.16,1,0.3,1)]",children:[e.jsx("h1",{className:"mb-8 max-w-full break-words text-center text-3xl leading-tight tracking-tight text-foreground",children:t("需要我帮你做点什么?")}),e.jsx(it,{variant:"conversation",projects:[],providers:fe,isProvidersLoading:X,defaultProviderId:h,createStep:w,placeholder:"Ask a question...",submitLabel:"Start",pendingLabel:"Starting...",submitTitle:"Start",onSubmit:async({title:s,providerId:l,attachmentIds:c})=>{await re({title:s,providerId:l,attachmentIds:c})}}),O?e.jsx("div",{className:"mt-3 rounded-lg border border-destructive/15 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:O}):null]})})]})]}),e.jsx(St,{isOpen:ue,conversations:C,onClose:()=>f(!1),onSelectConversation:ne})]})}export{Ut as ConversationPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k as X,o as he,n as ke,q as z,p as ce,t as gt,a9 as bt,m as Je,r as o,U as vt,V as ae,u as ge,j as e,P as xe,l as k,ae as He,Y as yt,D as Nt,E as wt,Z as Qe,X as kt,z as Ct,af as jt,ag as St}from"./index-CUDYX2CO.js";import{S as Ve,T as Ae,R as ie,h as ye,W as L,u as Tt,A as Et}from"./mermaid-NOHMQCX5-aLv2J0q_.js";import{A as pe}from"./AgentLogo-BoU-DtS1.js";import{C as fe}from"./chevron-down-DO8ocuLa.js";import{C as se}from"./check-06phvoBb.js";import{d as Mt,F as It}from"./use-projects-CIn-ZTOZ.js";import{M as Ye}from"./MemberAvatar-C3SWnA21.js";import{u as Rt}from"./use-providers-DQxnGN3a.js";import{P as At}from"./trash-2-0zy3IqlI.js";import{P as Lt}from"./useNormalizedLogs-Dc-ZYUbk.js";const _t=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],On=X("arrow-down",_t);const Dt=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ot=X("arrow-up",Dt);const Pt=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],zt=X("gauge",Pt);const qt=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],$t=X("git-branch",qt);const Ft=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Pn=X("search",Ft);const Gt=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Wt=X("shield-alert",Gt);const Bt=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Ut=X("shield",Bt);const Kt=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],zn=X("square-pen",Kt);const Ht=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Qt=X("zap",Ht);function et(t){const n=he(),a=Je({queryKey:z.sessions.runtime(t),queryFn:()=>ce.get(`/sessions/${t}/runtime`),enabled:!!t});return o.useEffect(()=>{if(!t)return;const r=vt.connect(),c=g=>{g.sessionId===t&&n.invalidateQueries({queryKey:z.sessions.runtime(t)})},u=g=>{g.sessionId===t&&n.setQueryData(z.sessions.runtime(t),g.state)},f=()=>{n.invalidateQueries({queryKey:z.sessions.runtime(t)})};return r.on(ae.SESSION_PERMISSION_REQUESTED,c),r.on(ae.SESSION_PERMISSION_INVALIDATED,c),r.on(ae.SESSION_RUNTIME_STATE_CHANGED,u),r.on("connect",f),()=>{r.off(ae.SESSION_PERMISSION_REQUESTED,c),r.off(ae.SESSION_PERMISSION_INVALIDATED,c),r.off(ae.SESSION_RUNTIME_STATE_CHANGED,u),r.off("connect",f)}},[t,n]),a}function Vt(t){return t==="RUNNING"||t==="AWAITING_PERMISSION"||t==="CANCELLING"}function Yt(t){return t===Ve.RUNNING||t===Ve.PENDING}function qn(t,n){const{data:a}=et(t);return{runtimeState:a,isActive:Yt(n)||Vt(a?.turnState),isCancelling:a?.turnState==="CANCELLING"}}function Xt(){const t=he();return ke({mutationFn:({sessionId:n,requestId:a,optionId:r})=>ce.post(`/sessions/${n}/permissions/${a}/resolve`,{optionId:r}),onSettled:(n,a,r)=>{t.invalidateQueries({queryKey:z.sessions.runtime(r.sessionId)})}})}function $n(){const t=he();return ke({mutationFn:n=>ce.post(`/sessions/${n}/start`),onSuccess:(n,a)=>{t.invalidateQueries({queryKey:z.sessions.detail(a)}),t.invalidateQueries({queryKey:z.tasks.all})}})}function Fn(){const t=he();return ke({mutationFn:n=>ce.post(`/sessions/${n}/stop`),onError:n=>{gt.error(bt("Failed to stop session. Refreshing status; check it and try again."),{description:n instanceof Error?n.message:void 0})},onSettled:(n,a,r)=>{t.setQueryData(z.sessions.runtime(r),c=>c?.turnState==="CANCELLING"?{...c,turnState:"IDLE"}:c),Promise.allSettled([t.invalidateQueries({queryKey:z.sessions.detail(r)}),t.invalidateQueries({queryKey:z.sessions.runtime(r)}),t.invalidateQueries({queryKey:z.workspaces.all}),t.invalidateQueries({queryKey:z.tasks.all})])}})}function Gn(){const t=he();return ke({mutationFn:({id:n,message:a,providerId:r})=>ce.post(`/sessions/${n}/message`,{message:a,providerId:r}),onSuccess:()=>{t.invalidateQueries({queryKey:z.workspaces.all}),t.invalidateQueries({queryKey:z.tasks.all})}})}function Wn({sessionId:t,compact:n=!1}){const{t:a}=ge(),{data:r}=et(t),c=Xt(),u=r?.pendingPermissions[0],f=u?.requestId,g=c.reset;return o.useEffect(()=>{g()},[f,g]),u?e.jsx("div",{className:k("mb-2 border-l-2 border-warning bg-warning/5 px-3 py-2.5",n&&"px-2.5 py-2"),children:e.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[e.jsx(Wt,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning","aria-hidden":"true"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:a("Permission required")}),e.jsx("div",{className:"mt-0.5 break-words text-xs text-muted-foreground",children:u.toolSummary||u.toolName||a("The agent needs approval to continue.")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:u.options.map(x=>e.jsxs("button",{type:"button",disabled:c.isPending,onClick:()=>c.mutate({sessionId:t,requestId:u.requestId,optionId:x.optionId}),className:k("inline-flex min-h-8 items-center gap-1.5 border px-3 text-xs font-medium transition-colors disabled:opacity-50",x.kind.startsWith("reject")?"border-destructive/30 text-destructive hover:bg-destructive/10":"border-border bg-background text-foreground hover:bg-muted"),children:[c.isPending&&c.variables?.requestId===u.requestId&&c.variables.optionId===x.optionId?e.jsx(xe,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}):null,x.name]},x.optionId))}),c.error?e.jsx("div",{className:"mt-1.5 text-xs text-destructive",role:"alert",children:c.error.message}):null]})]})}):null}function Ne(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function Zt(t){return t>=.9?"text-red-500":t>=.7?"text-amber-500":"text-neutral-400"}function Bn({usage:t,tooltipSide:n="top"}){const{t:a}=ge();if(!t)return null;const r=t.modelContextWindow,c=r?t.totalTokens/r:0,u=r?Math.min(Math.round(c*100),100):null,f=r?Zt(c):"text-neutral-400",g=r?e.jsx("span",{children:a("上下文: {used} / {max} tokens",{used:Ne(t.totalTokens),max:Ne(r)})}):e.jsx("span",{children:a("已使用: {used} tokens",{used:Ne(t.totalTokens)})});return e.jsx(Ae,{content:g,side:n,children:e.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 text-xs rounded-lg hover:bg-neutral-100 transition-colors cursor-default select-none",children:[e.jsx(zt,{size:14,className:f}),e.jsxs("span",{className:`tabular-nums ${f}`,children:[Ne(t.totalTokens),u!==null&&e.jsxs("span",{className:"text-neutral-300 ml-0.5",children:["/ ",u,"%"]})]})]})})}const Jt={damping:.7,stiffness:.05,mass:1.25},en=70,tn=1e3/60,nn=350;let Ce=!1;globalThis.document?.addEventListener("mousedown",()=>{Ce=!0});globalThis.document?.addEventListener("mouseup",()=>{Ce=!1});globalThis.document?.addEventListener("click",()=>{Ce=!1});const Un=(t={})=>{const[n,a]=o.useState(!1),[r,c]=o.useState(t.initial!==!1),[u,f]=o.useState(!1),g=o.useRef(null);g.current=t;const x=o.useCallback(()=>{if(!Ce)return!1;const d=window.getSelection();if(!d||!d.rangeCount)return!1;const h=d.getRangeAt(0);return h.commonAncestorContainer.contains(p.current)||p.current?.contains(h.commonAncestorContainer)},[]),y=o.useCallback(d=>{s.isAtBottom=d,c(d)},[]),C=o.useCallback(d=>{s.escapedFromLock=d,a(d)},[]),s=o.useMemo(()=>{let d;return{escapedFromLock:n,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return p.current?.scrollTop??0},set scrollTop(h){p.current&&(p.current.scrollTop=h,s.ignoreScrollToTop=p.current.scrollTop)},get targetScrollTop(){return!p.current||!I.current?0:p.current.scrollHeight-1-p.current.clientHeight},get calculatedTargetScrollTop(){if(!p.current||!I.current)return 0;const{targetScrollTop:h}=this;if(!t.targetScrollTop)return h;if(d?.targetScrollTop===h)return d.calculatedScrollTop;const v=Math.max(Math.min(t.targetScrollTop(h,{scrollElement:p.current,contentElement:I.current}),h),0);return d={targetScrollTop:h,calculatedScrollTop:v},requestAnimationFrame(()=>{d=void 0}),v},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=en}}},[]),b=o.useCallback((d={})=>{typeof d=="string"&&(d={animation:d}),d.preserveScrollPosition||y(!0);const h=Date.now()+(Number(d.wait)||0),v=Re(g.current,d.animation),{ignoreEscapes:j=!1}=d;let S,M=s.calculatedTargetScrollTop;d.duration instanceof Promise?d.duration.finally(()=>{S=Date.now()}):S=h+(d.duration??0);const A=async()=>{const B=new Promise(requestAnimationFrame).then(()=>{if(!s.isAtBottom)return s.animation=void 0,!1;const{scrollTop:D}=s,U=performance.now(),K=(U-(s.lastTick??U))/tn;if(s.animation||(s.animation={behavior:v,promise:B,ignoreEscapes:j}),s.animation.behavior===v&&(s.lastTick=U),x()||h>Date.now())return A();if(D<Math.min(M,s.calculatedTargetScrollTop)){if(s.animation?.behavior===v){if(v==="instant")return s.scrollTop=s.calculatedTargetScrollTop,A();s.velocity=(v.damping*s.velocity+v.stiffness*s.scrollDifference)/v.mass,s.accumulated+=s.velocity*K,s.scrollTop+=s.accumulated,s.scrollTop!==D&&(s.accumulated=0)}return A()}return S>Date.now()?(M=s.calculatedTargetScrollTop,A()):(s.animation=void 0,s.scrollTop<s.calculatedTargetScrollTop?b({animation:Re(g.current,g.current.resize),ignoreEscapes:j,duration:Math.max(0,S-Date.now())||void 0}):s.isAtBottom)});return B.then(D=>(requestAnimationFrame(()=>{s.animation||(s.lastTick=void 0,s.velocity=0)}),D))};return d.wait!==!0&&(s.animation=void 0),s.animation?.behavior===v?s.animation.promise:A()},[y,x,s]),m=o.useCallback(()=>{C(!0),y(!1)},[C,y]),N=o.useCallback(({target:d})=>{if(d!==p.current)return;const{scrollTop:h,ignoreScrollToTop:v}=s;let{lastScrollTop:j=h}=s;s.lastScrollTop=h,s.ignoreScrollToTop=void 0,v&&v>h&&(j=v),f(s.isNearBottom),setTimeout(()=>{if(s.resizeDifference||h===v)return;if(x()){C(!0),y(!1);return}const S=h>j,M=h<j;if(s.animation?.ignoreEscapes){s.scrollTop=j;return}M&&(C(!0),y(!1)),S&&C(!1),!s.escapedFromLock&&s.isNearBottom&&y(!0)},1)},[C,y,x,s]),_=o.useCallback(({target:d,deltaY:h})=>{let v=d;for(;!["scroll","auto"].includes(getComputedStyle(v).overflow);){if(!v.parentElement)return;v=v.parentElement}v===p.current&&h<0&&p.current.scrollHeight>p.current.clientHeight&&!s.animation?.ignoreEscapes&&(C(!0),y(!1))},[C,y,s]),p=Xe(d=>{p.current?.removeEventListener("scroll",N),p.current?.removeEventListener("wheel",_),d?.addEventListener("scroll",N,{passive:!0}),d?.addEventListener("wheel",_,{passive:!0})},[]),I=Xe(d=>{if(s.resizeObserver?.disconnect(),!d)return;let h;s.resizeObserver=new ResizeObserver(([v])=>{const{height:j}=v.contentRect,S=j-(h??j);if(s.resizeDifference=S,s.scrollTop>s.targetScrollTop&&(s.scrollTop=s.targetScrollTop),f(s.isNearBottom),S>=0){const M=Re(g.current,h?g.current.resize:g.current.initial);b({animation:M,wait:!0,preserveScrollPosition:!0,duration:M==="instant"?void 0:nn})}else s.isNearBottom&&(C(!1),y(!0));h=j,requestAnimationFrame(()=>{setTimeout(()=>{s.resizeDifference===S&&(s.resizeDifference=0)},1)})}),s.resizeObserver?.observe(d)},[]);return{contentRef:I,scrollRef:p,scrollToBottom:b,stopScroll:m,isAtBottom:r||u,isNearBottom:u,escapedFromLock:n,state:s}};function Xe(t,n){const a=o.useCallback(r=>(a.current=r,t(r)),n);return a}const Ie=new Map;function Re(...t){const n={...Jt};let a=!1;for(const c of t){if(c==="instant"){a=!0;continue}typeof c=="object"&&(a=!1,n.damping=c.damping??n.damping,n.stiffness=c.stiffness??n.stiffness,n.mass=c.mass??n.mass)}const r=JSON.stringify(n);return Ie.has(r)||Ie.set(r,Object.freeze(n)),a?"instant":Ie.get(r)}function Kn({providers:t,currentProviderId:n,agentType:a,runtimeType:r,onSelect:c}){const{t:u}=ge(),[f,g]=o.useState(!1),x=o.useRef(null),y=r===ie.ACP?ie.ACP:ie.CLI,C=t.filter(b=>String(b.provider.agentType)===a&&(b.provider.runtimeType===ie.ACP?ie.ACP:ie.CLI)===y),s=t.find(b=>b.provider.id===n);return o.useEffect(()=>{function b(m){x.current&&!x.current.contains(m.target)&&g(!1)}if(f)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[f]),C.length<=1?e.jsxs("div",{className:"flex items-center gap-1 text-xs text-neutral-400 px-2 py-1.5 select-none cursor-default",children:[e.jsx(pe,{agentType:s?.provider.agentType??a,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:s?.provider.name?He(s.provider.name,12):a})]}):e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("button",{onClick:()=>g(!f),className:"flex items-center gap-1 text-xs px-2 py-1.5 rounded-lg transition-colors cursor-pointer hover:bg-neutral-100 text-neutral-400 hover:text-neutral-600",title:`Provider: ${s?.provider.name??a} (click to change)`,children:[e.jsx(pe,{agentType:s?.provider.agentType??a,className:"size-3.5"}),e.jsx("span",{className:"min-w-0 truncate",children:s?.provider.name?He(s.provider.name,12):a}),e.jsx(fe,{size:12,className:`shrink-0 transition-transform ${f?"rotate-180":""}`})]}),f&&e.jsxs("div",{className:"absolute bottom-full right-0 mb-1 bg-white rounded-lg border border-neutral-200 shadow-lg py-1 min-w-[160px] z-50",children:[e.jsx("div",{className:"px-2 py-1 text-xs text-neutral-400 border-b border-neutral-100",children:u("切换渠道")}),C.map(b=>e.jsxs("button",{onClick:()=>{c(b.provider.id),g(!1)},className:`w-full flex items-center justify-between px-3 py-2 text-sm text-left hover:bg-neutral-50 transition-colors ${b.provider.id===n?"bg-blue-50 text-blue-600":"text-neutral-700"}`,children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(pe,{agentType:b.provider.agentType,className:"size-4"}),e.jsx("span",{className:"truncate max-w-[120px]",children:b.provider.name}),b.provider.isDefault&&e.jsx("span",{className:"text-xs text-neutral-400",children:u("(默认)")})]}),b.provider.id===n&&e.jsx(se,{size:14,className:"shrink-0"})]},b.provider.id))]})]})}function Hn(t,n){return o.useMemo(()=>{for(let a=t.length-1;a>=0;a--){const r=t[a];if(r.tokenUsage&&typeof r.tokenUsage.totalTokens=="number"&&r.tokenUsage.totalTokens>0)return{totalTokens:r.tokenUsage.totalTokens,modelContextWindow:r.tokenUsage.modelContextWindow}}return n??null},[t,n])}function Ze(t,n,a,r){if(a.filter(f=>f===r).length<=1)return t;const u=a.slice(0,n+1).filter(f=>f===r).length;return`${t} #${u}`}function sn(t){return Object.values(t).filter(Boolean).length}function rn({mode:t,setMode:n,selectedTemplateId:a,setSelectedTemplateId:r,selectedMemberPresetIds:c,setSelectedMemberPresetIds:u,disabled:f=!1,compact:g=!1}){const{t:x}=ge(),{preserveDesktopSearch:y}=yt(),[C,s]=o.useState(!1),{data:b}=Rt(),{data:m,isError:N,isFetching:_,isLoading:p,refetch:I}=Nt(),{data:d,isError:h,isFetching:v,isLoading:j,refetch:S}=wt(),M=o.useMemo(()=>new Map((b??[]).map(({provider:l,availability:w})=>[l.id,l.name+(w.type==="NOT_FOUND"?x(" (不可用)"):"")])),[b,x]),A=o.useMemo(()=>new Map((m??[]).map(l=>[l.id,l])),[m]),B=o.useMemo(()=>new Map((d??[]).map(l=>[l.id,l])),[d]),D=o.useMemo(()=>c.map(l=>A.get(l)).filter(l=>!!l),[A,c]);o.useEffect(()=>{m!==void 0&&u(l=>{const w=l.filter(q=>A.has(q));return w.length===l.length&&w.every((q,F)=>q===l[F])?l:w})},[m,A,u]),o.useEffect(()=>{d!==void 0&&r(l=>!l||B.has(l)?l:null)},[r,B,d]);const U=l=>{f||r(w=>w===l?null:l)},K=l=>{f||u(w=>[...w,l])},te=l=>{f||u(w=>w.filter((q,F)=>F!==l))},H=e.jsxs("section",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium text-muted-foreground mb-1.5",children:x("团队模板")}),h?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:x("团队模板加载失败")}),e.jsx("button",{type:"button",onClick:()=>{S()},disabled:f||v,className:"ml-2 underline hover:no-underline",children:x("重试")})]}):j?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(xe,{size:12,className:"animate-spin"}),x("加载中...")]}):(d??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[x("当前没有团队模板"),e.jsx(Qe,{to:y("/settings/team"),className:"ml-1.5 text-info hover:underline",children:x("去创建")})]}):e.jsx("div",{className:k("space-y-1.5",g&&"sm:grid sm:grid-cols-2 sm:gap-1.5 sm:space-y-0"),children:(d??[]).map(l=>{const w=l.id===a,q=l.members?.length??0,F=l.members?.map(V=>V.memberPresetId)??[],G=l.members?.slice(0,3).map((V,le)=>Ze(V.memberPreset?.name??V.memberPresetId,le,F,V.memberPresetId)).join(", ");return e.jsx("button",{type:"button",onClick:()=>U(l.id),disabled:f,className:k("w-full rounded-lg px-3 py-2 text-left border transition-all disabled:cursor-not-allowed disabled:opacity-60",w?"bg-background border-foreground/20 shadow-sm":"bg-background border-border/60 hover:border-border hover:bg-accent"),children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:k("text-xs truncate",w?"font-medium text-foreground":"text-foreground"),children:l.name}),e.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0",children:[q,x("人")]})]}),G&&e.jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground truncate",children:G})]}),w&&e.jsx(se,{size:13,className:"shrink-0 text-foreground"})]})},l.id)})})]}),ne=D.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:D.map((l,w)=>{const q=Ze(l.name,w,c,l.id);return e.jsxs("div",{className:"inline-flex items-center gap-1 pl-1 pr-0.5 py-0.5 rounded-md border border-border/60 bg-background text-[10px] text-foreground",children:[e.jsx(Ye,{name:l.name,avatar:l.avatar,className:"h-3.5 w-3.5 text-[7px]"}),e.jsx("span",{className:"max-w-[80px] truncate",children:q}),e.jsx("button",{type:"button",onClick:()=>te(w),disabled:f,className:"p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30 rounded transition-colors",children:e.jsx(kt,{size:9})})]},`${l.id}-${w}`)})}),re=N?e.jsxs("div",{className:"rounded-lg bg-destructive/10 px-3 py-2.5 text-xs text-destructive",children:[e.jsx("span",{children:x("成员预设加载失败")}),e.jsx("button",{type:"button",onClick:()=>{I()},disabled:f||_,className:"ml-2 underline hover:no-underline",children:x("重试")})]}):p?e.jsxs("div",{className:"flex items-center gap-2 py-3 text-xs text-muted-foreground",children:[e.jsx(xe,{size:12,className:"animate-spin"}),x("加载中...")]}):(m??[]).length===0?e.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-background px-3 py-3 text-xs text-muted-foreground",children:[x("当前没有成员预设"),e.jsx(Qe,{to:y("/settings/team"),className:"ml-1.5 text-info hover:underline",children:x("去创建")})]}):e.jsx("div",{className:"space-y-1 max-h-[180px] overflow-y-auto pr-1",children:(m??[]).map(l=>{const w=c.filter(G=>G===l.id).length,q=M.get(l.providerId)??l.providerId,F=sn(l.capabilities);return e.jsxs("button",{type:"button",onClick:()=>K(l.id),disabled:f,className:k("flex items-center gap-2 w-full px-2 py-1.5 rounded-lg text-left border border-transparent transition-all",f&&"cursor-not-allowed opacity-60","bg-background hover:bg-accent hover:border-border/60"),children:[e.jsx(Ye,{name:l.name,avatar:l.avatar,className:"h-6 w-6 text-[9px] shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs text-foreground truncate",children:l.name}),e.jsxs("div",{className:"text-[10px] text-muted-foreground truncate",children:[q," · ",F,"/10"]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[w>0&&e.jsxs("span",{className:"text-[10px] text-foreground font-semibold",children:["×",w]}),e.jsx(At,{size:12,className:"text-muted-foreground"})]})]},l.id)})}),Q=D.length>0&&e.jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-primary text-[10px] font-semibold text-primary-foreground px-1.5",children:D.length}),Z=e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground shrink-0",children:x("执行模式")}),e.jsxs("div",{className:"inline-flex items-center h-7 rounded-md border border-border/70 bg-background p-0.5",children:[e.jsxs("button",{type:"button",onClick:()=>!f&&n("AUTO"),disabled:f,className:k("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",t==="AUTO"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Qt,{size:11}),x("自动模式")]}),e.jsxs("button",{type:"button",onClick:()=>!f&&n("CONFIRM"),disabled:f,className:k("flex items-center gap-1.5 rounded h-full px-2.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",t==="CONFIRM"?"bg-primary text-primary-foreground font-medium shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Ut,{size:11}),x("确认模式")]})]})]});return g?e.jsxs("div",{className:"space-y-3",children:[Z,H,e.jsxs("div",{className:"border-t border-border/50 pt-2.5",children:[e.jsxs("button",{type:"button",onClick:()=>!f&&s(l=>!l),disabled:f,"aria-expanded":C,className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(fe,{size:12,className:k("transition-transform",C?"":"-rotate-90")}),x("追加独立成员"),Q]}),C&&e.jsxs("div",{className:"mt-2",children:[ne,re]})]})]}):e.jsxs("div",{className:"space-y-3.5",children:[Z,e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[H,e.jsxs("section",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:x("追加成员")}),Q]}),ne,re]})]})]})}function on({commands:t,selectedIndex:n,query:a,hasCatalog:r,title:c="Slash Commands",queryPrefix:u="/",emptyCatalogMessage:f="No slash commands catalog for this agent yet.",emptyQueryMessage:g,insertionHint:x="Enter / Tab to insert",compact:y=!1,onSelect:C}){const s=y?"px-1.5 pb-1.5":"px-2 pb-2",b=y?"px-2 py-1.5":"px-2.5 py-2",m=y?"max-h-36":"max-h-48";return e.jsxs("div",{className:y?"pt-1.5":"pt-2",children:[e.jsxs("div",{className:`mb-1 flex items-center justify-between ${y?"px-2 pt-0.5":"px-3 pt-1"}`,children:[e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-neutral-400",children:c}),e.jsx("span",{className:"text-[10px] text-neutral-400",children:x})]}),t.length===0?e.jsx("div",{className:`${y?"px-2 pb-2 pt-1.5 text-[11px]":"px-3 pb-3 pt-2 text-xs"} text-neutral-400`,children:r?g??`No matches for ${u}${a}`:f}):e.jsx("div",{className:`${s} ${m} overflow-y-auto`,children:t.map((N,_)=>e.jsxs("button",{type:"button",onMouseDown:p=>p.preventDefault(),onClick:()=>C(N),className:`w-full rounded-lg border text-left transition-colors ${_===n?"border-neutral-300 bg-neutral-50":"border-transparent hover:border-neutral-200 hover:bg-neutral-50/80"} ${b}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-mono text-[13px] text-neutral-900",children:N.command}),N.kind&&N.kind!=="builtin"?e.jsx("span",{className:"rounded-full border border-neutral-200 px-1.5 py-0.5 text-[9px] uppercase tracking-[0.12em] text-neutral-500",children:N.scope?`${N.scope} ${N.kind}`:N.kind}):null]}),e.jsx("div",{className:`${y?"mt-0.5 text-[11px]":"mt-1 text-xs"} text-neutral-500`,children:N.description})]},N.command))})]})}const ee=12,we=8;function an({open:t,anchorRef:n,commands:a,selectedIndex:r,query:c,hasCatalog:u,title:f,queryPrefix:g,emptyCatalogMessage:x,emptyQueryMessage:y,insertionHint:C,compact:s=!1,onSelect:b}){const m=o.useRef(null),[N,_]=o.useState(null);return o.useLayoutEffect(()=>{if(!t){_(null);return}const p=n.current;if(!p)return;let I=0;const d=()=>{const j=n.current;if(!j)return;const S=j.getBoundingClientRect(),M=window.innerWidth,A=window.innerHeight,B=s?260:320,D=s?M-ee*2:560,U=Math.min(Math.max(S.width,B),Math.max(B,D)),K=Math.min(Math.max(ee,S.left),Math.max(ee,M-ee-U)),te=A-S.bottom-we-ee,H=S.top-we-ee,ne=m.current?.offsetHeight??(s?220:280),re=s?240:320,Q=te<180&&H>te,l=Math.max(120,Math.min(re,Q?H:te)),w=Q?Math.max(ee,S.top-we-Math.min(ne,l)):Math.min(A-ee-Math.min(ne,l),S.bottom+we);_({top:w,left:K,width:U,maxHeight:l})},h=()=>{cancelAnimationFrame(I),I=requestAnimationFrame(d)};h();const v=new ResizeObserver(h);return v.observe(p),m.current&&v.observe(m.current),window.addEventListener("resize",h),window.addEventListener("scroll",h,!0),window.visualViewport?.addEventListener("resize",h),window.visualViewport?.addEventListener("scroll",h),()=>{cancelAnimationFrame(I),v.disconnect(),window.removeEventListener("resize",h),window.removeEventListener("scroll",h,!0),window.visualViewport?.removeEventListener("resize",h),window.visualViewport?.removeEventListener("scroll",h)}},[n,a.length,s,t,c,r]),!t||!N||typeof document>"u"?null:Ct.createPortal(e.jsx("div",{className:"pointer-events-none fixed inset-0 z-[120]",children:e.jsx("div",{ref:m,className:"pointer-events-auto fixed overflow-hidden rounded-xl border border-neutral-200 bg-white shadow-lg shadow-neutral-200/70",style:{top:N.top,left:N.left,width:N.width,maxHeight:N.maxHeight},children:e.jsx(on,{commands:a,selectedIndex:r,query:c,hasCatalog:u,title:f,queryPrefix:g,emptyCatalogMessage:x,emptyQueryMessage:y,insertionHint:C,compact:s,onSelect:b})})}),document.body)}function cn({agentType:t,workingDir:n}){return Je({queryKey:z.system.slashCommandCatalog(t,n),queryFn:async()=>(await ce.get("/system/slash-command-catalog",{params:{agentType:String(t),...n?{workingDir:n}:{}}})).commands,enabled:!!t,staleTime:3e4})}function ln(t,n){const a=new Set,r=[];for(const c of[...t,...n]){const u=c.command.trim().toLowerCase();!u||a.has(u)||(a.add(u),r.push(c.kind?c:{...c,kind:"builtin"}))}return r}function je(t){return t.trim().toLowerCase().replace(/^[/$]/,"")}function dn(t){return je(t.command)}function mn(t,n){if(!n)return 1e3;const a=dn(t),r=t.aliases?.map(je)??[],c=[a,...r];let u=0;for(const g of c)g===n?u=Math.max(u,500):g.startsWith(n)?u=Math.max(u,400-(g.length-n.length)):g.includes(n)&&(u=Math.max(u,250-g.indexOf(n)));return u>0?u:`${a} ${r.join(" ")} ${t.description}`.toLowerCase().includes(n)?100:0}function Qn(t){const n=/(^|[\s])\$([^\s]*)$/.exec(t);if(!n||n.index===void 0)return null;const a=n.index+n[1].length;return{query:je(n[2]),replaceStart:a}}function un(t,n){const a=je(n);return a?t.map((r,c)=>({command:r,index:c,score:mn(r,a)})).filter(r=>r.score>0).sort((r,c)=>c.score-r.score||r.index-c.index||r.command.command.localeCompare(c.command.command)).map(r=>r.command):t.slice()}const pn=[{command:"/permissions",description:"Manage what Codex can do without approval"},{command:"/sandbox-add-read-dir",description:"Grant read access to another directory"},{command:"/agent",description:"Switch between built-in agent personas"},{command:"/apps",description:"Manage connected apps"},{command:"/clear",description:"Start a fresh conversation"},{command:"/compact",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last assistant message to your clipboard"},{command:"/diff",description:"Show the current git diff"},{command:"/experimental",description:"Toggle experimental features"},{command:"/feedback",description:"Share feedback on Codex CLI"},{command:"/init",description:"Create or update AGENTS.md for the repo"},{command:"/logout",description:"Sign out of Codex"},{command:"/mcp",description:"Manage MCP servers"},{command:"/mention",description:"Add files or directories to the conversation context"},{command:"/model",description:"Change the active model"},{command:"/fast",description:"Toggle low reasoning mode"},{command:"/plan",description:"Toggle plan mode for code changes"},{command:"/personality",description:"Select how Codex communicates"},{command:"/ps",description:"List running background tasks"},{command:"/fork",description:"Fork the current conversation state"},{command:"/resume",description:"Resume a previous conversation"},{command:"/new",description:"Open a conversation picker to start or resume"},{command:"/quit",description:"Exit Codex CLI",aliases:["exit"]},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show session and configuration status"},{command:"/debug-config",description:"Inspect the effective configuration"},{command:"/statusline",description:"Configure the custom status line"},{command:"/skills",description:"Browse available skills and insert a $skill mention"}],fn=[{command:"/clear",description:"Clear the conversation history"},{command:"/compact",description:"Compact the conversation context",aliases:["compact focus"]},{command:"/config",description:"Open the configuration panel"},{command:"/cost",description:"Show token usage and cost"},{command:"/doctor",description:"Check Claude Code installation health"},{command:"/help",description:"Show help and available commands"},{command:"/init",description:"Initialize project instructions"},{command:"/login",description:"Sign in to Claude Code"},{command:"/logout",description:"Sign out of Claude Code"},{command:"/mcp",description:"Manage MCP servers"},{command:"/memory",description:"Edit project memory files"},{command:"/model",description:"Change the active model"},{command:"/permissions",description:"Review or update tool permissions"},{command:"/pr_comments",description:"Read pull request review comments"},{command:"/review",description:"Run a code review"},{command:"/status",description:"Show account and system status"},{command:"/terminal-setup",description:"Configure terminal newline shortcuts"},{command:"/vim",description:"Toggle vim mode"}],xn=[{command:"/bug",description:"File an issue about Gemini CLI"},{command:"/chat",description:"Manage chat checkpoints and exports"},{command:"/clear",description:"Clear the terminal display"},{command:"/compress",description:"Replace chat context with a summary"},{command:"/copy",description:"Copy the last Gemini CLI output"},{command:"/directory",description:"Manage additional workspace directories",aliases:["dir"]},{command:"/editor",description:"Choose the preferred editor"},{command:"/extensions",description:"List active Gemini CLI extensions"},{command:"/help",description:"Show help and command usage",aliases:["?"]},{command:"/mcp",description:"Show MCP servers and tools"},{command:"/memory",description:"Manage loaded GEMINI.md memory"},{command:"/restore",description:"Restore files from a tool checkpoint"},{command:"/settings",description:"Open the Gemini CLI settings editor"},{command:"/stats",description:"Show session statistics and token usage"},{command:"/theme",description:"Change the Gemini CLI theme"},{command:"/auth",description:"Change the authentication method"},{command:"/about",description:"Show version information"},{command:"/tools",description:"List currently available tools"},{command:"/privacy",description:"Review privacy and data collection settings"},{command:"/quit",description:"Exit Gemini CLI",aliases:["exit"]},{command:"/vim",description:"Toggle vim mode"},{command:"/init",description:"Generate a tailored GEMINI.md file"}],hn=[{command:"/model",description:"Change the active model"},{command:"/plan",description:"Create or reopen a plan"},{command:"/ask",description:"Toggle ask mode (read-only Q&A)"},{command:"/debug",description:"Toggle debug mode"},{command:"/clear",description:"Start a new chat session",aliases:["new","new-chat","newchat"]},{command:"/compress",description:"Summarize the conversation to reduce context"},{command:"/vim",description:"Toggle vim mode"},{command:"/shell",description:"Enter shell mode"},{command:"/about",description:"Show CLI, system, and account information"},{command:"/setup-terminal",description:"Configure terminal newline shortcuts"},{command:"/feedback",description:"Share feedback with the Cursor team"},{command:"/open",description:"Open the repository git root in Cursor"},{command:"/cursor",description:"Alias for /open",aliases:["open"]},{command:"/resume-chat",description:"Resume a previous chat by folder name",aliases:["resume"]},{command:"/copy-request-id",description:"Copy the last request ID"},{command:"/copy-conversation-id",description:"Copy the current conversation ID"},{command:"/logout",description:"Sign out from Cursor"},{command:"/quit",description:"Exit Cursor Agent",aliases:["exit"]},{command:"/mcp",description:"Manage MCP servers"}],gn={[ye.CODEX]:pn,[ye.CLAUDE_CODE]:fn,[ye.GEMINI_CLI]:xn,[ye.CURSOR_AGENT]:hn};function tt(t){return t.trim().toLowerCase().replace(/^\//,"")}function bn(t){return t?(gn[t]??[]).map(n=>({...n,kind:n.kind??"builtin"})):[]}function vn(t){const n=t.match(/^\s*\/([^\s]*)$/);return n?tt(n[1]):null}function yn(t,n){return un(t,tt(n))}function Nn(t){const n=t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229,a=t.key==="Tab"&&!t.shiftKey;return n||a}function wn({agentType:t,workingDir:n,input:a,setInput:r,textareaRef:c,minHeight:u,maxHeight:f}){const[g,x]=o.useState(0),{data:y=[]}=cn({agentType:t,workingDir:n}),C=o.useMemo(()=>ln(bn(t),y),[t,y]),s=o.useMemo(()=>vn(a),[a]),b=o.useMemo(()=>s===null?[]:yn(C,s),[C,s]),m=o.useCallback(()=>{const p=c.current;p&&(p.style.height="auto",p.style.height=`${Math.max(u,Math.min(p.scrollHeight,f))}px`)},[f,u,c]);o.useEffect(()=>{x(0)},[t,s]),o.useEffect(()=>{g<b.length||x(0)},[b.length,g]);const N=o.useCallback(p=>{const d=`${a.match(/^(\s*)\/[^\s]*$/)?.[1]??""}${p.command} `;r(d),requestAnimationFrame(()=>{const h=c.current;h&&(m(),h.focus(),h.setSelectionRange(d.length,d.length))})},[a,m,r,c]),_=o.useCallback(p=>s===null||b.length===0?!1:p.key==="ArrowDown"?(p.preventDefault(),x(I=>(I+1)%b.length),!0):p.key==="ArrowUp"?(p.preventDefault(),x(I=>(I-1+b.length)%b.length),!0):Nn(p)?(p.preventDefault(),N(b[g]??b[0]),!0):!1,[N,b,s,g]);return{allCommands:C,query:s,filteredCommands:b,selectedIndex:g,setSelectedIndex:x,applyCommand:N,handleKeyDown:_}}const kn="/assets/agent-tower-lockup-DPAcheCt.png";function Vn({className:t="h-6 w-auto max-[359px]:h-[22px]"}){return e.jsx("img",{src:kn,alt:"Agent Tower",className:`block shrink-0 select-none object-contain ${t}`})}const Cn={idle:"","creating-task":"Creating Task...","creating-teamrun":"Creating TeamRun...","creating-workspace":"Creating Workspace...","creating-session":"Creating Session...","starting-session":"Starting Agent..."};function Yn({variant:t="task",projects:n,providers:a,isProvidersLoading:r,onSubmit:c,defaultProjectId:u="",defaultProviderId:f="",onProjectChange:g,createStep:x,placeholder:y,submitLabel:C,pendingLabel:s,submitTitle:b}){const{t:m}=ge(),[N,_]=o.useState(""),[p,I]=o.useState(u),[d,h]=o.useState(f),[v,j]=o.useState("SOLO"),[S,M]=o.useState(L.WORKTREE),[A,B]=o.useState({}),[D,U]=o.useState("AUTO"),[K,te]=o.useState(null),[H,ne]=o.useState([]),[re,Q]=o.useState(!1),[Z,l]=o.useState(!1),[w,q]=o.useState(!1),[F,G]=o.useState(!1),V=o.useRef(null),le=o.useRef(null),Se=o.useRef(null),Le=o.useRef(null),_e=o.useRef(null),De=o.useRef(null),{files:Oe,addFiles:oe,removeFile:nt,clear:Pe,buildMarkdownLinks:ze,getDoneAttachments:qe,isUploading:be}=Tt(),de=Mt(),T=t==="conversation",E=t==="task"||t==="conversation",st=C??m(T?"开始":"创建");o.useEffect(()=>{I(u),g?.(u)},[u,g]),o.useEffect(()=>{h(f)},[f]),o.useEffect(()=>{if(!Z)return;const i=R=>{V.current&&!V.current.contains(R.target)&&l(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[Z]),o.useEffect(()=>{if(!w)return;const i=R=>{le.current&&!le.current.contains(R.target)&&q(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[w]),o.useEffect(()=>{if(!F)return;const i=R=>{Se.current&&!Se.current.contains(R.target)&&G(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[F]);const W=o.useMemo(()=>n.find(i=>i.id===p),[n,p]),ve=o.useMemo(()=>a.find(i=>i.id===d),[a,d]),Te=p?A[p]:void 0,rt=(Te?.isGitRepo??W?.isGitRepo)!==!1,ot=(Te?.worktreeReady??W?.worktreeReady)!==!1,$=!T&&!(rt&&ot),O=$?"SOLO":v,Y=$?L.MAIN_DIRECTORY:S,at=Y===L.MAIN_DIRECTORY?m("本地模式"):m("工作树模式"),$e=m("工作树隔离改动,支持 TeamRun、Merge、Rebase 和冲突解决。"),it=m("本地模式会直接修改项目主目录,不会自动提交,也不能使用 Merge、Rebase 或冲突解决。"),ct=Te?.reason??W?.reason,Fe=m(ct==="NO_HEAD"?"已检测到 Git,但需要先提交一次才能使用工作树模式。":"初始化 Git 后可使用工作树模式。"),Ge=T||O==="SOLO"?ve?.agentType:null,J=wn({agentType:Ge,workingDir:T?void 0:W?.repoPath,input:N,setInput:_,textareaRef:_e,minHeight:76,maxHeight:220}),P=x!=="idle",We=!!K||H.length>0,me=!P&&!be&&N.trim().length>0&&(T?!!d:!!p&&(O==="SOLO"?!!d:We));o.useEffect(()=>{$&&(j("SOLO"),M(L.MAIN_DIRECTORY),Q(!1),G(!1))},[$]),o.useEffect(()=>{$||T||M(L.WORKTREE)},[T,$,W?.id]);const lt=o.useCallback(async()=>{if(!W||de.isPending)return;const i=await de.mutateAsync({id:W.id});B(R=>({...R,[W.id]:i})),i.worktreeReady&&(j("SOLO"),M(L.WORKTREE),G(!1))},[de,W]),Ee=o.useCallback(async()=>{if(!me)return;const i=E?ze():"",R=E?qe().map(ue=>ue.id):[];try{await c({title:N.trim(),description:"",projectId:T?"":p,providerId:d,mode:T?"SOLO":O,workspaceMode:!T&&O==="SOLO"?Y:L.WORKTREE,teamRunMode:T?"AUTO":D,teamTemplateId:T||$?null:K,memberPresetIds:T||$?[]:H,attachmentLinks:i,attachmentIds:R}),_(""),E&&Pe()}catch{}},[me,E,ze,qe,c,N,T,p,d,O,Y,D,$,K,H,Pe]),dt=o.useCallback(i=>{J.handleKeyDown(i)||i.key==="Enter"&&!i.shiftKey&&!i.nativeEvent.isComposing&&i.nativeEvent.keyCode!==229&&(i.preventDefault(),Ee())},[Ee,J]),mt=o.useCallback(i=>{const R=i.target.files;R&&R.length>0&&oe(Array.from(R)),i.target.value=""},[oe]),ut=o.useCallback(i=>{I(i),g?.(i),l(!1)},[g]),pt=o.useCallback(i=>{if(!E)return;const R=i.clipboardData.items,ue=[];for(const Ue of R)if(Ue.kind==="file"){const Ke=Ue.getAsFile();Ke&&ue.push(Ke)}ue.length>0&&(i.preventDefault(),oe(ue))},[oe,E]),[Be,Me]=o.useState(!1),ft=o.useCallback(i=>{E&&(i.preventDefault(),Me(!0))},[E]),xt=o.useCallback(i=>{E&&(i.preventDefault(),Me(!1))},[E]),ht=o.useCallback(i=>{if(!E)return;i.preventDefault(),Me(!1);const R=i.dataTransfer.files;R.length>0&&oe(Array.from(R))},[oe,E]);return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{ref:Le,className:k("relative bg-background rounded-xl border transition-colors duration-200","shadow-[0_1px_2px_rgba(0,0,0,0.05)]","hover:border-ring/40 focus-within:border-ring/60",Be?"border-info bg-info/5":"border-border",P&&"opacity-80"),onDragOver:E?ft:void 0,onDragLeave:E?xt:void 0,onDrop:E?ht:void 0,children:[E&&Oe.length>0&&e.jsx("div",{className:"px-4 pt-3",children:e.jsx(Et,{files:Oe,onRemove:nt})}),e.jsx("textarea",{ref:_e,value:N,onChange:i=>_(i.target.value),onKeyDown:dt,onPaste:E?pt:void 0,placeholder:m(y||"Describe your task..."),disabled:P,autoFocus:!0,rows:1,className:"w-full px-4 pt-4 pb-2 bg-transparent border-none focus:outline-none resize-none text-[15px] text-foreground placeholder:text-muted-foreground/80 leading-relaxed",style:{minHeight:"76px",maxHeight:"220px",fieldSizing:"content"}}),E&&Be&&e.jsx("div",{className:"px-4 pb-2",children:e.jsx("div",{className:"flex items-center justify-center py-3 border border-dashed border-info/40 rounded-lg text-xs font-medium text-info",children:m("Drop files here")})}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-2 pt-1",children:[e.jsx("div",{className:"flex items-center gap-1",children:E?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>De.current?.click(),disabled:P||be,className:"p-2 text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:m("Attach files"),children:e.jsx(Lt,{size:18})}),e.jsx("input",{ref:De,type:"file",multiple:!0,onChange:mt,className:"hidden"})]}):null}),e.jsxs("div",{className:"flex items-center gap-2",children:[E&&be&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(xe,{size:14,className:"animate-spin"}),m("Uploading...")]}),P&&e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(xe,{size:14,className:"animate-spin"}),m(s??Cn[x])]}),!T&&!P&&!be&&O==="TEAM"&&!We&&N.trim().length>0&&e.jsx("span",{className:"text-[11px] text-warning",children:m("请选择团队模板或追加成员")}),me&&e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1 text-[11px] text-muted-foreground/80 select-none",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-[18px] h-[18px] px-1 rounded border border-border bg-muted/60 text-[10px] font-medium text-muted-foreground leading-none",children:"⏎"}),st]}),e.jsx("button",{type:"button",onClick:Ee,disabled:!me,className:k("flex items-center justify-center size-8 rounded-lg transition-all duration-200",me?"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm":"bg-muted text-muted-foreground/40 cursor-not-allowed"),title:m(b||"Create & Start"),children:e.jsx(Ot,{size:16,strokeWidth:2.5})})]})]})]}),e.jsx(an,{open:!!Ge&&J.query!==null,anchorRef:Le,commands:J.filteredCommands,selectedIndex:J.selectedIndex,query:J.query??"",hasCatalog:J.allCommands.length>0,compact:!0,onSelect:J.applyCommand}),e.jsxs("div",{className:"flex items-center flex-wrap gap-1.5 mt-2.5 px-0.5",children:[!T&&e.jsxs("div",{className:"relative",ref:V,children:[e.jsxs("button",{type:"button",onClick:()=>{P||l(i=>!i)},disabled:P,className:k("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",W?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(It,{size:14,className:"shrink-0",style:{color:W?.color??"var(--muted-foreground)"}}),e.jsx("span",{className:"max-w-[120px] truncate",children:W?.name??m("Project")}),e.jsx(fe,{size:12,className:k("text-muted-foreground transition-transform",Z&&"rotate-180")})]}),Z&&e.jsx("div",{className:"absolute top-full left-0 mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 max-h-[240px] overflow-y-auto z-50",children:n.map(i=>e.jsxs("button",{type:"button",onClick:()=>ut(i.id),className:"flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx("span",{className:"size-2 rounded-full shrink-0 mr-2",style:{backgroundColor:i.color??"var(--muted-foreground)"}}),e.jsx("span",{className:k("truncate flex-1",i.id===p?"text-foreground font-medium":"text-muted-foreground"),children:i.name}),e.jsx(se,{size:14,className:k("ml-2 shrink-0 text-foreground",i.id===p?"opacity-100":"opacity-0")})]},i.id))})]}),(T||O==="SOLO")&&e.jsxs("div",{className:"relative",ref:le,children:[e.jsxs("button",{type:"button",onClick:()=>{P||q(i=>!i)},disabled:P,className:k("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed",ve?"text-foreground/80":"text-muted-foreground"),children:[e.jsx(pe,{agentType:ve?.agentType,className:"size-3.5"}),e.jsx("span",{className:"max-w-[120px] truncate",children:ve?.name??m(r?"Loading...":"Agent")}),e.jsx(fe,{size:12,className:k("text-muted-foreground transition-transform",w&&"rotate-180")})]}),w&&e.jsx("div",{className:"absolute top-full left-0 mt-1.5 w-56 bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 max-h-[240px] overflow-y-auto z-50",children:a.map(i=>e.jsxs("button",{type:"button",disabled:!i.available,onClick:()=>{h(i.id),q(!1)},className:k("flex items-center w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",!i.available&&"opacity-40 cursor-not-allowed"),children:[e.jsx(se,{size:14,className:k("mr-2 shrink-0 text-foreground",i.id===d?"opacity-100":"opacity-0")}),e.jsx(pe,{agentType:i.agentType,className:"mr-2 size-3.5"}),e.jsxs("span",{className:k("min-w-0 truncate",i.id===d?"text-foreground font-medium":"text-muted-foreground"),children:[i.name,i.available?"":m(" (unavailable)")]})]},i.id))})]}),!T&&O==="SOLO"&&e.jsxs("div",{className:"relative",ref:Se,children:[e.jsxs("button",{type:"button",onClick:()=>{P||G(i=>!i)},disabled:P,className:k("flex items-center gap-1.5 px-2 h-7 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-foreground/80"),children:[e.jsx($t,{size:14,className:"text-muted-foreground"}),e.jsx("span",{className:"max-w-[96px] truncate",children:at}),e.jsx(fe,{size:12,className:k("text-muted-foreground transition-transform",F&&"rotate-180")})]}),F&&e.jsxs("div",{className:"absolute top-full left-0 mt-1.5 w-72 max-w-[calc(100vw-2rem)] bg-popover border border-border rounded-lg shadow-[0_4px_12px_rgba(0,0,0,0.06)] py-1 z-50",children:[$?e.jsx(Ae,{side:"bottom",className:"block w-full",content:Fe,children:e.jsxs("div",{tabIndex:0,"aria-label":Fe,className:"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",children:[e.jsxs("button",{type:"button",disabled:!0,className:"flex w-full cursor-not-allowed items-center px-3 py-2 text-left text-xs opacity-40 transition-colors",children:[e.jsx(se,{size:14,className:"mr-2 mt-0.5 shrink-0 text-foreground opacity-0"}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-muted-foreground",children:m("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:$e})]})]}),e.jsx("button",{type:"button",onClick:lt,disabled:de.isPending,className:"flex w-full items-center px-3 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-accent disabled:cursor-not-allowed disabled:opacity-50",children:de.isPending?m("检测中..."):m("重新检测 Git 状态")})]})}):e.jsxs("button",{type:"button",onClick:()=>{M(L.WORKTREE),G(!1)},className:"flex w-full items-center px-3 py-2 text-left text-xs transition-colors hover:bg-accent",children:[e.jsx(se,{size:14,className:k("mr-2 mt-0.5 shrink-0 text-foreground",Y===L.WORKTREE?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:k("block truncate",Y===L.WORKTREE?"text-foreground font-medium":"text-muted-foreground"),children:m("工作树模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:$e})]})]}),e.jsxs("button",{type:"button",onClick:()=>{M(L.MAIN_DIRECTORY),G(!1)},className:"flex items-start w-full px-3 py-2 text-xs text-left hover:bg-accent transition-colors",children:[e.jsx(se,{size:14,className:k("mr-2 mt-0.5 shrink-0 text-foreground",Y===L.MAIN_DIRECTORY?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:k("block truncate",Y===L.MAIN_DIRECTORY?"text-foreground font-medium":"text-muted-foreground"),children:m("本地模式")}),e.jsx("span",{className:"mt-0.5 block whitespace-normal text-[11px] leading-snug text-muted-foreground/80",children:it})]})]})]})]}),!T&&e.jsx(Ae,{side:"bottom",className:"ml-auto",content:$?m("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun."):Y===L.MAIN_DIRECTORY?m("TeamRun 需要工作树模式。开启团队模式时会自动切换为工作树模式。"):m("启用 TeamRun 后可选择团队模板或成员。"),children:e.jsxs("button",{type:"button",role:"switch","aria-checked":O==="TEAM",onClick:()=>{P||$||(v==="TEAM"?(j("SOLO"),Q(!1)):(j("TEAM"),G(!1),M(L.WORKTREE),Q(!0)))},disabled:P||$,className:k("flex items-center gap-2 h-7 pl-2 pr-2 rounded-md text-xs font-medium transition-colors","hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",O==="TEAM"?"text-foreground/80":"text-muted-foreground"),"aria-label":m("启用团队模式"),children:[e.jsx(jt,{size:14,className:O==="TEAM"?"text-foreground/80":"text-muted-foreground"}),e.jsx("span",{children:m("团队模式")}),($||Y===L.MAIN_DIRECTORY)&&O!=="TEAM"?e.jsx(St,{size:12,className:"text-muted-foreground/70","aria-hidden":"true"}):null,e.jsx("span",{className:k("relative inline-flex h-4 w-7 shrink-0 items-center rounded-full transition-colors",O==="TEAM"?"bg-primary":"bg-border"),children:e.jsx("span",{className:k("inline-block size-3 rounded-full bg-background shadow-sm transition-transform",O==="TEAM"?"translate-x-3.5":"translate-x-0.5")})})]})})]}),!T&&O==="TEAM"&&re&&e.jsx("div",{className:"mt-2.5 rounded-xl border border-border/60 bg-muted/40 p-3 animate-[fadeInUp_0.25s_cubic-bezier(0.16,1,0.3,1)]",children:e.jsx(rn,{mode:D,setMode:U,selectedTemplateId:K,setSelectedTemplateId:te,selectedMemberPresetIds:H,setSelectedMemberPresetIds:ne,disabled:P,compact:!0})})]})}export{On as A,Vn as B,Yn as C,$t as G,Kn as P,Wn as R,zn as S,Bn as T,Qt as Z,Hn as a,qn as b,Ot as c,Pn as d,$n as e,rn as f,Gn as g,Qn as h,un as i,wn as j,Fn as k,an as l,Ut as m,Un as u};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{u as T,r as g,j as e,S,g as J,s as M,v as w,I as U,B as E,w as p,l as P}from"./index-CUDYX2CO.js";import{u as _,a as z,b as B,c as F}from"./use-profiles-DFVi0aT0.js";import{M as G}from"./modal-D1r-F18d.js";import{C as $}from"./confirm-dialog-CDinB23R.js";import{T as R}from"./textarea-C3iQ4ONP.js";import{L as H}from"./layers-DRg_mgyk.js";import{C as q}from"./chevron-down-DO8ocuLa.js";import{P as K,T as Q}from"./trash-2-0zy3IqlI.js";import{P as W}from"./pencil-CniYlzH3.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
|
-
|
|
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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{u as _,r as o,p as de,j as e,X as se,S as K,a0 as ue,g as $,s as H,l as W,T as me,B as z,a1 as xe,a2 as pe,t as U}from"./index-CUDYX2CO.js";import{F as X,u as fe,a as he,b as ge,c as je}from"./use-projects-CIn-ZTOZ.js";import{F as V,a as ve,b as be}from"./folder-picker-0bwm5YE1.js";import{P as re,T as ye}from"./trash-2-0zy3IqlI.js";import{M as Y}from"./modal-D1r-F18d.js";import{S as Ne}from"./SettingsMasterDetail-BDYP0IlS.js";import"./chevron-right-ffReG4fO.js";import"./circle-alert-BhLONgEk.js";import"./check-06phvoBb.js";import"./arrow-left-DLv7xHB-.js";function Pe({value:t,onChange:y,repoPath:N,placeholder:k,disabled:a,disabledMessage:c}){const{t:d}=_(),[l,j]=o.useState(""),[h,n]=o.useState([]),[u,x]=o.useState(!1),[p,v]=o.useState(-1),b=o.useRef(null),E=o.useRef(null),R=o.useRef(void 0),q=o.useCallback(async s=>{if(a||!N||!s){n([]),x(!1);return}try{const i=await de.get("/filesystem/complete",{params:{basePath:N,prefix:s}});n(i.results),x(i.results.length>0),v(-1)}catch{n([]),x(!1)}},[a,N]);o.useEffect(()=>{if(clearTimeout(R.current),!l){n([]),x(!1);return}return R.current=setTimeout(()=>q(l),200),()=>clearTimeout(R.current)},[l,q]),o.useEffect(()=>{const s=i=>{E.current&&!E.current.contains(i.target)&&b.current&&!b.current.contains(i.target)&&x(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]);const w=s=>{if(a)return;const i=s.trim();!i||t.includes(i)||(y([...t,i]),j(""),x(!1),b.current?.focus())},S=s=>{a||y(t.filter((i,A)=>A!==s))},D=s=>{a||(s.type==="directory"?(j(s.path),b.current?.focus()):w(s.path))},M=(s,i)=>{a||(i.stopPropagation(),w(s.path.replace(/\/$/,"")))},F=s=>{s.nativeEvent.isComposing||s.nativeEvent.keyCode===229||a||(u&&h.length>0?s.key==="ArrowDown"?(s.preventDefault(),v(i=>Math.min(i+1,h.length-1))):s.key==="ArrowUp"?(s.preventDefault(),v(i=>Math.max(i-1,-1))):s.key==="Enter"?(s.preventDefault(),p>=0?D(h[p]):w(l)):s.key==="Escape"&&x(!1):s.key==="Enter"&&(s.preventDefault(),w(l)))};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((s,i)=>e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 group",children:[s.includes(".")&&!s.endsWith("/")?e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}):e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}),e.jsx("span",{className:"text-sm font-mono text-neutral-700 truncate flex-1",children:s}),e.jsx("button",{onClick:()=>S(i),disabled:a,className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0 disabled:cursor-not-allowed disabled:hover:text-neutral-300",children:e.jsx(se,{size:14})})]},s))}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{ref:b,type:"text",value:l,onChange:s=>j(s.target.value),onKeyDown:F,onFocus:()=>{l&&h.length>0&&x(!0)},placeholder:k??d("输入文件路径..."),disabled:a,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 disabled:cursor-not-allowed disabled:bg-neutral-50 disabled:text-neutral-400"}),e.jsxs("button",{onClick:()=>w(l),disabled:a||!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(re,{size:14}),e.jsx("span",{children:d("添加")})]})]}),u&&e.jsx("div",{ref:E,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:h.map((s,i)=>e.jsxs("button",{onClick:()=>D(s),className:`w-full flex items-center gap-2 px-3 py-1.5 text-sm text-left hover:bg-neutral-50 transition-colors ${i===p?"bg-neutral-100":""}`,children:[s.type==="directory"?e.jsx(X,{size:14,className:"text-amber-500 shrink-0"}):e.jsx(V,{size:14,className:"text-neutral-400 shrink-0"}),e.jsx("span",{className:"font-mono text-neutral-700 truncate flex-1",children:s.path}),s.type==="directory"&&e.jsx("span",{onClick:A=>M(s,A),className:"p-0.5 text-neutral-300 hover:text-emerald-600 shrink-0",title:d("添加此目录"),children:e.jsx(ve,{size:14})})]},s.path))})]}),a&&c&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:c})]})}function ke({value:t,onChange:y}){const{t:N}=_(),[k,a]=o.useState(""),[c,d]=o.useState(""),l=()=>{const n=k.trim(),u=c.trim();!n||!u||(y([...t,{name:n,command:u}]),a(""),d(""))},j=n=>{y(t.filter((u,x)=>x!==n))},h=n=>{n.key==="Enter"&&!n.nativeEvent.isComposing&&n.nativeEvent.keyCode!==229&&(n.preventDefault(),l())};return e.jsxs("div",{children:[t.length>0&&e.jsx("div",{className:"border border-neutral-200 rounded-lg mb-2 divide-y divide-neutral-100",children:t.map((n,u)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 group",children:[e.jsx("span",{className:"text-sm font-medium text-neutral-700 w-28 shrink-0 truncate",children:n.name}),e.jsx("span",{className:"text-sm font-mono text-neutral-500 flex-1 truncate",children:n.command}),e.jsx("button",{onClick:()=>j(u),className:"p-0.5 text-neutral-300 hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:e.jsx(se,{size:14})})]},u))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:k,onChange:n=>a(n.target.value),onKeyDown:h,placeholder:N("名称"),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:c,onChange:n=>d(n.target.value),onKeyDown:h,placeholder:N("命令"),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:l,disabled:!k.trim()||!c.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(re,{size:14}),e.jsx("span",{children:N("添加")})]})]})]})}function Z(t){return t?t.split(",").map(y=>y.trim()).filter(Boolean):[]}function ee(t){if(!t)return[];try{return JSON.parse(t)}catch{return[]}}function te(t){return typeof t.color!="string"||t.color.trim()===""?"bg-muted-foreground":t.color.startsWith("bg-")?t.color:t.color.startsWith("text-")?t.color.replace("text-","bg-"):"bg-muted-foreground"}function qe(){const{t}=_(),{data:y,isLoading:N}=fe({limit:100,includeArchived:!0}),k=he(),a=ge(),c=je(),[d,l]=o.useState(""),[j,h]=o.useState(null),[n,u]=o.useState({copyFiles:[],setupScript:"",quickCommands:[]}),[x,p]=o.useState(!1),[v,b]=o.useState(null),[E,R]=o.useState(!1),[q,w]=o.useState(!1),[S,D]=o.useState(!1),[M,F]=o.useState(!1),[s,i]=o.useState(""),[A,J]=o.useState(!1),C=y?.data??[],g=o.useMemo(()=>C.filter(r=>!r.archivedAt),[C]),I=o.useMemo(()=>C.filter(r=>r.archivedAt),[C]),f=g.find(r=>r.id===d),T=o.useMemo(()=>C.find(r=>r.id===v)??null,[v,C]);if(o.useEffect(()=>{!d&&g.length>0&&l(g[0].id)},[g,d]),o.useEffect(()=>{if(j){g.some(r=>r.id===j)&&(l(j),h(null));return}d&&!g.some(r=>r.id===d)&&(l(g[0]?.id??""),p(!1))},[g,j,d]),o.useEffect(()=>{f&&!x&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)})},[f,x]),N)return e.jsx(K,{className:"max-w-5xl",children:e.jsx(ue,{})});if(C.length===0)return e.jsxs(K,{className:"max-w-5xl",children:[e.jsx($,{title:t("项目配置")}),e.jsx(H,{message:t("暂无项目,请先创建项目")})]});const ne=()=>{d&&k.mutate({id:d,copyFiles:n.copyFiles.length>0?n.copyFiles.join(", "):null,setupScript:n.setupScript.trim()||null,quickCommands:n.quickCommands.length>0?JSON.stringify(n.quickCommands):null},{onSuccess:()=>p(!1)})},oe=r=>{h(null),l(r),p(!1),J(!0)},ae=()=>{f&&(b(f.id),D(!1),F(!1),R(!0))},O=()=>{a.isPending||(R(!1),b(null),D(!1),F(!1))},ie=async()=>{if(v)try{await a.mutateAsync({id:v,deleteRepo:S}),U.success(t(S?"项目已删除,并清理了本地文件":"项目已删除")),p(!1),O()}catch{}},le=r=>{const m=I.find(P=>P.id===r);b(r),i(m?.repoDeletedAt?m.repoPath:""),w(!0)},L=()=>{c.isPending||(w(!1),b(null),i(""))},ce=async()=>{if(!(!v||T?.repoDeletedAt&&!s.trim()))try{const m=await c.mutateAsync({id:v,repoPath:s.trim()||void 0});U.success(t("项目已恢复"));for(const P of m.warnings)U.warning(P);p(!1),h(m.project.id),l(m.project.id),L()}catch{}},Q=T?.name??t("this project"),G=!!T?.repoDeletedAt,B=f?.isGitRepo!==!1&&f?.worktreeReady!==!1;return e.jsxs(e.Fragment,{children:[e.jsxs(K,{className:"max-w-5xl",children:[e.jsx($,{title:t("项目配置")}),g.length===0&&I.length===0?e.jsx(H,{message:t("暂无项目,请先创建项目")}):e.jsx(Ne,{items:g,selectedId:d,onSelectItem:oe,getItemId:r=>r.id,mobileShowDetail:A,onMobileBack:()=>J(!1),renderListItem:(r,m)=>e.jsxs(e.Fragment,{children:[e.jsx("span",{className:W("h-2 w-2 rounded-full shrink-0",m?"bg-primary-foreground/60":te(r))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium",children:r.name}),e.jsx("div",{className:W("truncate text-[11px] font-mono",m?"text-primary-foreground/70":"text-muted-foreground"),children:r.repoPath.split("/").pop()})]})]}),renderListFooter:I.length>0?()=>e.jsxs("div",{className:"pt-3 mt-2 border-t border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 mb-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground",children:t("已删除")}),e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:I.length})]}),I.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg px-3 py-2 text-muted-foreground",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"truncate text-[12px]",children:r.name})}),e.jsx("button",{onClick:()=>le(r.id),disabled:c.isPending,className:"shrink-0 text-[11px] hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","aria-label":t("恢复项目"),children:e.jsx(pe,{size:12})})]},r.id))]}):void 0,renderDetail:r=>r?e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:W("h-2.5 w-2.5 rounded-full shrink-0",te(r))}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:r.name}),r.isGitRepo===!1&&e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:t("Local project")})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground font-mono mb-5",children:r.repoPath}),r.isGitRepo===!1&&e.jsx("div",{className:"mb-5 rounded-lg border border-info/25 bg-info/8 px-3 py-2 text-xs leading-relaxed text-info/90",children:t("Local projects only support local Solo tasks. Initialize Git to use worktrees and TeamRun.")}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsxs("div",{className:"py-5 first:pt-0",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("自动复制文件")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 时自动从主仓库复制的文件或目录,适用于 .env、node_modules 等不在 git 管理中的文件。支持 glob。")})]}),e.jsx(Pe,{value:n.copyFiles,onChange:m=>{u(P=>({...P,copyFiles:m})),p(!0)},repoPath:r.repoPath,disabled:!B,disabledMessage:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("Setup 脚本")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("创建 worktree 后自动执行的命令,每行一条。在 worktree 目录下执行,单条超时 5 分钟。")})]}),e.jsx("textarea",{value:n.setupScript,onChange:m=>{u(P=>({...P,setupScript:m.target.value})),p(!0)},placeholder:`pnpm install
|
|
2
|
-
pnpm run setup`,rows:4,disabled:!B,className:"w-full rounded-lg border border-input bg-muted/50 px-3 py-2 text-sm font-mono transition-colors focus:border-ring focus:bg-background focus:outline-none resize-none disabled:cursor-not-allowed disabled:opacity-50"}),!B&&e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("This setting applies only to Git worktree projects.")})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[13px] font-medium text-foreground",children:t("常用命令")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("在终端中可快速执行的命令,不会自动运行。")})]}),e.jsx(ke,{value:n.quickCommands,onChange:m=>{u(P=>({...P,quickCommands:m})),p(!0)}})]})]}),e.jsx("div",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/10 p-4",children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(me,{size:15,className:"text-destructive mt-0.5 shrink-0","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:t("删除项目")}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:t("项目将从默认列表隐藏,历史记录保留。可选同时删除本地文件。")})]})]}),e.jsxs(z,{size:"sm",variant:"destructive",className:"shrink-0",onClick:ae,disabled:a.isPending||c.isPending,children:[e.jsx(ye,{size:13}),t("删除项目")]})]})}),x&&e.jsx(xe,{saving:k.isPending,onSave:ne,onCancel:()=>{f&&u({copyFiles:Z(f.copyFiles),setupScript:f.setupScript??"",quickCommands:ee(f.quickCommands)}),p(!1)},className:"-mx-5"})]}):e.jsx("div",{className:"py-16 text-center text-sm text-muted-foreground",children:g.length>0?t("选择一个项目查看配置"):t("当前没有可配置的项目")})})]}),e.jsx(Y,{isOpen:E,onClose:O,title:t("Delete Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"outline",onClick:O,disabled:a.isPending,children:t("Cancel")}),e.jsx(z,{variant:"destructive",onClick:ie,disabled:a.isPending||S&&!M,children:a.isPending?t("Deleting..."):t("Delete Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t("项目「{title}」将从默认项目列表隐藏,但历史任务、workspace 和会话记录仍会保留。",{title:Q})}),e.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted px-3 py-3",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:r=>{D(r.target.checked),r.target.checked||F(!1)},className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t("同时删除本地项目文件")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("勾选后会删除项目路径指向的本地目录,并禁用代码/Git 相关能力。")})]})]}),S&&e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-3",children:[e.jsx("p",{className:"text-sm font-medium text-destructive",children:t("勾选后会连项目文件一起删除,请谨慎选择。")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("恢复该项目时需要重新绑定一个有效的项目路径。")}),e.jsxs("label",{className:"mt-3 flex items-start gap-2 text-xs text-foreground",children:[e.jsx("input",{type:"checkbox",checked:M,onChange:r=>F(r.target.checked),className:"mt-0.5 h-4 w-4 rounded border-border accent-primary"}),e.jsx("span",{children:t("我已确认这会删除本地项目文件")})]})]}),a.isError&&e.jsx("p",{className:"text-xs text-destructive",children:a.error instanceof Error?a.error.message:t("Failed to delete project")})]})}),e.jsx(Y,{isOpen:q,onClose:L,title:t("Restore Project"),action:e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"outline",onClick:L,disabled:c.isPending,children:t("Cancel")}),e.jsx(z,{onClick:ce,disabled:c.isPending||G&&!s.trim(),children:c.isPending?t("Restoring..."):t("Restore Project")})]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:G?t("项目「{title}」的本地项目文件已删除。恢复前需要重新绑定一个有效的项目路径。",{title:Q}):t("恢复后,项目会重新出现在默认项目列表中。")}),G&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-1.5",children:t("Project Path")}),e.jsx(be,{value:s,onChange:i,validationMode:"directory"}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:t("Agent Tower 会尽量校验项目 identity;如果 remote URL 或目录名不同,会给出警告但允许继续。")})]}),c.isError&&e.jsx("p",{className:"text-xs text-destructive",children:c.error instanceof Error?c.error.message:t("Failed to restore project")})]})})]})}export{qe as ProjectSettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as v,j as r,l as s}from"./index-CUDYX2CO.js";import{A as h}from"./arrow-left-DLv7xHB-.js";function y({items:o,selectedId:l,onSelectItem:c,getItemId:t,renderListItem:d,renderDetail:u,renderListFooter:g,mobileShowDetail:a,onMobileBack:x,listClassName:m,detailClassName:f}){const{t:p}=v(),b=o.find(e=>t(e)===l)??null;return r.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)] gap-5 lg:grid-cols-[240px_minmax(0,1fr)] lg:h-[calc(100vh-16rem)] lg:max-h-[640px]",children:[r.jsxs("div",{className:s("min-w-0 space-y-1 lg:overflow-y-auto lg:pr-1 scrollbar-app-thin",a&&"hidden lg:block",m),children:[o.map(e=>{const i=t(e),n=i===l;return r.jsx("button",{onClick:()=>c(i),"aria-current":n?"true":void 0,className:s("flex min-w-0 w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",n?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted/50"),children:d(e,n)},i)}),g?.()]}),r.jsxs("div",{className:s("min-w-0 rounded-xl border border-border bg-card lg:overflow-y-auto scrollbar-app-thin",!a&&"hidden lg:block",f),children:[r.jsxs("button",{onClick:x,className:"mb-4 flex items-center gap-1.5 px-5 pt-3 text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 lg:hidden",children:[r.jsx(h,{size:14}),p("返回列表")]}),u(b)]})]})}export{y as S};
|