@xopcai/xopc 0.0.476 → 0.0.477

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/dist/browser-ext/dist/assets/{auth-CKIyOA1a.js → auth-B658Oa_i.js} +2 -1
  2. package/dist/browser-ext/dist/background.js +1 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/dingtalk/xopc.extension.json +10 -4
  7. package/dist/extensions/discord/xopc.extension.json +9 -3
  8. package/dist/extensions/slack/xopc.extension.json +10 -4
  9. package/dist/extensions/telegram/xopc.extension.json +1 -1
  10. package/dist/extensions/wecom/xopc.extension.json +10 -4
  11. package/dist/gateway/server/chunks.bin +739 -686
  12. package/dist/gateway/server/chunks.json +1 -1
  13. package/dist/gateway/static/root/assets/af-CYmDZ4fF-CZxsvT2y.js +1 -0
  14. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-Bicuh10_.js → agent-defaults-settings-panel-rc9N1-Xr.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agent-plugin-dialog-hRZYhcLp.js → agent-plugin-dialog-D8zi6y5l.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agents-C2DH8M4z.js → agents-D3Kx5DCA.js} +3 -3
  17. package/dist/gateway/static/root/assets/{app-management-settings-panel-BrO0gY6b.js → app-management-settings-panel-CGIFJmRj.js} +1 -1
  18. package/dist/gateway/static/root/assets/{appearance-settings-h82Or0g-.js → appearance-settings-CNy2QkvT.js} +1 -1
  19. package/dist/gateway/static/root/assets/{apps-page-B9Ho8S53.js → apps-page-BWSZCO1g.js} +1 -1
  20. package/dist/gateway/static/root/assets/as-Hwl1DGzz-F6qyW8uH.js +1 -0
  21. package/dist/gateway/static/root/assets/{automation-run-list-CLjSIujK.js → automation-run-list-BzKslhcr.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automation-task-card-BS-RT312.js → automation-task-card-f5_tNbzB.js} +2 -2
  23. package/dist/gateway/static/root/assets/{automations-page-BL6ASYrU.js → automations-page-DT6lvXDX.js} +1 -1
  24. package/dist/gateway/static/root/assets/{automations-workspace-BFk-AF43.js → automations-workspace-uq7eZeoX.js} +4 -4
  25. package/dist/gateway/static/root/assets/be-BgqsjH7X-BYVdQd18.js +1 -0
  26. package/dist/gateway/static/root/assets/bg-Dr9AqrKw-B5xv6TfF.js +1 -0
  27. package/dist/gateway/static/root/assets/{block-editor-Dtz8JtrO.js → block-editor-BIAtRF39.js} +1 -1
  28. package/dist/gateway/static/root/assets/bn-CSXZX5iN-BGS6_hxH.js +1 -0
  29. package/dist/gateway/static/root/assets/{browser-settings-page-CDUHHu0n.js → browser-settings-page-C2Jx09LX.js} +3 -3
  30. package/dist/gateway/static/root/assets/{button-ChmVQg9O.js → button-C5tRaJxt.js} +1 -1
  31. package/dist/gateway/static/root/assets/ca-IXHA7IHe-DrduLk3W.js +1 -0
  32. package/dist/gateway/static/root/assets/capabilities-page-DgQ9OosE.js +2 -0
  33. package/dist/gateway/static/root/assets/{capabilities-settings-panel-ComYXaP1.js → capabilities-settings-panel-BjiHKpmd.js} +2 -2
  34. package/dist/gateway/static/root/assets/{capability-header-actions-BfLcB3Kh.js → capability-header-actions-Ck3ILShB.js} +1 -1
  35. package/dist/gateway/static/root/assets/{channels-Aa2Iun4r.js → channels-C9AQ0m77.js} +1 -1
  36. package/dist/gateway/static/root/assets/{chat-chart-block-DA2S21y2.js → chat-chart-block-BNmGrz2N.js} +1 -1
  37. package/dist/gateway/static/root/assets/chat-page-CJiXMjMM.js +72 -0
  38. package/dist/gateway/static/root/assets/{chat-terminal-dock-BALrP7_l.js → chat-terminal-dock-Bndihzyb.js} +1 -1
  39. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BPb7KheU.js → chunk-KS7C4IRE-DbzE-1bp.js} +1 -1
  40. package/dist/gateway/static/root/assets/composer-attachment-handoff-LTJZHQTE.js +1 -0
  41. package/dist/gateway/static/root/assets/{composer-model-config-control-BFC8jNyK.js → composer-model-config-control-Bnx68cDQ.js} +1 -1
  42. package/dist/gateway/static/root/assets/{computer-settings-page-CVWaJ3L8.js → computer-settings-page-MMiCgCEw.js} +1 -1
  43. package/dist/gateway/static/root/assets/{confirm-dialog-DkviAS5j.js → confirm-dialog-MHCmEEUZ.js} +1 -1
  44. package/dist/gateway/static/root/assets/{connected-providers-grid-NZP4qb6S.js → connected-providers-grid-BPydj2zS.js} +1 -1
  45. package/dist/gateway/static/root/assets/{connection-usage-guide-BNoFtMol.js → connection-usage-guide-CHGPjgHg.js} +1 -1
  46. package/dist/gateway/static/root/assets/{connector-service-page-CzrdJ4JY.js → connector-service-page-CjH7WEIw.js} +1 -1
  47. package/dist/gateway/static/root/assets/{connectors-page-BUqNvStL.js → connectors-page-aIaFZHw3.js} +1 -1
  48. package/dist/gateway/static/root/assets/cop-B5tK6J-Z-Dw82IjCr.js +1 -0
  49. package/dist/gateway/static/root/assets/{copy-text-row-BnSoJ0FX.js → copy-text-row-gqdh0Bg1.js} +1 -1
  50. package/dist/gateway/static/root/assets/cs-5GDhZ_Ce-BI5q4aVA.js +1 -0
  51. package/dist/gateway/static/root/assets/cu-BSm1hoGS-BRCy0UAr.js +1 -0
  52. package/dist/gateway/static/root/assets/cy-C9DIxPZF-Cag4snSk.js +1 -0
  53. package/dist/gateway/static/root/assets/da-BsG0TGcE-BWliw5hZ.js +1 -0
  54. package/dist/gateway/static/root/assets/{date-picker-DgTDENzF.js → date-picker-BWrSxZf1.js} +1 -1
  55. package/dist/gateway/static/root/assets/{date-time-picker-Gw4oSOk9.js → date-time-picker-Zhl9Yyzk.js} +1 -1
  56. package/dist/gateway/static/root/assets/de-1901-qqf2iWLB-BlgpCKr2.js +1 -0
  57. package/dist/gateway/static/root/assets/de-1996-LtGglqob-BjfWxQKM.js +1 -0
  58. package/dist/gateway/static/root/assets/de-ch-1901-COn1CKDv-_Xg3_np3.js +1 -0
  59. package/dist/gateway/static/root/assets/{dependency-picker-BJDpQtKY.js → dependency-picker-clYjcOx9.js} +1 -1
  60. package/dist/gateway/static/root/assets/{desktop-pet-BbIPYbvc.js → desktop-pet-CGRfEFeD.js} +1 -1
  61. package/dist/gateway/static/root/assets/{desktop-pet-settings-Cqzplufb.js → desktop-pet-settings-CUVZPqVA.js} +1 -1
  62. package/dist/gateway/static/root/assets/{device-pairing-wizard-DXFZiWMi.js → device-pairing-wizard-C62Ooz-T.js} +1 -1
  63. package/dist/gateway/static/root/assets/{directory-picker-path-field-DVFEzTAJ.js → directory-picker-path-field-3z5dHj8K.js} +1 -1
  64. package/dist/gateway/static/root/assets/{dist-GJ8-1PAx.js → dist-BSVQC3i_.js} +1 -1
  65. package/dist/gateway/static/root/assets/{dist-CxGUk8J-.js → dist-CDSvxjOh.js} +1 -1
  66. package/dist/gateway/static/root/assets/dist-DSRLZhL9.js +1 -0
  67. package/dist/gateway/static/root/assets/dist-DaFr5KMw.js +1 -0
  68. package/dist/gateway/static/root/assets/{dist-CY7CS_D3.js → dist-DlirbHVs.js} +1 -1
  69. package/dist/gateway/static/root/assets/el-monoton-pORtlC9P-CuqNQIvE.js +1 -0
  70. package/dist/gateway/static/root/assets/el-polyton-CDXn9JCY-B5J5pGHR.js +1 -0
  71. package/dist/gateway/static/root/assets/en-gb-BGHhUzDC-COWGBqwJ.js +1 -0
  72. package/dist/gateway/static/root/assets/es-PSvYPNjB-CnHE1eri.js +1 -0
  73. package/dist/gateway/static/root/assets/es2015-CFqg57eW.js +41 -0
  74. package/dist/gateway/static/root/assets/et-CYUTaVWy-H7jVbiHv.js +1 -0
  75. package/dist/gateway/static/root/assets/eu-CRNA9JLT-D1jw9zt8.js +1 -0
  76. package/dist/gateway/static/root/assets/{extension-authoritative-grants-DAfeCx4B.js → extension-authoritative-grants-DIZxVVMM.js} +1 -1
  77. package/dist/gateway/static/root/assets/{extension-debug-page-gW4GEEcj.js → extension-debug-page-D_-TPLjn.js} +1 -1
  78. package/dist/gateway/static/root/assets/{extension-iframe-host-DOPywUKI.js → extension-iframe-host-DQOKplxT.js} +1 -1
  79. package/dist/gateway/static/root/assets/{extension-message-router-TTAx3dPv.js → extension-message-router-Ccwjadyk.js} +1 -1
  80. package/dist/gateway/static/root/assets/{extension-page-Iq7vFC-g.js → extension-page-CmntX-Iw.js} +1 -1
  81. package/dist/gateway/static/root/assets/{extension-provider-BNnLkq95.js → extension-provider-niliLEmM.js} +1 -1
  82. package/dist/gateway/static/root/assets/{extension-settings-page-C0oLjaz6.js → extension-settings-page-Doi9Trxg.js} +1 -1
  83. package/dist/gateway/static/root/assets/fi-DNiE_U0X-mParSSSy.js +1 -0
  84. package/dist/gateway/static/root/assets/{floating-ui.dom-seOukHzT.js → floating-ui.dom-CiMnRY5O.js} +1 -1
  85. package/dist/gateway/static/root/assets/floating-ui.react-dom-Gx6CM22l.js +1 -0
  86. package/dist/gateway/static/root/assets/fr-BIgh4Hkw-Dc1KqFHa.js +1 -0
  87. package/dist/gateway/static/root/assets/fur-CoXvgQfx-tJv2icDr.js +1 -0
  88. package/dist/gateway/static/root/assets/ga-D54K6YtG-CDuqe3gr.js +1 -0
  89. package/dist/gateway/static/root/assets/{gateway-realtime-CfceJ5WX.js → gateway-realtime-BoJ3r2zr.js} +1 -1
  90. package/dist/gateway/static/root/assets/{gateway-restart-Dsg95Dwt.js → gateway-restart-L0ri15AO.js} +1 -1
  91. package/dist/gateway/static/root/assets/{gateway-settings-CMgry8RK.js → gateway-settings--jcl4PYh.js} +1 -1
  92. package/dist/gateway/static/root/assets/gl-Cx_3wrqA-D9_oxkqv.js +1 -0
  93. package/dist/gateway/static/root/assets/grc-gFF6GbE6-DANBReIg.js +1 -0
  94. package/dist/gateway/static/root/assets/gu-9bPoO3RA-COW9d1dt.js +1 -0
  95. package/dist/gateway/static/root/assets/hi-GilZHMjg-CiihDo6Q.js +1 -0
  96. package/dist/gateway/static/root/assets/{home-page-pT-lEQsu.js → home-page-DbLvAmzw.js} +4 -4
  97. package/dist/gateway/static/root/assets/hr-DowcKODH-D_vEJhf2.js +1 -0
  98. package/dist/gateway/static/root/assets/hsb-D_AuBPC_-kb5QeNH1.js +1 -0
  99. package/dist/gateway/static/root/assets/hu-DghCDVxq-Ct1fysVO.js +1 -0
  100. package/dist/gateway/static/root/assets/hy-UUaeTG5g-Cjfrs2ZM.js +1 -0
  101. package/dist/gateway/static/root/assets/ia-CvHYTdA2-B1i9kDPT.js +1 -0
  102. package/dist/gateway/static/root/assets/id-Dpxs7amD-C3Hzl2m4.js +1 -0
  103. package/dist/gateway/static/root/assets/{image-generation-api-DDHOD0Nx.js → image-generation-api-D63Vak-S.js} +1 -1
  104. package/dist/gateway/static/root/assets/{imports-page-BxRXNvQx.js → imports-page-CWr0KA9K.js} +1 -1
  105. package/dist/gateway/static/root/assets/index-CEXEV_TY.css +1 -0
  106. package/dist/gateway/static/root/assets/{index-DdEh8KeB.js → index-DynjhZRv.js} +7 -7
  107. package/dist/gateway/static/root/assets/{install-connector-dialog-Rox2_5eU.js → install-connector-dialog-DyscHGNB.js} +1 -1
  108. package/dist/gateway/static/root/assets/is-CJ1vxS9j-DWEBuJpb.js +1 -0
  109. package/dist/gateway/static/root/assets/it-CpWMQzhA-HiFRunf5.js +1 -0
  110. package/dist/gateway/static/root/assets/ka-CCxCVfU6-BU45urC7.js +1 -0
  111. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D7xlV7xT.js → keyboard-shortcuts-settings-BNxKXzTr.js} +1 -1
  112. package/dist/gateway/static/root/assets/kmr-dEjewOAw-DfPyPgkK.js +1 -0
  113. package/dist/gateway/static/root/assets/kn-Bjy8QS2v-BuXzi7S-.js +1 -0
  114. package/dist/gateway/static/root/assets/la-AGdXyFmb-Bwiuou7l.js +1 -0
  115. package/dist/gateway/static/root/assets/la-x-classic-DcM9aTVI-aO_2QO0y.js +1 -0
  116. package/dist/gateway/static/root/assets/la-x-liturgic-DZCmbwFj-BpDOy20C.js +1 -0
  117. package/dist/gateway/static/root/assets/{local-app-workbench-page-ReBczGac.js → local-app-workbench-page-BB-y__CE.js} +1 -1
  118. package/dist/gateway/static/root/assets/{local-apps-page-Ct07GT0V.js → local-apps-page-kllqJoU6.js} +1 -1
  119. package/dist/gateway/static/root/assets/{logs-page-CtEv5J4C.js → logs-page-DALkj_7O.js} +1 -1
  120. package/dist/gateway/static/root/assets/lt-CN8ITi7t-B3cgXplB.js +1 -0
  121. package/dist/gateway/static/root/assets/lv-C-JuXj31-CLjYDJHB.js +1 -0
  122. package/dist/gateway/static/root/assets/{management-settings-BjvQ4WiZ.js → management-settings-DVjgxWhD.js} +1 -1
  123. package/dist/gateway/static/root/assets/{markdown-view-C7kqotD-.js → markdown-view-BpBBv9Gr.js} +2 -2
  124. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DfbMmlmC.js → mcp-conversation-setup-page-Cr7uXvcG.js} +1 -1
  125. package/dist/gateway/static/root/assets/ml-BM2UBzMU-Ct0js8Am.js +1 -0
  126. package/dist/gateway/static/root/assets/mn-cyrl-CyRDZzA3-DN6sz9R4.js +1 -0
  127. package/dist/gateway/static/root/assets/mn-cyrl-x-lmc-DbCWj2Po-BJqn49ay.js +1 -0
  128. package/dist/gateway/static/root/assets/{model-selector-BP-t33vd.js → model-selector-RNPw-Mz4.js} +1 -1
  129. package/dist/gateway/static/root/assets/mr-BrkCTYf9-DGtESPcG.js +1 -0
  130. package/dist/gateway/static/root/assets/mul-ethi-D9YZ9OXl-D6ioGuYP.js +1 -0
  131. package/dist/gateway/static/root/assets/nb-DgKeJnSd-BfDSp4tN.js +1 -0
  132. package/dist/gateway/static/root/assets/{new-chat-navigation-BA1IB3hy.js → new-chat-navigation-DM_HUSZ1.js} +1 -1
  133. package/dist/gateway/static/root/assets/nl-BIDJBXRA-8_OIBsy0.js +1 -0
  134. package/dist/gateway/static/root/assets/nn-C4Gas4NI-BWT83oy8.js +1 -0
  135. package/dist/gateway/static/root/assets/no-CSP8-4c2-Cjg1mxae.js +1 -0
  136. package/dist/gateway/static/root/assets/{note-detail-panel-DAhIT6xP.js → note-detail-panel-DQOIB0cU.js} +3 -3
  137. package/dist/gateway/static/root/assets/note-image-lightbox-BQyXXJCE.js +1 -0
  138. package/dist/gateway/static/root/assets/{notes-api-B3Kc4909.js → notes-api-ChV_6O5I.js} +1 -1
  139. package/dist/gateway/static/root/assets/notes-page-BBUD12wy.js +8 -0
  140. package/dist/gateway/static/root/assets/{oauth-provider-connect-3QGibJMl.js → oauth-provider-connect-BgWyUbhu.js} +1 -1
  141. package/dist/gateway/static/root/assets/oc-CyJ2Q9k9-W5_I63nO.js +1 -0
  142. package/dist/gateway/static/root/assets/or-DUhKxVse-Cf5-bcl5.js +1 -0
  143. package/dist/gateway/static/root/assets/pa-NDvVySYt-Bj-XExX_.js +1 -0
  144. package/dist/gateway/static/root/assets/{page-context-capture-button-Bd__UBi9.js → page-context-capture-button-CNyjLpFG.js} +1 -1
  145. package/dist/gateway/static/root/assets/{personal-page-DHik8uj6.js → personal-page-dGPy_J7M.js} +1 -1
  146. package/dist/gateway/static/root/assets/{personal-profile-settings-Cd2xUVbw.js → personal-profile-settings-BlsS-2z3.js} +1 -1
  147. package/dist/gateway/static/root/assets/{personal-settings-panel-CHRra9hc.js → personal-settings-panel-D1W09VMR.js} +1 -1
  148. package/dist/gateway/static/root/assets/{phone-dependencies-card-CREmmRxI.js → phone-dependencies-card-CRABVjt1.js} +1 -1
  149. package/dist/gateway/static/root/assets/{phone-model-connection-BDzr9jXL.js → phone-model-connection-DtBRZXUN.js} +1 -1
  150. package/dist/gateway/static/root/assets/{phone-model-picker-DSQF-RxW.js → phone-model-picker-D3U9iAQo.js} +1 -1
  151. package/dist/gateway/static/root/assets/{phone-settings-page-gP5kr3VO.js → phone-settings-page-ClS7YSnU.js} +1 -1
  152. package/dist/gateway/static/root/assets/pi-znB0BT6g-o9084kBf.js +1 -0
  153. package/dist/gateway/static/root/assets/pl-CaFvP4tu-Bv_p-a9x.js +1 -0
  154. package/dist/gateway/static/root/assets/{plugin-details-dialog-43jCnG5n.js → plugin-details-dialog-DGW2QQJC.js} +1 -1
  155. package/dist/gateway/static/root/assets/pms-92V70vZ4-DfOt2RSi.js +1 -0
  156. package/dist/gateway/static/root/assets/{popover-select-CLsphyzA.js → popover-select-hRG1EzAY.js} +1 -1
  157. package/dist/gateway/static/root/assets/{preference-select-fields-VqtR_pOy.js → preference-select-fields-PZsYT8Db.js} +1 -1
  158. package/dist/gateway/static/root/assets/{preview-runtime-MJUo7XlD.js → preview-runtime-D9y0frrZ.js} +2 -2
  159. package/dist/gateway/static/root/assets/{product-automation-feedback-D43XiQq6.js → product-automation-feedback-W6rFx449.js} +1 -1
  160. package/dist/gateway/static/root/assets/product-open-page-CcJ0dC84.js +1 -0
  161. package/dist/gateway/static/root/assets/{product-preview-content-CkQebfi-.js → product-preview-content-CsdXwIxP.js} +1 -1
  162. package/dist/gateway/static/root/assets/product-preview-modal-CIe5WW9E.js +2 -0
  163. package/dist/gateway/static/root/assets/{project-detail-page-BBF8eVJa.js → project-detail-page-b6pU7eLQ.js} +2 -2
  164. package/dist/gateway/static/root/assets/{project-understanding-BScfv1pD.js → project-understanding-ClhKlj0g.js} +1 -1
  165. package/dist/gateway/static/root/assets/{projects-page-BCMWrLGf.js → projects-page-Bi9Ke76p.js} +1 -1
  166. package/dist/gateway/static/root/assets/pt-BKB_-X0N-CrkeeQaZ.js +1 -0
  167. package/dist/gateway/static/root/assets/{recording-upload-Yy9r6kHe.js → recording-upload-BjZ5SwXZ.js} +1 -1
  168. package/dist/gateway/static/root/assets/{refresh-button-D6ihZgH3.js → refresh-button-DX7bULU5.js} +1 -1
  169. package/dist/gateway/static/root/assets/{remote-access-hub-BeG8Bgy0.js → remote-access-hub-aSIeyTxn.js} +1 -1
  170. package/dist/gateway/static/root/assets/{resource-unavailable-Dccp_uis.js → resource-unavailable-BZVJxGR8.js} +1 -1
  171. package/dist/gateway/static/root/assets/rm-C1letx81-CNhvXnnG.js +1 -0
  172. package/dist/gateway/static/root/assets/ro-BUzliR9z-Bov_DAVD.js +1 -0
  173. package/dist/gateway/static/root/assets/route-preload-D36bLXpD.js +2 -0
  174. package/dist/gateway/static/root/assets/routine-panel-lfYWKBuW.js +2 -0
  175. package/dist/gateway/static/root/assets/ru-B591x1qT-DLdM0nWP.js +1 -0
  176. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-C7sHr-Lm.js → runtime-tools-settings-panel-DxYZLgVT.js} +1 -1
  177. package/dist/gateway/static/root/assets/sa-JnsT9B1R-CvBCyoRG.js +1 -0
  178. package/dist/gateway/static/root/assets/{schema-form-DXHzZPMr.js → schema-form-DkuIsCBU.js} +1 -1
  179. package/dist/gateway/static/root/assets/{service-recommendation-list-Bz9QWUZc.js → service-recommendation-list-BjuL2TaI.js} +1 -1
  180. package/dist/gateway/static/root/assets/{session-manager-fvJusKsK.js → session-manager-1UFhZMpv.js} +1 -1
  181. package/dist/gateway/static/root/assets/{sessions-page-DS-OExY1.js → sessions-page-CeCaW2FJ.js} +1 -1
  182. package/dist/gateway/static/root/assets/{settings-advanced-section-BsqgVQL3.js → settings-advanced-section-YRzA9yeq.js} +1 -1
  183. package/dist/gateway/static/root/assets/{settings-page-header-DKgbD0Bc.js → settings-page-header-C9xiCwzq.js} +1 -1
  184. package/dist/gateway/static/root/assets/{settings-page-layout-BE3vLWp_.js → settings-page-layout-DTOBegnh.js} +1 -1
  185. package/dist/gateway/static/root/assets/{settings-page-B_8kxJQW.js → settings-page-ngcjiqfd.js} +1 -1
  186. package/dist/gateway/static/root/assets/{setup-interaction-page-DLpGv0yp.js → setup-interaction-page-CnC-hC-A.js} +1 -1
  187. package/dist/gateway/static/root/assets/{setup-status-panel-BMaFUPnt.js → setup-status-panel-lAyDbUa1.js} +1 -1
  188. package/dist/gateway/static/root/assets/sh-cyrl-CLuomLGP-UY09gie6.js +1 -0
  189. package/dist/gateway/static/root/assets/sh-latn-DdZKFFaE-De-tA-2J.js +1 -0
  190. package/dist/gateway/static/root/assets/{share-link-dialog-3RNzFIH3.js → share-link-dialog-QvDZwWwI.js} +1 -1
  191. package/dist/gateway/static/root/assets/share-preview-page-7PohUauw.js +2 -0
  192. package/dist/gateway/static/root/assets/{shares-settings-C_ITdQqP.js → shares-settings-DpIh1naz.js} +1 -1
  193. package/dist/gateway/static/root/assets/sk-A3STIA2C-DC8Al4lF.js +1 -0
  194. package/dist/gateway/static/root/assets/{skills-page-B30SsJL6.js → skills-page-CRrTQOth.js} +1 -1
  195. package/dist/gateway/static/root/assets/sl-DjmW7S7C-B8FnrXi1.js +1 -0
  196. package/dist/gateway/static/root/assets/space-BPnfqDsQ.js +1 -0
  197. package/dist/gateway/static/root/assets/space-api-D4zPeS-a.js +1 -0
  198. package/dist/gateway/static/root/assets/space-page-DV-4mGaH.js +2 -0
  199. package/dist/gateway/static/root/assets/space-workbook-CtUQSd5l.js +291 -0
  200. package/dist/gateway/static/root/assets/space-workbook-CvOADsEJ.css +1 -0
  201. package/dist/gateway/static/root/assets/space-workbook-format-D1PqIvbd.js +1 -0
  202. package/dist/gateway/static/root/assets/space-workbook-import.worker-Bw2gfMG9.js +68 -0
  203. package/dist/gateway/static/root/assets/sr-cyrl-DzA2myNl-yGc0Jz1j.js +1 -0
  204. package/dist/gateway/static/root/assets/sv-B01JFt6B-DeQDoAsB.js +1 -0
  205. package/dist/gateway/static/root/assets/{system-settings-panel-KXLPpyOW.js → system-settings-panel-jgzBYOji.js} +1 -1
  206. package/dist/gateway/static/root/assets/ta-biPP5NX3-B5_ztYXp.js +1 -0
  207. package/dist/gateway/static/root/assets/{task-detail-page-DHYm_bsg.js → task-detail-page-qTnkErT0.js} +3 -3
  208. package/dist/gateway/static/root/assets/{task-header-title-Buwr7WTV.js → task-header-title-CRfK-rhR.js} +1 -1
  209. package/dist/gateway/static/root/assets/{task-result-evidence-DpV1mZJA.js → task-result-evidence-C2gEC9Hr.js} +1 -1
  210. package/dist/gateway/static/root/assets/te-DdPqCRaf-BjTOzs5s.js +1 -0
  211. package/dist/gateway/static/root/assets/th-C4s1cxFT-CFfNau1h.js +1 -0
  212. package/dist/gateway/static/root/assets/{time-picker-C1PXAXZF.js → time-picker-otHjbob1.js} +1 -1
  213. package/dist/gateway/static/root/assets/tk-BfqDjfTh-UHPz-lif.js +1 -0
  214. package/dist/gateway/static/root/assets/tr-C2sIij-w-DvQDK0dA.js +1 -0
  215. package/dist/gateway/static/root/assets/{tracing-settings-page-CcyPoojp.js → tracing-settings-page-7DxhxIp3.js} +1 -1
  216. package/dist/gateway/static/root/assets/{tunnel-api-D713CJ9R.js → tunnel-api-CZJEfJym.js} +1 -1
  217. package/dist/gateway/static/root/assets/uk-DBx0redY-DGVpthWV.js +1 -0
  218. package/dist/gateway/static/root/assets/{usage-page-DN1TcxWS.js → usage-page-CVJBXy2I.js} +1 -1
  219. package/dist/gateway/static/root/assets/{use-composer-attachments-4FKbf6PB.js → use-composer-attachments-Cs9sRfEz.js} +1 -1
  220. package/dist/gateway/static/root/assets/use-file-preview-expanded-B7Kp4Y1f.js +1 -0
  221. package/dist/gateway/static/root/assets/use-generated-media-UvehLoUl.js +1 -0
  222. package/dist/gateway/static/root/assets/{use-personal-work-srLCZOam.js → use-personal-work-eUnPoS9h.js} +1 -1
  223. package/dist/gateway/static/root/assets/{use-realtime-voice-tyo85cre.js → use-realtime-voice-CJD_ABL6.js} +1 -1
  224. package/dist/gateway/static/root/assets/{use-workspace-tree-VwHdfiR8.js → use-workspace-tree-BYrp8lL7.js} +1 -1
  225. package/dist/gateway/static/root/assets/{user-model-page-D-F5GO3T.js → user-model-page-s8sYPQwS.js} +2 -2
  226. package/dist/gateway/static/root/assets/{voice-player-store-DyuAAbk0.js → voice-player-store-DwAnvFVJ.js} +1 -1
  227. package/dist/gateway/static/root/assets/{voice-settings-DOajN2ay.js → voice-settings-WIooh0DA.js} +1 -1
  228. package/dist/gateway/static/root/assets/{work-discovery-overlay-CTLp1-tu.js → work-discovery-overlay-WGm3tfRV.js} +1 -1
  229. package/dist/gateway/static/root/assets/{work-discovery-page-B-UzFKIr.js → work-discovery-page-DLXUm21d.js} +1 -1
  230. package/dist/gateway/static/root/assets/{working-directory-picker-modal-DvVtUxHW.js → working-directory-picker-modal-BwmhPsrY.js} +1 -1
  231. package/dist/gateway/static/root/assets/{workspace-api-CIfedJeG.js → workspace-api-DEPruUJB.js} +2 -2
  232. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-iAz_WyiN.js +1 -0
  233. package/dist/gateway/static/root/assets/{workspace-open-location-menu-sbOva_RI.js → workspace-open-location-menu-CbQ5vUV7.js} +1 -1
  234. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BYuMOGaK.js → xopc-cloud-account-card-ClAhPUT1.js} +1 -1
  235. package/dist/gateway/static/root/assets/zh-latn-pinyin-CIit9tZA-CW52gdb_.js +1 -0
  236. package/dist/gateway/static/root/dependency-records.json +1251 -205
  237. package/dist/gateway/static/root/index.html +65 -62
  238. package/dist/package.js +1 -1
  239. package/dist/packages/gateway-contract/src/space.js +5 -2
  240. package/dist/packages/gateway-contract/src/user-message-display.js +6 -1
  241. package/dist/packages/realtime-protocol/src/index.js +4 -2
  242. package/dist/src/agent/inbound/attachment-pipeline.js +15 -6
  243. package/dist/src/agent/mcp/conversation-setup.js +9 -6
  244. package/dist/src/agent/skills/marketplace/search.d.ts +1 -0
  245. package/dist/src/agent/skills/marketplace/search.js +1 -0
  246. package/dist/src/agent/tools/capability-catalog-tool.js +1 -1
  247. package/dist/src/agent/tools/factory.js +3 -3
  248. package/dist/src/capabilities/capability-catalog.d.ts +4 -0
  249. package/dist/src/capabilities/capability-catalog.js +46 -15
  250. package/dist/src/channels/catalog/channel-catalog-service.js +2 -3
  251. package/dist/src/endpoint-tools/registry.d.ts +2 -1
  252. package/dist/src/endpoint-tools/registry.js +5 -3
  253. package/dist/src/endpoint-tools/runtime.d.ts +1 -1
  254. package/dist/src/endpoint-tools/runtime.js +2 -2
  255. package/dist/src/extensions/agent-plugins/mcp-adapter.js +15 -2
  256. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
  257. package/dist/src/gateway/hono/routes/mobile-capability-actions.d.ts +1 -1
  258. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +20 -10
  259. package/dist/src/gateway/hono/routes/mobile-capability-panels.d.ts +20 -0
  260. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +1523 -0
  261. package/dist/src/gateway/hono/routes/space.js +18 -0
  262. package/dist/src/gateway/security/gateway-scopes.js +5 -1
  263. package/dist/src/realtime/runtime.js +1 -1
  264. package/dist/src/session/session-title.js +4 -5
  265. package/dist/src/space/budget-workbook.d.ts +47 -0
  266. package/dist/src/space/budget-workbook.js +210 -0
  267. package/dist/src/space/repository.d.ts +1 -1
  268. package/dist/src/space/repository.js +24 -5
  269. package/dist/src/tunnel/tunnel-service.d.ts +5 -0
  270. package/dist/src/tunnel/tunnel-service.js +131 -30
  271. package/package.json +1 -1
  272. package/dist/gateway/static/root/assets/capabilities-page-D9EpUcuB.js +0 -2
  273. package/dist/gateway/static/root/assets/chat-page-BbahuZ59.js +0 -72
  274. package/dist/gateway/static/root/assets/dist-BuHnPloF.js +0 -1
  275. package/dist/gateway/static/root/assets/dist-ZrL34Ps4.js +0 -1
  276. package/dist/gateway/static/root/assets/es2015-DBLcMg5B.js +0 -41
  277. package/dist/gateway/static/root/assets/index-BtHMU5k4.css +0 -1
  278. package/dist/gateway/static/root/assets/note-image-lightbox-DrVGs1eQ.js +0 -1
  279. package/dist/gateway/static/root/assets/notes-page-zAJJ2OiQ.js +0 -8
  280. package/dist/gateway/static/root/assets/product-open-page-CQMoDCO1.js +0 -1
  281. package/dist/gateway/static/root/assets/product-preview-modal-DToUA1EF.js +0 -2
  282. package/dist/gateway/static/root/assets/route-preload-Bl10PwKS.js +0 -2
  283. package/dist/gateway/static/root/assets/routine-panel-BjqenuXU.js +0 -2
  284. package/dist/gateway/static/root/assets/share-preview-page-C49EIXte.js +0 -2
  285. package/dist/gateway/static/root/assets/space-page-DmvjU1jc.js +0 -2
  286. package/dist/gateway/static/root/assets/use-file-preview-expanded-CRBn6UTd.js +0 -1
  287. package/dist/gateway/static/root/assets/use-generated-media-CEJ5BBxX.js +0 -1
  288. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-Xi5feqPq.js +0 -1
