agent-tower 0.7.4-beta.1 → 0.7.4
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/mcp/tools/tasks.js +1 -1
- package/dist/mcp/tools/tasks.js.map +1 -1
- package/dist/mcp/types.js +1 -1
- package/dist/mcp/types.js.map +1 -1
- package/dist/services/__tests__/task.service.test.js +69 -7
- package/dist/services/__tests__/task.service.test.js.map +1 -1
- package/dist/services/task-display-state.d.ts +10 -0
- package/dist/services/task-display-state.d.ts.map +1 -0
- package/dist/services/task-display-state.js +45 -0
- package/dist/services/task-display-state.js.map +1 -0
- package/dist/services/task.service.d.ts +14 -6
- package/dist/services/task.service.d.ts.map +1 -1
- package/dist/services/task.service.js +70 -83
- package/dist/services/task.service.js.map +1 -1
- package/dist/web/assets/{AgentDemoPage-DiHEh1iv.js → AgentDemoPage-D9bIiALx.js} +1 -1
- package/dist/web/assets/{AgentEnvironmentSettingsPage-B_Xk7Bef.js → AgentEnvironmentSettingsPage-BE0RC6fR.js} +1 -1
- package/dist/web/assets/{AttachmentPreview-BngGSahV.js → AttachmentPreview-TPd4gdfb.js} +1 -1
- package/dist/web/assets/{BranchSelect-BgVKUnxj.js → BranchSelect-Kv3M1YhZ.js} +1 -1
- package/dist/web/assets/{BrandLogo-CBahjTd7.js → BrandLogo-fR2lCwEo.js} +1 -1
- package/dist/web/assets/{ConversationPage-kgJIlyS5.js → ConversationPage-BZiMHI9T.js} +1 -1
- package/dist/web/assets/{CreateTaskInput-Cllw4abW.js → CreateTaskInput-TcZpjBe-.js} +1 -1
- package/dist/web/assets/{DemoPage-CkS__9CE.js → DemoPage-DwpThe16.js} +1 -1
- package/dist/web/assets/{DesignSystemPage-BklN99GA.js → DesignSystemPage-DH9_cygJ.js} +1 -1
- package/dist/web/assets/{ExecutionPermissionSelector-Bsi1aa7q.js → ExecutionPermissionSelector-C-akTOVg.js} +1 -1
- package/dist/web/assets/{GeneralSettingsPage-BC9TUWiu.js → GeneralSettingsPage-v2w1eofz.js} +1 -1
- package/dist/web/assets/{LoadingPreviewPage-Dx8Si6-g.js → LoadingPreviewPage-pgk3PWM9.js} +1 -1
- package/dist/web/assets/{McpSettingsPage-fqXRGtFu.js → McpSettingsPage-w1DOlY5V.js} +1 -1
- package/dist/web/assets/{MemberAvatar-CZ3F53Ep.js → MemberAvatar-CJtylxwu.js} +1 -1
- package/dist/web/assets/MobileTaskDetail-D5Czlr2O.js +3 -0
- package/dist/web/assets/{NotificationSettingsPage-D9KGIFVA.js → NotificationSettingsPage-CkLg4WvT.js} +1 -1
- package/dist/web/assets/{ProfileSettingsPage-D_Hw5lpd.js → ProfileSettingsPage-B3yzbY1V.js} +1 -1
- package/dist/web/assets/ProjectKanbanPage-CuGSLvrU.js +14 -0
- package/dist/web/assets/{ProjectSettingsPage-CJANCPJX.js → ProjectSettingsPage-DoklOfna.js} +1 -1
- package/dist/web/assets/{ProviderSettingsPage-B6Ro5PQa.js → ProviderSettingsPage-Cm0hbX5n.js} +1 -1
- package/dist/web/assets/{SettingsMasterDetail-Q-049Dvh.js → SettingsMasterDetail-CGCUalkW.js} +1 -1
- package/dist/web/assets/TaskDetail-BiZbuXcE.js +1 -0
- package/dist/web/assets/{TaskHandoffPanel-BpGiZ5eT.js → TaskHandoffPanel-CJahUKNo.js} +24 -24
- package/dist/web/assets/{TeamSettingsPage-DbKgqEO_.js → TeamSettingsPage-CyppRTaY.js} +1 -1
- package/dist/web/assets/{TranslationSettingsPage-Ba-iypOV.js → TranslationSettingsPage-BoQXEZmn.js} +1 -1
- package/dist/web/assets/{arc-SOqs3Svk.js → arc-5NPBSbiL.js} +1 -1
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-BH25ukq_.js → architectureDiagram-3BPJPVTR-CqPT-IsX.js} +1 -1
- package/dist/web/assets/{at-sign-CEsum1vJ.js → at-sign-Cf39WHCg.js} +1 -1
- package/dist/web/assets/{blockDiagram-GPEHLZMM-CKA17iNP.js → blockDiagram-GPEHLZMM-BN-1z9KN.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-DnZ_8oOf.js → c4Diagram-AAUBKEIU-CkeLbmQp.js} +1 -1
- package/dist/web/assets/channel-CDkuQ_7m.js +1 -0
- package/dist/web/assets/check-yNWhPvMH.js +1 -0
- package/dist/web/assets/{chevron-down-Bmwy-nvS.js → chevron-down-Ct7FZbKm.js} +1 -1
- package/dist/web/assets/{chevron-up-CClL6-SF.js → chevron-up-ARFlXMyO.js} +1 -1
- package/dist/web/assets/{chip-BSMT2uT1.js → chip-BV_1-tIb.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-BrtUyBDF.js → chunk-2J33WTMH-CWR7tRuT.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-DZDNetDC.js → chunk-4BX2VUAB-CAulp4D5.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-xVa3bJqv.js → chunk-55IACEB6-DqkKXsbD.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-B7n9vxY4.js → chunk-727SXJPM-B19m45Sq.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-DQd4G76y.js → chunk-AQP2D5EJ-CuODwkza.js} +1 -1
- package/dist/web/assets/{chunk-FMBD7UC4-CXyP08kl.js → chunk-FMBD7UC4-CbUAjtCT.js} +1 -1
- package/dist/web/assets/{chunk-ND2GUHAM-BtnIS-HK.js → chunk-ND2GUHAM-C54VxArl.js} +1 -1
- package/dist/web/assets/{chunk-QZHKN3VN-D4D-V_ex.js → chunk-QZHKN3VN-D54Uw5fD.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-eHY73FGu.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-eHY73FGu.js +1 -0
- package/dist/web/assets/{code-block-OCS4YCEC-DfERo9L1.js → code-block-OCS4YCEC-CtAySD1h.js} +1 -1
- package/dist/web/assets/{confirm-dialog-8ItnHBi0.js → confirm-dialog-CCjHVFTv.js} +1 -1
- package/dist/web/assets/{content-DrW8KnXu.js → content-DZozZbBD.js} +1 -1
- package/dist/web/assets/{copy-prrQrInw.js → copy-C-jvx2et.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-CXdH8Idq.js → cose-bilkent-S5V4N54A-BaB2EVcU.js} +1 -1
- package/dist/web/assets/{cssMode-CJ6_f10q.js → cssMode-wd7JR1S4.js} +1 -1
- package/dist/web/assets/{dagre-BM42HDAG-XZydDwXe.js → dagre-BM42HDAG-C2j1Y8pO.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-CofEe0Fr.js → diagram-2AECGRRQ-CF-EvpV9.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-BbTtW5WH.js → diagram-5GNKFQAL-rBNso835.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-BJHZXpUM.js → diagram-KO2AKTUF-6NW-oos1.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-DN7A27YU.js → diagram-LMA3HP47-DTfRxRLT.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-4IdYadiw.js → diagram-OG6HWLK6-CS4Ae-hD.js} +1 -1
- package/dist/web/assets/{dialog-BUsI4h2U.js → dialog-DV4wfpNU.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-BFijhCWv.js → erDiagram-TEJ5UH35-Dw9QQctN.js} +1 -1
- package/dist/web/assets/{file-C6QMUr5_.js → file-Btui_I8Z.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-D9MxC-El.js → flowDiagram-I6XJVG4X-BGZ9q86S.js} +1 -1
- package/dist/web/assets/{folder-picker-CBdw-4v3.js → folder-picker-DiR-8Qdl.js} +1 -1
- package/dist/web/assets/{freemarker2-CJVobC22.js → freemarker2-yVWXzD3l.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-BijCAyPQ.js → ganttDiagram-6RSMTGT7-CkGun0no.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-AvI5QqxQ.js → gitGraphDiagram-PVQCEYII-Bz3oiYvi.js} +1 -1
- package/dist/web/assets/{globe-BOfcTsvL.js → globe-DAFqpAcW.js} +1 -1
- package/dist/web/assets/{handlebars-DTqWmI25.js → handlebars-BPf0z6eN.js} +1 -1
- package/dist/web/assets/{html-Bx7L8DX_.js → html-HCTCjfUg.js} +1 -1
- package/dist/web/assets/{htmlMode-D_S0NjZc.js → htmlMode-BDkbsknt.js} +1 -1
- package/dist/web/assets/index-408ws6FY.css +1 -0
- package/dist/web/assets/{index-DUmVscrR.js → index-B8xoIIa6.js} +4 -4
- package/dist/web/assets/{index-JXcQeorP.js → index-BMcLxIvZ.js} +1 -1
- package/dist/web/assets/{index-BFcDmhr0.js → index-BPqjxXmH.js} +1 -1
- package/dist/web/assets/index-BszkzNS4.js +122 -0
- package/dist/web/assets/{index-COigMgrJ.js → index-DgUtx9rV.js} +1 -1
- package/dist/web/assets/{index-Cdmj8aPv.js → index-DkSPjZm4.js} +1 -1
- package/dist/web/assets/{index-Bg8TlDo_.js → index-DuM6iAxG.js} +1 -1
- package/dist/web/assets/{index-CtOu4p9B.js → index-GuczxPxb.js} +1 -1
- package/dist/web/assets/{index-BClyhWqz.js → index-lZLy5rkr.js} +1 -1
- package/dist/web/assets/{infoDiagram-5YYISTIA-76JLqjJ0.js → infoDiagram-5YYISTIA-DYFufUYC.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-CXHFTVly.js → ishikawaDiagram-YF4QCWOH-IOkrKRwu.js} +1 -1
- package/dist/web/assets/javascript-DKmxrNeR.js +1 -0
- package/dist/web/assets/{journeyDiagram-JHISSGLW-6SDJs9C5.js → journeyDiagram-JHISSGLW-Btl3yxne.js} +1 -1
- package/dist/web/assets/{jsonMode-BGg9MhFR.js → jsonMode-DJPdvFcw.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-C0Y3zy1P.js → kanban-definition-UN3LZRKU-CDryhPbA.js} +1 -1
- package/dist/web/assets/{kbd-D4KIW7lm.js → kbd-8RRRm9jd.js} +1 -1
- package/dist/web/assets/{key-round-C4vhwqUu.js → key-round-wojrCrDP.js} +1 -1
- package/dist/web/assets/{layers-BBHgMnhN.js → layers-BH_LL4b8.js} +1 -1
- package/dist/web/assets/{linear-CjeIgBwO.js → linear-BLuwKHze.js} +1 -1
- package/dist/web/assets/{link-C-Jq7dnc.js → link-jWQOSQOQ.js} +1 -1
- package/dist/web/assets/{liquid-guocpCJB.js → liquid-1y-xg637.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-CPXERxVW.js → lspLanguageFeatures-cYkILdCn.js} +1 -1
- package/dist/web/assets/{mdx-DA4ymd3l.js → mdx-CRg4Q6aP.js} +1 -1
- package/dist/web/assets/{menu-BgtmXAzT.js → menu-CMqbaDni.js} +1 -1
- package/dist/web/assets/{mermaid-NOHMQCX5-XQbfQDGS.js → mermaid-NOHMQCX5-CYeAhOl-.js} +4 -4
- package/dist/web/assets/{message-square-DIFv9yrO.js → message-square-DykJ2lWP.js} +1 -1
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-6ucD61UV.js → mindmap-definition-RKZ34NQL-B5wtw1Rv.js} +1 -1
- package/dist/web/assets/{modal-Dx4N46s5.js → modal-BwOwTzij.js} +1 -1
- package/dist/web/assets/{monaco-Mn1xgio_.js → monaco-CcHqpOKe.js} +3 -3
- package/dist/web/assets/{nav-row-DwEkbw3N.js → nav-row-BmtdNLxR.js} +1 -1
- package/dist/web/assets/{paperclip-CdQvl5ee.js → paperclip-C4t49vX2.js} +1 -1
- package/dist/web/assets/{pencil-ChX7G9j9.js → pencil-BQ5_raiB.js} +1 -1
- package/dist/web/assets/{people-D_VwidfV.js → people-Dr0v8HK0.js} +1 -1
- package/dist/web/assets/{pieDiagram-4H26LBE5-KVvAyrIn.js → pieDiagram-4H26LBE5-BZ3VoaNI.js} +1 -1
- package/dist/web/assets/{popover-CGEFZKuu.js → popover-CTqvKqTR.js} +1 -1
- package/dist/web/assets/{python-BzNNRn8W.js → python-Huq_acyd.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-ClVzvpE7.js → quadrantDiagram-W4KKPZXB-C6ArHmnG.js} +1 -1
- package/dist/web/assets/{razor-DF2ZxqCE.js → razor-Clc87Ivb.js} +1 -1
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-uXN6Uoln.js → requirementDiagram-4Y6WPE33-DiLzBRQP.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-Bi3Tc0wR.js → sankeyDiagram-5OEKKPKP-QlYYd7IZ.js} +1 -1
- package/dist/web/assets/{search--FRFbCre.js → search-CMIAPUEt.js} +1 -1
- package/dist/web/assets/{select-D0sHgfcU.js → select-Bg7NI8i0.js} +1 -1
- package/dist/web/assets/{select-c5IIpQj0.js → select-DqB7YF38.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-CLdrO2PY.js → sequenceDiagram-3UESZ5HK-COKEtqc0.js} +1 -1
- package/dist/web/assets/{server-Dr_6KJFM.js → server-D7knl8H9.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-BGInldGc.js → stateDiagram-AJRCARHV-1RZZZdOe.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-CCLmVs34.js +1 -0
- package/dist/web/assets/{textarea-W-xQPto3.js → textarea-BCY2J2ca.js} +1 -1
- package/dist/web/assets/{timeline-definition-PNZ67QCA-BUp6Qykc.js → timeline-definition-PNZ67QCA-IJl1LY6J.js} +1 -1
- package/dist/web/assets/{toggles-Bgp7vdwg.js → toggles-C4LmZwyo.js} +1 -1
- package/dist/web/assets/{tooltip-DZcaSN1F.js → tooltip-Cirpotu3.js} +1 -1
- package/dist/web/assets/{track-Cj1Ogapu.js → track-Cv7h6oaE.js} +1 -1
- package/dist/web/assets/{trash-2-DmFXzIhh.js → trash-2-BEOQ1ICJ.js} +1 -1
- package/dist/web/assets/{tsMode-CSHMQttX.js → tsMode-CHIbCBQc.js} +1 -1
- package/dist/web/assets/{typescript-CyQKmnN-.js → typescript-CScj0bbb.js} +1 -1
- package/dist/web/assets/{upload-C-4QDrwN.js → upload-tLVD0xMT.js} +1 -1
- package/dist/web/assets/{use-profiles-D5mIgeQU.js → use-profiles-TkoP4Yw9.js} +1 -1
- package/dist/web/assets/{use-providers-BViTes-6.js → use-providers-Bz6YNiYj.js} +1 -1
- package/dist/web/assets/{use-translation-settings-Dgw0oKP1.js → use-translation-settings-CCpQNS30.js} +1 -1
- package/dist/web/assets/{useNormalizedLogs-BX7pMg0-.js → useNormalizedLogs-Bstb98cF.js} +1 -1
- package/dist/web/assets/{useTokenUsage-T03faPfn.js → useTokenUsage-D7SEwXb0.js} +1 -1
- package/dist/web/assets/{vennDiagram-CIIHVFJN-iQYnP9Ux.js → vennDiagram-CIIHVFJN-DzVayy4U.js} +1 -1
- package/dist/web/assets/{wardley-L42UT6IY-J7vXwA5J.js → wardley-L42UT6IY-CULSKh55.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-CdtM5GJv.js → wardleyDiagram-YWT4CUSO-C5_h3lAA.js} +1 -1
- package/dist/web/assets/{xml-C79KdvcD.js → xml-XuycSwh6.js} +1 -1
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-B3gcBChQ.js → xychartDiagram-2RQKCTM6-F65naXcR.js} +1 -1
- package/dist/web/assets/{yaml-C1WLpuVe.js → yaml-BWm159lw.js} +1 -1
- package/dist/web/index.html +2 -2
- package/node_modules/@agent-tower/shared/dist/types.d.ts +12 -2
- package/node_modules/@agent-tower/shared/dist/types.d.ts.map +1 -1
- package/node_modules/@agent-tower/shared/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/assets/MobileTaskDetail-B68iYPOI.js +0 -3
- package/dist/web/assets/ProjectKanbanPage-CUX0Kh-t.js +0 -12
- package/dist/web/assets/TaskDetail-DBtWf0YV.js +0 -1
- package/dist/web/assets/channel-xU45IQlP.js +0 -1
- package/dist/web/assets/check-DUA2DjGH.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-pvRulc6s.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-pvRulc6s.js +0 -1
- package/dist/web/assets/index-BDON669P.css +0 -1
- package/dist/web/assets/index-BRu1Yhrx.js +0 -122
- package/dist/web/assets/javascript-80FDzX3y.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-D44x8SXb.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bi as B,b5 as M,bj as U,u as z,r as S,j as p,l as T}from"./index-
|
|
1
|
+
import{bi as B,b5 as M,bj as U,u as z,r as S,j as p,l as T}from"./index-BszkzNS4.js";import{C as Z}from"./chevron-down-Ct7FZbKm.js";import{C as Y}from"./check-yNWhPvMH.js";const q=["ASK","AUTO_SANDBOX","FULL_ACCESS"];function L(e){return q.includes(e)}function Se(e){const n=[],i=e.config??{},t=[],r=(a,c="INVALID_ENUM")=>{n.push({field:"executionPermission",code:c,message:a})};for(const a of["permissionMode","acpPermissionMode"])i[a]!==void 0&&(i[a]==="ASK"?t.push("ASK"):i[a]==="UNRESTRICTED"||i[a]==="AUTO_APPROVE"?t.push("FULL_ACCESS"):r(`${a} contains an invalid legacy permission mode`));const o=B(e.agentType)?.executionPermission.path;o&&i[o]!==void 0&&(typeof i[o]!="boolean"?r(`${o} must be true or false`,"INVALID_TYPE"):t.push(i[o]?"FULL_ACCESS":"ASK"));const s=e.executionPermission;s!==void 0&&!L(s)&&r("executionPermission must be ASK, AUTO_SANDBOX or FULL_ACCESS");const l=L(s)?s:t[0]??"ASK";return t.some(a=>a!==l)&&r("Legacy permission fields conflict with executionPermission","CONFLICT"),(e.executionPermissionReviewRequired||n.length===0&&s===void 0&&l==="ASK"&&e.agentType===M.CODEX)&&r("Legacy Codex permissions did not establish an explicit reviewer policy. Select an execution permission mode.","LEGACY_PERMISSION_REVIEW_REQUIRED"),{mode:l,diagnostics:n}}function _e(e,n){const i={...n};delete i.permissionMode,delete i.acpPermissionMode;const t=B(e)?.executionPermission.path;return t&&delete i[t],i}function G(e,n){let i=e.slice(0,n).split(/\r\n|\n|\r/g);return[i.length,i.pop().length+1]}function J(e,n,i){let t=e.split(/\r\n|\n|\r/g),r="",o=(Math.log10(n+1)|0)+1;for(let s=n-1;s<=n+1;s++){let l=t[s-1];l&&(r+=s.toString().padEnd(o," "),r+=": ",r+=l,r+=`
|
|
2
2
|
`,s===n&&(r+=" ".repeat(o+i+2),r+=`^
|
|
3
3
|
`))}return r}class m extends Error{line;column;codeblock;constructor(n,i){const[t,r]=G(i.toml,i.ptr),o=J(i.toml,t,r);super(`Invalid TOML document: ${n}
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as te,a as ne,b as le,d as ie,e as re,f as oe,g as ce,r as t,t as m,j as a,S as de,h as ue,i as A,k as W,B as p,I as D}from"./index-
|
|
1
|
+
import{u as te,a as ne,b as le,d as ie,e as re,f as oe,g as ce,r as t,t as m,j as a,S as de,h as ue,i as A,k as W,B as p,I as D}from"./index-BszkzNS4.js";import{S as H}from"./select-DqB7YF38.js";import{T as me}from"./textarea-BCY2J2ca.js";import{S as pe}from"./toggles-C4LmZwyo.js";import{u as ge}from"./use-providers-Bz6YNiYj.js";import{i as fe}from"./provider-selection-DSu7SCI7.js";import"./select-Bg7NI8i0.js";import"./menu-styles-DWynpVVz.js";import"./chevron-down-Ct7FZbKm.js";import"./check-yNWhPvMH.js";import"./index-GuczxPxb.js";import"./index-BPqjxXmH.js";import"./index-lZLy5rkr.js";import"./index-BMcLxIvZ.js";import"./index-DkSPjZm4.js";import"./index-DuM6iAxG.js";const he=[{value:"zh-CN",label:"简体中文"},{value:"en",label:"English"}],N="__follow_task__",K=8;function V(P,y){return P instanceof Error?P.message:y}function Me(){const{locale:P,setLocale:y,t:e}=te(),{data:g}=ne(),{data:O}=ge(),{data:w}=le(),{data:r}=ie(),u=re(),i=oe(),S=ce(),[E,F]=t.useState(N),[k,_]=t.useState(""),[q,j]=t.useState(!1),[d,L]=t.useState(""),[o,I]=t.useState(""),[C,M]=t.useState(""),[T,f]=t.useState(!1),[J,h]=t.useState(!1),[b,l]=t.useState(null);t.useEffect(()=>{!g||!w||(F(g.commitMessageProviderId||N),_(g.commitMessagePrompt||w.prompt),j(!1))},[g,w]),t.useEffect(()=>{r&&(f(r.enabled),h(!1),l(null),L(""),I(""),M(""))},[r?.enabled]);const B=[{value:N,label:e("跟随任务")},...(O??[]).filter(fe).filter(s=>s.availability.type!=="NOT_FOUND").map(s=>({value:s.provider.id,label:s.provider.name}))],x=r?.enabled??!1,n=!x&&T?"enable":x&&!T?"disable":x&&J?"change":"idle",G=n!=="idle",Q=e(G?n==="disable"?"将关闭":n==="enable"?"将启用":"已启用":x?"已启用":"未启用"),X=t.useCallback(s=>{F(s);const v=s===N?null:s;u.mutate({commitMessageProviderId:v},{onError:()=>m.error(e("保存失败"))})},[u,e]),Y=t.useCallback(()=>{const s=k.trim()||null;u.mutate({commitMessagePrompt:s},{onSuccess:()=>{j(!1),m.success(e("已保存"))},onError:()=>m.error(e("保存失败"))})},[k,u,e]),c=t.useCallback(()=>{L(""),I(""),M("")},[]),Z=t.useCallback(()=>{f(r?.enabled??!1),h(!1),l(null),c()},[r?.enabled,c]),U=t.useCallback(s=>{if((s==="change"||s==="disable")&&!d)return l(e("请输入当前密码")),!1;if(s==="enable"||s==="change"){if(o.length<K)return l(e("密码至少需要 8 个字符")),!1;if(o!==C)return l(e("两次输入不一致")),!1}return l(null),!0},[C,d,o,e]),R=t.useCallback(()=>{if(n==="idle"||!U(n))return;const s=n==="disable"?{enabled:!1,currentPassword:d}:n==="enable"?{enabled:!0,newPassword:o}:{currentPassword:d,newPassword:o};i.mutate(s,{onSuccess:v=>{f(v.enabled),h(!1),l(null),c(),m.success(e(n==="disable"?"已关闭":"已保存"))},onError:v=>{const z=V(v,e("保存失败"));z.toLowerCase().includes("current password")?l(e("当前密码不正确")):z.toLowerCase().includes("at least 8")?l(e("密码至少需要 8 个字符")):l(z)}})},[n,c,d,o,e,i,U]),$=t.useCallback(s=>{!r||i.isPending||(f(s),h(!1),l(null),c())},[r,c,i.isPending]),ee=t.useCallback(()=>{S.mutate(void 0,{onSuccess:()=>m.success(e("已退出登录")),onError:s=>m.error(V(s,e("退出登录失败")))})},[S,e]),se=t.useCallback(s=>{s.preventDefault(),R()},[R]),ae=t.useCallback(()=>{!r||i.isPending||(f(!0),h(!0),l(null),c())},[r,c,i.isPending]);return a.jsxs(de,{children:[a.jsx(ue,{title:e("通用设置"),className:"mb-1"}),a.jsx("div",{className:"divide-y divide-border/60",children:a.jsx(A,{label:e("显示语言"),description:e("界面语言会保存到本地数据库,重启后继续生效。"),align:"center",children:a.jsx(H,{value:P,onChange:s=>y(s),options:he})})}),a.jsx(W,{className:"mt-8 mb-1",children:e("访问安全")}),a.jsx("div",{className:"divide-y divide-border/60",children:a.jsx(A,{label:e("访问密码"),description:e("开启后,进入 Agent Tower 需要输入密码。"),controlWidth:"fixed",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsx("span",{className:"text-sm font-medium text-foreground",children:Q}),a.jsx(pe,{checked:T,onCheckedChange:$,disabled:!r||i.isPending,"aria-label":e("访问密码")})]}),x&&n==="idle"&&a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[a.jsx(p,{type:"button",size:"sm",variant:"outline",className:"w-full sm:w-auto",onClick:ae,disabled:i.isPending,children:e("修改密码")}),a.jsx(p,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:ee,disabled:S.isPending,children:S.isPending?e("退出中..."):e("退出登录")})]}),G&&a.jsxs("form",{className:"space-y-2",onSubmit:se,children:[(n==="change"||n==="disable")&&a.jsx(D,{type:"password",autoComplete:"current-password",placeholder:e("当前密码"),value:d,onChange:s=>{L(s.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&!d)}),(n==="enable"||n==="change")&&a.jsxs(a.Fragment,{children:[a.jsx(D,{type:"password",autoComplete:"new-password",placeholder:e(n==="enable"?"访问密码":"新密码"),value:o,onChange:s=>{I(s.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o.length<K)}),a.jsx(D,{type:"password",autoComplete:"new-password",placeholder:e("确认密码"),value:C,onChange:s=>{M(s.target.value),l(null)},disabled:i.isPending,"aria-invalid":!!(b&&o!==C)})]}),(n==="change"||n==="disable")&&a.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e(n==="disable"?"关闭后不再要求访问密码。":"保存后其他已登录页面需要重新输入。")}),b&&a.jsx("p",{className:"text-xs text-destructive-ink",children:b}),a.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-1 sm:flex-row sm:justify-end",children:[a.jsx(p,{type:"button",size:"sm",variant:"ghost",className:"w-full sm:w-auto",onClick:Z,disabled:i.isPending,children:e("取消")}),a.jsx(p,{type:"submit",size:"sm",className:"w-full sm:w-auto",disabled:i.isPending,children:i.isPending?e("保存中..."):e(n==="disable"?"关闭访问密码":"保存")})]})]})]})})}),a.jsx(W,{className:"mt-8 mb-1",children:e("Git Commit Message")}),a.jsxs("div",{className:"divide-y divide-border/60",children:[a.jsx(A,{label:e("Agent 渠道"),description:e('"跟随任务"表示使用当前任务所用的 Agent 渠道。选择具体渠道可使用更经济的模型。'),children:a.jsx(H,{value:B.some(s=>s.value===E)?E:"",placeholder:O?.find(s=>s.provider.id===E)?.provider.name,onChange:X,options:B})}),a.jsx(A,{label:e("提示词模板"),description:e("自定义生成 commit message 的提示词。留空则使用内置默认模板。"),children:a.jsxs("div",{className:"space-y-2",children:[a.jsx(me,{value:k,onChange:s=>{_(s.target.value),j(!0)},rows:5,className:"font-mono resize-y"}),q&&a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(p,{size:"sm",variant:"ghost",onClick:()=>{_(g?.commitMessagePrompt||w?.prompt||""),j(!1)},children:e("取消")}),a.jsx(p,{size:"sm",onClick:Y,disabled:u.isPending,children:u.isPending?e("保存中..."):e("保存")})]})]})})]})]})}export{Me as GeneralSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as f,r as o,L as u,j as e,R as h,X as b}from"./index-
|
|
1
|
+
import{u as f,r as o,L as u,j as e,R as h,X as b}from"./index-BszkzNS4.js";function p(){const{t:s}=f(),[a,c]=o.useState(null),x=o.useRef(null),d=o.useRef(null),i=o.useRef(null),t=a?u.find(r=>r.id===a):null,l=o.useCallback(()=>{c(null)},[]);return o.useEffect(()=>{if(!t){i.current?.focus(),i.current=null;return}d.current?.focus();const r=n=>{if(n.key==="Escape"){n.preventDefault(),l();return}n.key==="Tab"&&(n.preventDefault(),d.current?.focus())};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,l]),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("style",{children:h}),e.jsx("header",{className:"border-b border-border px-6 py-4",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Loading Animation Preview"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("10 个首屏加载动画候选 · 颜色遵循 Agent Tower 设计规范 · 点击卡片查看全屏效果")})]})}),e.jsxs("main",{className:"max-w-6xl mx-auto px-6 py-8",inert:t?!0:void 0,"aria-hidden":t?!0:void 0,children:[e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:u.map((r,n)=>{const m=r.component;return e.jsxs("button",{onClick:g=>{i.current=g.currentTarget,c(r.id)},className:"group relative flex flex-col bg-card border border-border rounded-lg p-5 text-left transition-shadow hover:shadow-md focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",children:[e.jsxs("span",{className:"absolute top-3 right-3 text-[11px] font-semibold text-muted-foreground/60 tabular-nums",children:["#",n+1]}),e.jsx("div",{className:"flex items-center justify-center h-28 mb-4",children:e.jsx(m,{})}),e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:r.name}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:s(r.description)})]},r.id)})}),e.jsxs("div",{className:"mt-10 p-5 border border-border rounded-lg bg-muted/30",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground mb-2",children:s("设计推荐")}),e.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1.5 leading-relaxed",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("首选:Charcoal Breathe (#10)")})," — ",s("品牌感最强,Charcoal 色块+Tower 图标呼吸,用户对产品的第一印象即品牌本身。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选A:Tower Pulse (#1)")})," — ",s("品牌图标直接出现,脉冲节奏稳定,不浮夸,适合工作台场景。")]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-foreground",children:s("备选B:Terminal Cursor (#4)")})," — ",s("终端光标闪烁,贴合 Agent/终端协作的核心场景,开发者亲切感强。")]})]})]})]}),t&&e.jsxs("div",{ref:x,className:"fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm",onClick:r=>{r.target===r.currentTarget&&l()},role:"dialog","aria-modal":"true","aria-label":s("全屏预览:{name}",{name:t.name}),children:[e.jsx("button",{ref:d,onClick:l,className:"absolute top-4 right-4 p-2 rounded-lg text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none","aria-label":s("关闭预览"),children:e.jsx(b,{size:20})}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx("div",{className:"scale-[2] origin-center",children:e.jsx(t.component,{})}),e.jsxs("div",{className:"text-center mt-4",children:[e.jsx("h3",{className:"text-base font-semibold text-foreground",children:t.name}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1 max-w-sm",children:s(t.description)})]}),e.jsx("span",{className:"text-xs text-muted-foreground/60 mt-2",children:s("按 Esc 或点击关闭按钮退出")})]})]})]})}export{p as LoadingPreviewPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as l,q as m,p as x,u,r as g,t as a,j as e,S as n,a3 as p,B as i,ac as f}from"./index-
|
|
1
|
+
import{m as l,q as m,p as x,u,r as g,t as a,j as e,S as n,a3 as p,B as i,ac as f}from"./index-BszkzNS4.js";import{C as j}from"./copy-C-jvx2et.js";import{S as b}from"./server-D7knl8H9.js";import{C as h}from"./check-yNWhPvMH.js";function N(){return l({queryKey:m.system.mcpConfig,queryFn:()=>x.get("/system/mcp-config")})}function v({mode:s,label:t}){const r=s==="desktop-packaged";return e.jsx("span",{className:`inline-flex items-center rounded-md px-2 py-1 text-xs font-medium ${r?"bg-success/10 text-success-ink":"bg-warning/10 text-warning-ink"}`,children:t})}function M(){const{t:s}=u(),{data:t,isLoading:r,isError:d,refetch:o}=N(),c=g.useCallback(async()=>{if(t?.configJson)try{await navigator.clipboard.writeText(t.configJson),a.success(s("MCP 配置已复制"))}catch{a.error(s("复制 MCP 配置失败"))}},[t?.configJson,s]);return r?e.jsx(n,{children:e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(p,{className:"h-5 w-5 animate-spin motion-reduce:[animation-duration:2.4s] text-muted-foreground"})})}):d||!t?e.jsxs(n,{children:[e.jsx("h2",{className:"mb-1 text-base font-semibold text-foreground",children:s("MCP 配置")}),e.jsx("div",{className:"mt-5 rounded-lg border border-destructive/25 bg-destructive/10 px-4 py-3 text-sm text-destructive-ink",children:s("MCP 配置加载失败")}),e.jsx(i,{className:"mt-4",size:"sm",variant:"outline",onClick:()=>{o()},children:s("重试")})]}):e.jsxs(n,{children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:s("MCP 配置")}),e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-muted-foreground",children:s("复制下面的 JSON 到支持 MCP 的客户端配置中。桌面打包版使用 App 内置 runtime,不需要全局安装 agent-tower。")})]}),e.jsxs(i,{size:"sm",onClick:c,children:[e.jsx(j,{size:14}),s("复制配置")]})]}),e.jsxs("div",{className:"space-y-3 border-b border-border/60 pb-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(v,{mode:t.runtimeMode,label:t.runtimeMode==="desktop-packaged"?s("桌面打包 runtime"):s("工作区 runtime")}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:t.serverName})]}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"rounded-lg border border-border/60 bg-muted/35 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e.jsx(f,{size:12}),"Command"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-foreground",children:t.command})]}),e.jsxs("div",{className:"rounded-lg border border-border/60 bg-muted/35 p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e.jsx(b,{size:12}),"Entry"]}),e.jsx("div",{className:"break-all font-mono text-[12px] leading-relaxed text-foreground",children:t.args.at(-1)??""})]})]})]}),e.jsxs("div",{className:"pt-5",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[e.jsx("label",{className:"text-[12px] font-medium text-foreground/70",children:"mcpServers JSON"}),t.runtimeMode==="desktop-packaged"&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-success-ink",children:[e.jsx(h,{size:12}),s("无需全局 CLI")]})]}),e.jsx("textarea",{readOnly:!0,value:t.configJson,rows:14,className:"w-full resize-y rounded-lg border border-border bg-foreground/[0.025] px-3 py-3 font-mono text-[12px] leading-relaxed text-foreground outline-none"}),e.jsx("p",{className:"mt-2 text-xs leading-relaxed text-muted-foreground",children:s("当前版本只生成通用 MCP 配置,不会自动修改 Claude、Codex 或其他第三方客户端配置文件。")})]})]})}export{M as McpSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m,j as c,l as f}from"./index-
|
|
1
|
+
import{r as m,j as c,l as f}from"./index-BszkzNS4.js";import{A as u}from"./people-Dr0v8HK0.js";function p(s){const t=s.trim();if(!t)return"?";const r=t.split(/\s+/).filter(Boolean);return r.length>=2?`${r[0][0]??""}${r[1][0]??""}`.toUpperCase():Array.from(t).slice(0,2).join("").toUpperCase()}function l(s){const t=s.trim();return/^#([0-9a-f]{3,8})$/i.test(t)||/^rgba?\(/i.test(t)||/^hsla?\(/i.test(t)}function i(s){const t=s.trim();return t.startsWith("/")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:image/")||t.startsWith("blob:")}function x(s,t){const r=s?.trim()??"";return!r||l(r)||i(r)?p(t):r.length<=2?r.toUpperCase():r.slice(0,2).toUpperCase()}function d({name:s,avatar:t,size:r,className:n}){const e=t?.trim()??"",o=m.useMemo(()=>{const a=x(e,s);return r==="xs"&&/[\u3400-\u9fff]/.test(a)?Array.from(a)[0]:a},[s,e,r]);return c.jsx(u,{name:s,src:e&&i(e)?e:void 0,initials:o,size:r,className:f(!r&&"size-7 text-[10px]",n)})}export{d as M};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{u as B,j as e,aB as X,r as n,a2 as Ee,l as Re,aC as Nt,p as Bs,q as Je,aD as Pe,aq as kt,o as Ct,ak as wt,al as It,am as St,aE as Tt,an as Pt,ao as At,ar as Rt,ap as z,s as Ps,au as Et,B as Qe,aw as As,ax as Mt,a3 as Ot,ay as Lt,az as ue,a0 as Dt}from"./index-BszkzNS4.js";import{b as Fs,G as es,q as Wt,D as Gs,s as zt,t as Bt,u as Ft,r as Gt,g as Ae,c as qt,e as Ut,f as Vt,a as Ht,h as $t,W as Kt,C as _t,E as Qt,i as Xt,S as Yt,T as Rs,R as Zt,j as Jt,l as en,v as sn,w as tn,k as nn,m as rn,n as on,o as an,p as ln}from"./TaskHandoffPanel-CJahUKNo.js";import{g as Es,a as Ms,D as cn}from"./ProjectKanbanPage-CuGSLvrU.js";import{a as Os,Q as dn,s as un}from"./mermaid-NOHMQCX5-CYeAhOl-.js";import{u as mn,a as xn,R as pn,P as fn,T as hn}from"./useTokenUsage-D7SEwXb0.js";import{u as gn,a as bn,L as Ls,T as Ds}from"./useNormalizedLogs-Bstb98cF.js";import{g as vn}from"./ExecutionPermissionSelector-C-akTOVg.js";import{u as jn,A as yn}from"./AttachmentPreview-TPd4gdfb.js";import{u as Nn,a as kn,b as Cn,d as wn,e as In,S as Ws}from"./CreateTaskInput-TcZpjBe-.js";import{F as qs,H as Us,a as Vs,C as Sn,P as Xe}from"./content-DZozZbBD.js";import{C as Me}from"./chevron-down-Ct7FZbKm.js";import{a as Tn,b as Pn,c as An}from"./BranchSelect-Kv3M1YhZ.js";import{u as Rn}from"./use-providers-Bz6YNiYj.js";import{M as Hs}from"./message-square-DykJ2lWP.js";import{P as En,T as Mn}from"./trash-2-BEOQ1ICJ.js";import{P as On}from"./paperclip-C4t49vX2.js";import"./use-translation-settings-CCpQNS30.js";import"./MemberAvatar-CJtylxwu.js";import"./people-Dr0v8HK0.js";import"./chevron-up-ARFlXMyO.js";import"./at-sign-Cf39WHCg.js";import"./check-yNWhPvMH.js";import"./tooltip-Cirpotu3.js";import"./kbd-8RRRm9jd.js";import"./index-BPqjxXmH.js";import"./index-lZLy5rkr.js";import"./index-DkSPjZm4.js";import"./BrandLogo-fR2lCwEo.js";import"./popover-CTqvKqTR.js";import"./search-CMIAPUEt.js";import"./index-DgUtx9rV.js";import"./index-DuM6iAxG.js";import"./index-GuczxPxb.js";import"./confirm-dialog-CCjHVFTv.js";import"./dialog-DV4wfpNU.js";import"./modal-BwOwTzij.js";import"./select-DqB7YF38.js";import"./select-Bg7NI8i0.js";import"./menu-styles-DWynpVVz.js";import"./index-BMcLxIvZ.js";import"./provider-selection-DSu7SCI7.js";import"./layers-BH_LL4b8.js";import"./textarea-BCY2J2ca.js";import"./menu-CMqbaDni.js";import"./server-D7knl8H9.js";import"./upload-tLVD0xMT.js";import"./globe-DAFqpAcW.js";import"./pencil-BQ5_raiB.js";import"./chip-BV_1-tIb.js";import"./copy-C-jvx2et.js";import"./folder-picker-DiR-8Qdl.js";import"./track-Cv7h6oaE.js";import"./file-Btui_I8Z.js";function Ln(s){const o=s.split("/");return o[o.length-1]||s}function Dn(s){const o=s.lastIndexOf("/");return o>0?s.slice(0,o):""}function Wn({workingDir:s,filePath:o,type:c}){const{t:i}=B(),{data:g,isLoading:f,isError:h}=Wt(s,o,c);if(f)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-muted-foreground",children:[e.jsx(X,{}),e.jsx("span",{className:"text-xs",children:i("Loading diff...")})]});if(h)return e.jsx("div",{className:"px-3 py-3 text-xs text-destructive-ink",children:i("Failed to load diff.")});const p=g?.diff||"";if(!p.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:i("No diff content available.")});const b=p.split(`
|
|
2
|
+
`);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin mx-3 mb-3 rounded-lg border border-border/60 bg-background py-1 font-mono text-xs leading-5",children:e.jsx("div",{className:"min-w-max",children:b.map((a,I)=>e.jsx(Gs,{line:a,lineNum:I+1},I))})})}function zn({entry:s,type:o,workingDir:c}){const[i,g]=n.useState(!1),f=Dn(s.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>g(h=>!h),className:Re("flex items-center gap-2.5 w-full px-4 py-3 text-left active:bg-accent",i&&"bg-muted/50"),children:[e.jsx(qs,{status:s.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground truncate block",children:Ln(s.path)}),f&&e.jsx("span",{className:"text-[11px] text-muted-foreground truncate block",children:f})]}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:i?e.jsx(Me,{size:14}):e.jsx(Ee,{size:14})})]}),i&&e.jsx(Wn,{workingDir:c,filePath:s.path,type:o})]})}function zs({title:s,entries:o,type:c,workingDir:i,defaultOpen:g}){const{t:f}=B(),[h,p]=n.useState(g);return o.length===0?null:e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>p(b=>!b),className:"flex items-center gap-2 w-full px-4 py-2.5 active:bg-accent",children:[e.jsx("span",{className:"text-muted-foreground",children:h?e.jsx(Me,{size:14}):e.jsx(Ee,{size:14})}),e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:f(s)}),e.jsx("span",{className:"text-[11px] tabular-nums bg-muted px-1.5 py-0.5 rounded text-muted-foreground",children:o.length})]}),h&&e.jsx("div",{className:"divide-y divide-border/60",children:o.map(b=>e.jsx(zn,{entry:b,type:c,workingDir:i},`${c}:${b.path}`))})]})}function Bn({workingDir:s}){const{t:o}=B(),{data:c,isLoading:i,isError:g}=Fs(s);if(!s)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:o("No workspace selected.")});if(i)return e.jsxs("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:[e.jsx(X,{size:"md",className:"mr-2"}),e.jsx("span",{className:"text-sm",children:o("Loading changes...")})]});if(g)return e.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-sm",children:o("Failed to load changes.")});const f=c?.uncommitted||[],h=c?.committed||[];return f.length+h.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground py-16",children:[e.jsx(es,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:o("No pending changes")})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin overscroll-y-contain",children:[e.jsx(zs,{title:"Uncommitted",entries:f,type:"uncommitted",workingDir:s,defaultOpen:!0}),e.jsx(zs,{title:"Committed",entries:h,type:"committed",workingDir:s,defaultOpen:!1})]})}const Ye=50;function Fn(s){const c=Math.floor(Date.now()/1e3)-s;return c<60?Pe("{count}s ago",{count:c}):c<3600?Pe("{count}m ago",{count:Math.floor(c/60)}):c<86400?Pe("{count}h ago",{count:Math.floor(c/3600)}):c<604800?Pe("{count}d ago",{count:Math.floor(c/86400)}):new Date(s*1e3).toLocaleDateString()}function Gn(s){const o=s.split("/");return o[o.length-1]||s}function qn(s){const o=s.lastIndexOf("/");return o>0?s.slice(0,o):""}function Un({workingDir:s,hash:o,filePath:c}){const{t:i}=B(),{data:g,isLoading:f,isError:h}=Bt(s,o,c);if(f)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-4 text-muted-foreground",children:[e.jsx(X,{}),e.jsx("span",{className:"text-xs",children:i("Loading diff...")})]});if(h)return e.jsx("div",{className:"px-3 py-3 text-xs text-destructive-ink",children:i("Failed to load diff.")});const p=g?.diff||"";if(!p.trim())return e.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:i("No diff content available.")});const b=p.split(`
|
|
3
|
+
`);return e.jsx("div",{className:"overflow-x-auto scrollbar-app-thin mx-3 mb-3 rounded-lg border border-border/60 bg-background py-1 font-mono text-xs leading-5",children:e.jsx("div",{className:"min-w-max",children:b.map((a,I)=>e.jsx(Gs,{line:a,lineNum:I+1},I))})})}function Vn({entry:s,workingDir:o,hash:c}){const[i,g]=n.useState(!1),f=qn(s.path);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>g(h=>!h),className:Re("flex items-center gap-2.5 w-full px-4 py-2.5 text-left active:bg-accent",i&&"bg-muted/50"),children:[e.jsx(qs,{status:s.status,size:"md"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"text-sm text-foreground truncate block",children:Gn(s.path)}),f&&e.jsx("span",{className:"text-[11px] text-muted-foreground truncate block",children:f})]}),e.jsx("span",{className:"text-muted-foreground shrink-0",children:i?e.jsx(Me,{size:14}):e.jsx(Ee,{size:14})})]}),i&&e.jsx(Un,{workingDir:o,hash:c,filePath:s.path})]})}function Hn({commit:s,workingDir:o}){const{t:c}=B(),[i,g]=n.useState(!1),{data:f,isLoading:h}=zt(o,i?s.hash:null),p=f?.files||[];return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>g(b=>!b),className:Re("flex items-start gap-3 w-full px-4 py-3 text-left active:bg-accent",i&&"bg-muted/50"),children:[e.jsx("div",{className:"flex flex-col items-center shrink-0 pt-0.5",children:e.jsx("div",{className:Re("w-2.5 h-2.5 rounded-full shrink-0",i?"bg-info":"bg-foreground/15")})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-mono text-muted-foreground shrink-0",children:s.shortHash}),e.jsx("span",{className:"text-sm text-foreground truncate flex-1",children:s.message})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:s.author}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:Fn(s.timestamp)})]})]}),e.jsx("span",{className:"text-muted-foreground shrink-0 pt-0.5",children:i?e.jsx(Me,{size:14}):e.jsx(Ee,{size:14})})]}),i&&e.jsxs("div",{className:"pl-4 border-l-2 border-border ml-[22px]",children:[s.body&&e.jsx("div",{className:"px-3 py-2 text-xs text-foreground/70 whitespace-pre-wrap leading-4",children:s.body}),h?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 text-muted-foreground",children:[e.jsx(X,{}),e.jsx("span",{className:"text-xs",children:c("Loading files...")})]}):p.length===0?e.jsx("div",{className:"px-3 py-3 text-xs text-muted-foreground",children:c("No files changed")}):e.jsx("div",{className:"divide-y divide-border/60",children:p.map(b=>e.jsx(Vn,{entry:b,workingDir:o,hash:s.hash},b.path))})]})]})}function $n({workingDir:s}){const{t:o}=B(),{data:c,isLoading:i,isError:g,fetchNextPage:f,hasNextPage:h,isFetchingNextPage:p}=Nt({queryKey:Je.git.log(s||""),queryFn:({pageParam:a=0})=>Bs.get("/git/log",{params:{workingDir:s||"",limit:String(Ye),skip:String(a)}}),initialPageParam:0,getNextPageParam:(a,I)=>a.commits.length<Ye?void 0:I.length*Ye,enabled:!!s}),b=c?.pages.flatMap(a=>a.commits)||[];return s?i?e.jsxs("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:[e.jsx(X,{size:"md",className:"mr-2"}),e.jsx("span",{className:"text-sm",children:o("Loading history...")})]}):g?e.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive-ink text-sm",children:o("Failed to load history.")}):b.length===0?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground py-16",children:[e.jsx(Us,{size:28,className:"mb-3"}),e.jsx("span",{className:"text-sm",children:o("No commit history")})]}):e.jsxs("div",{className:"flex-1 overflow-y-auto scrollbar-app-thin overscroll-y-contain",children:[e.jsx("div",{className:"divide-y divide-border/60",children:b.map(a=>e.jsx(Hn,{commit:a,workingDir:s},a.hash))}),h&&e.jsx("button",{type:"button",onClick:()=>f(),disabled:p,className:"w-full py-4 text-sm text-muted-foreground active:text-foreground/80 active:bg-accent flex items-center justify-center gap-2",children:p?e.jsxs(e.Fragment,{children:[e.jsx(X,{})," ",o("Loading...")]}):o("Load more")})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground text-sm",children:o("No workspace selected.")})}const Kn=Dt(),_n=s=>s.includes("://")||s.startsWith("/api/")?s:s.startsWith("/")?`${Kn}/attachments/by-path?path=${encodeURIComponent(s)}`:s;function Qn({status:s,summary:o}){const{t:c}=B(),i={[ue.Running]:"bg-info",[ue.Review]:"bg-warning",[ue.Pending]:"bg-muted-foreground/60",[ue.Done]:"bg-success",[ue.Cancelled]:"bg-muted-foreground/60"};return e.jsx("span",{title:o??c(s),"aria-label":o??c(s),className:`w-2.5 h-2.5 rounded-full ${i[s]}`})}const Xn=[{key:"chat",label:"Chat",icon:Hs},{key:"changes",label:"Changes",icon:es},{key:"history",label:"History",icon:Us},{key:"workspace",label:"Workspace",icon:Vs}],Yn=[{key:"chat",label:"Team room",icon:Hs},{key:"team-status",label:"Team Status",icon:Tt},{key:"changes",label:"Changes",icon:es},{key:"workspace",label:"Workspace",icon:Vs}];function Yr({task:s,onBack:o,onSelectTask:c,onCreateSubtask:i,onDeleteTask:g,onTaskPriorityChange:f,isDeleting:h,autoStartState:p,onAutoStartRecovered:b}){const{t:a}=B(),I=kt(t=>t.setVisibleContext),[C,F]=n.useState("chat"),[R,me]=n.useState(""),[$s,xe]=n.useState(!1),[Ks,Oe]=n.useState(!1),[Le,pe]=n.useState(!1),[A,De]=n.useState(null),[Y,H]=n.useState(void 0),ss=n.useRef(0),[_s,We]=n.useState(),ze=n.useRef(null),Be=n.useRef(null),Z=n.useRef(null),ts=n.useRef(null),{scrollRef:G,contentRef:ns,isAtBottom:rs,scrollToBottom:fe,stopScroll:os}=mn({resize:"smooth",initial:"instant"}),$=Ct();n.useEffect(()=>{if(!Le)return;const t=r=>{Be.current&&!Be.current.contains(r.target)&&pe(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[Le]);const{data:l,isLoading:Qs}=Tn(s.id),J=Ft(s.id),as=J?.status==="completed"&&p?.status!=="failed"?null:p,Fe=!!(as||J&&J.status!=="completed"),{data:he}=wt(s.id),{data:Xs}=It(he?.id??""),is=St(he?.id??""),m=he??null,E=s.isGitRepo!==!1&&s.worktreeReady!==!1,Ge=n.useMemo(()=>(m?Yn:Xn).filter(t=>E||t.key!=="changes"&&t.key!=="history"),[E,m]),Ys=he===null,{data:ee,isLoading:Zs}=Pt(s.id,Ys),j=!!s.projectArchivedAt,ls=!!s.projectRepoDeletedAt,qe=a(ls?"项目已删除,本地仓库文件也已清理。恢复项目并重新绑定仓库后才能继续操作。":"项目已删除。恢复项目后才能继续创建会话或修改任务。");n.useEffect(()=>{H(void 0),De(null),We(void 0)},[s.id]),n.useEffect(()=>{m&&C==="history"&&F("chat"),!m&&C==="team-status"&&F("chat"),Ge.some(t=>t.key===C)||F("chat")},[C,Ge,m]);const q=n.useMemo(()=>Gt(l,m,Y),[Y,m,l]);n.useEffect(()=>{Y&&!l?.some(t=>t.id===Y)&&H(void 0)},[Y,l]);const y=n.useMemo(()=>l?.find(t=>t.id===q),[q,l]),S=n.useMemo(()=>{if(l){if(y)return Ae(y);for(const t of l)if(t.status==="ACTIVE"&&Ae(t))return Ae(t);return Ae(l[0])}},[y,l]),T=y?.status===At.ACTIVE?y.id:void 0,Ue=E&&qt(y,m),se=y?.branchName??"",cs=y?.commitMessage,te=n.useMemo(()=>Ut(y,l,s?.mainBranch??""),[y,s?.mainBranch,l]),ne=!!(Ue&&T&&S&&!j),{data:M,isLoading:Js}=Pn(T??"",{enabled:ne}),{data:ds}=Fs(S,{enabled:ne}),et=ds?.committed?.length,re=Vt((l??[]).map(t=>t.id),!m),{pendingConflictDetails:oe}=re,us=!!oe;n.useEffect(()=>{const t=E&&(C==="changes"||C==="chat"&&ne)?"changes":E&&C==="history"?"history":null;if(!T||!S||!t){I(null);return}return I({workspaceId:T,workingDir:S,tab:t}),()=>{I(null)}},[C,E,T,I,ne,S]);const N=n.useMemo(()=>oe||(M?.conflictOp&&M.conflictedFiles.length>0?Rt({conflictOp:M.conflictOp,conflictedFiles:M.conflictedFiles,resolutionContextToken:M.resolutionContextToken,sourceWorkspaceId:T,sourceWorktreePath:y?.worktreePath,sourceBranch:se,targetBranch:te}):oe),[M,oe,T,y?.worktreePath,se,te]),ms=N?.targetWorkspaceId??T,st=N?.targetWorktreePath??y?.worktreePath,tt=N?.sourceBranch??se,nt=N?.targetBranch??te,rt=y?.sessions??[],ge=n.useCallback(t=>{const r=t??N;r&&re.openDialog(r)},[N,re]),xs=n.useCallback(()=>s?.id?$.invalidateQueries({queryKey:Je.workspaces.list(s.id)}):Promise.resolve(),[s?.id,$]),Ve=n.useCallback(async()=>$.fetchQuery({queryKey:Je.tasks.body(s.id),queryFn:()=>Bs.get(`/tasks/${s.id}/body`)}),[$,s.id]),w=n.useMemo(()=>{if(!l)return null;const t=l.filter(x=>x.status==="ACTIVE"&&Array.isArray(x.sessions)).flatMap(x=>x.sessions??[]),r=x=>{const _=x.createdAt,Q=x.endedAt??x.startedAt??_;if(!Q)return 0;const Te=Date.parse(Q);return Number.isNaN(Te)?0:Te},d=x=>{const _=t.filter(Q=>x.includes(Q.status));return _.length===0?null:_.sort((Q,Te)=>r(Te)-r(Q))[0]??null},u=d([z.RUNNING])??d([z.PENDING])??d([z.COMPLETED,z.FAILED,z.CANCELLED]);if(u)return u;const W=l.filter(x=>(x.status==="ABANDONED"||x.status==="MERGED"||x.status==="HIBERNATED")&&Array.isArray(x.sessions)).flatMap(x=>x.sessions??[]).filter(x=>[z.COMPLETED,z.FAILED,z.CANCELLED].includes(x.status));return W.length===0?null:W.sort((x,_)=>r(_)-r(x))[0]??null},[l]),v=w?.id??"",be=m?A??"":v,ot=n.useMemo(()=>{if(!A||!l)return null;for(const t of l){const r=t.sessions?.find(d=>d.id===A);if(r)return r}return null},[A,l]),He=n.useMemo(()=>{if(!A||!m?.invocations)return null;const t=m.invocations.filter(r=>r.sessionId===A);return t.length===0?null:t.sort((r,d)=>{const u=Date.parse(r.updatedAt??r.createdAt??""),P=Date.parse(d.updatedAt??d.createdAt??"");return(Number.isNaN(P)?0:P)-(Number.isNaN(u)?0:u)})[0]??null},[A,m?.invocations]),at=n.useMemo(()=>!He?.memberId||!m?.members?null:m.members.find(t=>t.id===He.memberId)??null,[He?.memberId,m?.members]),k=A?ot:w??null,O=k?.id,K=n.useMemo(()=>{if(k?.workspaceId)return k.workspaceId;if(!(!k||!l))return l.find(t=>t.sessions?.some(r=>r.id===k.id))?.id},[k,l]),ve=n.useCallback((t,r)=>{const u=(r&&l?.some(P=>P.id===r)?r:void 0)??K??q??void 0;u&&H(u),ss.current+=1,We({id:ss.current,source:t,workspaceId:u}),F("workspace")},[K,q,l]),$e=n.useCallback((t,r)=>{ve({kind:"web",url:t},r)},[ve]),Ke=n.useCallback((t,r,d)=>{ve({kind:"visualization",sessionId:t,file:r},d)},[ve]),ps=n.useCallback(t=>{$e(t,K)},[K,$e]),fs=n.useCallback(t=>{O&&Ke(O,t,K)},[O,K,Ke]),{isActive:ae,isCancelling:ie}=Nn(O??"",k?.status),it=n.useMemo(()=>!w||!l?!1:!l.some(r=>r.status==="ACTIVE"&&r.sessions?.some(d=>d.id===w.id)),[w,l]),{data:je}=Rn(),[hs,lt]=n.useState(null),ye=hs?.sessionId===v?hs.providerId:w?.providerId??null,Ne=w?vn(je,ye):void 0,ct=n.useCallback(t=>{lt({sessionId:v,providerId:t})},[v]),U=kn({agentType:w?.agentType,workingDir:S,input:R,setInput:me,textareaRef:Z,minHeight:40,maxHeight:140}),V=Ht({agentType:w?.agentType,workingDir:S,input:R,setInput:me,textareaRef:Z,minHeight:40,maxHeight:140}),ke=S&&y?y.id:void 0,L=Cn(),gs=An(),D=wn(),{isConnected:bs,isLoadingSnapshot:vs,isOutputActive:js,lastExitAt:ys,logs:le,entries:dt,attach:Ce}=gn({sessionId:be,sessionStatus:k?.status,sessionStartedAt:k?.startedAt??k?.createdAt,sessionEndedAt:k?.endedAt??(ae?null:k?.updatedAt),onExit:n.useCallback(()=>{$.invalidateQueries({queryKey:["workspaces"]})},[$])}),{todos:we}=bn(dt),{files:ut,addFiles:Ie,removeFile:mt,clear:Ns,getDoneAttachments:ks,hasFiles:ce,isUploading:Se}=jn(),xt=n.useMemo(()=>$t(k),[k?.tokenUsage]),Cs=xn(le,xt);n.useEffect(()=>{be&&bs&&Ce()},[be,bs,Ce]);const ws=n.useRef(null);n.useEffect(()=>{if(ws.current!==s.id&&G.current){const t=G.current;requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight})}ws.current=s.id},[s.id,G]);const _e=n.useRef(!1),Is=n.useCallback(async()=>{if(!R.trim()&&!ce||!v||_e.current||D.isPending||ie||Se||Ne)return;_e.current=!0;const t=ks().map(d=>d.id),r=R.trim()||(t.length?" ":"");me(""),Ns(),Z.current&&(Z.current.style.height="40px"),L.mutate({id:v,message:r,attachmentIds:t,providerId:ye??void 0},{onSuccess:()=>Ce(),onSettled:()=>{_e.current=!1}})},[R,v,L,Ce,ce,Se,ks,Ns,ye,Ne,D.isPending,ie]),pt=n.useCallback(()=>{!v||D.isPending||D.mutate(v)},[v,D]),ft=n.useCallback(t=>is.mutateAsync(t),[is]),Ss=n.useCallback(t=>{De(t),F("chat"),requestAnimationFrame(()=>{fe()})},[fe]),ht=n.useCallback(()=>{De(null)},[]),gt=n.useCallback(()=>{F("changes")},[]),Ts=ne&&T?e.jsx(Kt,{projectId:s?.projectId??"",workspaceId:T,branchName:se,targetBranch:te,commitMessage:cs,changes:ds,gitStatus:M,isGitStatusLoading:Js,canRunGitOperations:Ue,onOpenChanges:gt,onRefreshCommitMessage:xs,onConflict:ge,className:"mb-2"}):null,bt=n.useCallback(t=>{const r=t.target.files;r&&r.length>0&&Ie(Array.from(r)),t.target.value=""},[Ie]),vt=n.useCallback(t=>{const r=t.clipboardData.items,d=[];for(const u of r)if(u.kind==="file"){const P=u.getAsFile();P&&d.push(P)}d.length>0&&(t.preventDefault(),Ie(d))},[Ie]),jt=n.useCallback(t=>{me(t.target.value);const r=t.target;r.style.height="auto",r.style.height=`${Math.max(40,Math.min(r.scrollHeight,140))}px`},[]),yt=n.useCallback(()=>{ke&&gs.mutate({workspaceId:ke})},[gs,ke]),de=n.useRef(null);return n.useEffect(()=>{const t=window.visualViewport;if(!t)return;let r=!1;const d=()=>{de.current&&(de.current.style.height=`${t.height}px`,de.current.style.top=`${t.offsetTop}px`)},u=()=>d(),P=()=>{r||d()},W=()=>{r=!0},x=()=>{r=!1,requestAnimationFrame(d)};return t.addEventListener("resize",u),t.addEventListener("scroll",P),document.addEventListener("touchstart",W,{passive:!0}),document.addEventListener("touchend",x,{passive:!0}),document.addEventListener("touchcancel",x,{passive:!0}),()=>{t.removeEventListener("resize",u),t.removeEventListener("scroll",P),document.removeEventListener("touchstart",W),document.removeEventListener("touchend",x),document.removeEventListener("touchcancel",x)}},[]),n.useEffect(()=>{const t=de.current;if(!t)return;const r=d=>{let u=d.target;for(;u&&u!==t;){if(u.tagName==="TEXTAREA"){if(u.scrollHeight>u.clientHeight)return;u=u.parentElement;continue}const W=window.getComputedStyle(u).overflowY;if((W==="auto"||W==="scroll")&&u.scrollHeight>u.clientHeight)return;u=u.parentElement}d.preventDefault()};return t.addEventListener("touchmove",r,{passive:!1}),()=>t.removeEventListener("touchmove",r)},[]),e.jsxs("div",{ref:de,className:"fixed inset-x-0 top-0 flex flex-col h-dvh bg-background overflow-hidden overscroll-none",children:[!m&&e.jsx(_t,{recovery:re,onRecover:t=>{H(t.sourceWorkspaceId),ge(t)}}),e.jsxs("header",{className:"shrink-0 bg-background border-b border-border z-20",children:[e.jsxs("div",{className:"flex items-center h-11 px-2.5 gap-1.5",children:[e.jsx("button",{onClick:o,className:"p-1.5 -ml-0.5 text-foreground/70 active:text-foreground",children:e.jsx(Ps,{size:18})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(Qt,{taskId:s.id,title:s.title,readOnly:j,titleClassName:"text-[13px] font-semibold text-foreground truncate leading-tight",compact:!0}),e.jsxs("div",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground leading-tight",children:[e.jsx("span",{className:`truncate font-medium ${s.projectColor}`,children:s.projectName}),s.projectArchivedAt&&e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:s.projectRepoDeletedAt?a("源码已删除"):a("已删除")}),e.jsx("span",{className:"text-muted-foreground",children:"/"}),e.jsx("span",{className:"font-mono truncate",children:s.branch})]}),Es(s,a)&&e.jsx("p",{className:"truncate text-xs text-muted-foreground",title:Ms(s,a),children:Es(s,a)})]}),e.jsx(Qn,{status:s.status,summary:Ms(s,a)}),e.jsx(In,{value:s.priority,compact:!0,onChange:!j&&f?t=>f(s.id,t):void 0}),e.jsx("button",{onClick:yt,disabled:!ke||j,className:"p-1.5 text-muted-foreground active:text-foreground disabled:opacity-30",children:e.jsx(Sn,{size:16})}),(g||i)&&!j&&e.jsxs("div",{className:"relative",ref:Be,children:[e.jsx("button",{onClick:()=>pe(t=>!t),className:"p-1.5 text-muted-foreground active:text-foreground","aria-label":"More actions",children:e.jsx(Xt,{size:16})}),Le&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-40 bg-background rounded-lg border border-border shadow-popover z-50 py-1",children:[i&&Et(s)&&e.jsxs("button",{className:"w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-muted/50",onClick:()=>{pe(!1),i(s.id)},children:[e.jsx(En,{size:15}),e.jsx("span",{children:a("Create subtask")})]}),e.jsxs("button",{onClick:()=>{Oe(!0),pe(!1)},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-destructive-ink active:bg-destructive/10",children:[e.jsx(Mn,{size:15}),e.jsx("span",{children:a("删除任务")})]})]})]})]}),e.jsx("div",{className:"flex border-t border-border/60",children:Ge.map(({key:t,label:r,icon:d})=>e.jsxs("button",{onClick:()=>F(t),className:`flex min-w-0 flex-1 items-center justify-center gap-1 px-1 py-2 text-xs font-medium transition-colors ${C===t?"text-foreground border-b-2 border-foreground":"text-muted-foreground border-b-2 border-transparent"}`,children:[e.jsx(d,{size:13,className:"shrink-0"}),e.jsx("span",{className:"truncate",children:a(r)})]},t))})]}),C==="chat"&&(m?e.jsx("main",{className:"flex-1 min-h-0 overflow-hidden",children:A?e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-background",children:[e.jsxs("div",{className:"relative z-20 flex shrink-0 items-center justify-between gap-3 overflow-visible border-b border-border px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-xs font-semibold text-foreground",children:a("Invocation details")}),e.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:A})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(Yt,{session:k,providers:je,usage:Cs,compact:!0,providerIdFallback:at?.providerId,agentTypeFallback:k?.agentType,tokenTooltipSide:"bottom"}),e.jsxs(Qe,{type:"button",size:"xs",variant:"ghost",className:"h-7 gap-1 rounded-lg border border-border bg-background/60 px-1.5 text-xs font-medium text-muted-foreground hover:border-foreground/20 hover:bg-accent hover:text-foreground active:bg-accent",onClick:ht,children:[e.jsx(Ps,{size:12}),e.jsx("span",{children:a("Team room")})]})]})]}),e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:G,className:"h-full overflow-y-auto overflow-x-hidden scrollbar-app-thin overscroll-y-contain px-3 pt-3 pb-2",children:e.jsxs("div",{ref:ns,children:[!m&&s&&e.jsx(Rs,{taskId:s.id}),vs?e.jsx(Ze,{label:a("Loading logs...")}):le.length===0&&!v?e.jsx("div",{className:"text-muted-foreground text-center py-8 text-sm",children:a(ae?"Waiting for agent output...":"No logs recorded for this session.")}):e.jsx(Ls,{children:e.jsx(Os,{logs:le,sessionId:O,downloadSessionId:O,isOutputActive:js,lastExitAt:ys,onUserToggleDetails:os,scrollElementRef:G,onOpenPreviewUrl:ps,onOpenVisualization:fs})})]})}),!rs&&e.jsxs("button",{onClick:()=>fe(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-foreground/70 active:bg-background transition-all","aria-label":a("Scroll to bottom"),children:[e.jsx(As,{size:12}),e.jsx("span",{children:a("回到底部")})]})]}),we.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-background shrink-0 border-t border-border/60",children:e.jsx(Ds,{todos:we,compact:!0})})]}):e.jsx(Zt,{teamRun:m,messages:Xs??m.messages??[],readOnly:j,readOnlyMessage:qe,onSendMessage:ft,onViewInvocationSession:Ss,changeSummaryBar:Ts,compactComposer:!0,workingDir:S,onOpenPreviewUrl:$e,onOpenVisualization:Ke})}):e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"relative flex-1 min-h-0",children:[e.jsx("div",{ref:G,className:"h-full overflow-y-auto overflow-x-hidden scrollbar-app-thin overscroll-y-contain px-3 pt-3 pb-2",children:e.jsxs("div",{ref:ns,children:[!m&&s&&e.jsx(Rs,{taskId:s.id}),e.jsx("div",{className:"mb-3 pb-2 border-b border-border/60",children:Zs?e.jsx("p",{className:"text-[13px] text-muted-foreground italic",children:a("Loading...")}):ee?.body?e.jsx("div",{className:"text-[13px] text-muted-foreground leading-relaxed prose prose-sm max-w-none",children:e.jsx(dn,{urlTransform:_n,components:un,children:ee.body})}):e.jsx("p",{className:"text-[13px] text-muted-foreground italic",children:"No description"})}),!j&&e.jsx(Jt,{state:as,setupProgress:J,sessionStarted:!!w?.startedAt,onRetry:v&&p?.status==="failed"?async()=>{await Ve(),xe(!0)}:void 0,compact:!0},s.id),Qs?(!Fe||j)&&e.jsx(Ze,{label:"Loading..."}):v?vs?e.jsx(Ze,{label:"Loading logs..."}):le.length===0&&!v?e.jsx("div",{className:"text-muted-foreground text-center py-8 text-sm",children:ae?"Waiting for agent output...":"No logs recorded."}):e.jsx(Ls,{children:e.jsx(Os,{logs:le,sessionId:O,downloadSessionId:O,isOutputActive:js,lastExitAt:ys,onUserToggleDetails:os,scrollElementRef:G,onOpenPreviewUrl:ps,onOpenVisualization:fs})}):!Fe||p?.status==="failed"||J?.status==="failed"||j?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(!Fe||j)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-12 h-12 bg-muted/50 rounded-xl border border-border/60 flex items-center justify-center mb-4",children:e.jsx(Xe,{size:20,className:"text-muted-foreground/70 ml-0.5"})}),e.jsx("h3",{className:"text-sm font-medium text-foreground mb-1",children:a("尚未启动 Agent")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-5 max-w-[240px]",children:j?qe:a("选择一个 Agent 来执行此任务")})]}),!j&&(!p||p.status==="failed")&&e.jsxs(Qe,{onClick:async()=>{await Ve(),xe(!0)},disabled:!!(p&&p.status!=="failed"),children:[e.jsx(Xe,{size:16,className:"mr-1.5"}),p?.status==="failed"?a("重试启动 Agent"):a("启动 Agent")]})]}):null]})}),!rs&&e.jsxs("button",{onClick:()=>fe(),className:"absolute bottom-2 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1 px-2.5 py-1 bg-background/90 backdrop-blur-sm border border-border rounded-full shadow-raised text-xs text-foreground/70 active:bg-background transition-all","aria-label":"Scroll to bottom",children:[e.jsx(As,{size:12}),e.jsx("span",{children:a("回到底部")})]})]}),we.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-0.5 bg-background shrink-0 border-t border-border/60",children:e.jsx(Ds,{todos:we,compact:!0})}),j?e.jsx("div",{className:"px-3 py-2 bg-background shrink-0 border-t border-border/60",children:e.jsx("div",{className:"rounded-xl border border-border bg-muted/50 px-3 py-2 text-xs text-muted-foreground",children:qe})}):it?e.jsx("div",{className:"px-3 py-2 bg-background shrink-0 border-t border-border/60",children:e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-border bg-muted/50 px-3 py-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:a("代码已合并,以上为历史沟通记录")}),e.jsxs(Qe,{size:"sm",onClick:async()=>{await Ve(),xe(!0)},children:[e.jsx(Xe,{size:14,className:"mr-1.5"}),a("启动新 Agent")]})]})}):v&&e.jsxs("div",{className:"px-3 py-2 bg-background shrink-0 border-t border-border/60",children:[Ts,e.jsx(pn,{sessionId:be||v,compact:!0}),e.jsxs("div",{ref:ze,className:"relative bg-background rounded-xl border border-border shadow-raised focus-within:border-ring",children:[e.jsx(yn,{files:ut,onRemove:mt}),e.jsx("textarea",{ref:Z,value:R,onChange:jt,onPaste:vt,onKeyDown:t=>{V.handleKeyDown(t)||U.handleKeyDown(t)||t.key==="Enter"&&!t.shiftKey&&!t.repeat&&!t.nativeEvent.isComposing&&t.nativeEvent.keyCode!==229&&(t.preventDefault(),Is())},rows:1,placeholder:ae?"Message Agent...":"Continue conversation...",className:"w-full px-3 pt-2.5 pb-1 bg-transparent border-none focus:outline-none resize-none text-[15px] text-foreground placeholder:text-muted-foreground/70",style:{minHeight:40,maxHeight:140}}),e.jsx("input",{ref:ts,type:"file",multiple:!0,className:"hidden",onChange:bt}),e.jsxs("div",{className:"flex items-center justify-between px-2 pb-1.5",children:[e.jsx("div",{className:"flex items-center gap-0.5",children:e.jsx("button",{onClick:()=>ts.current?.click(),className:"p-1 text-muted-foreground active:text-foreground/70 rounded-lg",children:e.jsx(On,{size:15})})}),e.jsxs("div",{className:"flex items-center gap-1",children:[w&&je&&e.jsx(fn,{providers:je,currentProviderId:ye,agentType:w.agentType,runtimeType:w.runtimeType,onSelect:ct}),e.jsx(hn,{usage:Cs}),ae&&!L.isPending&&!R.trim()&&!ce?e.jsx("button",{onClick:pt,disabled:D.isPending||ie,"aria-label":a("Stop"),className:"p-1.5 rounded-lg bg-destructive-ink text-white active:bg-destructive-ink/90 disabled:opacity-50",children:e.jsx(Mt,{size:12})}):e.jsx("button",{onClick:Is,"aria-label":a(L.isPending?"发送中...":"Send"),"aria-busy":L.isPending,disabled:!R.trim()&&!ce||Se||L.isPending||D.isPending||ie||!!Ne,className:`p-1.5 rounded-lg transition-colors ${(R.trim()||ce)&&!Se&&!L.isPending&&!D.isPending&&!ie&&!Ne?"bg-primary text-primary-foreground active:bg-primary":"bg-transparent text-muted-foreground"}`,children:L.isPending?e.jsx(Ot,{size:15,className:"animate-spin"}):e.jsx(Lt,{size:15})})]})]})]}),e.jsx(Ws,{open:U.query!==null,anchorRef:ze,commands:U.filteredCommands,selectedIndex:U.selectedIndex,query:U.query??"",hasCatalog:U.allCommands.length>0,compact:!0,onSelect:U.applyCommand}),e.jsx(Ws,{open:V.query!==null,anchorRef:ze,commands:V.filteredSkills,selectedIndex:V.selectedIndex,query:V.query??"",hasCatalog:V.allSkills.length>0,title:"Skills",queryPrefix:"$",emptyCatalogMessage:"No skills catalog for this agent yet.",compact:!0,onSelect:V.applySkill})]})]})),C==="team-status"&&m&&e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:e.jsx(en,{teamRun:m,workspaces:l,selectedWorkspaceId:q,onSelectWorkspace:H,onViewInvocationSession:Ss})}),C==="changes"&&E&&e.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[l&&l.length>1&&e.jsx("div",{className:"shrink-0 border-b border-border/60 bg-background px-3 py-2",children:e.jsx(sn,{workspaces:l,teamRun:m,selectedWorkspaceId:q,onSelectWorkspace:H,className:"w-full",buttonClassName:"w-full max-w-none min-w-0 justify-start"})}),Ue&&T&&e.jsx("div",{className:"shrink-0",children:e.jsx(tn,{projectId:s.projectId,workspaceId:T,branchName:se,targetBranch:te,commitMessage:cs,committedFileCount:et,onRefreshCommitMessage:xs,onConflict:ge,onResolveConflicts:()=>ge()})}),e.jsx(Bn,{workingDir:S})]}),C==="history"&&e.jsx("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:e.jsx($n,{workingDir:S})}),C==="workspace"&&e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(nn,{handoff:e.jsx(on,{taskId:s.id,readOnly:j},s.id),subtasks:e.jsx(rn,{task:s,onSelectTask:c,onCreateSubtask:i},s.id),sessionId:v||void 0,workspaceId:q,workingDir:S,projectId:s.projectId,className:"h-full",hideChanges:!0,gitAvailable:E,readOnly:j,repoDeleted:ls,previewRequest:_s,onPreviewRequestHandled:t=>{We(r=>r?.id===t?void 0:r)}})}),!j&&e.jsx(an,{isOpen:$s,onClose:()=>xe(!1),taskId:s.id,projectId:s.projectId,taskTitle:ee?.title??s.title,taskDescription:ee?.body??"",taskPrompt:ee?.prompt,projectIsGitRepo:s.isGitRepo,projectWorktreeReady:s.worktreeReady,projectGitReason:s.reason,onStarted:()=>b?.(s.id)}),e.jsx(cn,{isOpen:Ks,onClose:()=>Oe(!1),onConfirm:t=>{g?.(s.id,t),Oe(!1)},taskId:s.id,taskTitle:s.title,workspaces:l,isLoading:h}),us&&N&&ms&&e.jsx(ln,{open:us,onOpenChange:t=>{t||re.closeDialog()},workspaceId:ms,conflictOp:N.conflictOp,conflictedFiles:N.conflictedFiles,resolutionContextToken:N.resolutionContextToken,sourceBranch:tt,targetBranch:nt,operation:M?.operation,worktreePath:st,mergeAborted:N.mergeAborted,mergeStrategy:N.mergeStrategy,sourceWorkspaceId:N.sourceWorkspaceId,targetWorkspaceId:N.targetWorkspaceId,sourceWorktreePath:N.sourceWorktreePath,targetWorktreePath:N.targetWorktreePath,sessions:rt,currentSessionId:m?void 0:v,teamRunId:m?.id})]})}function Ze({label:s}){return e.jsxs("div",{className:"flex items-center justify-center py-12 gap-3 text-muted-foreground",children:[e.jsxs("svg",{className:"animate-spin motion-reduce:[animation-duration:2.4s] h-5 w-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),e.jsx("span",{className:"text-sm",children:s})]})}export{Yr as MobileTaskDetail};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as P,o as E,n as k,q as v,p as h,u as R,r as o,j as e,S as g,a7 as B,h as q,i as j,a8 as W,I as d,B as z,a3 as L,a9 as A,a4 as K,k as M,aa as Q}from"./index-
|
|
1
|
+
import{m as P,o as E,n as k,q as v,p as h,u as R,r as o,j as e,S as g,a7 as B,h as q,i as j,a8 as W,I as d,B as z,a3 as L,a9 as A,a4 as K,k as M,aa as Q}from"./index-BszkzNS4.js";import{S as O}from"./select-DqB7YF38.js";import{S as D}from"./toggles-C4LmZwyo.js";import{M as H}from"./message-square-DykJ2lWP.js";import{L as G}from"./link-jWQOSQOQ.js";import"./select-Bg7NI8i0.js";import"./menu-styles-DWynpVVz.js";import"./chevron-down-Ct7FZbKm.js";import"./check-yNWhPvMH.js";import"./index-GuczxPxb.js";import"./index-BPqjxXmH.js";import"./index-lZLy5rkr.js";import"./index-BMcLxIvZ.js";import"./index-DkSPjZm4.js";import"./index-DuM6iAxG.js";function J(){return P({queryKey:v.notifications.settings,queryFn:()=>h.get("/notifications/settings")})}function V(){const t=E();return k({mutationFn:a=>h.put("/notifications/settings",a),onSuccess:()=>{t.invalidateQueries({queryKey:v.notifications.settings})}})}function X(){return k({mutationFn:t=>h.post("/notifications/test",t)})}function me(){const{t}=R(),{data:a,isLoading:T}=J(),l=V(),n=X(),N=[{value:"none",label:t("关闭")},{value:"feishu",label:t("飞书 Webhook")}],[i,p]=o.useState({webhookUrl:"",baseUrl:"",titleTemplate:"",bodyTemplate:""}),[m,x]=o.useState(!1),[f,r]=o.useState("idle"),u=o.useRef(void 0);if(o.useEffect(()=>{a&&!m&&p({webhookUrl:a.feishuWebhookUrl??"",baseUrl:a.thirdPartyBaseUrl??"",titleTemplate:a.taskInReviewTitleTemplate??"",bodyTemplate:a.taskInReviewBodyTemplate??""})},[a,m]),o.useEffect(()=>(n.isSuccess?(r("success"),u.current=setTimeout(()=>r("idle"),3e3)):n.isError&&(r("error"),u.current=setTimeout(()=>r("idle"),5e3)),()=>clearTimeout(u.current)),[n.isSuccess,n.isError]),T)return e.jsx(g,{children:e.jsx(B,{rows:3})});const y=a?.osNotificationEnabled??!0,b=a?.thirdPartyChannel??"none",c=(s,I)=>{p(F=>({...F,[s]:I})),x(!0)},S=s=>{l.mutate({osNotificationEnabled:s})},C=s=>{l.mutate({thirdPartyChannel:s})},U=()=>{l.mutate({feishuWebhookUrl:i.webhookUrl.trim()||null,thirdPartyBaseUrl:i.baseUrl.trim()||null,taskInReviewTitleTemplate:i.titleTemplate.trim()||"Agent Tower",taskInReviewBodyTemplate:i.bodyTemplate.trim()||t('✅ "{taskTitle}" 已完成,等待审查')},{onSuccess:()=>x(!1)})},w=()=>{i.webhookUrl.trim()&&n.mutate({channel:"feishu",webhookUrl:i.webhookUrl.trim(),baseUrl:i.baseUrl.trim()||void 0})};return e.jsxs(g,{children:[e.jsx(q,{title:t("通知设置"),className:"mb-1"}),e.jsxs("div",{className:"divide-y divide-border/60",children:[e.jsx(j,{icon:W,label:t("桌面通知"),description:t("任务完成时弹出系统通知"),align:"center",controlWidth:"auto",children:e.jsx(D,{checked:y,onCheckedChange:S,"aria-label":t("桌面通知")})}),e.jsxs("div",{className:"py-5",children:[e.jsx(j,{icon:H,label:t("第三方通知"),description:t("推送到外部渠道(飞书群机器人等)"),align:"center",className:"py-0",children:e.jsx(O,{value:b,onChange:s=>C(s),options:N})}),b==="feishu"&&e.jsxs("div",{className:"mt-4 space-y-4 sm:pl-11",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-webhook-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:"Webhook URL"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{id:"feishu-webhook-url",value:i.webhookUrl,onChange:s=>c("webhookUrl",s.target.value),placeholder:"https://open.feishu.cn/open-apis/bot/v2/hook/...",className:"min-w-0 flex-1 font-mono"}),e.jsxs(z,{size:"sm",variant:"outline",onClick:w,disabled:!i.webhookUrl.trim()||n.isPending,className:"h-auto shrink-0",children:[n.isPending&&e.jsx(L,{size:12,className:"mr-1 animate-spin motion-reduce:animate-none"}),t("测试")]})]}),f==="success"&&e.jsxs("div",{role:"status",className:"mt-2 flex items-center gap-1.5 text-xs text-success-ink",children:[e.jsx(A,{size:12,"aria-hidden":"true"}),t("测试消息发送成功")]}),f==="error"&&e.jsxs("div",{role:"alert",className:"mt-2 flex items-center gap-1.5 text-xs text-destructive-ink",children:[e.jsx(K,{size:12,"aria-hidden":"true"}),t("发送失败,请检查 Webhook 地址")]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"feishu-base-url",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(G,{size:11,"aria-hidden":"true"}),t("跳转地址")]})}),e.jsx(d,{id:"feishu-base-url",value:i.baseUrl,onChange:s=>c("baseUrl",s.target.value),placeholder:"http://localhost:5173",className:"font-mono"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t('通知卡片中的"查看任务"按钮跳转地址前缀')})]})]})]}),e.jsxs("div",{className:"py-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx(M,{children:t("通知模板")}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("支持变量: {taskTitle}, {taskId}, {projectId}, {projectName}, {status}",{taskTitle:"{taskTitle}",taskId:"{taskId}",projectId:"{projectId}",projectName:"{projectName}",status:"{status}"})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-title-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("标题")}),e.jsx(d,{id:"notification-title-template",value:i.titleTemplate,onChange:s=>c("titleTemplate",s.target.value),placeholder:"Agent Tower"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"notification-body-template",className:"mb-1.5 block text-xs font-medium text-muted-foreground",children:t("内容")}),e.jsx(d,{id:"notification-body-template",value:i.bodyTemplate,onChange:s=>c("bodyTemplate",s.target.value),placeholder:t('✅ "{taskTitle}" 已完成,等待审查')})]})]})]})]}),m&&e.jsx(Q,{saving:l.isPending,onSave:U})]})}export{me as NotificationSettingsPage};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{u as T,r as g,j as e,S,h as J,E as F,F as w,I as G,B as E,G as p,l as P}from"./index-
|
|
1
|
+
import{u as T,r as g,j as e,S,h as J,E as F,F as w,I as G,B as E,G as p,l as P}from"./index-BszkzNS4.js";import{u as M,a as U,b as _,c as z}from"./use-profiles-TkoP4Yw9.js";import{M as B}from"./modal-BwOwTzij.js";import{C as $}from"./confirm-dialog-CCjHVFTv.js";import{T as R}from"./textarea-BCY2J2ca.js";import{L as H}from"./layers-BH_LL4b8.js";import{C as q}from"./chevron-down-Ct7FZbKm.js";import{P as K,T as Q}from"./trash-2-BEOQ1ICJ.js";import{P as W}from"./pencil-BQ5_raiB.js";import"./dialog-DV4wfpNU.js";import"./index-BPqjxXmH.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-xs 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-xs 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-xs font-semibold",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-xs font-medium text-muted-foreground",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 ue(){const{t}=T(),{data:a,isLoading:m}=M(),{data:c}=U(),h=_(),j=z(),[n,r]=g.useState(null),[b,u]=g.useState(""),[i,x]=g.useState(""),[f,v]=g.useState(""),[o,N]=g.useState(null),k=(s,l,d)=>{r({agentType:s,variant:l,config:d,isNew:!1}),x(l),u(JSON.stringify(d,null,2)),v("")},O=s=>{r({agentType:s,variant:"",config:{},isNew:!0}),x(""),u(`{
|
|
2
2
|
|
|
3
3
|
}`),v("")},D=()=>{if(!(!n||!i.trim()))try{const s=JSON.parse(b);v(""),h.mutate({agentType:n.agentType,variant:i.trim().toUpperCase(),config:s},{onSuccess:()=>r(null)})}catch{v(t("JSON 格式错误"))}},L=(s,l)=>{N({agentType:s,variant:l})},A=()=>{o&&j.mutate({agentType:o.agentType,variant:o.variant},{onSettled:()=>N(null)})},I=(s,l)=>!!c?.executors[s]?.[l];if(m)return e.jsx(S,{children:e.jsx(Z,{})});const C=a?.executors??{};return e.jsxs(S,{children:[e.jsx(J,{title:t("Profile 配置"),description:t("管理 Agent 执行器的配置变体。每个变体定义一组运行参数。"),className:"mb-4"}),e.jsx("div",{className:"space-y-3",children:Object.entries(C).map(([s,l])=>e.jsx(Y,{agentType:s,variants:l,isBuiltIn:d=>I(s,d),onEdit:(d,V)=>k(s,d,V),onNew:()=>O(s),onDelete:d=>L(s,d)},s))}),Object.keys(C).length===0&&e.jsx(F,{icon:H,message:t("暂无 Profile 配置")}),e.jsx(B,{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(G,{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-ink",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{ue as ProfileSettingsPage};
|