@xopcai/xopc 0.0.483 → 0.0.484

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 (359) hide show
  1. package/dist/browser-ext/dist/assets/{auth-tm02ZZB8.js → auth-8EjgHa-n.js} +28 -6
  2. package/dist/browser-ext/dist/background.js +7 -3
  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/telegram/src/plugin.js +1 -1
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
  9. package/dist/gateway/server/chunks.bin +794 -785
  10. package/dist/gateway/server/chunks.json +1 -1
  11. package/dist/gateway/static/root/assets/{apps-page-DO5uTFRI.js → apps-page-CH9wENBj.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-C5rp_vOE.js → automations-page-B1Ri4sh8.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-workspace-BxN47gkP.js → automations-workspace-CNSza6ir.js} +2 -2
  14. package/dist/gateway/static/root/assets/bell-BlYch9Vg.js +1 -0
  15. package/dist/gateway/static/root/assets/browser-notification-delivery-DjK3F0oR.js +1 -0
  16. package/dist/gateway/static/root/assets/capabilities-page-EENl65YY.js +2 -0
  17. package/dist/gateway/static/root/assets/{capabilities-settings-panel-B1o8BKxy.js → capabilities-settings-panel-BOwbZn9X.js} +1 -1
  18. package/dist/gateway/static/root/assets/{channels-_m_FjvAY.js → channels-DlnXbcOj.js} +1 -1
  19. package/dist/gateway/static/root/assets/{chat-page-D7l_0kTV.js → chat-page-LOR5JxDh.js} +15 -15
  20. package/dist/gateway/static/root/assets/{chat-terminal-dock-BKnlzlXT.js → chat-terminal-dock-DE8j-K9d.js} +1 -1
  21. package/dist/gateway/static/root/assets/{connectors-page-CXNy8Y5R.js → connectors-page-BJm1jjct.js} +1 -1
  22. package/dist/gateway/static/root/assets/device-connections-panel-DE01vyK_.js +1 -0
  23. package/dist/gateway/static/root/assets/{extension-debug-page-BcjkhaY9.js → extension-debug-page-D3X7SlzG.js} +1 -1
  24. package/dist/gateway/static/root/assets/{extension-iframe-host-RWjaucjJ.js → extension-iframe-host-CIAq7PSn.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-message-router-CzVgJn5c.js → extension-message-router-B2wbucV7.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-DC58VBdj.js → extension-page-qwY7r1_p.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-provider-BGrqW0_n.js → extension-provider-DFcRbTHI.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-settings-page-DYbal3Iq.js → extension-settings-page-Cpnh9lcZ.js} +1 -1
  29. package/dist/gateway/static/root/assets/file-preview-surface-Da1xZiG6.js +1 -0
  30. package/dist/gateway/static/root/assets/gateway-realtime-CoIFB3im.js +1 -0
  31. package/dist/gateway/static/root/assets/{home-page-DnjsusRG.js → home-page-BusNFHe-.js} +3 -3
  32. package/dist/gateway/static/root/assets/index-B_TGvH_k.css +1 -0
  33. package/dist/gateway/static/root/assets/index-DE6GguFZ.js +11 -0
  34. package/dist/gateway/static/root/assets/{local-app-workbench-page-DH5c5Zhv.js → local-app-workbench-page-B9uSL1Mi.js} +1 -1
  35. package/dist/gateway/static/root/assets/{logs-page-D2olKpTB.js → logs-page-0hkRbcUR.js} +1 -1
  36. package/dist/gateway/static/root/assets/map-pin-BFRLhzQ9.js +1 -0
  37. package/dist/gateway/static/root/assets/note-detail-panel-DXzfoiyk.js +7 -0
  38. package/dist/gateway/static/root/assets/{notes-page-YQAAdasN.js → notes-page-BNTgiHSk.js} +1 -1
  39. package/dist/gateway/static/root/assets/{page-context-capture-button-CDSH76wA.js → page-context-capture-button-BXSBeGms.js} +1 -1
  40. package/dist/gateway/static/root/assets/{personal-page-Bfgb5oQI.js → personal-page-D7zTHQ0K.js} +1 -1
  41. package/dist/gateway/static/root/assets/{personal-profile-settings-BvjLssF9.js → personal-profile-settings-TcI0Zfwr.js} +1 -1
  42. package/dist/gateway/static/root/assets/{personal-settings-panel-Ffr7gcx4.js → personal-settings-panel-BJ46T7ZO.js} +1 -1
  43. package/dist/gateway/static/root/assets/{preview-runtime-pNF_b2oD.js → preview-runtime-C1U57WSM.js} +1 -1
  44. package/dist/gateway/static/root/assets/product-automation-feedback-GA_YPLkr.js +1 -0
  45. package/dist/gateway/static/root/assets/{project-detail-page-DDaG-n-H.js → project-detail-page-Dgs8ImMC.js} +1 -1
  46. package/dist/gateway/static/root/assets/route-preload-7WVrzJca.js +2 -0
  47. package/dist/gateway/static/root/assets/routine-panel-Bfbiz0IN.js +2 -0
  48. package/dist/gateway/static/root/assets/{session-manager-CVNlrzFB.js → session-manager-DUWeBdeG.js} +1 -1
  49. package/dist/gateway/static/root/assets/{settings-page-DzISa84O.js → settings-page-BOzzOS6k.js} +1 -1
  50. package/dist/gateway/static/root/assets/share-2-CnIB9PsV.js +1 -0
  51. package/dist/gateway/static/root/assets/{share-link-dialog-D31jDQN9.js → share-link-dialog-2JjvWs0q.js} +1 -1
  52. package/dist/gateway/static/root/assets/{share-preview-page-Co6GUYV5.js → share-preview-page-Di5_ukH8.js} +1 -1
  53. package/dist/gateway/static/root/assets/{shares-settings-C-czUl49.js → shares-settings-CirGM67m.js} +1 -1
  54. package/dist/gateway/static/root/assets/space-page-CKVuhV2i.js +2 -0
  55. package/dist/gateway/static/root/assets/system-settings-panel-0e2zfQLt.js +1 -0
  56. package/dist/gateway/static/root/assets/{task-detail-page-DWoXIgp2.js → task-detail-page-DEpYIaok.js} +1 -1
  57. package/dist/gateway/static/root/assets/{task-header-title-DfyaQ58P.js → task-header-title-Cdgp2rCs.js} +1 -1
  58. package/dist/gateway/static/root/assets/{task-run-issue-notice-CljFUd21.js → task-run-issue-notice-CGrUMy0s.js} +1 -1
  59. package/dist/gateway/static/root/assets/use-composer-attachments-DJsIzJ1c.js +2 -0
  60. package/dist/gateway/static/root/assets/{use-file-preview-expanded-U5rH80Jf.js → use-file-preview-expanded-BFF2vXm5.js} +1 -1
  61. package/dist/gateway/static/root/assets/{use-personal-work-FI9Cgyq5.js → use-personal-work-Dd2jRUpz.js} +1 -1
  62. package/dist/gateway/static/root/assets/{use-realtime-voice-BARxeNLd.js → use-realtime-voice-9OvLwHzk.js} +1 -1
  63. package/dist/gateway/static/root/assets/use-share-link-WKZLlEqr.js +1 -0
  64. package/dist/gateway/static/root/assets/{use-workspace-tree-NEeru2fw.js → use-workspace-tree-LCIT1H-D.js} +1 -1
  65. package/dist/gateway/static/root/assets/{voice-settings-bAmN4bUq.js → voice-settings-j8o-hGTm.js} +1 -1
  66. package/dist/gateway/static/root/assets/{workspace-api-C8-p66T-.js → workspace-api-BuNWyNvA.js} +2 -2
  67. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DwVWTehC.js +1 -0
  68. package/dist/gateway/static/root/index.html +26 -23
  69. package/dist/package.js +1 -1
  70. package/dist/packages/endpoint-tools-client/src/index.js +6 -3
  71. package/dist/packages/endpoint-tools-protocol/src/folders.js +5 -10
  72. package/dist/packages/endpoint-tools-protocol/src/index.js +50 -10
  73. package/dist/packages/endpoint-tools-protocol/src/location.js +1 -1
  74. package/dist/packages/endpoint-tools-protocol/src/personal.js +2 -2
  75. package/dist/src/agent/agent-manager.js +14 -14
  76. package/dist/src/agent/background-review/prompts.js +1 -1
  77. package/dist/src/agent/background-review/run-background-review.js +8 -8
  78. package/dist/src/agent/context/coordinator.js +1 -1
  79. package/dist/src/agent/context/deep-recall.js +4 -4
  80. package/dist/src/agent/context/execution-context.js +3 -3
  81. package/dist/src/agent/context/project-context.js +4 -4
  82. package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
  83. package/dist/src/agent/embedded/run-for-session.js +4 -4
  84. package/dist/src/agent/embedded/run-turn.js +1 -1
  85. package/dist/src/agent/embedded/session-runner.js +3 -3
  86. package/dist/src/agent/external-tools/cliProvider.js +4 -4
  87. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  88. package/dist/src/agent/external-tools/endpoint-provider.js +24 -14
  89. package/dist/src/agent/image/tool-model-config.js +1 -1
  90. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  91. package/dist/src/agent/mcp/connection-drafts.js +1 -1
  92. package/dist/src/agent/mcp/connection-setup.js +2 -2
  93. package/dist/src/agent/mcp/managed-discovery.js +1 -1
  94. package/dist/src/agent/mcp/tool-catalog.js +1 -1
  95. package/dist/src/agent/mcp/transport.js +1 -1
  96. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  97. package/dist/src/agent/orchestration/child-run-resume.js +1 -1
  98. package/dist/src/agent/prompt/response-language.js +1 -1
  99. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  100. package/dist/src/agent/prompt/system-prompt-params.js +1 -1
  101. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  102. package/dist/src/agent/service/process-direct-streaming.js +2 -2
  103. package/dist/src/agent/service.js +10 -10
  104. package/dist/src/agent/session/session-config-service.js +1 -1
  105. package/dist/src/agent/session/session-inspector.js +1 -1
  106. package/dist/src/agent/skills/index.js +1 -1
  107. package/dist/src/agent/skills/managed-store.js +1 -1
  108. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  109. package/dist/src/agent/skills/skill-manager.js +1 -1
  110. package/dist/src/agent/skills/skill-sources.js +1 -1
  111. package/dist/src/agent/tasks/task-judge-service.js +6 -6
  112. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  113. package/dist/src/agent/tool-manuals/computer.js +2 -2
  114. package/dist/src/agent/tools/factory.js +10 -10
  115. package/dist/src/agent/tools/fetch-text.js +1 -1
  116. package/dist/src/agent/tools/index.js +3 -3
  117. package/dist/src/agent/tools/knowledge-memory-tool.js +1 -1
  118. package/dist/src/agent/tools/personal-attention-tool.js +1 -1
  119. package/dist/src/agent/tools/personal-memory-tool.js +5 -5
  120. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  121. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  122. package/dist/src/agent/tools/personal-request-tool.js +2 -2
  123. package/dist/src/agent/tools/personal-task-tool.js +4 -4
  124. package/dist/src/agent/tools/session-search-tool.js +2 -2
  125. package/dist/src/agent/tools/user-context-tool.js +2 -2
  126. package/dist/src/agent/tools/xopc-use-tool.js +5 -5
  127. package/dist/src/ai-assist/text-assist.js +1 -1
  128. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  129. package/dist/src/auth/sync-provider-auth.js +1 -1
  130. package/dist/src/automations/api/routes.js +2 -2
  131. package/dist/src/automations/capabilities/write.js +3 -3
  132. package/dist/src/automations/configuration-conversation.js +1 -1
  133. package/dist/src/automations/domain/index.js +1 -1
  134. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  135. package/dist/src/automations/index.js +2 -2
  136. package/dist/src/automations/service/action-executor.js +2 -2
  137. package/dist/src/automations/service/automation-service.js +2 -2
  138. package/dist/src/browser/native-messaging-host.js +1 -1
  139. package/dist/src/capabilities/capability-catalog.js +3 -3
  140. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  141. package/dist/src/capabilities/runtime/product.js +2 -2
  142. package/dist/src/capabilities/store-connector.js +1 -1
  143. package/dist/src/chat-commands/agent-edit.js +1 -1
  144. package/dist/src/chat-commands/builtins/config.js +1 -1
  145. package/dist/src/cli/commands/agent.js +1 -1
  146. package/dist/src/cli/commands/agents.js +1 -1
  147. package/dist/src/cli/commands/connectors.js +1 -1
  148. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  149. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  150. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  151. package/dist/src/cli/commands/init.js +1 -1
  152. package/dist/src/cli/commands/models.js +2 -2
  153. package/dist/src/cli/commands/onboard/model.js +2 -2
  154. package/dist/src/cli/commands/onboard.js +1 -1
  155. package/dist/src/cli/commands/project.js +1 -1
  156. package/dist/src/cli/commands/tunnel.js +1 -1
  157. package/dist/src/cli/extension-cli-register.js +1 -1
  158. package/dist/src/cli/utils/gateway-client.js +1 -1
  159. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  160. package/dist/src/computer/endpoint-transport.d.ts +1 -1
  161. package/dist/src/computer/endpoint-transport.js +3 -2
  162. package/dist/src/computer/errors.js +2 -1
  163. package/dist/src/computer/model-adapter.js +1 -0
  164. package/dist/src/computer/runtime.d.ts +1 -0
  165. package/dist/src/computer/runtime.js +15 -3
  166. package/dist/src/config/config-file.js +1 -1
  167. package/dist/src/config/index.js +4 -4
  168. package/dist/src/config/loader.js +1 -1
  169. package/dist/src/config/models-json.js +2 -2
  170. package/dist/src/connectors/connected-source-ingestion.js +2 -2
  171. package/dist/src/connectors/connected-source-understanding.js +2 -2
  172. package/dist/src/connectors/content-enrichment.js +1 -1
  173. package/dist/src/connectors/health.js +1 -1
  174. package/dist/src/endpoint-tools/device-capability-grants.d.ts +13 -0
  175. package/dist/src/endpoint-tools/device-capability-grants.js +71 -0
  176. package/dist/src/endpoint-tools/folder-connections.d.ts +3 -1
  177. package/dist/src/endpoint-tools/folder-connections.js +12 -8
  178. package/dist/src/endpoint-tools/invocation-service.d.ts +3 -0
  179. package/dist/src/endpoint-tools/invocation-service.js +8 -1
  180. package/dist/src/endpoint-tools/policy.js +1 -1
  181. package/dist/src/endpoint-tools/target-resolver.js +12 -7
  182. package/dist/src/endpoint-tools/task-targets.d.ts +3 -2
  183. package/dist/src/endpoint-tools/task-targets.js +9 -4
  184. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  185. package/dist/src/extensions/agent-plugins/cli-authorization.js +1 -1
  186. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  187. package/dist/src/extensions/agent-plugins/setup.js +1 -1
  188. package/dist/src/extensions/agent-plugins/skill-catalog.js +3 -3
  189. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  190. package/dist/src/extensions/agent-plugins/user-config.js +1 -1
  191. package/dist/src/extensions/agent-plugins/validation.js +2 -2
  192. package/dist/src/extensions/install.js +1 -1
  193. package/dist/src/gateway/agent-reactions/reaction.js +3 -3
  194. package/dist/src/gateway/agents-admin.js +2 -2
  195. package/dist/src/gateway/file-path-classifier.js +1 -1
  196. package/dist/src/gateway/global-defaults-admin.js +1 -1
  197. package/dist/src/gateway/hono/app.js +1 -1
  198. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  199. package/dist/src/gateway/hono/middleware/auth.js +10 -0
  200. package/dist/src/gateway/hono/oauth-async.js +1 -1
  201. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  202. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  203. package/dist/src/gateway/hono/routes/commands-skills.js +3 -3
  204. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  205. package/dist/src/gateway/hono/routes/device-connections.js +105 -14
  206. package/dist/src/gateway/hono/routes/endpoint-compatibility.js +6 -0
  207. package/dist/src/gateway/hono/routes/home.js +1 -1
  208. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
  209. package/dist/src/gateway/hono/routes/local-app-run-streams.js +1 -1
  210. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  211. package/dist/src/gateway/hono/routes/media.js +18 -32
  212. package/dist/src/gateway/hono/routes/memory-learning.js +2 -2
  213. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +4 -4
  214. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +9 -9
  215. package/dist/src/gateway/hono/routes/models.js +2 -2
  216. package/dist/src/gateway/hono/routes/music-generation.js +1 -1
  217. package/dist/src/gateway/hono/routes/notes.js +2 -2
  218. package/dist/src/gateway/hono/routes/phone-setup.js +3 -3
  219. package/dist/src/gateway/hono/routes/phone.js +2 -2
  220. package/dist/src/gateway/hono/routes/projects.js +5 -5
  221. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  222. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  223. package/dist/src/gateway/hono/routes/shares.js +96 -12
  224. package/dist/src/gateway/hono/routes/space.js +6 -3
  225. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  226. package/dist/src/gateway/hono/routes/tui.js +1 -1
  227. package/dist/src/gateway/hono/routes/user-model.js +5 -5
  228. package/dist/src/gateway/hono/routes/video-generation.js +1 -1
  229. package/dist/src/gateway/image-generation-setup.js +1 -1
  230. package/dist/src/gateway/media-access.js +1 -1
  231. package/dist/src/gateway/security/gateway-scopes.d.ts +1 -0
  232. package/dist/src/gateway/security/gateway-scopes.js +9 -1
  233. package/dist/src/gateway/security/media-playback-ticket.d.ts +3 -0
  234. package/dist/src/gateway/security/media-playback-ticket.js +41 -0
  235. package/dist/src/gateway/service/agent-runner.js +2 -2
  236. package/dist/src/gateway/service/config-coordinator.js +1 -1
  237. package/dist/src/gateway/service/marketplace-service.js +2 -2
  238. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  239. package/dist/src/gateway/service/session-command-service.js +2 -2
  240. package/dist/src/gateway/service/session-input-coordinator.js +1 -1
  241. package/dist/src/gateway/service.js +29 -29
  242. package/dist/src/gateway/session-context-summary.js +1 -1
  243. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  244. package/dist/src/home-intelligence/follow-ups.js +1 -1
  245. package/dist/src/home-intelligence/generator.js +2 -2
  246. package/dist/src/home-intelligence/host.js +5 -5
  247. package/dist/src/home-intelligence/observation.js +1 -1
  248. package/dist/src/home-intelligence/routines.js +2 -2
  249. package/dist/src/imports/importService.js +1 -1
  250. package/dist/src/imports/inventory.js +2 -2
  251. package/dist/src/imports/productImport.js +1 -1
  252. package/dist/src/knowledge-memory/repository.js +1 -1
  253. package/dist/src/knowledge-memory/usage-policy.js +1 -1
  254. package/dist/src/local-apps/automation-proposals.js +2 -2
  255. package/dist/src/local-apps/capabilities/automation-policy.js +1 -1
  256. package/dist/src/local-apps/capabilities/delegate.js +4 -4
  257. package/dist/src/local-apps/execution-authority.js +2 -2
  258. package/dist/src/local-apps/p1-services.js +3 -3
  259. package/dist/src/local-apps/preview-worker.js +1 -1
  260. package/dist/src/local-apps/service.js +2 -2
  261. package/dist/src/mcp/gateway-http-client.js +1 -1
  262. package/dist/src/media-shared/http/file-response.d.ts +3 -0
  263. package/dist/src/media-shared/http/file-response.js +31 -0
  264. package/dist/src/memory-learning/choice-observations.js +6 -6
  265. package/dist/src/memory-learning/source-learning.js +4 -4
  266. package/dist/src/memory-learning/task-receipts.js +1 -1
  267. package/dist/src/memory-learning/work-capture.js +1 -1
  268. package/dist/src/memory-learning/work-review.js +2 -2
  269. package/dist/src/music-generation/artifact.d.ts +1 -1
  270. package/dist/src/music-generation/artifact.js +4 -18
  271. package/dist/src/notes/service.js +1 -1
  272. package/dist/src/personal-agent/capability-service.js +1 -1
  273. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  274. package/dist/src/personal-agent/proactivity/service.js +4 -4
  275. package/dist/src/personal-agent/prompt-context.js +4 -4
  276. package/dist/src/personal-agent/reply-composer.js +4 -4
  277. package/dist/src/personal-agent/request-delivery.js +1 -1
  278. package/dist/src/personal-agent/request-service.js +4 -4
  279. package/dist/src/personal-agent/result-reader.js +1 -1
  280. package/dist/src/personal-agent/service.js +1 -1
  281. package/dist/src/personal-agent/task-cancel.js +1 -1
  282. package/dist/src/phone/cloud-adb-connection.js +1 -1
  283. package/dist/src/projects/capabilities/write.js +2 -2
  284. package/dist/src/projects/index.js +2 -2
  285. package/dist/src/projects/project-service.js +2 -2
  286. package/dist/src/projects/workspace.js +1 -1
  287. package/dist/src/providers/model-catalog-persistence.js +1 -1
  288. package/dist/src/providers/model-registry.js +1 -1
  289. package/dist/src/realtime/compact-run-event.js +5 -1
  290. package/dist/src/session/compact-history.js +6 -3
  291. package/dist/src/session/history-recall-policy.js +2 -2
  292. package/dist/src/session/index.js +1 -1
  293. package/dist/src/session/session-title.js +1 -1
  294. package/dist/src/session/store.js +1 -1
  295. package/dist/src/share/share-landing.d.ts +2 -0
  296. package/dist/src/share/share-landing.js +4 -0
  297. package/dist/src/share/share-store.js +3 -2
  298. package/dist/src/share/share-thumbnail.js +1 -1
  299. package/dist/src/share/share-types.d.ts +4 -0
  300. package/dist/src/share/site-proxy.js +1 -1
  301. package/dist/src/space/repository.d.ts +9 -1
  302. package/dist/src/space/repository.js +75 -30
  303. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -0
  304. package/dist/src/tasks/capabilities/read.js +4 -4
  305. package/dist/src/tasks/capabilities/relations.js +1 -1
  306. package/dist/src/tasks/capabilities/write.js +4 -4
  307. package/dist/src/tasks/home-query-service.js +1 -1
  308. package/dist/src/tasks/index.js +2 -2
  309. package/dist/src/tasks/task-allocation-service.js +4 -4
  310. package/dist/src/tasks/task-application-service.js +2 -2
  311. package/dist/src/tasks/task-contract-planner.js +1 -1
  312. package/dist/src/tasks/task-execution-capabilities.js +1 -1
  313. package/dist/src/tasks/task-handoff-service.js +1 -1
  314. package/dist/src/tasks/task-handoff.js +6 -6
  315. package/dist/src/tasks/task-json-acceptance.js +1 -1
  316. package/dist/src/tasks/task-main-update-decision-service.js +2 -2
  317. package/dist/src/tasks/task-main-update-delivery.js +1 -1
  318. package/dist/src/tasks/task-model-call.js +1 -1
  319. package/dist/src/tasks/task-research-result.js +2 -2
  320. package/dist/src/tasks/task-result-delivery-service.js +1 -1
  321. package/dist/src/tasks/task-retry-service.js +1 -1
  322. package/dist/src/tasks/task-run-coordinator.js +4 -4
  323. package/dist/src/tasks/task-run-dispatcher.js +1 -1
  324. package/dist/src/tui/backends/embedded-backend.js +6 -6
  325. package/dist/src/tui/tui-capabilities.js +2 -2
  326. package/dist/src/tui/tui-commands.js +2 -2
  327. package/dist/src/tui/tui-management.js +6 -6
  328. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  329. package/dist/src/tui/tui-startup-resources.js +2 -2
  330. package/dist/src/tui/tui.js +4 -4
  331. package/dist/src/user-context/access-policy.js +2 -2
  332. package/dist/src/user-model/bootstrap.js +1 -1
  333. package/dist/src/user-model/capture/executor.js +2 -2
  334. package/dist/src/user-model/index.js +2 -2
  335. package/dist/src/user-model/usage-policy.js +1 -1
  336. package/dist/src/video-generation/artifact.d.ts +1 -1
  337. package/dist/src/video-generation/artifact.js +4 -28
  338. package/dist/src/voice/realtime/conversation-context.js +1 -1
  339. package/dist/src/voice/realtime/memory-context.js +4 -4
  340. package/dist/src/voice/realtime/persona-context.js +1 -1
  341. package/dist/src/voice/realtime/user-context.js +1 -1
  342. package/dist/src/work-discovery/service.js +6 -6
  343. package/package.json +1 -1
  344. package/dist/gateway/static/root/assets/browser-notification-delivery-DmE2FgGc.js +0 -1
  345. package/dist/gateway/static/root/assets/capabilities-page-BFYx0xu5.js +0 -2
  346. package/dist/gateway/static/root/assets/device-connections-panel-XtEX1NcJ.js +0 -1
  347. package/dist/gateway/static/root/assets/file-preview-surface-BOfJPMux.js +0 -1
  348. package/dist/gateway/static/root/assets/gateway-realtime-jIH8iEGO.js +0 -1
  349. package/dist/gateway/static/root/assets/index-Cl5ueYDl.css +0 -1
  350. package/dist/gateway/static/root/assets/index-DYRzuQl_.js +0 -11
  351. package/dist/gateway/static/root/assets/map-pin-DNclV497.js +0 -1
  352. package/dist/gateway/static/root/assets/note-detail-panel-lU1-3mBw.js +0 -7
  353. package/dist/gateway/static/root/assets/product-automation-feedback-BxA2Ype-.js +0 -1
  354. package/dist/gateway/static/root/assets/route-preload-B-OXsVjy.js +0 -2
  355. package/dist/gateway/static/root/assets/routine-panel-BWLC11Ou.js +0 -2
  356. package/dist/gateway/static/root/assets/space-page-DhhqkNGh.js +0 -2
  357. package/dist/gateway/static/root/assets/system-settings-panel-Gu0rWNOv.js +0 -1
  358. package/dist/gateway/static/root/assets/use-composer-attachments-Dnrs5cP1.js +0 -2
  359. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-BlNfLhnV.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{_ as i,d as a,f as o,h as s,t as c}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as l,l as u,n as d,o as f}from"./locale-store-CHjsq5NR.js";import{t as p}from"./messages-C7QSnTdg.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{E as x,Y as S,_ as C,ct as w,q as T,t as E}from"./chat-page-D7l_0kTV.js";import{t as ee}from"./arrow-left-D880xG-P.js";import{f as D,i as O,u as k}from"./automation-display-DaVDNZz8.js";import{t as te}from"./check-DUBLcKHA.js";import{t as A}from"./chevron-right-BweFrslA.js";import{n as j,r as M}from"./popover-select-hRG1EzAY.js";import{t as N}from"./circle-BoO4YvTx.js";import{t as P}from"./ellipsis-0k4rZLoy.js";import{t as F}from"./external-link-DjqjBmc3.js";import{t as I}from"./file-icon-N6WjUhq_.js";import{t as ne}from"./folder-kanban-CpLlFI1o.js";import{t as re}from"./folder-open-CyzJ19I9.js";import{F as ie,N as ae,V as oe,z as se}from"./markdown-view-ihzUc4ud.js";import{t as ce}from"./message-square-fVE7Ghj1.js";import{t as le}from"./pause-DuPxgSxk.js";import{t as ue}from"./play-kxZvpBg8.js";import{t as L}from"./x-B_N4OPjy.js";import{t as R}from"./cn-0WouolD0.js";import{t as de}from"./skeleton-DzdOeGYz.js";import{f as fe}from"./tasks-CwyNaa-j.js";import{c as pe}from"./api-CGs641OT.js";import{xt as me}from"./session-manager-CVNlrzFB.js";import{i as he}from"./vendor-swr-CdRzEUwF.js";import{C as ge,D as _e,T as ve,a as ye,b as be,c as xe,f as Se,h as Ce,j as we,k as Te,o as Ee,p as De,r as Oe,s as ke}from"./home-task-actions-C8Fi6GBq.js";import{t as Ae}from"./chat-agents-api-CyvBfBbp.js";import{t as z}from"./button-C5tRaJxt.js";import{r as je}from"./right-workspace-store-Cehybf-G.js";import{c as Me}from"./composer-payload-handoff-ClWsunJ2.js";import{t as Ne}from"./page-header-store-NP7MCIaP.js";import{t as Pe}from"./agent-avatar-display-D_UDgOr9.js";import{t as Fe}from"./automation-api-D-gn6x5E.js";import{n as Ie}from"./agent-display-names-Bje7vfSn.js";import{t as B}from"./sliding-tab-list-CmcrqRzN.js";import{t as Le}from"./confirm-dialog-MHCmEEUZ.js";import{l as Re,m as ze,o as Be,r as Ve,t as He,u as Ue}from"./dist-DaFr5KMw.js";import{d as We,f as Ge,l as Ke,o as qe,u as Je}from"./automation-task-card-C453Q-Wa.js";import{t as Ye}from"./date-picker-DwITf4I2.js";import{t as Xe}from"./time-picker-otHjbob1.js";import{n as Ze}from"./date-formatters-DukWSVwc.js";import{n as Qe,r as $e,t as et}from"./task-header-title-DfyaQ58P.js";import{t as tt}from"./date-time-picker-ChG1CqR1.js";import{a as nt,i as rt,n as it,o as V,r as H,t as at}from"./task-run-issue-notice-CljFUd21.js";import{t as ot}from"./page-context-capture-button-CDSH76wA.js";import{t as st}from"./dependency-picker-DEPr5_Wk.js";var U=e(t(),1),W=n(),G=r();function ct(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 lt(e){let t=(0,W.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=R(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=>ct(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,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:l}),(0,G.jsx)(A,{"aria-hidden":!0,className:R(`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,G.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,G.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 ut(e){let t=e;for(;t&&!/(auto|scroll)/.test(getComputedStyle(t).overflowY);)t=t.parentElement;return t}function dt(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=ut(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 ft(e){let t=(0,W.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,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(void 0),p=(0,U.useRef)(o),m=(0,U.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,U.useEffect)(h,g);let _=(0,U.useRef)(void 0),v=(0,U.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=ct(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=dt(l.current,e)},t[7]=x):x=t[7];let S=x,[C,w]=(0,U.useState)(c??`results`),T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[8]=T):T=t[8];let[E,ee]=(0,U.useState)(T),D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{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]`));ee(r.map(pt));let i=0,a=()=>{if(d.current)return;let e=ut(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]=D):D=t[9];let O;t[10]!==r||t[11]!==n?(O=[n,r,b],t[10]=r,t[11]=n,t[12]=O):O=t[12],(0,U.useEffect)(D,O);let k,te;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>()=>{clearTimeout(f.current),_.current?.cancel()},k=[],t[13]=k,t[14]=te):(k=t[13],te=t[14]),(0,U.useEffect)(te,k);let A,j;t[15]===c?(A=t[16],j=t[17]):(A=()=>{!c||u.current===c||(u.current=c,w(c),S(c))},j=[c,S],t[15]=c,t[16]=A,t[17]=j),(0,U.useEffect)(A,j);let M;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{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]=M):M=t[18];let N;t[19]!==C||t[20]!==E?(N=[C,E],t[19]=C,t[20]=E,t[21]=N):N=t[21],(0,U.useEffect)(M,N);let P=n===`zh`?`任务详情分区`:`Task detail sections`,F;t[22]!==C||t[23]!==E?(F=E.map(e=>(0,G.jsx)(`button`,{type:`button`,"aria-current":C===e.id?`location`:void 0,"aria-pressed":C===e.id,"data-sliding-active":C===e.id,className:R(`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]=F):F=t[24];let I;return t[25]!==P||t[26]!==F?(I=(0,G.jsx)(B,{scrollFocusedItemIntoView:!1,as:`nav`,ref:l,"aria-label":P,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:F}),t[25]=P,t[26]=F,t[27]=I):I=t[27],I}function pt(e){return{id:e.dataset.taskSection,label:e.dataset.taskSectionLabel}}var mt=`Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage.`;function ht(e){let t=(0,W.c)(64),{criterion:n,index:r,language:i,closed:a,pending:o,onReview:s,projectId:c,conversationId:l}=e,u=i===`zh`,d=(0,U.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]:(_=R(`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,G.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=R(`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,G.jsx)(te,{className:`size-3.5`,strokeWidth:2.8}):null,t[15]=f,t[16]=w);let T;t[17]!==C||t[18]!==w?(T=(0,G.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,G.jsxs)(`label`,{className:_,children:[b,T]}),t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let ee=`criterion:${r}:evidence`,D;t[24]!==n.text||t[25]!==d?(D=(0,G.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]=D):D=t[26];let O=u?`验收依据`:`Acceptance evidence`,k;t[27]===O?k=t[28]:(k=(0,G.jsx)(`p`,{className:`font-medium text-fg`,children:O}),t[27]=O,t[28]=k);let A;t[29]!==n.method||t[30]!==m||t[31]!==u?(A=n.method?(0,G.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]=A):A=t[32];let j;t[33]!==n.review||t[34]!==i||t[35]!==h||t[36]!==u?(j=n.review?(0,G.jsxs)(`p`,{children:[u?`人工验收`:`User review`,` · `,h,` · `,Ze(n.review.reviewedAt,i)]}):null,t[33]=n.review,t[34]=i,t[35]=h,t[36]=u,t[37]=j):j=t[37];let M;t[38]!==n.note||t[39]!==r||t[40]!==i?(M=n.note&&n.note!==mt?(0,G.jsx)(V,{content:rt(n.note,i),contentKey:`criterion:${r}:note`,language:i,markdown:!1}):null,t[38]=n.note,t[39]=r,t[40]=i,t[41]=M):M=t[41];let N;t[42]!==l||t[43]!==n.evidence||t[44]!==i||t[45]!==c?(N=(0,G.jsx)(it,{evidence:n.evidence,projectId:c,conversationId:l,language:i}),t[42]=l,t[43]=n.evidence,t[44]=i,t[45]=c,t[46]=N):N=t[46];let P;t[47]!==p||t[48]!==u?(P=p?null:(0,G.jsx)(`p`,{children:u?`暂无验收依据`:`No evidence yet`}),t[47]=p,t[48]=u,t[49]=P):P=t[49];let F;t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==M||t[54]!==N||t[55]!==P?(F=(0,G.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:[k,A,j,M,N,P]}),t[50]=k,t[51]=A,t[52]=j,t[53]=M,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;t[57]!==ee||t[58]!==D||t[59]!==F?(I=(0,G.jsx)(lt,{panelId:ee,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:D,children:F}),t[57]=ee,t[58]=D,t[59]=F,t[60]=I):I=t[60];let ne;return t[61]!==E||t[62]!==I?(ne=(0,G.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,I]}),t[61]=E,t[62]=I,t[63]=ne):ne=t[63],ne}function gt(e){let t=(0,W.c)(40),{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(_t),t[0]=n,t[1]=p);let m=p,h;t[2]!==m||t[3]!==r||t[4]!==f?(h=m?(0,G.jsx)(lt,{panelId:`acceptance:diagnostic`,title:f?`验收标准需要细化`:`The criteria need more detail`,className:`mx-4 mb-2 text-xs leading-5 text-fg-muted`,children:(0,G.jsx)(`p`,{className:`mt-2 break-words`,children:rt(mt,r)})}):null,t[2]=m,t[3]=r,t[4]=f,t[5]=h):h=t[5];let g=a||void 0,_;if(t[6]!==i||t[7]!==u||t[8]!==n||t[9]!==r||t[10]!==c||t[11]!==a||t[12]!==l||t[13]!==d){let e;t[15]!==i||t[16]!==u||t[17]!==r||t[18]!==c||t[19]!==a||t[20]!==l||t[21]!==d?(e=(e,t)=>(0,G.jsx)(ht,{criterion:e,index:t,language:r,closed:i||!!d,pending:a,onReview:c,projectId:l,conversationId:u},`${t}:${e.text}`),t[15]=i,t[16]=u,t[17]=r,t[18]=c,t[19]=a,t[20]=l,t[21]=d,t[22]=e):e=t[22],_=n.map(e),t[6]=i,t[7]=u,t[8]=n,t[9]=r,t[10]=c,t[11]=a,t[12]=l,t[13]=d,t[14]=_}else _=t[14];let v;t[23]!==g||t[24]!==_?(v=(0,G.jsx)(`ul`,{"aria-busy":g,className:`border-t border-edge-subtle`,children:_}),t[23]=g,t[24]=_,t[25]=v):v=t[25];let y;t[26]!==n.length||t[27]!==f?(y=n.length===0?(0,G.jsx)(`p`,{className:`px-4 py-4 text-sm text-fg-muted`,children:f?`尚未定义验收标准`:`No acceptance criteria defined`}):null,t[26]=n.length,t[27]=f,t[28]=y):y=t[28];let b;t[29]===s?b=t[30]:(b=s?(0,G.jsx)(`p`,{role:`alert`,className:`mx-4 my-2 text-sm text-danger`,children:s}):null,t[29]=s,t[30]=b);let x;t[31]!==o||t[32]!==i?(x=!i&&o?(0,G.jsx)(`p`,{className:`border-t border-edge-subtle px-4 py-2.5 text-xs text-fg-muted`,children:o}):null,t[31]=o,t[32]=i,t[33]=x):x=t[33];let S;return t[34]!==h||t[35]!==v||t[36]!==y||t[37]!==b||t[38]!==x?(S=(0,G.jsxs)(G.Fragment,{children:[h,v,y,b,x]}),t[34]=h,t[35]=v,t[36]=y,t[37]=b,t[38]=x,t[39]=S):S=t[39],S}function _t(e){return e.note===mt}function vt(e){let t=(0,W.c)(27),{detail:n,language:r}=e,i=r===`zh`,o=a(),s;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==i){let e=n.deliverables??[],a=ye(n),l=a&&H(a,r),u;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),u=new Set(n.runs.filter(e).map(Tt)),t[5]=n.runs,t[6]=n.task,t[7]=u}else u=t[7];let d=u,f=n.context.filter(wt).map(Ct),p=new Set(e.flatMap(St).filter(Boolean)),m=new Set([...f.map(xt),...p].filter(Boolean)),h;t[10]===d?h=t[11]:(h=e=>d.has(e.runId),t[10]=d,t[11]=h);for(let e of n.receipts.filter(h))for(let t of e.evidence.filter(bt))t.uri&&m.has(t.uri)||(t.uri&&m.add(t.uri),f.push(t));let g=l?.summary,_=g&&g.length<=160&&!g.includes(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,d as a,f as o,h as s,t as c}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{i as l,l as u,n as d,o as f}from"./locale-store-CHjsq5NR.js";import{t as p}from"./messages-C7QSnTdg.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{E as x,Y as S,_ as C,ct as w,q as T,t as E}from"./chat-page-LOR5JxDh.js";import{t as ee}from"./arrow-left-D880xG-P.js";import{f as D,i as O,u as k}from"./automation-display-DaVDNZz8.js";import{t as te}from"./check-DUBLcKHA.js";import{t as A}from"./chevron-right-BweFrslA.js";import{n as j,r as M}from"./popover-select-hRG1EzAY.js";import{t as N}from"./circle-BoO4YvTx.js";import{t as P}from"./ellipsis-0k4rZLoy.js";import{t as F}from"./external-link-DjqjBmc3.js";import{t as I}from"./file-icon-N6WjUhq_.js";import{t as ne}from"./folder-kanban-CpLlFI1o.js";import{t as re}from"./folder-open-CyzJ19I9.js";import{F as ie,N as ae,V as oe,z as se}from"./markdown-view-ihzUc4ud.js";import{t as ce}from"./message-square-fVE7Ghj1.js";import{t as le}from"./pause-DuPxgSxk.js";import{t as ue}from"./play-kxZvpBg8.js";import{t as L}from"./x-B_N4OPjy.js";import{t as R}from"./cn-0WouolD0.js";import{t as de}from"./skeleton-DzdOeGYz.js";import{f as fe}from"./tasks-CwyNaa-j.js";import{c as pe}from"./api-CGs641OT.js";import{xt as me}from"./session-manager-DUWeBdeG.js";import{i as he}from"./vendor-swr-CdRzEUwF.js";import{C as ge,D as _e,T as ve,a as ye,b as be,c as xe,f as Se,h as Ce,j as we,k as Te,o as Ee,p as De,r as Oe,s as ke}from"./home-task-actions-C8Fi6GBq.js";import{t as Ae}from"./chat-agents-api-CyvBfBbp.js";import{t as z}from"./button-C5tRaJxt.js";import{r as je}from"./right-workspace-store-Cehybf-G.js";import{c as Me}from"./composer-payload-handoff-ClWsunJ2.js";import{t as Ne}from"./page-header-store-NP7MCIaP.js";import{t as Pe}from"./agent-avatar-display-D_UDgOr9.js";import{t as Fe}from"./automation-api-D-gn6x5E.js";import{n as Ie}from"./agent-display-names-Bje7vfSn.js";import{t as B}from"./sliding-tab-list-CmcrqRzN.js";import{t as Le}from"./confirm-dialog-MHCmEEUZ.js";import{l as Re,m as ze,o as Be,r as Ve,t as He,u as Ue}from"./dist-DaFr5KMw.js";import{d as We,f as Ge,l as Ke,o as qe,u as Je}from"./automation-task-card-C453Q-Wa.js";import{t as Ye}from"./date-picker-DwITf4I2.js";import{t as Xe}from"./time-picker-otHjbob1.js";import{n as Ze}from"./date-formatters-DukWSVwc.js";import{n as Qe,r as $e,t as et}from"./task-header-title-Cdgp2rCs.js";import{t as tt}from"./date-time-picker-ChG1CqR1.js";import{a as nt,i as rt,n as it,o as V,r as H,t as at}from"./task-run-issue-notice-CGrUMy0s.js";import{t as ot}from"./page-context-capture-button-BXSBeGms.js";import{t as st}from"./dependency-picker-DEPr5_Wk.js";var U=e(t(),1),W=n(),G=r();function ct(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 lt(e){let t=(0,W.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=R(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=>ct(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,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1`,children:l}),(0,G.jsx)(A,{"aria-hidden":!0,className:R(`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,G.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,G.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 ut(e){let t=e;for(;t&&!/(auto|scroll)/.test(getComputedStyle(t).overflowY);)t=t.parentElement;return t}function dt(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=ut(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 ft(e){let t=(0,W.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,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(void 0),p=(0,U.useRef)(o),m=(0,U.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,U.useEffect)(h,g);let _=(0,U.useRef)(void 0),v=(0,U.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=ct(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=dt(l.current,e)},t[7]=x):x=t[7];let S=x,[C,w]=(0,U.useState)(c??`results`),T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[8]=T):T=t[8];let[E,ee]=(0,U.useState)(T),D;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{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]`));ee(r.map(pt));let i=0,a=()=>{if(d.current)return;let e=ut(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]=D):D=t[9];let O;t[10]!==r||t[11]!==n?(O=[n,r,b],t[10]=r,t[11]=n,t[12]=O):O=t[12],(0,U.useEffect)(D,O);let k,te;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(te=()=>()=>{clearTimeout(f.current),_.current?.cancel()},k=[],t[13]=k,t[14]=te):(k=t[13],te=t[14]),(0,U.useEffect)(te,k);let A,j;t[15]===c?(A=t[16],j=t[17]):(A=()=>{!c||u.current===c||(u.current=c,w(c),S(c))},j=[c,S],t[15]=c,t[16]=A,t[17]=j),(0,U.useEffect)(A,j);let M;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>{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]=M):M=t[18];let N;t[19]!==C||t[20]!==E?(N=[C,E],t[19]=C,t[20]=E,t[21]=N):N=t[21],(0,U.useEffect)(M,N);let P=n===`zh`?`任务详情分区`:`Task detail sections`,F;t[22]!==C||t[23]!==E?(F=E.map(e=>(0,G.jsx)(`button`,{type:`button`,"aria-current":C===e.id?`location`:void 0,"aria-pressed":C===e.id,"data-sliding-active":C===e.id,className:R(`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]=F):F=t[24];let I;return t[25]!==P||t[26]!==F?(I=(0,G.jsx)(B,{scrollFocusedItemIntoView:!1,as:`nav`,ref:l,"aria-label":P,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:F}),t[25]=P,t[26]=F,t[27]=I):I=t[27],I}function pt(e){return{id:e.dataset.taskSection,label:e.dataset.taskSectionLabel}}var mt=`Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage.`;function ht(e){let t=(0,W.c)(64),{criterion:n,index:r,language:i,closed:a,pending:o,onReview:s,projectId:c,conversationId:l}=e,u=i===`zh`,d=(0,U.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]:(_=R(`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,G.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=R(`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,G.jsx)(te,{className:`size-3.5`,strokeWidth:2.8}):null,t[15]=f,t[16]=w);let T;t[17]!==C||t[18]!==w?(T=(0,G.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,G.jsxs)(`label`,{className:_,children:[b,T]}),t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let ee=`criterion:${r}:evidence`,D;t[24]!==n.text||t[25]!==d?(D=(0,G.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]=D):D=t[26];let O=u?`验收依据`:`Acceptance evidence`,k;t[27]===O?k=t[28]:(k=(0,G.jsx)(`p`,{className:`font-medium text-fg`,children:O}),t[27]=O,t[28]=k);let A;t[29]!==n.method||t[30]!==m||t[31]!==u?(A=n.method?(0,G.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]=A):A=t[32];let j;t[33]!==n.review||t[34]!==i||t[35]!==h||t[36]!==u?(j=n.review?(0,G.jsxs)(`p`,{children:[u?`人工验收`:`User review`,` · `,h,` · `,Ze(n.review.reviewedAt,i)]}):null,t[33]=n.review,t[34]=i,t[35]=h,t[36]=u,t[37]=j):j=t[37];let M;t[38]!==n.note||t[39]!==r||t[40]!==i?(M=n.note&&n.note!==mt?(0,G.jsx)(V,{content:rt(n.note,i),contentKey:`criterion:${r}:note`,language:i,markdown:!1}):null,t[38]=n.note,t[39]=r,t[40]=i,t[41]=M):M=t[41];let N;t[42]!==l||t[43]!==n.evidence||t[44]!==i||t[45]!==c?(N=(0,G.jsx)(it,{evidence:n.evidence,projectId:c,conversationId:l,language:i}),t[42]=l,t[43]=n.evidence,t[44]=i,t[45]=c,t[46]=N):N=t[46];let P;t[47]!==p||t[48]!==u?(P=p?null:(0,G.jsx)(`p`,{children:u?`暂无验收依据`:`No evidence yet`}),t[47]=p,t[48]=u,t[49]=P):P=t[49];let F;t[50]!==k||t[51]!==A||t[52]!==j||t[53]!==M||t[54]!==N||t[55]!==P?(F=(0,G.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:[k,A,j,M,N,P]}),t[50]=k,t[51]=A,t[52]=j,t[53]=M,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;t[57]!==ee||t[58]!==D||t[59]!==F?(I=(0,G.jsx)(lt,{panelId:ee,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:D,children:F}),t[57]=ee,t[58]=D,t[59]=F,t[60]=I):I=t[60];let ne;return t[61]!==E||t[62]!==I?(ne=(0,G.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,I]}),t[61]=E,t[62]=I,t[63]=ne):ne=t[63],ne}function gt(e){let t=(0,W.c)(40),{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(_t),t[0]=n,t[1]=p);let m=p,h;t[2]!==m||t[3]!==r||t[4]!==f?(h=m?(0,G.jsx)(lt,{panelId:`acceptance:diagnostic`,title:f?`验收标准需要细化`:`The criteria need more detail`,className:`mx-4 mb-2 text-xs leading-5 text-fg-muted`,children:(0,G.jsx)(`p`,{className:`mt-2 break-words`,children:rt(mt,r)})}):null,t[2]=m,t[3]=r,t[4]=f,t[5]=h):h=t[5];let g=a||void 0,_;if(t[6]!==i||t[7]!==u||t[8]!==n||t[9]!==r||t[10]!==c||t[11]!==a||t[12]!==l||t[13]!==d){let e;t[15]!==i||t[16]!==u||t[17]!==r||t[18]!==c||t[19]!==a||t[20]!==l||t[21]!==d?(e=(e,t)=>(0,G.jsx)(ht,{criterion:e,index:t,language:r,closed:i||!!d,pending:a,onReview:c,projectId:l,conversationId:u},`${t}:${e.text}`),t[15]=i,t[16]=u,t[17]=r,t[18]=c,t[19]=a,t[20]=l,t[21]=d,t[22]=e):e=t[22],_=n.map(e),t[6]=i,t[7]=u,t[8]=n,t[9]=r,t[10]=c,t[11]=a,t[12]=l,t[13]=d,t[14]=_}else _=t[14];let v;t[23]!==g||t[24]!==_?(v=(0,G.jsx)(`ul`,{"aria-busy":g,className:`border-t border-edge-subtle`,children:_}),t[23]=g,t[24]=_,t[25]=v):v=t[25];let y;t[26]!==n.length||t[27]!==f?(y=n.length===0?(0,G.jsx)(`p`,{className:`px-4 py-4 text-sm text-fg-muted`,children:f?`尚未定义验收标准`:`No acceptance criteria defined`}):null,t[26]=n.length,t[27]=f,t[28]=y):y=t[28];let b;t[29]===s?b=t[30]:(b=s?(0,G.jsx)(`p`,{role:`alert`,className:`mx-4 my-2 text-sm text-danger`,children:s}):null,t[29]=s,t[30]=b);let x;t[31]!==o||t[32]!==i?(x=!i&&o?(0,G.jsx)(`p`,{className:`border-t border-edge-subtle px-4 py-2.5 text-xs text-fg-muted`,children:o}):null,t[31]=o,t[32]=i,t[33]=x):x=t[33];let S;return t[34]!==h||t[35]!==v||t[36]!==y||t[37]!==b||t[38]!==x?(S=(0,G.jsxs)(G.Fragment,{children:[h,v,y,b,x]}),t[34]=h,t[35]=v,t[36]=y,t[37]=b,t[38]=x,t[39]=S):S=t[39],S}function _t(e){return e.note===mt}function vt(e){let t=(0,W.c)(27),{detail:n,language:r}=e,i=r===`zh`,o=a(),s;if(t[0]!==n||t[1]!==r||t[2]!==o||t[3]!==i){let e=n.deliverables??[],a=ye(n),l=a&&H(a,r),u;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),u=new Set(n.runs.filter(e).map(Tt)),t[5]=n.runs,t[6]=n.task,t[7]=u}else u=t[7];let d=u,f=n.context.filter(wt).map(Ct),p=new Set(e.flatMap(St).filter(Boolean)),m=new Set([...f.map(xt),...p].filter(Boolean)),h;t[10]===d?h=t[11]:(h=e=>d.has(e.runId),t[10]=d,t[11]=h);for(let e of n.receipts.filter(h))for(let t of e.evidence.filter(bt))t.uri&&m.has(t.uri)||(t.uri&&m.add(t.uri),f.push(t));let g=l?.summary,_=g&&g.length<=160&&!g.includes(`
2
2
  `)&&!/\b(?:Claim|Criterion|Research claim)\b|c-ac\d|Default criteria were not/i.test(g)?g:void 0,v=f.filter(e=>!p.has(e.uri)),y=i?`交付结果`:`Deliverables`,b;t[12]===y?b=t[13]:(b=(0,G.jsx)(`h2`,{id:`task-results-heading`,className:`text-sm font-semibold text-fg`,children:y}),t[12]=y,t[13]=b);let x;t[14]!==e||t[15]!==n||t[16]!==o||t[17]!==i?(x=e.length?(0,G.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,G.jsxs)(`li`,{className:`min-w-0`,children:[(0,G.jsxs)($e,{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,G.jsx)(I,{name:t}),(0,G.jsx)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:t})]}),e.artifact?.availability===`available`&&e.artifact.uri?.startsWith(`media://outbound/`)?(0,G.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]=x):x=t[18];let S;t[19]!==n||t[20]!==r||t[21]!==v?(S=v.length?(0,G.jsx)(it,{evidence:v,language:r,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,compact:!0}):null,t[19]=n,t[20]=r,t[21]=v,t[22]=S):S=t[22];let w;t[23]!==e||t[24]!==v.length||t[25]!==i?(w=!e.length&&!v.length?(0,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i?`尚无可查看的交付物`:`No deliverables available yet`}):null,t[23]=e,t[24]=v.length,t[25]=i,t[26]=w):w=t[26],s=(0,G.jsxs)(`section`,{"aria-label":i?`交付结果`:`Deliverables`,className:`rounded-xl bg-surface-panel p-4`,children:[b,_?(0,G.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-fg-muted [overflow-wrap:anywhere]`,children:_}):null,a&&a.completionVerdict!==`achieved`?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`本次执行尚未报告目标全部达成。`:`This run has not reported the full goal achieved.`}):null,x,S,w,a?null:(0,G.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:i?`尚无本版任务的执行结果`:`No run result for this task version`}),a&&l&&(a.needsUser||l.remainingWork.length>0||l.nextAction)?(0,G.jsxs)(`div`,{className:`mt-4 space-y-2 border-t border-edge-subtle pt-3`,"aria-label":i?`执行待办`:`Run follow-up`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:a.needsUser?i?`需要你决定`:`Your decision needed`:i?`待处理事项`:`Remaining work`}),l.remainingWork.length>0?(0,G.jsx)(`ul`,{className:`space-y-2 text-sm leading-6 text-fg`,children:l.remainingWork.map(yt)}):null,l.nextAction?(0,G.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:l.nextAction}):null,a.needsUser?(0,G.jsx)(c,{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]=s}else s=t[4];return s}function yt(e){return(0,G.jsx)(`li`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e},e)}function bt(e){return e.kind===`artifact`}function xt(e){return e.uri}function St(e){return[e.artifact?.uri,e.artifact?.shareUrl,e.artifact?.workspaceRelativePath]}function Ct(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 wt(e){return e.role===`deliverable`}function Tt(e){return e.id}function Et(e){let t=(0,W.c)(14),{detail:n,receipt:r,language:i}=e,a;t[0]!==n.runs||t[1]!==i||t[2]!==r?(a=H(r,i,n.runs.find(e=>e.id===r.runId)?.terminalMessage),t[0]=n.runs,t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s;t[4]===o.issue?s=t[5]:(s=o.issue?(0,G.jsx)(at,{issue:o.issue}):null,t[4]=o.issue,t[5]=s);let c;t[6]!==n.task||t[7]!==i||t[8]!==r||t[9]!==o.summary?(c=o.summary?(0,G.jsx)(V,{content:o.summary,contentKey:`${n.task.id}:result:${r.runId}`,language:i}):null,t[6]=n.task,t[7]=i,t[8]=r,t[9]=o.summary,t[10]=c):c=t[10];let l;return t[11]!==s||t[12]!==c?(l=(0,G.jsxs)(G.Fragment,{children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Dt(e){let t=(0,W.c)(19),{detail:n,language:r}=e,i=r===`zh`,a=Me(r),o;t[0]===n?o=t[1]:(o=ye(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,U.useState)(`idle`),f;t[4]===s?f=t[5]:(f=async function(e){if(s){d(`pending`);try{await _e(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,G.jsx)(S,{detail:n,language:r}),t[6]=n,t[7]=r,t[8]=m):m=t[8];let h=s?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:a.latestResult}),(0,G.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[a.receiptStatuses[s.status],` · `,a.verificationStatuses[s.verification.status]]})]}),(0,G.jsx)(Et,{detail:n,receipt:s,language:r}),s.evidence.length>0?(0,G.jsxs)(`details`,{children:[(0,G.jsxs)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:[i?`验证依据与执行产物`:`Evidence and artifacts`,` · `,s.evidence.length]}),(0,G.jsx)(it,{evidence:s.evidence,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,language:r})]}):null,(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,G.jsx)(z,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`helpful`),children:a.doneWell}),(0,G.jsx)(z,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`not_helpful`),children:a.needsFix}),u===`saved`?(0,G.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`反馈已记录`:`Feedback saved`}):null,u===`failed`?(0,G.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:a.actionFailed}):null]})]}):null,g=l.length>0?(0,G.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:a.executionHistory.replace(`{{count}}`,String(l.length))}),(0,G.jsx)(`div`,{className:`mt-3 space-y-4`,children:l.map(e=>(0,G.jsxs)(`article`,{className:`space-y-2 rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.receiptStatuses[e.status]}),(0,G.jsx)(Et,{detail:n,receipt:e,language:r})]},e.runId))})]}):null,_;t[9]!==a||t[10]!==n.criterionReviewHistory||t[11]!==r||t[12]!==i?(_=n.criterionReviewHistory?.length?(0,G.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:i?`历史验收判定`:`Past criterion reviews`}),(0,G.jsx)(`ul`,{className:`mt-2 space-y-2 text-sm`,children:n.criterionReviewHistory.map(e=>(0,G.jsxs)(`li`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`p`,{children:e.criterionText}),(0,G.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[a.verificationStatuses[e.status],` · `,Ze(e.reviewedAt,r)]}),e.note?(0,G.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:rt(e.note,r)}):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,G.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 Ot(e){let t=(0,W.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,G.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,G.jsxs)(`li`,{className:`text-sm text-fg`,children:[(0,G.jsxs)(`div`,{children:[o[e.fromPhase],e.fromResolution?` · ${u[e.fromResolution]}`:``,` → `,o[e.toPhase],e.toResolution?` · ${u[e.toResolution]}`:``]}),(0,G.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,G.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:Ze(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,G.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,G.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,G.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 kt({schedules:e,language:t,onEdit:n,onUpdated:r}){let i=t===`zh`,a=p(t),[o,s]=(0,U.useState)(null),l=(0,U.useRef)(!1),[u,d]=(0,U.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,s(e.id),d(null);try{r((await Fe.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,s(null)}}}return(0,G.jsxs)(`section`,{"aria-label":i?`执行时间`:`Execution schedule`,className:`rounded-xl bg-surface-inset p-4`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`执行时间`:`Execution schedule`}),(0,G.jsx)(`div`,{className:`mt-3 space-y-4`,children:e.map(e=>{let r=e.trigger.kind===`schedule`?e.trigger.schedule:null,s=k(e),l=!e.management||e.management.editable.includes(`trigger`),u=!e.management||e.management.editable.includes(`enabled`);return(0,G.jsxs)(`article`,{className:`space-y-2 text-sm text-fg`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`break-words font-medium`,children:e.name}),(0,G.jsx)(`span`,{className:`text-xs text-fg-muted`,children:s?i?`已执行`:`Completed`:e.enabled?i?`已启用`:`Enabled`:i?`已取消定时执行`:`Scheduling disabled`})]}),(0,G.jsx)(`p`,{children:r?.kind===`once`?`${i?`单次执行:`:`Run once: `}${f(Date.parse(r.at))}`:O(e.trigger,a.automations,a.cron,t)}),r?.kind===`cron`?(0,G.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[i?`执行时区:`:`Schedule timezone: `,r.tz||(i?`服务所在电脑时区`:`Server timezone`)]}):null,(0,G.jsxs)(`p`,{className:`text-fg-muted`,children:[i?`下次执行:`:`Next run: `,s?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,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l?(0,G.jsx)(z,{variant:`secondary`,disabled:o!==null,onClick:()=>n(e),children:i?`修改时间`:`Edit schedule`}):null,e.enabled&&u?(0,G.jsx)(z,{variant:`ghost`,disabled:o!==null,onClick:()=>void m(e),children:o===e.id?i?`正在取消…`:`Cancelling…`:i?`取消定时执行`:`Cancel schedule`}):null,(0,G.jsx)(z,{asChild:!0,variant:`ghost`,children:(0,G.jsx)(c,{to:`/automations?automation=${encodeURIComponent(e.id)}`,children:i?`查看自动化`:`View automation`})})]})]},e.id)})}),u?(0,G.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:u}):null]})}var At=`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 jt({taskId:e,taskTitle:t,projectId:n,executorAgentId:r,language:i,onClose:a,onCreated:o,automation:s}){let l=i===`zh`,u=p(i).automations,[d,f]=(0,U.useState)(()=>s?We(s):{...Ge,name:t,projectId:n??``,actionMode:`task_command`,taskId:e,agentId:r??``,triggerMode:`once`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}),[x,S]=(0,U.useState)(null),[C,w]=(0,U.useState)(!1),T=(0,U.useRef)(!1),[E,ee]=(0,U.useState)(null),D=e=>f(t=>({...t,...e}));async function O(e){if(e.preventDefault(),!(T.current||x)&&(ee(null),!(!d.name.trim()||!s&&!r))){if(d.triggerMode===`once`&&(!Number.isFinite(new Date(d.onceAt).getTime())||new Date(d.onceAt).getTime()<=Date.now())){ee(u.experience.futureTime);return}T.current=!0,w(!0);try{let e=s?Ke(s,d).trigger:Je(d).trigger,{automation:t}=s?await Fe.update(s.id,{trigger:e,...s.management?{}:{name:d.name.trim(),delivery:{...s.delivery,notificationPolicy:d.notificationPolicy}},...!s.management||s.management.editable.includes(`enabled`)?{enabled:!0}:{},expectedRevision:s.updatedAtMs}):await Fe.create({...Je(d),enabled:!0});S(t),o(t)}catch(e){ee(e instanceof Error?e.message:u.feedback.actionFailed)}finally{T.current=!1,w(!1)}}}return(0,G.jsx)(b,{open:!0,onOpenChange:e=>{!e&&!T.current&&a()},children:(0,G.jsxs)(_,{children:[(0,G.jsx)(m,{className:`fixed inset-0 z-[110] bg-black/45`}),(0,G.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,G.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,G.jsx)(y,{className:`text-base font-semibold text-fg`,children:s?l?`修改执行时间`:`Edit execution schedule`:l?`设置执行时间`:`Set execution time`}),(0,G.jsx)(g,{asChild:!0,children:(0,G.jsx)(z,{variant:`ghost`,className:`size-9 p-0`,disabled:C,"aria-label":l?`关闭`:`Close`,children:(0,G.jsx)(L,{className:`size-4`})})})]}),(0,G.jsx)(h,{className:`sr-only`,children:l?`为当前任务创建定时或周期自动化。`:`Create a scheduled or recurring automation for this task.`}),x?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,G.jsx)(`p`,{role:`status`,className:`text-sm font-medium text-fg`,children:s?l?`执行时间已更新`:`Schedule updated`:l?`执行时间已设置`:`Schedule created`}),(0,G.jsx)(`p`,{className:`break-words text-sm text-fg-muted`,children:x.name}),(0,G.jsx)(z,{asChild:!0,variant:`primary`,children:(0,G.jsx)(c,{to:`/automations?automation=${encodeURIComponent(x.id)}`,children:l?`查看自动化`:`View automation`})})]}),(0,G.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:(0,G.jsx)(z,{onClick:a,children:l?`完成`:`Done`})})]}):(0,G.jsxs)(`form`,{onSubmit:e=>void O(e),className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,G.jsxs)(`p`,{className:`break-words text-sm text-fg-muted`,children:[l?`执行任务:`:`Task: `,t]}),(0,G.jsxs)(`fieldset`,{disabled:C,className:`space-y-4`,children:[(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.name,(0,G.jsx)(`input`,{required:!0,readOnly:!!s?.management,className:At,value:d.name,onChange:e=>D({name:e.target.value})})]}),(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.trigger,(0,G.jsxs)(j,{value:d.triggerMode,onChange:e=>D({triggerMode:e.target.value}),children:[s?.trigger.kind===`schedule`&&s.trigger.schedule.kind===`interval`?(0,G.jsx)(M,{value:`interval`,children:l?`固定间隔`:`Fixed interval`}):null,s?.trigger.kind===`schedule`&&s.trigger.schedule.kind===`cron`?(0,G.jsx)(M,{value:`cron`,children:l?`自定义规则`:`Custom schedule`}):null,(0,G.jsx)(M,{value:`once`,children:u.trigger.once}),(0,G.jsx)(M,{value:`daily`,children:u.trigger.daily}),(0,G.jsx)(M,{value:`weekly`,children:u.trigger.weekly})]})]}),d.triggerMode===`once`?(0,G.jsx)(tt,{label:u.form.onceAt,disabled:C,value:d.onceAt,defaultTime:d.time,onChange:e=>D({onceAt:e})}):[`daily`,`weekly`].includes(d.triggerMode)?(0,G.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,G.jsx)(`span`,{children:u.form.time}),(0,G.jsx)(Xe,{disabled:C,value:d.time,onChange:e=>D({time:e}),ariaLabel:u.form.time})]}):null,d.triggerMode===`weekly`?(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.day,(0,G.jsx)(j,{value:d.weekday,onChange:e=>D({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,G.jsx)(M,{value:String(t),children:u.weekdays[e]},e))})]}):null,d.triggerMode===`cron`?(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`定时规则`:`Cron expression`,(0,G.jsx)(`input`,{required:!0,className:At,value:d.cronExpr,onChange:e=>D({cronExpr:e.target.value})})]}):null,d.triggerMode===`interval`?(0,G.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`执行间隔`:`Interval`,(0,G.jsx)(`input`,{required:!0,type:`number`,min:`1`,className:At,value:d.intervalValue,onChange:e=>D({intervalValue:e.target.value})})]}),(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`单位`:`Unit`,(0,G.jsxs)(j,{value:d.intervalUnit,onChange:e=>D({intervalUnit:e.target.value}),children:[(0,G.jsx)(M,{value:`minute`,children:l?`分钟`:`Minutes`}),(0,G.jsx)(M,{value:`hour`,children:l?`小时`:`Hours`}),(0,G.jsx)(M,{value:`day`,children:l?`天`:`Days`}),(0,G.jsx)(M,{value:`week`,children:l?`周`:`Weeks`})]})]})]}):null,(0,G.jsx)(qe,{form:d,onChange:D,language:i}),(0,G.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.draft.notifications,(0,G.jsxs)(j,{disabled:!!s?.management,value:d.notificationPolicy,onChange:e=>D({notificationPolicy:e.target.value}),children:[(0,G.jsx)(M,{value:`attention`,children:u.draft.notifyAttention}),(0,G.jsx)(M,{value:`all`,children:u.draft.notifyAll}),(0,G.jsx)(M,{value:`none`,children:u.draft.notifyNone})]})]})]}),!s&&!r?(0,G.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l?`请先为任务指定执行 Agent。`:`Assign an executor agent to the task first.`}):null,E?(0,G.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:E}):null]}),(0,G.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,G.jsx)(z,{type:`button`,variant:`ghost`,disabled:C,onClick:a,children:l?`取消`:`Cancel`}),(0,G.jsx)(z,{type:`submit`,variant:`primary`,disabled:C||!s&&!r||!d.name.trim()||d.triggerMode===`once`&&!d.onceAt,children:C?l?`正在保存…`:`Saving…`:s?s.enabled?l?`保存修改`:`Save changes`:l?`保存并启用`:`Save and enable`:l?`创建自动化`:`Create automation`})]})]})]})]})})}function Mt(e){let t=(0,W.c)(14),{detail:n,executorName:r,language:i,onUpdated:a,ref:o}=e,s=i===`zh`,l;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s){let e=n.waits.find(Ft),u=n.allowedCommands.includes(`resolve_wait`)&&!e?n.waits.filter(Pt):[],d=n.presentation.status===`needsUser`,f=ye(n),p=n.runs.find(Nt),m={queued:s?`等待开始执行。`:`Waiting to start.`,running:r?s?`${r} 正在处理任务。`:`${r} is working on the task.`:s?`任务处理中。`:`The task is in progress.`,waiting:s?`任务正在等待继续。`:`The task is waiting to resume.`,verifying:s?`正在检查执行结果。`:`Checking the result.`},h=rt(n.presentation.reason??e?.reason??n.waits[0]?.reason??(n.task.phase===`closed`?f?.summary??(s?`任务已关闭,可查看交付物与执行结果。`:`The task is closed. Review its deliverables and results.`):n.task.phase===`review`?s?`请检查交付物并勾选通过的验收项。`:`Review the deliverables and check the criteria that pass.`:(p&&m[p.status])??f?.summary??(s?`任务尚未开始,可开始执行或设置执行时间。`:`Start the task or set an execution time.`)),i),g=n.attention.length>0?(0,G.jsx)(`ul`,{className:`mt-3 space-y-3`,children:n.attention.map((e,t)=>{let r=u.some(t=>e.kind===`input_required`&&t.kind===`user_input`||e.kind===`approval_required`&&t.kind===`approval`),a=rt(e.summary,i);return(0,G.jsxs)(`li`,{className:`text-sm leading-6 text-fg-muted`,children:[(0,G.jsx)(V,{content:a,contentKey:`${n.task.id}:attention:${e.kind}:${t}`,language:i,previewHeight:72,children:(0,G.jsx)(T,{content:me(a),compact:!0,breaks:!0})}),!r&&(e.kind===`input_required`||e.kind===`approval_required`)?(0,G.jsx)(c,{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:s?e.kind===`approval_required`?`查看并决定`:`补充信息`:e.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${e.kind}-${t}`)})}):null,_=d?s?`需要你处理`:`Your action needed`:s?`当前进展`:`Current progress`,v=u.length>1?` · ${u.length}`:``,y;t[7]!==_||t[8]!==v?(y=(0,G.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[_,v]}),t[7]=_,t[8]=v,t[9]=y):y=t[9];let b;t[10]!==n||t[11]!==a||t[12]!==s?(b=e=>(0,G.jsx)(nt,{wait:e,detail:n,zh:s,onUpdated:a},e.id),t[10]=n,t[11]=a,t[12]=s,t[13]=b):b=t[13],l=(0,G.jsxs)(`section`,{ref:o,tabIndex:-1,"aria-label":s?`当前需要处理`:`Current action`,className:`rounded-xl bg-surface-panel p-4`,children:[y,u.map(b),u.length>0?g?(0,G.jsxs)(`details`,{className:`mt-3`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:s?`等待详情`:`Waiting details`}),g]}):null:g??(0,G.jsx)(V,{content:h,contentKey:`${n.task.id}:current-progress`,language:i,previewHeight:72,className:`mt-2 text-sm leading-6 text-fg-muted`,children:(0,G.jsx)(T,{content:me(h),compact:!0})})]}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=l}else l=t[6];return l}function Nt(e){return!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)}function Pt(e){return(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`}function Ft(e){return e.kind===`paused`}function It(e){let t=(0,W.c)(17),{children:n,contentKey:r,language:a,className:o}=e,s=(0,U.useId)(),c=U.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,G.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,G.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,G.jsxs)(`div`,{className:o,children:[m,h]}),t[13]=o,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function Lt({taskId:e}){let t=u(e=>e.conversationId),n=d(e=>e.language),[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)([]),[_,v]=(0,U.useState)(null),y=l(`/api/tasks/${encodeURIComponent(e)}/collaboration`),{data:b,error:x,mutate:S}=he([`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,U.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,G.jsxs)(`section`,{className:`rounded-xl bg-surface-inset p-4`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n===`zh`?`任务留言`:`Task updates`}),(0,G.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-2 overflow-y-auto`,children:[!b&&!x?(0,G.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,G.jsx)(de,{className:`h-14 w-full`}),(0,G.jsx)(de,{className:`h-14 w-4/5`})]}):null,x?(0,G.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:n===`zh`?`暂时无法读取留言`:`Updates unavailable`}):null,C[0]&&C[0].sequence>1?(0,G.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,G.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 text-sm`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,G.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,G.jsxs)(`span`,{children:[`· `,t.kind]}),t.deliveryStatus?(0,G.jsxs)(`span`,{children:[`· `,t.deliveryStatus]}):null]}),(0,G.jsx)(`div`,{className:`mt-1 min-w-0 text-fg`,"data-task-collaboration-body":!0,children:(0,G.jsx)(V,{content:t.body,contentKey:`${e}:update:${t.id}`,language:n,breaks:!0,previewHeight:120})}),t.kind===`question`&&t.authorKind===`worker_agent`?(0,G.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,G.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n===`zh`?`暂无进展留言`:`No updates yet`}):null]}),a?(0,G.jsxs)(`p`,{className:`mt-3 text-xs text-accent`,children:[n===`zh`?`正在回复执行 Agent 的问题`:`Replying to the worker`,(0,G.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>o(null),children:n===`zh`?`取消`:`Cancel`})]}):null,(0,G.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,G.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:_}):null,(0,G.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 Rt(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function zt(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 Bt(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function Vt(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ht(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Ut=[`backlog`,`ready`,`active`,`review`,`closed`],Wt=[`low`,`normal`,`high`,`critical`],Gt=(0,U.memo)(function(e){let t=(0,W.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,G.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=Ut.map(e=>(0,G.jsx)(M,{value:e,disabled:d(e),children:Bt(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,G.jsx)(j,{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,G.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}),Kt=(0,U.memo)(function(e){let t=(0,W.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,G.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=Wt.map(e=>(0,G.jsx)(M,{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,G.jsx)(j,{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,G.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}),qt=(0,U.memo)(function(e){let t=(0,W.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,G.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,G.jsx)(Ye,{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,G.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}),Jt=(0,U.memo)(function(e){let t=(0,W.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,G.jsx)(`span`,{children:i}),t[17]=i,t[18]=y),l=j,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,G.jsx)(M,{value:``,disabled:!0,children:a}),t[21]=a,t[22]=g),_=o.map(t=>(0,G.jsx)(M,{value:t.id,children:Ie(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,G.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,G.jsxs)(`label`,{className:v,children:[y,b]}),t[32]=b,t[33]=v,t[34]=y,t[35]=x):x=t[35],x}),Yt=(0,U.memo)(function(e){let t=(0,W.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(rn),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,G.jsx)(st,{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)),Xt=`xopc.taskDetail.chatPanelPercent`,Zt=42;function Qt(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?Zt:Math.min(r,Math.max(n,e))}function $t(){try{let e=Number(window.localStorage.getItem(Xt));return Number.isFinite(e)&&e>=30&&e<=60?e:Zt}catch{return Zt}}function en(e){let t=(0,W.c)(13),{items:n,empty:r,contentKey:i}=e,a=d(tn);if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,G.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
3
  `),t[2]=n,t[3]=o);let s;t[4]===n?s=t[5]:(s=n.map(K),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,G.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,G.jsx)(V,{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 K(e){return(0,G.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,G.jsx)(N,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,G.jsx)(`span`,{className:`min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e})]},e)}function tn(e){return e.language}function q({taskId:e,presentation:t,backgroundPath:n,onDeleted:r,onHeaderChange:s}){let[l,f]=i(),m=o(),h=d(e=>e.language),g=u(e=>e.conversationId),_=(0,U.useMemo)(()=>Me(h),[h]),v=Ne(e=>e.setPageHeader),y=Ne(e=>e.clearPageHeader),b=je(e=>e.panes),S=x(e=>e.openForSession),{data:C,error:T,mutate:O,lastChange:k,conversationLoading:te,conversationError:A}=w(e),{data:j,error:M,mutate:N}=he(e?[`task-detail-automations`,g]:null,()=>Fe.list(),{refreshInterval:3e4}),[I,L]=(0,U.useState)(null),[me,_e]=(0,U.useState)(null),[B,We]=(0,U.useState)(()=>new Set),[Ge,Ke]=(0,U.useState)([]),[qe,Je]=(0,U.useState)(null),[Ye,Xe]=(0,U.useState)([]),[$e,tt]=(0,U.useState)(!1),[nt,rt]=(0,U.useState)(``),[it,H]=(0,U.useState)(!1),[at,st]=(0,U.useState)(``),[W,dt]=(0,U.useState)($t),[pt,mt]=(0,U.useState)(!1),ht=(0,U.useRef)(null),_t=(0,U.useRef)(null),yt=(0,U.useRef)(null),{key:bt,state:xt}=a(),St=xt?.focusTaskResults,Ct=!!C;(0,U.useEffect)(()=>{if(!Ct||St!==e)return;let t=requestAnimationFrame(()=>{_t.current?.scrollIntoView?.({block:`start`}),_t.current?.focus({preventScroll:!0})});return()=>cancelAnimationFrame(t)},[St,bt,Ct,e]);let wt=(0,U.useRef)(null),Tt=(0,U.useRef)(null),[Et,At]=(0,U.useState)(!1),Nt=(0,U.useRef)(!1),Pt=(0,U.useRef)(!1),Ft=(0,U.useRef)(``),Bt=(0,U.useRef)(null),Ut=(0,U.useRef)(null),Wt=(0,U.useRef)(null),K=(0,U.useRef)(C),[tn,q]=(0,U.useState)(null),[nn,rn]=(0,U.useState)(null),[an,on]=(0,U.useState)(!1),[sn,cn]=(0,U.useState)(!1),[ln,un]=(0,U.useState)(null),dn=(0,U.useRef)(null),fn=(0,U.useMemo)(()=>({link:_.linkDependencies,linked:_.linkedDependencies,searchPlaceholder:_.dependencySearchPlaceholder,noMatches:_.noDependencyMatches,noCandidates:_.noDependencyCandidates,remove:_.removeDependency}),[_.dependencySearchPlaceholder,_.linkDependencies,_.linkedDependencies,_.noDependencyCandidates,_.noDependencyMatches,_.removeDependency]),pn=C?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,mn=(0,U.useMemo)(()=>se(l.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[l]),hn=(0,U.useCallback)(e=>t===`modal`&&n?ie(n,e):oe(`/tasks/${encodeURIComponent(e)}`,mn),[n,t,mn]);K.current=C;let J=(0,U.useCallback)((e,t)=>{We(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,U.useEffect)(()=>{L(null),_e(null),q(null),tt(!1),Bt.current=null,H(!1),rn(null),on(!1),cn(!1),un(null)},[e]),(0,U.useEffect)(()=>{let e=!0;return Ae().then(t=>{e&&Xe(t.items)}).catch(()=>void 0),()=>{e=!1}},[g]),(0,U.useEffect)(()=>{if(!k||k.source===`user`)return;rn(k);let e=window.setTimeout(()=>rn(null),3500);return()=>window.clearTimeout(e)},[k]),(0,U.useEffect)(()=>{let t=C?.task.projectId,n=C?.dependencies??[];if(!t){Wt.current=null,Je(null),Ke(n);return}Wt.current!==t&&(Wt.current=t,Je(null));let r=!0;return pe(t).then(t=>{if(!r)return;Je(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});Ke([...i.values()])}).catch(()=>{r&&Ke(n)}),()=>{r=!1}},[pn,C?.task.projectId,e]);let Y=(0,U.useCallback)(async(t,n=`command`)=>{let r=K.current;if(r){J(n,!0),L(null),t.type===`signoff`&&_e(null);try{await O(await De(e,t,r.task.version),{revalidate:!1})}catch{L(_.actionFailed),t.type===`signoff`&&_e(_.actionFailed)}finally{J(n,!1)}}},[_.actionFailed,O,J,e]),gn=async t=>{J(`command`,!0),L(null);try{let n=await ge(e,t);await O(),n.status===`waiting_connection`&&n.connectionConversationId?m(`/chat/${encodeURIComponent(n.connectionConversationId)}`):[`queued`,`running`,`verifying`,`succeeded`].includes(n.status)||L(Oe(n,h))}catch{L(_.actionFailed)}finally{J(`command`,!1)}},_n=(0,U.useCallback)(async(t,n)=>{let r=K.current;if(!r)return!1;n&&J(n,!0),L(null);try{let n=Te(e,t,r.task.version);return await O(n,{optimisticData:zt(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(_.actionFailed),!1}finally{n&&J(n,!1)}},[_.actionFailed,O,J,e]),vn=()=>{C&&(Bt.current={value:C.task.title,version:C.task.version},q(null),rt(C.task.title),tt(!0))},yn=()=>{Nt.current=!0,rt(K.current?.task.title??``),Bt.current=null,q(null),tt(!1),queueMicrotask(()=>{Nt.current=!1})},bn=async(e=!1)=>{if(Nt.current){Nt.current=!1;return}let t=K.current;if(!t||B.has(`title`))return;let n=nt.trim();if(!n){yn();return}let r=Bt.current;if(!e&&Rt(r,t.task.version,t.task.title,n)){q(`title`);return}if(n===t.task.title){yn();return}await _n({title:n},`title`)&&(Bt.current=null,q(null),tt(!1))},xn=async()=>{if(!C)return;if(Pt.current){Pt.current=!1;return}let e=at.trim(),t=Ut.current;if(Rt(t,C.task.version,C.task.body??``,e)){q(`description`);return}if(at===Ft.current||e===(C.task.body??``).trim()){H(!1);return}await _n({body:e||null})&&(q(null),H(!1))},Sn=(0,U.useCallback)(async e=>{let t=K.current;!t||e===t.task.phase||await Y({type:`move`,phase:e},`phase`)},[Y]),Cn=(0,U.useCallback)(e=>{_n({priority:e},`priority`)},[_n]),wn=(0,U.useCallback)(e=>{_n({dueAt:Ht(e)},`dueAt`)},[_n]),Tn=(0,U.useCallback)(e=>{dt(e);try{window.localStorage.setItem(Xt,String(e))}catch{}},[]),En=(0,U.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=wt.current?.clientWidth??0,n=e.key===`Home`?Zt:W+(e.key===`ArrowLeft`?2:-2);Tn(Qt(n,t))},[W,Tn]),Dn=(0,U.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=wt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),mt(!0);let i=W,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Qt((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{}mt(!1),Tn(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)},[W,Tn]),On=(0,U.useCallback)(async t=>{let n=K.current;if(n){J(`dependencies`,!0),L(null);try{await O(await we(e,t,n.task.version),{revalidate:!1})}catch{L(_.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[_.dependencyUpdateFailed,O,J,e]),kn=(0,U.useCallback)(async t=>{let n=K.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),L(null);try{await O(await be(e,t,n.task.version),{revalidate:!1})}catch{L(_.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[_.actionFailed,O,J,e]),An=(0,U.useCallback)(async()=>{J(`delete`,!0),L(null);try{await Ce(e),r?r():m(mn,{replace:!0})}catch(e){L(e instanceof Error?e.message:_.actionFailed)}finally{J(`delete`,!1)}},[_.actionFailed,m,r,mn,J,e]),jn=(0,U.useCallback)(async(t,n,r)=>{if(!t.acceptanceTarget)return!1;J(`acceptance`,!0),_e(null),L(null);try{return await O(await ve(e,fe(e,t.task.latestContractVersion,n),r,t.task.version,t.task.latestContractVersion,t.acceptanceTarget.id),{revalidate:!1}),!0}catch{return _e(_.actionFailed),L(_.actionFailed),O().catch(()=>void 0),!1}finally{J(`acceptance`,!1)}},[_.actionFailed,O,J,e]),Mn=C?.task.title,Nn=Mn!==void 0;if((0,U.useLayoutEffect)(()=>{let e=Tt.current,t=e?.parentElement;if(!Nn||!e||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(([e])=>{let n=ut(t),r=n?n.getBoundingClientRect().top+n.clientTop:0;At(!e.isIntersecting&&e.boundingClientRect.bottom<=r)});return n.observe(e),()=>n.disconnect()},[Nn,e]),(0,U.useLayoutEffect)(()=>{s?.({taskId:e,title:Mn,compact:Et})},[Et,s,e,Mn]),(0,U.useLayoutEffect)(()=>{if(t!==`modal`)return v({startExtra:(0,G.jsx)(c,{to:mn,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":_.backToWork,children:(0,G.jsx)(ee,{className:`size-4`})}),main:Nn?(0,G.jsx)(`div`,{className:`min-w-0 text-sm font-semibold text-fg`,children:(0,G.jsx)(et,{label:qe?`${qe} / ${_.taskLabel}`:_.taskLabel,title:Mn,compact:Et})}):null,end:e?(0,G.jsx)(c,{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,Et,_.backToWork,_.taskLabel,Nn,h,t,qe,mn,v,e,Mn]),T&&!C)return(0,G.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,G.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,G.jsx)(Qe,{})});let Pn=C.waits[0],X=C.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),Fn=xe(C),In=Fn.length>0&&Fn.every(e=>e.status===`passed`),Ln=C.waits.find(e=>e.kind===`paused`),Rn=ye(C),zn=Ee(C),Bn=_.detailStatuses[zn],Vn=C.task.body?.trim()||C.task.contract?.objective.trim()||``,Hn=C.allowedCommands.includes(`mark_ready`),Un=C.allowedCommands.includes(`start`),Wn=C.allowedCommands.includes(`add_wait`),Gn=!Pn&&!X&&In&&C.presentation.primaryAction?.type===`review`&&C.allowedCommands.includes(`close`),Kn=C.allowedCommands.includes(`reopen`),Z=C.conversation.activeConversationId,Q=C.conversation.currentExecutorAgentId??C.task.delegateAgentId??C.task.ownerId,qn=Ye.find(e=>e.id===Q),Jn=p(h).agentsSettings,Yn=qn?Ie(qn,Jn):void 0,Xn=X?.executorKind===`agent`?Ye.find(e=>e.id===(X.executorRef.agentId??C.conversation.currentExecutorAgentId)):void 0,Zn=Xn?Ie(Xn,Jn):void 0,Qn=!!(Z&&b[Z]?.open),$n=C.context.filter(e=>e.role!==`deliverable`),er=j?.automations.filter(t=>t.action.kind===`task_command`&&t.action.taskId===e)??[],$=er.filter(e=>e.trigger.kind===`schedule`&&e.action.kind===`task_command`&&e.action.command.type===`start`),tr=$.filter(e=>e.enabled&&e.state.nextRunAtMs!==void 0).map(e=>e.state.nextRunAtMs).sort((e,t)=>e-t)[0],nr=e=>{N(t=>({automations:[e,...(t?.automations??[]).filter(t=>t.id!==e.id)]}),{revalidate:!1})},rr=e=>{un(e),cn(!0)},ir=()=>{j&&($.length===1?rr($[0]):$.length>1?(dn.current&&(dn.current.open=!0),f(e=>ct(e,`schedule`,!0),{preventScrollReset:!0}),dn.current?.scrollIntoView({block:`start`,behavior:`smooth`}),dn.current?.focus({preventScroll:!0})):(un(null),cn(!0)))},ar=C.sessions.filter((e,t,n)=>n.findIndex(t=>t.conversationId===e.conversationId)===t),or=C.task.contract?.expectedOutputs??[],sr=C.task.contract?.constraints??[],cr=C.task.contract?.approvalRequired??[],lr=C.task.contract?.assumptions??[],ur=C.task.contract?.risks??[],dr=sr.length>0||cr.length>0||lr.length>0||ur.length>0,fr=(...e)=>!!nn?.changedFields.some(t=>e.includes(t)),pr=C.allowedCommands.includes(`move`),mr=B.has(`command`),hr=B.has(`delete`),gr=X!==void 0,_r=()=>{let e=ht.current;e&&(e.open=!0,f(e=>ct(e,`acceptance`,!0),{preventScrollReset:!0}),e.scrollIntoView({block:`start`,behavior:`smooth`}),e.focus({preventScroll:!0}))},vr=C.presentation.primaryAction,yr=()=>{Q&&Y({type:`start`,executor:{kind:`agent`,agentId:Q}})},br=()=>{_t.current?.scrollIntoView({block:`start`,behavior:`smooth`}),_t.current?.focus({preventScroll:!0})},xr=(()=>{switch(vr?.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:vr.waitId})};case`resolve_wait`:{let t=C.waits.find(e=>e.id===vr.waitId);if(t?.condition.type===`connection`&&t.taskRunId)return{label:h===`zh`?`检查连接并继续`:`Check connection and resume`,activate:()=>void gn(t.taskRunId)};let 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?yt.current?.focus():m(ae(e))}}case`inspect_run`:return{label:h===`zh`?`查看待处理事项`:`View pending issue`,activate:()=>yt.current?.focus()};case`review`:return{label:h===`zh`?`去验收`:`Review results`,activate:_r};case`signoff`:return{label:h===`zh`?`确认验收`:`Accept result`,activate:()=>void Y({type:`signoff`,resultId:vr.resultId})};case`view_results`:return{label:h===`zh`?`查看结果`:`View results`,activate:br};case`retry_allocation`:return{label:h===`zh`?`重新分配`:`Retry assignment`,activate:()=>void Y({type:`retry_allocation`})};case`retry_run`:return{label:h===`zh`?`重试任务`:`Retry task`,activate:()=>void gn(vr.runId)};case`start`:return{label:_.runTask,activate:yr,disabled:!Q}}})(),Sr=(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[xr?(0,G.jsx)(z,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:mr||xr.disabled,onClick:xr.activate,children:xr.label}):null,Kn?(0,G.jsxs)(z,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`ghost`,disabled:mr,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,G.jsx)(ue,{className:`size-4`}),_.reopenTask]}):null,C.task.phase!==`review`&&!Ln&&Wn?(0,G.jsxs)(z,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:mr,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,G.jsx)(le,{className:`size-4`}),_.pauseTask]}):null,!Pn&&!X&&C.task.phase!==`closed`&&C.task.phase!==`review`?(0,G.jsxs)(z,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:!j,onClick:ir,children:[(0,G.jsx)(D,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`]}):null,(0,G.jsxs)(Re,{children:[(0,G.jsx)(ze,{asChild:!0,children:(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:mr||hr,"aria-label":_.moreActions,children:(0,G.jsx)(P,{className:`size-4`,"aria-hidden":!0})})}),(0,G.jsx)(Be,{children:(0,G.jsxs)(He,{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`&&!Ln&&Wn?(0,G.jsx)(Ve,{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`&&!Pn&&!X?(0,G.jsx)(Ve,{disabled:!j,className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:opacity-50`,onSelect:ir,children:$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:h===`zh`?`设置执行时间`:`Set execution time`}):null,C.task.phase===`review`&&!Pn&&Un&&Q?(0,G.jsx)(Ve,{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,Hn&&(Un||Pn||C.task.phase===`review`)?(0,G.jsx)(Ve,{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,G.jsx)(Ve,{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),L(null),O(Se(e,X.id,X.version),{revalidate:!1}).catch(()=>L(_.actionFailed)).finally(()=>J(`command`,!1))},children:_.cancelActiveRun}):null,X?(0,G.jsx)(Ue,{className:`my-1 h-px bg-edge`}):null,C.task.phase===`closed`?null:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ve,{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,G.jsx)(Ue,{className:`my-1 h-px bg-edge`})]}),(0,G.jsx)(Ve,{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(gr){L(_.deleteActiveTaskBlocked);return}on(!0)},children:_.deleteTask})]})})]})]});return(0,G.jsxs)(`div`,{ref:wt,className:`flex h-full min-h-0 flex-col overflow-hidden ${pt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${W}%`},children:[(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,G.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,G.jsxs)(`header`,{ref:Tt,className:R(`shrink-0 px-4 py-5 sm:px-6 sm:py-6`,fr(`title`)&&`task-detail-live-update`),children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[qe?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,G.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),qe]}):null,qe?(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`/`}):null,(0,G.jsx)(`span`,{children:_.taskLabel}),nn?(0,G.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:nn.source===`agent`?h===`zh`?`Agent 刚刚更新`:`Updated by Agent`:h===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),$e?(0,G.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,"aria-label":h===`zh`?`任务标题`:`Task title`,rows:2,value:nt,onFocus:e=>{Bt.current?.value===nt&&(e.currentTarget.setSelectionRange(0,0),e.currentTarget.scrollTop=0)},onChange:e=>rt(e.target.value),onBlur:()=>void bn(),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),yn()):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,G.jsx)(V,{content:C.task.title,contentKey:`${e}:title`,language:h,previewHeight:56,className:`mt-2 max-w-3xl`,children:(0,G.jsx)(`h1`,{className:`break-words text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl`,children:(0,G.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:vn,children:C.task.title})})}),tn===`title`?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,G.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,G.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:yn,children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,G.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,disabled:B.has(`title`),onClick:()=>void bn(!0),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,G.jsx)(`span`,{className:R(`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium`,ke(zn)),children:Bn})]}),(0,G.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,G.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[Q?(0,G.jsx)(Pe,{agentId:Q,avatar:qn?.avatar,size:20,className:`shrink-0`}):null,(0,G.jsxs)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[_.executorLabel,` · `,Yn??Q??_.unassigned]})]}),(0,G.jsx)(`span`,{className:`text-fg-subtle`,children:_.updatedAt.replace(`{{date}}`,Ze(C.task.updatedAt,h))})]})]}),(0,G.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:[Sr,I?(0,G.jsx)(`p`,{role:`alert`,className:`basis-full text-sm text-danger`,children:I}):null,(0,G.jsx)(ft,{language:h,hasSchedule:$.length>0},e)]}),(0,G.jsxs)(`section`,{className:`min-w-0 space-y-4 p-4 sm:p-5`,children:[zn===`review`?null:(0,G.jsx)(Mt,{ref:yt,detail:C,executorName:Zn,language:h,onUpdated:e=>{O(e,{revalidate:!1})}}),(0,G.jsxs)(`section`,{"data-task-section":`results`,"data-task-section-label":h===`zh`?`交付结果`:`Results`,ref:_t,tabIndex:-1,"aria-labelledby":`task-results-heading`,className:`scroll-mt-24 space-y-4`,children:[(0,G.jsx)(vt,{detail:C,language:h}),(0,G.jsx)(lt,{panelId:`acceptance`,chevron:!0,"data-task-section":`acceptance`,"data-task-section-label":h===`zh`?`验收`:`Acceptance`,defaultOpen:!0,ref:ht,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,G.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[h===`zh`?`验收`:`Acceptance`,(0,G.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:[Fn.filter(e=>e.status===`passed`).length,`/`,Fn.length]})]}),children:(0,G.jsx)(gt,{criteria:Fn,language:h,closed:C.task.phase===`closed`,pending:B.has(`acceptance`),error:me,reviewDisabled:!C.acceptanceTarget||C.presentation.primaryAction?.type===`inspect_run`,blockedReason:Pn?h===`zh`?`请先处理待办事项`:`Resolve the pending request first`:X?h===`zh`?`请等待当前执行结束`:`Wait for the current run to finish`:void 0,onReview:(e,t)=>jn(C,e,t),projectId:C.task.projectId,conversationId:Z??void 0},`${e}:${C.task.latestContractVersion}:${C.acceptanceTarget?.id??``}`)})]}),(0,G.jsx)(lt,{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,G.jsx)(Dt,{detail:C,language:h},Rn?.runId??e)}),!j&&!M?(0,G.jsx)(de,{className:`h-9 rounded-lg`}):null,M?(0,G.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-danger`,children:[(0,G.jsx)(`span`,{children:h===`zh`?`无法读取执行计划,请重试后再设置时间。`:`Could not load schedules. Retry before setting a time.`}),(0,G.jsx)(z,{variant:`ghost`,onClick:()=>void N(),children:h===`zh`?`重试`:`Retry`})]}):null,$.length>0?(0,G.jsx)(lt,{panelId:`schedule`,chevron:!0,defaultOpen:!0,"data-task-section":`schedule`,"data-task-section-label":h===`zh`?`执行时间`:`Schedule`,ref:dn,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,G.jsxs)(G.Fragment,{children:[h===`zh`?`执行时间`:`Execution schedule`,` · `,$.length,tr===void 0?``:` · ${h===`zh`?`下次执行:`:`Next run: `}${Ze(tr,h)}`]}),children:(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(kt,{schedules:$,language:h,onEdit:rr,onUpdated:nr})})}):null,(0,G.jsx)(lt,{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,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsxs)(`section`,{className:`overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,G.jsxs)(`div`,{className:`border-b border-edge-subtle p-5`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:h===`zh`?`任务目标`:`Task goal`}),(0,G.jsx)(V,{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,G.jsxs)(z,{variant:`ghost`,className:`mt-2 min-h-9 px-2 text-xs`,onClick:_r,children:[_.successDefinition,` · `,Fn.length]})]}),or.length>0?(0,G.jsxs)(`div`,{className:`p-5`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.expectedOutputs}),(0,G.jsx)(`div`,{className:`mt-2`,children:(0,G.jsx)(en,{contentKey:`${e}:expectedOutputs`,items:or,empty:_.noDefinition})})]}):null,(0,G.jsxs)(`details`,{className:R(`p-5`,fr(`body`)&&`task-detail-live-update`),children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:_.taskDescription}),it?(0,G.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:at,onChange:e=>st(e.target.value),onBlur:()=>void xn(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Pt.current=!0,st(C.task.body??C.task.contract?.objective??``),H(!1),queueMicrotask(()=>{Pt.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,G.jsxs)(`div`,{className:`mt-2`,children:[Vn&&Vn!==C.task.title?(0,G.jsx)(V,{content:Vn,contentKey:`${e}:description`,language:h}):(0,G.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:_.noTaskDescription}),(0,G.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??``;Ft.current=e,Ut.current={value:C.task.body??``,version:C.task.version},q(null),st(e),H(!0)},children:h===`zh`?`编辑说明`:`Edit description`})]}),tn===`description`?(0,G.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,G.jsx)(`span`,{children:h===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,G.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{st(C.task.body??``),q(null),H(!1)},children:h===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,G.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void _n({body:at.trim()||null}).then(e=>{e&&(q(null),H(!1))}),children:h===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),dr?(0,G.jsxs)(`section`,{className:R(`p-5`,fr(`contract`)&&`task-detail-live-update`),children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskDefinition}),(0,G.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:h===`zh`?`执行边界及补充背景`:`Execution boundaries and supporting context`}),sr.length>0?(0,G.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.constraints}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(en,{contentKey:`${e}:constraints`,items:sr,empty:_.noDefinition})})]}):null,cr.length>0?(0,G.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.approvalRequired}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(en,{contentKey:`${e}:approvalRequired`,items:cr,empty:_.noDefinition})})]}):null,lr.length>0?(0,G.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextAssumptions}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(en,{contentKey:`${e}:assumptions`,items:lr,empty:_.noDefinition})})]}):null,ur.length>0?(0,G.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:_.contextRisks}),(0,G.jsx)(`div`,{className:`mt-3`,children:(0,G.jsx)(en,{contentKey:`${e}:risks`,items:ur,empty:_.noDefinition})})]}):null]}):null]})})}),(0,G.jsxs)(lt,{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,G.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-inset divide-y divide-edge-subtle`,children:[(0,G.jsxs)(`section`,{className:R(`p-5`,fr(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.taskProperties}),(0,G.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,G.jsx)(Gt,{value:C.task.phase,disabled:B.has(`phase`),canMove:pr,canApprove:Gn,canReopen:Kn,language:h,label:_.taskPhase,onChange:Sn}),(0,G.jsx)(Kt,{value:C.task.priority,disabled:B.has(`priority`),label:_.priority,labels:_.priorityLabels,onChange:Cn}),(0,G.jsx)(qt,{value:Vt(C.task.dueAt),disabled:B.has(`dueAt`),label:_.dueDate,onChange:wn}),(0,G.jsx)(Jt,{value:C.conversation.currentExecutorAgentId??``,disabled:B.has(`delegateAgentId`),label:_.executorLabel,unassignedLabel:_.unassigned,agents:Ye,language:h,onChange:kn})]})]}),(0,G.jsxs)(`details`,{className:R(`p-5`,fr(`dependencies`)&&`task-detail-live-update`),children:[(0,G.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[_.taskRelations,` · `,C.dependencies.length,` / `,C.dependents.length]}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependencies}),(0,G.jsx)(Yt,{candidates:Ge,selected:C.dependencies,disabled:B.has(`dependencies`),labels:fn,getTaskHref:hn,onChange:On})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:_.dependents}),C.dependents.length>0?(0,G.jsx)(`div`,{className:`space-y-1.5`,children:C.dependents.map(t=>(0,G.jsx)(V,{content:t.title,contentKey:`${e}:dependent:${t.id}`,language:h,previewHeight:72,className:`rounded-lg bg-surface-hover p-2.5`,children:(0,G.jsx)(c,{to:hn(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,G.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:_.noDependents})]})]})]})]}),C.task.phase===`closed`?null:(0,G.jsxs)(z,{variant:`ghost`,className:`my-3`,disabled:!j,onClick:ir,children:[(0,G.jsx)(D,{className:`size-4`}),$.length>0?h===`zh`?`管理执行时间`:`Manage schedule`:_.scheduleRecurringTask]}),(0,G.jsxs)(`details`,{className:`mb-4 rounded-xl bg-surface-inset p-5`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:h===`zh`?`关联内容`:`Related work`}),ar.length>0||C.runs.length>0||er.length>0||C.dependencies.length>0||C.dependents.length>0?(0,G.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[ar.length>0?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`对话 · ${ar.length}`:`Conversations · ${ar.length}`}),(0,G.jsx)(It,{contentKey:`${e}:sessions`,language:h,className:`mt-2`,children:ar.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(c,{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,er.length>0?(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:h===`zh`?`自动化 · ${er.length}`:`Automations · ${er.length}`}),(0,G.jsx)(It,{contentKey:`${e}:automations`,language:h,className:`mt-2`,children:er.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(c,{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,G.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,G.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:_.taskRelations}),(0,G.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,G.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:h===`zh`?`还没有关联内容`:`No related work yet`}),(0,G.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:(0,G.jsx)(ot,{resource:{kind:`task`,id:C.task.id,revision:String(C.task.version)},disabled:$e||it||B.size>0})})]}),$n.length>0?(0,G.jsxs)(`section`,{className:R(`p-5`,fr(`context`)&&`task-detail-live-update`),children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:_.contextUsed}),(0,G.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:$n.map(e=>(0,G.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,G.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[_.contextRoleLabels[e.role],` · `,_.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,G.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,G.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,G.jsx)(lt,{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,G.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[(0,G.jsx)(Lt,{taskId:e},e),(0,G.jsx)(Ot,{changes:C.phaseChanges,language:h})]})})]})]}),(0,G.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(W),tabIndex:0,onPointerDown:Dn,onKeyDown:En,onDoubleClick:()=>Tn(Zt),className:`hidden w-2 shrink-0 cursor-col-resize touch-none bg-surface-panel outline-none focus-visible:bg-accent-soft lg:block`}),(0,G.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,G.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-4 py-3`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-medium text-fg-muted`,children:h===`zh`?`执行对话`:`Execution chat`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[ar.length>1?(0,G.jsxs)(Re,{children:[(0,G.jsx)(ze,{asChild:!0,children:(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,children:h===`zh`?`${ar.length} 段对话`:`${ar.length} conversations`})}),(0,G.jsx)(Be,{children:(0,G.jsx)(He,{align:`end`,sideOffset:6,className:`z-[100] min-w-52 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:ar.map(t=>(0,G.jsx)(Ve,{asChild:!0,children:(0,G.jsx)(c,{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,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(z,{type:`button`,variant:`ghost`,className:R(`size-8 p-0`,Qn&&`bg-surface-hover text-fg`),"aria-label":h===`zh`?`项目文件`:`Project files`,"aria-pressed":Qn,onClick:()=>{je.getState().openFiles(Z),S(Z)},children:(0,G.jsx)(re,{className:`size-4`,"aria-hidden":!0})}),(0,G.jsx)(z,{asChild:!0,variant:`ghost`,className:`size-8 p-0`,children:(0,G.jsx)(c,{to:ae(e),"aria-label":h===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,G.jsx)(F,{className:`size-4`,"aria-hidden":!0})})})]}):null]})]}),Z?(0,G.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,G.jsx)(E,{embedded:!0,conversationId:Z,taskId:e})}):te?(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,G.jsxs)(`div`,{className:`max-w-xs`,children:[(0,G.jsx)(ce,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,G.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):A?(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,G.jsxs)(`div`,{className:`max-w-xs`,children:[(0,G.jsx)(ce,{className:`mx-auto size-8 text-danger`}),(0,G.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,G.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:A instanceof Error?A.message:String(A)})]})}):(0,G.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,G.jsxs)(`div`,{className:`max-w-xs`,children:[(0,G.jsx)(ce,{className:`mx-auto size-8 text-fg-subtle`}),(0,G.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:h===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,G.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.`})]})})]})]}),sn?(0,G.jsx)(jt,{automation:ln??void 0,taskId:e,taskTitle:C.task.title,projectId:C.task.projectId,executorAgentId:Q,language:h,onClose:()=>cn(!1),onCreated:nr},`${e}:${ln?.id??`new`}`):null,(0,G.jsx)(Le,{open:an,title:_.deleteTaskTitle,description:_.deleteTaskDescription.replace(`{{title}}`,C.task.title),confirmLabel:_.confirmDeleteTask,cancelLabel:_.keepTask,destructive:!0,onConfirm:()=>{on(!1),An()},onCancel:()=>on(!1)})]})}function nn(){let e=(0,W.c)(2),{taskId:t}=s(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,G.jsx)(q,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function rn(e){return e.id}export{nn as TaskDetailPage,q 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-DIIvxCDx.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-D7l_0kTV.js";import{D as m}from"./markdown-view-ihzUc4ud.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-Cehybf-G.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-DIIvxCDx.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-LOR5JxDh.js";import{D as m}from"./markdown-view-ihzUc4ud.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-Cehybf-G.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{_ as i,t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{t as o}from"./messages-C7QSnTdg.js";import{t as s}from"./external-link-DjqjBmc3.js";import{t as c}from"./file-text-D12HbeVy.js";import{t as l}from"./markdown-view-ihzUc4ud.js";import{t as u}from"./cn-0WouolD0.js";import{T as d,w as f,xt as p}from"./session-manager-CVNlrzFB.js";import{i as m,p as h}from"./home-task-actions-C8Fi6GBq.js";import{t as g}from"./button-C5tRaJxt.js";import{t as _}from"./activity-store-hSe5Nbgk.js";import{m as v,o as y}from"./shares-api-BhWvN3LS.js";import{n as b}from"./capability-presentation-DlJQUUlM.js";var x=n(),S=e(t(),1),C=r();function w(e){let t=(0,x.c)(38),{content:n,contentKey:r,language:a,markdown:o,breaks:s,previewHeight:c,className:d,children:f}=e,m=o===void 0||o,h=s!==void 0&&s,g=c===void 0?240:c,_;t[0]===n?_=t[1]:(_=p(n),t[0]=n,t[1]=_),n=_;let v=(0,S.useId)(),y=(0,S.useRef)(null),[b,w]=(0,S.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=y.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,S.useLayoutEffect)(k,A);let j=b&&!O,M;t[10]===d?M=t[11]:(M=u(`min-w-0`,d),t[10]=d,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]!==f||t[17]!==n||t[18]!==m?(P=f??(m?(0,C.jsx)(l,{content:n,compact:!0,breaks:h,className:`text-sm leading-6 text-fg`}):(0,C.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:n})),t[15]=h,t[16]=f,t[17]=n,t[18]=m,t[19]=P):P=t[19];let F;t[20]!==j||t[21]!==P?(F=(0,C.jsx)(`div`,{ref:y,inert:j,children:P}),t[20]=j,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==v||t[24]!==F||t[25]!==N?(I=(0,C.jsx)(`div`,{id:v,style:N,children:F}),t[23]=v,t[24]=F,t[25]=N,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==O||t[29]!==v||t[30]!==a||t[31]!==b||t[32]!==E?(L=b?(0,C.jsx)(`button`,{type:`button`,"aria-expanded":O,"aria-controls":v,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]=v,t[30]=a,t[31]=b,t[32]=E,t[33]=L):L=t[33];let R;return t[34]!==I||t[35]!==L||t[36]!==M?(R=(0,C.jsxs)(`div`,{className:M,children:[I,L]}),t[34]=I,t[35]=L,t[36]=M,t[37]=R):R=t[37],R}function T({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)(!1),f=(0,S.useRef)(null),p=e.kind===`approval`,m=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function v(a){if(!p&&!i.trim()||p&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);f.current?.signature!==c&&(f.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await h(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:p?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,f.current.key);d(!0),r(o),_({tone:`success`,title:p?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,C.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),v()},children:[p?(0,C.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,C.jsx)(`p`,{children:e.reason}),(0,C.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,C.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,C.jsx)(g,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void v(`approve`),children:n?`批准`:`Approve`}),(0,C.jsx)(g,{type:`button`,disabled:o||u,onClick:()=>void v(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,C.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)})]}),m.length>0&&(0,C.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,C.jsx)(g,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,C.jsx)(g,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,C.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}function E(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 D({uri:e,zh:t}){let[n,r]=(0,S.useState)(),[i,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)(``);async function p(){o(!0),u(``);try{let n=E(e,(await v()).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 m(){if(!(!n||i)){o(!0),u(``);try{let e=await y(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,C.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,C.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(g,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void p(),children:t?`检查链接状态`:`Check link`}),s&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,C.jsx)(g,{type:`button`,disabled:i,onClick:()=>void m(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,C.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,C.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),s&&(0,C.jsx)(a,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}var O=`/settings/capabilities/models`,k=new Set([`provider_setup_required`,`provider_auth_invalid`,`rate_limit`,`timeout`,`provider_connection_error`,`billing`,`model_quota_exhausted`,`platform_token_limit_exceeded`,`credit_budget_exhausted`,`xopc_quota_exhausted`,`xopc_platform_limit`,`xopc_credit_budget_exhausted`,`unknown`,`format`]),A=/^(?:No API key found for |OAuth refresh failed for |[a-z]*Error:|HTTP [45]\d{2}\b|[45]\d{2}(?::| (?:Unauthorized|Forbidden|Too Many Requests|Bad Request|Internal Server Error|Bad Gateway|Service Unavailable|Gateway Timeout)\b)|invalid_api_key\b|insufficient_quota\b)/i,j=/^(?:(?:fetch|connection) failed\b|Connection error[.!]?\s*$|(?:Request|Agent run) timed out\b|Assistant turn failed\b)/i;function M(e){let t=e.trim().replace(/^Error:\s+/,``);if(t.startsWith(`{`)){let e=d(t);if(e&&(k.has(e.code)||k.has(e.kind)||/(?:error|failed)$/.test(e.kind)))return e;let n=/^\{\s*"(?:kind|code)"\s*:\s*"([^"]+)"/.exec(t)?.[1];if(!e&&n&&k.has(n))return{code:n,kind:n,provider:void 0}}return A.test(e.trim())||j.test(t)||/\n[ \t]+at\s+(?:async\s+)?\S+/.test(t)?f(t):null}function N(e,t,n){let r=e?M(e):null,i=r?k.has(r.code)?r.code:r.kind:n,a=t===`zh`,s=o(t).chat,c=r?.provider,l=c&&/^[a-z0-9][a-z0-9._-]{0,79}$/i.test(c)&&!/^sk-/i.test(c)?b(c,c===`qwen-token-plan-cn`?`Alibaba Bailian Subscription (China)`:c,a):a?`当前任务使用的模型服务商`:`the model provider used by this task`,u={label:a?`打开模型设置`:`Open model settings`,href:O};switch(i){case`provider_setup_required`:return{title:s.providerSetupRequiredTitle,description:a?`本次任务缺少 ${l} 的连接凭证。请在模型设置中完成配置,再回到工作台重试。`:`Credentials for ${l} are missing. Set them up in model settings, then return to the workbench and retry.`,action:u};case`provider_auth_invalid`:return{title:a?`模型服务商认证失败`:`Model provider authentication failed`,description:a?`${l} 拒绝了当前凭证。请重新登录或更新 API 密钥,再重试。`:`${l} rejected the current credentials. Sign in again or update the API key, then retry.`,action:u};case`provider_connection_error`:return{title:s.agentRunErrorConnectionTitle,description:a?`本次执行中断。请稍后重试;如果已经执行过外部操作,先核对实际结果。`:`The run was interrupted. Try again later. If it already took an external action, check the outcome first.`};case`rate_limit`:return{title:s.agentRunErrorRateLimitTitle,description:s.agentRunErrorRateLimitBody};case`timeout`:return{title:s.agentRunErrorTimeoutTitle,description:s.agentRunErrorTimeoutBody};case`billing`:return{title:s.agentRunErrorBillingTitle,description:s.agentRunErrorBillingBody};case`xopc_quota_exhausted`:case`model_quota_exhausted`:return{title:s.xopcQuotaExhaustedTitle,description:s.xopcQuotaExhaustedBody,action:u};case`xopc_platform_limit`:case`platform_token_limit_exceeded`:return{title:s.xopcPlatformLimitTitle,description:s.xopcPlatformLimitBody,action:u};case`xopc_credit_budget_exhausted`:case`credit_budget_exhausted`:return{title:s.creditBudgetExhaustedTitle,description:s.creditBudgetExhaustedBody,action:{label:s.creditBudgetSettingsCta,href:`/settings/agent-defaults?panel=runtime`}};case`tool_outcome_unconfirmed`:case`execution_interrupted`:return{title:a?`需要确认上次操作结果`:`Confirm the outcome of the previous run`,description:a?`重试前请确认上次执行是否已产生外部变更。`:`Before retrying, check whether the previous run made any external changes.`};case`acceptance_incomplete`:return{title:a?`结果尚未达到验收要求`:`The result does not yet meet the requirements`,description:a?`请查看尚待完成的事项和已有依据,确认还需要补做什么。`:`Review the remaining work and available evidence to see what still needs attention.`};case`empty_agent_run`:return{title:a?`本次执行没有生成可查看的结果`:`This run did not produce a result to review`};case`dispatch_failed`:return{title:a?`任务未能开始执行`:`The task could not start`};default:return r?{title:a?`本次执行未完成`:`This run did not complete`}:void 0}}var P={"The required evidence-linked research result is missing.":[`缺少可核对的来源和结论,暂时无法核验结果。`,`There are no source-backed findings to verify yet.`],"The requested chat reply is missing.":[`还没有生成可在对话中查看的答复。`,`The reply for the conversation is still missing.`],"Requirements changed after review.":[`验收后任务要求有更新,需要按最新要求重新核验。`,`The requirements changed after review. The result needs to be checked against the latest requirements.`],"Review every current acceptance criterion;":[`还有验收条件尚未核验。`,`Some acceptance criteria have not been checked.`],"No evidence-linked verification result was submitted.":[`暂时缺少可核对的依据。`,`There is no evidence to check this criterion yet.`],"Criterion omitted by reviewer.":[`本次核验未覆盖此项。`,`This criterion was not checked.`],"Instruction omitted by reviewer.":[`本次核验未覆盖这项补充要求。`,`This additional requirement was not checked.`],"Review unavailable.":[`本次未能完成核验。`,`Verification could not be completed.`],"Directions added during execution still need verification.":[`执行期间补充的要求还有待核验。`,`Requirements added during the run still need verification.`],"Default criteria were not expanded into concrete acceptance items;":[`验收条件还不够具体,暂时无法逐项确认完成情况。`,`The criteria are too broad to confirm which requirements are met.`],"Evidence is insufficient.":[`现有依据不足。`,`The available evidence is insufficient.`]};function F(e,t){let n=/^(Published file missing|Publication changed after review):\s*(.+?)\. (?:Republish from the existing workspace output|Review the final version)\.$/.exec(e);if(n){let[,e,r]=n,i=/^Selected artifact\s+/.test(r)?void 0:r;return e===`Published file missing`?t===`zh`?i?`暂时无法打开交付文件「${i}」,需要重新发布。`:`有交付文件缺失,需要重新发布。`:i?`“${i}” is unavailable and needs to be published again.`:`A deliverable is missing and needs to be published again.`:t===`zh`?`交付文件「${r}」有更新,需要核验最新版本。`:`“${r}” changed after review. Check the latest version.`}let r=e.replace(/^(?:Criterion \d+|Instruction \d+|Claim [\w.-]+):\s*/,``),i=Object.entries(P).find(([e])=>r.startsWith(e));return i?i[1][t===`zh`?0:1]:t===`zh`&&r.endsWith(` Evidence is insufficient.`)?`${r.slice(0,-26).replace(/([。!?])\.$/,`$1`)} 现有依据不足。`:r.replace(/([。!?])\.(?=\s|$)/g,`$1`)}function I(e,t){return e?.trim()?N(e,t)?.title??F(e.trim(),t):``}function L(e,t,n){let r=t===`zh`,i=e.status===`failed`?e.failure?.code:void 0,a=N(e.summary,t),o=i===`tool_outcome_unconfirmed`||i===`execution_interrupted`?N(void 0,t,i):a??N(e.status===`failed`?n:void 0,t,i);return{issue:o,summary:a||i===`empty_agent_run`?``:F(e.summary.trim(),t),remainingWork:[...new Set(e.remainingWork.map(e=>I(e,t)).filter(Boolean))],nextAction:I(e.nextAction,t)||(o?.description?``:I(e.failure?.recoveryAction,t)),status:e.status===`cancelled`?r?`本次执行已取消。`:`This run was canceled.`:e.status===`failed`||e.completionVerdict===`not_achieved`?r?`本次执行未完成。`:`This run did not complete.`:e.completionVerdict===`achieved`?r?`执行报告已达成目标,请结合依据验收。`:`The run reports that it met the goal. Review the evidence before accepting.`:e.completionVerdict===`partial`?r?`已有阶段性结果,仍有事项需要确认或完成。`:`A partial result is available. Some work still needs review or completion.`:r?`本次执行已结束,请查看结果和依据。`:`The run ended. Review the result and supporting evidence.`}}function R(e){let t=(0,x.c)(18),{evidence:n,projectId:r,conversationId:i,language:a,onOpenFile:o,compact:l}=e,u=l!==void 0&&l,d=m(z);if(!n.length)return null;let f=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,p;if(t[0]!==u||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==o||t[5]!==r||t[6]!==d){let e;t[8]!==u||t[9]!==i||t[10]!==a||t[11]!==o||t[12]!==r||t[13]!==d?(e=(e,t)=>{let n=e.uri?.trim(),l=n&&/^https?:\/\//i.test(n),f=n&&!l&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),p=a===`zh`,m=e.kind===`source`&&e.provenance===`judge`&&e.title.startsWith(`Research claim: `),h=l?URL.parse(n)?.hostname:void 0,g=m?h?p?`查看来源 · ${h}`:`Open source · ${h}`:p?`结论依据`:`Evidence for this finding`:e.title||(p?`查看交付物`:`Open artifact`),_=I(e.summary,a);return(0,C.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[(0,C.jsx)(w,{content:g,contentKey:`${i??r}:evidence-title:${t}:${e.title}`,language:a,previewHeight:60,children:l?(0,C.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,C.jsx)(s,{className:`size-4 shrink-0`}),(0,C.jsx)(`span`,{className:`min-w-0 break-words`,children:g})]}):f&&(r||i)?(0,C.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:()=>o?o(n):d(n,null,r,i),children:[(0,C.jsx)(c,{className:`size-4 shrink-0`}),g]}):(0,C.jsx)(`p`,{className:`break-words [overflow-wrap:anywhere] text-sm font-medium text-fg`,children:g})}),l&&e.kind===`artifact`&&(0,C.jsx)(D,{uri:n,zh:a===`zh`},n),u&&!l&&!(f&&(r||i))?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a===`zh`?`位置待确认`:`Location needs confirmation`}):null,!u&&_?(0,C.jsx)(w,{content:_,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,C.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]=o,t[12]=r,t[13]=d,t[14]=e):e=t[14],p=n.map(e),t[0]=u,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=r,t[6]=d,t[7]=p}else p=t[7];let h;return t[15]!==f||t[16]!==p?(h=(0,C.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":f,children:p}),t[15]=f,t[16]=p,t[17]=h):h=t[17],h}function z(e){return e.setPath}function B(e){let t=(0,x.c)(10),{issue:n}=e,r;t[0]===n.title?r=t[1]:(r=(0,C.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=r);let i;t[2]===n.description?i=t[3]:(i=n.description?(0,C.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n.description}):null,t[2]=n.description,t[3]=i);let o;t[4]===n.action?o=t[5]:(o=n.action?(0,C.jsx)(g,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(a,{to:n.action.href,children:n.action.label})}):null,t[4]=n.action,t[5]=o);let s;return t[6]!==r||t[7]!==i||t[8]!==o?(s=(0,C.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge bg-surface-inset p-3`,children:[r,i,o]}),t[6]=r,t[7]=i,t[8]=o,t[9]=s):s=t[9],s}export{T as a,I as i,R as n,w as o,L as r,B 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{_ as i,t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{t as o}from"./messages-C7QSnTdg.js";import{t as s}from"./external-link-DjqjBmc3.js";import{t as c}from"./file-text-D12HbeVy.js";import{t as l}from"./markdown-view-ihzUc4ud.js";import{t as u}from"./cn-0WouolD0.js";import{T as d,w as f,xt as p}from"./session-manager-DUWeBdeG.js";import{i as m,p as h}from"./home-task-actions-C8Fi6GBq.js";import{t as g}from"./button-C5tRaJxt.js";import{t as _}from"./activity-store-hSe5Nbgk.js";import{m as v,o as y}from"./shares-api-BhWvN3LS.js";import{n as b}from"./capability-presentation-DlJQUUlM.js";var x=n(),S=e(t(),1),C=r();function w(e){let t=(0,x.c)(38),{content:n,contentKey:r,language:a,markdown:o,breaks:s,previewHeight:c,className:d,children:f}=e,m=o===void 0||o,h=s!==void 0&&s,g=c===void 0?240:c,_;t[0]===n?_=t[1]:(_=p(n),t[0]=n,t[1]=_),n=_;let v=(0,S.useId)(),y=(0,S.useRef)(null),[b,w]=(0,S.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=y.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,S.useLayoutEffect)(k,A);let j=b&&!O,M;t[10]===d?M=t[11]:(M=u(`min-w-0`,d),t[10]=d,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]!==f||t[17]!==n||t[18]!==m?(P=f??(m?(0,C.jsx)(l,{content:n,compact:!0,breaks:h,className:`text-sm leading-6 text-fg`}):(0,C.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:n})),t[15]=h,t[16]=f,t[17]=n,t[18]=m,t[19]=P):P=t[19];let F;t[20]!==j||t[21]!==P?(F=(0,C.jsx)(`div`,{ref:y,inert:j,children:P}),t[20]=j,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==v||t[24]!==F||t[25]!==N?(I=(0,C.jsx)(`div`,{id:v,style:N,children:F}),t[23]=v,t[24]=F,t[25]=N,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==O||t[29]!==v||t[30]!==a||t[31]!==b||t[32]!==E?(L=b?(0,C.jsx)(`button`,{type:`button`,"aria-expanded":O,"aria-controls":v,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]=v,t[30]=a,t[31]=b,t[32]=E,t[33]=L):L=t[33];let R;return t[34]!==I||t[35]!==L||t[36]!==M?(R=(0,C.jsxs)(`div`,{className:M,children:[I,L]}),t[34]=I,t[35]=L,t[36]=M,t[37]=R):R=t[37],R}function T({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(!1),[c,l]=(0,S.useState)(``),[u,d]=(0,S.useState)(!1),f=(0,S.useRef)(null),p=e.kind===`approval`,m=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function v(a){if(!p&&!i.trim()||p&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);f.current?.signature!==c&&(f.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await h(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:p?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,f.current.key);d(!0),r(o),_({tone:`success`,title:p?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,C.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),v()},children:[p?(0,C.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,C.jsx)(`p`,{children:e.reason}),(0,C.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,C.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,C.jsx)(g,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void v(`approve`),children:n?`批准`:`Approve`}),(0,C.jsx)(g,{type:`button`,disabled:o||u,onClick:()=>void v(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,C.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)})]}),m.length>0&&(0,C.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,C.jsx)(g,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,C.jsx)(g,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,C.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}function E(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 D({uri:e,zh:t}){let[n,r]=(0,S.useState)(),[i,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(``),[d,f]=(0,S.useState)(``);async function p(){o(!0),u(``);try{let n=E(e,(await v()).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 m(){if(!(!n||i)){o(!0),u(``);try{let e=await y(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,C.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,C.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsx)(g,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void p(),children:t?`检查链接状态`:`Check link`}),s&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,C.jsx)(g,{type:`button`,disabled:i,onClick:()=>void m(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,C.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,C.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),s&&(0,C.jsx)(a,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}var O=`/settings/capabilities/models`,k=new Set([`provider_setup_required`,`provider_auth_invalid`,`rate_limit`,`timeout`,`provider_connection_error`,`billing`,`model_quota_exhausted`,`platform_token_limit_exceeded`,`credit_budget_exhausted`,`xopc_quota_exhausted`,`xopc_platform_limit`,`xopc_credit_budget_exhausted`,`unknown`,`format`]),A=/^(?:No API key found for |OAuth refresh failed for |[a-z]*Error:|HTTP [45]\d{2}\b|[45]\d{2}(?::| (?:Unauthorized|Forbidden|Too Many Requests|Bad Request|Internal Server Error|Bad Gateway|Service Unavailable|Gateway Timeout)\b)|invalid_api_key\b|insufficient_quota\b)/i,j=/^(?:(?:fetch|connection) failed\b|Connection error[.!]?\s*$|(?:Request|Agent run) timed out\b|Assistant turn failed\b)/i;function M(e){let t=e.trim().replace(/^Error:\s+/,``);if(t.startsWith(`{`)){let e=d(t);if(e&&(k.has(e.code)||k.has(e.kind)||/(?:error|failed)$/.test(e.kind)))return e;let n=/^\{\s*"(?:kind|code)"\s*:\s*"([^"]+)"/.exec(t)?.[1];if(!e&&n&&k.has(n))return{code:n,kind:n,provider:void 0}}return A.test(e.trim())||j.test(t)||/\n[ \t]+at\s+(?:async\s+)?\S+/.test(t)?f(t):null}function N(e,t,n){let r=e?M(e):null,i=r?k.has(r.code)?r.code:r.kind:n,a=t===`zh`,s=o(t).chat,c=r?.provider,l=c&&/^[a-z0-9][a-z0-9._-]{0,79}$/i.test(c)&&!/^sk-/i.test(c)?b(c,c===`qwen-token-plan-cn`?`Alibaba Bailian Subscription (China)`:c,a):a?`当前任务使用的模型服务商`:`the model provider used by this task`,u={label:a?`打开模型设置`:`Open model settings`,href:O};switch(i){case`provider_setup_required`:return{title:s.providerSetupRequiredTitle,description:a?`本次任务缺少 ${l} 的连接凭证。请在模型设置中完成配置,再回到工作台重试。`:`Credentials for ${l} are missing. Set them up in model settings, then return to the workbench and retry.`,action:u};case`provider_auth_invalid`:return{title:a?`模型服务商认证失败`:`Model provider authentication failed`,description:a?`${l} 拒绝了当前凭证。请重新登录或更新 API 密钥,再重试。`:`${l} rejected the current credentials. Sign in again or update the API key, then retry.`,action:u};case`provider_connection_error`:return{title:s.agentRunErrorConnectionTitle,description:a?`本次执行中断。请稍后重试;如果已经执行过外部操作,先核对实际结果。`:`The run was interrupted. Try again later. If it already took an external action, check the outcome first.`};case`rate_limit`:return{title:s.agentRunErrorRateLimitTitle,description:s.agentRunErrorRateLimitBody};case`timeout`:return{title:s.agentRunErrorTimeoutTitle,description:s.agentRunErrorTimeoutBody};case`billing`:return{title:s.agentRunErrorBillingTitle,description:s.agentRunErrorBillingBody};case`xopc_quota_exhausted`:case`model_quota_exhausted`:return{title:s.xopcQuotaExhaustedTitle,description:s.xopcQuotaExhaustedBody,action:u};case`xopc_platform_limit`:case`platform_token_limit_exceeded`:return{title:s.xopcPlatformLimitTitle,description:s.xopcPlatformLimitBody,action:u};case`xopc_credit_budget_exhausted`:case`credit_budget_exhausted`:return{title:s.creditBudgetExhaustedTitle,description:s.creditBudgetExhaustedBody,action:{label:s.creditBudgetSettingsCta,href:`/settings/agent-defaults?panel=runtime`}};case`tool_outcome_unconfirmed`:case`execution_interrupted`:return{title:a?`需要确认上次操作结果`:`Confirm the outcome of the previous run`,description:a?`重试前请确认上次执行是否已产生外部变更。`:`Before retrying, check whether the previous run made any external changes.`};case`acceptance_incomplete`:return{title:a?`结果尚未达到验收要求`:`The result does not yet meet the requirements`,description:a?`请查看尚待完成的事项和已有依据,确认还需要补做什么。`:`Review the remaining work and available evidence to see what still needs attention.`};case`empty_agent_run`:return{title:a?`本次执行没有生成可查看的结果`:`This run did not produce a result to review`};case`dispatch_failed`:return{title:a?`任务未能开始执行`:`The task could not start`};default:return r?{title:a?`本次执行未完成`:`This run did not complete`}:void 0}}var P={"The required evidence-linked research result is missing.":[`缺少可核对的来源和结论,暂时无法核验结果。`,`There are no source-backed findings to verify yet.`],"The requested chat reply is missing.":[`还没有生成可在对话中查看的答复。`,`The reply for the conversation is still missing.`],"Requirements changed after review.":[`验收后任务要求有更新,需要按最新要求重新核验。`,`The requirements changed after review. The result needs to be checked against the latest requirements.`],"Review every current acceptance criterion;":[`还有验收条件尚未核验。`,`Some acceptance criteria have not been checked.`],"No evidence-linked verification result was submitted.":[`暂时缺少可核对的依据。`,`There is no evidence to check this criterion yet.`],"Criterion omitted by reviewer.":[`本次核验未覆盖此项。`,`This criterion was not checked.`],"Instruction omitted by reviewer.":[`本次核验未覆盖这项补充要求。`,`This additional requirement was not checked.`],"Review unavailable.":[`本次未能完成核验。`,`Verification could not be completed.`],"Directions added during execution still need verification.":[`执行期间补充的要求还有待核验。`,`Requirements added during the run still need verification.`],"Default criteria were not expanded into concrete acceptance items;":[`验收条件还不够具体,暂时无法逐项确认完成情况。`,`The criteria are too broad to confirm which requirements are met.`],"Evidence is insufficient.":[`现有依据不足。`,`The available evidence is insufficient.`]};function F(e,t){let n=/^(Published file missing|Publication changed after review):\s*(.+?)\. (?:Republish from the existing workspace output|Review the final version)\.$/.exec(e);if(n){let[,e,r]=n,i=/^Selected artifact\s+/.test(r)?void 0:r;return e===`Published file missing`?t===`zh`?i?`暂时无法打开交付文件「${i}」,需要重新发布。`:`有交付文件缺失,需要重新发布。`:i?`“${i}” is unavailable and needs to be published again.`:`A deliverable is missing and needs to be published again.`:t===`zh`?`交付文件「${r}」有更新,需要核验最新版本。`:`“${r}” changed after review. Check the latest version.`}let r=e.replace(/^(?:Criterion \d+|Instruction \d+|Claim [\w.-]+):\s*/,``),i=Object.entries(P).find(([e])=>r.startsWith(e));return i?i[1][t===`zh`?0:1]:t===`zh`&&r.endsWith(` Evidence is insufficient.`)?`${r.slice(0,-26).replace(/([。!?])\.$/,`$1`)} 现有依据不足。`:r.replace(/([。!?])\.(?=\s|$)/g,`$1`)}function I(e,t){return e?.trim()?N(e,t)?.title??F(e.trim(),t):``}function L(e,t,n){let r=t===`zh`,i=e.status===`failed`?e.failure?.code:void 0,a=N(e.summary,t),o=i===`tool_outcome_unconfirmed`||i===`execution_interrupted`?N(void 0,t,i):a??N(e.status===`failed`?n:void 0,t,i);return{issue:o,summary:a||i===`empty_agent_run`?``:F(e.summary.trim(),t),remainingWork:[...new Set(e.remainingWork.map(e=>I(e,t)).filter(Boolean))],nextAction:I(e.nextAction,t)||(o?.description?``:I(e.failure?.recoveryAction,t)),status:e.status===`cancelled`?r?`本次执行已取消。`:`This run was canceled.`:e.status===`failed`||e.completionVerdict===`not_achieved`?r?`本次执行未完成。`:`This run did not complete.`:e.completionVerdict===`achieved`?r?`执行报告已达成目标,请结合依据验收。`:`The run reports that it met the goal. Review the evidence before accepting.`:e.completionVerdict===`partial`?r?`已有阶段性结果,仍有事项需要确认或完成。`:`A partial result is available. Some work still needs review or completion.`:r?`本次执行已结束,请查看结果和依据。`:`The run ended. Review the result and supporting evidence.`}}function R(e){let t=(0,x.c)(18),{evidence:n,projectId:r,conversationId:i,language:a,onOpenFile:o,compact:l}=e,u=l!==void 0&&l,d=m(z);if(!n.length)return null;let f=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,p;if(t[0]!==u||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==o||t[5]!==r||t[6]!==d){let e;t[8]!==u||t[9]!==i||t[10]!==a||t[11]!==o||t[12]!==r||t[13]!==d?(e=(e,t)=>{let n=e.uri?.trim(),l=n&&/^https?:\/\//i.test(n),f=n&&!l&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),p=a===`zh`,m=e.kind===`source`&&e.provenance===`judge`&&e.title.startsWith(`Research claim: `),h=l?URL.parse(n)?.hostname:void 0,g=m?h?p?`查看来源 · ${h}`:`Open source · ${h}`:p?`结论依据`:`Evidence for this finding`:e.title||(p?`查看交付物`:`Open artifact`),_=I(e.summary,a);return(0,C.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[(0,C.jsx)(w,{content:g,contentKey:`${i??r}:evidence-title:${t}:${e.title}`,language:a,previewHeight:60,children:l?(0,C.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,C.jsx)(s,{className:`size-4 shrink-0`}),(0,C.jsx)(`span`,{className:`min-w-0 break-words`,children:g})]}):f&&(r||i)?(0,C.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:()=>o?o(n):d(n,null,r,i),children:[(0,C.jsx)(c,{className:`size-4 shrink-0`}),g]}):(0,C.jsx)(`p`,{className:`break-words [overflow-wrap:anywhere] text-sm font-medium text-fg`,children:g})}),l&&e.kind===`artifact`&&(0,C.jsx)(D,{uri:n,zh:a===`zh`},n),u&&!l&&!(f&&(r||i))?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a===`zh`?`位置待确认`:`Location needs confirmation`}):null,!u&&_?(0,C.jsx)(w,{content:_,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,C.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]=o,t[12]=r,t[13]=d,t[14]=e):e=t[14],p=n.map(e),t[0]=u,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=r,t[6]=d,t[7]=p}else p=t[7];let h;return t[15]!==f||t[16]!==p?(h=(0,C.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":f,children:p}),t[15]=f,t[16]=p,t[17]=h):h=t[17],h}function z(e){return e.setPath}function B(e){let t=(0,x.c)(10),{issue:n}=e,r;t[0]===n.title?r=t[1]:(r=(0,C.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=r);let i;t[2]===n.description?i=t[3]:(i=n.description?(0,C.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n.description}):null,t[2]=n.description,t[3]=i);let o;t[4]===n.action?o=t[5]:(o=n.action?(0,C.jsx)(g,{asChild:!0,variant:`secondary`,children:(0,C.jsx)(a,{to:n.action.href,children:n.action.label})}):null,t[4]=n.action,t[5]=o);let s;return t[6]!==r||t[7]!==i||t[8]!==o?(s=(0,C.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge bg-surface-inset p-3`,children:[r,i,o]}),t[6]=r,t[7]=i,t[8]=o,t[9]=s):s=t[9],s}export{T as a,I as i,R as n,w as o,L as r,B as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-load-C9iZLUHv.js","assets/rolldown-runtime-aKtaBQYM.js","assets/attachment-utils-core-BPYdUI6y.js"])))=>i.map(i=>d[i]);
2
+ 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"./preload-helper-Czpn1I53.js";import{n as a}from"./locale-store-CHjsq5NR.js";import{t as o}from"./messages-C7QSnTdg.js";import{o as s,r as c,s as l,t as u}from"./dist-DlirbHVs.js";import{t as d}from"./chevron-left-DqFhpbvK.js";import{t as f}from"./chevron-right-BweFrslA.js";import{t as p}from"./file-code-corner-byQA1VfD.js";import{t as m}from"./file-CStvVK2S.js";import{n as h,r as g,s as _,t as v}from"./use-file-preview-expanded-BFF2vXm5.js";import{t as y}from"./mic-CuUb7zc-.js";import{u as b}from"./preview-runtime-C1U57WSM.js";import{n as x}from"./share-link-dialog-2JjvWs0q.js";import{t as S}from"./cn-0WouolD0.js";import{r as C}from"./turn-outcome-BSbEJx8h.js";import{i as w}from"./attachment-utils-core-BPYdUI6y.js";import{t as T}from"./constants-D5Z-mUto.js";import{r as E}from"./right-workspace-store-Cehybf-G.js";import{n as D}from"./interaction-BdhHBbYa.js";import{t as O}from"./composer-notifications-MGKffwC7.js";import{n as k}from"./electron-env-DHOGevH3.js";import{t as A}from"./use-share-link-WKZLlEqr.js";import{n as j,t as M}from"./file-preview-surface-Da1xZiG6.js";var N=n(),P=e(t(),1),F=r();function I(e){let t=(0,N.c)(6),n=_(),r,i;if(t[0]!==n||t[1]!==e?(r=()=>{!n||e.embedded||!e.open||!e.attachment||(E.getState().openFile({attachment:e.attachment,images:e.images,conversationId:e.conversationId||void 0,resultRevision:e.resultRevision},n),e.onClose())},i=[n,e],t[0]=n,t[1]=e,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,P.useEffect)(r,i),n&&!e.embedded)return null;let a;return t[4]===e?a=t[5]:(a=(0,F.jsx)(L,{...e}),t[4]=e,t[5]=a),a}function L({open:e,embedded:t=!1,showEmbeddedClose:n=!1,tabId:r,attachment:i,images:p=[],resultRevision:m,onAttachmentChange:g,authToken:_,conversationId:y,layerClassName:w=`z-[115]`,onClose:T}){let E=a(e=>e.language),N=o(E).chat,I=b({open:e,attachment:i,authToken:_,conversationId:y,language:E}),L=A(),{expanded:R,setExpanded:z}=v(e,L.dialogOpen),[B,V]=(0,P.useState)(!1),{preview:H,fileType:U,hasExtractedText:W}=I,G=i?p.findIndex(e=>e===i||e.id&&e.id===i.id||e.uri&&e.uri===i.uri||!e.id&&!e.uri&&e.name===i.name&&!!e.data&&e.data===i.data):-1,K=U===`image`&&p.length>1&&G>=0&&!!g,q=e=>{if(!K||L.dialogOpen)return;let t=G+(e===`previous`?-1:1);t>=0&&t<p.length&&g?.(p[t])},J=U!==`image`&&U!==`text`&&U!==`pptx`&&W,Y=H?.uri?C(H.uri):null,X=!!(Y||H?.uri?.startsWith(`media://`)&&(y||H.taskId)),ee=()=>{!H?.uri||!X||L.createShareLink(Y?{fileId:Y,fileName:H.name}:{uri:H.uri,conversationId:y??void 0,taskId:H.taskId,fileName:H.name})},te=!!(H&&!I.loading&&!I.loadError),Z=()=>{z(!1),T()},ne=()=>{if(!H||!I.downloadBuffer)return;let e=new Blob([I.downloadBuffer],{type:I.descriptor.mimeType}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=H.name??`download`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},re=!!I.downloadBuffer,ie=k()&&U===`spreadsheet`&&/\.xlsx?$/i.test(I.fileName)&&!!I.downloadBuffer&&!!window.electronAPI?.shell?.openTemporaryFile,ae=async()=>{let e=I.downloadBuffer,t=window.electronAPI?.shell?.openTemporaryFile;if(!(!e||!t||B)){V(!0);try{(await t({fileName:I.fileName,data:new Uint8Array(e)})).ok||O(`warning`,N.attachmentPreviewOpenLocalFailed)}catch{O(`warning`,N.attachmentPreviewOpenLocalFailed)}finally{V(!1)}}},oe={onDownload:ne,canDownload:re},Q=S(`min-h-0 min-w-0 flex-1 cursor-pointer border-0 p-0`,`bg-surface-base transition-colors`,`hover:bg-surface-hover/90 dark:bg-black/60 dark:hover:bg-black/70`,D.focusRingBase),$=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(h,{header:{expanded:R,onToggleExpanded:te?()=>z(e=>!e):void 0,hideClose:t&&!n,hideExpand:!!r,onClose:Z,share:X?{onClick:ee,loading:L.loading}:void 0,openWithSystemApp:ie?{onClick:()=>void ae(),loading:B}:void 0,textView:J?{active:I.showExtractedText,onChange:e=>{I.setShowExtractedText(e),I.clearLoadError()}}:void 0},chat:I.downloadBuffer?{conversationId:y,createFile:async()=>new File([I.downloadBuffer],I.fileName,{type:I.descriptor.mimeType})}:void 0,onImageSwipe:K?q:void 0,language:E,descriptor:r?{...I.descriptor,id:r}:I.descriptor,loading:I.loading,loadError:I.loadError,textContent:I.textContent,binaryBuffer:I.binaryBuffer,showExtractedText:I.showExtractedText,extractedText:I.extractedText,extractedTextTruncated:I.extractedTextTruncated,actions:oe}),m?(0,F.jsxs)(`p`,{className:`shrink-0 border-t border-edge px-4 py-2 text-xs text-fg-muted`,"data-result-revision":!0,children:[E===`zh`?`成果版本`:`Result version`,` `,m]}):null,K?(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center gap-4 border-t border-edge bg-surface-panel px-3 py-2`,children:[(0,F.jsx)(`button`,{type:`button`,"aria-label":N.attachmentPreviewPreviousImage,disabled:G===0,onClick:()=>q(`previous`),className:S(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,D.focusRingBase),children:(0,F.jsx)(d,{size:20,"aria-hidden":`true`})}),(0,F.jsxs)(`span`,{role:`status`,className:`min-w-16 text-center text-sm tabular-nums text-fg-muted`,children:[G+1,` / `,p.length]}),(0,F.jsx)(`button`,{type:`button`,"aria-label":N.attachmentPreviewNextImage,disabled:G===p.length-1,onClick:()=>q(`next`),className:S(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,D.focusRingBase),children:(0,F.jsx)(f,{size:20,"aria-hidden":`true`})})]}):null]});return t?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(M,{expanded:R,children:$}),(0,F.jsx)(x,{open:L.dialogOpen,onOpenChange:L.handleOpenChange,loading:L.loading,error:L.error,result:L.result,pendingParams:L.pendingParams,onConfirm:e=>void L.confirmShareLink(e)})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u,{open:e,onOpenChange:e=>!e&&Z(),children:(0,F.jsx)(s,{children:(0,F.jsxs)(c,{"aria-describedby":void 0,onKeyDown:e=>{!K||L.dialogOpen||e.altKey||e.ctrlKey||e.metaKey||e.target.closest(`input, textarea, select, [contenteditable="true"]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),q(e.key===`ArrowLeft`?`previous`:`next`))},className:S(`xopc-dialog-content-fullscreen fixed inset-0 flex h-[100dvh] w-full flex-row overflow-hidden`,j(),w,`border-0 bg-transparent p-0 shadow-none outline-none`),children:[(0,F.jsx)(l,{className:`sr-only`,children:H?.name??``}),(0,F.jsx)(`button`,{type:`button`,className:Q,onClick:Z,"aria-label":N.attachmentPreviewClose}),(0,F.jsx)(`div`,{className:S(`flex h-full min-h-0 shrink-0 flex-col overflow-hidden`,R?`w-full`:`w-[min(100%,var(--max-width-app-main))]`,`bg-surface-panel sm:border-x sm:border-edge dark:sm:border-edge`,`shadow-float dark:shadow-elevated`),children:$}),(0,F.jsx)(`button`,{type:`button`,className:Q,onClick:Z,"aria-label":N.attachmentPreviewClose})]})})}),(0,F.jsx)(x,{open:L.dialogOpen,onOpenChange:L.handleOpenChange,loading:L.loading,error:L.error,result:L.result,pendingParams:L.pendingParams,onConfirm:e=>void L.confirmShareLink(e)})]})}function R(e){let t=(0,N.c)(23),{attachments:n,conversationId:r,topPadded:i,onRemove:s,className:c}=e,l=a(z),u;t[0]===l?u=t[1]:(u=o(l),t[0]=l,t[1]=u);let d=u.chat,[f,h]=(0,P.useState)(null);if(n.length===0)return null;let g=i?`pt-2`:`pt-3`,_;t[2]!==c||t[3]!==g?(_=S(`flex flex-wrap gap-2 border-b border-edge-subtle/90 bg-surface-hover/20 px-4 pb-2 dark:border-edge-subtle`,g,c),t[2]=c,t[3]=g,t[4]=_):_=t[4];let v;if(t[5]!==n||t[6]!==d||t[7]!==s){let e;t[9]!==d||t[10]!==s?(e=(e,t)=>{let n=e.type===`pasted_text`?d.pastedText:e.name;return(0,F.jsxs)(`div`,{className:`flex max-w-[200px] items-center rounded-lg bg-surface-hover text-xs dark:bg-surface-hover/80`,children:[(0,F.jsxs)(`button`,{type:`button`,className:S(`flex min-w-0 flex-1 items-center gap-1.5 rounded-l-lg py-1 pl-2 pr-1 text-left hover:bg-surface-active`,D.transition,D.press,D.focusRingPanel),onClick:()=>h(e),"aria-label":`${d.attachmentPreviewOpen}: ${n}`,title:`${d.attachmentPreviewOpen}: ${n}`,children:[e.mimeType?.startsWith(`image/`)&&e.content?(0,F.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:``,className:`size-6 shrink-0 rounded object-cover`}):e.type===`voice`||e.mimeType?.startsWith(`audio/`)?(0,F.jsx)(y,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):e.type===`pasted_text`?(0,F.jsx)(p,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):(0,F.jsx)(m,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,F.jsx)(`span`,{className:`shrink-0 text-fg-disabled`,children:w(e.size)})]}),(0,F.jsx)(`button`,{type:`button`,className:S(`flex min-h-8 min-w-8 items-center justify-center rounded-r-lg text-fg-muted hover:bg-surface-active hover:text-fg`,D.transition,D.press,D.focusRingPanel),onClick:()=>s(t),"aria-label":`${d.attachmentPreviewRemove}: ${n}`,title:`${d.attachmentPreviewRemove}: ${n}`,children:(0,F.jsx)(`span`,{"aria-hidden":!0,children:`×`})})]},e.id??`${e.name}-${e.size}-${e.mimeType}-${e.content?.slice(0,16)??``}`)},t[9]=d,t[10]=s,t[11]=e):e=t[11],v=n.map(e),t[5]=n,t[6]=d,t[7]=s,t[8]=v}else v=t[8];let b;t[12]!==_||t[13]!==v?(b=(0,F.jsx)(`div`,{className:_,children:v}),t[12]=_,t[13]=v,t[14]=b):b=t[14];let x=f!==null,C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>h(null),t[15]=C):C=t[15];let T;t[16]!==r||t[17]!==f||t[18]!==x?(T=(0,F.jsx)(I,{open:x,attachment:f,conversationId:r,onClose:C}),t[16]=r,t[17]=f,t[18]=x,t[19]=T):T=t[19];let E;return t[20]!==b||t[21]!==T?(E=(0,F.jsxs)(F.Fragment,{children:[b,T]}),t[20]=b,t[21]=T,t[22]=E):E=t[22],E}function z(e){return e.language}function B(e){let{chat:t,initialAttachments:n=[],onAttachmentsChange:r}=e,[a,o]=(0,P.useState)(n),[s,c]=(0,P.useState)(!1),l=(0,P.useRef)(null),u=(0,P.useRef)(a),d=(0,P.useRef)(r);u.current=a,d.current=r;let f=(0,P.useCallback)(e=>{let t=typeof e==`function`?e(u.current):e;u.current=t,o(t),d.current?.(t)},[]),p=(0,P.useCallback)(()=>{f([])},[]),m=(0,P.useCallback)(e=>{f(t=>t.filter((t,n)=>n!==e))},[]),h=(0,P.useCallback)(()=>u.current.map(e=>({type:e.type===`voice`?`voice`:e.type||`file`,mimeType:e.mimeType,data:e.content,name:e.name,size:e.size,...e.uri?{uri:e.uri}:{},...typeof e.durationSeconds==`number`&&Number.isFinite(e.durationSeconds)&&e.durationSeconds>0?{durationSeconds:e.durationSeconds}:{}})),[]),_=(0,P.useCallback)(async(e,n)=>{if(e.length===0)return;let r=10-u.current.length;if(r<=0){O(`warning`,t.maxAttachmentsReached,{max:10});return}let a=e.slice(0,r);e.length>a.length&&O(`warning`,t.maxAttachmentsTruncated,{max:10,dropped:e.length-a.length});let{loadAttachment:o}=await i(async()=>{let{loadAttachment:e}=await import(`./attachment-load-C9iZLUHv.js`).then(e=>e.t);return{loadAttachment:e}},__vite__mapDeps([0,1,2])),s=(await Promise.all(a.map(async e=>{if(e.size>33554432)return O(`warning`,t.attachmentFileTooLarge,{name:e.name,maxSize:w(T)}),null;try{return await o(e,e.name)}catch{return O(`error`,t.attachmentLoadFailed,{name:e.name}),null}}))).filter(e=>e!==null).map(e=>n?{...e,type:n}:e);f(e=>[...e,...s])},[t.attachmentFileTooLarge,t.attachmentLoadFailed,t.maxAttachmentsReached,t.maxAttachmentsTruncated]),v=(0,P.useCallback)(e=>_(e),[_]);return(0,P.useEffect)(()=>{if(e.conversationId)return g(e.conversationId,async e=>{let t=u.current.length;return await _([e]),u.current.length>t})},[_,e.conversationId]),{attachments:a,setAttachments:f,attachmentsRef:u,isDragging:s,setIsDragging:c,fileInputRef:l,processFiles:v,processPastedText:(0,P.useCallback)(e=>_([new File([e.text],e.name,{type:e.mimeType})],`pasted_text`),[_]),removeAttachment:m,clearAttachments:p,wireAttachmentsPayload:h}}export{R as n,I as r,B 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{f as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as a}from"./locale-store-CHjsq5NR.js";import{t as o}from"./messages-C7QSnTdg.js";import{t as s}from"./createLucideIcon-DPHK1VkS.js";import{t as c}from"./app-window-DXFNqt_0.js";import{t as l}from"./check-DUBLcKHA.js";import{t as u}from"./chevron-down-ccbiQQz_.js";import{t as d}from"./copy-Dv6d4Dvw.js";import{t as f}from"./download-Dk-ZjtO6.js";import{t as p}from"./ellipsis-0k4rZLoy.js";import{t as ee}from"./external-link-DjqjBmc3.js";import{t as te}from"./eye-CABVeTq0.js";import{t as ne}from"./folder-open-CyzJ19I9.js";import{t as re}from"./link-2-D_ZKYUW7.js";import{t as ie}from"./loader-circle-CifKLtgG.js";import{K as ae}from"./markdown-view-ihzUc4ud.js";import{t as oe}from"./message-square-plus-XP0tGdlV.js";import{t as m}from"./minimize-2-DtOGrlpo.js";import{t as h}from"./paperclip-f1HujQY1.js";import{t as g}from"./pencil-DmIY3Oa-.js";import{t as se}from"./refresh-cw-BRlGaq2w.js";import{t as ce}from"./save-DRDABU--.js";import{c as _,i as le,n as ue,r as de,s as fe,t as pe}from"./preview-runtime-pNF_b2oD.js";import{t as me}from"./x-B_N4OPjy.js";import{t as v}from"./cn-0WouolD0.js";import{a as y}from"./session-api-CR3NLqvs.js";import{i as b}from"./attachment-utils-core-BPYdUI6y.js";import{t as x}from"./constants-D5Z-mUto.js";import{n as he}from"./interaction-BdhHBbYa.js";import{t as S}from"./composer-notifications-MGKffwC7.js";import{r as ge}from"./app-chrome-BeB4KgOf.js";import{n as _e}from"./electron-env-DHOGevH3.js";import{t as ve}from"./sliding-tab-list-CmcrqRzN.js";import{a as ye,l as be,m as C,n as w,o as xe,r as T,t as E,u as D}from"./dist-DaFr5KMw.js";var Se=s(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),Ce=s(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),O=e(t(),1),k=(0,O.createContext)(null);function A(){return(0,O.useContext)(k)}var j=(0,O.createContext)([]),we=(0,O.createContext)(null),M=new Map;function Te(e,t){return M.set(e,t),()=>{M.get(e)===t&&M.delete(e)}}async function N(e,t){return await M.get(e)?.(t)??!1}var P=n(),F=r();function I(e){let t=(0,P.c)(3),{app:n}=e,[r,i]=(0,O.useState)(),a;return t[0]!==n||t[1]!==r?(a=n?.iconDataUrl&&n.iconDataUrl!==r?(0,F.jsx)(`img`,{src:n.iconDataUrl,alt:``,width:20,height:20,className:`size-5 shrink-0 object-contain`,onError:()=>i(n.iconDataUrl)}):(0,F.jsx)(c,{className:`size-5 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=n,t[1]=r,t[2]=a):a=t[2],a}function Ee({variant:e=`split`,onAction:t,systemApp:n,chooseApp:r,recommendedApps:i,recentApps:s,onOpenWithApp:d}){let f=a(e=>e.language),p=o(f).workspace,[te,ne]=(0,O.useState)(),[re,ae]=(0,O.useState)(!1),oe=[...i,...s],m=d&&te!==null?oe.find(e=>e.path===te?.path)??te??oe[0]:void 0,h=!!(re||n?.loading||r?.loading),g=h||!!n?.disabled,se=m?f===`zh`?`用 ${m.name} 打开`:`Open with ${m.name}`:p.openSystemApp,ce=`flex min-h-9 cursor-default items-center gap-2.5 rounded-md px-2.5 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-40`,_=`my-1 h-px bg-edge-subtle`;if(!n&&!r&&(!d||!oe.length))return null;if(e===`menu`){let e=e=>t?t(e):e(),a=`flex min-h-9 w-full items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-40`;return(0,F.jsxs)(F.Fragment,{children:[n?(0,F.jsxs)(`button`,{type:`button`,role:`menuitem`,className:a,disabled:g,onClick:()=>e(n.onClick),children:[(0,F.jsx)(ee,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:p.openSystemApp})]}):null,d?[{label:p.recommendedApps,apps:i},{label:p.recentApps,apps:s.filter(e=>!i.some(t=>t.path===e.path))}].map(t=>t.apps.length?(0,F.jsxs)(`div`,{role:`group`,"aria-label":t.label,children:[(0,F.jsx)(`div`,{className:`px-2.5 pb-1 pt-1.5 text-xs font-medium text-fg-muted`,children:t.label}),t.apps.map(t=>(0,F.jsxs)(`button`,{type:`button`,role:`menuitem`,className:a,disabled:g,onClick:()=>e(()=>d(t.path)),children:[(0,F.jsx)(I,{app:t}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.name})]},t.path))]},t.label):null):null,r?(0,F.jsxs)(`button`,{type:`button`,role:`menuitem`,className:a,disabled:g||r.disabled,onClick:()=>e(()=>{r.onClick()}),children:[(0,F.jsx)(c,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:p.chooseApp})]}):null,(0,F.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`})]})}return(0,F.jsxs)(`div`,{className:`inline-flex h-9 shrink-0 items-stretch rounded-full border border-edge-subtle bg-surface-panel`,children:[(0,F.jsxs)(`button`,{type:`button`,"aria-label":se,title:se,disabled:g||!m&&!n,onClick:()=>m?d?.(m.path):n?.onClick(),className:v(`inline-flex min-w-0 items-center gap-2 rounded-l-full pl-3 pr-2 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-40`,he.focusRingPanel),children:[h?(0,F.jsx)(ie,{className:`size-5 animate-spin`,"aria-hidden":!0}):(0,F.jsx)(I,{app:m}),(0,F.jsx)(`span`,{children:f===`zh`?`打开`:`Open`})]}),(0,F.jsxs)(be,{modal:!1,children:[(0,F.jsx)(C,{asChild:!0,children:(0,F.jsx)(`button`,{type:`button`,"aria-label":p.chooseApp,title:p.chooseApp,disabled:g,className:v(`inline-flex w-8 shrink-0 items-center justify-center rounded-r-full text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,he.focusRingPanel),children:(0,F.jsx)(u,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})})}),(0,F.jsx)(xe,{children:(0,F.jsxs)(E,{align:`end`,sideOffset:6,collisionPadding:8,"aria-label":p.chooseApp,onEscapeKeyDown:e=>e.stopPropagation(),className:`z-[150] max-h-[var(--radix-dropdown-menu-content-available-height)] w-64 max-w-[calc(100vw-1rem)] overflow-y-auto overscroll-contain rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover outline-none`,children:[n?(0,F.jsxs)(T,{className:ce,disabled:n.disabled||h,onSelect:()=>{ne(null),n.onClick()},children:[(0,F.jsx)(ee,{className:`size-5 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:p.openSystemApp}),m?null:(0,F.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0})]}):null,d?[{label:p.recommendedApps,apps:i},{label:p.recentApps,apps:s.filter(e=>!i.some(t=>t.path===e.path))}].map(e=>e.apps.length?(0,F.jsxs)(w,{children:[(0,F.jsx)(D,{className:_}),(0,F.jsx)(ye,{className:`px-2.5 pb-1 pt-1.5 text-xs font-medium text-fg-muted`,children:e.label}),e.apps.map(e=>(0,F.jsxs)(T,{className:ce,disabled:h,title:e.name,onSelect:()=>{ne(e),d(e.path)},children:[(0,F.jsx)(I,{app:e}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.path===m?.path?(0,F.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]},e.path))]},e.label):null):null,r?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(D,{className:_}),(0,F.jsxs)(T,{className:ce,disabled:r.disabled||h,onSelect:async()=>{ae(!0);try{let e=await r.onClick();e&&ne(e)}finally{ae(!1)}},children:[(0,F.jsx)(c,{className:`size-5 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:p.chooseApp})]})]}):null]})})]})]})}function De(e){let t=(0,P.c)(9),{label:n,active:r,disabled:i,onClick:a,children:o}=e,s=r&&`border-accent/20 bg-accent-soft text-accent-fg`,c;t[0]===s?c=t[1]:(c=v(`inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-edge-subtle bg-surface-panel text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,s,he.focusRingPanel),t[0]=s,t[1]=c);let l;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n||t[6]!==a||t[7]!==c?(l=(0,F.jsx)(`button`,{type:`button`,className:c,title:n,"aria-label":n,"aria-pressed":r,disabled:i,onClick:a,children:o}),t[2]=r,t[3]=o,t[4]=i,t[5]=n,t[6]=a,t[7]=c,t[8]=l):l=t[8],l}function L(e){let t=(0,P.c)(14),{icon:n,label:r,active:i,disabled:a,onClick:o}=e,s=i===void 0?`menuitem`:`menuitemcheckbox`,c;t[0]===n?c=t[1]:(c=(0,F.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center text-fg-muted`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=c);let u;t[2]===r?u=t[3]:(u=(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r}),t[2]=r,t[3]=u);let d;t[4]===i?d=t[5]:(d=i?(0,F.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0}):null,t[4]=i,t[5]=d);let f;return t[6]!==i||t[7]!==a||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==u||t[12]!==d?(f=(0,F.jsxs)(`button`,{type:`button`,role:s,"aria-checked":i,className:`flex h-9 w-full min-w-0 items-center gap-2.5 rounded-md px-2.5 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-40`,disabled:a,onClick:o,children:[c,u,d]}),t[6]=i,t[7]=a,t[8]=o,t[9]=s,t[10]=c,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function R(e){let t=(0,P.c)(90),{referenceActions:n,onRefresh:r,onRetrySave:i,subtitle:s,controller:c,actions:u,expanded:_,onToggleExpanded:le,onClose:ue,hideClose:de,hideExpand:fe,edit:y,wordWrap:b,editInNewChat:x,share:S,openWithSystemApp:ye,chooseApp:be,recommendedApps:C,recentApps:w,onOpenWithApp:xe,onRevealInFolder:T,copyPath:E,textView:D,openInBrowser:k}=e,A;t[0]===n?A=t[1]:(A=n===void 0?[]:n,t[0]=n,t[1]=A);let j=A,M;t[2]===C?M=t[3]:(M=C===void 0?[]:C,t[2]=C,t[3]=M);let Te=M,N;t[4]===w?N=t[5]:(N=w===void 0?[]:w,t[4]=w,t[5]=N);let I=N,R=a(Ae),je;t[6]===R?je=t[7]:(je=o(R),t[6]=R,t[7]=je);let z=je,B=z.workspace,Me=c.plugin.id===`pdf`?z.chat.attachmentPreviewPdf:c.plugin.id===`docx`?z.chat.attachmentPreviewDocument:c.plugin.id===`spreadsheet`?z.chat.attachmentPreviewSpreadsheet:B.preview,Ne;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=_e(),t[8]=Ne):Ne=t[8];let Pe=Ne,V=(0,O.useContext)(we),Fe=(0,O.useRef)(null),Ie=(0,O.useRef)(null),[H,Le]=(0,O.useState)(!1),Re;t[9]===c.plugin.capabilities?Re=t[10]:(Re=c.plugin.capabilities.some(ke),t[9]=c.plugin.capabilities,t[10]=Re);let ze=Re,Be,Ve;t[11]===H?(Be=t[12],Ve=t[13]):(Be=()=>{if(!H)return;Fe.current?.querySelector(`button:not(:disabled), a`)?.focus();let e=e=>{if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&Fe.current?.contains(document.activeElement)){e.preventDefault(),e.stopImmediatePropagation();let t=[...Fe.current.querySelectorAll(`button:not(:disabled), a`)],n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus();return}e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),Le(!1),Ie.current?.focus())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},Ve=[H],t[11]=H,t[12]=Be,t[13]=Ve),(0,O.useEffect)(Be,Ve);let He;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(He=e=>{Le(!1),Ie.current?.focus(),e()},t[14]=He):He=t[14];let U=He,Ue;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=v(`shrink-0 bg-surface-base px-3 py-2 sm:px-4`,ge),t[15]=Ue):Ue=t[15];let W;t[16]===V?W=t[17]:(W=V?(0,F.jsx)(De,{label:V.label,active:V.active,onClick:V.onToggle,children:(0,F.jsx)(Se,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}):null,t[16]=V,t[17]=W);let G;t[18]!==_||t[19]!==fe||t[20]!==B.collapsePreview||t[21]!==B.expandPreview||t[22]!==le?(G=fe?null:(0,F.jsx)(De,{label:_?B.collapsePreview:B.expandPreview,active:_,disabled:!le,onClick:le,children:_?(0,F.jsx)(m,{className:`size-4`,"aria-hidden":!0}):(0,F.jsx)(ae,{className:`size-4`,"aria-hidden":!0})}),t[18]=_,t[19]=fe,t[20]=B.collapsePreview,t[21]=B.expandPreview,t[22]=le,t[23]=G):G=t[23];let K;t[24]===H?K=t[25]:(K=H?(0,F.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 cursor-default bg-transparent`,"aria-hidden":!0,tabIndex:-1,onPointerDown:e=>{e.preventDefault(),Le(!1)}}):null,t[24]=H,t[25]=K);let We;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(We=v(`inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-edge-subtle bg-surface-panel text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,he.focusRingPanel),t[26]=We):We=t[26];let Ge,Ke;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=()=>Le(Oe),Ke=(0,F.jsx)(p,{className:`size-4`}),t[27]=Ge,t[28]=Ke):(Ge=t[27],Ke=t[28]);let q;t[29]!==B.moreActions||t[30]!==H?(q=(0,F.jsx)(`button`,{ref:Ie,type:`button`,className:We,title:B.moreActions,"aria-label":B.moreActions,"aria-haspopup":`menu`,"aria-expanded":H,onClick:Ge,children:Ke}),t[29]=B.moreActions,t[30]=H,t[31]=q):q=t[31];let J;t[32]!==u||t[33]!==be||t[34]!==c.plugin.capabilities||t[35]!==E||t[36]!==y||t[37]!==x||t[38]!==R||t[39]!==B.copyFilePath||t[40]!==B.copyWorkspacePath||t[41]!==B.download||t[42]!==B.edit||t[43]!==B.editInNewChat||t[44]!==B.moreActions||t[45]!==B.openInBrowser||t[46]!==B.pathCopied||t[47]!==B.preview||t[48]!==B.revealInFolder||t[49]!==B.saveCopy||t[50]!==B.shareLink||t[51]!==B.wordWrap||t[52]!==H||t[53]!==xe||t[54]!==r||t[55]!==i||t[56]!==T||t[57]!==k||t[58]!==ye||t[59]!==I||t[60]!==Te||t[61]!==j||t[62]!==S||t[63]!==b?(J=H?(0,F.jsxs)(`div`,{ref:Fe,role:`menu`,"aria-label":B.moreActions,"data-file-preview-menu":!0,className:`absolute right-0 top-full z-50 mt-1 max-h-[min(32rem,calc(100dvh-8rem))] w-60 max-w-[calc(100vw-2rem)] overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,F.jsx)(Ee,{variant:`menu`,onAction:U,systemApp:ye,chooseApp:be,recommendedApps:Te,recentApps:I,onOpenWithApp:xe}),j.map(e=>(0,F.jsx)(L,{icon:(0,F.jsx)(h,{className:`size-4`}),label:e.label,disabled:e.disabled,onClick:()=>U(e.onClick)},e.label)),i?(0,F.jsx)(L,{icon:(0,F.jsx)(ce,{className:`size-4`}),label:R===`zh`?`重试保存`:`Retry save`,onClick:()=>U(i)}):null,r?(0,F.jsx)(L,{icon:(0,F.jsx)(se,{className:`size-4`}),label:R===`zh`?`刷新文件`:`Refresh file`,onClick:()=>U(r)}):null,c.plugin.capabilities.includes(`edit`)?(0,F.jsx)(L,{icon:y?.active?(0,F.jsx)(te,{className:`size-4`}):(0,F.jsx)(g,{className:`size-4`}),label:y?.active?B.preview:B.edit,disabled:!y,onClick:()=>U(()=>y?.onToggle())}):null,b?(0,F.jsx)(L,{icon:(0,F.jsx)(Ce,{className:`size-4`}),label:B.wordWrap,active:b.active,onClick:()=>U(b.onToggle)}):null,(0,F.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}),(0,F.jsx)(L,{icon:x?.loading?(0,F.jsx)(ie,{className:`size-4 animate-spin`}):(0,F.jsx)(oe,{className:`size-4`}),label:B.editInNewChat,disabled:!x||x.disabled||x.loading,onClick:()=>U(()=>x?.onClick())}),(0,F.jsx)(L,{icon:S?.loading?(0,F.jsx)(ie,{className:`size-4 animate-spin`}):(0,F.jsx)(re,{className:`size-4`}),label:B.shareLink,disabled:!S||S.disabled||S.loading,onClick:()=>U(()=>S?.onClick())}),(0,F.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}),k?(0,F.jsxs)(`a`,{href:k.href,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,className:`flex h-9 w-full items-center gap-2.5 rounded-md px-2.5 text-sm text-fg hover:bg-surface-hover`,onClick:()=>Le(!1),children:[(0,F.jsx)(ee,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),B.openInBrowser]}):null,T?(0,F.jsx)(L,{icon:(0,F.jsx)(ne,{className:`size-4`}),label:B.revealInFolder,onClick:()=>U(T)}):null,T?(0,F.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}):null,(0,F.jsx)(L,{icon:(0,F.jsx)(f,{className:`size-4`}),label:Pe?B.saveCopy:B.download,disabled:!u.canDownload,onClick:()=>U(()=>void u.onDownload())}),E?(0,F.jsx)(L,{icon:E.copied?(0,F.jsx)(l,{className:`size-4 text-emerald-500`}):(0,F.jsx)(d,{className:`size-4`}),label:E.copied?B.pathCopied:Pe?B.copyFilePath:B.copyWorkspacePath,onClick:()=>U(E.onClick)}):null]}):null,t[32]=u,t[33]=be,t[34]=c.plugin.capabilities,t[35]=E,t[36]=y,t[37]=x,t[38]=R,t[39]=B.copyFilePath,t[40]=B.copyWorkspacePath,t[41]=B.download,t[42]=B.edit,t[43]=B.editInNewChat,t[44]=B.moreActions,t[45]=B.openInBrowser,t[46]=B.pathCopied,t[47]=B.preview,t[48]=B.revealInFolder,t[49]=B.saveCopy,t[50]=B.shareLink,t[51]=B.wordWrap,t[52]=H,t[53]=xe,t[54]=r,t[55]=i,t[56]=T,t[57]=k,t[58]=ye,t[59]=I,t[60]=Te,t[61]=j,t[62]=S,t[63]=b,t[64]=J):J=t[64];let Y;t[65]!==K||t[66]!==q||t[67]!==J?(Y=(0,F.jsxs)(`div`,{className:`relative shrink-0`,children:[K,q,J]}),t[65]=K,t[66]=q,t[67]=J,t[68]=Y):Y=t[68];let X;t[69]!==de||t[70]!==B.close||t[71]!==ue?(X=de?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`mx-0.5 h-5 w-px bg-edge-subtle`,"aria-hidden":!0}),(0,F.jsx)(De,{label:B.close,onClick:ue,children:(0,F.jsx)(me,{className:`size-4`,strokeWidth:1.75})})]}),t[69]=de,t[70]=B.close,t[71]=ue,t[72]=X):X=t[72];let Z;t[73]!==W||t[74]!==G||t[75]!==Y||t[76]!==X?(Z=(0,F.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:(0,F.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[W,G,Y,X]})}),t[73]=W,t[74]=G,t[75]=Y,t[76]=X,t[77]=Z):Z=t[77];let Q;t[78]===s?Q=t[79]:(Q=s?(0,F.jsx)(`div`,{className:`mt-1.5 flex min-h-4 min-w-0 items-center gap-2 px-3 text-xs leading-4 text-fg-muted`,children:s}):null,t[78]=s,t[79]=Q);let $;t[80]!==c||t[81]!==ze||t[82]!==z.chat||t[83]!==Me||t[84]!==D?($=ze||D?(0,F.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 overflow-x-auto pb-0.5`,children:[D?(0,F.jsx)(ve,{className:`mr-2 flex shrink-0 rounded-lg bg-surface-hover p-0.5`,role:`group`,"aria-label":z.chat.attachmentPreviewText,children:[{active:!1,label:Me},{active:!0,label:z.chat.attachmentPreviewText}].map(e=>(0,F.jsx)(`button`,{type:`button`,"aria-pressed":D.active===e.active,className:v(`rounded-md px-2.5 py-1 text-xs font-medium`,D.active===e.active?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>D.onChange(e.active),children:e.label},e.label))}):null,ze?(0,F.jsx)(pe,{controller:c}):null]}):null,t[80]=c,t[81]=ze,t[82]=z.chat,t[83]=Me,t[84]=D,t[85]=$):$=t[85];let qe;return t[86]!==Z||t[87]!==Q||t[88]!==$?(qe=(0,F.jsxs)(`div`,{"data-workspace-toolbar":!0,className:Ue,children:[Z,Q,$]}),t[86]=Z,t[87]=Q,t[88]=$,t[89]=qe):qe=t[89],qe}function Oe(e){return!e}function ke(e){return[`zoom`,`search`,`rotate`,`pageNavigation`].includes(e)}function Ae(e){return e.language}function je({header:e,chat:t,...n}){let r=(0,O.useRef)(null);(0,O.useEffect)(()=>{let e=r.current;if(!e)return;let t=()=>{let t=fe(n.descriptor.id).scroll;e.querySelectorAll(`[class*="overflow-auto"], [class*="overflow-y-auto"], .cm-scroller`).forEach((e,n)=>{t[n]!=null&&(e.scrollTop=t[n])})},i=requestAnimationFrame(t),a=typeof MutationObserver<`u`?new MutationObserver(t):null;a?.observe(e,{childList:!0,subtree:!0});let o=()=>_(n.descriptor.id,{scroll:[...e.querySelectorAll(`[class*="overflow-auto"], [class*="overflow-y-auto"], .cm-scroller`)].map(e=>e.scrollTop)});return e.addEventListener(`scroll`,o,!0),()=>{cancelAnimationFrame(i),a?.disconnect(),e.removeEventListener(`scroll`,o,!0)}},[n.descriptor.id]);let a=(0,O.useContext)(j),[s,c]=(0,O.useState)(!1),l=de(n.descriptor),u=i(),d=o(n.language),[f,p]=(0,O.useState)(!1),ee=async()=>{if(!(!t||f)){p(!0);try{let[n,r]=await Promise.all([t.createFile(),t.conversationId?y(t.conversationId).catch(()=>null):Promise.resolve(null)]);if(n.size>33554432){S(`warning`,d.chat.attachmentFileTooLarge,{name:n.name,maxSize:b(x)});return}let i=new URLSearchParams({attachmentHandoff:le(n)}),a=t.projectId?.trim()||r?.projectId?.trim(),o=t.agentId?.trim()||r?.routing?.agentId?.trim();a&&i.set(`projectId`,a),u({pathname:`/chat/new`,search:`?${i}`},{state:{forceNewChat:!0,agentId:o||void 0}}),e.onClose()}catch{S(`error`,d.workspace.editInNewChatFailed)}finally{p(!1)}}};return(0,F.jsxs)(`div`,{ref:r,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[(0,F.jsx)(R,{...e,name:n.descriptor.fileName,filePath:n.descriptor.source.kind===`workspace`?n.descriptor.source.path:void 0,controller:l,actions:n.actions,referenceActions:t?a.map(e=>({label:e.label,disabled:s||n.loading||!!n.loadError||t.disabled,onClick:async()=>{if(!s){c(!0);try{let r=await t.createFile(),i=await N(e.id,r);S(i?`success`:`warning`,n.language===`zh`?i?`已添加到目标聊天草稿`:`未能添加附件,请确认目标聊天可用及附件限制`:i?`Added to the target chat draft`:`Could not add attachment. Check the target chat and attachment limits.`)}catch{S(`error`,n.language===`zh`?`文件引用失败,原草稿已保留`:`Could not reference file. Your draft is retained.`)}finally{c(!1)}}}})):void 0,editInNewChat:t?{onClick:()=>void ee(),loading:f,disabled:n.loading||!!n.loadError||t.disabled}:void 0},n.descriptor.id),(0,F.jsx)(ue,{...n,controller:l})]})}function z(e,t){let n=(0,P.c)(7),r=e===void 0||e,i=t!==void 0&&t,[a,o]=(0,O.useState)(!1);!r&&a&&o(!1);let s,c;n[0]!==r||n[1]!==i||n[2]!==a?(s=()=>{if(!r||!a)return;let e=document.body.style.overflow;document.body.style.overflow=`hidden`;let t=e=>{i||e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[data-file-preview-menu]`)||(e.preventDefault(),e.stopImmediatePropagation(),o(!1))};return window.addEventListener(`keydown`,t,!0),()=>{document.body.style.overflow=e,window.removeEventListener(`keydown`,t,!0)}},c=[r,a,i],n[0]=r,n[1]=i,n[2]=a,n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,O.useEffect)(s,c);let l;return n[5]===a?l=n[6]:(l={expanded:a,setExpanded:o},n[5]=a,n[6]=l),l}export{k as a,Ce as c,j as i,Se as l,je as n,we as o,Te as r,A as s,z 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{f as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{n as a}from"./locale-store-CHjsq5NR.js";import{t as o}from"./messages-C7QSnTdg.js";import{t as s}from"./createLucideIcon-DPHK1VkS.js";import{t as c}from"./app-window-DXFNqt_0.js";import{t as l}from"./check-DUBLcKHA.js";import{t as u}from"./chevron-down-ccbiQQz_.js";import{t as d}from"./copy-Dv6d4Dvw.js";import{t as f}from"./download-Dk-ZjtO6.js";import{t as p}from"./ellipsis-0k4rZLoy.js";import{t as ee}from"./external-link-DjqjBmc3.js";import{t as te}from"./eye-CABVeTq0.js";import{t as ne}from"./folder-open-CyzJ19I9.js";import{t as re}from"./link-2-D_ZKYUW7.js";import{t as ie}from"./loader-circle-CifKLtgG.js";import{K as ae}from"./markdown-view-ihzUc4ud.js";import{t as oe}from"./message-square-plus-XP0tGdlV.js";import{t as m}from"./minimize-2-DtOGrlpo.js";import{t as h}from"./paperclip-f1HujQY1.js";import{t as g}from"./pencil-DmIY3Oa-.js";import{t as se}from"./refresh-cw-BRlGaq2w.js";import{t as ce}from"./save-DRDABU--.js";import{c as _,i as le,n as ue,r as de,s as fe,t as pe}from"./preview-runtime-C1U57WSM.js";import{t as me}from"./x-B_N4OPjy.js";import{t as v}from"./cn-0WouolD0.js";import{a as y}from"./session-api-CR3NLqvs.js";import{i as b}from"./attachment-utils-core-BPYdUI6y.js";import{t as x}from"./constants-D5Z-mUto.js";import{n as he}from"./interaction-BdhHBbYa.js";import{t as S}from"./composer-notifications-MGKffwC7.js";import{r as ge}from"./app-chrome-BeB4KgOf.js";import{n as _e}from"./electron-env-DHOGevH3.js";import{t as ve}from"./sliding-tab-list-CmcrqRzN.js";import{a as ye,l as be,m as C,n as w,o as xe,r as T,t as E,u as D}from"./dist-DaFr5KMw.js";var Se=s(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),Ce=s(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),O=e(t(),1),k=(0,O.createContext)(null);function A(){return(0,O.useContext)(k)}var j=(0,O.createContext)([]),we=(0,O.createContext)(null),M=new Map;function Te(e,t){return M.set(e,t),()=>{M.get(e)===t&&M.delete(e)}}async function N(e,t){return await M.get(e)?.(t)??!1}var P=n(),F=r();function I(e){let t=(0,P.c)(3),{app:n}=e,[r,i]=(0,O.useState)(),a;return t[0]!==n||t[1]!==r?(a=n?.iconDataUrl&&n.iconDataUrl!==r?(0,F.jsx)(`img`,{src:n.iconDataUrl,alt:``,width:20,height:20,className:`size-5 shrink-0 object-contain`,onError:()=>i(n.iconDataUrl)}):(0,F.jsx)(c,{className:`size-5 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=n,t[1]=r,t[2]=a):a=t[2],a}function Ee({variant:e=`split`,onAction:t,systemApp:n,chooseApp:r,recommendedApps:i,recentApps:s,onOpenWithApp:d}){let f=a(e=>e.language),p=o(f).workspace,[te,ne]=(0,O.useState)(),[re,ae]=(0,O.useState)(!1),oe=[...i,...s],m=d&&te!==null?oe.find(e=>e.path===te?.path)??te??oe[0]:void 0,h=!!(re||n?.loading||r?.loading),g=h||!!n?.disabled,se=m?f===`zh`?`用 ${m.name} 打开`:`Open with ${m.name}`:p.openSystemApp,ce=`flex min-h-9 cursor-default items-center gap-2.5 rounded-md px-2.5 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-40`,_=`my-1 h-px bg-edge-subtle`;if(!n&&!r&&(!d||!oe.length))return null;if(e===`menu`){let e=e=>t?t(e):e(),a=`flex min-h-9 w-full items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-40`;return(0,F.jsxs)(F.Fragment,{children:[n?(0,F.jsxs)(`button`,{type:`button`,role:`menuitem`,className:a,disabled:g,onClick:()=>e(n.onClick),children:[(0,F.jsx)(ee,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:p.openSystemApp})]}):null,d?[{label:p.recommendedApps,apps:i},{label:p.recentApps,apps:s.filter(e=>!i.some(t=>t.path===e.path))}].map(t=>t.apps.length?(0,F.jsxs)(`div`,{role:`group`,"aria-label":t.label,children:[(0,F.jsx)(`div`,{className:`px-2.5 pb-1 pt-1.5 text-xs font-medium text-fg-muted`,children:t.label}),t.apps.map(t=>(0,F.jsxs)(`button`,{type:`button`,role:`menuitem`,className:a,disabled:g,onClick:()=>e(()=>d(t.path)),children:[(0,F.jsx)(I,{app:t}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.name})]},t.path))]},t.label):null):null,r?(0,F.jsxs)(`button`,{type:`button`,role:`menuitem`,className:a,disabled:g||r.disabled,onClick:()=>e(()=>{r.onClick()}),children:[(0,F.jsx)(c,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:p.chooseApp})]}):null,(0,F.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`})]})}return(0,F.jsxs)(`div`,{className:`inline-flex h-9 shrink-0 items-stretch rounded-full border border-edge-subtle bg-surface-panel`,children:[(0,F.jsxs)(`button`,{type:`button`,"aria-label":se,title:se,disabled:g||!m&&!n,onClick:()=>m?d?.(m.path):n?.onClick(),className:v(`inline-flex min-w-0 items-center gap-2 rounded-l-full pl-3 pr-2 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-40`,he.focusRingPanel),children:[h?(0,F.jsx)(ie,{className:`size-5 animate-spin`,"aria-hidden":!0}):(0,F.jsx)(I,{app:m}),(0,F.jsx)(`span`,{children:f===`zh`?`打开`:`Open`})]}),(0,F.jsxs)(be,{modal:!1,children:[(0,F.jsx)(C,{asChild:!0,children:(0,F.jsx)(`button`,{type:`button`,"aria-label":p.chooseApp,title:p.chooseApp,disabled:g,className:v(`inline-flex w-8 shrink-0 items-center justify-center rounded-r-full text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,he.focusRingPanel),children:(0,F.jsx)(u,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})})}),(0,F.jsx)(xe,{children:(0,F.jsxs)(E,{align:`end`,sideOffset:6,collisionPadding:8,"aria-label":p.chooseApp,onEscapeKeyDown:e=>e.stopPropagation(),className:`z-[150] max-h-[var(--radix-dropdown-menu-content-available-height)] w-64 max-w-[calc(100vw-1rem)] overflow-y-auto overscroll-contain rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover outline-none`,children:[n?(0,F.jsxs)(T,{className:ce,disabled:n.disabled||h,onSelect:()=>{ne(null),n.onClick()},children:[(0,F.jsx)(ee,{className:`size-5 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:p.openSystemApp}),m?null:(0,F.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0})]}):null,d?[{label:p.recommendedApps,apps:i},{label:p.recentApps,apps:s.filter(e=>!i.some(t=>t.path===e.path))}].map(e=>e.apps.length?(0,F.jsxs)(w,{children:[(0,F.jsx)(D,{className:_}),(0,F.jsx)(ye,{className:`px-2.5 pb-1 pt-1.5 text-xs font-medium text-fg-muted`,children:e.label}),e.apps.map(e=>(0,F.jsxs)(T,{className:ce,disabled:h,title:e.name,onSelect:()=>{ne(e),d(e.path)},children:[(0,F.jsx)(I,{app:e}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.path===m?.path?(0,F.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]},e.path))]},e.label):null):null,r?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(D,{className:_}),(0,F.jsxs)(T,{className:ce,disabled:r.disabled||h,onSelect:async()=>{ae(!0);try{let e=await r.onClick();e&&ne(e)}finally{ae(!1)}},children:[(0,F.jsx)(c,{className:`size-5 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:p.chooseApp})]})]}):null]})})]})]})}function De(e){let t=(0,P.c)(9),{label:n,active:r,disabled:i,onClick:a,children:o}=e,s=r&&`border-accent/20 bg-accent-soft text-accent-fg`,c;t[0]===s?c=t[1]:(c=v(`inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-edge-subtle bg-surface-panel text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,s,he.focusRingPanel),t[0]=s,t[1]=c);let l;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n||t[6]!==a||t[7]!==c?(l=(0,F.jsx)(`button`,{type:`button`,className:c,title:n,"aria-label":n,"aria-pressed":r,disabled:i,onClick:a,children:o}),t[2]=r,t[3]=o,t[4]=i,t[5]=n,t[6]=a,t[7]=c,t[8]=l):l=t[8],l}function L(e){let t=(0,P.c)(14),{icon:n,label:r,active:i,disabled:a,onClick:o}=e,s=i===void 0?`menuitem`:`menuitemcheckbox`,c;t[0]===n?c=t[1]:(c=(0,F.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center text-fg-muted`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=c);let u;t[2]===r?u=t[3]:(u=(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r}),t[2]=r,t[3]=u);let d;t[4]===i?d=t[5]:(d=i?(0,F.jsx)(l,{className:`size-4 shrink-0`,"aria-hidden":!0}):null,t[4]=i,t[5]=d);let f;return t[6]!==i||t[7]!==a||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==u||t[12]!==d?(f=(0,F.jsxs)(`button`,{type:`button`,role:s,"aria-checked":i,className:`flex h-9 w-full min-w-0 items-center gap-2.5 rounded-md px-2.5 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-40`,disabled:a,onClick:o,children:[c,u,d]}),t[6]=i,t[7]=a,t[8]=o,t[9]=s,t[10]=c,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function R(e){let t=(0,P.c)(90),{referenceActions:n,onRefresh:r,onRetrySave:i,subtitle:s,controller:c,actions:u,expanded:_,onToggleExpanded:le,onClose:ue,hideClose:de,hideExpand:fe,edit:y,wordWrap:b,editInNewChat:x,share:S,openWithSystemApp:ye,chooseApp:be,recommendedApps:C,recentApps:w,onOpenWithApp:xe,onRevealInFolder:T,copyPath:E,textView:D,openInBrowser:k}=e,A;t[0]===n?A=t[1]:(A=n===void 0?[]:n,t[0]=n,t[1]=A);let j=A,M;t[2]===C?M=t[3]:(M=C===void 0?[]:C,t[2]=C,t[3]=M);let Te=M,N;t[4]===w?N=t[5]:(N=w===void 0?[]:w,t[4]=w,t[5]=N);let I=N,R=a(Ae),je;t[6]===R?je=t[7]:(je=o(R),t[6]=R,t[7]=je);let z=je,B=z.workspace,Me=c.plugin.id===`pdf`?z.chat.attachmentPreviewPdf:c.plugin.id===`docx`?z.chat.attachmentPreviewDocument:c.plugin.id===`spreadsheet`?z.chat.attachmentPreviewSpreadsheet:B.preview,Ne;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=_e(),t[8]=Ne):Ne=t[8];let Pe=Ne,V=(0,O.useContext)(we),Fe=(0,O.useRef)(null),Ie=(0,O.useRef)(null),[H,Le]=(0,O.useState)(!1),Re;t[9]===c.plugin.capabilities?Re=t[10]:(Re=c.plugin.capabilities.some(ke),t[9]=c.plugin.capabilities,t[10]=Re);let ze=Re,Be,Ve;t[11]===H?(Be=t[12],Ve=t[13]):(Be=()=>{if(!H)return;Fe.current?.querySelector(`button:not(:disabled), a`)?.focus();let e=e=>{if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&Fe.current?.contains(document.activeElement)){e.preventDefault(),e.stopImmediatePropagation();let t=[...Fe.current.querySelectorAll(`button:not(:disabled), a`)],n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus();return}e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),Le(!1),Ie.current?.focus())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},Ve=[H],t[11]=H,t[12]=Be,t[13]=Ve),(0,O.useEffect)(Be,Ve);let He;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(He=e=>{Le(!1),Ie.current?.focus(),e()},t[14]=He):He=t[14];let U=He,Ue;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=v(`shrink-0 bg-surface-base px-3 py-2 sm:px-4`,ge),t[15]=Ue):Ue=t[15];let W;t[16]===V?W=t[17]:(W=V?(0,F.jsx)(De,{label:V.label,active:V.active,onClick:V.onToggle,children:(0,F.jsx)(Se,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}):null,t[16]=V,t[17]=W);let G;t[18]!==_||t[19]!==fe||t[20]!==B.collapsePreview||t[21]!==B.expandPreview||t[22]!==le?(G=fe?null:(0,F.jsx)(De,{label:_?B.collapsePreview:B.expandPreview,active:_,disabled:!le,onClick:le,children:_?(0,F.jsx)(m,{className:`size-4`,"aria-hidden":!0}):(0,F.jsx)(ae,{className:`size-4`,"aria-hidden":!0})}),t[18]=_,t[19]=fe,t[20]=B.collapsePreview,t[21]=B.expandPreview,t[22]=le,t[23]=G):G=t[23];let K;t[24]===H?K=t[25]:(K=H?(0,F.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 cursor-default bg-transparent`,"aria-hidden":!0,tabIndex:-1,onPointerDown:e=>{e.preventDefault(),Le(!1)}}):null,t[24]=H,t[25]=K);let We;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(We=v(`inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-edge-subtle bg-surface-panel text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,he.focusRingPanel),t[26]=We):We=t[26];let Ge,Ke;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=()=>Le(Oe),Ke=(0,F.jsx)(p,{className:`size-4`}),t[27]=Ge,t[28]=Ke):(Ge=t[27],Ke=t[28]);let q;t[29]!==B.moreActions||t[30]!==H?(q=(0,F.jsx)(`button`,{ref:Ie,type:`button`,className:We,title:B.moreActions,"aria-label":B.moreActions,"aria-haspopup":`menu`,"aria-expanded":H,onClick:Ge,children:Ke}),t[29]=B.moreActions,t[30]=H,t[31]=q):q=t[31];let J;t[32]!==u||t[33]!==be||t[34]!==c.plugin.capabilities||t[35]!==E||t[36]!==y||t[37]!==x||t[38]!==R||t[39]!==B.copyFilePath||t[40]!==B.copyWorkspacePath||t[41]!==B.download||t[42]!==B.edit||t[43]!==B.editInNewChat||t[44]!==B.moreActions||t[45]!==B.openInBrowser||t[46]!==B.pathCopied||t[47]!==B.preview||t[48]!==B.revealInFolder||t[49]!==B.saveCopy||t[50]!==B.shareLink||t[51]!==B.wordWrap||t[52]!==H||t[53]!==xe||t[54]!==r||t[55]!==i||t[56]!==T||t[57]!==k||t[58]!==ye||t[59]!==I||t[60]!==Te||t[61]!==j||t[62]!==S||t[63]!==b?(J=H?(0,F.jsxs)(`div`,{ref:Fe,role:`menu`,"aria-label":B.moreActions,"data-file-preview-menu":!0,className:`absolute right-0 top-full z-50 mt-1 max-h-[min(32rem,calc(100dvh-8rem))] w-60 max-w-[calc(100vw-2rem)] overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,F.jsx)(Ee,{variant:`menu`,onAction:U,systemApp:ye,chooseApp:be,recommendedApps:Te,recentApps:I,onOpenWithApp:xe}),j.map(e=>(0,F.jsx)(L,{icon:(0,F.jsx)(h,{className:`size-4`}),label:e.label,disabled:e.disabled,onClick:()=>U(e.onClick)},e.label)),i?(0,F.jsx)(L,{icon:(0,F.jsx)(ce,{className:`size-4`}),label:R===`zh`?`重试保存`:`Retry save`,onClick:()=>U(i)}):null,r?(0,F.jsx)(L,{icon:(0,F.jsx)(se,{className:`size-4`}),label:R===`zh`?`刷新文件`:`Refresh file`,onClick:()=>U(r)}):null,c.plugin.capabilities.includes(`edit`)?(0,F.jsx)(L,{icon:y?.active?(0,F.jsx)(te,{className:`size-4`}):(0,F.jsx)(g,{className:`size-4`}),label:y?.active?B.preview:B.edit,disabled:!y,onClick:()=>U(()=>y?.onToggle())}):null,b?(0,F.jsx)(L,{icon:(0,F.jsx)(Ce,{className:`size-4`}),label:B.wordWrap,active:b.active,onClick:()=>U(b.onToggle)}):null,(0,F.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}),(0,F.jsx)(L,{icon:x?.loading?(0,F.jsx)(ie,{className:`size-4 animate-spin`}):(0,F.jsx)(oe,{className:`size-4`}),label:B.editInNewChat,disabled:!x||x.disabled||x.loading,onClick:()=>U(()=>x?.onClick())}),(0,F.jsx)(L,{icon:S?.loading?(0,F.jsx)(ie,{className:`size-4 animate-spin`}):(0,F.jsx)(re,{className:`size-4`}),label:B.shareLink,disabled:!S||S.disabled||S.loading,onClick:()=>U(()=>S?.onClick())}),(0,F.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}),k?(0,F.jsxs)(`a`,{href:k.href,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,className:`flex h-9 w-full items-center gap-2.5 rounded-md px-2.5 text-sm text-fg hover:bg-surface-hover`,onClick:()=>Le(!1),children:[(0,F.jsx)(ee,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),B.openInBrowser]}):null,T?(0,F.jsx)(L,{icon:(0,F.jsx)(ne,{className:`size-4`}),label:B.revealInFolder,onClick:()=>U(T)}):null,T?(0,F.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}):null,(0,F.jsx)(L,{icon:(0,F.jsx)(f,{className:`size-4`}),label:Pe?B.saveCopy:B.download,disabled:!u.canDownload,onClick:()=>U(()=>void u.onDownload())}),E?(0,F.jsx)(L,{icon:E.copied?(0,F.jsx)(l,{className:`size-4 text-emerald-500`}):(0,F.jsx)(d,{className:`size-4`}),label:E.copied?B.pathCopied:Pe?B.copyFilePath:B.copyWorkspacePath,onClick:()=>U(E.onClick)}):null]}):null,t[32]=u,t[33]=be,t[34]=c.plugin.capabilities,t[35]=E,t[36]=y,t[37]=x,t[38]=R,t[39]=B.copyFilePath,t[40]=B.copyWorkspacePath,t[41]=B.download,t[42]=B.edit,t[43]=B.editInNewChat,t[44]=B.moreActions,t[45]=B.openInBrowser,t[46]=B.pathCopied,t[47]=B.preview,t[48]=B.revealInFolder,t[49]=B.saveCopy,t[50]=B.shareLink,t[51]=B.wordWrap,t[52]=H,t[53]=xe,t[54]=r,t[55]=i,t[56]=T,t[57]=k,t[58]=ye,t[59]=I,t[60]=Te,t[61]=j,t[62]=S,t[63]=b,t[64]=J):J=t[64];let Y;t[65]!==K||t[66]!==q||t[67]!==J?(Y=(0,F.jsxs)(`div`,{className:`relative shrink-0`,children:[K,q,J]}),t[65]=K,t[66]=q,t[67]=J,t[68]=Y):Y=t[68];let X;t[69]!==de||t[70]!==B.close||t[71]!==ue?(X=de?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`mx-0.5 h-5 w-px bg-edge-subtle`,"aria-hidden":!0}),(0,F.jsx)(De,{label:B.close,onClick:ue,children:(0,F.jsx)(me,{className:`size-4`,strokeWidth:1.75})})]}),t[69]=de,t[70]=B.close,t[71]=ue,t[72]=X):X=t[72];let Z;t[73]!==W||t[74]!==G||t[75]!==Y||t[76]!==X?(Z=(0,F.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:(0,F.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[W,G,Y,X]})}),t[73]=W,t[74]=G,t[75]=Y,t[76]=X,t[77]=Z):Z=t[77];let Q;t[78]===s?Q=t[79]:(Q=s?(0,F.jsx)(`div`,{className:`mt-1.5 flex min-h-4 min-w-0 items-center gap-2 px-3 text-xs leading-4 text-fg-muted`,children:s}):null,t[78]=s,t[79]=Q);let $;t[80]!==c||t[81]!==ze||t[82]!==z.chat||t[83]!==Me||t[84]!==D?($=ze||D?(0,F.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 overflow-x-auto pb-0.5`,children:[D?(0,F.jsx)(ve,{className:`mr-2 flex shrink-0 rounded-lg bg-surface-hover p-0.5`,role:`group`,"aria-label":z.chat.attachmentPreviewText,children:[{active:!1,label:Me},{active:!0,label:z.chat.attachmentPreviewText}].map(e=>(0,F.jsx)(`button`,{type:`button`,"aria-pressed":D.active===e.active,className:v(`rounded-md px-2.5 py-1 text-xs font-medium`,D.active===e.active?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>D.onChange(e.active),children:e.label},e.label))}):null,ze?(0,F.jsx)(pe,{controller:c}):null]}):null,t[80]=c,t[81]=ze,t[82]=z.chat,t[83]=Me,t[84]=D,t[85]=$):$=t[85];let qe;return t[86]!==Z||t[87]!==Q||t[88]!==$?(qe=(0,F.jsxs)(`div`,{"data-workspace-toolbar":!0,className:Ue,children:[Z,Q,$]}),t[86]=Z,t[87]=Q,t[88]=$,t[89]=qe):qe=t[89],qe}function Oe(e){return!e}function ke(e){return[`zoom`,`search`,`rotate`,`pageNavigation`].includes(e)}function Ae(e){return e.language}function je({header:e,chat:t,...n}){let r=(0,O.useRef)(null);(0,O.useEffect)(()=>{let e=r.current;if(!e)return;let t=()=>{let t=fe(n.descriptor.id).scroll;e.querySelectorAll(`[class*="overflow-auto"], [class*="overflow-y-auto"], .cm-scroller`).forEach((e,n)=>{t[n]!=null&&(e.scrollTop=t[n])})},i=requestAnimationFrame(t),a=typeof MutationObserver<`u`?new MutationObserver(t):null;a?.observe(e,{childList:!0,subtree:!0});let o=()=>_(n.descriptor.id,{scroll:[...e.querySelectorAll(`[class*="overflow-auto"], [class*="overflow-y-auto"], .cm-scroller`)].map(e=>e.scrollTop)});return e.addEventListener(`scroll`,o,!0),()=>{cancelAnimationFrame(i),a?.disconnect(),e.removeEventListener(`scroll`,o,!0)}},[n.descriptor.id]);let a=(0,O.useContext)(j),[s,c]=(0,O.useState)(!1),l=de(n.descriptor),u=i(),d=o(n.language),[f,p]=(0,O.useState)(!1),ee=async()=>{if(!(!t||f)){p(!0);try{let[n,r]=await Promise.all([t.createFile(),t.conversationId?y(t.conversationId).catch(()=>null):Promise.resolve(null)]);if(n.size>33554432){S(`warning`,d.chat.attachmentFileTooLarge,{name:n.name,maxSize:b(x)});return}let i=new URLSearchParams({attachmentHandoff:le(n)}),a=t.projectId?.trim()||r?.projectId?.trim(),o=t.agentId?.trim()||r?.routing?.agentId?.trim();a&&i.set(`projectId`,a),u({pathname:`/chat/new`,search:`?${i}`},{state:{forceNewChat:!0,agentId:o||void 0}}),e.onClose()}catch{S(`error`,d.workspace.editInNewChatFailed)}finally{p(!1)}}};return(0,F.jsxs)(`div`,{ref:r,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[(0,F.jsx)(R,{...e,name:n.descriptor.fileName,filePath:n.descriptor.source.kind===`workspace`?n.descriptor.source.path:void 0,controller:l,actions:n.actions,referenceActions:t?a.map(e=>({label:e.label,disabled:s||n.loading||!!n.loadError||t.disabled,onClick:async()=>{if(!s){c(!0);try{let r=await t.createFile(),i=await N(e.id,r);S(i?`success`:`warning`,n.language===`zh`?i?`已添加到目标聊天草稿`:`未能添加附件,请确认目标聊天可用及附件限制`:i?`Added to the target chat draft`:`Could not add attachment. Check the target chat and attachment limits.`)}catch{S(`error`,n.language===`zh`?`文件引用失败,原草稿已保留`:`Could not reference file. Your draft is retained.`)}finally{c(!1)}}}})):void 0,editInNewChat:t?{onClick:()=>void ee(),loading:f,disabled:n.loading||!!n.loadError||t.disabled}:void 0},n.descriptor.id),(0,F.jsx)(ue,{...n,controller:l})]})}function z(e,t){let n=(0,P.c)(7),r=e===void 0||e,i=t!==void 0&&t,[a,o]=(0,O.useState)(!1);!r&&a&&o(!1);let s,c;n[0]!==r||n[1]!==i||n[2]!==a?(s=()=>{if(!r||!a)return;let e=document.body.style.overflow;document.body.style.overflow=`hidden`;let t=e=>{i||e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[data-file-preview-menu]`)||(e.preventDefault(),e.stopImmediatePropagation(),o(!1))};return window.addEventListener(`keydown`,t,!0),()=>{document.body.style.overflow=e,window.removeEventListener(`keydown`,t,!0)}},c=[r,a,i],n[0]=r,n[1]=i,n[2]=a,n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,O.useEffect)(s,c);let l;return n[5]===a?l=n[6]:(l={expanded:a,setExpanded:o},n[5]=a,n[6]=l),l}export{k as a,Ce as c,j as i,Se as l,je as n,we as o,Te as r,A as s,z as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,l as i,o as a}from"./locale-store-CHjsq5NR.js";import{t as o}from"./createLucideIcon-DPHK1VkS.js";import{I as s}from"./chat-page-D7l_0kTV.js";import{i as c,t as l}from"./vendor-swr-CdRzEUwF.js";import{c as u}from"./composer-payload-handoff-ClWsunJ2.js";var d=o(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),f=n(),p=e(t(),1),m=10;function h(e){return r(`/api/personal-agent/activity?view=work&limit=${m}&offset=${e}`)}async function g([e]){return(await a(e)).payload}function _(e){let t=(0,f.c)(3),n=i(v),r;return t[0]!==e||t[1]!==n?(r=e?[h(0),e,n]:null,t[0]=e,t[1]=n,t[2]=r):r=t[2],c(r,g)}function v(e){return e.conversationId}function y(e,t,n){let r=(0,f.c)(36),a=i(S),[o,s]=(0,p.useState)(!1),c=t?.total??0,u;r[0]!==a||r[1]!==e||r[2]!==o||r[3]!==c?(u=(t,n)=>{let r=(t+1)*m;return!o||r>=c||n&&n.items.length<m?null:[h(r),e,a]},r[0]=a,r[1]=e,r[2]=o,r[3]=c,r[4]=u):u=r[4];let d;r[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateFirstPage:!1,shouldRetryOnError:!1},r[5]=d):d=r[5];let{data:_,error:v,isValidating:y,size:C,setSize:w,mutate:T}=l(u,g,d),E;r[6]!==t?.items||r[7]!==c?(E=JSON.stringify([c,t?.items.map(x)]),r[6]=t?.items,r[7]=c,r[8]=E):E=r[8];let D=E,O=(0,p.useRef)(D),k,A;r[9]!==D||r[10]!==T||r[11]!==o?(k=()=>{let e=O.current!==D;O.current=D,e&&o&&T()},A=[D,T,o],r[9]=D,r[10]=T,r[11]=o,r[12]=k,r[13]=A):(k=r[12],A=r[13]),(0,p.useEffect)(k,A);let j=_?.length??0,M;r[14]!==_||r[15]!==j||r[16]!==c?(M=(j+1)*m<c&&(j===0||_?.at(-1)?.items.length===m),r[14]=_,r[15]=j,r[16]=c,r[17]=M):M=r[17];let N=M,P=o&&!v&&N&&(y||C>j),F;r[18]!==w||r[19]!==C||r[20]!==o?(F=()=>{o?w(C+1):s(!0)},r[18]=w,r[19]=C,r[20]=o,r[21]=F):F=r[21];let I=F,L;r[22]===t?.items?L=r[23]:(L=t?.items??[],r[22]=t?.items,r[23]=L);let R;r[24]!==_||r[25]!==L?(R=[...L,...(_??[]).flatMap(b)],r[24]=_,r[25]=L,r[26]=R):R=r[26];let z=n?v:void 0,B=n&&N,V=n&&P,H;r[27]===T?H=r[28]:(H=()=>void T(),r[27]=T,r[28]=H);let U;return r[29]!==I||r[30]!==B||r[31]!==V||r[32]!==H||r[33]!==R||r[34]!==z?(U={items:R,error:z,hasMore:B,loading:V,loadMore:I,retry:H},r[29]=I,r[30]=B,r[31]=V,r[32]=H,r[33]=R,r[34]=z,r[35]=U):U=r[35],U}function b(e){return e.items}function x(e){return e.id}function S(e){return e.conversationId}function C(e){let t=(0,f.c)(6),n=i(T),a=`/api/sessions/${encodeURIComponent(e??``)}/clarification`,o;t[0]===a?o=t[1]:(o=r(a),t[0]=a,t[1]=o);let s=o,l;return t[2]!==e||t[3]!==n||t[4]!==s?(l=e?[s,e,n]:null,t[2]=e,t[3]=n,t[4]=s,t[5]=l):l=t[5],c(l,w)}async function w(e){let[t]=e;return(await a(t)).payload?.clarification??null}function T(e){return e.conversationId}function E(e){return!!e.attention||e.presentation.status===`needsUser`||e.presentation.status===`review`}function D(e,t,n){let r=(0,f.c)(5),i,a;r[0]!==e||r[1]!==n||r[2]!==t?(i=()=>{if(!e)return;let r,i=()=>{window.clearTimeout(r),r=window.setTimeout(()=>{Promise.allSettled([t(),n?.()])},120)},a=[`task-changed-v2`,`task-updated`,`clarification-updated`,`gateway-realtime-connected`],o=t=>{t.detail?.key===e&&i()};a.forEach(e=>window.addEventListener(e,i)),window.addEventListener(`session-transcript-updated`,o);let s=window.setInterval(()=>{document.visibilityState===`visible`&&i()},15e3);return()=>{window.clearTimeout(r),window.clearInterval(s),a.forEach(e=>window.removeEventListener(e,i)),window.removeEventListener(`session-transcript-updated`,o)}},a=[e,t,n],r[0]=e,r[1]=n,r[2]=t,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,p.useEffect)(i,a)}function O(e,t){let n=(0,f.c)(5),r=(0,p.useRef)(null),i=(0,p.useRef)(null),a,o;n[0]!==e||n[1]!==t?(a=()=>{let n=r.current,a=i.current;if(!e||!n||!a||typeof IntersectionObserver>`u`)return;let o=new IntersectionObserver(e=>{e.some(k)&&t()},{root:n,rootMargin:`0px 0px 120px`});return o.observe(a),()=>o.disconnect()},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,p.useEffect)(a,o);let s;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={listRef:r,loadMoreRef:i},n[4]=s):s=n[4],s}function k(e){return e.isIntersecting}function A(e){return e?.status===`open`&&(e.expiresAt===void 0||e.expiresAt>Date.now())}function j(e,t){let{status:n}=e.presentation,r=n===`failed`?`bg-danger`:[`needsUser`,`review`,`waiting`,`blocked`,`paused`].includes(n)?`bg-warning`:[`running`,`verifying`,`completed`].includes(n)?`bg-accent`:`bg-fg-subtle`;return[u(t?`zh`:`en`).detailStatuses[n],r]}function M(e,t){let n=(0,f.c)(26),r;n[0]===e?r=n[1]:(r=t=>e?t.runs[e]:void 0,n[0]=e,n[1]=r);let i=s(r),{data:a,mutate:o,error:c}=_(e),{data:l,mutate:u,error:d}=C(e),m,h,g,v;if(n[2]!==l||n[3]!==a?.current){m=a?.current??[];let e=m.filter(E);v=e.length,h=Number,g=A(l)&&!e.some(e=>e.prompt?.id===l.id),n[2]=l,n[3]=a?.current,n[4]=m,n[5]=h,n[6]=g,n[7]=v}else m=n[4],h=n[5],g=n[6],v=n[7];let y=v+h(g),b;n[8]===m?b=n[9]:(b=m.filter(F),n[8]=m,n[9]=b);let x=b,S;n[10]===m?S=n[11]:(S=m.filter(P),n[10]=m,n[11]=S);let w=S,T;n[12]===a?.items?T=n[13]:(T=a?.items.find(N)?.updatedAt,n[12]=a?.items,n[13]=T);let D=T,[O,k]=(0,p.useState)(),j,M;n[14]===D?(j=n[15],M=n[16]):(j=()=>{if(D===void 0)return;let e=D+4e3-Date.now();if(e<=0)return;k(D);let t=window.setTimeout(()=>k(void 0),e);return()=>window.clearTimeout(t)},M=[D],n[14]=D,n[15]=j,n[16]=M),(0,p.useEffect)(j,M);let I=O!==void 0&&O===D,L=y?`waiting`:x.length||w.length||i?.status===`running`?`working`:i?.status===`waiting`?`waiting`:I?`delivered`:`idle`,R=``;y?R=t?`有 ${y} 项待你处理`:`${y} to review`:x.length>1?R=t?`有 ${x.length} 项正在推进`:`${x.length} in progress`:x[0]?R=t?`正在推进 · ${x[0].title}`:`Working · ${x[0].title}`:i?.status===`running`?R=t?`正在回复`:`Responding`:w.length?R=t?`有 ${w.length} 项等待开始`:`${w.length} queued`:i?.status===`waiting`?R=t?`等待继续`:`Waiting to resume`:I?R=t?`刚刚完成交付`:`Just delivered`:(c||d)&&(R=t?`暂时无法更新状态`:`Status unavailable`);let z;return n[17]!==y||n[18]!==L||n[19]!==l||n[20]!==u||n[21]!==o||n[22]!==R||n[23]!==a||n[24]!==c?(z={work:a,workError:c,prompt:l,avatarState:L,summary:R,attentionCount:y,refreshWork:o,refreshPrompt:u},n[17]=y,n[18]=L,n[19]=l,n[20]=u,n[21]=o,n[22]=R,n[23]=a,n[24]=c,n[25]=z):z=n[25],z}function N(e){return e.resolution===`done`}function P(e){return e.operationalState===`queued`||e.operationalState===`allocating`}function F(e){return e.operationalState===`running`||e.operationalState===`verifying`}export{y as a,d as c,O as i,E as n,M as o,j as r,D as s,A as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,l as i,o as a}from"./locale-store-CHjsq5NR.js";import{t as o}from"./createLucideIcon-DPHK1VkS.js";import{I as s}from"./chat-page-LOR5JxDh.js";import{i as c,t as l}from"./vendor-swr-CdRzEUwF.js";import{c as u}from"./composer-payload-handoff-ClWsunJ2.js";var d=o(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),f=n(),p=e(t(),1),m=10;function h(e){return r(`/api/personal-agent/activity?view=work&limit=${m}&offset=${e}`)}async function g([e]){return(await a(e)).payload}function _(e){let t=(0,f.c)(3),n=i(v),r;return t[0]!==e||t[1]!==n?(r=e?[h(0),e,n]:null,t[0]=e,t[1]=n,t[2]=r):r=t[2],c(r,g)}function v(e){return e.conversationId}function y(e,t,n){let r=(0,f.c)(36),a=i(S),[o,s]=(0,p.useState)(!1),c=t?.total??0,u;r[0]!==a||r[1]!==e||r[2]!==o||r[3]!==c?(u=(t,n)=>{let r=(t+1)*m;return!o||r>=c||n&&n.items.length<m?null:[h(r),e,a]},r[0]=a,r[1]=e,r[2]=o,r[3]=c,r[4]=u):u=r[4];let d;r[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateFirstPage:!1,shouldRetryOnError:!1},r[5]=d):d=r[5];let{data:_,error:v,isValidating:y,size:C,setSize:w,mutate:T}=l(u,g,d),E;r[6]!==t?.items||r[7]!==c?(E=JSON.stringify([c,t?.items.map(x)]),r[6]=t?.items,r[7]=c,r[8]=E):E=r[8];let D=E,O=(0,p.useRef)(D),k,A;r[9]!==D||r[10]!==T||r[11]!==o?(k=()=>{let e=O.current!==D;O.current=D,e&&o&&T()},A=[D,T,o],r[9]=D,r[10]=T,r[11]=o,r[12]=k,r[13]=A):(k=r[12],A=r[13]),(0,p.useEffect)(k,A);let j=_?.length??0,M;r[14]!==_||r[15]!==j||r[16]!==c?(M=(j+1)*m<c&&(j===0||_?.at(-1)?.items.length===m),r[14]=_,r[15]=j,r[16]=c,r[17]=M):M=r[17];let N=M,P=o&&!v&&N&&(y||C>j),F;r[18]!==w||r[19]!==C||r[20]!==o?(F=()=>{o?w(C+1):s(!0)},r[18]=w,r[19]=C,r[20]=o,r[21]=F):F=r[21];let I=F,L;r[22]===t?.items?L=r[23]:(L=t?.items??[],r[22]=t?.items,r[23]=L);let R;r[24]!==_||r[25]!==L?(R=[...L,...(_??[]).flatMap(b)],r[24]=_,r[25]=L,r[26]=R):R=r[26];let z=n?v:void 0,B=n&&N,V=n&&P,H;r[27]===T?H=r[28]:(H=()=>void T(),r[27]=T,r[28]=H);let U;return r[29]!==I||r[30]!==B||r[31]!==V||r[32]!==H||r[33]!==R||r[34]!==z?(U={items:R,error:z,hasMore:B,loading:V,loadMore:I,retry:H},r[29]=I,r[30]=B,r[31]=V,r[32]=H,r[33]=R,r[34]=z,r[35]=U):U=r[35],U}function b(e){return e.items}function x(e){return e.id}function S(e){return e.conversationId}function C(e){let t=(0,f.c)(6),n=i(T),a=`/api/sessions/${encodeURIComponent(e??``)}/clarification`,o;t[0]===a?o=t[1]:(o=r(a),t[0]=a,t[1]=o);let s=o,l;return t[2]!==e||t[3]!==n||t[4]!==s?(l=e?[s,e,n]:null,t[2]=e,t[3]=n,t[4]=s,t[5]=l):l=t[5],c(l,w)}async function w(e){let[t]=e;return(await a(t)).payload?.clarification??null}function T(e){return e.conversationId}function E(e){return!!e.attention||e.presentation.status===`needsUser`||e.presentation.status===`review`}function D(e,t,n){let r=(0,f.c)(5),i,a;r[0]!==e||r[1]!==n||r[2]!==t?(i=()=>{if(!e)return;let r,i=()=>{window.clearTimeout(r),r=window.setTimeout(()=>{Promise.allSettled([t(),n?.()])},120)},a=[`task-changed-v2`,`task-updated`,`clarification-updated`,`gateway-realtime-connected`],o=t=>{t.detail?.key===e&&i()};a.forEach(e=>window.addEventListener(e,i)),window.addEventListener(`session-transcript-updated`,o);let s=window.setInterval(()=>{document.visibilityState===`visible`&&i()},15e3);return()=>{window.clearTimeout(r),window.clearInterval(s),a.forEach(e=>window.removeEventListener(e,i)),window.removeEventListener(`session-transcript-updated`,o)}},a=[e,t,n],r[0]=e,r[1]=n,r[2]=t,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,p.useEffect)(i,a)}function O(e,t){let n=(0,f.c)(5),r=(0,p.useRef)(null),i=(0,p.useRef)(null),a,o;n[0]!==e||n[1]!==t?(a=()=>{let n=r.current,a=i.current;if(!e||!n||!a||typeof IntersectionObserver>`u`)return;let o=new IntersectionObserver(e=>{e.some(k)&&t()},{root:n,rootMargin:`0px 0px 120px`});return o.observe(a),()=>o.disconnect()},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,p.useEffect)(a,o);let s;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={listRef:r,loadMoreRef:i},n[4]=s):s=n[4],s}function k(e){return e.isIntersecting}function A(e){return e?.status===`open`&&(e.expiresAt===void 0||e.expiresAt>Date.now())}function j(e,t){let{status:n}=e.presentation,r=n===`failed`?`bg-danger`:[`needsUser`,`review`,`waiting`,`blocked`,`paused`].includes(n)?`bg-warning`:[`running`,`verifying`,`completed`].includes(n)?`bg-accent`:`bg-fg-subtle`;return[u(t?`zh`:`en`).detailStatuses[n],r]}function M(e,t){let n=(0,f.c)(26),r;n[0]===e?r=n[1]:(r=t=>e?t.runs[e]:void 0,n[0]=e,n[1]=r);let i=s(r),{data:a,mutate:o,error:c}=_(e),{data:l,mutate:u,error:d}=C(e),m,h,g,v;if(n[2]!==l||n[3]!==a?.current){m=a?.current??[];let e=m.filter(E);v=e.length,h=Number,g=A(l)&&!e.some(e=>e.prompt?.id===l.id),n[2]=l,n[3]=a?.current,n[4]=m,n[5]=h,n[6]=g,n[7]=v}else m=n[4],h=n[5],g=n[6],v=n[7];let y=v+h(g),b;n[8]===m?b=n[9]:(b=m.filter(F),n[8]=m,n[9]=b);let x=b,S;n[10]===m?S=n[11]:(S=m.filter(P),n[10]=m,n[11]=S);let w=S,T;n[12]===a?.items?T=n[13]:(T=a?.items.find(N)?.updatedAt,n[12]=a?.items,n[13]=T);let D=T,[O,k]=(0,p.useState)(),j,M;n[14]===D?(j=n[15],M=n[16]):(j=()=>{if(D===void 0)return;let e=D+4e3-Date.now();if(e<=0)return;k(D);let t=window.setTimeout(()=>k(void 0),e);return()=>window.clearTimeout(t)},M=[D],n[14]=D,n[15]=j,n[16]=M),(0,p.useEffect)(j,M);let I=O!==void 0&&O===D,L=y?`waiting`:x.length||w.length||i?.status===`running`?`working`:i?.status===`waiting`?`waiting`:I?`delivered`:`idle`,R=``;y?R=t?`有 ${y} 项待你处理`:`${y} to review`:x.length>1?R=t?`有 ${x.length} 项正在推进`:`${x.length} in progress`:x[0]?R=t?`正在推进 · ${x[0].title}`:`Working · ${x[0].title}`:i?.status===`running`?R=t?`正在回复`:`Responding`:w.length?R=t?`有 ${w.length} 项等待开始`:`${w.length} queued`:i?.status===`waiting`?R=t?`等待继续`:`Waiting to resume`:I?R=t?`刚刚完成交付`:`Just delivered`:(c||d)&&(R=t?`暂时无法更新状态`:`Status unavailable`);let z;return n[17]!==y||n[18]!==L||n[19]!==l||n[20]!==u||n[21]!==o||n[22]!==R||n[23]!==a||n[24]!==c?(z={work:a,workError:c,prompt:l,avatarState:L,summary:R,attentionCount:y,refreshWork:o,refreshPrompt:u},n[17]=y,n[18]=L,n[19]=l,n[20]=u,n[21]=o,n[22]=R,n[23]=a,n[24]=c,n[25]=z):z=n[25],z}function N(e){return e.resolution===`done`}function P(e){return e.operationalState===`queued`||e.operationalState===`allocating`}function F(e){return e.operationalState===`running`||e.operationalState===`verifying`}export{y as a,d as c,O as i,E as n,M as o,j as r,D as s,A as t};