@@ -1,3 +1,3 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i,l as a,p as o,t as s,u as c}from"./chunk-KS7C4IRE-BPb7KheU.js";import{i as l,l as u,n as d,o as f}from"./locale-store-B4o4aDCg.js";import{t as p}from"./messages-hlOsXkQ7.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-CY7CS_D3.js";import{G as x,T as S,g as C,ot as w,q as T,t as E}from"./chat-page-BbahuZ59.js";import{t as D}from"./arrow-left-D880xG-P.js";import{f as O,i as k,u as A}from"./automation-display-DaVDNZz8.js";import{t as j}from"./check-DUBLcKHA.js";import{t as M}from"./chevron-right-BweFrslA.js";import{n as N,r as P}from"./popover-select-CLsphyzA.js";import{t as F}from"./circle-BoO4YvTx.js";import{t as I}from"./ellipsis-0k4rZLoy.js";import{t as L}from"./external-link-DjqjBmc3.js";import{t as R}from"./file-icon-N6WjUhq_.js";import{t as ee}from"./folder-kanban-CpLlFI1o.js";import{t as te}from"./folder-open-CyzJ19I9.js";import{B as ne,H as re,I as ie,P as ae}from"./markdown-view-C7kqotD-.js";import{t as oe}from"./message-square-fVE7Ghj1.js";import{t as se}from"./pause-DuPxgSxk.js";import{t as ce}from"./play-kxZvpBg8.js";import{t as z}from"./x-B_N4OPjy.js";import{t as B}from"./cn-0WouolD0.js";import{t as le}from"./skeleton-DzdOeGYz.js";import{d as ue}from"./tasks-BIehlq7k.js";import{c as de}from"./api-D0r-2gWQ.js";import{ht as fe}from"./session-manager-fvJusKsK.js";import{i as pe}from"./vendor-swr-CdRzEUwF.js";import{C as me,D as he,T as ge,_ as _e,a as ve,f as ye,i as be,l as xe,n as Se,r as Ce,u as we,x as Te}from"./workspace-preview-store-DYd8E5bV.js";import{t as Ee}from"./chat-agents-api-B-47bqbd.js";import{t as V}from"./button-ChmVQg9O.js";import{r as De}from"./right-workspace-store-CFf15f36.js";import{c as Oe}from"./composer-payload-handoff-DKLokix8.js";import{t as ke}from"./page-header-store-D_2QZ6Ps.js";import{t as Ae}from"./agent-avatar-display-BDHjRaTK.js";import{t as je}from"./automation-api-CxLFngqe.js";import{n as Me}from"./agent-display-names-Bje7vfSn.js";import{t as H}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ne}from"./confirm-dialog-DkviAS5j.js";import{l as Pe,m as Fe,o as Ie,r as Le,t as Re,u as ze}from"./dist-ZrL34Ps4.js";import{d as Be,f as Ve,l as He,o as Ue,u as We}from"./automation-task-card-BS-RT312.js";import{t as Ge}from"./date-picker-DgTDENzF.js";import{t as Ke}from"./time-picker-C1PXAXZF.js";import{n as qe}from"./date-formatters-DukWSVwc.js";import{n as Je,r as Ye,t as Xe}from"./task-header-title-Buwr7WTV.js";import{t as Ze}from"./date-time-picker-Gw4oSOk9.js";import{n as Qe,r as U,t as $e}from"./task-result-evidence-DpV1mZJA.js";import{t as et}from"./page-context-capture-button-Bd__UBi9.js";import{t as tt}from"./dependency-picker-BJDpQtKY.js";var W=e(t(),1),G=n(),K=r();function nt(e,t,n){let r=new URLSearchParams(e),i=r.getAll(`taskPanel`).filter(e=>e!==t&&e!==`${t}:closed`);r.delete(`taskPanel`);for(let e of i)r.append(`taskPanel`,e);return r.append(`taskPanel`,n?t:`${t}:closed`),r}function rt(e){let t=(0,G.c)(32),n,r,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7]):({panelId:r,title:l,defaultOpen:s,children:n,summaryClassName:o,chevron:c,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l);let u=s!==void 0&&s,d=c!==void 0&&c,[f,p]=i(),m;if(t[8]!==u||t[9]!==r||t[10]!==f){let e=f.getAll(`taskPanel`);m=e.includes(r)||u&&!e.includes(`${r}:closed`),t[8]=u,t[9]=r,t[10]=f,t[11]=m}else m=t[11];let h=m,g=o??`cursor-pointer py-2 text-xs text-fg-muted hover:text-fg`,_=d&&`flex list-none items-center justify-between gap-3 [&::-webkit-details-marker]:hidden`,v;t[12]!==g||t[13]!==_?(v=B(g,_),t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==r||t[17]!==p?(y=e=>{e.preventDefault(),p(e=>nt(e,r,!h),{preventScrollReset:!0})},t[15]=h,t[16]=r,t[17]=p,t[18]=y):y=t[18];let b;t[19]!==d||t[20]!==h||t[21]!==l?(b=d?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:l}),(0,K.jsx)(M,{"aria-hidden":!0,className:B(`size-4 shrink-0 text-fg-subtle motion-safe:transition-transform motion-safe:duration-150`,h&&`rotate-90`)})]}):l,t[19]=d,t[20]=h,t[21]=l,t[22]=b):b=t[22];let x;t[23]!==v||t[24]!==y||t[25]!==b?(x=(0,K.jsx)(`summary`,{className:v,onClick:y,children:b}),t[23]=v,t[24]=y,t[25]=b,t[26]=x):x=t[26];let S;return t[27]!==n||t[28]!==h||t[29]!==a||t[30]!==x?(S=(0,K.jsxs)(`details`,{...a,open:h,children:[x,n]}),t[27]=n,t[28]=h,t[29]=a,t[30]=x,t[31]=S):S=t[31],S}function it(e){let t=e;for(;t&&!/(auto|scroll)/.test(getComputedStyle(t).overflowY);)t=t.parentElement;return t}function at(e,t){let n=e?.closest(`.task-detail-scroll`),r=Array.from(n?.querySelectorAll(`[data-task-section]`)??[]).find(e=>e.dataset.taskSection===t);if(!r||!n)return;r instanceof HTMLDetailsElement&&(r.open=!0);let i=it(n),a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!i){r.scrollIntoView({block:`start`,behavior:a?`instant`:`smooth`});return}let o=(e?.parentElement?.getBoundingClientRect().height??0)+16,s=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,i.scrollTop+r.getBoundingClientRect().top-i.getBoundingClientRect().top-i.clientTop-o));i.scrollTo({top:s,behavior:a?`instant`:`smooth`});let c=i;return{cancel:()=>c.scrollTo({top:c.scrollTop,behavior:`instant`}),isComplete:()=>Math.abs(c.scrollTop-s)<1}}function ot(e){let t=(0,G.c)(28),{language:n,hasSchedule:r}=e,[a,o]=i(),s;t[0]===a?s=t[1]:(s=a.get(`taskSection`),t[0]=a,t[1]=s);let c=s,l=(0,W.useRef)(null),u=(0,W.useRef)(null),d=(0,W.useRef)(null),f=(0,W.useRef)(void 0),p=(0,W.useRef)(o),m=(0,W.useRef)(c),h,g;t[2]!==c||t[3]!==o?(h=()=>{p.current=o,m.current=c},g=[o,c],t[2]=c,t[3]=o,t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,W.useEffect)(h,g);let _=(0,W.useRef)(void 0),v=(0,W.useRef)(!1),y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=d.current;d.current=null,_.current=void 0,!(!e||!v.current)&&(v.current=!1,p.current(t=>{let n=nt(t,e,!0);return n.set(`taskSection`,e),n},{preventScrollReset:!0}))},t[6]=y):y=t[6];let b=y,x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(e,t)=>{let n=t!==void 0&&t;clearTimeout(f.current),d.current=e,v.current=n,f.current=setTimeout(b,800),_.current=at(l.current,e)},t[7]=x):x=t[7];let S=x,[C,w]=(0,W.useState)(c??`results`),T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[8]=T):T=t[8];let[E,D]=(0,W.useState)(T),O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{let e=l.current,t=e?.closest(`.task-detail-scroll`),n=e?.parentElement;if(!t||!n)return;let r=Array.from(t.querySelectorAll(`[data-task-section]`));D(r.map(st));let i=0,a=()=>{if(d.current)return;let e=it(t),i=n.getBoundingClientRect().bottom+24,a=r[0];for(let e of r)e.getBoundingClientRect().top<=i&&(a=e);if(e&&e.scrollHeight>e.clientHeight&&e.scrollTop+e.clientHeight>=e.scrollHeight-2&&(a=r.at(-1)),!a)return;let o=a.dataset.taskSection;w(o),m.current!==o&&(u.current=o,clearTimeout(f.current),f.current=setTimeout(()=>{p.current(e=>{let t=new URLSearchParams(e);return t.set(`taskSection`,o),t},{replace:!0,preventScrollReset:!0})},160))},o=e=>{if(!(!(e.target instanceof Element)||!e.target.contains(t))){if(d.current){clearTimeout(f.current),f.current=setTimeout(b,160);return}clearTimeout(f.current),i||=requestAnimationFrame(()=>{i=0,a()})}},s=n=>{!(n.target instanceof Node)||!t.contains(n.target)||e.contains(n.target)||n instanceof KeyboardEvent&&![`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(n.key)||(_.current?.cancel(),_.current=void 0,d.current=null,v.current=!1,clearTimeout(f.current))},c=e=>{e.target instanceof Element&&e.target.contains(t)&&d.current&&(!_.current||_.current.isComplete())&&(clearTimeout(f.current),b())},h=()=>{let e=n.getBoundingClientRect().height;for(let t of r)t.style.scrollMarginTop=`${e+16}px`};h();let g=typeof ResizeObserver>`u`?null:new ResizeObserver(h);return g?.observe(n),window.addEventListener(`resize`,h),document.addEventListener(`scroll`,o,!0),document.addEventListener(`scrollend`,c,!0),document.addEventListener(`wheel`,s,{capture:!0,passive:!0}),document.addEventListener(`touchstart`,s,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,s,{capture:!0,passive:!0}),document.addEventListener(`keydown`,s,!0),()=>{cancelAnimationFrame(i),g?.disconnect(),window.removeEventListener(`resize`,h),document.removeEventListener(`scroll`,o,!0),document.removeEventListener(`scrollend`,c,!0),document.removeEventListener(`wheel`,s,!0),document.removeEventListener(`touchstart`,s,!0),document.removeEventListener(`pointerdown`,s,!0),document.removeEventListener(`keydown`,s,!0)}},t[9]=O):O=t[9];let k;t[10]!==r||t[11]!==n?(k=[n,r,b],t[10]=r,t[11]=n,t[12]=k):k=t[12],(0,W.useEffect)(O,k);let A,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>{clearTimeout(f.current),_.current?.cancel()},A=[],t[13]=A,t[14]=j):(A=t[13],j=t[14]),(0,W.useEffect)(j,A);let M,N;t[15]===c?(M=t[16],N=t[17]):(M=()=>{!c||u.current===c||(u.current=c,w(c),S(c))},N=[c,S],t[15]=c,t[16]=M,t[17]=N),(0,W.useEffect)(M,N);let P;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=l.current,t=e?.querySelector(`[aria-current="location"]`);if(!e||!t)return;let n=t.offsetLeft<e.scrollLeft?t.offsetLeft:t.offsetLeft+t.offsetWidth>e.scrollLeft+e.clientWidth?t.offsetLeft+t.offsetWidth-e.clientWidth:e.scrollLeft;n!==e.scrollLeft&&e.scrollTo({left:n,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},t[18]=P):P=t[18];let F;t[19]!==C||t[20]!==E?(F=[C,E],t[19]=C,t[20]=E,t[21]=F):F=t[21],(0,W.useEffect)(P,F);let I=n===`zh`?`任务详情分区`:`Task detail sections`,L;t[22]!==C||t[23]!==E?(L=E.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-current":C===e.id?`location`:void 0,"aria-pressed":C===e.id,"data-sliding-active":C===e.id,className:B(`relative z-10 min-h-9 min-w-max flex-1 touch-manipulation rounded-lg px-3 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C===e.id?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>{u.current=e.id,w(e.id),S(e.id,!0)},children:e.label},e.id)),t[22]=C,t[23]=E,t[24]=L):L=t[24];let R;return t[25]!==I||t[26]!==L?(R=(0,K.jsx)(H,{scrollFocusedItemIntoView:!1,as:`nav`,ref:l,"aria-label":I,className:`flex w-full gap-0.5 overflow-x-auto rounded-xl bg-surface-inset p-1`,indicatorClassName:`rounded-lg bg-surface-panel ring-1 ring-edge-subtle duration-300 [transition-timing-function:cubic-bezier(0.22,1,0.36,1)]`,children:L}),t[25]=I,t[26]=L,t[27]=R):R=t[27],R}function st(e){return{id:e.dataset.taskSection,label:e.dataset.taskSectionLabel}}var ct=`Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage.`;function lt(e){let t=(0,G.c)(64),{criterion:n,index:r,language:i,closed:a,pending:o,onReview:s,projectId:c,conversationId:l}=e,u=i===`zh`,d=(0,W.useId)(),f=n.status===`passed`,p=n.evidence.length>0||n.method||n.review||n.note,m=n.verificationStatus===`passed`?u?`通过`:`Passed`:n.verificationStatus===`failed`?u?`未通过`:`Failed`:u?`未核验`:`Unverified`,h=n.review?.status===`passed`?u?`已验收`:`Accepted`:n.review?.status===`failed`?u?`未通过`:`Failed`:u?`已撤销验收`:`Acceptance cleared`,g=!a&&!o&&`cursor-pointer`,_;t[0]===g?_=t[1]:(_=B(`relative grid size-11 shrink-0 place-items-center rounded-full`,g),t[0]=g,t[1]=_);let v=o||void 0,y;t[2]!==r||t[3]!==s||t[4]!==o?(y=e=>{o||s(r,e.target.checked?`passed`:`unverified`)},t[2]=r,t[3]=s,t[4]=o,t[5]=y):y=t[5];let b;t[6]!==f||t[7]!==a||t[8]!==v||t[9]!==y||t[10]!==d?(b=(0,K.jsx)(`input`,{type:`checkbox`,"aria-labelledby":d,className:`peer sr-only`,checked:f,disabled:a,"aria-disabled":v,onChange:y}),t[6]=f,t[7]=a,t[8]=v,t[9]=y,t[10]=d,t[11]=b):b=t[11];let x=f?`border-edge bg-surface-inset text-fg`:`border-fg-subtle/70`,S=!a&&!o&&`hover:bg-surface-hover`,C;t[12]!==x||t[13]!==S?(C=B(`grid size-5 place-items-center rounded-full border motion-safe:transition-colors motion-safe:duration-150 peer-focus-visible:ring-2 peer-focus-visible:ring-accent peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-panel`,x,S),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]===f?w=t[16]:(w=f?(0,K.jsx)(j,{className:`size-3.5`,strokeWidth:2.8}):null,t[15]=f,t[16]=w);let T;t[17]!==C||t[18]!==w?(T=(0,K.jsx)(`span`,{"aria-hidden":!0,className:C,children:w}),t[17]=C,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,K.jsxs)(`label`,{className:_,children:[b,T]}),t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let D=`criterion:${r}:evidence`,O;t[24]!==n.text||t[25]!==d?(O=(0,K.jsx)(`span`,{id:d,className:`block whitespace-pre-wrap break-words text-sm leading-5 text-fg [overflow-wrap:anywhere]`,children:n.text}),t[24]=n.text,t[25]=d,t[26]=O):O=t[26];let k=u?`验收依据`:`Acceptance evidence`,A;t[27]===k?A=t[28]:(A=(0,K.jsx)(`p`,{className:`font-medium text-fg`,children:k}),t[27]=k,t[28]=A);let M;t[29]!==n.method||t[30]!==m||t[31]!==u?(M=n.method?(0,K.jsxs)(`p`,{children:[u?`自动核验`:`Automatic verification`,` · `,m,n.method===`model_reviewed`?u?` · 模型审阅`:` · Model review`:``]}):null,t[29]=n.method,t[30]=m,t[31]=u,t[32]=M):M=t[32];let N;t[33]!==n.review||t[34]!==i||t[35]!==h||t[36]!==u?(N=n.review?(0,K.jsxs)(`p`,{children:[u?`人工验收`:`User review`,` · `,h,` · `,qe(n.review.reviewedAt,i)]}):null,t[33]=n.review,t[34]=i,t[35]=h,t[36]=u,t[37]=N):N=t[37];let P;t[38]!==n.note||t[39]!==r||t[40]!==i?(P=n.note&&n.note!==ct?(0,K.jsx)(U,{content:n.note,contentKey:`criterion:${r}:note`,language:i,markdown:!1}):null,t[38]=n.note,t[39]=r,t[40]=i,t[41]=P):P=t[41];let F;t[42]!==l||t[43]!==n.evidence||t[44]!==i||t[45]!==c?(F=(0,K.jsx)($e,{evidence:n.evidence,projectId:c,conversationId:l,language:i}),t[42]=l,t[43]=n.evidence,t[44]=i,t[45]=c,t[46]=F):F=t[46];let I;t[47]!==p||t[48]!==u?(I=p?null:(0,K.jsx)(`p`,{children:u?`暂无验收依据`:`No evidence yet`}),t[47]=p,t[48]=u,t[49]=I):I=t[49];let L;t[50]!==A||t[51]!==M||t[52]!==N||t[53]!==P||t[54]!==F||t[55]!==I?(L=(0,K.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-inset px-3 py-2.5 text-xs leading-5 text-fg-muted`,children:[A,M,N,P,F,I]}),t[50]=A,t[51]=M,t[52]=N,t[53]=P,t[54]=F,t[55]=I,t[56]=L):L=t[56];let R;t[57]!==D||t[58]!==O||t[59]!==L?(R=(0,K.jsx)(rt,{panelId:D,chevron:!0,className:`min-w-0 flex-1`,summaryClassName:`-ms-1 min-h-11 cursor-pointer rounded-lg py-3 pe-2 ps-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:O,children:L}),t[57]=D,t[58]=O,t[59]=L,t[60]=R):R=t[60];let ee;return t[61]!==E||t[62]!==R?(ee=(0,K.jsxs)(`li`,{className:`relative flex min-w-0 items-start px-2 before:absolute before:end-0 before:start-13 before:top-0 before:border-t before:border-edge-subtle first:before:hidden sm:px-3`,children:[E,R]}),t[61]=E,t[62]=R,t[63]=ee):ee=t[63],ee}function ut(e){let t=(0,G.c)(39),{criteria:n,language:r,closed:i,pending:a,blockedReason:o,error:s,onReview:c,projectId:l,conversationId:u,reviewDisabled:d}=e,f=r===`zh`,p;t[0]===n?p=t[1]:(p=n.some(dt),t[0]=n,t[1]=p);let m=p,h;t[2]!==m||t[3]!==f?(h=m?(0,K.jsx)(rt,{panelId:`acceptance:diagnostic`,title:f?`自动核验未完成:验收标准过于宽泛`:`Automatic verification incomplete: criteria are too broad`,className:`mx-4 mb-2 text-xs leading-5 text-fg-muted`,children:(0,K.jsx)(`p`,{className:`mt-2 break-words`,children:ct})}):null,t[2]=m,t[3]=f,t[4]=h):h=t[4];let g=a||void 0,_;if(t[5]!==i||t[6]!==u||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==a||t[11]!==l||t[12]!==d){let e;t[14]!==i||t[15]!==u||t[16]!==r||t[17]!==c||t[18]!==a||t[19]!==l||t[20]!==d?(e=(e,t)=>(0,K.jsx)(lt,{criterion:e,index:t,language:r,closed:i||!!d,pending:a,onReview:c,projectId:l,conversationId:u},`${t}:${e.text}`),t[14]=i,t[15]=u,t[16]=r,t[17]=c,t[18]=a,t[19]=l,t[20]=d,t[21]=e):e=t[21],_=n.map(e),t[5]=i,t[6]=u,t[7]=n,t[8]=r,t[9]=c,t[10]=a,t[11]=l,t[12]=d,t[13]=_}else _=t[13];let v;t[22]!==g||t[23]!==_?(v=(0,K.jsx)(`ul`,{"aria-busy":g,className:`border-t border-edge-subtle`,children:_}),t[22]=g,t[23]=_,t[24]=v):v=t[24];let y;t[25]!==n.length||t[26]!==f?(y=n.length===0?(0,K.jsx)(`p`,{className:`px-4 py-4 text-sm text-fg-muted`,children:f?`尚未定义验收标准`:`No acceptance criteria defined`}):null,t[25]=n.length,t[26]=f,t[27]=y):y=t[27];let b;t[28]===s?b=t[29]:(b=s?(0,K.jsx)(`p`,{role:`alert`,className:`mx-4 my-2 text-sm text-danger`,children:s}):null,t[28]=s,t[29]=b);let x;t[30]!==o||t[31]!==i?(x=!i&&o?(0,K.jsx)(`p`,{className:`border-t border-edge-subtle px-4 py-2.5 text-xs text-fg-muted`,children:o}):null,t[30]=o,t[31]=i,t[32]=x):x=t[32];let S;return t[33]!==h||t[34]!==v||t[35]!==y||t[36]!==b||t[37]!==x?(S=(0,K.jsxs)(K.Fragment,{children:[h,v,y,b,x]}),t[33]=h,t[34]=v,t[35]=y,t[36]=b,t[37]=x,t[38]=S):S=t[38],S}function dt(e){return e.note===ct}function ft(e){let t=(0,G.c)(27),{detail:n,language:r}=e,i=r===`zh`,o=a(),c;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==i){let e=n.deliverables??[],a=Se(n),l;if(t[5]!==n.runs||t[6]!==n.task){let e;t[8]===n.task?e=t[9]:(e=e=>e.contractVersion===n.task.latestContractVersion,t[8]=n.task,t[9]=e),l=new Set(n.runs.filter(e).map(yt)),t[5]=n.runs,t[6]=n.task,t[7]=l}else l=t[7];let u=l,d=n.context.filter(vt).map(_t),f=new Set(e.flatMap(gt).filter(Boolean)),p=new Set([...d.map(ht),...f].filter(Boolean)),m;t[10]===u?m=t[11]:(m=e=>u.has(e.runId),t[10]=u,t[11]=m);for(let e of n.receipts.filter(m))for(let t of e.evidence.filter(mt))t.uri&&p.has(t.uri)||(t.uri&&p.add(t.uri),d.push(t));let h=a?.summary.trim(),g=h&&h.length<=160&&!h.includes(`
2
- `)&&!/\b(?:Claim|Criterion|Research claim)\b|c-ac\d|Default criteria were not/i.test(h)?h:void 0,_=d.filter(e=>!f.has(e.uri)),v=i?`交付结果`:`Deliverables`,y;t[12]===v?y=t[13]:(y=(0,K.jsx)(`h2`,{id:`task-results-heading`,className:`text-sm font-semibold text-fg`,children:v}),t[12]=v,t[13]=y);let b;t[14]!==e||t[15]!==n||t[16]!==o||t[17]!==i?(b=e.length?(0,K.jsx)(`ul`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.map(e=>{let t=e.artifact?.title??e.reference?.title??e.id;return(0,K.jsxs)(`li`,{className:`min-w-0`,children:[(0,K.jsxs)(Ye,{item:e,conversationId:e.task?.conversationId??n.conversation.activeConversationId,backgroundPath:`${o.pathname}${o.search}`,zh:i,className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,K.jsx)(R,{name:t}),(0,K.jsx)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:t})]}),e.artifact?.availability===`available`&&e.artifact.uri?.startsWith(`media://outbound/`)?(0,K.jsx)(C,{file:e.artifact,zh:i}):null]},e.id)})}):null,t[14]=e,t[15]=n,t[16]=o,t[17]=i,t[18]=b):b=t[18];let x;t[19]!==n||t[20]!==r||t[21]!==_?(x=_.length?(0,K.jsx)($e,{evidence:_,language:r,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,compact:!0}):null,t[19]=n,t[20]=r,t[21]=_,t[22]=x):x=t[22];let S;t[23]!==e||t[24]!==_.length||t[25]!==i?(S=!e.length&&!_.length?(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i?`尚无可查看的交付物`:`No deliverables available yet`}):null,t[23]=e,t[24]=_.length,t[25]=i,t[26]=S):S=t[26],c=(0,K.jsxs)(`section`,{"aria-label":i?`交付结果`:`Deliverables`,className:`rounded-xl bg-surface-panel p-4`,children:[y,g?(0,K.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-fg-muted [overflow-wrap:anywhere]`,children:g}):null,a&&a.completionVerdict!==`achieved`?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`本次执行尚未报告目标全部达成。`:`This run has not reported the full goal achieved.`}):null,b,x,S,a?null:(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:i?`尚无本版任务的执行结果`:`No run result for this task version`}),a&&(a.needsUser||a.remainingWork.length>0||a.nextAction||a.failure)?(0,K.jsxs)(`div`,{className:`mt-4 space-y-2 border-t border-edge-subtle pt-3`,"aria-label":i?`执行待办`:`Run follow-up`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:a.needsUser?i?`需要你决定`:`Your decision needed`:i?`待处理事项`:`Remaining work`}),a.remainingWork.length>0?(0,K.jsx)(`ul`,{className:`space-y-2 text-sm leading-6 text-fg`,children:[...new Set(a.remainingWork)].map(pt)}):null,a.nextAction?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:a.nextAction}):null,a.failure?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-danger [overflow-wrap:anywhere]`,children:a.failure.recoveryAction}):null,a.needsUser?(0,K.jsx)(s,{className:`inline-flex min-h-9 items-center rounded-sm text-xs font-medium text-accent-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent/40`,to:ae(n.task.id),children:i?`查看并决定`:`Review and decide`}):null]}):null]}),t[0]=n,t[1]=r,t[2]=o,t[3]=i,t[4]=c}else c=t[4];return c}function pt(e){return(0,K.jsx)(`li`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e},e)}function mt(e){return e.kind===`artifact`}function ht(e){return e.uri}function gt(e){return[e.artifact?.uri,e.artifact?.shareUrl,e.artifact?.workspaceRelativePath]}function _t(e){return{kind:[`file`,`url`].includes(e.targetKind)?`artifact`:`source`,title:e.title??e.targetId,summary:``,...[`file`,`url`].includes(e.targetKind)?{uri:e.targetId}:{},provenance:`user`,strength:`observed`,observedAt:0}}function vt(e){return e.role===`deliverable`}function yt(e){return e.id}function bt(e){let t=(0,G.c)(19),{detail:n,language:r}=e,i=r===`zh`,a=Oe(r),o;t[0]===n?o=t[1]:(o=Se(n),t[0]=n,t[1]=o);let s=o,c;t[2]===s?.runId?c=t[3]:(c=e=>e.runId!==s?.runId,t[2]=s?.runId,t[3]=c);let l=n.receipts.filter(c),[u,d]=(0,W.useState)(`idle`),f;t[4]===s?f=t[5]:(f=async function(e){if(s){d(`pending`);try{await me(s.runId,e),d(`saved`)}catch{d(`failed`)}}},t[4]=s,t[5]=f);let p=f,m;t[6]!==n||t[7]!==r?(m=(0,K.jsx)(T,{detail:n,language:r}),t[6]=n,t[7]=r,t[8]=m):m=t[8];let h=s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:a.latestResult}),(0,K.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[a.receiptStatuses[s.status],` · `,a.verificationStatuses[s.verification.status]]})]}),(0,K.jsx)(U,{content:s.summary,contentKey:`${n.task.id}:result:${s.runId}`,language:r}),s.evidence.length>0?(0,K.jsxs)(`details`,{children:[(0,K.jsxs)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:[i?`验证依据与执行产物`:`Evidence and artifacts`,` · `,s.evidence.length]}),(0,K.jsx)($e,{evidence:s.evidence,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,language:r})]}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,K.jsx)(V,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`helpful`),children:a.doneWell}),(0,K.jsx)(V,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`not_helpful`),children:a.needsFix}),u===`saved`?(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`反馈已记录`:`Feedback saved`}):null,u===`failed`?(0,K.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:a.actionFailed}):null]})]}):null,g=l.length>0?(0,K.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:a.executionHistory.replace(`{{count}}`,String(l.length))}),(0,K.jsx)(`div`,{className:`mt-3 space-y-4`,children:l.map(e=>(0,K.jsxs)(`article`,{className:`space-y-2 rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.receiptStatuses[e.status]}),(0,K.jsx)(U,{content:e.summary,contentKey:`${n.task.id}:result:${e.runId}`,language:r})]},e.runId))})]}):null,_;t[9]!==a||t[10]!==n.criterionReviewHistory||t[11]!==r||t[12]!==i?(_=n.criterionReviewHistory?.length?(0,K.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:i?`历史验收判定`:`Past criterion reviews`}),(0,K.jsx)(`ul`,{className:`mt-2 space-y-2 text-sm`,children:n.criterionReviewHistory.map(e=>(0,K.jsxs)(`li`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`p`,{children:e.criterionText}),(0,K.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[a.verificationStatuses[e.status],` · `,qe(e.reviewedAt,r)]}),e.note?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.note}):null]},`${e.contractVersion}:${e.resultId??``}:${e.criterionIndex}`))})]}):null,t[9]=a,t[10]=n.criterionReviewHistory,t[11]=r,t[12]=i,t[13]=_):_=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==_?(v=(0,K.jsxs)(`div`,{className:`space-y-4`,children:[m,h,g,_]}),t[14]=m,t[15]=h,t[16]=g,t[17]=_,t[18]=v):v=t[18],v}function xt(e){let t=(0,G.c)(33),{changes:n,language:r}=e,i=r===`zh`,a;t[0]===i?a=t[1]:(a=i?{backlog:`待办池`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`},t[0]=i,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=i?{board:`看板`,mobile:`移动端`,api:`手动操作`,runtime:`自动流转`,undo:`撤销`}:{board:`Board`,mobile:`Mobile`,api:`Manual update`,runtime:`Automatic`,undo:`Undo`},t[2]=i,t[3]=s);let c=s,l;t[4]===i?l=t[5]:(l=i?{done:`完成`,cancelled:`取消`,duplicate:`重复`,wont_do:`不做`}:{done:`Done`,cancelled:`Cancelled`,duplicate:`Duplicate`,wont_do:`Won’t do`},t[4]=i,t[5]=l);let u=l,d;t[6]===i?d=t[7]:(d=i?{user:`用户`,agent:`Agent`,system:`系统`,integration:`外部服务`}:{user:`User`,agent:`Agent`,system:`System`,integration:`Integration`},t[6]=i,t[7]=d);let f=d,p=i?`变更记录`:`Change log`,m;t[8]!==n.length||t[9]!==p?(m=(0,K.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[p,` (`,n.length,`)`]}),t[8]=n.length,t[9]=p,t[10]=m):m=t[10];let h;if(t[11]!==f||t[12]!==n||t[13]!==r||t[14]!==o||t[15]!==u||t[16]!==c){let e;t[18]!==f||t[19]!==r||t[20]!==o||t[21]!==u||t[22]!==c?(e=e=>(0,K.jsxs)(`li`,{className:`text-sm text-fg`,children:[(0,K.jsxs)(`div`,{children:[o[e.fromPhase],e.fromResolution?` · ${u[e.fromResolution]}`:``,` → `,o[e.toPhase],e.toResolution?` · ${u[e.toResolution]}`:``]}),(0,K.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[f[e.actor.kind],e.actor.id?` (${e.actor.id})`:``,` · `,c[e.source],` · `,(0,K.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:qe(e.createdAt,r)})]})]},e.id),t[18]=f,t[19]=r,t[20]=o,t[21]=u,t[22]=c,t[23]=e):e=t[23],h=[...n].reverse().map(e),t[11]=f,t[12]=n,t[13]=r,t[14]=o,t[15]=u,t[16]=c,t[17]=h}else h=t[17];let g;t[24]===h?g=t[25]:(g=(0,K.jsx)(`ol`,{className:`mt-3 max-h-80 space-y-3 overflow-y-auto`,children:h}),t[24]=h,t[25]=g);let _;t[26]!==n.length||t[27]!==i?(_=n.length?null:(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i?`暂无阶段变更记录`:`No phase changes yet`}),t[26]=n.length,t[27]=i,t[28]=_):_=t[28];let v;return t[29]!==m||t[30]!==g||t[31]!==_?(v=(0,K.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[m,g,_]}),t[29]=m,t[30]=g,t[31]=_,t[32]=v):v=t[32],v}function St({schedules:e,language:t,onEdit:n,onUpdated:r}){let i=t===`zh`,a=p(t),[o,c]=(0,W.useState)(null),l=(0,W.useRef)(!1),[u,d]=(0,W.useState)(null),f=e=>new Date(e).toLocaleString(i?`zh-CN`:`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`});async function m(e){if(!l.current){l.current=!0,c(e.id),d(null);try{r((await je.update(e.id,{enabled:!1,expectedRevision:e.updatedAtMs})).automation)}catch(e){d(e instanceof Error?e.message:a.automations.feedback.actionFailed)}finally{l.current=!1,c(null)}}}return(0,K.jsxs)(`section`,{"aria-label":i?`执行时间`:`Execution schedule`,className:`rounded-xl bg-surface-inset p-4`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`执行时间`:`Execution schedule`}),(0,K.jsx)(`div`,{className:`mt-3 space-y-4`,children:e.map(e=>{let r=e.trigger.kind===`schedule`?e.trigger.schedule:null,c=A(e),l=!e.management||e.management.editable.includes(`trigger`),u=!e.management||e.management.editable.includes(`enabled`);return(0,K.jsxs)(`article`,{className:`space-y-2 text-sm text-fg`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`break-words font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:`text-xs text-fg-muted`,children:c?i?`已执行`:`Completed`:e.enabled?i?`已启用`:`Enabled`:i?`已取消定时执行`:`Scheduling disabled`})]}),(0,K.jsx)(`p`,{children:r?.kind===`once`?`${i?`单次执行:`:`Run once: `}${f(Date.parse(r.at))}`:k(e.trigger,a.automations,a.cron,t)}),r?.kind===`cron`?(0,K.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[i?`执行时区:`:`Schedule timezone: `,r.tz||(i?`服务所在电脑时区`:`Server timezone`)]}):null,(0,K.jsxs)(`p`,{className:`text-fg-muted`,children:[i?`下次执行:`:`Next run: `,c?i?`已执行,无后续计划`:`Completed; no upcoming run`:e.enabled?e.state.nextRunAtMs===void 0?i?`暂无后续执行`:`No upcoming run`:f(e.state.nextRunAtMs):i?`已取消,不再自动执行`:`Disabled; no automatic runs`]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l?(0,K.jsx)(V,{variant:`secondary`,disabled:o!==null,onClick:()=>n(e),children:i?`修改时间`:`Edit schedule`}):null,e.enabled&&u?(0,K.jsx)(V,{variant:`ghost`,disabled:o!==null,onClick:()=>void m(e),children:o===e.id?i?`正在取消…`:`Cancelling…`:i?`取消定时执行`:`Cancel schedule`}):null,(0,K.jsx)(V,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(s,{to:`/automations?automation=${encodeURIComponent(e.id)}`,children:i?`查看自动化`:`View automation`})})]})]},e.id)})}),u?(0,K.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:u}):null]})}var Ct=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function wt({taskId:e,taskTitle:t,projectId:n,executorAgentId:r,language:i,onClose:a,onCreated:o,automation:c}){let l=i===`zh`,u=p(i).automations,[d,f]=(0,W.useState)(()=>c?Be(c):{...Ve,name:t,projectId:n??``,actionMode:`task_command`,taskId:e,agentId:r??``,triggerMode:`once`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}),[x,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(!1),T=(0,W.useRef)(!1),[E,D]=(0,W.useState)(null),O=e=>f(t=>({...t,...e}));async function k(e){if(e.preventDefault(),!(T.current||x)&&(D(null),!(!d.name.trim()||!c&&!r))){if(d.triggerMode===`once`&&(!Number.isFinite(new Date(d.onceAt).getTime())||new Date(d.onceAt).getTime()<=Date.now())){D(u.experience.futureTime);return}T.current=!0,w(!0);try{let e=c?He(c,d).trigger:We(d).trigger,{automation:t}=c?await je.update(c.id,{trigger:e,...c.management?{}:{name:d.name.trim(),delivery:{...c.delivery,notificationPolicy:d.notificationPolicy}},...!c.management||c.management.editable.includes(`enabled`)?{enabled:!0}:{},expectedRevision:c.updatedAtMs}):await je.create({...We(d),enabled:!0});S(t),o(t)}catch(e){D(e instanceof Error?e.message:u.feedback.actionFailed)}finally{T.current=!1,w(!1)}}}return(0,K.jsx)(b,{open:!0,onOpenChange:e=>{!e&&!T.current&&a()},children:(0,K.jsxs)(_,{children:[(0,K.jsx)(m,{className:`fixed inset-0 z-[110] bg-black/45`}),(0,K.jsxs)(v,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[111] flex h-[min(38rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,K.jsx)(y,{className:`text-base font-semibold text-fg`,children:c?l?`修改执行时间`:`Edit execution schedule`:l?`设置执行时间`:`Set execution time`}),(0,K.jsx)(g,{asChild:!0,children:(0,K.jsx)(V,{variant:`ghost`,className:`size-9 p-0`,disabled:C,"aria-label":l?`关闭`:`Close`,children:(0,K.jsx)(z,{className:`size-4`})})})]}),(0,K.jsx)(h,{className:`sr-only`,children:l?`为当前任务创建定时或周期自动化。`:`Create a scheduled or recurring automation for this task.`}),x?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,K.jsx)(`p`,{role:`status`,className:`text-sm font-medium text-fg`,children:c?l?`执行时间已更新`:`Schedule updated`:l?`执行时间已设置`:`Schedule created`}),(0,K.jsx)(`p`,{className:`break-words text-sm text-fg-muted`,children:x.name}),(0,K.jsx)(V,{asChild:!0,variant:`primary`,children:(0,K.jsx)(s,{to:`/automations?automation=${encodeURIComponent(x.id)}`,children:l?`查看自动化`:`View automation`})})]}),(0,K.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:(0,K.jsx)(V,{onClick:a,children:l?`完成`:`Done`})})]}):(0,K.jsxs)(`form`,{onSubmit:e=>void k(e),className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,K.jsxs)(`p`,{className:`break-words text-sm text-fg-muted`,children:[l?`执行任务:`:`Task: `,t]}),(0,K.jsxs)(`fieldset`,{disabled:C,className:`space-y-4`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.name,(0,K.jsx)(`input`,{required:!0,readOnly:!!c?.management,className:Ct,value:d.name,onChange:e=>O({name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.trigger,(0,K.jsxs)(N,{value:d.triggerMode,onChange:e=>O({triggerMode:e.target.value}),children:[c?.trigger.kind===`schedule`&&c.trigger.schedule.kind===`interval`?(0,K.jsx)(P,{value:`interval`,children:l?`固定间隔`:`Fixed interval`}):null,c?.trigger.kind===`schedule`&&c.trigger.schedule.kind===`cron`?(0,K.jsx)(P,{value:`cron`,children:l?`自定义规则`:`Custom schedule`}):null,(0,K.jsx)(P,{value:`once`,children:u.trigger.once}),(0,K.jsx)(P,{value:`daily`,children:u.trigger.daily}),(0,K.jsx)(P,{value:`weekly`,children:u.trigger.weekly})]})]}),d.triggerMode===`once`?(0,K.jsx)(Ze,{label:u.form.onceAt,disabled:C,value:d.onceAt,defaultTime:d.time,onChange:e=>O({onceAt:e})}):[`daily`,`weekly`].includes(d.triggerMode)?(0,K.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,K.jsx)(`span`,{children:u.form.time}),(0,K.jsx)(Ke,{disabled:C,value:d.time,onChange:e=>O({time:e}),ariaLabel:u.form.time})]}):null,d.triggerMode===`weekly`?(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.day,(0,K.jsx)(N,{value:d.weekday,onChange:e=>O({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,K.jsx)(P,{value:String(t),children:u.weekdays[e]},e))})]}):null,d.triggerMode===`cron`?(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`定时规则`:`Cron expression`,(0,K.jsx)(`input`,{required:!0,className:Ct,value:d.cronExpr,onChange:e=>O({cronExpr:e.target.value})})]}):null,d.triggerMode===`interval`?(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`执行间隔`:`Interval`,(0,K.jsx)(`input`,{required:!0,type:`number`,min:`1`,className:Ct,value:d.intervalValue,onChange:e=>O({intervalValue:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`单位`:`Unit`,(0,K.jsxs)(N,{value:d.intervalUnit,onChange:e=>O({intervalUnit:e.target.value}),children:[(0,K.jsx)(P,{value:`minute`,children:l?`分钟`:`Minutes`}),(0,K.jsx)(P,{value:`hour`,children:l?`小时`:`Hours`}),(0,K.jsx)(P,{value:`day`,children:l?`天`:`Days`}),(0,K.jsx)(P,{value:`week`,children:l?`周`:`Weeks`})]})]})]}):null,(0,K.jsx)(Ue,{form:d,onChange:O,language:i}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.draft.notifications,(0,K.jsxs)(N,{disabled:!!c?.management,value:d.notificationPolicy,onChange:e=>O({notificationPolicy:e.target.value}),children:[(0,K.jsx)(P,{value:`attention`,children:u.draft.notifyAttention}),(0,K.jsx)(P,{value:`all`,children:u.draft.notifyAll}),(0,K.jsx)(P,{value:`none`,children:u.draft.notifyNone})]})]})]}),!c&&!r?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l?`请先为任务指定执行 Agent。`:`Assign an executor agent to the task first.`}):null,E?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:E}):null]}),(0,K.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,K.jsx)(V,{type:`button`,variant:`ghost`,disabled:C,onClick:a,children:l?`取消`:`Cancel`}),(0,K.jsx)(V,{type:`submit`,variant:`primary`,disabled:C||!c&&!r||!d.name.trim()||d.triggerMode===`once`&&!d.onceAt,children:C?l?`正在保存…`:`Saving…`:c?c.enabled?l?`保存修改`:`Save changes`:l?`保存并启用`:`Save and enable`:l?`创建自动化`:`Create automation`})]})]})]})]})})}function Tt(e){let t=(0,G.c)(49),{detail:n,executorName:r,language:i,onUpdated:a,ref:o}=e,c=i===`zh`,l;t[0]===n.waits?l=t[1]:(l=n.waits.find(Ot),t[0]=n.waits,t[1]=l);let u=l,d,f,p,m,h,g,_,v,y;if(t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==a||t[6]!==u||t[7]!==o||t[8]!==c){d=n.allowedCommands.includes(`resolve_wait`)&&!u?n.waits.filter(Dt):[];let e=n.presentation.status===`needsUser`,l;t[18]===n?l=t[19]:(l=Se(n),t[18]=n,t[19]=l);let b=l,S;t[20]===n.runs?S=t[21]:(S=n.runs.find(Et),t[20]=n.runs,t[21]=S);let C=S,w=c?`等待开始执行。`:`Waiting to start.`,T=r?c?`${r} 正在处理任务。`:`${r} is working on the task.`:c?`任务处理中。`:`The task is in progress.`,E=c?`任务正在等待继续。`:`The task is waiting to resume.`,D=c?`正在检查执行结果。`:`Checking the result.`,O;t[22]!==w||t[23]!==T||t[24]!==E||t[25]!==D?(O={queued:w,running:T,waiting:E,verifying:D},t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O):O=t[26];let k=O;p=n.presentation.reason??u?.reason??n.waits[0]?.reason??(n.task.phase===`closed`?b?.summary??(c?`任务已关闭,可查看交付物与执行结果。`:`The task is closed. Review its deliverables and results.`):n.task.phase===`review`?c?`请检查交付物并勾选通过的验收项。`:`Review the deliverables and check the criteria that pass.`:(C&&k[C.status])??b?.summary??(c?`任务尚未开始,可开始执行或设置执行时间。`:`Start the task or set an execution time.`)),f=n.attention.length>0?(0,K.jsx)(`ul`,{className:`mt-3 space-y-3`,children:n.attention.map((e,t)=>{let r=d.some(t=>e.kind===`input_required`&&t.kind===`user_input`||e.kind===`approval_required`&&t.kind===`approval`);return(0,K.jsxs)(`li`,{className:`text-sm leading-6 text-fg-muted`,children:[(0,K.jsx)(U,{content:e.summary,contentKey:`${n.task.id}:attention:${e.kind}:${t}`,language:i,previewHeight:72,children:(0,K.jsx)(x,{content:fe(e.summary),compact:!0,breaks:!0})}),!r&&(e.kind===`input_required`||e.kind===`approval_required`)?(0,K.jsx)(s,{className:`mt-2 inline-flex min-h-11 items-center rounded-lg bg-accent-soft px-3 font-medium text-accent-fg`,to:ae(n.task.id),children:c?e.kind===`approval_required`?`查看并决定`:`补充信息`:e.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${e.kind}-${t}`)})}):null,m=o,h=-1,g=c?`当前需要处理`:`Current action`,_=`rounded-xl bg-surface-panel p-4`;let A=e?c?`需要你处理`:`Your action needed`:c?`当前进展`:`Current progress`,j=d.length>1?` · ${d.length}`:``;t[27]!==A||t[28]!==j?(v=(0,K.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[A,j]}),t[27]=A,t[28]=j,t[29]=v):v=t[29];let M;t[30]!==n||t[31]!==a||t[32]!==c?(M=e=>(0,K.jsx)(Qe,{wait:e,detail:n,zh:c,onUpdated:a},e.id),t[30]=n,t[31]=a,t[32]=c,t[33]=M):M=t[33],y=d.map(M),t[2]=n,t[3]=r,t[4]=i,t[5]=a,t[6]=u,t[7]=o,t[8]=c,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y}else d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17];let b;t[34]!==d.length||t[35]!==f||t[36]!==n.task||t[37]!==i||t[38]!==p||t[39]!==c?(b=d.length>0?f?(0,K.jsxs)(`details`,{className:`mt-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:c?`等待详情`:`Waiting details`}),f]}):null:f??(0,K.jsx)(U,{content:p,contentKey:`${n.task.id}:current-progress`,language:i,previewHeight:72,className:`mt-2 text-sm leading-6 text-fg-muted`,children:(0,K.jsx)(x,{content:fe(p),compact:!0})}),t[34]=d.length,t[35]=f,t[36]=n.task,t[37]=i,t[38]=p,t[39]=c,t[40]=b):b=t[40];let S;return t[41]!==m||t[42]!==h||t[43]!==g||t[44]!==_||t[45]!==v||t[46]!==y||t[47]!==b?(S=(0,K.jsxs)(`section`,{ref:m,tabIndex:h,"aria-label":g,className:_,children:[v,y,b]}),t[41]=m,t[42]=h,t[43]=g,t[44]=_,t[45]=v,t[46]=y,t[47]=b,t[48]=S):S=t[48],S}function Et(e){return!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)}function Dt(e){return(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`}function Ot(e){return e.kind===`paused`}function kt(e){let t=(0,G.c)(17),{children:n,contentKey:r,language:a,className:o}=e,s=(0,W.useId)(),c=W.Children.toArray(n),[l,u]=i(),d;t[0]!==r||t[1]!==l?(d=l.getAll(`taskExpanded`).includes(r),t[0]=r,t[1]=l,t[2]=d):d=t[2];let f=d,p=f?c:c.slice(0,3),m;t[3]!==s||t[4]!==p?(m=(0,K.jsx)(`ul`,{id:s,className:`space-y-1.5`,children:p}),t[3]=s,t[4]=p,t[5]=m):m=t[5];let h;t[6]!==r||t[7]!==f||t[8]!==s||t[9]!==c.length||t[10]!==a||t[11]!==u?(h=c.length>3?(0,K.jsx)(`button`,{type:`button`,"aria-expanded":f,"aria-controls":s,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>u(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);return t.delete(`taskExpanded`),n.forEach(e=>t.append(`taskExpanded`,e)),f||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:a===`zh`?f?`收起`:`查看全部(${c.length})`:f?`Show less`:`Show all (${c.length})`}):null,t[6]=r,t[7]=f,t[8]=s,t[9]=c.length,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==o||t[14]!==m||t[15]!==h?(g=(0,K.jsxs)(`div`,{className:o,children:[m,h]}),t[13]=o,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function At({taskId:e}){let t=u(e=>e.conversationId),n=d(e=>e.language),[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)([]),[_,v]=(0,W.useState)(null),y=l(`/api/tasks/${encodeURIComponent(e)}/collaboration`),{data:b,error:x,mutate:S}=pe([`task-collaboration`,e,t],()=>f(`${y}?recent=1`),{revalidateOnFocus:!0}),C=[...new Map([...h,...b?.items??[]].map(e=>[e.id,e])).values()].sort((e,t)=>e.sequence-t.sequence),w=async()=>{let e=C[0];if(!(!e||p)){m(!0);try{let t=await f(`${y}?recent=1&beforeSequence=${e.sequence}`);g(e=>[...t.items,...e])}catch(e){v(e instanceof Error?e.message:String(e))}finally{m(!1)}}};(0,W.useEffect)(()=>{let t=t=>{let n=t.detail;(!n?.taskId||n.taskId===e)&&S()};return window.addEventListener(`task-collaboration-entry-added`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-collaboration-entry-added`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[S,e]);let T=async()=>{if(!(!r.trim()||s)){c(!0),v(null);try{await f(y,{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({kind:a?`answer`:`instruction`,body:r.trim(),...a?{causationId:a}:{}})}),i(``),o(null),await S()}catch(e){v(e instanceof Error?e.message:String(e))}finally{c(!1)}}};return(0,K.jsxs)(`section`,{className:`rounded-xl bg-surface-inset p-4`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n===`zh`?`任务留言`:`Task updates`}),(0,K.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-2 overflow-y-auto`,children:[!b&&!x?(0,K.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,K.jsx)(le,{className:`h-14 w-full`}),(0,K.jsx)(le,{className:`h-14 w-4/5`})]}):null,x?(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:n===`zh`?`暂时无法读取留言`:`Updates unavailable`}):null,C[0]&&C[0].sequence>1?(0,K.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>void w(),className:`text-xs text-accent hover:underline disabled:opacity-50`,children:n===`zh`?`查看更早留言`:`Earlier updates`}):null,C.map(t=>(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 text-sm`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,K.jsx)(`span`,{children:t.authorKind===`worker_agent`?n===`zh`?`执行 Agent`:`Worker`:t.authorKind===`main_agent`?n===`zh`?`主 Agent`:`Main Agent`:t.authorKind===`system`?n===`zh`?`系统`:`System`:n===`zh`?`用户`:`You`}),(0,K.jsxs)(`span`,{children:[`· `,t.kind]}),t.deliveryStatus?(0,K.jsxs)(`span`,{children:[`· `,t.deliveryStatus]}):null]}),(0,K.jsx)(`div`,{className:`mt-1 min-w-0 text-fg`,"data-task-collaboration-body":!0,children:(0,K.jsx)(U,{content:t.body,contentKey:`${e}:update:${t.id}`,language:n,breaks:!0,previewHeight:120})}),t.kind===`question`&&t.authorKind===`worker_agent`?(0,K.jsx)(`button`,{type:`button`,className:`mt-2 text-xs text-accent hover:underline`,onClick:()=>o(t.id),children:n===`zh`?`回复问题`:`Reply`}):null]},t.id)),b&&!C.length?(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n===`zh`?`暂无进展留言`:`No updates yet`}):null]}),a?(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-accent`,children:[n===`zh`?`正在回复执行 Agent 的问题`:`Replying to the worker`,(0,K.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>o(null),children:n===`zh`?`取消`:`Cancel`})]}):null,(0,K.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),rows:2,"aria-label":n===`zh`?`任务留言`:`Task message`,placeholder:n===`zh`?`给执行 Agent 留言`:`Message the worker`,className:`mt-3 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),_?(0,K.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:_}):null,(0,K.jsx)(`button`,{type:`button`,disabled:!r.trim()||s,onClick:()=>void T(),className:`mt-2 rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white disabled:opacity-50`,children:s?n===`zh`?`发送中`:`Sending`:n===`zh`?`发送`:`Send`})]})}function jt(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Mt(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}function Nt(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function Pt(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ft(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var It=[`backlog`,`ready`,`active`,`review`,`closed`],Lt=[`low`,`normal`,`high`,`critical`],Rt=(0,W.memo)(function(e){let t=(0,G.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:l}=e,u;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(u=e=>e!==n&&!i&&!(e===`closed`?a:n===`closed`&&o),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=u):u=t[4];let d=u,f;t[5]===c?f=t[6]:(f=(0,K.jsx)(`span`,{children:c}),t[5]=c,t[6]=f);let p;t[7]===l?p=t[8]:(p=e=>l(e.target.value),t[7]=l,t[8]=p);let m;t[9]!==s||t[10]!==d?(m=It.map(e=>(0,K.jsx)(P,{value:e,disabled:d(e),children:Nt(e,s)},e)),t[9]=s,t[10]=d,t[11]=m):m=t[11];let h;t[12]!==r||t[13]!==p||t[14]!==m||t[15]!==n?(h=(0,K.jsx)(N,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:p,children:m}),t[12]=r,t[13]=p,t[14]=m,t[15]=n,t[16]=h):h=t[16];let g;return t[17]!==f||t[18]!==h?(g=(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[f,h]}),t[17]=f,t[18]=h,t[19]=g):g=t[19],g}),zt=(0,W.memo)(function(e){let t=(0,G.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,K.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=Lt.map(e=>(0,K.jsx)(P,{value:e,children:a[e]},e)),t[4]=a,t[5]=l);let u;t[6]!==r||t[7]!==c||t[8]!==l||t[9]!==n?(u=(0,K.jsx)(N,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:l}),t[6]=r,t[7]=c,t[8]=l,t[9]=n,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,u]}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}),Bt=(0,W.memo)(function(e){let t=(0,G.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,K.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,K.jsx)(Ge,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Vt=(0,W.memo)(function(e){let t=(0,G.c)(36),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,language:s,onChange:c}=e,l,u,d,f,m,h,g,_,v,y;if(t[0]!==o||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==c||t[5]!==a||t[6]!==n){let{agentsSettings:e}=p(s);v=`grid gap-1.5 text-xs text-fg-muted`,t[17]===i?y=t[18]:(y=(0,K.jsx)(`span`,{children:i}),t[17]=i,t[18]=y),l=N,u=`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,d=`border-0`,f=n,m=r,t[19]===c?h=t[20]:(h=e=>c(e.target.value),t[19]=c,t[20]=h),t[21]===a?g=t[22]:(g=(0,K.jsx)(P,{value:``,disabled:!0,children:a}),t[21]=a,t[22]=g),_=o.map(t=>(0,K.jsx)(P,{value:t.id,children:Me(t,e)},t.id)),t[0]=o,t[1]=r,t[2]=i,t[3]=s,t[4]=c,t[5]=a,t[6]=n,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else l=t[7],u=t[8],d=t[9],f=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16];let b;t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f||t[27]!==m||t[28]!==h||t[29]!==g||t[30]!==_?(b=(0,K.jsxs)(l,{triggerClassName:u,contentClassName:d,value:f,disabled:m,onChange:h,children:[g,_]}),t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=m,t[28]=h,t[29]=g,t[30]=_,t[31]=b):b=t[31];let x;return t[32]!==b||t[33]!==v||t[34]!==y?(x=(0,K.jsxs)(`label`,{className:v,children:[y,b]}),t[32]=b,t[33]=v,t[34]=y,t[35]=x):x=t[35],x}),Ht=(0,W.memo)(function(e){let t=(0,G.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(Qt),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,K.jsx)(tt,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Ut=`xopc.taskDetail.chatPanelPercent`,Wt=42;function Gt(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Wt:Math.min(r,Math.max(n,e))}function Kt(){try{let e=Number(window.localStorage.getItem(Ut));return Number.isFinite(e)&&e>=30&&e<=60?e:Wt}catch{return Wt}}function qt(e){let t=(0,G.c)(13),{items:n,empty:r,contentKey:i}=e,a=d(Yt);if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,K.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let o;t[2]===n?o=t[3]:(o=n.join(`
3
- `),t[2]=n,t[3]=o);let s;t[4]===n?s=t[5]:(s=n.map(Jt),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,K.jsx)(`ul`,{className:`space-y-2`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==c?(l=(0,K.jsx)(U,{content:o,contentKey:i,language:a,previewHeight:144,children:c}),t[8]=i,t[9]=a,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}function Jt(e){return(0,K.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,K.jsx)(F,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,K.jsx)(`span`,{className:`min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e})]},e)}function Yt(e){return e.language}function Xt({taskId:e,presentation:t,backgroundPath:n,onDeleted:r,onHeaderChange:o}){let[l,f]=i(),m=c(),h=d(e=>e.language),g=u(e=>e.conversationId),_=(0,W.useMemo)(()=>Oe(h),[h]),v=ke(e=>e.setPageHeader),y=ke(e=>e.clearPageHeader),b=De(e=>e.panes),x=S(e=>e.openForSession),{data:C,error:T,mutate:k,lastChange:A,conversationLoading:j,conversationError:M}=w(e),{data:N,error:P,mutate:F}=pe(e?[`task-detail-automations`,g]:null,()=>je.list(),{refreshInterval:3e4}),[R,z]=(0,W.useState)(null),[fe,me]=(0,W.useState)(null),[H,Be]=(0,W.useState)(()=>new Set),[Ve,He]=(0,W.useState)([]),[Ue,We]=(0,W.useState)(null),[Ge,Ke]=(0,W.useState)([]),[Ye,Ze]=(0,W.useState)(!1),[Qe,$e]=(0,W.useState)(``),[tt,G]=(0,W.useState)(!1),[at,st]=(0,W.useState)(``),[ct,lt]=(0,W.useState)(Kt),[dt,pt]=(0,W.useState)(!1),mt=(0,W.useRef)(null),ht=(0,W.useRef)(null),gt=(0,W.useRef)(null),{key:_t,state:vt}=a(),yt=vt?.focusTaskResults,Ct=!!C;(0,W.useEffect)(()=>{if(!Ct||yt!==e)return;let t=requestAnimationFrame(()=>{ht.current?.scrollIntoView?.({block:`start`}),ht.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[yt,_t,Ct,e]);let Et=(0,W.useRef)(null),Dt=(0,W.useRef)(null),[Ot,Nt]=(0,W.useState)(!1),It=(0,W.useRef)(!1),Lt=(0,W.useRef)(!1),Jt=(0,W.useRef)(``),Yt=(0,W.useRef)(null),Xt=(0,W.useRef)(null),Zt=(0,W.useRef)(null),Qt=(0,W.useRef)(C),[$t,q]=(0,W.useState)(null),[en,tn]=(0,W.useState)(null),[nn,rn]=(0,W.useState)(!1),[an,on]=(0,W.useState)(!1),[sn,cn]=(0,W.useState)(null),ln=(0,W.useRef)(null),un=(0,W.useMemo)(()=>({link:_.linkDependencies,linked:_.linkedDependencies,searchPlaceholder:_.dependencySearchPlaceholder,noMatches:_.noDependencyMatches,noCandidates:_.noDependencyCandidates,remove:_.removeDependency}),[_.dependencySearchPlaceholder,_.linkDependencies,_.linkedDependencies,_.noDependencyCandidates,_.noDependencyMatches,_.removeDependency]),dn=C?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,fn=(0,W.useMemo)(()=>ne(l.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[l]),pn=(0,W.useCallback)(e=>t===`modal`&&n?ie(n,e):re(`/tasks/${encodeURIComponent(e)}`,fn),[n,t,fn]);Qt.current=C;let J=(0,W.useCallback)((e,t)=>{Be(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,W.useEffect)(()=>{z(null),me(null),q(null),Ze(!1),Yt.current=null,G(!1),tn(null),rn(!1),on(!1),cn(null)},[e]),(0,W.useEffect)(()=>{let e=!0;return Ee().then(t=>{e&&Ke(t.items)}).catch(()=>void 0),()=>{e=!1}},[g]),(0,W.useEffect)(()=>{if(!A||A.source===`user`)return;tn(A);let e=window.setTimeout(()=>tn(null),3500);return()=>window.clearTimeout(e)},[A]),(0,W.useEffect)(()=>{let t=C?.task.projectId,n=C?.dependencies??[];if(!t){Zt.current=null,We(null),He(n);return}Zt.current!==t&&(Zt.current=t,We(null));let r=!0;return de(t).then(t=>{if(!r)return;We(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});He([...i.values()])}).catch(()=>{r&&He(n)}),()=>{r=!1}},[dn,C?.task.projectId,e]);let Y=(0,W.useCallback)(async(t,n=`command`)=>{let r=Qt.current;if(r){J(n,!0),z(null),t.type===`signoff`&&me(null);try{await k(await we(e,t,r.task.version),{revalidate:!1})}catch{z(_.actionFailed),t.type===`signoff`&&me(_.actionFailed)}finally{J(n,!1)}}},[_.actionFailed,k,J,e]),mn=(0,W.useCallback)(async(t,n)=>{let r=Qt.current;if(!r)return!1;n&&J(n,!0),z(null);try{let n=ge(e,t,r.task.version);return await k(n,{optimisticData:Mt(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return z(_.actionFailed),!1}finally{n&&J(n,!1)}},[_.actionFailed,k,J,e]),hn=()=>{C&&(Yt.current={value:C.task.title,version:C.task.version},q(null),$e(C.task.title),Ze(!0))},gn=()=>{It.current=!0,$e(Qt.current?.task.title??``),Yt.current=null,q(null),Ze(!1),queueMicrotask(()=>{It.current=!1})},_n=async(e=!1)=>{if(It.current){It.current=!1;return}let t=Qt.current;if(!t||H.has(`title`))return;let n=Qe.trim();if(!n){gn();return}let r=Yt.current;if(!e&&jt(r,t.task.version,t.task.title,n)){q(`title`);return}if(n===t.task.title){gn();return}await mn({title:n},`title`)&&(Yt.current=null,q(null),Ze(!1))},vn=async()=>{if(!C)return;if(Lt.current){Lt.current=!1;return}let e=at.trim(),t=Xt.current;if(jt(t,C.task.version,C.task.body??``,e)){q(`description`);return}if(at===Jt.current||e===(C.task.body??``).trim()){G(!1);return}await mn({body:e||null})&&(q(null),G(!1))},yn=(0,W.useCallback)(async e=>{let t=Qt.current;!t||e===t.task.phase||await Y({type:`move`,phase:e},`phase`)},[Y]),bn=(0,W.useCallback)(e=>{mn({priority:e},`priority`)},[mn]),xn=(0,W.useCallback)(e=>{mn({dueAt:Ft(e)},`dueAt`)},[mn]),Sn=(0,W.useCallback)(e=>{lt(e);try{window.localStorage.setItem(Ut,String(e))}catch{}},[]),Cn=(0,W.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=Et.current?.clientWidth??0,n=e.key===`Home`?Wt:ct+(e.key===`ArrowLeft`?2:-2);Sn(Gt(n,t))},[ct,Sn]),wn=(0,W.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=Et.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),pt(!0);let i=ct,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Gt((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}pt(!1),Sn(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[ct,Sn]),Tn=(0,W.useCallback)(async t=>{let n=Qt.current;if(n){J(`dependencies`,!0),z(null);try{await k(await he(e,t,n.task.version),{revalidate:!1})}catch{z(_.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[_.dependencyUpdateFailed,k,J,e]),En=(0,W.useCallback)(async t=>{let n=Qt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),z(null);try{await k(await _e(e,t,n.task.version),{revalidate:!1})}catch{z(_.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[_.actionFailed,k,J,e]),Dn=(0,W.useCallback)(async()=>{J(`delete`,!0),z(null);try{await ye(e),r?r():m(fn,{replace:!0})}catch(e){z(e instanceof Error?e.message:_.actionFailed)}finally{J(`delete`,!1)}},[_.actionFailed,m,r,fn,J,e]),On=(0,W.useCallback)(async(t,n,r)=>{if(!t.acceptanceTarget)return!1;J(`acceptance`,!0),me(null),z(null);try{return await k(await Te(e,ue(e,t.task.latestContractVersion,n),r,t.task.version,t.task.latestContractVersion,t.acceptanceTarget.id),{revalidate:!1}),!0}catch{return me(_.actionFailed),z(_.actionFailed),k().catch(()=>void 0),!1}finally{J(`acceptance`,!1)}},[_.actionFailed,k,J,e]),kn=C?.task.title,An=kn!==void 0;if((0,W.useLayoutEffect)(()=>{let e=Dt.current,t=e?.parentElement;if(!An||!e||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(([e])=>{let n=it(t),r=n?n.getBoundingClientRect().top+n.clientTop:0;Nt(!e.isIntersecting&&e.boundingClientRect.bottom<=r)});return n.observe(e),()=>n.disconnect()},[An,e]),(0,W.useLayoutEffect)(()=>{o?.({taskId:e,title:kn,compact:Ot})},[Ot,o,e,kn]),(0,W.useLayoutEffect)(()=>{if(t!==`modal`)return v({startExtra:(0,K.jsx)(s,{to:fn,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":_.backToWork,children:(0,K.jsx)(D,{className:`size-4`})}),main:An?(0,K.jsx)(`div`,{className:`min-w-0 text-sm font-semibold text-fg`,children:(0,K.jsx)(Xe,{label:Ue?`${Ue} / ${_.taskLabel}`:_.taskLabel,title:kn,compact:Ot})}):null,end:e?(0,K.jsx)(s,{to:`/space?taskId=${encodeURIComponent(e)}`,className:`rounded-lg px-2.5 py-2 text-sm text-fg-muted hover:bg-surface-hover`,children:h===`zh`?`成果`:`Results`}):null}),y},[y,Ot,_.backToWork,_.taskLabel,An,h,t,Ue,fn,v,e,kn]),T&&!C)return(0,K.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:_.taskNotFound});if(!C)return(0,K.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,K.jsx)(Je,{})});let jn=C.waits[0],X=C.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),Mn=ve(C),Nn=Mn.length>0&&Mn.every(e=>e.status===`passed`),Pn=C.waits.find(e=>e.kind===`paused`),Fn=Se(C),In=Ce(C),Ln=_.detailStatuses[In],Rn=C.task.body?.trim()||C.task.contract?.objective.trim()||``,zn=C.allowedCommands.includes(`mark_ready`),Bn=C.allowedCommands.includes(`start`),Vn=C.allowedCommands.includes(`add_wait`),Hn=!jn&&!X&&Nn&&C.presentation.primaryAction?.type===`review`&&C.allowedCommands.includes(`close`),Un=C.allowedCommands.includes(`reopen`),Z=C.conversation.activeConversationId,Q=C.conversation.currentExecutorAgentId??C.task.delegateAgentId??C.task.ownerId,Wn=Ge.find(e=>e.id===Q),Gn=p(h).agentsSettings,Kn=Wn?Me(Wn,Gn):void 0,qn=X?.executorKind===`agent`?Ge.find(e=>e.id===(X.executorRef.agentId??C.conversation.currentExecutorAgentId)):void 0,Jn=qn?Me(qn,Gn):void 0,Yn=!!(Z&&b[Z]?.open),Xn=C.context.filter(e=>e.role!==`deliverable`),Zn=N?.automations.filter(t=>t.action.kind===`task_command`&&t.action.taskId===e)??[],$=Zn.filter(e=>e.trigger.kind===`schedule`&&e.action.kind===`task_command`&&e.action.command.type===`start`),Qn=$.filter(e=>e.enabled&&e.state.nextRunAtMs!==void 0).map(e=>e.state.nextRunAtMs).sort((e,t)=>e-t)[0],$n=e=>{F(t=>({automations:[e,...(t?.automations??[]).filter(t=>t.id!==e.id)]}),{revalidate:!1})},er=e=>{cn(e),on(!0)},tr=()=>{N&&($.length===1?er($[0]):$.length>1?(ln.current&&(ln.current.open=!0),f(e=>nt(e,`schedule`,!0),{preventScrollReset:!0}),ln.current?.scrollIntoView({block:`start`,behavior:`smooth`}),ln.current?.focus({preventScroll:!0})):(cn(null),on(!0)))},nr=C.sessions.filter((e,t,n)=>n.findIndex(t=>t.conversationId===e.conversationId)===t),rr=C.task.contract?.expectedOutputs??[],ir=C.task.contract?.constraints??[],ar=C.task.contract?.approvalRequired??[],or=C.task.contract?.assumptions??[],sr=C.task.contract?.risks??[],cr=ir.length>0||ar.length>0||or.length>0||sr.length>0,lr=(...e)=>!!en?.changedFields.some(t=>e.includes(t)),ur=C.allowedCommands.includes(`move`),dr=H.has(`command`),fr=H.has(`delete`),pr=X!==void 0,mr=()=>{let e=mt.current;e&&(e.open=!0,f(e=>nt(e,`acceptance`,!0),{preventScrollReset:!0}),e.scrollIntoView({block:`start`,behavior:`smooth`}),e.focus({preventScroll:!0}))},hr=C.presentation.primaryAction,gr=()=>{Q&&Y({type:`start`,executor:{kind:`agent`,agentId:Q}})},_r=()=>{ht.current?.scrollIntoView({block:`start`,behavior:`smooth`}),ht.current?.focus({preventScroll:!0})},vr=(()=>{switch(hr?.type){case`mark_ready`:return{label:_.scheduleTask,activate:()=>void Y({type:`mark_ready`})};case`resume`:return{label:_.resumeTask,activate:()=>void Y({type:`resolve_wait`,waitId:hr.waitId})};case`resolve_wait`:{let t=C.waits.find(e=>e.id===hr.waitId),n=t&&t.condition.type!==`connection`&&(t.kind===`user_input`||t.kind===`approval`&&typeof t.condition.capability==`string`);return{label:h===`zh`?`处理待办`:`Resolve pending item`,activate:()=>n?gt.current?.focus():m(ae(e))}}case`inspect_run`:return{label:h===`zh`?`查看待处理事项`:`View pending issue`,activate:()=>gt.current?.focus()};case`review`:return{label:h===`zh`?`去验收`:`Review results`,activate:mr};case`signoff`:return{label:h===`zh`?`确认验收`:`Accept result`,activate:()=>void Y({type:`signoff`,resultId:hr.resultId})};case`view_results`:return{label:h===`zh`?`查看结果`:`View results`,activate:_r};case`retry_allocation`:return{label:h===`zh`?`重新分配`:`Retry assignment`,activate:()=>void Y({type:`retry_allocation`})};case`retry_run`:{let e=C.runs.find(e=>e.id===hr.runId),t=e?.executorKind===`agent`&&typeof e.executorRef.agentId==`string`?e.executorRef.agentId:void 0;return{label:h===`zh`?`重试任务`:`Retry task`,disabled:!t,activate:()=>{t&&Y({type:`start`,executor:{kind:`agent`,agentId:t}})}}}case`start`:return{label:_.runTask,activate:gr,disabled:!Q}}})(),yr=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[vr?(0,K.jsx)(V,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:dr||vr.disabled,onClick:vr.activate,children:vr.label}):null,Un?(0,K.jsxs)(V,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`ghost`,disabled:dr,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,K.jsx)(ce,{className:`size-4`}),_.reopenTask]}):null,C.task.phase!==`review`&&!Pn&&Vn?(0,K.jsxs)(V,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:dr,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,K.jsx)(se,{className:`size-4`}),_.pauseTask]}):null,!jn&&!X&&C.task.phase!==`closed`&&C.task.phase!==`review`?(0,K.jsxs)(V,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:!N,onClick:tr,children:[(0,K.jsx)(O,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`]}):null,(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Fe,{asChild:!0,children:(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:dr||fr,"aria-label":_.moreActions,children:(0,K.jsx)(I,{className:`size-4`,"aria-hidden":!0})})}),(0,K.jsx)(Ie,{children:(0,K.jsxs)(Re,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[C.task.phase===`review`&&!Pn&&Vn?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:_.pauseTask}):null,C.task.phase===`review`&&!jn&&!X?(0,K.jsx)(Le,{disabled:!N,className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:opacity-50`,onSelect:tr,children:$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`}):null,C.task.phase===`review`&&!jn&&Bn&&Q?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Q}}),children:_.runTask}):null,zn&&(Bn||jn||C.task.phase===`review`)?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`mark_ready`}),children:_.scheduleTask}):null,X?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{J(`command`,!0),z(null),k(xe(e,X.id,X.version),{revalidate:!1}).catch(()=>z(_.actionFailed)).finally(()=>J(`command`,!1))},children:_.cancelActiveRun}):null,X?(0,K.jsx)(ze,{className:`my-1 h-px bg-edge`}):null,C.task.phase===`closed`?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:_.cancelTask}),(0,K.jsx)(ze,{className:`my-1 h-px bg-edge`})]}),(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(pr){z(_.deleteActiveTaskBlocked);return}rn(!0)},children:_.deleteTask})]})})]})]});return(0,K.jsxs)(`div`,{ref:Et,className:`flex h-full min-h-0 flex-col overflow-hidden ${dt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${ct}%`},children:[(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`task-detail-scroll flex min-w-0 shrink-0 flex-col bg-surface-base lg:min-h-0 lg:flex-1 lg:shrink lg:overflow-y-auto lg:overscroll-contain`,children:[(0,K.jsxs)(`header`,{ref:Dt,className:B(`shrink-0 px-4 py-5 sm:px-6 sm:py-6`,lr(`title`)&&`task-detail-live-update`),children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[Ue?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),Ue]}):null,Ue?(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`/`}):null,(0,K.jsx)(`span`,{children:_.taskLabel}),en?(0,K.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:en.source===`agent`?h===`zh`?`Agent 刚刚更新`:`Updated by Agent`:h===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ye?(0,K.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,"aria-label":h===`zh`?`任务标题`:`Task title`,rows:2,value:Qe,onFocus:e=>{Yt.current?.value===Qe&&(e.currentTarget.setSelectionRange(0,0),e.currentTarget.scrollTop=0)},onChange:e=>$e(e.target.value),onBlur:()=>void _n(),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),gn()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),e.currentTarget.blur()))},className:`mt-2 block max-h-56 min-h-14 w-full max-w-3xl resize-none overflow-y-auto bg-transparent p-0 text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl outline-none [field-sizing:content]`}):(0,K.jsx)(U,{content:C.task.title,contentKey:`${e}:title`,language:h,previewHeight:56,className:`mt-2 max-w-3xl`,children:(0,K.jsx)(`h1`,{className:`break-words text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl`,children:(0,K.jsx)(`button`,{type:`button`,className:`max-w-full whitespace-pre-wrap break-words [overflow-wrap:anywhere] rounded-sm text-left outline-none hover:bg-surface-hover/60 focus-visible:ring-2 focus-visible:ring-accent/40`,title:C.task.title,onClick:hn,children:C.task.title})})}),$t===`title`?(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,K.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:gn,children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,disabled:H.has(`title`),onClick:()=>void _n(!0),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,K.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium`,be(In)),children:Ln})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[Q?(0,K.jsx)(Ae,{agentId:Q,avatar:Wn?.avatar,size:20,className:`shrink-0`}):null,(0,K.jsxs)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[_.executorLabel,` · `,Kn??Q??_.unassigned]})]}),(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:_.updatedAt.replace(`{{date}}`,qe(C.task.updatedAt,h))})]})]}),(0,K.jsxs)(`div`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center justify-end gap-2 border-b border-edge-subtle bg-surface-panel px-4 py-2 sm:px-5`,"aria-label":h===`zh`?`任务操作`:`Task actions`,children:[yr,R?(0,K.jsx)(`p`,{role:`alert`,className:`basis-full text-sm text-danger`,children:R}):null,(0,K.jsx)(ot,{language:h,hasSchedule:$.length>0},e)]}),(0,K.jsxs)(`section`,{className:`min-w-0 space-y-4 p-4 sm:p-5`,children:[In===`review`?null:(0,K.jsx)(Tt,{ref:gt,detail:C,executorName:Jn,language:h,onUpdated:e=>{k(e,{revalidate:!1})}}),(0,K.jsxs)(`section`,{"data-task-section":`results`,"data-task-section-label":h===`zh`?`交付结果`:`Results`,ref:ht,tabIndex:-1,"aria-labelledby":`task-results-heading`,className:`scroll-mt-24 space-y-4`,children:[(0,K.jsx)(ft,{detail:C,language:h}),(0,K.jsx)(rt,{panelId:`acceptance`,chevron:!0,"data-task-section":`acceptance`,"data-task-section-label":h===`zh`?`验收`:`Acceptance`,defaultOpen:!0,ref:mt,tabIndex:-1,"aria-label":_.successDefinition,className:`scroll-mt-24 overflow-hidden rounded-2xl bg-surface-panel`,summaryClassName:`min-h-12 cursor-pointer px-4 py-2 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:(0,K.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[h===`zh`?`验收`:`Acceptance`,(0,K.jsxs)(`span`,{"aria-live":`polite`,className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium tabular-nums text-fg-muted`,children:[Mn.filter(e=>e.status===`passed`).length,`/`,Mn.length]})]}),children:(0,K.jsx)(ut,{criteria:Mn,language:h,closed:C.task.phase===`closed`,pending:H.has(`acceptance`),error:fe,reviewDisabled:!C.acceptanceTarget||C.presentation.primaryAction?.type===`inspect_run`,blockedReason:jn?h===`zh`?`请先处理待办事项`:`Resolve the pending request first`:X?h===`zh`?`请等待当前执行结束`:`Wait for the current run to finish`:void 0,onReview:(e,t)=>On(C,e,t),projectId:C.task.projectId,conversationId:Z??void 0},`${e}:${C.task.latestContractVersion}:${C.acceptanceTarget?.id??``}`)})]}),(0,K.jsx)(rt,{panelId:`report`,chevron:!0,defaultOpen:!0,"data-task-section":`report`,"data-task-section-label":h===`zh`?`执行报告`:`Report`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`完整执行报告`:`Full execution report`,children:(0,K.jsx)(bt,{detail:C,language:h},Fn?.runId??e)}),!N&&!P?(0,K.jsx)(le,{className:`h-9 rounded-lg`}):null,P?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-danger`,children:[(0,K.jsx)(`span`,{children:h===`zh`?`无法读取执行计划,请重试后再设置时间。`:`Could not load schedules. Retry before setting a time.`}),(0,K.jsx)(V,{variant:`ghost`,onClick:()=>void F(),children:h===`zh`?`重试`:`Retry`})]}):null,$.length>0?(0,K.jsx)(rt,{panelId:`schedule`,chevron:!0,defaultOpen:!0,"data-task-section":`schedule`,"data-task-section-label":h===`zh`?`执行时间`:`Schedule`,ref:ln,tabIndex:-1,className:`scroll-mt-24 rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm text-fg-muted`,title:(0,K.jsxs)(K.Fragment,{children:[h===`zh`?`执行时间`:`Execution schedule`,` · `,$.length,Qn===void 0?``:` · ${h===`zh`?`下次执行:`:`Next run: `}${qe(Qn,h)}`]}),children:(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(St,{schedules:$,language:h,onEdit:er,onUpdated:$n})})}):null,(0,K.jsx)(rt,{panelId:`goal`,chevron:!0,defaultOpen:!0,"data-task-section":`goal`,"data-task-section-label":h===`zh`?`目标说明`:`Goal`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`任务目标与说明`:`Task goal and description`,children:(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,K.jsxs)(`div`,{className:`border-b border-edge-subtle p-5`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h===`zh`?`任务目标`:`Task goal`}),(0,K.jsx)(U,{content:C.task.contract?.objective||C.task.title,contentKey:`${e}:goal`,language:h,markdown:!1,previewHeight:72,className:`mt-3 text-sm leading-6 text-fg`}),(0,K.jsxs)(V,{variant:`ghost`,className:`mt-2 min-h-9 px-2 text-xs`,onClick:mr,children:[_.successDefinition,` · `,Mn.length]})]}),rr.length>0?(0,K.jsxs)(`div`,{className:`p-5`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.expectedOutputs}),(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(qt,{contentKey:`${e}:expectedOutputs`,items:rr,empty:_.noDefinition})})]}):null,(0,K.jsxs)(`details`,{className:B(`p-5`,lr(`body`)&&`task-detail-live-update`),children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:_.taskDescription}),tt?(0,K.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:at,onChange:e=>st(e.target.value),onBlur:()=>void vn(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Lt.current=!0,st(C.task.body??C.task.contract?.objective??``),G(!1),queueMicrotask(()=>{Lt.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,K.jsxs)(`div`,{className:`mt-2`,children:[Rn&&Rn!==C.task.title?(0,K.jsx)(U,{content:Rn,contentKey:`${e}:description`,language:h}):(0,K.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:_.noTaskDescription}),(0,K.jsx)(`button`,{type:`button`,className:`mt-2 rounded-md px-2 py-1 text-xs text-accent hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=C.task.body??C.task.contract?.objective??``;Jt.current=e,Xt.current={value:C.task.body??``,version:C.task.version},q(null),st(e),G(!0)},children:h===`zh`?`编辑说明`:`Edit description`})]}),$t===`description`?(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,K.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{st(C.task.body??``),q(null),G(!1)},children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void mn({body:at.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),cr?(0,K.jsxs)(`section`,{className:B(`p-5`,lr(`contract`)&&`task-detail-live-update`),children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDefinition}),(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:h===`zh`?`执行边界及补充背景`:`Execution boundaries and supporting context`}),ir.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.constraints}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:constraints`,items:ir,empty:_.noDefinition})})]}):null,ar.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.approvalRequired}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:approvalRequired`,items:ar,empty:_.noDefinition})})]}):null,or.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextAssumptions}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:assumptions`,items:or,empty:_.noDefinition})})]}):null,sr.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextRisks}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:risks`,items:sr,empty:_.noDefinition})})]}):null]}):null]})})}),(0,K.jsxs)(rt,{panelId:`management`,chevron:!0,defaultOpen:!0,"data-task-section":`management`,"data-task-section-label":h===`zh`?`任务管理`:`Management`,"aria-label":h===`zh`?`任务管理`:`Task management`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`任务管理`:`Task management`,children:[(0,K.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,K.jsxs)(`section`,{className:B(`p-5`,lr(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskProperties}),(0,K.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,K.jsx)(Rt,{value:C.task.phase,disabled:H.has(`phase`),canMove:ur,canApprove:Hn,canReopen:Un,language:h,label:_.taskPhase,onChange:yn}),(0,K.jsx)(zt,{value:C.task.priority,disabled:H.has(`priority`),label:_.priority,labels:_.priorityLabels,onChange:bn}),(0,K.jsx)(Bt,{value:Pt(C.task.dueAt),disabled:H.has(`dueAt`),label:_.dueDate,onChange:xn}),(0,K.jsx)(Vt,{value:C.conversation.currentExecutorAgentId??``,disabled:H.has(`delegateAgentId`),label:_.executorLabel,unassignedLabel:_.unassigned,agents:Ge,language:h,onChange:En})]})]}),(0,K.jsxs)(`details`,{className:B(`p-5`,lr(`dependencies`)&&`task-detail-live-update`),children:[(0,K.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[_.taskRelations,` · `,C.dependencies.length,` / `,C.dependents.length]}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependencies}),(0,K.jsx)(Ht,{candidates:Ve,selected:C.dependencies,disabled:H.has(`dependencies`),labels:un,getTaskHref:pn,onChange:Tn})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependents}),C.dependents.length>0?(0,K.jsx)(`div`,{className:`space-y-1.5`,children:C.dependents.map(t=>(0,K.jsx)(U,{content:t.title,contentKey:`${e}:dependent:${t.id}`,language:h,previewHeight:72,className:`rounded-lg bg-surface-hover p-2.5`,children:(0,K.jsx)(s,{to:pn(t.id),className:`block break-words [overflow-wrap:anywhere] text-sm text-fg-muted transition-colors hover:text-fg`,children:t.title})},t.id))}):(0,K.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:_.noDependents})]})]})]})]}),C.task.phase===`closed`?null:(0,K.jsxs)(V,{variant:`ghost`,className:`my-3`,disabled:!N,onClick:tr,children:[(0,K.jsx)(O,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:_.scheduleRecurringTask]}),(0,K.jsxs)(`details`,{className:`mb-4 rounded-xl bg-surface-inset p-5`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:h===`zh`?`关联内容`:`Related work`}),nr.length>0||C.runs.length>0||Zn.length>0||C.dependencies.length>0||C.dependents.length>0?(0,K.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[nr.length>0?(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`对话 · ${nr.length}`:`Conversations · ${nr.length}`}),(0,K.jsx)(kt,{contentKey:`${e}:sessions`,language:h,className:`mt-2`,children:nr.map(t=>(0,K.jsx)(`li`,{children:(0,K.jsx)(s,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:t.conversationId===Z?ae(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===Z?h===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?h===`zh`?`关联讨论`:`Linked discussion`:h===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})]}):null,Zn.length>0?(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`自动化 · ${Zn.length}`:`Automations · ${Zn.length}`}),(0,K.jsx)(kt,{contentKey:`${e}:automations`,language:h,className:`mt-2`,children:Zn.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsx)(s,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:`/automations?automation=${encodeURIComponent(e.id)}`,children:e.name})},e.id))})]}):null,C.dependencies.length>0||C.dependents.length>0?(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.taskRelations}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg`,children:h===`zh`?`${C.dependencies.length} 个前置任务 · ${C.dependents.length} 个后续任务`:`${C.dependencies.length} prerequisites · ${C.dependents.length} dependents`})]}):null]}):(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h===`zh`?`还没有关联内容`:`No related work yet`}),(0,K.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:(0,K.jsx)(et,{resource:{kind:`task`,id:C.task.id,revision:String(C.task.version)},disabled:Ye||tt||H.size>0})})]}),Xn.length>0?(0,K.jsxs)(`section`,{className:B(`p-5`,lr(`context`)&&`task-detail-live-update`),children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.contextUsed}),(0,K.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:Xn.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,K.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[_.contextRoleLabels[e.role],` · `,_.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,K.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,K.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,K.jsx)(rt,{panelId:`activity`,chevron:!0,defaultOpen:!0,"data-task-section":`activity`,"data-task-section-label":h===`zh`?`活动留言`:`Activity`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-semibold text-fg`,title:h===`zh`?`活动记录与留言`:`Activity and updates`,children:(0,K.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[(0,K.jsx)(At,{taskId:e},e),(0,K.jsx)(xt,{changes:C.phaseChanges,language:h})]})})]})]}),(0,K.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(ct),tabIndex:0,onPointerDown:wn,onKeyDown:Cn,onDoubleClick:()=>Sn(Wt),className:`hidden w-2 shrink-0 cursor-col-resize touch-none bg-surface-panel outline-none focus-visible:bg-accent-soft lg:block`}),(0,K.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 shrink-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)]`,children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-4 py-3`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-medium text-fg-muted`,children:h===`zh`?`执行对话`:`Execution chat`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[nr.length>1?(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Fe,{asChild:!0,children:(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,children:h===`zh`?`${nr.length} 段对话`:`${nr.length} conversations`})}),(0,K.jsx)(Ie,{children:(0,K.jsx)(Re,{align:`end`,sideOffset:6,className:`z-[100] min-w-52 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:nr.map(t=>(0,K.jsx)(Le,{asChild:!0,children:(0,K.jsx)(s,{className:`block rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,to:t.conversationId===Z?ae(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===Z?h===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?h===`zh`?`关联讨论`:`Linked discussion`:h===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})})]}):null,Z?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:B(`size-8 p-0`,Yn&&`bg-surface-hover text-fg`),"aria-label":h===`zh`?`项目文件`:`Project files`,"aria-pressed":Yn,onClick:()=>{De.getState().openFiles(Z),x(Z)},children:(0,K.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),(0,K.jsx)(V,{asChild:!0,variant:`ghost`,className:`size-8 p-0`,children:(0,K.jsx)(s,{to:ae(e),"aria-label":h===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,K.jsx)(L,{className:`size-4`,"aria-hidden":!0})})})]}):null]})]}),Z?(0,K.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,K.jsx)(E,{embedded:!0,conversationId:Z,taskId:e})}):j?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-xs`,children:[(0,K.jsx)(oe,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):M?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-xs`,children:[(0,K.jsx)(oe,{className:`mx-auto size-8 text-danger`}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:M instanceof Error?M.message:String(M)})]})}):(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-xs`,children:[(0,K.jsx)(oe,{className:`mx-auto size-8 text-fg-subtle`}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:h===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]}),an?(0,K.jsx)(wt,{automation:sn??void 0,taskId:e,taskTitle:C.task.title,projectId:C.task.projectId,executorAgentId:Q,language:h,onClose:()=>on(!1),onCreated:$n},`${e}:${sn?.id??`new`}`):null,(0,K.jsx)(Ne,{open:nn,title:_.deleteTaskTitle,description:_.deleteTaskDescription.replace(`{{title}}`,C.task.title),confirmLabel:_.confirmDeleteTask,cancelLabel:_.keepTask,destructive:!0,onConfirm:()=>{rn(!1),Dn()},onCancel:()=>rn(!1)})]})}function Zt(){let e=(0,G.c)(2),{taskId:t}=o(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,K.jsx)(Xt,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Qt(e){return e.id}export{Zt as TaskDetailPage,Xt as TaskDetailView};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,g as a,m as o,t as s,u as c}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{i as l,l as u,n as d,o as f}from"./locale-store-B4o4aDCg.js";import{t as p}from"./messages-hlOsXkQ7.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-DlirbHVs.js";import{G as x,T as S,g as C,ot as w,q as T,t as E}from"./chat-page-CJiXMjMM.js";import{t as D}from"./arrow-left-D880xG-P.js";import{f as O,i as k,u as A}from"./automation-display-DaVDNZz8.js";import{t as j}from"./check-DUBLcKHA.js";import{t as M}from"./chevron-right-BweFrslA.js";import{n as N,r as P}from"./popover-select-hRG1EzAY.js";import{t as F}from"./circle-BoO4YvTx.js";import{t as I}from"./ellipsis-0k4rZLoy.js";import{t as L}from"./external-link-DjqjBmc3.js";import{t as R}from"./file-icon-N6WjUhq_.js";import{t as ee}from"./folder-kanban-CpLlFI1o.js";import{t as te}from"./folder-open-CyzJ19I9.js";import{B as ne,H as re,I as ie,P as ae}from"./markdown-view-BpBBv9Gr.js";import{t as oe}from"./message-square-fVE7Ghj1.js";import{t as se}from"./pause-DuPxgSxk.js";import{t as ce}from"./play-kxZvpBg8.js";import{t as z}from"./x-B_N4OPjy.js";import{t as B}from"./cn-0WouolD0.js";import{t as le}from"./skeleton-DzdOeGYz.js";import{d as ue}from"./tasks-BIehlq7k.js";import{c as de}from"./api-D0r-2gWQ.js";import{ht as fe}from"./session-manager-1UFhZMpv.js";import{i as pe}from"./vendor-swr-CdRzEUwF.js";import{C as me,D as he,T as ge,_ as _e,a as ve,f as ye,i as be,l as xe,n as Se,r as Ce,u as we,x as Te}from"./workspace-preview-store-DYd8E5bV.js";import{t as Ee}from"./chat-agents-api-B-47bqbd.js";import{t as V}from"./button-C5tRaJxt.js";import{r as De}from"./right-workspace-store-CFf15f36.js";import{c as Oe}from"./composer-payload-handoff-DKLokix8.js";import{t as ke}from"./page-header-store-D_2QZ6Ps.js";import{t as Ae}from"./agent-avatar-display-BDHjRaTK.js";import{t as je}from"./automation-api-CxLFngqe.js";import{n as Me}from"./agent-display-names-Bje7vfSn.js";import{t as H}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ne}from"./confirm-dialog-MHCmEEUZ.js";import{l as Pe,m as Fe,o as Ie,r as Le,t as Re,u as ze}from"./dist-DaFr5KMw.js";import{d as Be,f as Ve,l as He,o as Ue,u as We}from"./automation-task-card-f5_tNbzB.js";import{t as Ge}from"./date-picker-BWrSxZf1.js";import{t as Ke}from"./time-picker-otHjbob1.js";import{n as qe}from"./date-formatters-DukWSVwc.js";import{n as Je,r as Ye,t as Xe}from"./task-header-title-CRfK-rhR.js";import{t as Ze}from"./date-time-picker-Zhl9Yyzk.js";import{n as Qe,r as U,t as $e}from"./task-result-evidence-C2gEC9Hr.js";import{t as et}from"./page-context-capture-button-CNyjLpFG.js";import{t as tt}from"./dependency-picker-clYjcOx9.js";var W=e(t(),1),G=n(),K=r();function nt(e,t,n){let r=new URLSearchParams(e),i=r.getAll(`taskPanel`).filter(e=>e!==t&&e!==`${t}:closed`);r.delete(`taskPanel`);for(let e of i)r.append(`taskPanel`,e);return r.append(`taskPanel`,n?t:`${t}:closed`),r}function rt(e){let t=(0,G.c)(32),n,r,i,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],c=t[6],l=t[7]):({panelId:r,title:l,defaultOpen:s,children:n,summaryClassName:o,chevron:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c,t[7]=l);let u=s!==void 0&&s,d=c!==void 0&&c,[f,p]=a(),m;if(t[8]!==u||t[9]!==r||t[10]!==f){let e=f.getAll(`taskPanel`);m=e.includes(r)||u&&!e.includes(`${r}:closed`),t[8]=u,t[9]=r,t[10]=f,t[11]=m}else m=t[11];let h=m,g=o??`cursor-pointer py-2 text-xs text-fg-muted hover:text-fg`,_=d&&`flex list-none items-center justify-between gap-3 [&::-webkit-details-marker]:hidden`,v;t[12]!==g||t[13]!==_?(v=B(g,_),t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==r||t[17]!==p?(y=e=>{e.preventDefault(),p(e=>nt(e,r,!h),{preventScrollReset:!0})},t[15]=h,t[16]=r,t[17]=p,t[18]=y):y=t[18];let b;t[19]!==d||t[20]!==h||t[21]!==l?(b=d?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`min-w-0 flex-1`,children:l}),(0,K.jsx)(M,{"aria-hidden":!0,className:B(`size-4 shrink-0 text-fg-subtle motion-safe:transition-transform motion-safe:duration-150`,h&&`rotate-90`)})]}):l,t[19]=d,t[20]=h,t[21]=l,t[22]=b):b=t[22];let x;t[23]!==v||t[24]!==y||t[25]!==b?(x=(0,K.jsx)(`summary`,{className:v,onClick:y,children:b}),t[23]=v,t[24]=y,t[25]=b,t[26]=x):x=t[26];let S;return t[27]!==n||t[28]!==h||t[29]!==i||t[30]!==x?(S=(0,K.jsxs)(`details`,{...i,open:h,children:[x,n]}),t[27]=n,t[28]=h,t[29]=i,t[30]=x,t[31]=S):S=t[31],S}function it(e){let t=e;for(;t&&!/(auto|scroll)/.test(getComputedStyle(t).overflowY);)t=t.parentElement;return t}function at(e,t){let n=e?.closest(`.task-detail-scroll`),r=Array.from(n?.querySelectorAll(`[data-task-section]`)??[]).find(e=>e.dataset.taskSection===t);if(!r||!n)return;r instanceof HTMLDetailsElement&&(r.open=!0);let i=it(n),a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!i){r.scrollIntoView({block:`start`,behavior:a?`instant`:`smooth`});return}let o=(e?.parentElement?.getBoundingClientRect().height??0)+16,s=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,i.scrollTop+r.getBoundingClientRect().top-i.getBoundingClientRect().top-i.clientTop-o));i.scrollTo({top:s,behavior:a?`instant`:`smooth`});let c=i;return{cancel:()=>c.scrollTo({top:c.scrollTop,behavior:`instant`}),isComplete:()=>Math.abs(c.scrollTop-s)<1}}function ot(e){let t=(0,G.c)(28),{language:n,hasSchedule:r}=e,[i,o]=a(),s;t[0]===i?s=t[1]:(s=i.get(`taskSection`),t[0]=i,t[1]=s);let c=s,l=(0,W.useRef)(null),u=(0,W.useRef)(null),d=(0,W.useRef)(null),f=(0,W.useRef)(void 0),p=(0,W.useRef)(o),m=(0,W.useRef)(c),h,g;t[2]!==c||t[3]!==o?(h=()=>{p.current=o,m.current=c},g=[o,c],t[2]=c,t[3]=o,t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,W.useEffect)(h,g);let _=(0,W.useRef)(void 0),v=(0,W.useRef)(!1),y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=d.current;d.current=null,_.current=void 0,!(!e||!v.current)&&(v.current=!1,p.current(t=>{let n=nt(t,e,!0);return n.set(`taskSection`,e),n},{preventScrollReset:!0}))},t[6]=y):y=t[6];let b=y,x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(e,t)=>{let n=t!==void 0&&t;clearTimeout(f.current),d.current=e,v.current=n,f.current=setTimeout(b,800),_.current=at(l.current,e)},t[7]=x):x=t[7];let S=x,[C,w]=(0,W.useState)(c??`results`),T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[8]=T):T=t[8];let[E,D]=(0,W.useState)(T),O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{let e=l.current,t=e?.closest(`.task-detail-scroll`),n=e?.parentElement;if(!t||!n)return;let r=Array.from(t.querySelectorAll(`[data-task-section]`));D(r.map(st));let i=0,a=()=>{if(d.current)return;let e=it(t),i=n.getBoundingClientRect().bottom+24,a=r[0];for(let e of r)e.getBoundingClientRect().top<=i&&(a=e);if(e&&e.scrollHeight>e.clientHeight&&e.scrollTop+e.clientHeight>=e.scrollHeight-2&&(a=r.at(-1)),!a)return;let o=a.dataset.taskSection;w(o),m.current!==o&&(u.current=o,clearTimeout(f.current),f.current=setTimeout(()=>{p.current(e=>{let t=new URLSearchParams(e);return t.set(`taskSection`,o),t},{replace:!0,preventScrollReset:!0})},160))},o=e=>{if(!(!(e.target instanceof Element)||!e.target.contains(t))){if(d.current){clearTimeout(f.current),f.current=setTimeout(b,160);return}clearTimeout(f.current),i||=requestAnimationFrame(()=>{i=0,a()})}},s=n=>{!(n.target instanceof Node)||!t.contains(n.target)||e.contains(n.target)||n instanceof KeyboardEvent&&![`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(n.key)||(_.current?.cancel(),_.current=void 0,d.current=null,v.current=!1,clearTimeout(f.current))},c=e=>{e.target instanceof Element&&e.target.contains(t)&&d.current&&(!_.current||_.current.isComplete())&&(clearTimeout(f.current),b())},h=()=>{let e=n.getBoundingClientRect().height;for(let t of r)t.style.scrollMarginTop=`${e+16}px`};h();let g=typeof ResizeObserver>`u`?null:new ResizeObserver(h);return g?.observe(n),window.addEventListener(`resize`,h),document.addEventListener(`scroll`,o,!0),document.addEventListener(`scrollend`,c,!0),document.addEventListener(`wheel`,s,{capture:!0,passive:!0}),document.addEventListener(`touchstart`,s,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,s,{capture:!0,passive:!0}),document.addEventListener(`keydown`,s,!0),()=>{cancelAnimationFrame(i),g?.disconnect(),window.removeEventListener(`resize`,h),document.removeEventListener(`scroll`,o,!0),document.removeEventListener(`scrollend`,c,!0),document.removeEventListener(`wheel`,s,!0),document.removeEventListener(`touchstart`,s,!0),document.removeEventListener(`pointerdown`,s,!0),document.removeEventListener(`keydown`,s,!0)}},t[9]=O):O=t[9];let k;t[10]!==r||t[11]!==n?(k=[n,r,b],t[10]=r,t[11]=n,t[12]=k):k=t[12],(0,W.useEffect)(O,k);let A,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>{clearTimeout(f.current),_.current?.cancel()},A=[],t[13]=A,t[14]=j):(A=t[13],j=t[14]),(0,W.useEffect)(j,A);let M,N;t[15]===c?(M=t[16],N=t[17]):(M=()=>{!c||u.current===c||(u.current=c,w(c),S(c))},N=[c,S],t[15]=c,t[16]=M,t[17]=N),(0,W.useEffect)(M,N);let P;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=l.current,t=e?.querySelector(`[aria-current="location"]`);if(!e||!t)return;let n=t.offsetLeft<e.scrollLeft?t.offsetLeft:t.offsetLeft+t.offsetWidth>e.scrollLeft+e.clientWidth?t.offsetLeft+t.offsetWidth-e.clientWidth:e.scrollLeft;n!==e.scrollLeft&&e.scrollTo({left:n,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},t[18]=P):P=t[18];let F;t[19]!==C||t[20]!==E?(F=[C,E],t[19]=C,t[20]=E,t[21]=F):F=t[21],(0,W.useEffect)(P,F);let I=n===`zh`?`任务详情分区`:`Task detail sections`,L;t[22]!==C||t[23]!==E?(L=E.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-current":C===e.id?`location`:void 0,"aria-pressed":C===e.id,"data-sliding-active":C===e.id,className:B(`relative z-10 min-h-9 min-w-max flex-1 touch-manipulation rounded-lg px-3 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C===e.id?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>{u.current=e.id,w(e.id),S(e.id,!0)},children:e.label},e.id)),t[22]=C,t[23]=E,t[24]=L):L=t[24];let R;return t[25]!==I||t[26]!==L?(R=(0,K.jsx)(H,{scrollFocusedItemIntoView:!1,as:`nav`,ref:l,"aria-label":I,className:`flex w-full gap-0.5 overflow-x-auto rounded-xl bg-surface-inset p-1`,indicatorClassName:`rounded-lg bg-surface-panel ring-1 ring-edge-subtle duration-300 [transition-timing-function:cubic-bezier(0.22,1,0.36,1)]`,children:L}),t[25]=I,t[26]=L,t[27]=R):R=t[27],R}function st(e){return{id:e.dataset.taskSection,label:e.dataset.taskSectionLabel}}var ct=`Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage.`;function lt(e){let t=(0,G.c)(64),{criterion:n,index:r,language:i,closed:a,pending:o,onReview:s,projectId:c,conversationId:l}=e,u=i===`zh`,d=(0,W.useId)(),f=n.status===`passed`,p=n.evidence.length>0||n.method||n.review||n.note,m=n.verificationStatus===`passed`?u?`通过`:`Passed`:n.verificationStatus===`failed`?u?`未通过`:`Failed`:u?`未核验`:`Unverified`,h=n.review?.status===`passed`?u?`已验收`:`Accepted`:n.review?.status===`failed`?u?`未通过`:`Failed`:u?`已撤销验收`:`Acceptance cleared`,g=!a&&!o&&`cursor-pointer`,_;t[0]===g?_=t[1]:(_=B(`relative grid size-11 shrink-0 place-items-center rounded-full`,g),t[0]=g,t[1]=_);let v=o||void 0,y;t[2]!==r||t[3]!==s||t[4]!==o?(y=e=>{o||s(r,e.target.checked?`passed`:`unverified`)},t[2]=r,t[3]=s,t[4]=o,t[5]=y):y=t[5];let b;t[6]!==f||t[7]!==a||t[8]!==v||t[9]!==y||t[10]!==d?(b=(0,K.jsx)(`input`,{type:`checkbox`,"aria-labelledby":d,className:`peer sr-only`,checked:f,disabled:a,"aria-disabled":v,onChange:y}),t[6]=f,t[7]=a,t[8]=v,t[9]=y,t[10]=d,t[11]=b):b=t[11];let x=f?`border-edge bg-surface-inset text-fg`:`border-fg-subtle/70`,S=!a&&!o&&`hover:bg-surface-hover`,C;t[12]!==x||t[13]!==S?(C=B(`grid size-5 place-items-center rounded-full border motion-safe:transition-colors motion-safe:duration-150 peer-focus-visible:ring-2 peer-focus-visible:ring-accent peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-panel`,x,S),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]===f?w=t[16]:(w=f?(0,K.jsx)(j,{className:`size-3.5`,strokeWidth:2.8}):null,t[15]=f,t[16]=w);let T;t[17]!==C||t[18]!==w?(T=(0,K.jsx)(`span`,{"aria-hidden":!0,className:C,children:w}),t[17]=C,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,K.jsxs)(`label`,{className:_,children:[b,T]}),t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let D=`criterion:${r}:evidence`,O;t[24]!==n.text||t[25]!==d?(O=(0,K.jsx)(`span`,{id:d,className:`block whitespace-pre-wrap break-words text-sm leading-5 text-fg [overflow-wrap:anywhere]`,children:n.text}),t[24]=n.text,t[25]=d,t[26]=O):O=t[26];let k=u?`验收依据`:`Acceptance evidence`,A;t[27]===k?A=t[28]:(A=(0,K.jsx)(`p`,{className:`font-medium text-fg`,children:k}),t[27]=k,t[28]=A);let M;t[29]!==n.method||t[30]!==m||t[31]!==u?(M=n.method?(0,K.jsxs)(`p`,{children:[u?`自动核验`:`Automatic verification`,` · `,m,n.method===`model_reviewed`?u?` · 模型审阅`:` · Model review`:``]}):null,t[29]=n.method,t[30]=m,t[31]=u,t[32]=M):M=t[32];let N;t[33]!==n.review||t[34]!==i||t[35]!==h||t[36]!==u?(N=n.review?(0,K.jsxs)(`p`,{children:[u?`人工验收`:`User review`,` · `,h,` · `,qe(n.review.reviewedAt,i)]}):null,t[33]=n.review,t[34]=i,t[35]=h,t[36]=u,t[37]=N):N=t[37];let P;t[38]!==n.note||t[39]!==r||t[40]!==i?(P=n.note&&n.note!==ct?(0,K.jsx)(U,{content:n.note,contentKey:`criterion:${r}:note`,language:i,markdown:!1}):null,t[38]=n.note,t[39]=r,t[40]=i,t[41]=P):P=t[41];let F;t[42]!==l||t[43]!==n.evidence||t[44]!==i||t[45]!==c?(F=(0,K.jsx)($e,{evidence:n.evidence,projectId:c,conversationId:l,language:i}),t[42]=l,t[43]=n.evidence,t[44]=i,t[45]=c,t[46]=F):F=t[46];let I;t[47]!==p||t[48]!==u?(I=p?null:(0,K.jsx)(`p`,{children:u?`暂无验收依据`:`No evidence yet`}),t[47]=p,t[48]=u,t[49]=I):I=t[49];let L;t[50]!==A||t[51]!==M||t[52]!==N||t[53]!==P||t[54]!==F||t[55]!==I?(L=(0,K.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-inset px-3 py-2.5 text-xs leading-5 text-fg-muted`,children:[A,M,N,P,F,I]}),t[50]=A,t[51]=M,t[52]=N,t[53]=P,t[54]=F,t[55]=I,t[56]=L):L=t[56];let R;t[57]!==D||t[58]!==O||t[59]!==L?(R=(0,K.jsx)(rt,{panelId:D,chevron:!0,className:`min-w-0 flex-1`,summaryClassName:`-ms-1 min-h-11 cursor-pointer rounded-lg py-3 pe-2 ps-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:O,children:L}),t[57]=D,t[58]=O,t[59]=L,t[60]=R):R=t[60];let ee;return t[61]!==E||t[62]!==R?(ee=(0,K.jsxs)(`li`,{className:`relative flex min-w-0 items-start px-2 before:absolute before:end-0 before:start-13 before:top-0 before:border-t before:border-edge-subtle first:before:hidden sm:px-3`,children:[E,R]}),t[61]=E,t[62]=R,t[63]=ee):ee=t[63],ee}function ut(e){let t=(0,G.c)(39),{criteria:n,language:r,closed:i,pending:a,blockedReason:o,error:s,onReview:c,projectId:l,conversationId:u,reviewDisabled:d}=e,f=r===`zh`,p;t[0]===n?p=t[1]:(p=n.some(dt),t[0]=n,t[1]=p);let m=p,h;t[2]!==m||t[3]!==f?(h=m?(0,K.jsx)(rt,{panelId:`acceptance:diagnostic`,title:f?`自动核验未完成:验收标准过于宽泛`:`Automatic verification incomplete: criteria are too broad`,className:`mx-4 mb-2 text-xs leading-5 text-fg-muted`,children:(0,K.jsx)(`p`,{className:`mt-2 break-words`,children:ct})}):null,t[2]=m,t[3]=f,t[4]=h):h=t[4];let g=a||void 0,_;if(t[5]!==i||t[6]!==u||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==a||t[11]!==l||t[12]!==d){let e;t[14]!==i||t[15]!==u||t[16]!==r||t[17]!==c||t[18]!==a||t[19]!==l||t[20]!==d?(e=(e,t)=>(0,K.jsx)(lt,{criterion:e,index:t,language:r,closed:i||!!d,pending:a,onReview:c,projectId:l,conversationId:u},`${t}:${e.text}`),t[14]=i,t[15]=u,t[16]=r,t[17]=c,t[18]=a,t[19]=l,t[20]=d,t[21]=e):e=t[21],_=n.map(e),t[5]=i,t[6]=u,t[7]=n,t[8]=r,t[9]=c,t[10]=a,t[11]=l,t[12]=d,t[13]=_}else _=t[13];let v;t[22]!==g||t[23]!==_?(v=(0,K.jsx)(`ul`,{"aria-busy":g,className:`border-t border-edge-subtle`,children:_}),t[22]=g,t[23]=_,t[24]=v):v=t[24];let y;t[25]!==n.length||t[26]!==f?(y=n.length===0?(0,K.jsx)(`p`,{className:`px-4 py-4 text-sm text-fg-muted`,children:f?`尚未定义验收标准`:`No acceptance criteria defined`}):null,t[25]=n.length,t[26]=f,t[27]=y):y=t[27];let b;t[28]===s?b=t[29]:(b=s?(0,K.jsx)(`p`,{role:`alert`,className:`mx-4 my-2 text-sm text-danger`,children:s}):null,t[28]=s,t[29]=b);let x;t[30]!==o||t[31]!==i?(x=!i&&o?(0,K.jsx)(`p`,{className:`border-t border-edge-subtle px-4 py-2.5 text-xs text-fg-muted`,children:o}):null,t[30]=o,t[31]=i,t[32]=x):x=t[32];let S;return t[33]!==h||t[34]!==v||t[35]!==y||t[36]!==b||t[37]!==x?(S=(0,K.jsxs)(K.Fragment,{children:[h,v,y,b,x]}),t[33]=h,t[34]=v,t[35]=y,t[36]=b,t[37]=x,t[38]=S):S=t[38],S}function dt(e){return e.note===ct}function ft(e){let t=(0,G.c)(27),{detail:n,language:r}=e,i=r===`zh`,a=c(),o;if(t[0]!==n||t[1]!==r||t[2]!==a||t[3]!==i){let e=n.deliverables??[],c=Se(n),l;if(t[5]!==n.runs||t[6]!==n.task){let e;t[8]===n.task?e=t[9]:(e=e=>e.contractVersion===n.task.latestContractVersion,t[8]=n.task,t[9]=e),l=new Set(n.runs.filter(e).map(yt)),t[5]=n.runs,t[6]=n.task,t[7]=l}else l=t[7];let u=l,d=n.context.filter(vt).map(_t),f=new Set(e.flatMap(gt).filter(Boolean)),p=new Set([...d.map(ht),...f].filter(Boolean)),m;t[10]===u?m=t[11]:(m=e=>u.has(e.runId),t[10]=u,t[11]=m);for(let e of n.receipts.filter(m))for(let t of e.evidence.filter(mt))t.uri&&p.has(t.uri)||(t.uri&&p.add(t.uri),d.push(t));let h=c?.summary.trim(),g=h&&h.length<=160&&!h.includes(`
2
+ `)&&!/\b(?:Claim|Criterion|Research claim)\b|c-ac\d|Default criteria were not/i.test(h)?h:void 0,_=d.filter(e=>!f.has(e.uri)),v=i?`交付结果`:`Deliverables`,y;t[12]===v?y=t[13]:(y=(0,K.jsx)(`h2`,{id:`task-results-heading`,className:`text-sm font-semibold text-fg`,children:v}),t[12]=v,t[13]=y);let b;t[14]!==e||t[15]!==n||t[16]!==a||t[17]!==i?(b=e.length?(0,K.jsx)(`ul`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:e.map(e=>{let t=e.artifact?.title??e.reference?.title??e.id;return(0,K.jsxs)(`li`,{className:`min-w-0`,children:[(0,K.jsxs)(Ye,{item:e,conversationId:e.task?.conversationId??n.conversation.activeConversationId,backgroundPath:`${a.pathname}${a.search}`,zh:i,className:`flex min-h-11 w-full min-w-0 items-center gap-2 rounded-lg bg-surface-inset px-3 py-2 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,K.jsx)(R,{name:t}),(0,K.jsx)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:t})]}),e.artifact?.availability===`available`&&e.artifact.uri?.startsWith(`media://outbound/`)?(0,K.jsx)(C,{file:e.artifact,zh:i}):null]},e.id)})}):null,t[14]=e,t[15]=n,t[16]=a,t[17]=i,t[18]=b):b=t[18];let x;t[19]!==n||t[20]!==r||t[21]!==_?(x=_.length?(0,K.jsx)($e,{evidence:_,language:r,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,compact:!0}):null,t[19]=n,t[20]=r,t[21]=_,t[22]=x):x=t[22];let S;t[23]!==e||t[24]!==_.length||t[25]!==i?(S=!e.length&&!_.length?(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i?`尚无可查看的交付物`:`No deliverables available yet`}):null,t[23]=e,t[24]=_.length,t[25]=i,t[26]=S):S=t[26],o=(0,K.jsxs)(`section`,{"aria-label":i?`交付结果`:`Deliverables`,className:`rounded-xl bg-surface-panel p-4`,children:[y,g?(0,K.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-fg-muted [overflow-wrap:anywhere]`,children:g}):null,c&&c.completionVerdict!==`achieved`?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`本次执行尚未报告目标全部达成。`:`This run has not reported the full goal achieved.`}):null,b,x,S,c?null:(0,K.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:i?`尚无本版任务的执行结果`:`No run result for this task version`}),c&&(c.needsUser||c.remainingWork.length>0||c.nextAction||c.failure)?(0,K.jsxs)(`div`,{className:`mt-4 space-y-2 border-t border-edge-subtle pt-3`,"aria-label":i?`执行待办`:`Run follow-up`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:c.needsUser?i?`需要你决定`:`Your decision needed`:i?`待处理事项`:`Remaining work`}),c.remainingWork.length>0?(0,K.jsx)(`ul`,{className:`space-y-2 text-sm leading-6 text-fg`,children:[...new Set(c.remainingWork)].map(pt)}):null,c.nextAction?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:c.nextAction}):null,c.failure?(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-danger [overflow-wrap:anywhere]`,children:c.failure.recoveryAction}):null,c.needsUser?(0,K.jsx)(s,{className:`inline-flex min-h-9 items-center rounded-sm text-xs font-medium text-accent-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent/40`,to:ae(n.task.id),children:i?`查看并决定`:`Review and decide`}):null]}):null]}),t[0]=n,t[1]=r,t[2]=a,t[3]=i,t[4]=o}else o=t[4];return o}function pt(e){return(0,K.jsx)(`li`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e},e)}function mt(e){return e.kind===`artifact`}function ht(e){return e.uri}function gt(e){return[e.artifact?.uri,e.artifact?.shareUrl,e.artifact?.workspaceRelativePath]}function _t(e){return{kind:[`file`,`url`].includes(e.targetKind)?`artifact`:`source`,title:e.title??e.targetId,summary:``,...[`file`,`url`].includes(e.targetKind)?{uri:e.targetId}:{},provenance:`user`,strength:`observed`,observedAt:0}}function vt(e){return e.role===`deliverable`}function yt(e){return e.id}function bt(e){let t=(0,G.c)(19),{detail:n,language:r}=e,i=r===`zh`,a=Oe(r),o;t[0]===n?o=t[1]:(o=Se(n),t[0]=n,t[1]=o);let s=o,c;t[2]===s?.runId?c=t[3]:(c=e=>e.runId!==s?.runId,t[2]=s?.runId,t[3]=c);let l=n.receipts.filter(c),[u,d]=(0,W.useState)(`idle`),f;t[4]===s?f=t[5]:(f=async function(e){if(s){d(`pending`);try{await me(s.runId,e),d(`saved`)}catch{d(`failed`)}}},t[4]=s,t[5]=f);let p=f,m;t[6]!==n||t[7]!==r?(m=(0,K.jsx)(T,{detail:n,language:r}),t[6]=n,t[7]=r,t[8]=m):m=t[8];let h=s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:a.latestResult}),(0,K.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[a.receiptStatuses[s.status],` · `,a.verificationStatuses[s.verification.status]]})]}),(0,K.jsx)(U,{content:s.summary,contentKey:`${n.task.id}:result:${s.runId}`,language:r}),s.evidence.length>0?(0,K.jsxs)(`details`,{children:[(0,K.jsxs)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:[i?`验证依据与执行产物`:`Evidence and artifacts`,` · `,s.evidence.length]}),(0,K.jsx)($e,{evidence:s.evidence,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,language:r})]}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,K.jsx)(V,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`helpful`),children:a.doneWell}),(0,K.jsx)(V,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`not_helpful`),children:a.needsFix}),u===`saved`?(0,K.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`反馈已记录`:`Feedback saved`}):null,u===`failed`?(0,K.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:a.actionFailed}):null]})]}):null,g=l.length>0?(0,K.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:a.executionHistory.replace(`{{count}}`,String(l.length))}),(0,K.jsx)(`div`,{className:`mt-3 space-y-4`,children:l.map(e=>(0,K.jsxs)(`article`,{className:`space-y-2 rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.receiptStatuses[e.status]}),(0,K.jsx)(U,{content:e.summary,contentKey:`${n.task.id}:result:${e.runId}`,language:r})]},e.runId))})]}):null,_;t[9]!==a||t[10]!==n.criterionReviewHistory||t[11]!==r||t[12]!==i?(_=n.criterionReviewHistory?.length?(0,K.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:i?`历史验收判定`:`Past criterion reviews`}),(0,K.jsx)(`ul`,{className:`mt-2 space-y-2 text-sm`,children:n.criterionReviewHistory.map(e=>(0,K.jsxs)(`li`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`p`,{children:e.criterionText}),(0,K.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[a.verificationStatuses[e.status],` · `,qe(e.reviewedAt,r)]}),e.note?(0,K.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.note}):null]},`${e.contractVersion}:${e.resultId??``}:${e.criterionIndex}`))})]}):null,t[9]=a,t[10]=n.criterionReviewHistory,t[11]=r,t[12]=i,t[13]=_):_=t[13];let v;return t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==_?(v=(0,K.jsxs)(`div`,{className:`space-y-4`,children:[m,h,g,_]}),t[14]=m,t[15]=h,t[16]=g,t[17]=_,t[18]=v):v=t[18],v}function xt(e){let t=(0,G.c)(33),{changes:n,language:r}=e,i=r===`zh`,a;t[0]===i?a=t[1]:(a=i?{backlog:`待办池`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`},t[0]=i,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=i?{board:`看板`,mobile:`移动端`,api:`手动操作`,runtime:`自动流转`,undo:`撤销`}:{board:`Board`,mobile:`Mobile`,api:`Manual update`,runtime:`Automatic`,undo:`Undo`},t[2]=i,t[3]=s);let c=s,l;t[4]===i?l=t[5]:(l=i?{done:`完成`,cancelled:`取消`,duplicate:`重复`,wont_do:`不做`}:{done:`Done`,cancelled:`Cancelled`,duplicate:`Duplicate`,wont_do:`Won’t do`},t[4]=i,t[5]=l);let u=l,d;t[6]===i?d=t[7]:(d=i?{user:`用户`,agent:`Agent`,system:`系统`,integration:`外部服务`}:{user:`User`,agent:`Agent`,system:`System`,integration:`Integration`},t[6]=i,t[7]=d);let f=d,p=i?`变更记录`:`Change log`,m;t[8]!==n.length||t[9]!==p?(m=(0,K.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[p,` (`,n.length,`)`]}),t[8]=n.length,t[9]=p,t[10]=m):m=t[10];let h;if(t[11]!==f||t[12]!==n||t[13]!==r||t[14]!==o||t[15]!==u||t[16]!==c){let e;t[18]!==f||t[19]!==r||t[20]!==o||t[21]!==u||t[22]!==c?(e=e=>(0,K.jsxs)(`li`,{className:`text-sm text-fg`,children:[(0,K.jsxs)(`div`,{children:[o[e.fromPhase],e.fromResolution?` · ${u[e.fromResolution]}`:``,` → `,o[e.toPhase],e.toResolution?` · ${u[e.toResolution]}`:``]}),(0,K.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[f[e.actor.kind],e.actor.id?` (${e.actor.id})`:``,` · `,c[e.source],` · `,(0,K.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:qe(e.createdAt,r)})]})]},e.id),t[18]=f,t[19]=r,t[20]=o,t[21]=u,t[22]=c,t[23]=e):e=t[23],h=[...n].reverse().map(e),t[11]=f,t[12]=n,t[13]=r,t[14]=o,t[15]=u,t[16]=c,t[17]=h}else h=t[17];let g;t[24]===h?g=t[25]:(g=(0,K.jsx)(`ol`,{className:`mt-3 max-h-80 space-y-3 overflow-y-auto`,children:h}),t[24]=h,t[25]=g);let _;t[26]!==n.length||t[27]!==i?(_=n.length?null:(0,K.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i?`暂无阶段变更记录`:`No phase changes yet`}),t[26]=n.length,t[27]=i,t[28]=_):_=t[28];let v;return t[29]!==m||t[30]!==g||t[31]!==_?(v=(0,K.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[m,g,_]}),t[29]=m,t[30]=g,t[31]=_,t[32]=v):v=t[32],v}function St({schedules:e,language:t,onEdit:n,onUpdated:r}){let i=t===`zh`,a=p(t),[o,c]=(0,W.useState)(null),l=(0,W.useRef)(!1),[u,d]=(0,W.useState)(null),f=e=>new Date(e).toLocaleString(i?`zh-CN`:`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`});async function m(e){if(!l.current){l.current=!0,c(e.id),d(null);try{r((await je.update(e.id,{enabled:!1,expectedRevision:e.updatedAtMs})).automation)}catch(e){d(e instanceof Error?e.message:a.automations.feedback.actionFailed)}finally{l.current=!1,c(null)}}}return(0,K.jsxs)(`section`,{"aria-label":i?`执行时间`:`Execution schedule`,className:`rounded-xl bg-surface-inset p-4`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`执行时间`:`Execution schedule`}),(0,K.jsx)(`div`,{className:`mt-3 space-y-4`,children:e.map(e=>{let r=e.trigger.kind===`schedule`?e.trigger.schedule:null,c=A(e),l=!e.management||e.management.editable.includes(`trigger`),u=!e.management||e.management.editable.includes(`enabled`);return(0,K.jsxs)(`article`,{className:`space-y-2 text-sm text-fg`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`break-words font-medium`,children:e.name}),(0,K.jsx)(`span`,{className:`text-xs text-fg-muted`,children:c?i?`已执行`:`Completed`:e.enabled?i?`已启用`:`Enabled`:i?`已取消定时执行`:`Scheduling disabled`})]}),(0,K.jsx)(`p`,{children:r?.kind===`once`?`${i?`单次执行:`:`Run once: `}${f(Date.parse(r.at))}`:k(e.trigger,a.automations,a.cron,t)}),r?.kind===`cron`?(0,K.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[i?`执行时区:`:`Schedule timezone: `,r.tz||(i?`服务所在电脑时区`:`Server timezone`)]}):null,(0,K.jsxs)(`p`,{className:`text-fg-muted`,children:[i?`下次执行:`:`Next run: `,c?i?`已执行,无后续计划`:`Completed; no upcoming run`:e.enabled?e.state.nextRunAtMs===void 0?i?`暂无后续执行`:`No upcoming run`:f(e.state.nextRunAtMs):i?`已取消,不再自动执行`:`Disabled; no automatic runs`]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l?(0,K.jsx)(V,{variant:`secondary`,disabled:o!==null,onClick:()=>n(e),children:i?`修改时间`:`Edit schedule`}):null,e.enabled&&u?(0,K.jsx)(V,{variant:`ghost`,disabled:o!==null,onClick:()=>void m(e),children:o===e.id?i?`正在取消…`:`Cancelling…`:i?`取消定时执行`:`Cancel schedule`}):null,(0,K.jsx)(V,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(s,{to:`/automations?automation=${encodeURIComponent(e.id)}`,children:i?`查看自动化`:`View automation`})})]})]},e.id)})}),u?(0,K.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:u}):null]})}var Ct=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function wt({taskId:e,taskTitle:t,projectId:n,executorAgentId:r,language:i,onClose:a,onCreated:o,automation:c}){let l=i===`zh`,u=p(i).automations,[d,f]=(0,W.useState)(()=>c?Be(c):{...Ve,name:t,projectId:n??``,actionMode:`task_command`,taskId:e,agentId:r??``,triggerMode:`once`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}),[x,S]=(0,W.useState)(null),[C,w]=(0,W.useState)(!1),T=(0,W.useRef)(!1),[E,D]=(0,W.useState)(null),O=e=>f(t=>({...t,...e}));async function k(e){if(e.preventDefault(),!(T.current||x)&&(D(null),!(!d.name.trim()||!c&&!r))){if(d.triggerMode===`once`&&(!Number.isFinite(new Date(d.onceAt).getTime())||new Date(d.onceAt).getTime()<=Date.now())){D(u.experience.futureTime);return}T.current=!0,w(!0);try{let e=c?He(c,d).trigger:We(d).trigger,{automation:t}=c?await je.update(c.id,{trigger:e,...c.management?{}:{name:d.name.trim(),delivery:{...c.delivery,notificationPolicy:d.notificationPolicy}},...!c.management||c.management.editable.includes(`enabled`)?{enabled:!0}:{},expectedRevision:c.updatedAtMs}):await je.create({...We(d),enabled:!0});S(t),o(t)}catch(e){D(e instanceof Error?e.message:u.feedback.actionFailed)}finally{T.current=!1,w(!1)}}}return(0,K.jsx)(b,{open:!0,onOpenChange:e=>{!e&&!T.current&&a()},children:(0,K.jsxs)(_,{children:[(0,K.jsx)(m,{className:`fixed inset-0 z-[110] bg-black/45`}),(0,K.jsxs)(v,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[111] flex h-[min(38rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,K.jsx)(y,{className:`text-base font-semibold text-fg`,children:c?l?`修改执行时间`:`Edit execution schedule`:l?`设置执行时间`:`Set execution time`}),(0,K.jsx)(g,{asChild:!0,children:(0,K.jsx)(V,{variant:`ghost`,className:`size-9 p-0`,disabled:C,"aria-label":l?`关闭`:`Close`,children:(0,K.jsx)(z,{className:`size-4`})})})]}),(0,K.jsx)(h,{className:`sr-only`,children:l?`为当前任务创建定时或周期自动化。`:`Create a scheduled or recurring automation for this task.`}),x?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,K.jsx)(`p`,{role:`status`,className:`text-sm font-medium text-fg`,children:c?l?`执行时间已更新`:`Schedule updated`:l?`执行时间已设置`:`Schedule created`}),(0,K.jsx)(`p`,{className:`break-words text-sm text-fg-muted`,children:x.name}),(0,K.jsx)(V,{asChild:!0,variant:`primary`,children:(0,K.jsx)(s,{to:`/automations?automation=${encodeURIComponent(x.id)}`,children:l?`查看自动化`:`View automation`})})]}),(0,K.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:(0,K.jsx)(V,{onClick:a,children:l?`完成`:`Done`})})]}):(0,K.jsxs)(`form`,{onSubmit:e=>void k(e),className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,K.jsxs)(`p`,{className:`break-words text-sm text-fg-muted`,children:[l?`执行任务:`:`Task: `,t]}),(0,K.jsxs)(`fieldset`,{disabled:C,className:`space-y-4`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.name,(0,K.jsx)(`input`,{required:!0,readOnly:!!c?.management,className:Ct,value:d.name,onChange:e=>O({name:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.trigger,(0,K.jsxs)(N,{value:d.triggerMode,onChange:e=>O({triggerMode:e.target.value}),children:[c?.trigger.kind===`schedule`&&c.trigger.schedule.kind===`interval`?(0,K.jsx)(P,{value:`interval`,children:l?`固定间隔`:`Fixed interval`}):null,c?.trigger.kind===`schedule`&&c.trigger.schedule.kind===`cron`?(0,K.jsx)(P,{value:`cron`,children:l?`自定义规则`:`Custom schedule`}):null,(0,K.jsx)(P,{value:`once`,children:u.trigger.once}),(0,K.jsx)(P,{value:`daily`,children:u.trigger.daily}),(0,K.jsx)(P,{value:`weekly`,children:u.trigger.weekly})]})]}),d.triggerMode===`once`?(0,K.jsx)(Ze,{label:u.form.onceAt,disabled:C,value:d.onceAt,defaultTime:d.time,onChange:e=>O({onceAt:e})}):[`daily`,`weekly`].includes(d.triggerMode)?(0,K.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,K.jsx)(`span`,{children:u.form.time}),(0,K.jsx)(Ke,{disabled:C,value:d.time,onChange:e=>O({time:e}),ariaLabel:u.form.time})]}):null,d.triggerMode===`weekly`?(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.day,(0,K.jsx)(N,{value:d.weekday,onChange:e=>O({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,K.jsx)(P,{value:String(t),children:u.weekdays[e]},e))})]}):null,d.triggerMode===`cron`?(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`定时规则`:`Cron expression`,(0,K.jsx)(`input`,{required:!0,className:Ct,value:d.cronExpr,onChange:e=>O({cronExpr:e.target.value})})]}):null,d.triggerMode===`interval`?(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`执行间隔`:`Interval`,(0,K.jsx)(`input`,{required:!0,type:`number`,min:`1`,className:Ct,value:d.intervalValue,onChange:e=>O({intervalValue:e.target.value})})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`单位`:`Unit`,(0,K.jsxs)(N,{value:d.intervalUnit,onChange:e=>O({intervalUnit:e.target.value}),children:[(0,K.jsx)(P,{value:`minute`,children:l?`分钟`:`Minutes`}),(0,K.jsx)(P,{value:`hour`,children:l?`小时`:`Hours`}),(0,K.jsx)(P,{value:`day`,children:l?`天`:`Days`}),(0,K.jsx)(P,{value:`week`,children:l?`周`:`Weeks`})]})]})]}):null,(0,K.jsx)(Ue,{form:d,onChange:O,language:i}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.draft.notifications,(0,K.jsxs)(N,{disabled:!!c?.management,value:d.notificationPolicy,onChange:e=>O({notificationPolicy:e.target.value}),children:[(0,K.jsx)(P,{value:`attention`,children:u.draft.notifyAttention}),(0,K.jsx)(P,{value:`all`,children:u.draft.notifyAll}),(0,K.jsx)(P,{value:`none`,children:u.draft.notifyNone})]})]})]}),!c&&!r?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l?`请先为任务指定执行 Agent。`:`Assign an executor agent to the task first.`}):null,E?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:E}):null]}),(0,K.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,K.jsx)(V,{type:`button`,variant:`ghost`,disabled:C,onClick:a,children:l?`取消`:`Cancel`}),(0,K.jsx)(V,{type:`submit`,variant:`primary`,disabled:C||!c&&!r||!d.name.trim()||d.triggerMode===`once`&&!d.onceAt,children:C?l?`正在保存…`:`Saving…`:c?c.enabled?l?`保存修改`:`Save changes`:l?`保存并启用`:`Save and enable`:l?`创建自动化`:`Create automation`})]})]})]})]})})}function Tt(e){let t=(0,G.c)(49),{detail:n,executorName:r,language:i,onUpdated:a,ref:o}=e,c=i===`zh`,l;t[0]===n.waits?l=t[1]:(l=n.waits.find(Ot),t[0]=n.waits,t[1]=l);let u=l,d,f,p,m,h,g,_,v,y;if(t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==a||t[6]!==u||t[7]!==o||t[8]!==c){d=n.allowedCommands.includes(`resolve_wait`)&&!u?n.waits.filter(Dt):[];let e=n.presentation.status===`needsUser`,l;t[18]===n?l=t[19]:(l=Se(n),t[18]=n,t[19]=l);let b=l,S;t[20]===n.runs?S=t[21]:(S=n.runs.find(Et),t[20]=n.runs,t[21]=S);let C=S,w=c?`等待开始执行。`:`Waiting to start.`,T=r?c?`${r} 正在处理任务。`:`${r} is working on the task.`:c?`任务处理中。`:`The task is in progress.`,E=c?`任务正在等待继续。`:`The task is waiting to resume.`,D=c?`正在检查执行结果。`:`Checking the result.`,O;t[22]!==w||t[23]!==T||t[24]!==E||t[25]!==D?(O={queued:w,running:T,waiting:E,verifying:D},t[22]=w,t[23]=T,t[24]=E,t[25]=D,t[26]=O):O=t[26];let k=O;p=n.presentation.reason??u?.reason??n.waits[0]?.reason??(n.task.phase===`closed`?b?.summary??(c?`任务已关闭,可查看交付物与执行结果。`:`The task is closed. Review its deliverables and results.`):n.task.phase===`review`?c?`请检查交付物并勾选通过的验收项。`:`Review the deliverables and check the criteria that pass.`:(C&&k[C.status])??b?.summary??(c?`任务尚未开始,可开始执行或设置执行时间。`:`Start the task or set an execution time.`)),f=n.attention.length>0?(0,K.jsx)(`ul`,{className:`mt-3 space-y-3`,children:n.attention.map((e,t)=>{let r=d.some(t=>e.kind===`input_required`&&t.kind===`user_input`||e.kind===`approval_required`&&t.kind===`approval`);return(0,K.jsxs)(`li`,{className:`text-sm leading-6 text-fg-muted`,children:[(0,K.jsx)(U,{content:e.summary,contentKey:`${n.task.id}:attention:${e.kind}:${t}`,language:i,previewHeight:72,children:(0,K.jsx)(x,{content:fe(e.summary),compact:!0,breaks:!0})}),!r&&(e.kind===`input_required`||e.kind===`approval_required`)?(0,K.jsx)(s,{className:`mt-2 inline-flex min-h-11 items-center rounded-lg bg-accent-soft px-3 font-medium text-accent-fg`,to:ae(n.task.id),children:c?e.kind===`approval_required`?`查看并决定`:`补充信息`:e.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${e.kind}-${t}`)})}):null,m=o,h=-1,g=c?`当前需要处理`:`Current action`,_=`rounded-xl bg-surface-panel p-4`;let A=e?c?`需要你处理`:`Your action needed`:c?`当前进展`:`Current progress`,j=d.length>1?` · ${d.length}`:``;t[27]!==A||t[28]!==j?(v=(0,K.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[A,j]}),t[27]=A,t[28]=j,t[29]=v):v=t[29];let M;t[30]!==n||t[31]!==a||t[32]!==c?(M=e=>(0,K.jsx)(Qe,{wait:e,detail:n,zh:c,onUpdated:a},e.id),t[30]=n,t[31]=a,t[32]=c,t[33]=M):M=t[33],y=d.map(M),t[2]=n,t[3]=r,t[4]=i,t[5]=a,t[6]=u,t[7]=o,t[8]=c,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g,t[15]=_,t[16]=v,t[17]=y}else d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=t[16],y=t[17];let b;t[34]!==d.length||t[35]!==f||t[36]!==n.task||t[37]!==i||t[38]!==p||t[39]!==c?(b=d.length>0?f?(0,K.jsxs)(`details`,{className:`mt-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:c?`等待详情`:`Waiting details`}),f]}):null:f??(0,K.jsx)(U,{content:p,contentKey:`${n.task.id}:current-progress`,language:i,previewHeight:72,className:`mt-2 text-sm leading-6 text-fg-muted`,children:(0,K.jsx)(x,{content:fe(p),compact:!0})}),t[34]=d.length,t[35]=f,t[36]=n.task,t[37]=i,t[38]=p,t[39]=c,t[40]=b):b=t[40];let S;return t[41]!==m||t[42]!==h||t[43]!==g||t[44]!==_||t[45]!==v||t[46]!==y||t[47]!==b?(S=(0,K.jsxs)(`section`,{ref:m,tabIndex:h,"aria-label":g,className:_,children:[v,y,b]}),t[41]=m,t[42]=h,t[43]=g,t[44]=_,t[45]=v,t[46]=y,t[47]=b,t[48]=S):S=t[48],S}function Et(e){return!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)}function Dt(e){return(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`}function Ot(e){return e.kind===`paused`}function kt(e){let t=(0,G.c)(17),{children:n,contentKey:r,language:i,className:o}=e,s=(0,W.useId)(),c=W.Children.toArray(n),[l,u]=a(),d;t[0]!==r||t[1]!==l?(d=l.getAll(`taskExpanded`).includes(r),t[0]=r,t[1]=l,t[2]=d):d=t[2];let f=d,p=f?c:c.slice(0,3),m;t[3]!==s||t[4]!==p?(m=(0,K.jsx)(`ul`,{id:s,className:`space-y-1.5`,children:p}),t[3]=s,t[4]=p,t[5]=m):m=t[5];let h;t[6]!==r||t[7]!==f||t[8]!==s||t[9]!==c.length||t[10]!==i||t[11]!==u?(h=c.length>3?(0,K.jsx)(`button`,{type:`button`,"aria-expanded":f,"aria-controls":s,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>u(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);return t.delete(`taskExpanded`),n.forEach(e=>t.append(`taskExpanded`,e)),f||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:i===`zh`?f?`收起`:`查看全部(${c.length})`:f?`Show less`:`Show all (${c.length})`}):null,t[6]=r,t[7]=f,t[8]=s,t[9]=c.length,t[10]=i,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==o||t[14]!==m||t[15]!==h?(g=(0,K.jsxs)(`div`,{className:o,children:[m,h]}),t[13]=o,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function At({taskId:e}){let t=u(e=>e.conversationId),n=d(e=>e.language),[r,i]=(0,W.useState)(``),[a,o]=(0,W.useState)(null),[s,c]=(0,W.useState)(!1),[p,m]=(0,W.useState)(!1),[h,g]=(0,W.useState)([]),[_,v]=(0,W.useState)(null),y=l(`/api/tasks/${encodeURIComponent(e)}/collaboration`),{data:b,error:x,mutate:S}=pe([`task-collaboration`,e,t],()=>f(`${y}?recent=1`),{revalidateOnFocus:!0}),C=[...new Map([...h,...b?.items??[]].map(e=>[e.id,e])).values()].sort((e,t)=>e.sequence-t.sequence),w=async()=>{let e=C[0];if(!(!e||p)){m(!0);try{let t=await f(`${y}?recent=1&beforeSequence=${e.sequence}`);g(e=>[...t.items,...e])}catch(e){v(e instanceof Error?e.message:String(e))}finally{m(!1)}}};(0,W.useEffect)(()=>{let t=t=>{let n=t.detail;(!n?.taskId||n.taskId===e)&&S()};return window.addEventListener(`task-collaboration-entry-added`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-collaboration-entry-added`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[S,e]);let T=async()=>{if(!(!r.trim()||s)){c(!0),v(null);try{await f(y,{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({kind:a?`answer`:`instruction`,body:r.trim(),...a?{causationId:a}:{}})}),i(``),o(null),await S()}catch(e){v(e instanceof Error?e.message:String(e))}finally{c(!1)}}};return(0,K.jsxs)(`section`,{className:`rounded-xl bg-surface-inset p-4`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n===`zh`?`任务留言`:`Task updates`}),(0,K.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-2 overflow-y-auto`,children:[!b&&!x?(0,K.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,K.jsx)(le,{className:`h-14 w-full`}),(0,K.jsx)(le,{className:`h-14 w-4/5`})]}):null,x?(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:n===`zh`?`暂时无法读取留言`:`Updates unavailable`}):null,C[0]&&C[0].sequence>1?(0,K.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>void w(),className:`text-xs text-accent hover:underline disabled:opacity-50`,children:n===`zh`?`查看更早留言`:`Earlier updates`}):null,C.map(t=>(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 text-sm`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,K.jsx)(`span`,{children:t.authorKind===`worker_agent`?n===`zh`?`执行 Agent`:`Worker`:t.authorKind===`main_agent`?n===`zh`?`主 Agent`:`Main Agent`:t.authorKind===`system`?n===`zh`?`系统`:`System`:n===`zh`?`用户`:`You`}),(0,K.jsxs)(`span`,{children:[`· `,t.kind]}),t.deliveryStatus?(0,K.jsxs)(`span`,{children:[`· `,t.deliveryStatus]}):null]}),(0,K.jsx)(`div`,{className:`mt-1 min-w-0 text-fg`,"data-task-collaboration-body":!0,children:(0,K.jsx)(U,{content:t.body,contentKey:`${e}:update:${t.id}`,language:n,breaks:!0,previewHeight:120})}),t.kind===`question`&&t.authorKind===`worker_agent`?(0,K.jsx)(`button`,{type:`button`,className:`mt-2 text-xs text-accent hover:underline`,onClick:()=>o(t.id),children:n===`zh`?`回复问题`:`Reply`}):null]},t.id)),b&&!C.length?(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n===`zh`?`暂无进展留言`:`No updates yet`}):null]}),a?(0,K.jsxs)(`p`,{className:`mt-3 text-xs text-accent`,children:[n===`zh`?`正在回复执行 Agent 的问题`:`Replying to the worker`,(0,K.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>o(null),children:n===`zh`?`取消`:`Cancel`})]}):null,(0,K.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),rows:2,"aria-label":n===`zh`?`任务留言`:`Task message`,placeholder:n===`zh`?`给执行 Agent 留言`:`Message the worker`,className:`mt-3 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),_?(0,K.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:_}):null,(0,K.jsx)(`button`,{type:`button`,disabled:!r.trim()||s,onClick:()=>void T(),className:`mt-2 rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white disabled:opacity-50`,children:s?n===`zh`?`发送中`:`Sending`:n===`zh`?`发送`:`Send`})]})}function jt(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Mt(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}function Nt(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function Pt(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ft(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var It=[`backlog`,`ready`,`active`,`review`,`closed`],Lt=[`low`,`normal`,`high`,`critical`],Rt=(0,W.memo)(function(e){let t=(0,G.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:l}=e,u;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(u=e=>e!==n&&!i&&!(e===`closed`?a:n===`closed`&&o),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=u):u=t[4];let d=u,f;t[5]===c?f=t[6]:(f=(0,K.jsx)(`span`,{children:c}),t[5]=c,t[6]=f);let p;t[7]===l?p=t[8]:(p=e=>l(e.target.value),t[7]=l,t[8]=p);let m;t[9]!==s||t[10]!==d?(m=It.map(e=>(0,K.jsx)(P,{value:e,disabled:d(e),children:Nt(e,s)},e)),t[9]=s,t[10]=d,t[11]=m):m=t[11];let h;t[12]!==r||t[13]!==p||t[14]!==m||t[15]!==n?(h=(0,K.jsx)(N,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:p,children:m}),t[12]=r,t[13]=p,t[14]=m,t[15]=n,t[16]=h):h=t[16];let g;return t[17]!==f||t[18]!==h?(g=(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[f,h]}),t[17]=f,t[18]=h,t[19]=g):g=t[19],g}),zt=(0,W.memo)(function(e){let t=(0,G.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,K.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=Lt.map(e=>(0,K.jsx)(P,{value:e,children:a[e]},e)),t[4]=a,t[5]=l);let u;t[6]!==r||t[7]!==c||t[8]!==l||t[9]!==n?(u=(0,K.jsx)(N,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:l}),t[6]=r,t[7]=c,t[8]=l,t[9]=n,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,u]}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}),Bt=(0,W.memo)(function(e){let t=(0,G.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,K.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,K.jsx)(Ge,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,K.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Vt=(0,W.memo)(function(e){let t=(0,G.c)(36),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,language:s,onChange:c}=e,l,u,d,f,m,h,g,_,v,y;if(t[0]!==o||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==c||t[5]!==a||t[6]!==n){let{agentsSettings:e}=p(s);v=`grid gap-1.5 text-xs text-fg-muted`,t[17]===i?y=t[18]:(y=(0,K.jsx)(`span`,{children:i}),t[17]=i,t[18]=y),l=N,u=`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,d=`border-0`,f=n,m=r,t[19]===c?h=t[20]:(h=e=>c(e.target.value),t[19]=c,t[20]=h),t[21]===a?g=t[22]:(g=(0,K.jsx)(P,{value:``,disabled:!0,children:a}),t[21]=a,t[22]=g),_=o.map(t=>(0,K.jsx)(P,{value:t.id,children:Me(t,e)},t.id)),t[0]=o,t[1]=r,t[2]=i,t[3]=s,t[4]=c,t[5]=a,t[6]=n,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else l=t[7],u=t[8],d=t[9],f=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16];let b;t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==f||t[27]!==m||t[28]!==h||t[29]!==g||t[30]!==_?(b=(0,K.jsxs)(l,{triggerClassName:u,contentClassName:d,value:f,disabled:m,onChange:h,children:[g,_]}),t[23]=l,t[24]=u,t[25]=d,t[26]=f,t[27]=m,t[28]=h,t[29]=g,t[30]=_,t[31]=b):b=t[31];let x;return t[32]!==b||t[33]!==v||t[34]!==y?(x=(0,K.jsxs)(`label`,{className:v,children:[y,b]}),t[32]=b,t[33]=v,t[34]=y,t[35]=x):x=t[35],x}),Ht=(0,W.memo)(function(e){let t=(0,G.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(Qt),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,K.jsx)(tt,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Ut=`xopc.taskDetail.chatPanelPercent`,Wt=42;function Gt(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Wt:Math.min(r,Math.max(n,e))}function Kt(){try{let e=Number(window.localStorage.getItem(Ut));return Number.isFinite(e)&&e>=30&&e<=60?e:Wt}catch{return Wt}}function qt(e){let t=(0,G.c)(13),{items:n,empty:r,contentKey:i}=e,a=d(Yt);if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,K.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let o;t[2]===n?o=t[3]:(o=n.join(`
3
+ `),t[2]=n,t[3]=o);let s;t[4]===n?s=t[5]:(s=n.map(Jt),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,K.jsx)(`ul`,{className:`space-y-2`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==c?(l=(0,K.jsx)(U,{content:o,contentKey:i,language:a,previewHeight:144,children:c}),t[8]=i,t[9]=a,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}function Jt(e){return(0,K.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,K.jsx)(F,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,K.jsx)(`span`,{className:`min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e})]},e)}function Yt(e){return e.language}function Xt({taskId:e,presentation:t,backgroundPath:n,onDeleted:r,onHeaderChange:o}){let[l,f]=a(),m=i(),h=d(e=>e.language),g=u(e=>e.conversationId),_=(0,W.useMemo)(()=>Oe(h),[h]),v=ke(e=>e.setPageHeader),y=ke(e=>e.clearPageHeader),b=De(e=>e.panes),x=S(e=>e.openForSession),{data:C,error:T,mutate:k,lastChange:A,conversationLoading:j,conversationError:M}=w(e),{data:N,error:P,mutate:F}=pe(e?[`task-detail-automations`,g]:null,()=>je.list(),{refreshInterval:3e4}),[R,z]=(0,W.useState)(null),[fe,me]=(0,W.useState)(null),[H,Be]=(0,W.useState)(()=>new Set),[Ve,He]=(0,W.useState)([]),[Ue,We]=(0,W.useState)(null),[Ge,Ke]=(0,W.useState)([]),[Ye,Ze]=(0,W.useState)(!1),[Qe,$e]=(0,W.useState)(``),[tt,G]=(0,W.useState)(!1),[at,st]=(0,W.useState)(``),[ct,lt]=(0,W.useState)(Kt),[dt,pt]=(0,W.useState)(!1),mt=(0,W.useRef)(null),ht=(0,W.useRef)(null),gt=(0,W.useRef)(null),{key:_t,state:vt}=c(),yt=vt?.focusTaskResults,Ct=!!C;(0,W.useEffect)(()=>{if(!Ct||yt!==e)return;let t=requestAnimationFrame(()=>{ht.current?.scrollIntoView?.({block:`start`}),ht.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[yt,_t,Ct,e]);let Et=(0,W.useRef)(null),Dt=(0,W.useRef)(null),[Ot,Nt]=(0,W.useState)(!1),It=(0,W.useRef)(!1),Lt=(0,W.useRef)(!1),Jt=(0,W.useRef)(``),Yt=(0,W.useRef)(null),Xt=(0,W.useRef)(null),Zt=(0,W.useRef)(null),Qt=(0,W.useRef)(C),[$t,q]=(0,W.useState)(null),[en,tn]=(0,W.useState)(null),[nn,rn]=(0,W.useState)(!1),[an,on]=(0,W.useState)(!1),[sn,cn]=(0,W.useState)(null),ln=(0,W.useRef)(null),un=(0,W.useMemo)(()=>({link:_.linkDependencies,linked:_.linkedDependencies,searchPlaceholder:_.dependencySearchPlaceholder,noMatches:_.noDependencyMatches,noCandidates:_.noDependencyCandidates,remove:_.removeDependency}),[_.dependencySearchPlaceholder,_.linkDependencies,_.linkedDependencies,_.noDependencyCandidates,_.noDependencyMatches,_.removeDependency]),dn=C?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,fn=(0,W.useMemo)(()=>ne(l.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[l]),pn=(0,W.useCallback)(e=>t===`modal`&&n?ie(n,e):re(`/tasks/${encodeURIComponent(e)}`,fn),[n,t,fn]);Qt.current=C;let J=(0,W.useCallback)((e,t)=>{Be(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,W.useEffect)(()=>{z(null),me(null),q(null),Ze(!1),Yt.current=null,G(!1),tn(null),rn(!1),on(!1),cn(null)},[e]),(0,W.useEffect)(()=>{let e=!0;return Ee().then(t=>{e&&Ke(t.items)}).catch(()=>void 0),()=>{e=!1}},[g]),(0,W.useEffect)(()=>{if(!A||A.source===`user`)return;tn(A);let e=window.setTimeout(()=>tn(null),3500);return()=>window.clearTimeout(e)},[A]),(0,W.useEffect)(()=>{let t=C?.task.projectId,n=C?.dependencies??[];if(!t){Zt.current=null,We(null),He(n);return}Zt.current!==t&&(Zt.current=t,We(null));let r=!0;return de(t).then(t=>{if(!r)return;We(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});He([...i.values()])}).catch(()=>{r&&He(n)}),()=>{r=!1}},[dn,C?.task.projectId,e]);let Y=(0,W.useCallback)(async(t,n=`command`)=>{let r=Qt.current;if(r){J(n,!0),z(null),t.type===`signoff`&&me(null);try{await k(await we(e,t,r.task.version),{revalidate:!1})}catch{z(_.actionFailed),t.type===`signoff`&&me(_.actionFailed)}finally{J(n,!1)}}},[_.actionFailed,k,J,e]),mn=(0,W.useCallback)(async(t,n)=>{let r=Qt.current;if(!r)return!1;n&&J(n,!0),z(null);try{let n=ge(e,t,r.task.version);return await k(n,{optimisticData:Mt(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return z(_.actionFailed),!1}finally{n&&J(n,!1)}},[_.actionFailed,k,J,e]),hn=()=>{C&&(Yt.current={value:C.task.title,version:C.task.version},q(null),$e(C.task.title),Ze(!0))},gn=()=>{It.current=!0,$e(Qt.current?.task.title??``),Yt.current=null,q(null),Ze(!1),queueMicrotask(()=>{It.current=!1})},_n=async(e=!1)=>{if(It.current){It.current=!1;return}let t=Qt.current;if(!t||H.has(`title`))return;let n=Qe.trim();if(!n){gn();return}let r=Yt.current;if(!e&&jt(r,t.task.version,t.task.title,n)){q(`title`);return}if(n===t.task.title){gn();return}await mn({title:n},`title`)&&(Yt.current=null,q(null),Ze(!1))},vn=async()=>{if(!C)return;if(Lt.current){Lt.current=!1;return}let e=at.trim(),t=Xt.current;if(jt(t,C.task.version,C.task.body??``,e)){q(`description`);return}if(at===Jt.current||e===(C.task.body??``).trim()){G(!1);return}await mn({body:e||null})&&(q(null),G(!1))},yn=(0,W.useCallback)(async e=>{let t=Qt.current;!t||e===t.task.phase||await Y({type:`move`,phase:e},`phase`)},[Y]),bn=(0,W.useCallback)(e=>{mn({priority:e},`priority`)},[mn]),xn=(0,W.useCallback)(e=>{mn({dueAt:Ft(e)},`dueAt`)},[mn]),Sn=(0,W.useCallback)(e=>{lt(e);try{window.localStorage.setItem(Ut,String(e))}catch{}},[]),Cn=(0,W.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=Et.current?.clientWidth??0,n=e.key===`Home`?Wt:ct+(e.key===`ArrowLeft`?2:-2);Sn(Gt(n,t))},[ct,Sn]),wn=(0,W.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=Et.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),pt(!0);let i=ct,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Gt((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}pt(!1),Sn(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[ct,Sn]),Tn=(0,W.useCallback)(async t=>{let n=Qt.current;if(n){J(`dependencies`,!0),z(null);try{await k(await he(e,t,n.task.version),{revalidate:!1})}catch{z(_.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[_.dependencyUpdateFailed,k,J,e]),En=(0,W.useCallback)(async t=>{let n=Qt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),z(null);try{await k(await _e(e,t,n.task.version),{revalidate:!1})}catch{z(_.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[_.actionFailed,k,J,e]),Dn=(0,W.useCallback)(async()=>{J(`delete`,!0),z(null);try{await ye(e),r?r():m(fn,{replace:!0})}catch(e){z(e instanceof Error?e.message:_.actionFailed)}finally{J(`delete`,!1)}},[_.actionFailed,m,r,fn,J,e]),On=(0,W.useCallback)(async(t,n,r)=>{if(!t.acceptanceTarget)return!1;J(`acceptance`,!0),me(null),z(null);try{return await k(await Te(e,ue(e,t.task.latestContractVersion,n),r,t.task.version,t.task.latestContractVersion,t.acceptanceTarget.id),{revalidate:!1}),!0}catch{return me(_.actionFailed),z(_.actionFailed),k().catch(()=>void 0),!1}finally{J(`acceptance`,!1)}},[_.actionFailed,k,J,e]),kn=C?.task.title,An=kn!==void 0;if((0,W.useLayoutEffect)(()=>{let e=Dt.current,t=e?.parentElement;if(!An||!e||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(([e])=>{let n=it(t),r=n?n.getBoundingClientRect().top+n.clientTop:0;Nt(!e.isIntersecting&&e.boundingClientRect.bottom<=r)});return n.observe(e),()=>n.disconnect()},[An,e]),(0,W.useLayoutEffect)(()=>{o?.({taskId:e,title:kn,compact:Ot})},[Ot,o,e,kn]),(0,W.useLayoutEffect)(()=>{if(t!==`modal`)return v({startExtra:(0,K.jsx)(s,{to:fn,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":_.backToWork,children:(0,K.jsx)(D,{className:`size-4`})}),main:An?(0,K.jsx)(`div`,{className:`min-w-0 text-sm font-semibold text-fg`,children:(0,K.jsx)(Xe,{label:Ue?`${Ue} / ${_.taskLabel}`:_.taskLabel,title:kn,compact:Ot})}):null,end:e?(0,K.jsx)(s,{to:`/space?taskId=${encodeURIComponent(e)}`,className:`rounded-lg px-2.5 py-2 text-sm text-fg-muted hover:bg-surface-hover`,children:h===`zh`?`成果`:`Results`}):null}),y},[y,Ot,_.backToWork,_.taskLabel,An,h,t,Ue,fn,v,e,kn]),T&&!C)return(0,K.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:_.taskNotFound});if(!C)return(0,K.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,K.jsx)(Je,{})});let jn=C.waits[0],X=C.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),Mn=ve(C),Nn=Mn.length>0&&Mn.every(e=>e.status===`passed`),Pn=C.waits.find(e=>e.kind===`paused`),Fn=Se(C),In=Ce(C),Ln=_.detailStatuses[In],Rn=C.task.body?.trim()||C.task.contract?.objective.trim()||``,zn=C.allowedCommands.includes(`mark_ready`),Bn=C.allowedCommands.includes(`start`),Vn=C.allowedCommands.includes(`add_wait`),Hn=!jn&&!X&&Nn&&C.presentation.primaryAction?.type===`review`&&C.allowedCommands.includes(`close`),Un=C.allowedCommands.includes(`reopen`),Z=C.conversation.activeConversationId,Q=C.conversation.currentExecutorAgentId??C.task.delegateAgentId??C.task.ownerId,Wn=Ge.find(e=>e.id===Q),Gn=p(h).agentsSettings,Kn=Wn?Me(Wn,Gn):void 0,qn=X?.executorKind===`agent`?Ge.find(e=>e.id===(X.executorRef.agentId??C.conversation.currentExecutorAgentId)):void 0,Jn=qn?Me(qn,Gn):void 0,Yn=!!(Z&&b[Z]?.open),Xn=C.context.filter(e=>e.role!==`deliverable`),Zn=N?.automations.filter(t=>t.action.kind===`task_command`&&t.action.taskId===e)??[],$=Zn.filter(e=>e.trigger.kind===`schedule`&&e.action.kind===`task_command`&&e.action.command.type===`start`),Qn=$.filter(e=>e.enabled&&e.state.nextRunAtMs!==void 0).map(e=>e.state.nextRunAtMs).sort((e,t)=>e-t)[0],$n=e=>{F(t=>({automations:[e,...(t?.automations??[]).filter(t=>t.id!==e.id)]}),{revalidate:!1})},er=e=>{cn(e),on(!0)},tr=()=>{N&&($.length===1?er($[0]):$.length>1?(ln.current&&(ln.current.open=!0),f(e=>nt(e,`schedule`,!0),{preventScrollReset:!0}),ln.current?.scrollIntoView({block:`start`,behavior:`smooth`}),ln.current?.focus({preventScroll:!0})):(cn(null),on(!0)))},nr=C.sessions.filter((e,t,n)=>n.findIndex(t=>t.conversationId===e.conversationId)===t),rr=C.task.contract?.expectedOutputs??[],ir=C.task.contract?.constraints??[],ar=C.task.contract?.approvalRequired??[],or=C.task.contract?.assumptions??[],sr=C.task.contract?.risks??[],cr=ir.length>0||ar.length>0||or.length>0||sr.length>0,lr=(...e)=>!!en?.changedFields.some(t=>e.includes(t)),ur=C.allowedCommands.includes(`move`),dr=H.has(`command`),fr=H.has(`delete`),pr=X!==void 0,mr=()=>{let e=mt.current;e&&(e.open=!0,f(e=>nt(e,`acceptance`,!0),{preventScrollReset:!0}),e.scrollIntoView({block:`start`,behavior:`smooth`}),e.focus({preventScroll:!0}))},hr=C.presentation.primaryAction,gr=()=>{Q&&Y({type:`start`,executor:{kind:`agent`,agentId:Q}})},_r=()=>{ht.current?.scrollIntoView({block:`start`,behavior:`smooth`}),ht.current?.focus({preventScroll:!0})},vr=(()=>{switch(hr?.type){case`mark_ready`:return{label:_.scheduleTask,activate:()=>void Y({type:`mark_ready`})};case`resume`:return{label:_.resumeTask,activate:()=>void Y({type:`resolve_wait`,waitId:hr.waitId})};case`resolve_wait`:{let t=C.waits.find(e=>e.id===hr.waitId),n=t&&t.condition.type!==`connection`&&(t.kind===`user_input`||t.kind===`approval`&&typeof t.condition.capability==`string`);return{label:h===`zh`?`处理待办`:`Resolve pending item`,activate:()=>n?gt.current?.focus():m(ae(e))}}case`inspect_run`:return{label:h===`zh`?`查看待处理事项`:`View pending issue`,activate:()=>gt.current?.focus()};case`review`:return{label:h===`zh`?`去验收`:`Review results`,activate:mr};case`signoff`:return{label:h===`zh`?`确认验收`:`Accept result`,activate:()=>void Y({type:`signoff`,resultId:hr.resultId})};case`view_results`:return{label:h===`zh`?`查看结果`:`View results`,activate:_r};case`retry_allocation`:return{label:h===`zh`?`重新分配`:`Retry assignment`,activate:()=>void Y({type:`retry_allocation`})};case`retry_run`:{let e=C.runs.find(e=>e.id===hr.runId),t=e?.executorKind===`agent`&&typeof e.executorRef.agentId==`string`?e.executorRef.agentId:void 0;return{label:h===`zh`?`重试任务`:`Retry task`,disabled:!t,activate:()=>{t&&Y({type:`start`,executor:{kind:`agent`,agentId:t}})}}}case`start`:return{label:_.runTask,activate:gr,disabled:!Q}}})(),yr=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[vr?(0,K.jsx)(V,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:dr||vr.disabled,onClick:vr.activate,children:vr.label}):null,Un?(0,K.jsxs)(V,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`ghost`,disabled:dr,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,K.jsx)(ce,{className:`size-4`}),_.reopenTask]}):null,C.task.phase!==`review`&&!Pn&&Vn?(0,K.jsxs)(V,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:dr,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,K.jsx)(se,{className:`size-4`}),_.pauseTask]}):null,!jn&&!X&&C.task.phase!==`closed`&&C.task.phase!==`review`?(0,K.jsxs)(V,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:!N,onClick:tr,children:[(0,K.jsx)(O,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`]}):null,(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Fe,{asChild:!0,children:(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:dr||fr,"aria-label":_.moreActions,children:(0,K.jsx)(I,{className:`size-4`,"aria-hidden":!0})})}),(0,K.jsx)(Ie,{children:(0,K.jsxs)(Re,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[C.task.phase===`review`&&!Pn&&Vn?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:_.pauseTask}):null,C.task.phase===`review`&&!jn&&!X?(0,K.jsx)(Le,{disabled:!N,className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:opacity-50`,onSelect:tr,children:$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`}):null,C.task.phase===`review`&&!jn&&Bn&&Q?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Q}}),children:_.runTask}):null,zn&&(Bn||jn||C.task.phase===`review`)?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Y({type:`mark_ready`}),children:_.scheduleTask}):null,X?(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{J(`command`,!0),z(null),k(xe(e,X.id,X.version),{revalidate:!1}).catch(()=>z(_.actionFailed)).finally(()=>J(`command`,!1))},children:_.cancelActiveRun}):null,X?(0,K.jsx)(ze,{className:`my-1 h-px bg-edge`}):null,C.task.phase===`closed`?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:_.cancelTask}),(0,K.jsx)(ze,{className:`my-1 h-px bg-edge`})]}),(0,K.jsx)(Le,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(pr){z(_.deleteActiveTaskBlocked);return}rn(!0)},children:_.deleteTask})]})})]})]});return(0,K.jsxs)(`div`,{ref:Et,className:`flex h-full min-h-0 flex-col overflow-hidden ${dt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${ct}%`},children:[(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`task-detail-scroll flex min-w-0 shrink-0 flex-col bg-surface-base lg:min-h-0 lg:flex-1 lg:shrink lg:overflow-y-auto lg:overscroll-contain`,children:[(0,K.jsxs)(`header`,{ref:Dt,className:B(`shrink-0 px-4 py-5 sm:px-6 sm:py-6`,lr(`title`)&&`task-detail-live-update`),children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[Ue?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),Ue]}):null,Ue?(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`/`}):null,(0,K.jsx)(`span`,{children:_.taskLabel}),en?(0,K.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:en.source===`agent`?h===`zh`?`Agent 刚刚更新`:`Updated by Agent`:h===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ye?(0,K.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,"aria-label":h===`zh`?`任务标题`:`Task title`,rows:2,value:Qe,onFocus:e=>{Yt.current?.value===Qe&&(e.currentTarget.setSelectionRange(0,0),e.currentTarget.scrollTop=0)},onChange:e=>$e(e.target.value),onBlur:()=>void _n(),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),gn()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),e.currentTarget.blur()))},className:`mt-2 block max-h-56 min-h-14 w-full max-w-3xl resize-none overflow-y-auto bg-transparent p-0 text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl outline-none [field-sizing:content]`}):(0,K.jsx)(U,{content:C.task.title,contentKey:`${e}:title`,language:h,previewHeight:56,className:`mt-2 max-w-3xl`,children:(0,K.jsx)(`h1`,{className:`break-words text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl`,children:(0,K.jsx)(`button`,{type:`button`,className:`max-w-full whitespace-pre-wrap break-words [overflow-wrap:anywhere] rounded-sm text-left outline-none hover:bg-surface-hover/60 focus-visible:ring-2 focus-visible:ring-accent/40`,title:C.task.title,onClick:hn,children:C.task.title})})}),$t===`title`?(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,K.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:gn,children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,disabled:H.has(`title`),onClick:()=>void _n(!0),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,K.jsx)(`span`,{className:B(`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium`,be(In)),children:Ln})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[Q?(0,K.jsx)(Ae,{agentId:Q,avatar:Wn?.avatar,size:20,className:`shrink-0`}):null,(0,K.jsxs)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[_.executorLabel,` · `,Kn??Q??_.unassigned]})]}),(0,K.jsx)(`span`,{className:`text-fg-subtle`,children:_.updatedAt.replace(`{{date}}`,qe(C.task.updatedAt,h))})]})]}),(0,K.jsxs)(`div`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center justify-end gap-2 border-b border-edge-subtle bg-surface-panel px-4 py-2 sm:px-5`,"aria-label":h===`zh`?`任务操作`:`Task actions`,children:[yr,R?(0,K.jsx)(`p`,{role:`alert`,className:`basis-full text-sm text-danger`,children:R}):null,(0,K.jsx)(ot,{language:h,hasSchedule:$.length>0},e)]}),(0,K.jsxs)(`section`,{className:`min-w-0 space-y-4 p-4 sm:p-5`,children:[In===`review`?null:(0,K.jsx)(Tt,{ref:gt,detail:C,executorName:Jn,language:h,onUpdated:e=>{k(e,{revalidate:!1})}}),(0,K.jsxs)(`section`,{"data-task-section":`results`,"data-task-section-label":h===`zh`?`交付结果`:`Results`,ref:ht,tabIndex:-1,"aria-labelledby":`task-results-heading`,className:`scroll-mt-24 space-y-4`,children:[(0,K.jsx)(ft,{detail:C,language:h}),(0,K.jsx)(rt,{panelId:`acceptance`,chevron:!0,"data-task-section":`acceptance`,"data-task-section-label":h===`zh`?`验收`:`Acceptance`,defaultOpen:!0,ref:mt,tabIndex:-1,"aria-label":_.successDefinition,className:`scroll-mt-24 overflow-hidden rounded-2xl bg-surface-panel`,summaryClassName:`min-h-12 cursor-pointer px-4 py-2 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:(0,K.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[h===`zh`?`验收`:`Acceptance`,(0,K.jsxs)(`span`,{"aria-live":`polite`,className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium tabular-nums text-fg-muted`,children:[Mn.filter(e=>e.status===`passed`).length,`/`,Mn.length]})]}),children:(0,K.jsx)(ut,{criteria:Mn,language:h,closed:C.task.phase===`closed`,pending:H.has(`acceptance`),error:fe,reviewDisabled:!C.acceptanceTarget||C.presentation.primaryAction?.type===`inspect_run`,blockedReason:jn?h===`zh`?`请先处理待办事项`:`Resolve the pending request first`:X?h===`zh`?`请等待当前执行结束`:`Wait for the current run to finish`:void 0,onReview:(e,t)=>On(C,e,t),projectId:C.task.projectId,conversationId:Z??void 0},`${e}:${C.task.latestContractVersion}:${C.acceptanceTarget?.id??``}`)})]}),(0,K.jsx)(rt,{panelId:`report`,chevron:!0,defaultOpen:!0,"data-task-section":`report`,"data-task-section-label":h===`zh`?`执行报告`:`Report`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`完整执行报告`:`Full execution report`,children:(0,K.jsx)(bt,{detail:C,language:h},Fn?.runId??e)}),!N&&!P?(0,K.jsx)(le,{className:`h-9 rounded-lg`}):null,P?(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-danger`,children:[(0,K.jsx)(`span`,{children:h===`zh`?`无法读取执行计划,请重试后再设置时间。`:`Could not load schedules. Retry before setting a time.`}),(0,K.jsx)(V,{variant:`ghost`,onClick:()=>void F(),children:h===`zh`?`重试`:`Retry`})]}):null,$.length>0?(0,K.jsx)(rt,{panelId:`schedule`,chevron:!0,defaultOpen:!0,"data-task-section":`schedule`,"data-task-section-label":h===`zh`?`执行时间`:`Schedule`,ref:ln,tabIndex:-1,className:`scroll-mt-24 rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm text-fg-muted`,title:(0,K.jsxs)(K.Fragment,{children:[h===`zh`?`执行时间`:`Execution schedule`,` · `,$.length,Qn===void 0?``:` · ${h===`zh`?`下次执行:`:`Next run: `}${qe(Qn,h)}`]}),children:(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(St,{schedules:$,language:h,onEdit:er,onUpdated:$n})})}):null,(0,K.jsx)(rt,{panelId:`goal`,chevron:!0,defaultOpen:!0,"data-task-section":`goal`,"data-task-section-label":h===`zh`?`目标说明`:`Goal`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`任务目标与说明`:`Task goal and description`,children:(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,K.jsxs)(`div`,{className:`border-b border-edge-subtle p-5`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h===`zh`?`任务目标`:`Task goal`}),(0,K.jsx)(U,{content:C.task.contract?.objective||C.task.title,contentKey:`${e}:goal`,language:h,markdown:!1,previewHeight:72,className:`mt-3 text-sm leading-6 text-fg`}),(0,K.jsxs)(V,{variant:`ghost`,className:`mt-2 min-h-9 px-2 text-xs`,onClick:mr,children:[_.successDefinition,` · `,Mn.length]})]}),rr.length>0?(0,K.jsxs)(`div`,{className:`p-5`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.expectedOutputs}),(0,K.jsx)(`div`,{className:`mt-2`,children:(0,K.jsx)(qt,{contentKey:`${e}:expectedOutputs`,items:rr,empty:_.noDefinition})})]}):null,(0,K.jsxs)(`details`,{className:B(`p-5`,lr(`body`)&&`task-detail-live-update`),children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:_.taskDescription}),tt?(0,K.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:at,onChange:e=>st(e.target.value),onBlur:()=>void vn(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Lt.current=!0,st(C.task.body??C.task.contract?.objective??``),G(!1),queueMicrotask(()=>{Lt.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,K.jsxs)(`div`,{className:`mt-2`,children:[Rn&&Rn!==C.task.title?(0,K.jsx)(U,{content:Rn,contentKey:`${e}:description`,language:h}):(0,K.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:_.noTaskDescription}),(0,K.jsx)(`button`,{type:`button`,className:`mt-2 rounded-md px-2 py-1 text-xs text-accent hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=C.task.body??C.task.contract?.objective??``;Jt.current=e,Xt.current={value:C.task.body??``,version:C.task.version},q(null),st(e),G(!0)},children:h===`zh`?`编辑说明`:`Edit description`})]}),$t===`description`?(0,K.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,K.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{st(C.task.body??``),q(null),G(!1)},children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,K.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void mn({body:at.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),cr?(0,K.jsxs)(`section`,{className:B(`p-5`,lr(`contract`)&&`task-detail-live-update`),children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDefinition}),(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:h===`zh`?`执行边界及补充背景`:`Execution boundaries and supporting context`}),ir.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.constraints}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:constraints`,items:ir,empty:_.noDefinition})})]}):null,ar.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.approvalRequired}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:approvalRequired`,items:ar,empty:_.noDefinition})})]}):null,or.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextAssumptions}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:assumptions`,items:or,empty:_.noDefinition})})]}):null,sr.length>0?(0,K.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextRisks}),(0,K.jsx)(`div`,{className:`mt-3`,children:(0,K.jsx)(qt,{contentKey:`${e}:risks`,items:sr,empty:_.noDefinition})})]}):null]}):null]})})}),(0,K.jsxs)(rt,{panelId:`management`,chevron:!0,defaultOpen:!0,"data-task-section":`management`,"data-task-section-label":h===`zh`?`任务管理`:`Management`,"aria-label":h===`zh`?`任务管理`:`Task management`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:h===`zh`?`任务管理`:`Task management`,children:[(0,K.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,K.jsxs)(`section`,{className:B(`p-5`,lr(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskProperties}),(0,K.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,K.jsx)(Rt,{value:C.task.phase,disabled:H.has(`phase`),canMove:ur,canApprove:Hn,canReopen:Un,language:h,label:_.taskPhase,onChange:yn}),(0,K.jsx)(zt,{value:C.task.priority,disabled:H.has(`priority`),label:_.priority,labels:_.priorityLabels,onChange:bn}),(0,K.jsx)(Bt,{value:Pt(C.task.dueAt),disabled:H.has(`dueAt`),label:_.dueDate,onChange:xn}),(0,K.jsx)(Vt,{value:C.conversation.currentExecutorAgentId??``,disabled:H.has(`delegateAgentId`),label:_.executorLabel,unassignedLabel:_.unassigned,agents:Ge,language:h,onChange:En})]})]}),(0,K.jsxs)(`details`,{className:B(`p-5`,lr(`dependencies`)&&`task-detail-live-update`),children:[(0,K.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[_.taskRelations,` · `,C.dependencies.length,` / `,C.dependents.length]}),(0,K.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependencies}),(0,K.jsx)(Ht,{candidates:Ve,selected:C.dependencies,disabled:H.has(`dependencies`),labels:un,getTaskHref:pn,onChange:Tn})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependents}),C.dependents.length>0?(0,K.jsx)(`div`,{className:`space-y-1.5`,children:C.dependents.map(t=>(0,K.jsx)(U,{content:t.title,contentKey:`${e}:dependent:${t.id}`,language:h,previewHeight:72,className:`rounded-lg bg-surface-hover p-2.5`,children:(0,K.jsx)(s,{to:pn(t.id),className:`block break-words [overflow-wrap:anywhere] text-sm text-fg-muted transition-colors hover:text-fg`,children:t.title})},t.id))}):(0,K.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:_.noDependents})]})]})]})]}),C.task.phase===`closed`?null:(0,K.jsxs)(V,{variant:`ghost`,className:`my-3`,disabled:!N,onClick:tr,children:[(0,K.jsx)(O,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:_.scheduleRecurringTask]}),(0,K.jsxs)(`details`,{className:`mb-4 rounded-xl bg-surface-inset p-5`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:h===`zh`?`关联内容`:`Related work`}),nr.length>0||C.runs.length>0||Zn.length>0||C.dependencies.length>0||C.dependents.length>0?(0,K.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[nr.length>0?(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`对话 · ${nr.length}`:`Conversations · ${nr.length}`}),(0,K.jsx)(kt,{contentKey:`${e}:sessions`,language:h,className:`mt-2`,children:nr.map(t=>(0,K.jsx)(`li`,{children:(0,K.jsx)(s,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:t.conversationId===Z?ae(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===Z?h===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?h===`zh`?`关联讨论`:`Linked discussion`:h===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})]}):null,Zn.length>0?(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`自动化 · ${Zn.length}`:`Automations · ${Zn.length}`}),(0,K.jsx)(kt,{contentKey:`${e}:automations`,language:h,className:`mt-2`,children:Zn.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsx)(s,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:`/automations?automation=${encodeURIComponent(e.id)}`,children:e.name})},e.id))})]}):null,C.dependencies.length>0||C.dependents.length>0?(0,K.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,K.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.taskRelations}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg`,children:h===`zh`?`${C.dependencies.length} 个前置任务 · ${C.dependents.length} 个后续任务`:`${C.dependencies.length} prerequisites · ${C.dependents.length} dependents`})]}):null]}):(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h===`zh`?`还没有关联内容`:`No related work yet`}),(0,K.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:(0,K.jsx)(et,{resource:{kind:`task`,id:C.task.id,revision:String(C.task.version)},disabled:Ye||tt||H.size>0})})]}),Xn.length>0?(0,K.jsxs)(`section`,{className:B(`p-5`,lr(`context`)&&`task-detail-live-update`),children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.contextUsed}),(0,K.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:Xn.map(e=>(0,K.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,K.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[_.contextRoleLabels[e.role],` · `,_.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,K.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,K.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,K.jsx)(rt,{panelId:`activity`,chevron:!0,defaultOpen:!0,"data-task-section":`activity`,"data-task-section-label":h===`zh`?`活动留言`:`Activity`,className:`rounded-2xl bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-semibold text-fg`,title:h===`zh`?`活动记录与留言`:`Activity and updates`,children:(0,K.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[(0,K.jsx)(At,{taskId:e},e),(0,K.jsx)(xt,{changes:C.phaseChanges,language:h})]})})]})]}),(0,K.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":h===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(ct),tabIndex:0,onPointerDown:wn,onKeyDown:Cn,onDoubleClick:()=>Sn(Wt),className:`hidden w-2 shrink-0 cursor-col-resize touch-none bg-surface-panel outline-none focus-visible:bg-accent-soft lg:block`}),(0,K.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 shrink-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)]`,children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-4 py-3`,children:[(0,K.jsx)(`h2`,{className:`text-sm font-medium text-fg-muted`,children:h===`zh`?`执行对话`:`Execution chat`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[nr.length>1?(0,K.jsxs)(Pe,{children:[(0,K.jsx)(Fe,{asChild:!0,children:(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,children:h===`zh`?`${nr.length} 段对话`:`${nr.length} conversations`})}),(0,K.jsx)(Ie,{children:(0,K.jsx)(Re,{align:`end`,sideOffset:6,className:`z-[100] min-w-52 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:nr.map(t=>(0,K.jsx)(Le,{asChild:!0,children:(0,K.jsx)(s,{className:`block rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,to:t.conversationId===Z?ae(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===Z?h===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?h===`zh`?`关联讨论`:`Linked discussion`:h===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})})]}):null,Z?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(V,{type:`button`,variant:`ghost`,className:B(`size-8 p-0`,Yn&&`bg-surface-hover text-fg`),"aria-label":h===`zh`?`项目文件`:`Project files`,"aria-pressed":Yn,onClick:()=>{De.getState().openFiles(Z),x(Z)},children:(0,K.jsx)(te,{className:`size-4`,"aria-hidden":!0})}),(0,K.jsx)(V,{asChild:!0,variant:`ghost`,className:`size-8 p-0`,children:(0,K.jsx)(s,{to:ae(e),"aria-label":h===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,K.jsx)(L,{className:`size-4`,"aria-hidden":!0})})})]}):null]})]}),Z?(0,K.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,K.jsx)(E,{embedded:!0,conversationId:Z,taskId:e})}):j?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-xs`,children:[(0,K.jsx)(oe,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):M?(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-xs`,children:[(0,K.jsx)(oe,{className:`mx-auto size-8 text-danger`}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:M instanceof Error?M.message:String(M)})]})}):(0,K.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,K.jsxs)(`div`,{className:`max-w-xs`,children:[(0,K.jsx)(oe,{className:`mx-auto size-8 text-fg-subtle`}),(0,K.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,K.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:h===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]}),an?(0,K.jsx)(wt,{automation:sn??void 0,taskId:e,taskTitle:C.task.title,projectId:C.task.projectId,executorAgentId:Q,language:h,onClose:()=>on(!1),onCreated:$n},`${e}:${sn?.id??`new`}`):null,(0,K.jsx)(Ne,{open:nn,title:_.deleteTaskTitle,description:_.deleteTaskDescription.replace(`{{title}}`,C.task.title),confirmLabel:_.confirmDeleteTask,cancelLabel:_.keepTask,destructive:!0,onConfirm:()=>{rn(!1),Dn()},onCancel:()=>rn(!1)})]})}function Zt(){let e=(0,G.c)(2),{taskId:t}=o(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,K.jsx)(Xt,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Qt(e){return e.id}export{Zt as TaskDetailPage,Xt as TaskDetailView};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BPb7KheU.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-CY7CS_D3.js";import{h as p}from"./chat-page-BbahuZ59.js";import{O as m}from"./markdown-view-C7kqotD-.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./cn-0WouolD0.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{r as v}from"./turn-outcome-BSbEJx8h.js";import{o as y}from"./product-delivery-4gEqUIsK.js";import{n as b}from"./attachment-utils-core-BPYdUI6y.js";import{r as x}from"./right-workspace-store-CFf15f36.js";var S=n(),C=e(t(),1),w=r();function T(e){if(!e)return;let t=URL.parse(e,window.location.origin);return t&&[`http:`,`https:`].includes(t.protocol)&&/^(?:https?:\/\/|\/(?!\/))/i.test(e)?t.href:void 0}function E(e){let t=(0,S.c)(30),{item:n,workspaceScope:r,conversationId:g,backgroundPath:_,zh:E,className:O,children:k}=e,{artifact:A,reference:j,task:M}=n,[N,P]=(0,C.useState)(!1),F=A?.title??j?.title??n.id,I;t[0]===j?I=t[1]:(I=j&&y(j),t[0]=j,t[1]=I);let L=I,R=j?.kind===`chat_preview`?j.revision:void 0,z;t[2]!==A?.shareUrl||t[3]!==A?.uri?(z=T(A?.uri)??T(A?.shareUrl),t[2]=A?.shareUrl,t[3]=A?.uri,t[4]=z):z=t[4];let B=z,V=A?.uri,H;t[5]!==V||t[6]!==B?(H=V&&/^\/api\/(?:music-generation\/sessions\/[^/]+\/jobs\/[a-f0-9]{64}\/audio|video-generation\/sessions\/[^/]+\/jobs\/[a-fA-F0-9-]+\/video)$/.test(V)?B:void 0,t[5]=V,t[6]=B,t[7]=H):H=t[7];let U=H,W;t[8]!==A?.workspaceRelativePath||t[9]!==V?(W=V?.startsWith(`media://`)||V&&v(V)||A?.workspaceRelativePath,t[8]=A?.workspaceRelativePath,t[9]=V,t[10]=W):W=t[10];let G=!!W,K=!!(B&&window.electronAPI?.browser),q;return t[11]!==A||t[12]!==_||t[13]!==k||t[14]!==O||t[15]!==g||t[16]!==K||t[17]!==G||t[18]!==U||t[19]!==n.id||t[20]!==N||t[21]!==L||t[22]!==j||t[23]!==R||t[24]!==M?.id||t[25]!==F||t[26]!==B||t[27]!==r||t[28]!==E?(q=L?(0,w.jsx)(i,{to:m(_,L),className:O,children:k}):U||j&&R?(0,w.jsxs)(f,{open:N,onOpenChange:P,children:[(0,w.jsx)(o,{className:O,children:k}),N?(0,w.jsxs)(l,{children:[(0,w.jsx)(a,{className:`xopc-dialog-overlay fixed inset-0 z-[90] bg-black/45`}),(0,w.jsxs)(u,{onKeyDown:D,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[91] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(56rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,w.jsx)(d,{className:`truncate font-medium text-fg`,children:F}),(0,w.jsx)(s,{className:`sr-only`,children:E?`预览交付物`:`Preview deliverable`}),(0,w.jsx)(c,{"aria-label":E?`关闭预览`:`Close preview`,className:`grid size-8 shrink-0 place-items-center rounded-lg hover:bg-surface-hover`,children:(0,w.jsx)(h,{className:`size-4`})})]}),(0,w.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-4`,children:U?(0,w.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 py-4`,children:[A?.kind===`audio`?(0,w.jsx)(`audio`,{controls:!0,preload:`metadata`,src:U,"aria-label":F,className:`w-full max-w-xl`}):(0,w.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:U,"aria-label":F,className:`min-h-0 max-w-full rounded-lg bg-black`}),(0,w.jsx)(`a`,{href:`${U}?download=1`,download:!0,className:`shrink-0 text-sm text-accent-fg hover:underline`,children:E?`下载`:`Download`})]}):j&&R?(0,w.jsx)(p,{leaseId:`personal-deliverable:${n.id}`,reference:j,sourceHash:R,preferredHeight:480,language:E?`zh`:`en`}):null})]})]}):null]}):G||K?(0,w.jsx)(`button`,{type:`button`,className:O,onClick:()=>{let e=x.getState();G&&A?e.openFile({attachment:{...b(A),taskId:M?.id},conversationId:g},r):e.openBrowser(B,r)},children:k}):B?(0,w.jsx)(`a`,{href:B,target:`_blank`,rel:`noopener noreferrer`,className:O,children:k}):(0,w.jsx)(`div`,{className:O,children:k}),t[11]=A,t[12]=_,t[13]=k,t[14]=O,t[15]=g,t[16]=K,t[17]=G,t[18]=U,t[19]=n.id,t[20]=N,t[21]=L,t[22]=j,t[23]=R,t[24]=M?.id,t[25]=F,t[26]=B,t[27]=r,t[28]=E,t[29]=q):q=t[29],q}function D(e){return e.stopPropagation()}function O(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,w.jsx)(_,{className:`h-32 rounded-2xl`}),(0,w.jsx)(_,{className:`h-52 rounded-2xl`}),(0,w.jsx)(_,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function k(e){let t=(0,S.c)(16),{label:n,title:r,compact:i}=e,a=i&&!!r,o=a&&`-translate-y-2 opacity-0`,s;t[0]===o?s=t[1]:(s=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,o),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==a||t[4]!==s?(c=(0,w.jsx)(`span`,{"aria-hidden":a,className:s,children:n}),t[2]=n,t[3]=a,t[4]=s,t[5]=c):c=t[5];let l=!a,u=!a&&`translate-y-2 opacity-0`,d;t[6]===u?d=t[7]:(d=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,u),t[6]=u,t[7]=d);let f;t[8]!==l||t[9]!==d||t[10]!==r?(f=(0,w.jsx)(`span`,{"aria-hidden":l,className:d,children:r}),t[8]=l,t[9]=d,t[10]=r,t[11]=f):f=t[11];let p;return t[12]!==a||t[13]!==c||t[14]!==f?(p=(0,w.jsxs)(`span`,{className:`grid min-w-0 overflow-hidden leading-6`,"data-task-header-compact":a,children:[c,f]}),t[12]=a,t[13]=c,t[14]=f,t[15]=p):p=t[15],p}export{O as n,E as r,k as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-DlirbHVs.js";import{h as p}from"./chat-page-CJiXMjMM.js";import{O as m}from"./markdown-view-BpBBv9Gr.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./cn-0WouolD0.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{r as v}from"./turn-outcome-BSbEJx8h.js";import{o as y}from"./product-delivery-4gEqUIsK.js";import{n as b}from"./attachment-utils-core-BPYdUI6y.js";import{r as x}from"./right-workspace-store-CFf15f36.js";var S=n(),C=e(t(),1),w=r();function T(e){if(!e)return;let t=URL.parse(e,window.location.origin);return t&&[`http:`,`https:`].includes(t.protocol)&&/^(?:https?:\/\/|\/(?!\/))/i.test(e)?t.href:void 0}function E(e){let t=(0,S.c)(30),{item:n,workspaceScope:r,conversationId:g,backgroundPath:_,zh:E,className:O,children:k}=e,{artifact:A,reference:j,task:M}=n,[N,P]=(0,C.useState)(!1),F=A?.title??j?.title??n.id,I;t[0]===j?I=t[1]:(I=j&&y(j),t[0]=j,t[1]=I);let L=I,R=j?.kind===`chat_preview`?j.revision:void 0,z;t[2]!==A?.shareUrl||t[3]!==A?.uri?(z=T(A?.uri)??T(A?.shareUrl),t[2]=A?.shareUrl,t[3]=A?.uri,t[4]=z):z=t[4];let B=z,V=A?.uri,H;t[5]!==V||t[6]!==B?(H=V&&/^\/api\/(?:music-generation\/sessions\/[^/]+\/jobs\/[a-f0-9]{64}\/audio|video-generation\/sessions\/[^/]+\/jobs\/[a-fA-F0-9-]+\/video)$/.test(V)?B:void 0,t[5]=V,t[6]=B,t[7]=H):H=t[7];let U=H,W;t[8]!==A?.workspaceRelativePath||t[9]!==V?(W=V?.startsWith(`media://`)||V&&v(V)||A?.workspaceRelativePath,t[8]=A?.workspaceRelativePath,t[9]=V,t[10]=W):W=t[10];let G=!!W,K=!!(B&&window.electronAPI?.browser),q;return t[11]!==A||t[12]!==_||t[13]!==k||t[14]!==O||t[15]!==g||t[16]!==K||t[17]!==G||t[18]!==U||t[19]!==n.id||t[20]!==N||t[21]!==L||t[22]!==j||t[23]!==R||t[24]!==M?.id||t[25]!==F||t[26]!==B||t[27]!==r||t[28]!==E?(q=L?(0,w.jsx)(i,{to:m(_,L),className:O,children:k}):U||j&&R?(0,w.jsxs)(f,{open:N,onOpenChange:P,children:[(0,w.jsx)(o,{className:O,children:k}),N?(0,w.jsxs)(l,{children:[(0,w.jsx)(a,{className:`xopc-dialog-overlay fixed inset-0 z-[90] bg-black/45`}),(0,w.jsxs)(u,{onKeyDown:D,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[91] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(56rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,w.jsx)(d,{className:`truncate font-medium text-fg`,children:F}),(0,w.jsx)(s,{className:`sr-only`,children:E?`预览交付物`:`Preview deliverable`}),(0,w.jsx)(c,{"aria-label":E?`关闭预览`:`Close preview`,className:`grid size-8 shrink-0 place-items-center rounded-lg hover:bg-surface-hover`,children:(0,w.jsx)(h,{className:`size-4`})})]}),(0,w.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-4`,children:U?(0,w.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 py-4`,children:[A?.kind===`audio`?(0,w.jsx)(`audio`,{controls:!0,preload:`metadata`,src:U,"aria-label":F,className:`w-full max-w-xl`}):(0,w.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:U,"aria-label":F,className:`min-h-0 max-w-full rounded-lg bg-black`}),(0,w.jsx)(`a`,{href:`${U}?download=1`,download:!0,className:`shrink-0 text-sm text-accent-fg hover:underline`,children:E?`下载`:`Download`})]}):j&&R?(0,w.jsx)(p,{leaseId:`personal-deliverable:${n.id}`,reference:j,sourceHash:R,preferredHeight:480,language:E?`zh`:`en`}):null})]})]}):null]}):G||K?(0,w.jsx)(`button`,{type:`button`,className:O,onClick:()=>{let e=x.getState();G&&A?e.openFile({attachment:{...b(A),taskId:M?.id},conversationId:g},r):e.openBrowser(B,r)},children:k}):B?(0,w.jsx)(`a`,{href:B,target:`_blank`,rel:`noopener noreferrer`,className:O,children:k}):(0,w.jsx)(`div`,{className:O,children:k}),t[11]=A,t[12]=_,t[13]=k,t[14]=O,t[15]=g,t[16]=K,t[17]=G,t[18]=U,t[19]=n.id,t[20]=N,t[21]=L,t[22]=j,t[23]=R,t[24]=M?.id,t[25]=F,t[26]=B,t[27]=r,t[28]=E,t[29]=q):q=t[29],q}function D(e){return e.stopPropagation()}function O(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,w.jsx)(_,{className:`h-32 rounded-2xl`}),(0,w.jsx)(_,{className:`h-52 rounded-2xl`}),(0,w.jsx)(_,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function k(e){let t=(0,S.c)(16),{label:n,title:r,compact:i}=e,a=i&&!!r,o=a&&`-translate-y-2 opacity-0`,s;t[0]===o?s=t[1]:(s=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,o),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==a||t[4]!==s?(c=(0,w.jsx)(`span`,{"aria-hidden":a,className:s,children:n}),t[2]=n,t[3]=a,t[4]=s,t[5]=c):c=t[5];let l=!a,u=!a&&`translate-y-2 opacity-0`,d;t[6]===u?d=t[7]:(d=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,u),t[6]=u,t[7]=d);let f;t[8]!==l||t[9]!==d||t[10]!==r?(f=(0,w.jsx)(`span`,{"aria-hidden":l,className:d,children:r}),t[8]=l,t[9]=d,t[10]=r,t[11]=f):f=t[11];let p;return t[12]!==a||t[13]!==c||t[14]!==f?(p=(0,w.jsxs)(`span`,{className:`grid min-w-0 overflow-hidden leading-6`,"data-task-header-compact":a,children:[c,f]}),t[12]=a,t[13]=c,t[14]=f,t[15]=p):p=t[15],p}export{O as n,E as r,k as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i,t as a}from"./chunk-KS7C4IRE-BPb7KheU.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./file-text-D12HbeVy.js";import{t as c}from"./markdown-view-C7kqotD-.js";import{t as l}from"./cn-0WouolD0.js";import{ht as u}from"./session-manager-fvJusKsK.js";import{t as d,u as f}from"./workspace-preview-store-DYd8E5bV.js";import{t as p}from"./button-ChmVQg9O.js";import{t as m}from"./activity-store-BK11iD5x.js";import{m as h,o as g}from"./shares-api-B532SLIU.js";var _=n(),v=e(t(),1),y=r();function b(e){let t=(0,_.c)(38),{content:n,contentKey:r,language:a,markdown:o,breaks:s,previewHeight:d,className:f,children:p}=e,m=o===void 0||o,h=s!==void 0&&s,g=d===void 0?240:d,b;t[0]===n?b=t[1]:(b=u(n),t[0]=n,t[1]=b),n=b;let x=(0,v.useId)(),S=(0,v.useRef)(null),[C,w]=(0,v.useState)(!1),[T,E]=i(),D;t[2]!==r||t[3]!==T?(D=T.getAll(`taskExpanded`).includes(r),t[2]=r,t[3]=T,t[4]=D):D=t[4];let O=D,k;t[5]===g?k=t[6]:(k=()=>{let e=S.current;if(!e)return;let t=()=>w(e.scrollHeight>g);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[5]=g,t[6]=k);let A;t[7]!==n||t[8]!==g?(A=[n,g],t[7]=n,t[8]=g,t[9]=A):A=t[9],(0,v.useLayoutEffect)(k,A);let j=C&&!O,M;t[10]===f?M=t[11]:(M=l(`min-w-0`,f),t[10]=f,t[11]=M);let N;t[12]!==j||t[13]!==g?(N=j?{maxHeight:g,overflow:`hidden`,maskImage:`linear-gradient(to bottom, black calc(100% - ${Math.min(24,g/3)}px), transparent)`}:void 0,t[12]=j,t[13]=g,t[14]=N):N=t[14];let P;t[15]!==h||t[16]!==p||t[17]!==n||t[18]!==m?(P=p??(m?(0,y.jsx)(c,{content:n,compact:!0,breaks:h,className:`text-sm leading-6 text-fg`}):(0,y.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:n})),t[15]=h,t[16]=p,t[17]=n,t[18]=m,t[19]=P):P=t[19];let F;t[20]!==j||t[21]!==P?(F=(0,y.jsx)(`div`,{ref:S,inert:j,children:P}),t[20]=j,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==x||t[24]!==F||t[25]!==N?(I=(0,y.jsx)(`div`,{id:x,style:N,children:F}),t[23]=x,t[24]=F,t[25]=N,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==O||t[29]!==x||t[30]!==a||t[31]!==C||t[32]!==E?(L=C?(0,y.jsx)(`button`,{type:`button`,"aria-expanded":O,"aria-controls":x,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>E(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);t.delete(`taskExpanded`);for(let e of n)t.append(`taskExpanded`,e);return O||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:a===`zh`?O?`收起`:`查看更多`:O?`Show less`:`Show more`}):null,t[27]=r,t[28]=O,t[29]=x,t[30]=a,t[31]=C,t[32]=E,t[33]=L):L=t[33];let R;return t[34]!==I||t[35]!==L||t[36]!==M?(R=(0,y.jsxs)(`div`,{className:M,children:[I,L]}),t[34]=I,t[35]=L,t[36]=M,t[37]=R):R=t[37],R}function x({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),h=(0,v.useRef)(null),g=e.kind===`approval`,_=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function b(a){if(!g&&!i.trim()||g&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);h.current?.signature!==c&&(h.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await f(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:g?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,h.current.key);d(!0),r(o),m({tone:`success`,title:g?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,y.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),b()},children:[g?(0,y.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,y.jsx)(`p`,{children:e.reason}),(0,y.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,y.jsx)(p,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void b(`approve`),children:n?`批准`:`Approve`}),(0,y.jsx)(p,{type:`button`,disabled:o||u,onClick:()=>void b(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,y.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),_.length>0&&(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:_.map(e=>(0,y.jsx)(p,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,y.jsx)(p,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,y.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}function S(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function C({uri:e,zh:t}){let[n,r]=(0,v.useState)(),[i,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``);async function m(){o(!0),u(``);try{let n=S(e,(await h()).payload.shares);r(n),c(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{o(!1)}}async function _(){if(!(!n||i)){o(!0),u(``);try{let e=await g(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{o(!1)}}}return(0,y.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,y.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(p,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void m(),children:t?`检查链接状态`:`Check link`}),s&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,y.jsx)(p,{type:`button`,disabled:i,onClick:()=>void _(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,y.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,y.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),s&&(0,y.jsx)(a,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function w(e){let t=(0,_.c)(18),{evidence:n,projectId:r,conversationId:i,language:a,onOpenFile:c,compact:l}=e,u=l!==void 0&&l,f=d(T);if(!n.length)return null;let p=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,m;if(t[0]!==u||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==c||t[5]!==r||t[6]!==f){let e;t[8]!==u||t[9]!==i||t[10]!==a||t[11]!==c||t[12]!==r||t[13]!==f?(e=(e,t)=>{let n=e.uri?.trim(),l=n&&/^https?:\/\//i.test(n),d=n&&!l&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),p=e.title||(a===`zh`?`查看产物`:`Open artifact`);return(0,y.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[(0,y.jsx)(b,{content:p,contentKey:`${i??r}:evidence-title:${t}:${e.title}`,language:a,previewHeight:60,children:l?(0,y.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,y.jsx)(o,{className:`size-4 shrink-0`}),(0,y.jsx)(`span`,{className:`min-w-0 break-words`,children:p})]}):d&&(r||i)?(0,y.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,onClick:()=>c?c(n):f(n,null,r,i),children:[(0,y.jsx)(s,{className:`size-4 shrink-0`}),p]}):(0,y.jsx)(`p`,{className:`break-words [overflow-wrap:anywhere] text-sm font-medium text-fg`,children:p})}),l&&e.kind===`artifact`&&(0,y.jsx)(C,{uri:n,zh:a===`zh`},n),u&&!l&&!(d&&(r||i))?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a===`zh`?`位置待确认`:`Location needs confirmation`}):null,!u&&e.summary?(0,y.jsx)(b,{content:e.summary,contentKey:`${i??r}:evidence:${t}:${e.title}`,language:a,markdown:!1,previewHeight:80,className:`mt-1 text-xs leading-5 text-fg-muted`}):null,u?null:(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.provenance===`judge`?e.strength===`verified`?a===`zh`?`模型审阅通过`:`Model reviewed`:a===`zh`?`模型未确认,待核验`:`Not confirmed by review`:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[8]=u,t[9]=i,t[10]=a,t[11]=c,t[12]=r,t[13]=f,t[14]=e):e=t[14],m=n.map(e),t[0]=u,t[1]=i,t[2]=n,t[3]=a,t[4]=c,t[5]=r,t[6]=f,t[7]=m}else m=t[7];let h;return t[15]!==p||t[16]!==m?(h=(0,y.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":p,children:m}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function T(e){return e.setPath}export{x as n,b as r,w as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{g as i,t as a}from"./chunk-KS7C4IRE-DbzE-1bp.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./file-text-D12HbeVy.js";import{t as c}from"./markdown-view-BpBBv9Gr.js";import{t as l}from"./cn-0WouolD0.js";import{ht as u}from"./session-manager-1UFhZMpv.js";import{t as d,u as f}from"./workspace-preview-store-DYd8E5bV.js";import{t as p}from"./button-C5tRaJxt.js";import{t as m}from"./activity-store-BK11iD5x.js";import{m as h,o as g}from"./shares-api-B532SLIU.js";var _=n(),v=e(t(),1),y=r();function b(e){let t=(0,_.c)(38),{content:n,contentKey:r,language:a,markdown:o,breaks:s,previewHeight:d,className:f,children:p}=e,m=o===void 0||o,h=s!==void 0&&s,g=d===void 0?240:d,b;t[0]===n?b=t[1]:(b=u(n),t[0]=n,t[1]=b),n=b;let x=(0,v.useId)(),S=(0,v.useRef)(null),[C,w]=(0,v.useState)(!1),[T,E]=i(),D;t[2]!==r||t[3]!==T?(D=T.getAll(`taskExpanded`).includes(r),t[2]=r,t[3]=T,t[4]=D):D=t[4];let O=D,k;t[5]===g?k=t[6]:(k=()=>{let e=S.current;if(!e)return;let t=()=>w(e.scrollHeight>g);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[5]=g,t[6]=k);let A;t[7]!==n||t[8]!==g?(A=[n,g],t[7]=n,t[8]=g,t[9]=A):A=t[9],(0,v.useLayoutEffect)(k,A);let j=C&&!O,M;t[10]===f?M=t[11]:(M=l(`min-w-0`,f),t[10]=f,t[11]=M);let N;t[12]!==j||t[13]!==g?(N=j?{maxHeight:g,overflow:`hidden`,maskImage:`linear-gradient(to bottom, black calc(100% - ${Math.min(24,g/3)}px), transparent)`}:void 0,t[12]=j,t[13]=g,t[14]=N):N=t[14];let P;t[15]!==h||t[16]!==p||t[17]!==n||t[18]!==m?(P=p??(m?(0,y.jsx)(c,{content:n,compact:!0,breaks:h,className:`text-sm leading-6 text-fg`}):(0,y.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:n})),t[15]=h,t[16]=p,t[17]=n,t[18]=m,t[19]=P):P=t[19];let F;t[20]!==j||t[21]!==P?(F=(0,y.jsx)(`div`,{ref:S,inert:j,children:P}),t[20]=j,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==x||t[24]!==F||t[25]!==N?(I=(0,y.jsx)(`div`,{id:x,style:N,children:F}),t[23]=x,t[24]=F,t[25]=N,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==O||t[29]!==x||t[30]!==a||t[31]!==C||t[32]!==E?(L=C?(0,y.jsx)(`button`,{type:`button`,"aria-expanded":O,"aria-controls":x,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>E(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);t.delete(`taskExpanded`);for(let e of n)t.append(`taskExpanded`,e);return O||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:a===`zh`?O?`收起`:`查看更多`:O?`Show less`:`Show more`}):null,t[27]=r,t[28]=O,t[29]=x,t[30]=a,t[31]=C,t[32]=E,t[33]=L):L=t[33];let R;return t[34]!==I||t[35]!==L||t[36]!==M?(R=(0,y.jsxs)(`div`,{className:M,children:[I,L]}),t[34]=I,t[35]=L,t[36]=M,t[37]=R):R=t[37],R}function x({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(``),[u,d]=(0,v.useState)(!1),h=(0,v.useRef)(null),g=e.kind===`approval`,_=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function b(a){if(!g&&!i.trim()||g&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);h.current?.signature!==c&&(h.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await f(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:g?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,h.current.key);d(!0),r(o),m({tone:`success`,title:g?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,y.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),b()},children:[g?(0,y.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,y.jsx)(`p`,{children:e.reason}),(0,y.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,y.jsx)(p,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void b(`approve`),children:n?`批准`:`Approve`}),(0,y.jsx)(p,{type:`button`,disabled:o||u,onClick:()=>void b(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,y.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),_.length>0&&(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:_.map(e=>(0,y.jsx)(p,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,y.jsx)(p,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,y.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,y.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}function S(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function C({uri:e,zh:t}){let[n,r]=(0,v.useState)(),[i,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(``),[d,f]=(0,v.useState)(``);async function m(){o(!0),u(``);try{let n=S(e,(await h()).payload.shares);r(n),c(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{o(!1)}}async function _(){if(!(!n||i)){o(!0),u(``);try{let e=await g(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{o(!1)}}}return(0,y.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,y.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(p,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void m(),children:t?`检查链接状态`:`Check link`}),s&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,y.jsx)(p,{type:`button`,disabled:i,onClick:()=>void _(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,y.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,y.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),s&&(0,y.jsx)(a,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function w(e){let t=(0,_.c)(18),{evidence:n,projectId:r,conversationId:i,language:a,onOpenFile:c,compact:l}=e,u=l!==void 0&&l,f=d(T);if(!n.length)return null;let p=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,m;if(t[0]!==u||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==c||t[5]!==r||t[6]!==f){let e;t[8]!==u||t[9]!==i||t[10]!==a||t[11]!==c||t[12]!==r||t[13]!==f?(e=(e,t)=>{let n=e.uri?.trim(),l=n&&/^https?:\/\//i.test(n),d=n&&!l&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),p=e.title||(a===`zh`?`查看产物`:`Open artifact`);return(0,y.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[(0,y.jsx)(b,{content:p,contentKey:`${i??r}:evidence-title:${t}:${e.title}`,language:a,previewHeight:60,children:l?(0,y.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,y.jsx)(o,{className:`size-4 shrink-0`}),(0,y.jsx)(`span`,{className:`min-w-0 break-words`,children:p})]}):d&&(r||i)?(0,y.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,onClick:()=>c?c(n):f(n,null,r,i),children:[(0,y.jsx)(s,{className:`size-4 shrink-0`}),p]}):(0,y.jsx)(`p`,{className:`break-words [overflow-wrap:anywhere] text-sm font-medium text-fg`,children:p})}),l&&e.kind===`artifact`&&(0,y.jsx)(C,{uri:n,zh:a===`zh`},n),u&&!l&&!(d&&(r||i))?(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a===`zh`?`位置待确认`:`Location needs confirmation`}):null,!u&&e.summary?(0,y.jsx)(b,{content:e.summary,contentKey:`${i??r}:evidence:${t}:${e.title}`,language:a,markdown:!1,previewHeight:80,className:`mt-1 text-xs leading-5 text-fg-muted`}):null,u?null:(0,y.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.provenance===`judge`?e.strength===`verified`?a===`zh`?`模型审阅通过`:`Model reviewed`:a===`zh`?`模型未确认,待核验`:`Not confirmed by review`:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[8]=u,t[9]=i,t[10]=a,t[11]=c,t[12]=r,t[13]=f,t[14]=e):e=t[14],m=n.map(e),t[0]=u,t[1]=i,t[2]=n,t[3]=a,t[4]=c,t[5]=r,t[6]=f,t[7]=m}else m=t[7];let h;return t[15]!==p||t[16]!==m?(h=(0,y.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":p,children:m}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function T(e){return e.setPath}export{x as n,b as r,w as t};
@@ -0,0 +1 @@
1
+ var e=[`22,11,01,1,21`,`{"‍":0,"‌":1,"అ":2,"ఆ":2,"ఇ":2,"ఈ":2,"ఉ":2,"ఊ":2,"ఋ":2,"ౠ":2,"ఌ":2,"ౡ":2,"ఎ":2,"ఏ":2,"ఐ":2,"ఒ":2,"ఓ":2,"ఔ":2,"ా":2,"ి":2,"ీ":2,"ు":2,"ూ":2,"ృ":2,"ౄ":2,"ె":2,"ే":2,"ై":2,"ొ":2,"ో":2,"ౌ":2,"క":3,"ఖ":3,"గ":3,"ఘ":3,"ఙ":3,"చ":3,"ఛ":3,"జ":3,"ఝ":3,"ఞ":3,"ట":3,"ఠ":3,"డ":3,"ఢ":3,"ణ":3,"త":3,"థ":3,"ద":3,"ధ":3,"న":3,"ప":3,"ఫ":3,"బ":3,"భ":3,"మ":3,"య":3,"ర":3,"ఱ":3,"ల":3,"ళ":3,"వ":3,"శ":3,"ష":3,"స":3,"హ":3,"ఁ":4,"ం":4,"ః":4,"ౕ":4,"ౖ":4,"్":0}`,[]];export{e as Te};